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

Hsiangkai Wang llvmlistbot at llvm.org
Tue Apr 29 09:21:45 PDT 2025


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

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.

>From 41edb090679440bec1cc69865d179fc4c703a80d Mon Sep 17 00:00:00 2001
From: Hsiangkai Wang <hsiangkai.wang at arm.com>
Date: Tue, 29 Apr 2025 17:12:12 +0100
Subject: [PATCH] [mlir][SPIRV] Do not rewrite CompositeInsert for coopmatrix

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.
---
 mlir/lib/Dialect/SPIRV/Transforms/RewriteInsertsPass.cpp | 3 +++
 1 file changed, 3 insertions(+)

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) {



More information about the Mlir-commits mailing list