-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Revert "[mlir][Pass] Fix crash when applying a pass to an optional interface" #168847
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
matthias-springer
merged 1 commit into
main
from
revert-168499-users/matthias-springer/fix_crash_passm
Nov 20, 2025
Merged
Revert "[mlir][Pass] Fix crash when applying a pass to an optional interface" #168847
matthias-springer
merged 1 commit into
main
from
revert-168499-users/matthias-springer/fix_crash_passm
Nov 20, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…terface …" This reverts commit 54f69ca.
Member
|
@llvm/pr-subscribers-mlir-core Author: Matthias Springer (matthias-springer) ChangesReverts llvm/llvm-project#168499 Full diff: https://github.com/llvm/llvm-project/pull/168847.diff 5 Files Affected:
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index 448a688243491..16893c6db87b1 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -193,13 +193,6 @@ class Pass {
/// This is useful for generic operation passes to add restrictions on the
/// operations they operate on.
virtual bool canScheduleOn(RegisteredOperationName opName) const = 0;
- virtual bool canScheduleOn(Operation *op) const {
- std::optional<RegisteredOperationName> registeredInfo =
- op->getName().getRegisteredInfo();
- if (!registeredInfo)
- return false;
- return canScheduleOn(*registeredInfo);
- }
/// Schedule an arbitrary pass pipeline on the provided operation.
/// This can be invoke any time in a pass to dynamic schedule more passes.
@@ -443,7 +436,6 @@ class InterfacePass : public OperationPass<> {
/// Indicate if the current pass can be scheduled on the given operation type.
/// For an InterfacePass, this checks if the operation implements the given
/// interface.
- bool canScheduleOn(Operation *op) const final { return isa<InterfaceT>(op); }
bool canScheduleOn(RegisteredOperationName opName) const final {
return opName.hasInterface<InterfaceT>();
}
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 75f882606e0ab..521c7c6be17b6 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -559,9 +559,9 @@ LogicalResult OpToOpPassAdaptor::run(Pass *pass, Operation *op,
return op->emitOpError() << "trying to schedule a pass on an operation not "
"marked as 'IsolatedFromAbove'";
}
- if (!pass->canScheduleOn(op)) {
- return op->emitOpError() << "trying to schedule pass '" << pass->getName()
- << "' on an unsupported operation";
+ if (!pass->canScheduleOn(*op->getName().getRegisteredInfo())) {
+ return op->emitOpError()
+ << "trying to schedule a pass on an unsupported operation";
}
// Initialize the pass state with a callback for the pass to dynamically
diff --git a/mlir/test/Dialect/Transform/test-pass-application.mlir b/mlir/test/Dialect/Transform/test-pass-application.mlir
index 4806daf7ce73f..ce8f69c58701d 100644
--- a/mlir/test/Dialect/Transform/test-pass-application.mlir
+++ b/mlir/test/Dialect/Transform/test-pass-application.mlir
@@ -386,7 +386,7 @@ module attributes {transform.with_named_sequence} {
// -----
module attributes {transform.with_named_sequence} {
- // expected-error @below {{trying to schedule pass 'DuplicateFunctionEliminationPass' on an unsupported operation}}
+ // expected-error @below {{trying to schedule a pass on an unsupported operation}}
// expected-note @below {{target op}}
func.func @invalid_target_op_type() {
return
diff --git a/mlir/test/Pass/invalid-unsupported-operation.mlir b/mlir/test/Pass/invalid-unsupported-operation.mlir
deleted file mode 100644
index 0ff49448c1daf..0000000000000
--- a/mlir/test/Pass/invalid-unsupported-operation.mlir
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: mlir-opt %s -test-print-liveness -split-input-file -verify-diagnostics
-
-// Unnamed modules do not implement SymbolOpInterface.
-// expected-error @+1 {{trying to schedule pass '(anonymous namespace)::TestLivenessPass' on an unsupported operation}}
-module {}
-
-// -----
-
-// Named modules implement SymbolOpInterface.
-module @named_module {}
diff --git a/mlir/test/Pass/pipeline-invalid.mlir b/mlir/test/Pass/pipeline-invalid.mlir
index 4116e127a24a6..948a13384bc75 100644
--- a/mlir/test/Pass/pipeline-invalid.mlir
+++ b/mlir/test/Pass/pipeline-invalid.mlir
@@ -15,5 +15,5 @@ arith.constant 0
// -----
-// expected-error@below {{trying to schedule pass '(anonymous namespace)::TestFunctionPass' on an unsupported operation}}
+// expected-error@below {{trying to schedule a pass on an unsupported operation}}
module {}
|
Member
|
@llvm/pr-subscribers-mlir Author: Matthias Springer (matthias-springer) ChangesReverts llvm/llvm-project#168499 Full diff: https://github.com/llvm/llvm-project/pull/168847.diff 5 Files Affected:
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index 448a688243491..16893c6db87b1 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -193,13 +193,6 @@ class Pass {
/// This is useful for generic operation passes to add restrictions on the
/// operations they operate on.
virtual bool canScheduleOn(RegisteredOperationName opName) const = 0;
- virtual bool canScheduleOn(Operation *op) const {
- std::optional<RegisteredOperationName> registeredInfo =
- op->getName().getRegisteredInfo();
- if (!registeredInfo)
- return false;
- return canScheduleOn(*registeredInfo);
- }
/// Schedule an arbitrary pass pipeline on the provided operation.
/// This can be invoke any time in a pass to dynamic schedule more passes.
@@ -443,7 +436,6 @@ class InterfacePass : public OperationPass<> {
/// Indicate if the current pass can be scheduled on the given operation type.
/// For an InterfacePass, this checks if the operation implements the given
/// interface.
- bool canScheduleOn(Operation *op) const final { return isa<InterfaceT>(op); }
bool canScheduleOn(RegisteredOperationName opName) const final {
return opName.hasInterface<InterfaceT>();
}
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 75f882606e0ab..521c7c6be17b6 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -559,9 +559,9 @@ LogicalResult OpToOpPassAdaptor::run(Pass *pass, Operation *op,
return op->emitOpError() << "trying to schedule a pass on an operation not "
"marked as 'IsolatedFromAbove'";
}
- if (!pass->canScheduleOn(op)) {
- return op->emitOpError() << "trying to schedule pass '" << pass->getName()
- << "' on an unsupported operation";
+ if (!pass->canScheduleOn(*op->getName().getRegisteredInfo())) {
+ return op->emitOpError()
+ << "trying to schedule a pass on an unsupported operation";
}
// Initialize the pass state with a callback for the pass to dynamically
diff --git a/mlir/test/Dialect/Transform/test-pass-application.mlir b/mlir/test/Dialect/Transform/test-pass-application.mlir
index 4806daf7ce73f..ce8f69c58701d 100644
--- a/mlir/test/Dialect/Transform/test-pass-application.mlir
+++ b/mlir/test/Dialect/Transform/test-pass-application.mlir
@@ -386,7 +386,7 @@ module attributes {transform.with_named_sequence} {
// -----
module attributes {transform.with_named_sequence} {
- // expected-error @below {{trying to schedule pass 'DuplicateFunctionEliminationPass' on an unsupported operation}}
+ // expected-error @below {{trying to schedule a pass on an unsupported operation}}
// expected-note @below {{target op}}
func.func @invalid_target_op_type() {
return
diff --git a/mlir/test/Pass/invalid-unsupported-operation.mlir b/mlir/test/Pass/invalid-unsupported-operation.mlir
deleted file mode 100644
index 0ff49448c1daf..0000000000000
--- a/mlir/test/Pass/invalid-unsupported-operation.mlir
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: mlir-opt %s -test-print-liveness -split-input-file -verify-diagnostics
-
-// Unnamed modules do not implement SymbolOpInterface.
-// expected-error @+1 {{trying to schedule pass '(anonymous namespace)::TestLivenessPass' on an unsupported operation}}
-module {}
-
-// -----
-
-// Named modules implement SymbolOpInterface.
-module @named_module {}
diff --git a/mlir/test/Pass/pipeline-invalid.mlir b/mlir/test/Pass/pipeline-invalid.mlir
index 4116e127a24a6..948a13384bc75 100644
--- a/mlir/test/Pass/pipeline-invalid.mlir
+++ b/mlir/test/Pass/pipeline-invalid.mlir
@@ -15,5 +15,5 @@ arith.constant 0
// -----
-// expected-error@below {{trying to schedule pass '(anonymous namespace)::TestFunctionPass' on an unsupported operation}}
+// expected-error@below {{trying to schedule a pass on an unsupported operation}}
module {}
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #168499