[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
This commit is contained in:
Eugene Zhulenev 2020-10-22 13:35:49 -07:00
parent 9f4b888c32
commit b16f6324db
2 changed files with 6 additions and 0 deletions

View File

@ -59,7 +59,12 @@ mlirAsyncRuntimeAwaitToken(AsyncToken *token) {
extern "C" MLIR_ASYNCRUNTIME_EXPORT void extern "C" MLIR_ASYNCRUNTIME_EXPORT void
mlirAsyncRuntimeExecute(CoroHandle handle, CoroResume resume) { mlirAsyncRuntimeExecute(CoroHandle handle, CoroResume resume) {
#if LLVM_ENABLE_THREADS
std::thread thread([handle, resume]() { (*resume)(handle); });
thread.detach();
#else
(*resume)(handle); (*resume)(handle);
#endif
} }
extern "C" MLIR_ASYNCRUNTIME_EXPORT void extern "C" MLIR_ASYNCRUNTIME_EXPORT void

View File

@ -107,5 +107,6 @@ add_mlir_library(mlir_async_runtime
LINK_LIBS PUBLIC LINK_LIBS PUBLIC
mlir_c_runner_utils_static mlir_c_runner_utils_static
${LLVM_PTHREAD_LIB}
) )
target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS) target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS)