This implements the last step for lowering vector.contract progressively
to LLVM IR (except for masks). Multi-dimensional reductions that remain
after expanding all parallel dimensions are lowered into into simpler
vector.contract operations until a trivial 1-dim reduction remains.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks good, thanks Aart! One question, is the unrolling here deterministic in that the same op will always produce the same sequence of reductions after unrolling? Context is numerical stability across test runs....
mlir/lib/Dialect/VectorOps/VectorTransforms.cpp | ||
---|---|---|
1031 | Maybe not in this change, but it would be great if this unrolling code could reuse the unrolling code already in this file: mlir::vector::unrollSingleResultOpMatchingType( | |
1070 | s/idx/id.index() don't see 'idx' used elsewhere. |
The order is always the same of a given mapping and op, but the accumulation may indeed introduce instabilities if an exact order is assumed (i.e. acc feeds into the chain rather than being just added at the end). We can make semantics more strict if needed.
mlir/lib/Dialect/VectorOps/VectorTransforms.cpp | ||
---|---|---|
1031 | Ack. | |
1070 | This was actually done on purpose to avoid having to cast one to the type of the other (to avoid compiler complaints about sign). |
mlir/lib/Dialect/VectorOps/VectorTransforms.cpp | ||
---|---|---|
1070 | nit: Please remove trivial braces. Also can you just inline the 'idx' variable into its use? |
Maybe not in this change, but it would be great if this unrolling code could reuse the unrolling code already in this file: mlir::vector::unrollSingleResultOpMatchingType(