[Mlir-commits] [mlir] [mlir][nvgpu] Add negative tests for warpgroup MMA accumulator ops (PR #202516)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Jun 8 23:53:01 PDT 2026


https://github.com/Vaisman created https://github.com/llvm/llvm-project/pull/202516

Add verifier tests for warpgroup MMA accumulator initialization
and store operations.

The tests cover invalid accumulator shapes, unsupported non-f32
store results, and mismatched store destination shapes.

The verifier logic for these cases exists in
WarpgroupMmaInitAccumulatorOp::verify() and
WarpgroupMmaStoreOp::verify(), but lacked explicit negative test
coverage in invalid.mlir.

>From f5a5ce1c5a9c0ab34f1b6ce4a75188c5363b597d Mon Sep 17 00:00:00 2001
From: Vasili Svirski <vasili.svirski at gmail.com>
Date: Mon, 8 Jun 2026 16:45:18 +0200
Subject: [PATCH] [mlir][nvgpu] Add negative tests for warpgroup MMA
 accumulator ops

---
 mlir/test/Dialect/NVGPU/invalid.mlir | 42 ++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/mlir/test/Dialect/NVGPU/invalid.mlir b/mlir/test/Dialect/NVGPU/invalid.mlir
index f218d1527d976..0341a08a2c778 100644
--- a/mlir/test/Dialect/NVGPU/invalid.mlir
+++ b/mlir/test/Dialect/NVGPU/invalid.mlir
@@ -423,3 +423,45 @@ func.func @mma_sparse_sync_invalid_shape_4_elements(%arg0: vector<2x2xf16>, %arg
        (vector<2x2xf16>, vector<2x2xf16>, vector<2x2xf16>) -> vector<2x2xf16>
   return %d : vector<2x2xf16>
 }
+
+// -----
+
+func.func @warpgroup_mma_init_accumulator_invalid_m() {
+  // expected-error @+1 {{does not fit into warp-group level}}
+  %acc = nvgpu.warpgroup.mma.init.accumulator
+      -> !nvgpu.warpgroup.accumulator<fragmented = vector<65x128xf32>>
+  return
+}
+
+// -----
+
+func.func @warpgroup_mma_init_accumulator_invalid_n() {
+  // expected-error @+1 {{does not fit into warp-group level}}
+  %acc = nvgpu.warpgroup.mma.init.accumulator
+      -> !nvgpu.warpgroup.accumulator<fragmented = vector<64x121xf32>>
+  return
+}
+
+// -----
+
+func.func @warpgroup_mma_store_non_f32_result(
+    %acc: !nvgpu.warpgroup.accumulator<fragmented = vector<64x128xf16>>,
+    %dst: memref<64x128xf16, 3>) {
+  // expected-error @+1 {{only f32 results for the time being}}
+  nvgpu.warpgroup.mma.store %acc, %dst :
+      !nvgpu.warpgroup.accumulator<fragmented = vector<64x128xf16>>
+      to memref<64x128xf16, 3>
+  return
+}
+
+// -----
+
+func.func @warpgroup_mma_store_mismatched_shape(
+    %acc: !nvgpu.warpgroup.accumulator<fragmented = vector<64x128xf32>>,
+    %dst: memref<64x64xf32, 3>) {
+  // expected-error @+1 {{does not have same size as results}}
+  nvgpu.warpgroup.mma.store %acc, %dst :
+      !nvgpu.warpgroup.accumulator<fragmented = vector<64x128xf32>>
+      to memref<64x64xf32, 3>
+  return
+}



More information about the Mlir-commits mailing list