[Mlir-commits] [mlir] [mlir][linalg] Implement TilingInterface for winograd operators (PR #96184)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jul 19 08:02:21 PDT 2024


================
@@ -2813,6 +2813,100 @@ LogicalResult WinogradInputTransformOp::verify() {
   return success();
 }
 
+SmallVector<Range>
+WinogradInputTransformOp::getIterationDomain(OpBuilder &builder) {
+  Location loc = getLoc();
+  IndexType indexType = builder.getIndexType();
+  IntegerAttr zeroAttr = builder.getIntegerAttr(indexType, 0);
+  IntegerAttr oneAttr = builder.getIntegerAttr(indexType, 1);
+  Value output = getOutput();
+  SmallVector<Range> loopBounds(6);
+  for (unsigned dim = 0; dim < 6; ++dim) {
----------------
Max191 wrote:

It would be better to not have magic numers like this. Instead of using `6` directly, can you use the output operand rank?

You can add some helpers as extraClassDeclarations, similar to in the SoftmaxOp:
https://github.com/llvm/llvm-project/blob/c719d7b390481b095c7498fe75a0bcf60a24bad9/mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td#L139-L153

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


More information about the Mlir-commits mailing list