[Mlir-commits] [mlir] [mlir][SPIRV] Do not rewrite CompositeInsert for coopmatrix (PR #137837)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Apr 29 09:22:25 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-spirv

Author: Hsiangkai Wang (Hsiangkai)

<details>
<summary>Changes</summary>

When rewriting multiple CompositeInserts to CompositeConstruct, we need to know the number of elements of the result type. However, we cannot query the number of elements for cooperative matrix types.

---
Full diff: https://github.com/llvm/llvm-project/pull/137837.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp (+3) 


``````````diff
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
index f38282f57a2c3..bc3d0429efd19 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp
@@ -84,6 +84,9 @@ void RewriteInsertsPass::runOnOperation() {
 LogicalResult RewriteInsertsPass::collectInsertionChain(
     spirv::CompositeInsertOp op,
     SmallVectorImpl<spirv::CompositeInsertOp> &insertions) {
+  if (llvm::isa<spirv::CooperativeMatrixType>(op.getComposite().getType()))
+    return failure();
+
   auto indicesArrayAttr = cast<ArrayAttr>(op.getIndices());
   // TODO: handle nested composite object.
   if (indicesArrayAttr.size() == 1) {

``````````

</details>


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


More information about the Mlir-commits mailing list