llvm-project
87e8e7d8 - [SPIRV] Implement lowering for llvm.matrix.transpose and llvm.matrix.multiply (#172050)

Commit
21 days ago
[SPIRV] Implement lowering for llvm.matrix.transpose and llvm.matrix.multiply (#172050) This patch implements the lowering for the llvm.matrix.transpose and llvm.matrix.multiply intrinsics in the SPIR-V backend. - llvm.matrix.transpose is lowered to a G_SHUFFLE_VECTOR with a mask calculated to transpose the elements. - llvm.matrix.multiply is lowered by decomposing the operation into dot products of rows and columns: - Rows and columns are extracted using G_UNMERGE_VALUES or shuffles. - Dot products are computed using OpDot for floating point vectors or standard arithmetic for scalars/integers. - The result is reconstructed using G_BUILD_VECTOR. This change also updates SPIRVPostLegalizer to improve type deduction for G_UNMERGE_VALUES, enabling correct type assignment for the intermediate virtual registers generated during lowering. New tests are added to verify support for various matrix sizes and element types (float and int).
Author
Parents
Loading