This revision adds support for hoisting "subtensor + vector.transfer_read" / "subtensor_insert + vector.transfer_write pairs" across scf.for.
The unit of hoisting becomes a HoistableRead / HoistableWrite struct which contains a pair of "vector.transfer_read + optional subtensor" / "vector.transfer_write + optional subtensor_insert".
scf::ForOp canonicalization patterns are applied greedily on the successful application of the transformation to cleanup the IR more eagerly and potentially expose more transformation opportunities.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp | ||
---|---|---|
120 | Nit: do you want to also check that ranks are equal (i.e., there's an equal number of offsets, sizes and strides)? zip will only let you check the prefix otherwise | |
271 | It may be defined in the loop and still be loop-invariant, but detecting that sounds like LICM's job. Consider running it before this pass if you aren't already. | |
291 | Even a local constexpr size_t kFirstIndexingPosition = 2 would make it better (ideally, this should move to the op itself) |
Nit: do you want to also check that ranks are equal (i.e., there's an equal number of offsets, sizes and strides)? zip will only let you check the prefix otherwise