[Mlir-commits] [mlir] [MLIR][test] Run Integration tests for CPU using qemu-aarch64 (PR #101568)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Thu Aug 1 15:10:08 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-linalg

Author: Zhaoshi Zheng (zhaoshiz)

<details>
<summary>Changes</summary>

To run integration tests using qemu-aarch64 on x64 host, below flags are added to the cmake command when building mlir/llvm:

      -DMLIR_INCLUDE_INTEGRATION_TESTS=ON \
      -DMLIR_RUN_ARM_SVE_TESTS=ON \
      -DMLIR_RUN_ARM_SME_TESTS=ON \
      -DARM_EMULATOR_EXECUTABLE="<...>/qemu-aarch64" \
      -DARM_EMULATOR_OPTIONS="-L /usr/aarch64-linux-gnu" \
      -DARM_EMULATOR_MLIR_CPU_RUNNER_EXECUTABLE="<llvm_arm64_build_top>/bin/mlir-cpu-runner-arm64" \
      -DARM_EMULATOR_LLI_EXECUTABLE="<llvm_arm64_build_top>/bin/lli" \
      -DARM_EMULATOR_UTILS_LIB_DIR="<llvm_arm64_build_top>/lib"

The last three above are prebuilt on, or cross-built for, an aarch64 host.

---

Patch is 158.24 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/101568.diff


141 Files Affected:

- (modified) mlir/test/Integration/Dialect/LLVMIR/CPU/lit.local.cfg (+29-5) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/lit.local.cfg (+57) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/use-too-many-tiles.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/1d-depthwise-conv.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/fill-1d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/lit.local.cfg (+43) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_1d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_2d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/block.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/block_majors.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0_permute.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1_permute.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_bf16.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dense_output_f16.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/dual_sparse_conv_2d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/iterator-based-sqsum.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/padded_sparse_conv_2d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/reshape_dot.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_abs.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_binary.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block3d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_block_matmul.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cast.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_cmp.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_dim.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_codegen_foreach.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_collapse_shape.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex32.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex64.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_complex_ops.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_constant_to_sparse_tensor.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_1d_nwc_wcf.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_55.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nchw_fchw.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_2d_nhwc_hwcf.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conv_3d_ndhwc_dhwcf.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_block.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_dyn.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_element.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_ptr.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2dense.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_conversion_sparse2sparse.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_coo_test.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_dilated_conv_2d_nhwc_hwcf.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_dot.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_ds.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_empty.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_expand.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_expand_shape.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_filter_conv2d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_flatten.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_foreach_slices.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_generate.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_index_dense.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_1d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_2d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_insert_3d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_loose.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matmul_slice.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matrix_ops.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_matvec.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_mttkrp.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_mult_elt.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_reduction.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_out_simple.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pack.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pack_d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_permute.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_pooling_nhwc.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_print.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_print_3d.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_quantized_matmul.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_re_im.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_prod.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reduce_custom_sum.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_min.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reductions_prod.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_reshape.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_push_back.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_rewrite_sort_coo.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_matmul.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sampled_mm_fusion.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_scale.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_scf_nested.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_select.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_semiring_select.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sign.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sorted_coo.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_spmm.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_storage.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_strided_conv_2d_nhwc_hwcf.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_bf16.mlir (+3-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_c32.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum_f16.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tanh.mlir (+3-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_ops.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_transpose_coo.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_unary.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_vector_ops.mlir (+2-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/lit.local.cfg (+57) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/load-store-128-bit-tile.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/load-vertical.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/multi-tile-transpose.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/outerproduct-f16f16f32.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/outerproduct-f32.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/outerproduct-f64.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/outerproduct-i8i8i32.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/ssve.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/test-setArmSVLBits.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/tile-fill.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/transfer-read-2d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/transfer-write-2d.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/transpose.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-load-store.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSME/vector-ops.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/arrays-of-scalable-vectors.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/contraction.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/lit.local.cfg (+42) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/scalable-interleave.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/sve.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-scalable-deinterleave.mlir (+1-1) 
- (modified) mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/test-setArmVLBits.mlir (+1-1) 


``````````diff
diff --git a/mlir/test/Integration/Dialect/LLVMIR/CPU/lit.local.cfg b/mlir/test/Integration/Dialect/LLVMIR/CPU/lit.local.cfg
index 3214a1101f084..3733b6d4afb62 100644
--- a/mlir/test/Integration/Dialect/LLVMIR/CPU/lit.local.cfg
+++ b/mlir/test/Integration/Dialect/LLVMIR/CPU/lit.local.cfg
@@ -3,13 +3,30 @@ import sys
 lli_cmd = "lli"
 if config.riscv_emulator_lli_executable:
     lli_cmd = config.riscv_emulator_lli_executable
+elif config.arm_emulator_lli_executable:
+    lli_cmd = config.arm_emulator_lli_executable
 
-config.substitutions.append(
-    (
-        "%mlir_native_utils_lib_dir",
-        config.riscv_emulator_utils_lib_dir or config.mlir_lib_dir,
+if config.riscv_emulator_utils_lib_dir:
+    config.substitutions.append(
+        (
+            "%mlir_native_utils_lib_dir",
+            config.riscv_emulator_utils_lib_dir
+        )
+    )
+elif config.arm_emulator_utils_lib_dir:
+    config.substitutions.append(
+        (
+            "%mlir_native_utils_lib_dir",
+            config.arm_emulator_utils_lib_dir
+        )
+    )
+else:
+    config.substitutions.append(
+        (
+            "%mlir_native_utils_lib_dir",
+            config.mlir_lib_dir
+        )
     )
-)
 
 if config.riscv_vector_emulator_executable:
     # Run test in qemu emulator.
@@ -18,5 +35,12 @@ if config.riscv_vector_emulator_executable:
         emulation_cmd = emulation_cmd + " " + config.riscv_vector_emulator_options
     emulation_cmd = emulation_cmd + " " + lli_cmd + " --march=riscv64 -mattr=+v "
     config.substitutions.append(("%lli", emulation_cmd))
+elif config.arm_emulator_executable:
+    # Run test in qemu emulator.
+    emulation_cmd = config.arm_emulator_executable
+    if config.arm_emulator_options:
+        emulation_cmd = emulation_cmd + " " + config.arm_emulator_options
+    emulation_cmd = emulation_cmd + " " + lli_cmd + " --march=aarch64 -mattr=+neon "
+    config.substitutions.append(("%lli", emulation_cmd))
 else:
     config.substitutions.append(("%lli", lli_cmd))
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir
index 881e2799b5b06..ed4342b7d50af 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/fill-2d.mlir
@@ -6,7 +6,7 @@
 // RUN: %mcr_aarch64_cmd \
 // RUN:   -e=entry -entry-point-result=void \
 // RUN:   -march=aarch64 -mattr="+sve,+sme" \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils,%arm_sme_abi_shlib | \
+// RUN:   -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_arm_sme_abi_shlib | \
 // RUN: FileCheck %s
 
 func.func @entry() {
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/lit.local.cfg b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/lit.local.cfg
index 296b4419438e8..29c3fe64aa857 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/lit.local.cfg
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/lit.local.cfg
@@ -7,3 +7,60 @@ if not config.mlir_run_arm_sme_tests:
 # No JIT on win32.
 if sys.platform == "win32":
     config.unsupported = True
+
+mlir_runner_utils_file_name = "/libmlir_runner_utils" + config.llvm_shlib_ext
+mlir_c_runner_utils_file_name = "/libmlir_c_runner_utils" + config.llvm_shlib_ext
+mlir_arm_runner_utils_file_name = "/libmlir_arm_runner_utils" + config.llvm_shlib_ext
+arm_sme_abi_shlib_file_name = "/libmlir_arm_sme_abi_stubs" + config.llvm_shlib_ext
+if config.arm_emulator_utils_lib_dir:
+    # Use mlir runtime libs from the location passed by -DARM_EMULATOR_UTILS_LIB_DIR.
+    config.substitutions.append(
+        (
+            "%native_mlir_runner_utils",
+            config.arm_emulator_utils_lib_dir + mlir_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_mlir_c_runner_utils",
+            config.arm_emulator_utils_lib_dir + mlir_c_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (   "%native_mlir_arm_runner_utils",
+            config.arm_emulator_utils_lib_dir + mlir_arm_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_arm_sme_abi_shlib",
+            # Use passed Arm SME ABI routines, if not present default to stubs.
+            config.arm_sme_abi_routines_shlib or (config.arm_emulator_utils_lib_dir + arm_sme_abi_shlib_file_name)
+        )
+    )
+else:
+    config.substitutions.append(
+        (
+            "%native_mlir_runner_utils",
+            config.mlir_lib_dir + mlir_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_mlir_c_runner_utils",
+            config.mlir_lib_dir + mlir_c_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_mlir_arm_runner_utils",
+            config.mlir_lib_dir + mlir_arm_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_arm_sme_abi_shlib",
+            # Use passed Arm SME ABI routines, if not present default to stubs.
+            config.arm_sme_abi_routines_shlib or (config.mlir_lib_dir + arm_sme_abi_shlib_file_name)
+        )
+    )
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
index a8b6457d64bec..a57348a543c3c 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul-transpose-a.mlir
@@ -5,7 +5,7 @@
 // RUN: %mcr_aarch64_cmd \
 // RUN:   -e=main -entry-point-result=void \
 // RUN:   -march=aarch64 -mattr="+sve,+sme" \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils,%arm_sme_abi_shlib | \
+// RUN:   -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_arm_sme_abi_shlib | \
 // RUN: FileCheck %s
 
 func.func @matmul_transpose_a(%A : tensor<?x?xf32>, %B : tensor<?x?xf32>, %C : tensor<?x?xf32>) {
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
index 091665223188f..79c9fcac70604 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/matmul.mlir
@@ -4,7 +4,7 @@
 // RUN: %mcr_aarch64_cmd \
 // RUN:   -e=main -entry-point-result=void \
 // RUN:   -march=aarch64 -mattr="+sve,+sme" \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils,%arm_sme_abi_shlib | \
+// RUN:   -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_arm_sme_abi_shlib | \
 // RUN: FileCheck %s
 
 func.func @matmul(%A : tensor<?x?xf32>, %B : tensor<?x?xf32>, %C : tensor<?x?xf32>) {
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir
index aabd9d2ce788e..a8b250697432b 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul-mixed-types.mlir
@@ -10,7 +10,7 @@
 // RUN: %mcr_aarch64_cmd \
 // RUN:   -e=main -entry-point-result=void \
 // RUN:   -march=aarch64 -mattr="+sve,+sme" \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils,%arm_sme_abi_shlib,%mlir_arm_runner_utils | \
+// RUN:   -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_arm_sme_abi_shlib,%native_mlir_arm_runner_utils | \
 // RUN: FileCheck %s
 
 /// This is very similar to the SME multi-tile-matmul.mlir test, except that it
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul.mlir
index 03a7d25cffa76..243f9e5cde9f5 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/multi-tile-matmul.mlir
@@ -6,7 +6,7 @@
 // RUN: %mcr_aarch64_cmd \
 // RUN:   -e=main -entry-point-result=void \
 // RUN:   -march=aarch64 -mattr="+sve,+sme" \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils,%arm_sme_abi_shlib,%mlir_arm_runner_utils | \
+// RUN:   -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_arm_sme_abi_shlib,%native_mlir_arm_runner_utils | \
 // RUN: FileCheck %s
 
 /// This is very similar to the SME matmul.mlir test, except that it uses a tile
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/use-too-many-tiles.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/use-too-many-tiles.mlir
index 0b84b5a71b39b..05eee31ccc6fa 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/use-too-many-tiles.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSME/use-too-many-tiles.mlir
@@ -3,7 +3,7 @@
 // RUN: %mcr_aarch64_cmd \
 // RUN:   -e=main -entry-point-result=void \
 // RUN:   -march=aarch64 -mattr="+sve,+sme" \
-// RUN:   -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils,%arm_sme_abi_shlib | \
+// RUN:   -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils,%native_arm_sme_abi_shlib | \
 // RUN: FileCheck %s
 
 /// This function uses too many tiles! There's only two i16 tiles (ZA0.H and
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/1d-depthwise-conv.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/1d-depthwise-conv.mlir
index 56dce1c654017..3193147552525 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/1d-depthwise-conv.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/1d-depthwise-conv.mlir
@@ -4,7 +4,7 @@
 // DEFINE:    -convert-vector-to-llvm="enable-arm-sve" -test-lower-to-llvm -o %t
 // DEFINE: %{entry_point} = conv
 // DEFINE: %{run} = %mcr_aarch64_cmd %t -e %{entry_point} -entry-point-result=void --march=aarch64 --mattr="+sve"\
-// DEFINE:    -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils
+// DEFINE:    -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils
 
 // RUN: rm -f %t && %{compile} && %{run} | FileCheck %s
 
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/fill-1d.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/fill-1d.mlir
index 44b555c8c3ad5..6099eea1910d9 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/fill-1d.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/fill-1d.mlir
@@ -1,5 +1,5 @@
 // RUN: mlir-opt %s -transform-interpreter -test-transform-dialect-erase-schedule -lower-vector-mask -one-shot-bufferize -buffer-deallocation-pipeline -test-lower-to-llvm | \
-// RUN: %mcr_aarch64_cmd -e=entry -entry-point-result=void --march=aarch64 --mattr="+sve" -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils | \
+// RUN: %mcr_aarch64_cmd -e=entry -entry-point-result=void --march=aarch64 --mattr="+sve" -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils | \
 // RUN: FileCheck %s
 
 func.func @entry() {
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/lit.local.cfg b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/lit.local.cfg
index 37d3a74874ce4..e1c9367b119b4 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/lit.local.cfg
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/lit.local.cfg
@@ -1,4 +1,5 @@
 import sys
+from lit.llvm import llvm_config
 
 # ArmSVE tests must be enabled via build flag.
 if not config.mlir_run_arm_sve_tests:
@@ -7,3 +8,45 @@ if not config.mlir_run_arm_sve_tests:
 # No JIT on win32.
 if sys.platform == "win32":
     config.unsupported = True
+
+mlir_runner_utils_file_name = "/libmlir_runner_utils" + config.llvm_shlib_ext
+mlir_c_runner_utils_file_name = "/libmlir_c_runner_utils" + config.llvm_shlib_ext
+mlir_arm_runner_utils_file_name = "/libmlir_arm_runner_utils" + config.llvm_shlib_ext
+if config.arm_emulator_utils_lib_dir:
+    # Use mlir runtime libs from the location passed by -DARM_EMULATOR_UTILS_LIB_DIR.
+    config.substitutions.append(
+        (
+            "%native_mlir_runner_utils",
+            config.arm_emulator_utils_lib_dir + mlir_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_mlir_c_runner_utils",
+            config.arm_emulator_utils_lib_dir + mlir_c_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (   "%native_mlir_arm_runner_utils",
+            config.arm_emulator_utils_lib_dir + mlir_arm_runner_utils_file_name
+        )
+    )
+else:
+    config.substitutions.append(
+        (
+            "%native_mlir_runner_utils",
+            config.mlir_lib_dir + mlir_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_mlir_c_runner_utils",
+            config.mlir_lib_dir + mlir_c_runner_utils_file_name
+        )
+    )
+    config.substitutions.append(
+        (
+            "%native_mlir_arm_runner_utils",
+            config.mlir_lib_dir + mlir_arm_runner_utils_file_name
+        )
+    )
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir
index edb9de922808c..bcfeef772743b 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/matmul.mlir
@@ -4,7 +4,7 @@
 // DEFINE:    -convert-vector-to-llvm="enable-arm-sve" -test-lower-to-llvm -o %t
 // DEFINE: %{entry_point} = matmul_f32
 // DEFINE: %{run} = %mcr_aarch64_cmd %t -e %{entry_point} -entry-point-result=void --march=aarch64 --mattr="+sve"\
-// DEFINE:    -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils
+// DEFINE:    -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils
 
 // RUN: %{compile}
 
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_1d.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_1d.mlir
index 7cdb35918c4c0..3090e921553c6 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_1d.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_1d.mlir
@@ -4,7 +4,7 @@
 // DEFINE:    -convert-vector-to-llvm="enable-arm-sve" -test-lower-to-llvm -o %t
 // DEFINE: %{entry_point} = reduce_1d_f32
 // DEFINE: %{run} = %mcr_aarch64_cmd %t -e %{entry_point} -entry-point-result=void --march=aarch64 --mattr="+sve"\
-// DEFINE:    -shared-libs=%mlir_native_utils_lib_dir/libmlir_runner_utils%shlibext,%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
+// DEFINE:    -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils
 
 // RUN: %{compile}
 
diff --git a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_2d.mlir b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_2d.mlir
index bcfe12e374b4e..fc0fd40b4d265 100644
--- a/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_2d.mlir
+++ b/mlir/test/Integration/Dialect/Linalg/CPU/ArmSVE/reduce_2d.mlir
@@ -4,7 +4,7 @@
 // DEFINE:    -convert-vector-to-llvm="enable-arm-sve" -test-lower-to-llvm -o %t
 // DEFINE: %{entry_point} = reduce_2d_f32
 // DEFINE: %{run} = %mcr_aarch64_cmd %t -e %{entry_point} -entry-point-result=void --march=aarch64 --mattr="+sve"\
-// DEFINE:    -shared-libs=%mlir_native_utils_lib_dir/libmlir_runner_utils%shlibext,%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
+// DEFINE:    -shared-libs=%native_mlir_runner_utils,%native_mlir_c_runner_utils
 
 // RUN: %{compile}
 
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/block.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/block.mlir
index ab4fd0e30d654..5819e1aa0db93 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/block.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/block.mlir
@@ -10,9 +10,10 @@
 // DEFINE: %{compile} = mlir-opt %s --sparsifier="%{sparsifier_opts}"
 // DEFINE: %{compile_sve} = mlir-opt %s --sparsifier="%{sparsifier_opts_sve}"
 // DEFINE: %{run_libs} = -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils
+// DEFINE: %{run_libs_sve} = -shared-libs=%mlir_native_utils_lib_dir/libmlir_runner_utils%shlibext,%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
 // DEFINE: %{run_opts} = -e main -entry-point-result=void
 // DEFINE: %{run} = mlir-cpu-runner %{run_opts} %{run_libs}
-// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs}
+// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs_sve}
 //
 // DEFINE: %{env} =
 //--------------------------------------------------------------------------------------------------
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/block_majors.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/block_majors.mlir
index caa0d6a71ed37..601d66fb073c6 100755
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/block_majors.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/block_majors.mlir
@@ -10,9 +10,10 @@
 // DEFINE: %{compile} = mlir-opt %s --sparsifier="%{sparsifier_opts}"
 // DEFINE: %{compile_sve} = mlir-opt %s --sparsifier="%{sparsifier_opts_sve}"
 // DEFINE: %{run_libs} = -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils
+// DEFINE: %{run_libs_sve} = -shared-libs=%mlir_native_utils_lib_dir/libmlir_runner_utils%shlibext,%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
 // DEFINE: %{run_opts} = -e main -entry-point-result=void
 // DEFINE: %{run} = mlir-cpu-runner %{run_opts} %{run_libs}
-// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs}
+// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs_sve}
 //
 // DEFINE: %{env} =
 //--------------------------------------------------------------------------------------------------
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0.mlir
index 7edb76cc8045d..d1be197ab8da6 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0.mlir
@@ -10,9 +10,10 @@
 // DEFINE: %{compile} = mlir-opt %s --sparsifier="%{sparsifier_opts}"
 // DEFINE: %{compile_sve} = mlir-opt %s --sparsifier="%{sparsifier_opts_sve}"
 // DEFINE: %{run_libs} = -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils
+// DEFINE: %{run_libs_sve} = -shared-libs=%mlir_native_utils_lib_dir/libmlir_runner_utils%shlibext,%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
 // DEFINE: %{run_opts} = -e main -entry-point-result=void
 // DEFINE: %{run} = mlir-cpu-runner %{run_opts} %{run_libs}
-// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs}
+// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs_sve}
 //
 // DEFINE: %{env} =
 //--------------------------------------------------------------------------------------------------
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0_permute.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0_permute.mlir
index d17e110e2c2d9..f816cf8859d97 100644
--- a/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0_permute.mlir
+++ b/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_0_permute.mlir
@@ -10,9 +10,10 @@
 // DEFINE: %{compile} = mlir-opt %s --sparsifier="%{sparsifier_opts}"
 // DEFINE: %{compile_sve} = mlir-opt %s --sparsifier="%{sparsifier_opts_sve}"
 // DEFINE: %{run_libs} = -shared-libs=%mlir_c_runner_utils,%mlir_runner_utils
+// DEFINE: %{run_libs_sve} = -shared-libs=%mlir_native_utils_lib_dir/libmlir_runner_utils%shlibext,%mlir_native_utils_lib_dir/libmlir_c_runner_utils%shlibext
 // DEFINE: %{run_opts} = -e main -entry-point-result=void
 // DEFINE: %{run} = mlir-cpu-runner %{run_opts} %{run_libs}
-// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs}
+// DEFINE: %{run_sve} = %mcr_aarch64_cmd --march=aarch64 --mattr="+sve" %{run_opts} %{run_libs_sve}
 
 // DEFINE: %{env} =
 //--------------------------------------------------------------------------------------------------
diff --git a/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1.mlir b/mlir/test/Integration/Dialect/SparseTensor/CPU/concatenate_dim_1.mlir
index c2a4e95e7922e..a30f6475a7530 100644
--- a/mlir/test/Integration/D...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/101568


More information about the Mlir-commits mailing list