| Issue |
184906
|
| Summary |
[DirectX][SPIRV] Support both row-major and column-major order matrix memory layouts in the SPIR-V and DXIL backends
|
| Labels |
HLSL
|
| Assignees |
|
| Reporter |
Icohedron
|
Currently the [SPIR-V](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/SPIRV/SPIRVCombinerHelper.cpp) and [DirectX](https://github.com/Icohedron/llvm-project/blob/2491daa60da34861eeff2a239b443b984844d6a9/llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp#L1052) backends always assume matrices are in column-major order.
We need to be able to support row-major order matrix memory layouts as well.
How should matrix memory layout information be passed to the backends?
Currently, only the default memory layout for matrices can be changed in Clang from column-major to row-major with the command-line flag `-fmatrix-memory-layout=row-major` or `/Zpr`.
For supporting this alone, we could add a module flag to indicate if the default matrix memory layout is row-major or column-major. Then the lowering of the matrix intrinsics can be adjusted based on the value of the module flag.
If we want to support the `row_major` and `column_major` keywords in the future in Clang HLSL, a module flag will not suffice.
For example, the matrix multiply intrinsic takes two matrices as input, and returns a matrix. The input and outputs could all be of different memory layouts. If we are to have a separate matrix multiply intrinsic implementation for each combination, we would have 8 different variants of matrix multiply.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs