[Mlir-commits] [mlir] [mlir][xegpu] Fix verifier diagnostic recursion (PR #124148)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Jan 23 09:11:22 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-gpu

Author: Adam Siemieniuk (adam-smnk)

<details>
<summary>Changes</summary>

Uses global diagnostic message in operation verifier to avoid infinite recursion on a warning.

Emitting diagnostics through the operation under verification creates a loop where verifier runs again before printing the message.

---
Full diff: https://github.com/llvm/llvm-project/pull/124148.diff


1 Files Affected:

- (modified) mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp (+4-3) 


``````````diff
diff --git a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
index 15c435f1fa257b..81f46f941785a1 100644
--- a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
+++ b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
@@ -294,7 +294,7 @@ LogicalResult LoadNdOp::verify() {
     if (valid)
       transpose(trans, tdescShape);
     else
-      emitWarning("Invalid transpose attr. It is ignored.");
+      mlir::emitWarning(getLoc()) << "Invalid transpose attr. It is ignored.";
   }
 
   if (getPacked()) {
@@ -304,8 +304,9 @@ LogicalResult LoadNdOp::verify() {
       tdescShape[axis] /= vnni_factor;
       tdescShape.push_back(vnni_factor);
     } else {
-      emitWarning("Invalid Packed Attr. It is ignored (available for 2D "
-                  "TensorDesc only).");
+      mlir::emitWarning(getLoc())
+          << "Invalid Packed Attr. It is ignored (available for 2D "
+             "TensorDesc only).";
     }
   }
 

``````````

</details>


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


More information about the Mlir-commits mailing list