[PATCH] D79812: [MLIR] Add symbol map to mlir ExecutionEngine
Benjamin Kramer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 14 13:38:02 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3a11ca7bed03: [MLIR] Add symbol map to mlir ExecutionEngine (authored by ezhulenev, committed by bkramer).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79812/new/
https://reviews.llvm.org/D79812
Files:
mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
mlir/lib/ExecutionEngine/ExecutionEngine.cpp
Index: mlir/lib/ExecutionEngine/ExecutionEngine.cpp
===================================================================
--- mlir/lib/ExecutionEngine/ExecutionEngine.cpp
+++ mlir/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -51,7 +51,9 @@
using llvm::orc::ExecutionSession;
using llvm::orc::IRCompileLayer;
using llvm::orc::JITTargetMachineBuilder;
+using llvm::orc::MangleAndInterner;
using llvm::orc::RTDyldObjectLinkingLayer;
+using llvm::orc::SymbolMap;
using llvm::orc::ThreadSafeModule;
using llvm::orc::TMOwningSimpleCompiler;
@@ -99,6 +101,14 @@
cache->dumpToObjectFile(filename);
}
+void ExecutionEngine::registerSymbols(
+ llvm::function_ref<SymbolMap(MangleAndInterner)> symbolMap) {
+ auto &mainJitDylib = jit->getMainJITDylib();
+ cantFail(mainJitDylib.define(
+ absoluteSymbols(symbolMap(llvm::orc::MangleAndInterner(
+ mainJitDylib.getExecutionSession(), jit->getDataLayout())))));
+}
+
// Setup LLVM target triple from the current machine.
bool ExecutionEngine::setupTargetTriple(Module *llvmModule) {
// Setup the machine properties from the current architecture.
@@ -194,7 +204,7 @@
: nullptr) {}
Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
- ModuleOp m, std::function<Error(llvm::Module *)> transformer,
+ ModuleOp m, llvm::function_ref<Error(llvm::Module *)> transformer,
Optional<llvm::CodeGenOpt::Level> jitCodeGenOptLevel,
ArrayRef<StringRef> sharedLibPaths, bool enableObjectCache,
bool enableGDBNotificationListener, bool enablePerfNotificationListener) {
Index: mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
===================================================================
--- mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
+++ mlir/include/mlir/ExecutionEngine/ExecutionEngine.h
@@ -63,21 +63,28 @@
ExecutionEngine(bool enableObjectCache, bool enableGDBNotificationListener,
bool enablePerfNotificationListener);
- /// Creates an execution engine for the given module. If `transformer` is
- /// provided, it will be called on the LLVM module during JIT-compilation and
- /// can be used, e.g., for reporting or optimization. `jitCodeGenOptLevel`,
- /// when provided, is used as the optimization level for target code
- /// generation. If `sharedLibPaths` are provided, the underlying
- /// JIT-compilation will open and link the shared libraries for symbol
- /// resolution. If `enableObjectCache` is set, the JIT compiler will create
- /// one to store the object generated for the given module. If enable
- /// `enableGDBNotificationListener` is set, the JIT compiler will notify
- /// the llvm's global GDB notification listener. If
- /// `enablePerfNotificationListener` is set, the JIT compiler will notify
+ /// Creates an execution engine for the given module.
+ ///
+ /// If `transformer` is provided, it will be called on the LLVM module during
+ /// JIT-compilation and can be used, e.g., for reporting or optimization.
+ ///
+ /// `jitCodeGenOptLevel`, when provided, is used as the optimization level for
+ /// target code generation.
+ ///
+ /// If `sharedLibPaths` are provided, the underlying JIT-compilation will
+ /// open and link the shared libraries for symbol resolution.
+ ///
+ /// If `enableObjectCache` is set, the JIT compiler will create one to store
+ /// the object generated for the given module.
+ ///
+ /// If enable `enableGDBNotificationListener` is set, the JIT compiler will
+ /// notify the llvm's global GDB notification listener.
+ ///
+ /// If `enablePerfNotificationListener` is set, the JIT compiler will notify
/// the llvm's global Perf notification listener.
static llvm::Expected<std::unique_ptr<ExecutionEngine>>
create(ModuleOp m,
- std::function<llvm::Error(llvm::Module *)> transformer = {},
+ llvm::function_ref<llvm::Error(llvm::Module *)> transformer = {},
Optional<llvm::CodeGenOpt::Level> jitCodeGenOptLevel = llvm::None,
ArrayRef<StringRef> sharedLibPaths = {}, bool enableObjectCache = true,
bool enableGDBNotificationListener = true,
@@ -105,6 +112,11 @@
/// Dump object code to output file `filename`.
void dumpToObjectFile(StringRef filename);
+ /// Register symbols with this ExecutionEngine.
+ void registerSymbols(
+ llvm::function_ref<llvm::orc::SymbolMap(llvm::orc::MangleAndInterner)>
+ symbolMap);
+
private:
/// Ordering of llvmContext and jit is important for destruction purposes: the
/// jit must be destroyed before the context.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79812.264082.patch
Type: text/x-patch
Size: 4590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200514/075645e5/attachment-0001.bin>
More information about the llvm-commits
mailing list