4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/CUDA/shuffle.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin)' \
// RUN: -gpu-to-llvm \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_cuda_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_cuda_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/CUDA/two-modules.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-nvvm,gpu-to-cubin)' \
// RUN: -gpu-to-llvm \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_cuda_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_cuda_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/ROCM/gpu-to-hsaco.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-rocdl,gpu-to-hsaco{chip=%chip})' \
// RUN: -gpu-to-llvm \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/ROCM/printf.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-rocdl{index-bitwidth=32 runtime=HIP},gpu-to-hsaco{chip=%chip})' \
// RUN: -gpu-to-llvm \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/ROCM/two-modules.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-rocdl,gpu-to-hsaco{chip=%chip})' \
// RUN: -gpu-to-llvm \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/ROCM/vecadd.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-rocdl{use-bare-ptr-memref-call-conv=true},gpu-to-hsaco{chip=%chip})' \
// RUN: -gpu-to-llvm=use-bare-pointers-for-kernels=true \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
4 changes: 2 additions & 2 deletions mlir/test/Integration/GPU/ROCM/vector-transferops.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// RUN: -pass-pipeline='gpu.module(strip-debuginfo,convert-gpu-to-rocdl{chipset=%chip index-bitwidth=32},gpu-to-hsaco{chip=%chip})' \
// RUN: -gpu-to-llvm \
// RUN: | mlir-cpu-runner \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_rocm_runtime%shlibext \
// RUN: --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: --entry-point-result=void \
// RUN: | FileCheck %s

Expand Down
39 changes: 20 additions & 19 deletions mlir/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
ToolSubst('toy-ch4', unresolved='ignore'),
ToolSubst('toy-ch5', unresolved='ignore'),
ToolSubst('%mlir_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
ToolSubst('%mlir_src_dir', config.mlir_src_root, unresolved='ignore'),
# The substitutions below will be replaced by '%mlir_lib_dir' shortly.
ToolSubst('%linalg_test_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
ToolSubst('%mlir_runner_utils_dir', config.mlir_lib_dir, unresolved='ignore'),
Expand Down Expand Up @@ -111,33 +112,33 @@
# binaries come from the build tree. This should be unified to the build tree
# by copying/linking sources to build.
if config.enable_bindings_python:
llvm_config.with_environment('PYTHONPATH', [
os.path.join(config.mlir_obj_root, 'python_packages', 'mlir_core'),
os.path.join(config.mlir_obj_root, 'python_packages', 'mlir_test'),
], append_path=True)
llvm_config.with_environment('PYTHONPATH', [
os.path.join(config.mlir_obj_root, 'python_packages', 'mlir_core'),
os.path.join(config.mlir_obj_root, 'python_packages', 'mlir_test'),
], append_path=True)

if config.enable_assertions:
config.available_features.add('asserts')
config.available_features.add('asserts')
else:
config.available_features.add('noasserts')
config.available_features.add('noasserts')

def have_host_jit_feature_support(feature_name):
mlir_cpu_runner_exe = lit.util.which('mlir-cpu-runner', config.mlir_tools_dir)
mlir_cpu_runner_exe = lit.util.which('mlir-cpu-runner', config.mlir_tools_dir)

if not mlir_cpu_runner_exe:
return False
if not mlir_cpu_runner_exe:
return False

try:
mlir_cpu_runner_cmd = subprocess.Popen(
[mlir_cpu_runner_exe, '--host-supports-' + feature_name], stdout=subprocess.PIPE)
except OSError:
print('could not exec mlir-cpu-runner')
return False
try:
mlir_cpu_runner_cmd = subprocess.Popen(
[mlir_cpu_runner_exe, '--host-supports-' + feature_name], stdout=subprocess.PIPE)
except OSError:
print('could not exec mlir-cpu-runner')
return False

mlir_cpu_runner_out = mlir_cpu_runner_cmd.stdout.read().decode('ascii')
mlir_cpu_runner_cmd.wait()
mlir_cpu_runner_out = mlir_cpu_runner_cmd.stdout.read().decode('ascii')
mlir_cpu_runner_cmd.wait()

return 'true' in mlir_cpu_runner_out
return 'true' in mlir_cpu_runner_out

if have_host_jit_feature_support('jit'):
config.available_features.add('host-supports-jit')
config.available_features.add('host-supports-jit')
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// RUN: -reconcile-unrealized-casts \
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s

// -------------------------------------------------------------------------- //
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/mlir-cpu-runner/async-error.mlir
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: mlir-opt %s -pass-pipeline="async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-vector-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_async_runtime%shlibext \
// RUN: | FileCheck %s --dump-input=always

// FIXME: https://github.com/llvm/llvm-project/issues/57231
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/mlir-cpu-runner/async-group.mlir
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: mlir-opt %s -pass-pipeline="async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_async_runtime%shlibext \
// RUN: | FileCheck %s

// This is crashing in CI "most of the time" on a AMD Rome CPU VM on GCP with:
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/mlir-cpu-runner/async-value.mlir
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: mlir-opt %s -pass-pipeline="async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-arith-to-llvm),convert-vector-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_async_runtime%shlibext \
// RUN: | FileCheck %s --dump-input=always

// FIXME: https://github.com/llvm/llvm-project/issues/57231
Expand Down
6 changes: 3 additions & 3 deletions mlir/test/mlir-cpu-runner/async.mlir
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: mlir-opt %s -pass-pipeline="async-to-async-runtime,func.func(async-runtime-ref-counting,async-runtime-ref-counting-opt),convert-async-to-llvm,func.func(convert-linalg-to-loops,convert-scf-to-cf),convert-linalg-to-llvm,convert-memref-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_async_runtime%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_async_runtime%shlibext \
// RUN: | FileCheck %s

// FIXME: https://github.com/llvm/llvm-project/issues/57231
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/bare-ptr-call-conv.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-scf-to-cf,convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm{use-bare-ptr-memref-call-conv=1}" -reconcile-unrealized-casts | mlir-cpu-runner -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext -entry-point-result=void | FileCheck %s
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-scf-to-cf,convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm{use-bare-ptr-memref-call-conv=1}" -reconcile-unrealized-casts | mlir-cpu-runner -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext -entry-point-result=void | FileCheck %s

// Verify bare pointer memref calling convention. `simple_add1_add2_test`
// gets two 2xf32 memrefs, adds 1.0f to the first one and 2.0f to the second
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/copy.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-scf-to-cf,convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: | FileCheck %s

func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/global-memref.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e main -entry-point-result=void -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s

func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
func.func private @printMemrefI32(memref<*xi32>) attributes { llvm.emit_c_interface }
Expand Down
4 changes: 2 additions & 2 deletions mlir/test/mlir-cpu-runner/math-polynomial-approx.mlir
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(test-math-polynomial-approximation,convert-arith-to-llvm),convert-vector-to-llvm,func.func(convert-math-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner \
// RUN: -e main -entry-point-result=void -O0 \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext \
// RUN: | FileCheck %s

// -------------------------------------------------------------------------- //
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/memref-reinterpret-cast.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-scf-to-cf),convert-memref-to-llvm,func.func(convert-arith-to-llvm),convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: | FileCheck %s

func.func private @printMemrefF32(memref<*xf32>) attributes { llvm.emit_c_interface }
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/memref-reshape.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-scf-to-cf,memref-expand,convert-arith-to-llvm),convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: | FileCheck %s


Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/print.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -pass-pipeline="convert-func-to-llvm,reconcile-unrealized-casts" \
// RUN: | mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext \
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_c_runner_utils%shlibext \
// RUN: | FileCheck %s


Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/sgemm-naive-codegen.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-opt -pass-pipeline="func.func(convert-linalg-to-loops,lower-affine,convert-scf-to-cf,convert-arith-to-llvm),convert-vector-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" %s | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
// RUN: mlir-opt -pass-pipeline="func.func(convert-linalg-to-loops,lower-affine,convert-scf-to-cf,convert-arith-to-llvm),convert-vector-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" %s | mlir-cpu-runner -O3 -e main -entry-point-result=void -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s

func.func @main() {
%A = memref.alloc() : memref<16x16xf32>
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-cpu-runner/unranked-memref.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | \
// RUN: mlir-cpu-runner -e main -entry-point-result=void \
// RUN: -shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%mlir_runner_utils_dir/libmlir_c_runner_utils%shlibext | FileCheck %s
// RUN: -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s

// CHECK: rank = 2
// CHECK-SAME: sizes = [10, 3]
Expand Down
8 changes: 4 additions & 4 deletions mlir/test/mlir-cpu-runner/utils.mlir
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_0d -entry-point-result=void -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-0D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_1d -entry-point-result=void -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-1D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_3d -entry-point-result=void -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-3D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e vector_splat_2d -entry-point-result=void -shared-libs=%linalg_test_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%linalg_test_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-VECTOR-SPLAT-2D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_0d -entry-point-result=void -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-0D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_1d -entry-point-result=void -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-1D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e print_3d -entry-point-result=void -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-3D
// RUN: mlir-opt %s -pass-pipeline="func.func(convert-linalg-to-loops,convert-scf-to-cf,convert-arith-to-llvm),convert-linalg-to-llvm,convert-memref-to-llvm,convert-func-to-llvm,reconcile-unrealized-casts" | mlir-cpu-runner -e vector_splat_2d -entry-point-result=void -shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext -shared-libs=%mlir_lib_dir/libmlir_c_runner_utils%shlibext | FileCheck %s --check-prefix=PRINT-VECTOR-SPLAT-2D

func.func @print_0d() {
%f = arith.constant 2.00000e+00 : f32
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-spirv-cpu-runner/double.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-spirv-cpu-runner %s -e main --entry-point-result=void --shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%spirv_wrapper_library_dir/libmlir_test_spirv_cpu_runner_c_wrappers%shlibext
// RUN: mlir-spirv-cpu-runner %s -e main --entry-point-result=void --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_test_spirv_cpu_runner_c_wrappers%shlibext

// CHECK: [8, 8, 8, 8, 8, 8]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-spirv-cpu-runner/simple_add.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-spirv-cpu-runner %s -e main --entry-point-result=void --shared-libs=%mlir_runner_utils_dir/libmlir_runner_utils%shlibext,%spirv_wrapper_library_dir/libmlir_test_spirv_cpu_runner_c_wrappers%shlibext
// RUN: mlir-spirv-cpu-runner %s -e main --entry-point-result=void --shared-libs=%mlir_lib_dir/libmlir_runner_utils%shlibext,%mlir_lib_dir/libmlir_test_spirv_cpu_runner_c_wrappers%shlibext

// CHECK: [[[7.7, 0, 0], [7.7, 0, 0], [7.7, 0, 0]], [[0, 7.7, 0], [0, 7.7, 0], [0, 7.7, 0]], [[0, 0, 7.7], [0, 0, 7.7], [0, 0, 7.7]]]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-vulkan-runner/addf.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
// RUN: mlir-vulkan-runner %s --shared-libs=%mlir_lib_dir/libvulkan-runtime-wrappers%shlibext,%mlir_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s

// CHECK: [3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3, 3.3]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-vulkan-runner/addi.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
// RUN: mlir-vulkan-runner %s --shared-libs=%mlir_lib_dir/libvulkan-runtime-wrappers%shlibext,%mlir_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s

// CHECK-COUNT-64: [3, 3, 3, 3, 3, 3, 3, 3]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-vulkan-runner/addi8.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
// RUN: mlir-vulkan-runner %s --shared-libs=%mlir_lib_dir/libvulkan-runtime-wrappers%shlibext,%mlir_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s

// CHECK-COUNT-64: [3, 3, 3, 3, 3, 3, 3, 3]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-vulkan-runner/mulf.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
// RUN: mlir-vulkan-runner %s --shared-libs=%mlir_lib_dir/libvulkan-runtime-wrappers%shlibext,%mlir_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s

// CHECK-COUNT-4: [6, 6, 6, 6]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-vulkan-runner/subf.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
// RUN: mlir-vulkan-runner %s --shared-libs=%mlir_lib_dir/libvulkan-runtime-wrappers%shlibext,%mlir_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s

// CHECK-COUNT-32: [2.2, 2.2, 2.2, 2.2]
module attributes {
Expand Down
2 changes: 1 addition & 1 deletion mlir/test/mlir-vulkan-runner/time.mlir
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: mlir-vulkan-runner %s --shared-libs=%vulkan_wrapper_library_dir/libvulkan-runtime-wrappers%shlibext,%linalg_test_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s
// RUN: mlir-vulkan-runner %s --shared-libs=%mlir_lib_dir/libvulkan-runtime-wrappers%shlibext,%mlir_lib_dir/libmlir_runner_utils%shlibext --entry-point-result=void | FileCheck %s

// CHECK: Compute shader execution time
// CHECK: Command buffer submit time
Expand Down
92 changes: 76 additions & 16 deletions utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6471,7 +6471,36 @@ cc_library(
)

cc_library(
name = "mlir_c_runner_utils",
name = "mlir_async_runtime_api",
hdrs = ["include/mlir/ExecutionEngine/AsyncRuntime.h"],
includes = ["include"],
)

cc_library(
name = "_mlir_async_runtime",
srcs = ["lib/ExecutionEngine/AsyncRuntime.cpp"],
copts = ["-Dmlir_async_runtime_EXPORTS"],
deps = [
":mlir_async_runtime_api",
"//llvm:Support",
],
)

# Indirection to avoid output filename clash between cc_library and cc_binary.
alias(
name = "mlir_async_runtime",
actual = "_mlir_async_runtime",
)

cc_binary(
name = "libmlir_async_runtime.so",
linkshared = True,
linkstatic = False,
deps = [":mlir_async_runtime"],
)

cc_library(
name = "_mlir_c_runner_utils",
srcs = [
"lib/ExecutionEngine/CRunnerUtils.cpp",
"lib/ExecutionEngine/Float16bits.cpp",
Expand All @@ -6486,30 +6515,40 @@ cc_library(
includes = ["include"],
)

cc_library(
name = "mlir_async_runtime_api",
hdrs = ["include/mlir/ExecutionEngine/AsyncRuntime.h"],
includes = ["include"],
# Indirection to avoid output filename clash between cc_library and cc_binary.
alias(
name = "mlir_c_runner_utils",
actual = "_mlir_c_runner_utils",
)

cc_library(
name = "mlir_async_runtime",
srcs = ["lib/ExecutionEngine/AsyncRuntime.cpp"],
copts = ["-Dmlir_async_runtime_EXPORTS"],
deps = [
":mlir_async_runtime_api",
"//llvm:Support",
],
cc_binary(
name = "libmlir_c_runner_utils.so",
linkshared = True,
linkstatic = False,
deps = [":mlir_c_runner_utils"],
)

cc_library(
name = "mlir_runner_utils",
name = "_mlir_runner_utils",
srcs = ["lib/ExecutionEngine/RunnerUtils.cpp"],
hdrs = ["include/mlir/ExecutionEngine/RunnerUtils.h"],
includes = ["include"],
deps = [":mlir_c_runner_utils"],
)

# Indirection to avoid output filename clash between cc_library and cc_binary.
alias(
name = "mlir_runner_utils",
actual = "_mlir_runner_utils",
)

cc_binary(
name = "libmlir_runner_utils.so",
linkshared = True,
linkstatic = False,
deps = [":mlir_runner_utils"],
)

cc_binary(
name = "mlir-cpu-runner",
srcs = ["tools/mlir-cpu-runner/mlir-cpu-runner.cpp"],
Expand Down Expand Up @@ -6546,7 +6585,7 @@ cc_headers_only(
)

cc_library(
name = "mlir_cuda_runtime",
name = "_mlir_cuda_runtime",
srcs = ["lib/ExecutionEngine/CudaRuntimeWrappers.cpp"],
# Prevent needing EnableABIBreakingChecks symbol from LLVMSupport.
copts = ["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"],
Expand All @@ -6562,6 +6601,27 @@ cc_library(
],
)

# Indirection to avoid output filename clash between cc_library and cc_binary.
alias(
name = "mlir_cuda_runtime",
actual = "_mlir_cuda_runtime",
tags = [
"manual", # External dependency
"nobuildkite", # TODO(gcmn): Add support for this target
],
)

cc_binary(
name = "libmlir_cuda_runtime.so",
linkshared = True,
linkstatic = False,
tags = [
"manual", # External dependency
"nobuildkite", # TODO(gcmn): Add support for this target
],
deps = [":mlir_cuda_runtime"],
)

cc_library(
name = "VulkanRuntime",
srcs = ["tools/mlir-vulkan-runner/VulkanRuntime.cpp"],
Expand All @@ -6583,7 +6643,7 @@ cc_library(
)

cc_binary(
name = "tools/libvulkan-runtime-wrappers.so",
name = "libvulkan-runtime-wrappers.so",
srcs = ["tools/mlir-vulkan-runner/vulkan-runtime-wrappers.cpp"],
linkshared = True,
tags = [
Expand Down