Author: Eugene Zhulenev Date: 2020-12-01T01:12:16-08:00 New Revision: 9edcedf7f222ce7c893d1e3bf19b3a7a1f0f2218
URL: https://github.com/llvm/llvm-project/commit/9edcedf7f222ce7c893d1e3bf19b3a7a1f0f2218 DIFF: https://github.com/llvm/llvm-project/commit/9edcedf7f222ce7c893d1e3bf19b3a7a1f0f2218.diff LOG: [mlir] AsyncRuntime: disable threading until test flakiness is fixed ExecutionEngine/LLJIT do not run globals destructors in loaded dynamic libraries when destroyed, and threads managed by ThreadPool can race with program termination, and it leads to segfaults. TODO: Re-enable threading after fixing a problem with destructors, or removing static globals from dynamic library. Differential Revision: https://reviews.llvm.org/D92368 Added: Modified: mlir/lib/ExecutionEngine/AsyncRuntime.cpp Removed: ################################################################################ diff --git a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp index 6bf59f86208d..3b90b9c694f3 100644 --- a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp +++ b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp @@ -24,8 +24,6 @@ #include <thread> #include <vector> -#include "llvm/Support/ThreadPool.h" - //===----------------------------------------------------------------------===// // Async runtime API. //===----------------------------------------------------------------------===// @@ -45,7 +43,6 @@ class AsyncRuntime { AsyncRuntime() : numRefCountedObjects(0) {} ~AsyncRuntime() { - threadPool.wait(); // wait for the completion of all async tasks assert(getNumRefCountedObjects() == 0 && "all ref counted objects must be destroyed"); } @@ -54,8 +51,6 @@ class AsyncRuntime { return numRefCountedObjects.load(std::memory_order_relaxed); } - llvm::ThreadPool &getThreadPool() { return threadPool; } - private: friend class RefCounted; @@ -69,8 +64,6 @@ class AsyncRuntime { } std::atomic<int32_t> numRefCountedObjects; - - llvm::ThreadPool threadPool; }; // Returns the default per-process instance of an async runtime. @@ -241,8 +234,7 @@ extern "C" void mlirAsyncRuntimeAwaitAllInGroup(AsyncGroup *group) { } extern "C" void mlirAsyncRuntimeExecute(CoroHandle handle, CoroResume resume) { - auto *runtime = getDefaultAsyncRuntimeInstance(); - runtime->getThreadPool().async([handle, resume]() { (*resume)(handle); }); + (*resume)(handle); } extern "C" void mlirAsyncRuntimeAwaitTokenAndExecute(AsyncToken *token, _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits