<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Stefan<div class=""><br class=""></div><div class="">I see the OrcV2 examples tests are failing on Darwin, when built with the sanitizers enabled. Can you please take a look? </div><div class=""><br class=""></div><div class="">Refer to <a href="https://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/7992/testReport/" class="">https://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan/7992/testReport/</a>. </div><div class=""><br class=""></div><div class=""><pre class="console-output" style="box-sizing: inherit; font-size: var(--font-size-monospace); white-space: pre-wrap; word-wrap: break-word; margin-top: 0px; margin-bottom: 0px; caret-color: rgb(51, 51, 51); color: rgb(51, 51, 51);">Failed Tests (5):
LLVM :: Examples/OrcV2Examples/orcv2-cbindings-add-object-file.test
LLVM :: Examples/OrcV2Examples/orcv2-cbindings-basic-usage.test
LLVM :: Examples/OrcV2Examples/orcv2-cbindings-lazy.test
LLVM :: Examples/OrcV2Examples/orcv2-cbindings-reflect-process-symbols.test
LLVM :: Examples/OrcV2Examples/orcv2-cbindings-removable-code.test</pre><div class=""><br class=""></div><div class="">Thanks</div><div class="">Azhar</div><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 29, 2021, at 5:41 AM, Stefan Gränitz via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class="">Author: Stefan Gränitz<br class="">Date: 2021-07-29T14:40:42+02:00<br class="">New Revision: 058935145d6b0c600c35e8b83fa150896c725f8d<br class=""><br class="">URL: <a href="https://github.com/llvm/llvm-project/commit/058935145d6b0c600c35e8b83fa150896c725f8d" class="">https://github.com/llvm/llvm-project/commit/058935145d6b0c600c35e8b83fa150896c725f8d</a><br class="">DIFF: <a href="https://github.com/llvm/llvm-project/commit/058935145d6b0c600c35e8b83fa150896c725f8d.diff" class="">https://github.com/llvm/llvm-project/commit/058935145d6b0c600c35e8b83fa150896c725f8d.diff</a><br class=""><br class="">LOG: [Orc][examples] Adopt ExecutorProcessControl API and re-enable LLJITWithRemoteDebugging<br class=""><br class="">The API change originated from D104694. The LLJITWithRemoteDebugging example and the test for it were disabled while it was in the works.<br class=""><br class="">Added: <br class=""><br class=""><br class="">Modified: <br class=""> llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt<br class=""> llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp<br class=""> llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp<br class=""> llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h<br class=""> llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test<br class=""> llvm/test/Examples/lit.local.cfg<br class=""><br class="">Removed: <br class=""><br class=""><br class=""><br class="">################################################################################<br class="">diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt<br class="">index 06dfe88a898d5..2f8db1976107d 100644<br class="">--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt<br class="">+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/CMakeLists.txt<br class="">@@ -10,7 +10,7 @@ set(LLVM_LINK_COMPONENTS<br class=""> nativecodegen<br class=""> )<br class=""><br class="">-if (LLVM_INCLUDE_UTILS AND NOT LLVM_INCLUDE_UTILS)<br class="">+if (LLVM_INCLUDE_UTILS)<br class=""> add_llvm_example(LLJITWithRemoteDebugging<br class=""> LLJITWithRemoteDebugging.cpp<br class=""> RemoteJITUtils.cpp<br class="">@@ -18,7 +18,4 @@ if (LLVM_INCLUDE_UTILS AND NOT LLVM_INCLUDE_UTILS)<br class=""> DEPENDS<br class=""> llvm-jitlink-executor<br class=""> )<br class="">-else()<br class="">- # Use a temporary no-op target until D104694 lands.<br class="">- add_custom_target(LLJITWithRemoteDebugging)<br class=""> endif()<br class=""><br class="">diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp<br class="">index ca0953550e090..227ad09d7ae79 100644<br class="">--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp<br class="">+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp<br class="">@@ -133,12 +133,12 @@ static cl::opt<bool><br class=""><br class=""> ExitOnError ExitOnErr;<br class=""><br class="">-static std::unique_ptr<JITLinkExecutor> connectExecutor(const char *Argv0,<br class="">- ExecutionSession &ES) {<br class="">+static std::unique_ptr<JITLinkExecutor> connectExecutor(const char *Argv0) {<br class=""> // Connect to a running out-of-process executor through a TCP socket.<br class=""> if (!OOPExecutorConnect.empty()) {<br class=""> std::unique_ptr<TCPSocketJITLinkExecutor> Exec =<br class="">- ExitOnErr(JITLinkExecutor::ConnectTCPSocket(OOPExecutorConnect, ES));<br class="">+ ExitOnErr(JITLinkExecutor::ConnectTCPSocket(OOPExecutorConnect,<br class="">+ std::ref(ExitOnErr)));<br class=""><br class=""> outs() << "Connected to executor at " << OOPExecutorConnect << "\n";<br class=""> if (WaitForDebugger) {<br class="">@@ -157,7 +157,7 @@ static std::unique_ptr<JITLinkExecutor> connectExecutor(const char *Argv0,<br class=""><br class=""> outs() << "Found out-of-process executor: " << Exec->getPath() << "\n";<br class=""><br class="">- ExitOnErr(Exec->launch(ES));<br class="">+ ExitOnErr(Exec->launch(std::ref(ExitOnErr)));<br class=""> if (WaitForDebugger) {<br class=""> outs() << "Launched executor in subprocess: " << Exec->getPID() << "\n"<br class=""> << "Attach a debugger and press any key to continue.\n";<br class="">@@ -177,11 +177,8 @@ int main(int argc, char *argv[]) {<br class=""> ExitOnErr.setBanner(std::string(argv[0]) + ": ");<br class=""> cl::ParseCommandLineOptions(argc, argv, "LLJITWithRemoteDebugging");<br class=""><br class="">- auto ES = std::make_unique<ExecutionSession>();<br class="">- ES->setErrorReporter([&](Error Err) { ExitOnErr(std::move(Err)); });<br class="">-<br class=""> // Launch/connect the out-of-process executor.<br class="">- std::unique_ptr<JITLinkExecutor> Executor = connectExecutor(argv[0], *ES);<br class="">+ std::unique_ptr<JITLinkExecutor> Executor = connectExecutor(argv[0]);<br class=""><br class=""> // Load the given IR files.<br class=""> std::vector<ThreadSafeModule> TSMs;<br class="">@@ -215,6 +212,8 @@ int main(int argc, char *argv[]) {<br class=""><br class=""> // Create LLJIT and destroy it before disconnecting the target process.<br class=""> {<br class="">+ std::unique_ptr<ExecutionSession> ES = Executor->startSession();<br class="">+<br class=""> outs() << "Initializing LLJIT for remote executor\n";<br class=""> auto J = ExitOnErr(LLJITBuilder()<br class=""> .setExecutionSession(std::move(ES))<br class="">@@ -253,6 +252,5 @@ int main(int argc, char *argv[]) {<br class=""> outs() << "Exit code: " << Result << "\n";<br class=""> }<br class=""><br class="">- ExitOnErr(Executor->disconnect());<br class=""> return 0;<br class=""> }<br class=""><br class="">diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp<br class="">index 8e4a283556617..2616dd225d021 100644<br class="">--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp<br class="">+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp<br class="">@@ -47,9 +47,9 @@ class RemoteExecutorProcessControl<br class=""> public:<br class=""> using BaseT::initializeORCRPCEPCBase;<br class=""><br class="">- RemoteExecutorProcessControl(ExecutionSession &ES,<br class="">- std::unique_ptr<RPCChannel> Channel,<br class="">- std::unique_ptr<RPCEndpoint> Endpoint);<br class="">+ RemoteExecutorProcessControl(std::unique_ptr<RPCChannel> Channel,<br class="">+ std::unique_ptr<RPCEndpoint> Endpoint,<br class="">+ BaseT::ErrorReporter ReportError);<br class=""><br class=""> void initializeMemoryManagement();<br class=""> Error disconnect() override;<br class="">@@ -64,10 +64,10 @@ class RemoteExecutorProcessControl<br class=""> };<br class=""><br class=""> RemoteExecutorProcessControl::RemoteExecutorProcessControl(<br class="">- ExecutionSession &ES, std::unique_ptr<RPCChannel> Channel,<br class="">- std::unique_ptr<RPCEndpoint> Endpoint)<br class="">- : BaseT(ES.getSymbolStringPool(), *Endpoint,<br class="">- [&ES](Error Err) { ES.reportError(std::move(Err)); }),<br class="">+ std::unique_ptr<RPCChannel> Channel, std::unique_ptr<RPCEndpoint> Endpoint,<br class="">+ BaseT::ErrorReporter ReportError)<br class="">+ : BaseT(std::make_shared<SymbolStringPool>(), *Endpoint,<br class="">+ std::move(ReportError)),<br class=""> Channel(std::move(Channel)), Endpoint(std::move(Endpoint)) {<br class=""><br class=""> ListenerThread = std::thread([&]() {<br class="">@@ -109,11 +109,17 @@ JITLinkExecutor::~JITLinkExecutor() = default;<br class=""><br class=""> Expected<std::unique_ptr<ObjectLayer>><br class=""> JITLinkExecutor::operator()(ExecutionSession &ES, const Triple &TT) {<br class="">+ assert(EPC && "RemoteExecutorProcessControl must be initialized");<br class=""> return std::make_unique<ObjectLinkingLayer>(ES, EPC->getMemMgr());<br class=""> }<br class=""><br class="">+std::unique_ptr<ExecutionSession> JITLinkExecutor::startSession() {<br class="">+ assert(OwnedEPC && "RemoteExecutorProcessControl must be initialized");<br class="">+ return std::make_unique<ExecutionSession>(std::move(OwnedEPC));<br class="">+}<br class="">+<br class=""> Error JITLinkExecutor::addDebugSupport(ObjectLayer &ObjLayer) {<br class="">- auto Registrar = createJITLoaderGDBRegistrar(*EPC);<br class="">+ auto Registrar = createJITLoaderGDBRegistrar(EPC->getExecutionSession());<br class=""> if (!Registrar)<br class=""> return Registrar.takeError();<br class=""><br class="">@@ -127,7 +133,8 @@ Error JITLinkExecutor::addDebugSupport(ObjectLayer &ObjLayer) {<br class=""> Expected<std::unique_ptr<DefinitionGenerator>><br class=""> JITLinkExecutor::loadDylib(StringRef RemotePath) {<br class=""> if (auto Handle = EPC->loadDylib(RemotePath.data()))<br class="">- return std::make_unique<EPCDynamicLibrarySearchGenerator>(*EPC, *Handle);<br class="">+ return std::make_unique<EPCDynamicLibrarySearchGenerator>(<br class="">+ EPC->getExecutionSession(), *Handle);<br class=""> else<br class=""> return Handle.takeError();<br class=""> }<br class="">@@ -174,7 +181,8 @@ JITLinkExecutor::CreateLocal(std::string ExecutablePath) {<br class=""><br class=""> TCPSocketJITLinkExecutor::TCPSocketJITLinkExecutor(<br class=""> std::unique_ptr<RemoteExecutorProcessControl> EPC) {<br class="">- this->EPC = std::move(EPC);<br class="">+ this->OwnedEPC = std::move(EPC);<br class="">+ this->EPC = this->OwnedEPC.get();<br class=""> }<br class=""><br class=""> #ifndef LLVM_ON_UNIX<br class="">@@ -197,7 +205,8 @@ JITLinkExecutor::ConnectTCPSocket(StringRef NetworkAddress,<br class=""><br class=""> #else<br class=""><br class="">-Error ChildProcessJITLinkExecutor::launch(ExecutionSession &ES) {<br class="">+Error ChildProcessJITLinkExecutor::launch(<br class="">+ unique_function<void(Error)> ErrorReporter) {<br class=""> constexpr int ReadEnd = 0;<br class=""> constexpr int WriteEnd = 1;<br class=""><br class="">@@ -252,13 +261,14 @@ Error ChildProcessJITLinkExecutor::launch(ExecutionSession &ES) {<br class=""> auto Endpoint = std::make_unique<RemoteExecutorProcessControl::RPCEndpoint>(<br class=""> *Channel, true);<br class=""><br class="">- EPC = std::make_unique<RemoteExecutorProcessControl>(ES, std::move(Channel),<br class="">- std::move(Endpoint));<br class="">+ OwnedEPC = std::make_unique<RemoteExecutorProcessControl>(<br class="">+ std::move(Channel), std::move(Endpoint), std::move(ErrorReporter));<br class=""><br class="">- if (auto Err = EPC->initializeORCRPCEPCBase())<br class="">- return joinErrors(std::move(Err), EPC->disconnect());<br class="">+ if (auto Err = OwnedEPC->initializeORCRPCEPCBase())<br class="">+ return joinErrors(std::move(Err), OwnedEPC->disconnect());<br class=""><br class="">- EPC->initializeMemoryManagement();<br class="">+ OwnedEPC->initializeMemoryManagement();<br class="">+ EPC = OwnedEPC.get();<br class=""><br class=""> shared::registerStringError<RPCChannel>();<br class=""> return Error::success();<br class="">@@ -305,7 +315,7 @@ static Expected<int> connectTCPSocketImpl(std::string Host,<br class=""><br class=""> Expected<std::unique_ptr<TCPSocketJITLinkExecutor>><br class=""> JITLinkExecutor::ConnectTCPSocket(StringRef NetworkAddress,<br class="">- ExecutionSession &ES) {<br class="">+ unique_function<void(Error)> ErrorReporter) {<br class=""> auto CreateErr = [NetworkAddress](StringRef Details) {<br class=""> return make_error<StringError>(<br class=""> formatv("Failed to connect TCP socket '{0}': {1}", NetworkAddress,<br class="">@@ -332,7 +342,7 @@ JITLinkExecutor::ConnectTCPSocket(StringRef NetworkAddress,<br class=""> *Channel, true);<br class=""><br class=""> auto EPC = std::make_unique<RemoteExecutorProcessControl>(<br class="">- ES, std::move(Channel), std::move(Endpoint));<br class="">+ std::move(Channel), std::move(Endpoint), std::move(ErrorReporter));<br class=""><br class=""> if (auto Err = EPC->initializeORCRPCEPCBase())<br class=""> return joinErrors(std::move(Err), EPC->disconnect());<br class=""><br class="">diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h<br class="">index baa376003a67b..5b15b1e9964f7 100644<br class="">--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h<br class="">+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.h<br class="">@@ -56,12 +56,16 @@ class JITLinkExecutor {<br class=""> /// through a TCP socket. A valid NetworkAddress provides hostname and port,<br class=""> /// e.g. localhost:20000.<br class=""> static Expected<std::unique_ptr<TCPSocketJITLinkExecutor>><br class="">- ConnectTCPSocket(StringRef NetworkAddress, ExecutionSession &ES);<br class="">+ ConnectTCPSocket(StringRef NetworkAddress,<br class="">+ unique_function<void(Error)> ErrorReporter);<br class=""><br class=""> // Implement ObjectLinkingLayerCreator<br class=""> Expected<std::unique_ptr<ObjectLayer>> operator()(ExecutionSession &,<br class=""> const Triple &);<br class=""><br class="">+ std::unique_ptr<ExecutionSession> startSession();<br class="">+ Error disconnect();<br class="">+<br class=""> Error addDebugSupport(ObjectLayer &ObjLayer);<br class=""><br class=""> Expected<std::unique_ptr<DefinitionGenerator>><br class="">@@ -69,12 +73,12 @@ class JITLinkExecutor {<br class=""><br class=""> Expected<int> runAsMain(JITEvaluatedSymbol MainSym,<br class=""> ArrayRef<std::string> Args);<br class="">- Error disconnect();<br class=""><br class=""> virtual ~JITLinkExecutor();<br class=""><br class=""> protected:<br class="">- std::unique_ptr<RemoteExecutorProcessControl> EPC;<br class="">+ std::unique_ptr<RemoteExecutorProcessControl> OwnedEPC{nullptr};<br class="">+ RemoteExecutorProcessControl *EPC{nullptr};<br class=""><br class=""> JITLinkExecutor();<br class=""> };<br class="">@@ -82,7 +86,7 @@ class JITLinkExecutor {<br class=""> /// JITLinkExecutor that runs in a child process on the local machine.<br class=""> class ChildProcessJITLinkExecutor : public JITLinkExecutor {<br class=""> public:<br class="">- Error launch(ExecutionSession &ES);<br class="">+ Error launch(unique_function<void(Error)> ErrorReporter);<br class=""><br class=""> pid_t getPID() const { return ProcessID; }<br class=""> StringRef getPath() const { return ExecutablePath; }<br class=""><br class="">diff --git a/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test b/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test<br class="">index a1ea7f9db1fd0..a09d72a76bef9 100644<br class="">--- a/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test<br class="">+++ b/llvm/test/Examples/OrcV2Examples/lljit-with-remote-debugging.test<br class="">@@ -1,10 +1,10 @@<br class=""> # This test makes sure that the example builds and executes as expected.<br class=""> # Instructions for debugging can be found in LLJITWithRemoteDebugging.cpp<br class=""><br class="">-# RUN: LLJITWithRemoteDebugging %p/Inputs/argc_sub1_elf.ll | FileCheck --check-prefix=CHECK1 %s<br class="">-# CHECK1: Parsing input IR code from: {{.*}}/Inputs/argc_sub1_elf.ll<br class="">-# CHECK1: Running: main()<br class="">-# CHECK1: Exit code: 0<br class="">+# RUN: LLJITWithRemoteDebugging %p/Inputs/argc_sub1_elf.ll | FileCheck --check-prefix=CHECK0 %s<br class="">+# CHECK0: Parsing input IR code from: {{.*}}/Inputs/argc_sub1_elf.ll<br class="">+# CHECK0: Running: main()<br class="">+# CHECK0: Exit code: 0<br class=""><br class=""> # RUN: LLJITWithRemoteDebugging %p/Inputs/argc_sub1_elf.ll --args 2nd 3rd 4th | FileCheck --check-prefix=CHECK3 %s<br class=""> # CHECK3: Parsing input IR code from: {{.*}}/Inputs/argc_sub1_elf.ll<br class=""><br class="">diff --git a/llvm/test/Examples/lit.local.cfg b/llvm/test/Examples/lit.local.cfg<br class="">index f23a918956ba7..a9f3860333603 100644<br class="">--- a/llvm/test/Examples/lit.local.cfg<br class="">+++ b/llvm/test/Examples/lit.local.cfg<br class="">@@ -1,7 +1,5 @@<br class="">-#if not config.build_examples or sys.platform in ['win32']:<br class="">-<br class="">-# Mark both lljit-with-* tests unsupported until D104694 lands.<br class="">-config.unsupported = True<br class="">+if not config.build_examples or sys.platform in ['win32']:<br class="">+ config.unsupported = True<br class=""><br class=""> # Test discovery should ignore subdirectories that contain test inputs.<br class=""> config.excludes = ['Inputs']<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>