Skip to content

[mlir][StorageUniquer] Restore old signature for default implementaion of verifyInvariants. #103023

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
Aug 13, 2024

Conversation

bchetioui
Copy link
Member

PR #102326 changed the prototype of the default implementation of verify to include emitErrorFn.

This breaks automatic derivation in consumer attributes, such as https://github.com/tensorflow/runtime/blob/60277ba976739502e45ad26585e071568fa44af1/include/tfrt/core_runtime/opdefs/attributes.h#L53.

This PR simply restores the signature to what it was prior to PR #102326.

@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Aug 13, 2024
@bchetioui
Copy link
Member Author

@matthias-springer btw, thank you for leaving notes on your PR for integrators---much appreciated!

@llvmbot
Copy link
Member

llvmbot commented Aug 13, 2024

@llvm/pr-subscribers-mlir

Author: Benjamin Chetioui (bchetioui)

Changes

PR #102326 changed the prototype of the default implementation of verify to include emitErrorFn.

This breaks automatic derivation in consumer attributes, such as https://github.com/tensorflow/runtime/blob/60277ba976739502e45ad26585e071568fa44af1/include/tfrt/core_runtime/opdefs/attributes.h#L53.

This PR simply restores the signature to what it was prior to PR #102326.


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

1 Files Affected:

  • (modified) mlir/include/mlir/IR/StorageUniquerSupport.h (+1-2)
diff --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h
index d6ccbbd8579947..c493fd9c5042c7 100644
--- a/mlir/include/mlir/IR/StorageUniquerSupport.h
+++ b/mlir/include/mlir/IR/StorageUniquerSupport.h
@@ -227,8 +227,7 @@ class StorageUserBase : public BaseT, public Traits<ConcreteT>... {
   /// Default implementation that just returns success.
   template <typename... Args>
   static LogicalResult
-  verifyInvariants(function_ref<InFlightDiagnostic()> emitErrorFn,
-                   Args... args) {
+  verifyInvariants(Args... args) {
     return success();
   }
 

@llvmbot
Copy link
Member

llvmbot commented Aug 13, 2024

@llvm/pr-subscribers-mlir-core

Author: Benjamin Chetioui (bchetioui)

Changes

PR #102326 changed the prototype of the default implementation of verify to include emitErrorFn.

This breaks automatic derivation in consumer attributes, such as https://github.com/tensorflow/runtime/blob/60277ba976739502e45ad26585e071568fa44af1/include/tfrt/core_runtime/opdefs/attributes.h#L53.

This PR simply restores the signature to what it was prior to PR #102326.


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

1 Files Affected:

  • (modified) mlir/include/mlir/IR/StorageUniquerSupport.h (+1-2)
diff --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h
index d6ccbbd8579947..c493fd9c5042c7 100644
--- a/mlir/include/mlir/IR/StorageUniquerSupport.h
+++ b/mlir/include/mlir/IR/StorageUniquerSupport.h
@@ -227,8 +227,7 @@ class StorageUserBase : public BaseT, public Traits<ConcreteT>... {
   /// Default implementation that just returns success.
   template <typename... Args>
   static LogicalResult
-  verifyInvariants(function_ref<InFlightDiagnostic()> emitErrorFn,
-                   Args... args) {
+  verifyInvariants(Args... args) {
     return success();
   }
 

Copy link

github-actions bot commented Aug 13, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@bchetioui bchetioui force-pushed the fix-verify-invariants branch from fa733c2 to f491fe0 Compare August 13, 2024 08:55
@matthias-springer
Copy link
Member

matthias-springer commented Aug 13, 2024

Isn't this function always called with a function_ref<InFlightDiagnostic()> emitErrorFn? (There is no particular reason why I changed this. Just wanted to make the params a bit more explicit.)

Copy link
Member

@matthias-springer matthias-springer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if the CI passes

@bchetioui
Copy link
Member Author

bchetioui commented Aug 13, 2024

Nope, it seems like this is also called with a llvm::unique_function<InFlightDiagnostic ()>, see the following error I encountered:

llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:230:3: note: candidate function template not viable: no known conversion from 'llvm::unique_function<InFlightDiagnostic ()>' to 'function_ref<InFlightDiagnostic ()>' (aka 'function_ref<mlir::InFlightDiagnostic ()>') for 1st argument

…on of verifyInvariants.

PR llvm#102326 changed the prototype of the default implementation of
verify to include emitErrorFn.

This breaks automatic derivation in consumer attributes, such as
https://github.com/tensorflow/runtime/blob/60277ba976739502e45ad26585e071568fa44af1/include/tfrt/core_runtime/opdefs/attributes.h#L53.

This PR simply restores the signature to what it was prior to PR llvm#102326.
@bchetioui bchetioui force-pushed the fix-verify-invariants branch from f491fe0 to 7f76489 Compare August 13, 2024 09:13
@bchetioui bchetioui merged commit a9636b7 into llvm:main Aug 13, 2024
8 checks passed
@bchetioui bchetioui deleted the fix-verify-invariants branch August 13, 2024 10:05
@bchetioui
Copy link
Member Author

Thanks for the review, @matthias-springer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mlir:core MLIR Core Infrastructure mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants