[clang] [clang-repl] Sink RemoteJITUtils into Interpreter class (NFC) (PR #155140)
Lang Hames via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 17 23:52:57 PDT 2025
================
@@ -115,15 +120,38 @@ class Interpreter {
/// An optional compiler instance for CUDA offloading
std::unique_ptr<CompilerInstance> DeviceCI;
+public:
+ struct JITConfig {
+ /// Indicates whether out-of-process JIT execution is enabled.
+ bool IsOutOfProcess = false;
+ /// Path to the out-of-process JIT executor.
+ std::string OOPExecutor = "";
+ std::string OOPExecutorConnect = "";
+ /// Indicates whether to use shared memory for communication.
+ bool UseSharedMemory = false;
+ /// Representing the slab allocation size for memory management in kb.
+ unsigned SlabAllocateSize = 0;
+ /// Path to the ORC runtime library.
+ std::string OrcRuntimePath = "";
+ /// PID of the out-of-process JIT executor.
+ uint32_t ExecutorPID = 0;
+
+ JITConfig()
+ : IsOutOfProcess(false), OOPExecutor(""), OOPExecutorConnect(""),
+ UseSharedMemory(false), SlabAllocateSize(0), OrcRuntimePath(""),
+ ExecutorPID(0) {}
+ };
+
----------------
lhames wrote:
>From discussion with @vgvassilev it sounds like the motivation here was to defer creation of the `LLJITBuilder` until you can ask the driver for the runtime path?
This solves that problem, but eliminates the ability to configure the builder.
What if you added a new member and callback along the lines of:
```c++
std::optional<std::string> OrcRuntimePath;
llvm::unique_function<LLJITBuilder(&JITConfig)> MakeJITBuilder = makeDefaultJITBuilder;
```
then in the setup path you'd have something like:
```c++
if (!Cfg.OrcRuntimePath) {
if (OrcRTPath = getOrcRuntimePath(TC))
CfgOrcRuntimePath = std::move(*OrcRTPath);
else
return OrcRTPath.takeError();
}
auto JITBuilder = MakeJITBuilder(Cfg);
if (auto JOrErr = JITBuilder.create())
J = std::move(*JOrErr);
else
return JOrErr.takeError();
...
```
The extra indirection gives you the opportunity to ask the driver for the path (if one isn't provided) while still giving the client the opportunity to configure the LLJITBuilder.
https://github.com/llvm/llvm-project/pull/155140
More information about the cfe-commits
mailing list