[all-commits] [llvm/llvm-project] fc4fed: [HLSL] Codegen column-major matrix initializer lis...
Deric C. via All-commits
all-commits at lists.llvm.org
Fri Mar 13 09:10:49 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fc4fed4d982cef5dddc7568a422d2be430e941d2
https://github.com/llvm/llvm-project/commit/fc4fed4d982cef5dddc7568a422d2be430e941d2
Author: Deric C. <cheung.deric at gmail.com>
Date: 2026-03-13 (Fri, 13 Mar 2026)
Changed paths:
M clang/lib/CodeGen/CGExprScalar.cpp
M clang/test/CodeGenHLSL/BasicFeatures/MatrixConstructor.hlsl
M clang/test/CodeGenHLSL/BasicFeatures/MatrixInitializerListOrder.hlsl
M clang/test/CodeGenHLSL/BasicFeatures/MatrixToAndFromVectorConstructors.hlsl
M clang/test/CodeGenHLSL/BoolMatrix.hlsl
Log Message:
-----------
[HLSL] Codegen column-major matrix initializer lists without a vector shuffle (#186228)
Fixes #185518
The SPIR-V backend does not handle the lowering of `shufflevector`
instructions on vectors with more than 4 elements.
This PR changes the codegen of matrix init lists to directly emit
vectors with elements in column-major order when the default matrix
memory layout is column-major, as opposed to in linear/row-major order
followed by a vector shuffle.
While an alternative fix could be to change the default depth of
[`canEvaluateShuffled`](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp#L1865-L1866)
to 16 in `InstCombineVectorOps.cpp` to eliminate the vector shuffle for
vectors of up to 16 elements in size (to handle 4x4 matrices), this
change would have broader impacts than just HLSL, which does not seem
necessary for the scope of this issue (which regards only matrix
initializer list codegen).
Another alternative fix would be to extend the `shufflevector` lowering
in the SPIR-V backend to support vectors of more than 4 elements.
However, again, this goes beyond the scope of just matrix initializer
list codegen which is so far the only case where a vector shuffle of a
vector more than 4 elements appeared.
Assisted-by: claude-opus-4.6
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list