1 from lit.llvm import llvm_config
3 if not config.mlir_include_integration_tests:
4 config.unsupported = True
7 def configure_aarch64_mcr_cmd():
8 mcr_cmd = "mlir-cpu-runner"
10 # NOTE: If the SVE tests are disabled and the SME tests are enabled to run
11 # under emulation, the SVE specific RUN lines in the SparseTensor tests
12 # will run under emulation.
13 if not (config.mlir_run_arm_sve_tests or config.mlir_run_arm_sme_tests):
14 config.substitutions.append(("%mcr_aarch64_cmd", mcr_cmd))
17 if config.arm_emulator_executable:
18 if config.arm_emulator_mlir_cpu_runner_executable:
19 mcr_cmd = config.arm_emulator_mlir_cpu_runner_executable
21 # Top-level LIT config adds llvm_tools_dir to PATH but this is lost
22 # when running under an emulator. If the user didn't specify an
23 # mlir-cpu-runner executable, use absolute path
24 # %llvm_tools_dir/mlir-cpu-runner.
25 mcr_cmd = llvm_config.use_llvm_tool(
27 search_env="MLIR_CPU_RUNNER",
29 search_paths=[config.mlir_tools_dir],
33 # Run test in emulator (qemu or armie)
35 f"{config.arm_emulator_executable} {config.arm_emulator_options}"
38 mcr_cmd = f"{emulation_cmd} {mcr_cmd}"
40 config.substitutions.append(("%mcr_aarch64_cmd", mcr_cmd))
42 def configure_aarch64_mlir_utils():
43 # Use mlir runtime libs from the location passed by -DARM_EMULATOR_UTILS_LIB_DIR.
44 if config.arm_emulator_utils_lib_dir:
45 base_dir = config.arm_emulator_utils_lib_dir
47 base_dir = config.mlir_lib_dir
49 config.substitutions.append(("%native_mlir_runner_utils",
50 base_dir + "/libmlir_runner_utils" + config.llvm_shlib_ext))
51 config.substitutions.append(("%native_mlir_c_runner_utils",
52 base_dir + "/libmlir_c_runner_utils" + config.llvm_shlib_ext))
53 config.substitutions.append(("%native_mlir_arm_runner_utils",
54 base_dir + "/libmlir_arm_runner_utils" + config.llvm_shlib_ext))
55 # Use passed Arm SME ABI routines, if not present default to stubs.
56 config.substitutions.append(("%native_arm_sme_abi_shlib", config.arm_sme_abi_routines_shlib or
57 (base_dir + "/libmlir_arm_sme_abi_stubs" + config.llvm_shlib_ext)))
59 # AArch64 tests will run under emulation if configured at build time by the
60 # following CMake options:
62 # * ARM_EMULATOR_EXECUTABLE - emulator to use.
63 # * ARM_EMULATOR_OPTIONS - options for emulator.
64 # * ARM_EMULATOR_MLIR_CPU_RUNNER_EXECUTABLE - AArch64 native mlir-cpu-runner to
65 # support cross-compilation
66 # * ARM_EMULATOR_UTILS_LIB_DIR - AArch64 native utilites library to support
69 # Check for above options and set correct executables and runtime libs
70 configure_aarch64_mcr_cmd()
71 configure_aarch64_mlir_utils()