[Mlir-commits] [mlir] [mlir][gpu] Add GPU subgroup MMA extract and insert operations (PR #139048)

Hsiangkai Wang llvmlistbot at llvm.org
Fri May 23 01:52:53 PDT 2025


================
@@ -1919,6 +1919,81 @@ 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. The values of !gpu.mma_matrix are stored across multiple
+    threads in the subgroup. If there are multiple values packed in a thread, use
+    `indices` to specify the element in the local thread to extract.
----------------
Hsiangkai wrote:

Description updated and rename the operations to reflect its meaning.

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


More information about the Mlir-commits mailing list