[Mlir-commits] [mlir] [mlir][vector] Split `TransposeOpLowering` into 2 patterns (PR #91935)

Andrzej WarzyƄski llvmlistbot at llvm.org
Mon May 13 14:03:43 PDT 2024


banach-space wrote:

> IIRC this is now going to be generating a vector.shape_cast that isnt handled on SPIR-V backends

No, `TransposeOpLowering` _is already generating `vector.shape_cast`_ as demonstrated by these tests: https://github.com/llvm/llvm-project/blob/1fd196c8df8e9fa4e0eddddc92b012824d8d1b0b/mlir/test/Dialect/Vector/vector-transpose-lowering.mlir#L801-L858

In our previous discussion about these patterns, @antiagainst confirmed that those are not a problem for SPIR-V:
> We explicitly control when to perform transpose lowering and thus we can slot the lowering for type_cast in there too.

In any case, let me re-iterate, **this patch does not add any new patterns**, it is merely _moving_ the existing patterns.

> and this pattern is being added to a "generic vector lowering" pattern set

No, this pattern:
*  is _already_ present [within TransposeOpLowering](https://github.com/llvm/llvm-project/blob/1fd196c8df8e9fa4e0eddddc92b012824d8d1b0b/mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp#L337-L353), which
* is _already_ [added to populateVectorTransposeLoweringPatterns](https://github.com/llvm/llvm-project/blob/1fd196c8df8e9fa4e0eddddc92b012824d8d1b0b/mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp#L482-L487).

This PR merely extracts that logic into a separate class, `Transpose2DWithUnitDimToShapeCast`.  The rationale for that is summarised ... in the summary.

https://github.com/llvm/llvm-project/pull/91935


More information about the Mlir-commits mailing list