Repository navigation
Conversation
Lifts a tensor-semantics `iree_codegen.inner_tiled` op to vector semantics by reading each operand with `vector.transfer_read`, replacing the op with a vector-semantics `inner_tiled`, and writing each result back with `vector.transfer_write`. Statically-shaped operands only — the CPU codegen path drives the iteration domain to unit bounds well before this pattern runs. This fills the gap between encoding-materialization (which produces a tensor-semantics inner_tiled) and the existing `DropInnerTiledUnitDimsPattern` + `LowerInnerTiledPattern` (both vector-semantics-only) on the LLVM-CPU side. GPU folds the analogous read/write into its lane-distribution step (`DistributeInnerTiledToLanes`); CPU has no lane distribution so the vectorize step needs to be standalone. Exposes the pattern as `populateVectorizeInnerTiledPatterns` from `Codegen/Common/Transforms.h`, plus a transform-dialect entry point `apply_patterns.iree.vectorize_inner_tiled` so the pattern can be exercised from a lit test. Tested via a single-tile AVX-512 1x16x1 f32 example in TransformExtensions/test/vectorize_inner_tiled.mlir. Signed-off-by: Benoit Jacob <[email protected]> Progress towards #24323
0c7cc32 to
5201935
Compare
|
The UBSan CI failure is #24331 |
hanhanW
left a comment
There was a problem hiding this comment.
I think it is already happening in this implementation:
iree/compiler/src/iree/compiler/Codegen/Interfaces/VectorizableOpInterface.cpp
Lines 1177 to 1284 in 7247601
@sommerlukas we are reaching to the state that your vector size analysis requires inner tiles soon. We now allow inner tiles being dynamic for future SVE/SME/RISC-V work.
Thanks for the heads-up, happy to chat about how this can be supported. Do we also need to track scalable flags then? The pack/unpack operations probably already carry size information for the inner tiles. How do we determine the mapping for inner dimensions, as they're not part of the maps? |
It will be more clear after #24311 is fixed. The rough idea in my mind is using either ValueBound or extended IntRange analysis to get the tiling size, then you can propagate the information. |
|
Thanks @hanhanW for catching this! Closed. |
Lifts a tensor-semantics
iree_codegen.inner_tiledop to vector semantics by reading each operand withvector.transfer_read, replacing the op with a vector-semanticsinner_tiled, and writing each result back withvector.transfer_write. Statically-shaped operands only — the CPU codegen path drives the iteration domain to unit bounds well before this pattern runs.This fills the gap between encoding-materialization (which produces a tensor-semantics inner_tiled) and the existing
DropInnerTiledUnitDimsPattern+LowerInnerTiledPattern(both vector-semantics-only) on the LLVM-CPU side. GPU folds the analogous read/write into its lane-distribution step (DistributeInnerTiledToLanes); CPU has no lane distribution so the vectorize step needs to be standalone.Exposes the pattern as
populateVectorizeInnerTiledPatternsfromCodegen/Common/Transforms.h, plus a transform-dialect entry pointapply_patterns.iree.vectorize_inner_tiledso the pattern can be exercised from a lit test.Tested via a single-tile AVX-512 1x16x1 f32 example in TransformExtensions/test/vectorize_inner_tiled.mlir.
Progress towards #24323