diff --git a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h --- a/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h +++ b/mlir/include/mlir/ExecutionEngine/CRunnerUtils.h @@ -26,7 +26,7 @@ #define MLIR_CRUNNERUTILS_EXPORT __declspec(dllimport) #endif // mlir_c_runner_utils_EXPORTS #endif // MLIR_CRUNNERUTILS_EXPORT -#else +#else // _WIN32 #define MLIR_CRUNNERUTILS_EXPORT #define MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS #endif // _WIN32 diff --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt --- a/mlir/lib/ExecutionEngine/CMakeLists.txt +++ b/mlir/lib/ExecutionEngine/CMakeLists.txt @@ -80,6 +80,7 @@ EXCLUDE_FROM_LIBMLIR ) set_property(TARGET mlir_c_runner_utils PROPERTY CXX_STANDARD 11) +target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS) add_mlir_library(mlir_c_runner_utils_static CRunnerUtils.cpp @@ -88,7 +89,6 @@ EXCLUDE_FROM_LIBMLIR ) set_property(TARGET mlir_c_runner_utils_static PROPERTY CXX_STANDARD 11) -target_compile_definitions(mlir_c_runner_utils PRIVATE mlir_c_runner_utils_EXPORTS) add_mlir_library(mlir_runner_utils SHARED @@ -101,6 +101,15 @@ ) target_compile_definitions(mlir_runner_utils PRIVATE mlir_runner_utils_EXPORTS) +add_mlir_library(mlir_runner_utils_static + RunnerUtils.cpp + + EXCLUDE_FROM_LIBMLIR + + LINK_LIBS PUBLIC + mlir_c_runner_utils_static +) + add_mlir_library(mlir_async_runtime SHARED AsyncRuntime.cpp @@ -112,3 +121,13 @@ ${LLVM_PTHREAD_LIB} ) target_compile_definitions(mlir_async_runtime PRIVATE mlir_async_runtime_EXPORTS) + +add_mlir_library(mlir_async_runtime_static + AsyncRuntime.cpp + + EXCLUDE_FROM_LIBMLIR + + LINK_LIBS PUBLIC + mlir_c_runner_utils_static + ${LLVM_PTHREAD_LIB} +) diff --git a/mlir/test/mlir-cuda-runner/all-reduce-and.mlir b/mlir/test/mlir-cuda-runner/all-reduce-and.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-and.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-and.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @main() { %data = alloc() : memref<2x6xi32> diff --git a/mlir/test/mlir-cuda-runner/all-reduce-max.mlir b/mlir/test/mlir-cuda-runner/all-reduce-max.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-max.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-max.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @main() { %data = alloc() : memref<2x6xi32> diff --git a/mlir/test/mlir-cuda-runner/all-reduce-min.mlir b/mlir/test/mlir-cuda-runner/all-reduce-min.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-min.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-min.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @main() { %data = alloc() : memref<2x6xi32> diff --git a/mlir/test/mlir-cuda-runner/all-reduce-op.mlir b/mlir/test/mlir-cuda-runner/all-reduce-op.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-op.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-op.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s // CHECK-COUNT-8: [{{(5356, ){12}5356}}] func @main() { diff --git a/mlir/test/mlir-cuda-runner/all-reduce-or.mlir b/mlir/test/mlir-cuda-runner/all-reduce-or.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-or.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-or.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @main() { %data = alloc() : memref<2x6xi32> diff --git a/mlir/test/mlir-cuda-runner/all-reduce-region.mlir b/mlir/test/mlir-cuda-runner/all-reduce-region.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-region.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-region.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s // CHECK: [{{(35, ){34}35}}] func @main() { diff --git a/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir b/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir --- a/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir +++ b/mlir/test/mlir-cuda-runner/all-reduce-xor.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @main() { %data = alloc() : memref<2x6xi32> diff --git a/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir b/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir --- a/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir +++ b/mlir/test/mlir-cuda-runner/gpu-to-cubin.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @other_func(%arg0 : f32, %arg1 : memref) { %cst = constant 1 : index diff --git a/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir b/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir --- a/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir +++ b/mlir/test/mlir-cuda-runner/multiple-all-reduce.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @main() { %data = alloc() : memref<2x6xf32> diff --git a/mlir/test/mlir-cuda-runner/shuffle.mlir b/mlir/test/mlir-cuda-runner/shuffle.mlir --- a/mlir/test/mlir-cuda-runner/shuffle.mlir +++ b/mlir/test/mlir-cuda-runner/shuffle.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s // CHECK: [4, 5, 6, 7, 0, 1, 2, 3, 12, -1, -1, -1, 8] func @main() { diff --git a/mlir/test/mlir-cuda-runner/two-modules.mlir b/mlir/test/mlir-cuda-runner/two-modules.mlir --- a/mlir/test/mlir-cuda-runner/two-modules.mlir +++ b/mlir/test/mlir-cuda-runner/two-modules.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-cuda-runner %s --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-cuda-runner %s \ +// RUN: --shared-libs=%cuda_wrapper_library_dir/libcuda-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s // CHECK: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] func @main() { diff --git a/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir b/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir --- a/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir +++ b/mlir/test/mlir-rocm-runner/gpu-to-hsaco.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-rocm-runner %s --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-rocm-runner %s \ +// RUN: --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @other_func(%arg0 : f32, %arg1 : memref) { %c0 = constant 0 : index diff --git a/mlir/test/mlir-rocm-runner/two-modules.mlir b/mlir/test/mlir-rocm-runner/two-modules.mlir --- a/mlir/test/mlir-rocm-runner/two-modules.mlir +++ b/mlir/test/mlir-rocm-runner/two-modules.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-rocm-runner %s --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-rocm-runner %s \ +// RUN: --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s // CHECK: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] func @main() { diff --git a/mlir/test/mlir-rocm-runner/vecadd.mlir b/mlir/test/mlir-rocm-runner/vecadd.mlir --- a/mlir/test/mlir-rocm-runner/vecadd.mlir +++ b/mlir/test/mlir-rocm-runner/vecadd.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-rocm-runner %s --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-rocm-runner %s \ +// RUN: --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @vecadd(%arg0 : memref, %arg1 : memref, %arg2 : memref) { %c0 = constant 0 : index diff --git a/mlir/test/mlir-rocm-runner/vector-transferops.mlir b/mlir/test/mlir-rocm-runner/vector-transferops.mlir --- a/mlir/test/mlir-rocm-runner/vector-transferops.mlir +++ b/mlir/test/mlir-rocm-runner/vector-transferops.mlir @@ -1,4 +1,7 @@ -// RUN: mlir-rocm-runner %s --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s +// RUN: mlir-rocm-runner %s \ +// RUN: --shared-libs=%rocm_wrapper_library_dir/librocm-runtime-wrappers%shlibext +// RUN: --entry-point-result=void \ +// RUN: | FileCheck %s func @vectransferx2(%arg0 : memref, %arg1 : memref) { %cst = constant 1 : index diff --git a/mlir/tools/mlir-cuda-runner/CMakeLists.txt b/mlir/tools/mlir-cuda-runner/CMakeLists.txt --- a/mlir/tools/mlir-cuda-runner/CMakeLists.txt +++ b/mlir/tools/mlir-cuda-runner/CMakeLists.txt @@ -37,6 +37,7 @@ target_link_libraries(cuda-runtime-wrappers PUBLIC LLVMSupport + mlir_runner_utils_static ${CUDA_RUNTIME_LIBRARY} ) diff --git a/mlir/tools/mlir-rocm-runner/CMakeLists.txt b/mlir/tools/mlir-rocm-runner/CMakeLists.txt --- a/mlir/tools/mlir-rocm-runner/CMakeLists.txt +++ b/mlir/tools/mlir-rocm-runner/CMakeLists.txt @@ -61,6 +61,7 @@ target_link_libraries(rocm-runtime-wrappers PUBLIC LLVMSupport + mlir_runner_utils_static ${ROCM_RUNTIME_LIBRARY} )