Skip to content

[mlir] Declare explicit typeid to fix dylib build #138357

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
May 2, 2025
Merged

Conversation

rnk
Copy link
Collaborator

@rnk rnk commented May 2, 2025

This makes the dyn_cast work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes #138202

This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes llvm#138202
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels May 2, 2025
@rnk rnk requested a review from joker-eph May 2, 2025 23:02
@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-mlir-core

@llvm/pr-subscribers-mlir

Author: Reid Kleckner (rnk)

Changes

This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes #138202


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

2 Files Affected:

  • (modified) mlir/include/mlir/Pass/Pass.h (+3-2)
  • (modified) mlir/lib/Pass/Pass.cpp (+2)
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index 7725a3a2910bd..9e8ba7158f1b3 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -493,8 +493,6 @@ class PassExecutionAction : public tracing::ActionImpl<PassExecutionAction> {
   using Base = tracing::ActionImpl<PassExecutionAction>;
 
 public:
-  /// Define a TypeID for this PassExecutionAction.
-  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PassExecutionAction)
   /// Construct a PassExecutionAction. This is called by the OpToOpPassAdaptor
   /// when it calls `executeAction`.
   PassExecutionAction(ArrayRef<IRUnit> irUnits, const Pass &pass);
@@ -526,4 +524,7 @@ class PassExecutionAction : public tracing::ActionImpl<PassExecutionAction> {
 
 } // namespace mlir
 
+/// Define a TypeID for this PassExecutionAction.
+MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::PassExecutionAction)
+
 #endif // MLIR_PASS_PASS_H
diff --git a/mlir/lib/Pass/Pass.cpp b/mlir/lib/Pass/Pass.cpp
index 67c18189b85e0..8d1fbcdb19a9d 100644
--- a/mlir/lib/Pass/Pass.cpp
+++ b/mlir/lib/Pass/Pass.cpp
@@ -51,6 +51,8 @@ Operation *PassExecutionAction::getOp() const {
                          : llvm::dyn_cast_if_present<Operation *>(irUnits[0]);
 }
 
+MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::PassExecutionAction)
+
 //===----------------------------------------------------------------------===//
 // Pass
 //===----------------------------------------------------------------------===//

@rnk rnk merged commit 880de1c into llvm:main May 2, 2025
12 of 13 checks passed
@rnk
Copy link
Collaborator Author

rnk commented May 2, 2025

Thanks!

IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes llvm#138202
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes llvm#138202
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes llvm#138202
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
This makes the dyn_cast<PassExecutionAction> work outside the dylib,
i.e. from the unit test binary, when the CMake setting
MLIR_LINK_MLIR_DYLIB is ON.

Fixes llvm#138202
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.

MLIR pass test fails when using dylib
3 participants