[Mlir-commits] [mlir] [MLIR][Linalg] Add specialization for linalg.broadcast (PR #104684)

Renato Golin llvmlistbot at llvm.org
Sat Aug 17 14:49:38 PDT 2024


================
@@ -22,13 +22,32 @@
 #include "llvm/ADT/SmallBitVector.h"
 #include "llvm/ADT/SmallVector.h"
 #include <algorithm>
+#include <numeric>
 
 using namespace mlir;
 using namespace mlir::linalg;
 
 /// Include the definitions of the copy operation interface.
 #include "mlir/Dialect/Linalg/IR/LinalgInterfaces.cpp.inc"
 
+namespace {
+/// Check linalg generic with single input output has
+/// body that is just a yield op yielding input value.
+static bool bodyIsJustYieldOp(GenericOp genericOp) {
----------------
rengolin wrote:

Could you perhaps use this mechanism instead?
https://github.com/plaidml/tpp-mlir/blob/main/include/TPP/IR/StructuredOpMatcher.h

We can create a PR to upstream this part, so that we can all use it.

@ftynse any objections?

https://github.com/llvm/llvm-project/pull/104684


More information about the Mlir-commits mailing list