[Mlir-commits] [mlir] [mlir][AMDGPU] Avoid verifier crash in DPPOp on vector operand types (PR #178887)

Ayush Kumar Gaur llvmlistbot at llvm.org
Fri Jan 30 05:24:53 PST 2026


https://github.com/Ayush3941 created https://github.com/llvm/llvm-project/pull/178887

### whats the problem 
mlir-opt could crash while verifying amdgpu.dpp when its operands had vector
types, such as ARM SME tile vectors produced by arm_sme.get_tile.
The crash occurred during IR verification, before any lowering or passes ran.

### why it happens 
DPPOp::verify() called Type::getIntOrFloatBitWidth() on the operand type.
When the operand was a VectorType, this hit an assertion because only scalar
integer and float types have a bitwidth.

### whats the fix 
Query the bitwidth on the element type using getElementTypeOrSelf() instead of
the container type.
Add a regression test to ensure amdgpu.dpp verification no longer asserts on
vector operand types.

Fixes #178128

>From af7f96587dec42caab0b1be1488ec5e7b214da9d Mon Sep 17 00:00:00 2001
From: Ayush3941 <ayushkgaur1 at gmail.com>
Date: Fri, 30 Jan 2026 08:10:50 -0500
Subject: [PATCH 1/2] [mlir][AMDGPU] Fix DPPOp verifier crash on vector operand
 types

---
 mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp            |  4 ++--
 .../AMDGPU/dpp-verify-no-assert-on-vectors.mlir     | 13 +++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 mlir/test/Dialect/AMDGPU/dpp-verify-no-assert-on-vectors.mlir

diff --git a/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp b/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp
index 87a813a31608d..ec44310bd0e93 100644
--- a/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp
+++ b/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp
@@ -675,11 +675,11 @@ LogicalResult SparseMFMAOp::verify() {
 //===----------------------------------------------------------------------===//
 LogicalResult DPPOp::verify() {
   Type srcType = getSrc().getType();
-  if (srcType.getIntOrFloatBitWidth() > 64) {
+  Type elemType = getElementTypeOrSelf(srcType); 
+  if (elemType.getIntOrFloatBitWidth() > 64) {
     return emitOpError("integer and floating point types larger than 64 bits "
                        "are not supported");
   }
-
   DPPPerm kind = getKind();
   Attribute permArgument = getPermArgument().value_or(Attribute{});
 
diff --git a/mlir/test/Dialect/AMDGPU/dpp-verify-no-assert-on-vectors.mlir b/mlir/test/Dialect/AMDGPU/dpp-verify-no-assert-on-vectors.mlir
new file mode 100644
index 0000000000000..c2d712cc3d004
--- /dev/null
+++ b/mlir/test/Dialect/AMDGPU/dpp-verify-no-assert-on-vectors.mlir
@@ -0,0 +1,13 @@
+// RUN: mlir-opt %s -verify-each
+
+// DPPOp verifier must not assert when src type is a
+// vector (e.g. ARM SME tile vectors).
+
+module {
+  func.func @main() {
+    %tile = arm_sme.get_tile : vector<[16]x[16]xi8>
+    %pop = math.ctpop %tile : vector<[16]x[16]xi8>
+    %r = amdgpu.dpp %pop %tile row_shl(1 : i32) : vector<[16]x[16]xi8>
+    return
+  }
+}

>From ea8534d4db2503014287caec08343cb7d2517aab Mon Sep 17 00:00:00 2001
From: Ayush3941 <ayushkgaur1 at gmail.com>
Date: Fri, 30 Jan 2026 08:17:21 -0500
Subject: [PATCH 2/2] [mlir][AMDGPU] Fix DPPOp verifier crash on vector operand
 types with fixd format

---
 mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp b/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp
index ec44310bd0e93..c39ae9fc14831 100644
--- a/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp
+++ b/mlir/lib/Dialect/AMDGPU/IR/AMDGPUOps.cpp
@@ -675,7 +675,7 @@ LogicalResult SparseMFMAOp::verify() {
 //===----------------------------------------------------------------------===//
 LogicalResult DPPOp::verify() {
   Type srcType = getSrc().getType();
-  Type elemType = getElementTypeOrSelf(srcType); 
+  Type elemType = getElementTypeOrSelf(srcType);
   if (elemType.getIntOrFloatBitWidth() > 64) {
     return emitOpError("integer and floating point types larger than 64 bits "
                        "are not supported");



More information about the Mlir-commits mailing list