[Mlir-commits] [mlir] b18e5b6 - Re-apply "[ORC] Remove the Triple argument from LLJITBuilder::..." with fixes.
Lang Hames
llvmlistbot at llvm.org
Wed Mar 5 22:17:14 PST 2025
Author: Lang Hames
Date: 2025-03-06T17:17:05+11:00
New Revision: b18e5b6a36399f11ba1152875b6892900c5afdaf
URL: https://github.com/llvm/llvm-project/commit/b18e5b6a36399f11ba1152875b6892900c5afdaf
DIFF: https://github.com/llvm/llvm-project/commit/b18e5b6a36399f11ba1152875b6892900c5afdaf.diff
LOG: Re-apply "[ORC] Remove the Triple argument from LLJITBuilder::..." with fixes.
This re-applies f905bf3e1ef860c4d6fe67fb64901b6bbe698a91, which was reverted in
c861c1a046eb8c1e546a8767e0010904a3c8c385 due to compiler errors, with a fix for
MLIR.
Added:
Modified:
llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp
llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
llvm/tools/lli/lli.cpp
mlir/lib/ExecutionEngine/ExecutionEngine.cpp
Removed:
################################################################################
diff --git a/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp b/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp
index 16c81de54c86f..37fb92d2fce19 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer/LLJITWithCustomObjectLinkingLayer.cpp
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
LLJITBuilder()
.setJITTargetMachineBuilder(std::move(JTMB))
.setObjectLinkingLayerCreator(
- [&](ExecutionSession &ES, const Triple &TT) {
+ [&](ExecutionSession &ES) {
return std::make_unique<ObjectLinkingLayer>(
ES, ExitOnErr(jitlink::InProcessMemoryManager::Create()));
})
diff --git a/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp b/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
index 5ee52244b3fb4..df2f48cef14cb 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithGDBRegistrationListener/LLJITWithGDBRegistrationListener.cpp
@@ -62,8 +62,7 @@ int main(int argc, char *argv[]) {
auto J =
ExitOnErr(LLJITBuilder()
.setJITTargetMachineBuilder(std::move(JTMB))
- .setObjectLinkingLayerCreator([&](ExecutionSession &ES,
- const Triple &TT) {
+ .setObjectLinkingLayerCreator([&](ExecutionSession &ES) {
auto GetMemMgr = []() {
return std::make_unique<SectionMemoryManager>();
};
diff --git a/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp b/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
index 10b1633646349..d955b65c349fa 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithObjectLinkingLayerPlugin/LLJITWithObjectLinkingLayerPlugin.cpp
@@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
LLJITBuilder()
.setJITTargetMachineBuilder(std::move(JTMB))
.setObjectLinkingLayerCreator(
- [&](ExecutionSession &ES, const Triple &TT) {
+ [&](ExecutionSession &ES) {
// Create ObjectLinkingLayer.
auto ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(
ES, ExitOnErr(jitlink::InProcessMemoryManager::Create()));
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
index 84904b1710945..4ff688e07dfef 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -299,8 +299,7 @@ class LLLazyJIT : public LLJIT {
class LLJITBuilderState {
public:
using ObjectLinkingLayerCreator =
- std::function<Expected<std::unique_ptr<ObjectLayer>>(ExecutionSession &,
- const Triple &)>;
+ std::function<Expected<std::unique_ptr<ObjectLayer>>(ExecutionSession &)>;
using CompileFunctionCreator =
std::function<Expected<std::unique_ptr<IRCompileLayer::IRCompiler>>(
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 972c24abc7506..a48b2624eccda 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -832,8 +832,7 @@ Error LLJITBuilderState::prepareForConstruction() {
JTMB->setCodeModel(CodeModel::Small);
JTMB->setRelocationModel(Reloc::PIC_);
CreateObjectLinkingLayer =
- [](ExecutionSession &ES,
- const Triple &) -> Expected<std::unique_ptr<ObjectLayer>> {
+ [](ExecutionSession &ES) -> Expected<std::unique_ptr<ObjectLayer>> {
return std::make_unique<ObjectLinkingLayer>(ES);
};
}
@@ -951,7 +950,7 @@ LLJIT::createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES) {
// If the config state provided an ObjectLinkingLayer factory then use it.
if (S.CreateObjectLinkingLayer)
- return S.CreateObjectLinkingLayer(ES, S.JTMB->getTargetTriple());
+ return S.CreateObjectLinkingLayer(ES);
// Otherwise default to creating an RTDyldObjectLinkingLayer that constructs
// a new SectionMemoryManager for each object.
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp b/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
index ae76cb08765e4..d44199f1698e9 100644
--- a/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
@@ -911,12 +911,11 @@ void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(
LLVMOrcLLJITBuilderRef Builder,
LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx) {
- unwrap(Builder)->setObjectLinkingLayerCreator(
- [=](ExecutionSession &ES, const Triple &TT) {
- auto TTStr = TT.str();
- return std::unique_ptr<ObjectLayer>(
- unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
- });
+ unwrap(Builder)->setObjectLinkingLayerCreator([=](ExecutionSession &ES) {
+ auto TTStr = ES.getTargetTriple().str();
+ return std::unique_ptr<ObjectLayer>(
+ unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
+ });
}
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result,
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 19246f0394167..4a07b4fe79b88 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -1031,10 +1031,9 @@ int runOrcJIT(const char *ProgName) {
Builder.getJITTargetMachineBuilder()
->setRelocationModel(Reloc::PIC_)
.setCodeModel(CodeModel::Small);
- Builder.setObjectLinkingLayerCreator(
- [&](orc::ExecutionSession &ES, const Triple &TT) {
- return std::make_unique<orc::ObjectLinkingLayer>(ES);
- });
+ Builder.setObjectLinkingLayerCreator([&](orc::ExecutionSession &ES) {
+ return std::make_unique<orc::ObjectLinkingLayer>(ES);
+ });
}
auto J = ExitOnErr(Builder.create());
diff --git a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
index 2ecc80400b3db..05b182f8ac4cf 100644
--- a/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -313,8 +313,7 @@ ExecutionEngine::create(Operation *m, const ExecutionEngineOptions &options,
// Callback to create the object layer with symbol resolution to current
// process and dynamically linked libraries.
- auto objectLinkingLayerCreator = [&](ExecutionSession &session,
- const Triple &tt) {
+ auto objectLinkingLayerCreator = [&](ExecutionSession &session) {
auto objectLayer = std::make_unique<RTDyldObjectLinkingLayer>(
session, [sectionMemoryMapper = options.sectionMemoryMapper]() {
return std::make_unique<SectionMemoryManager>(sectionMemoryMapper);
More information about the Mlir-commits
mailing list