[Mlir-commits] [mlir] b16f632 - [mlir] Link with pthreads in AsyncRuntime
Eugene Zhulenev
llvmlistbot at llvm.org
Fri Oct 23 12:52:59 PDT 2020
Author: Eugene Zhulenev
Date: 2020-10-23T12:52:51-07:00
New Revision: b16f6324db21f778aba9cb62452010aab13c2d1f
URL: https://github.com/llvm/llvm-project/commit/b16f6324db21f778aba9cb62452010aab13c2d1f
DIFF: https://github.com/llvm/llvm-project/commit/b16f6324db21f778aba9cb62452010aab13c2d1f.diff
LOG: [mlir] Link with pthreads in AsyncRuntime
AsyncRuntime must be explicitly linked with LLVM pthreads
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D89983
Added:
Modified:
mlir/lib/ExecutionEngine/AsyncRuntime.cpp
mlir/lib/ExecutionEngine/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
index b450a8334ae4..c4d1bba954cc 100644
--- a/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
+++ b/mlir/lib/ExecutionEngine/AsyncRuntime.cpp
@@ -59,7 +59,12 @@ mlirAsyncRuntimeAwaitToken(AsyncToken *token) {
extern "C" MLIR_ASYNCRUNTIME_EXPORT void
mlirAsyncRuntimeExecute(CoroHandle handle, CoroResume resume) {
+#if LLVM_ENABLE_THREADS
+ std::thread thread([handle, resume]() { (*resume)(handle); });
+ thread.detach();
+#else
(*resume)(handle);
+#endif
}
extern "C" MLIR_ASYNCRUNTIME_EXPORT void
diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index f66d49f2d0ae..407be2f5c684 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -107,5 +107,6 @@ add_mlir_library(mlir_async_runtime
LINK_LIBS PUBLIC
mlir_c_runner_utils_static
+ ${LLVM_PTHREAD_LIB}
)
target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS)
More information about the Mlir-commits
mailing list