-
Notifications
You must be signed in to change notification settings - Fork 37
remote jit execution #631
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
remote jit execution #631
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -200,10 +200,20 @@ inline void codeComplete(std::vector<std::string>& Results, | |||||||
|
|
||||||||
| #include "llvm/Support/Error.h" | ||||||||
|
|
||||||||
| #include "clang/Interpreter/RemoteJITUtils.h" | ||||||||
| #include "clang/Basic/Version.h" | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: #includes are not sorted properly [llvm-include-order]
Suggested change
|
||||||||
| #include "llvm/TargetParser/Host.h" | ||||||||
|
|
||||||||
| #include "llvm/ExecutionEngine/Orc/Debugging/DebuggerSupport.h" | ||||||||
|
|
||||||||
| #include "llvm/Support/CommandLine.h" | ||||||||
|
|
||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: included header CommandLine.h is not used directly [misc-include-cleaner]
Suggested change
|
||||||||
| static llvm::ExitOnError ExitOnError; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'ExitOnError' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables] static llvm::ExitOnError ExitOnError;
^ |
||||||||
|
|
||||||||
| namespace compat { | ||||||||
|
|
||||||||
| inline std::unique_ptr<clang::Interpreter> | ||||||||
| createClangInterpreter(std::vector<const char*>& args) { | ||||||||
| createClangInterpreter(std::vector<const char*>& args, bool is_out_of_process) { | ||||||||
| auto has_arg = [](const char* x, llvm::StringRef match = "cuda") { | ||||||||
| llvm::StringRef Arg = x; | ||||||||
| Arg = Arg.trim().ltrim('-'); | ||||||||
|
|
@@ -241,10 +251,31 @@ createClangInterpreter(std::vector<const char*>& args) { | |||||||
| (*ciOrErr)->LoadRequestedPlugins(); | ||||||||
| if (CudaEnabled) | ||||||||
| DeviceCI->LoadRequestedPlugins(); | ||||||||
|
|
||||||||
| std::unique_ptr<llvm::orc::LLJITBuilder> JB; | ||||||||
|
|
||||||||
| if(is_out_of_process) { | ||||||||
| std::string OOPExecutor = "/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/llvm-project-test/build/bin/llvm-jitlink-executor"; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: no header providing "std::string" is directly included [misc-include-cleaner] lib/CppInterOp/Compatibility.h:10: + #include <string> |
||||||||
| bool UseSharedMemory = false; | ||||||||
| std::string SlabAllocateSizeString = ""; | ||||||||
| std::unique_ptr<llvm::orc::ExecutorProcessControl> EPC; | ||||||||
| EPC = ExitOnError( | ||||||||
| launchExecutor(OOPExecutor, UseSharedMemory, SlabAllocateSizeString)); | ||||||||
|
|
||||||||
|
|
||||||||
| std::string OrcRuntimePath = "/Users/abhinavkumar/Desktop/Coding/CERN_HSF_COMPILER_RESEARCH/llvm-project-test/build/lib/clang/20/lib/darwin/liborc_rt_osx.a"; | ||||||||
| if (EPC) { | ||||||||
|
|
||||||||
| CB.SetTargetTriple(EPC->getTargetTriple().getTriple()); | ||||||||
| JB = ExitOnError( | ||||||||
| clang::Interpreter::createLLJITBuilder(std::move(EPC), OrcRuntimePath)); | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| auto innerOrErr = | ||||||||
| CudaEnabled ? clang::Interpreter::createWithCUDA(std::move(*ciOrErr), | ||||||||
| std::move(DeviceCI)) | ||||||||
| : clang::Interpreter::create(std::move(*ciOrErr)); | ||||||||
| : clang::Interpreter::create(std::move(*ciOrErr), std::move(JB)); | ||||||||
|
|
||||||||
| if (!innerOrErr) { | ||||||||
| llvm::logAllUnhandledErrors(innerOrErr.takeError(), llvm::errs(), | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2911,11 +2911,11 @@ static std::string MakeResourcesPath() { | |||||
| } // namespace | ||||||
|
|
||||||
| TInterp_t CreateInterpreter(const std::vector<const char*>& Args /*={}*/, | ||||||
| const std::vector<const char*>& GpuArgs /*={}*/) { | ||||||
| const std::vector<const char*>& GpuArgs /*={}*/, bool is_out_of_process) { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: 'MakeResourcesPath' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace]
Suggested change
|
||||||
| std::string MainExecutableName = sys::fs::getMainExecutable(nullptr, nullptr); | ||||||
| std::string ResourceDir = MakeResourcesPath(); | ||||||
| std::vector<const char*> ClingArgv = {"-resource-dir", ResourceDir.c_str(), | ||||||
| "-std=c++14"}; | ||||||
| "-std=c++14", "-gdwarf-4", "-O0"}; | ||||||
| ClingArgv.insert(ClingArgv.begin(), MainExecutableName.c_str()); | ||||||
| #ifdef _WIN32 | ||||||
| // FIXME : Workaround Sema::PushDeclContext assert on windows | ||||||
|
|
@@ -2955,7 +2955,7 @@ TInterp_t CreateInterpreter(const std::vector<const char*>& Args /*={}*/, | |||||
| auto I = new compat::Interpreter(ClingArgv.size(), &ClingArgv[0]); | ||||||
| #else | ||||||
| auto Interp = compat::Interpreter::create(static_cast<int>(ClingArgv.size()), | ||||||
| ClingArgv.data()); | ||||||
| ClingArgv.data(), nullptr, {}, nullptr, true, is_out_of_process); | ||||||
| if (!Interp) | ||||||
| return nullptr; | ||||||
| auto* I = Interp.release(); | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'clang/Interpreter/RemoteJITUtils.h' file not found [clang-diagnostic-error]