Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
|---|---|---|
| 137 | Can't we use makeComposedFoldedAffineMin and let it fold the map? | |
| mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
|---|---|---|
| 137 | Thanks for the pointer. Even using makeComposedFoldedAffineMin or makeComposedAffineMin I cannot get rid of the map, but we get better IR with what we have now where the constants are folded into the map. For example, affine_map<(d0)[s0, s1] -> (20, -d0 + s1)> turns to affine_map<(d0) -> (20, -d0 + 300)>. Current IR: #map1 = affine_map<(d0) -> (20, -d0 + 300)>
scf.for %arg4 = %c0 to %c300 step %c20 {
%0 = affine.min #map1(%arg4)
use(%0)
}Do we have something to simplify the map here? As a reference also here we do check if we can avoid the map: https://github.com/llvm/llvm-project/blob/bc32896e9f39c1c64528840d78c8a07aad2ad313/mlir/lib/Dialect/Linalg/Utils/Utils.cpp#L866 | |
| mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
|---|---|---|
| 93 | Take either a Range or just three separate variables to avoid magic number-based access below. | |
| 100–104 | This matching is insufficiently robust, m_Constant is recommended instead. You can also just call getAsOpFoldResult for the stride (offset and size are already available as OpFoldResult at the call side) and dyn_cast those to Attribute. | |
| 137 | I see, you need to be able to reason about the set of induction variable values. Scrap that. | |
| 153 | Note that offset and size are created artificially from an OpFoldResult a couple of lines above. Use that instead and you won't do the redundant work of matching constant operations that you have just created from actual constants. | |
| mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | ||
|---|---|---|
| 100–104 | found getConstantIntValue that does what suggested. | |
Take either a Range or just three separate variables to avoid magic number-based access below.