While The tiling interface provides a mechanism for operations to be
tiled into tiled version of the op (or another op at the same level of
abstraction), the generateScalarImplementation method added here is
the "exit point" after all transformations have been done. Ops that
implement this method are expected to generate IR that are directly
lowerable to backend dialects like LLVM or SPIR-V dialects.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Interfaces/TilingInterface.td | ||
---|---|---|
177 | ||
179 | ||
mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp | ||
33–41 | Nit: makeComposedFoldedMultiResultAffineApply does this + folding (IIUC, it will avoid emitting the map if it is only a permutation), if desired. | |
47 | ValueRange | |
60 | Nit: I'd rather take the location of the terminator since we are emitting its equivalent. | |
61 | Nit: it doesn't look necessary to use OpOperand, getOperands should do fine here. | |
mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
507 | Ultra-nit. | |
516–518 | Note that the switch of Range to use OpFoldResult has landed so you may need to materialize them here. | |
mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir | ||
66–78 | Why this is a DAG? We should have a well-defined order for these. |
Address comments.
mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp | ||
---|---|---|
33–41 | I tried this, but I hit the same issue as what is being fixed by https://reviews.llvm.org/D130616 which I think has other issues. Left it as is for now. I am happy to fix this later on after your patch lands. | |
mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
516–518 | Thanks! Btw, it would be really nice if scf.for could allow use of OpFoldResult for lb, ub, and step. I think this is one of the major switch points remaining. |
LGTM as long as the CHECK-DAG is sorted out.
mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
---|---|---|
516–518 | This would require making the SCF dialect dependent on the Arithmetic dialect to materialize constants, which sounds unfortunate to me. Maybe we can have a helper function that builds the "for" separately in some util library. |
mlir/test/Interfaces/TilingInterface/lower-to-loops-using-interface.mlir | ||
---|---|---|
66–78 | Force of habit. Will change to CHECK. |