[Mlir-commits] [mlir] [mlir][gpu][spirv] Convert memref<mma_matrix> to spv.array<coopmatrix> (PR #212806)
Igor Wodiany
llvmlistbot at llvm.org
Tue Aug 4 08:53:57 PDT 2026
================
@@ -410,9 +415,24 @@ AllocaOpPattern::matchAndRewrite(memref::AllocaOp allocaOp, OpAdaptor adaptor,
if (!spirvType)
return rewriter.notifyMatchFailure(allocaOp, "type conversion failed");
- rewriter.replaceOpWithNewOp<spirv::VariableOp>(allocaOp, spirvType,
- spirv::StorageClass::Function,
- /*initializer=*/nullptr);
+ auto function = allocaOp->getParentOfType<FunctionOpInterface>();
+ if (!function)
+ return rewriter.notifyMatchFailure(allocaOp,
+ "requires a containing function");
+
+ // SPIR-V requires Function variables to be declared in the first block.
+ OpBuilder::InsertionGuard guard(rewriter);
+ Block &entryBlock = function->getRegion(0).front();
+ auto insertionPoint = entryBlock.begin();
----------------
IgWod wrote:
nit: please spell out the type
https://github.com/llvm/llvm-project/pull/212806
More information about the Mlir-commits
mailing list