[Mlir-commits] [mlir] [mlir][gpu] Add GPU subgroup MMA extract and insert operations (PR #139048)
Hsiangkai Wang
llvmlistbot at llvm.org
Thu May 22 02:35:11 PDT 2025
================
@@ -1919,6 +1919,79 @@ def GPU_SubgroupMmaConstantMatrixOp : GPU_Op<"subgroup_mma_constant_matrix",
}];
}
+def GPU_SubgroupMmaExtractOp : GPU_Op<"subgroup_mma_extract",
+ [Pure,
+ TypesMatchWith<"value type matches element type of mma_matrix",
+ "matrix", "res",
+ "::llvm::cast<gpu::MMAMatrixType>($_self).getElementType()">]>{
+
+ let summary = "Extract a value from GPU warp by invocation and indices";
+
+ let description = [{
+ The `gpu.subgroup_mma_extract` operation extracts a value from `!gpu.mma_matrix`
+ by the invocation in a subgroup.
+
+ This operation takes `!gpu.mma_matrix` as its first operand. It is the source
+ matrix across a subgroup. The op returns a scalar value stored in the invocation
+ in the subgroup. If there are multiple values packed in an invocation, use
+ `indices` to specify the element to extract.
+
+ Example:
+
+ ```mlir
+ %c0 = arith.constant 0 : index
+ %val = gpu.subgroup_mma_extract %m[%c0] : !gpu.mma_matrix<16x16xf32, "AOp"> -> f32
----------------
Hsiangkai wrote:
> it would be nice to describe this. It is not obvious from reading the current description
I have added description about how cooperative matrix is stored between threads.
https://github.com/llvm/llvm-project/pull/139048
More information about the Mlir-commits
mailing list