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

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Aug 13 11:35:43 PDT 2024


================
@@ -58,3 +51,61 @@ aarch64_mcr_cmd = configure_aarch64_mcr_cmd()
 # * ARM_EMULATOR_UTILS_LIB_DIR - AArch64 native utilites library to support
 #                                cross-compilation.
 config.substitutions.append(("%mcr_aarch64_cmd", aarch64_mcr_cmd))
+
+# Substitutions for ARM_EMULATOR_UTILS_LIB_DIR, if set
+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)
+        )
+    )
----------------
banach-space wrote:

Perhaps I'm missing something, but couldn't this block be rewritten as:
```python
if config.arm_emulator_utils_lib_dir:
  base_dir = config.arm_emulator_utils_lib_dir
else:
  base_dir = config.mlir_lib_dir
  
config.substitutions.append(("%native_mlir_runner_utils", base_dir + mlir_runner_utils_file_name))
config.substitutions.append((...)))
```
? This way the `if`/`else` blocks would get nice and small.

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


More information about the Mlir-commits mailing list