Skip to content

[mlir][xegpu] Fix verifier diagnostic recursion #124148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2025

Conversation

adam-smnk
Copy link
Contributor

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.

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.
@llvmbot
Copy link
Member

llvmbot commented Jan 23, 2025

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-gpu

Author: Adam Siemieniuk (adam-smnk)

Changes

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 --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).";
     }
   }
 

@chencha3
Copy link
Contributor

Thanks for the Fix. @adam-smnk

@adam-smnk adam-smnk merged commit ba6774f into llvm:main Jan 24, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants