[mlir][test] Add missing LIT config for `mlir-cpu-config` + emulator
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 21 Jul 2023 07:25:12 +0000 (07:25 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 21 Jul 2023 09:20:03 +0000 (09:20 +0000)
Similarly to when using `lli`, make sure that when using
`mlir-cpu-runner` with an emulator, a full path to `mlir-cpu-runner` is
used. Otherwise `mlir-cpu-runner` won't be found and you will get the
following error:
```
Error while loading mlir-cpu-runner: No such file or directory
```

This patch should fix:
  * https://lab.llvm.org/buildbot/#/builders/179
The breakage was originally introduced in
https://reviews.llvm.org/D155405.

Differential Revision: https://reviews.llvm.org/D155920

mlir/test/Integration/lit.local.cfg

index 12429d4..8600824 100644 (file)
@@ -36,14 +36,26 @@ def configure_aarch64_lli_and_mcr_cmd():
                 use_installed=False,
             )
 
+        if config.arm_emulator_mlir_cpu_runner_executable:
+            mcr_cmd = config.arm_emulator_mlir_cpu_runner_executable
+        else:
+            # Top-level LIT config adds llvm_tools_dir to PATH but this is lost
+            # when running under an emulator. If the user didn't specify an
+            # mlir-cpu-runner executable, use absolute path
+            # %llvm_tools_dir/mlir-cpu-runner.
+            mcr_cmd = llvm_config.use_llvm_tool(
+                "mlir-cpu-runner",
+                search_env="MLIR_CPU_RUNNER",
+                required=True,
+                search_paths=[config.mlir_tools_dir],
+                use_installed=False,
+            )
+
         # Run test in emulator (qemu or armie)
         emulation_cmd = (
             f"{config.arm_emulator_executable} {config.arm_emulator_options}"
         )
 
-        if config.arm_emulator_mlir_cpu_runner_executable:
-          mcr_cmd = config.arm_emulator_mlir_cpu_runner_executable
-
         lli_cmd = f"{emulation_cmd} {lli_cmd}"
         mcr_cmd = f"{emulation_cmd} {mcr_cmd}"