Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit b86fc17

Browse files
authored
Revert "[MLIR] Split ExecutionEngine Initialization out of ctor into an explicit method call" (#153477)
Reverts llvm/llvm-project#153373 Sanitizer bot is broken
1 parent 798f793 commit b86fc17

File tree

3 files changed

+4
-25
lines changed

3 files changed

+4
-25
lines changed

mlir/include/mlir-c/ExecutionEngine.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ MLIR_CAPI_EXPORTED MlirExecutionEngine mlirExecutionEngineCreate(
4646
MlirModule op, int optLevel, int numPaths,
4747
const MlirStringRef *sharedLibPaths, bool enableObjectDump);
4848

49-
/// Initialize the ExecutionEngine. Global constructors specified by
50-
/// `llvm.mlir.global_ctors` will be run. One common scenario is that kernel
51-
/// binary compiled from `gpu.module` gets loaded during initialization. Make
52-
/// sure all symbols are resolvable before initialization by calling
53-
/// `mlirExecutionEngineRegisterSymbol` or including shared libraries.
54-
MLIR_CAPI_EXPORTED void mlirExecutionEngineInitialize(MlirExecutionEngine jit);
55-
5649
/// Destroy an ExecutionEngine instance.
5750
MLIR_CAPI_EXPORTED void mlirExecutionEngineDestroy(MlirExecutionEngine jit);
5851

mlir/lib/Bindings/Python/ExecutionEngineModule.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "mlir-c/ExecutionEngine.h"
10-
#include "mlir/Bindings/Python/Nanobind.h"
1110
#include "mlir/Bindings/Python/NanobindAdaptors.h"
11+
#include "mlir/Bindings/Python/Nanobind.h"
1212

1313
namespace nb = nanobind;
1414
using namespace mlir;
@@ -124,17 +124,6 @@ NB_MODULE(_mlirExecutionEngine, m) {
124124
},
125125
nb::arg("name"), nb::arg("callback"),
126126
"Register `callback` as the runtime symbol `name`.")
127-
.def(
128-
"initialize",
129-
[](PyExecutionEngine &executionEngine) {
130-
mlirExecutionEngineInitialize(executionEngine.get());
131-
},
132-
"Initialize the ExecutionEngine. Global constructors specified by "
133-
"`llvm.mlir.global_ctors` will be run. One common scenario is that "
134-
"kernel binary compiled from `gpu.module` gets loaded during "
135-
"initialization. Make sure all symbols are resolvable before "
136-
"initialization by calling `raw_register_runtime` or including "
137-
"shared libraries.")
138127
.def(
139128
"dump_to_object_file",
140129
[](PyExecutionEngine &executionEngine, const std::string &fileName) {

mlir/lib/CAPI/ExecutionEngine/ExecutionEngine.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ mlirExecutionEngineCreate(MlirModule op, int optLevel, int numPaths,
6868
return wrap(jitOrError->release());
6969
}
7070

71-
extern "C" void mlirExecutionEngineInitialize(MlirExecutionEngine jit) {
72-
unwrap(jit)->initialize();
73-
}
74-
7571
extern "C" void mlirExecutionEngineDestroy(MlirExecutionEngine jit) {
7672
delete (unwrap(jit));
7773
}
@@ -110,8 +106,9 @@ extern "C" void mlirExecutionEngineRegisterSymbol(MlirExecutionEngine jit,
110106
void *sym) {
111107
unwrap(jit)->registerSymbols([&](llvm::orc::MangleAndInterner interner) {
112108
llvm::orc::SymbolMap symbolMap;
113-
symbolMap[interner(unwrap(name))] = {llvm::orc::ExecutorAddr::fromPtr(sym),
114-
llvm::JITSymbolFlags::Exported};
109+
symbolMap[interner(unwrap(name))] =
110+
{ llvm::orc::ExecutorAddr::fromPtr(sym),
111+
llvm::JITSymbolFlags::Exported };
115112
return symbolMap;
116113
});
117114
}

0 commit comments

Comments
 (0)