[clang] [llvm] [HLSL][Matrix] Support row-major `transpose` and `mul` by inserting matrix memory layout transformations (PR #186898)
Joshua Batista via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 17 15:55:21 PDT 2026
================
@@ -141,6 +141,22 @@ class MatrixBuilder {
return B.CreateCall(TheFn->getFunctionType(), TheFn, Ops, Name);
}
+ /// Create a column-major matrix from a row-major matrix with the given
+ /// logical dimensions by transposing it.
+ CallInst *CreateRowMajorToColumnMajorTransform(Value *Matrix, unsigned Rows,
+ unsigned Columns,
+ const Twine &Name = "") {
+ return CreateMatrixTranspose(Matrix, Columns, Rows, Name);
+ }
+
+ /// Create a row-major matrix from a column-major matrix with the given
+ /// logical dimensions by transposing it.
+ CallInst *CreateColumnMajorToRowMajorTransform(Value *Matrix, unsigned Rows,
+ unsigned Columns,
+ const Twine &Name = "") {
+ return CreateMatrixTranspose(Matrix, Rows, Columns, Name);
----------------
bob80905 wrote:
I suspect this is a no-op, and Columns and Rows should be swapped as above. That, or this function should be called with swapped row/col parameters, but it is not.
https://github.com/llvm/llvm-project/pull/186898
More information about the cfe-commits
mailing list