|
| 1 | +From 17ff6161b83e6a5e86fcb6a13c5551bba1438405 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Erick Ochoa < [email protected]> |
| 3 | +Date: Thu, 12 Sep 2024 21:16:58 -0400 |
| 4 | +Subject: [PATCH 1/9] [CMake] Add missing dependency (#108461) |
| 5 | + |
| 6 | +The [`mlir-capi-execution-engine-test` test |
| 7 | +executable](https://github.com/llvm/llvm-project/blob/main/mlir/test/CAPI/CMakeLists.txt#L26-L34) |
| 8 | + |
| 9 | +```cmake |
| 10 | +if(MLIR_ENABLE_EXECUTION_ENGINE) |
| 11 | + _add_capi_test_executable(mlir-capi-execution-engine-test |
| 12 | + execution_engine.c |
| 13 | + LINK_LIBS PRIVATE |
| 14 | + MLIRCAPIConversion |
| 15 | + MLIRCAPIExecutionEngine |
| 16 | + MLIRCAPIRegisterEverything |
| 17 | +) |
| 18 | +endif() |
| 19 | +``` |
| 20 | + |
| 21 | + |
| 22 | +is run by lit tests, but it is not properly listed as a dependency. It |
| 23 | +is added in places conditionally across the file |
| 24 | +[`tests/CMakeLists.txt`](https://github.com/llvm/llvm-project/blob/main/mlir/test/CMakeLists.txt#L130-L143) |
| 25 | + |
| 26 | +```cmake |
| 27 | +# The native target may not be enabled, in this case we won't |
| 28 | +# run tests that involves executing on the host: do not build |
| 29 | +# useless binaries. |
| 30 | +if(LLVM_ENABLE_PIC AND TARGET ${LLVM_NATIVE_ARCH}) |
| 31 | + list(APPEND MLIR_TEST_DEPENDS |
| 32 | + mlir-cpu-runner |
| 33 | + llc |
| 34 | + mlir_async_runtime |
| 35 | + mlir-capi-execution-engine-test |
| 36 | + mlir_c_runner_utils |
| 37 | + mlir_runner_utils |
| 38 | + mlir_float16_utils |
| 39 | + ) |
| 40 | +endif() |
| 41 | +``` |
| 42 | + |
| 43 | +But this condition is not the same as the one where the test executable |
| 44 | +is added. [It has been reported on discord that the following error |
| 45 | +occurred:](https://discord.com/channels/636084430946959380/642426447167881246/1283811636725022730) |
| 46 | + |
| 47 | +``` |
| 48 | +FAIL: MLIR :: CAPI/execution_engine.c (2 of 2121) |
| 49 | +******************** TEST 'MLIR :: CAPI/execution_engine.c' FAILED ******************** |
| 50 | +Exit Code: 127 |
| 51 | +Command Output (stdout): |
| 52 | +-- |
| 53 | +# RUN: at line 10 |
| 54 | +/usr/bin/mlir-capi-execution-engine-test 2>&1 | /usr/bin/FileCheck /builddir/build/BUILD/mlir-19.1.0_rc4-build/mlir-19.1.0-rc4.src/test/CAPI/execution_engine.c |
| 55 | +# executed command: /usr/bin/mlir-capi-execution-engine-test |
| 56 | +# .---command stderr------------ |
| 57 | +# | '/usr/bin/mlir-capi-execution-engine-test': command not found |
| 58 | +# `----------------------------- |
| 59 | +``` |
| 60 | + |
| 61 | +This error will not be deterministic and is dependent on the order in |
| 62 | +which tools are built. If by any chance, |
| 63 | +`mlir-capi-execution-engine-test` is built before the lit tests run, |
| 64 | +then nothing will happen. But lit tests can be run before |
| 65 | +`mlir-capi-execution-engine-test` is built. |
| 66 | + |
| 67 | +This patch adds the `mlir-capi-execution-engine` to the |
| 68 | +`MLIR_TEST_DEPENDS` list when the `MLIR_ENABLE_EXECUTION_ENGINE` flag is |
| 69 | +present. |
| 70 | + |
| 71 | +Happy to make changes like: |
| 72 | +* removing `mlir-capi-execution-engine-test` from the other place where |
| 73 | +it is included in the tests |
| 74 | +* and merge and sort alphabetically these two commands |
| 75 | + |
| 76 | +```cmake |
| 77 | +set(MLIR_TEST_DEPENDS |
| 78 | +FileCheck count not split-file |
| 79 | +mlir-capi-ir-test |
| 80 | +mlir-capi-irdl-test |
| 81 | +mlir-capi-llvm-test |
| 82 | +mlir-capi-pass-test |
| 83 | +mlir-capi-quant-test |
| 84 | +mlir-capi-rewrite-test |
| 85 | +mlir-capi-sparse-tensor-test |
| 86 | +mlir-capi-transform-test |
| 87 | +mlir-capi-transform-interpreter-test |
| 88 | +mlir-capi-translation-test |
| 89 | +mlir-linalg-ods-yaml-gen |
| 90 | +mlir-lsp-server |
| 91 | +mlir-opt |
| 92 | + mlir-query |
| 93 | + mlir-reduce |
| 94 | + mlir-tblgen |
| 95 | + mlir-translate |
| 96 | + tblgen-lsp-server |
| 97 | + tblgen-to-irdl |
| 98 | + ) |
| 99 | + |
| 100 | +set(MLIR_TEST_DEPENDS ${MLIR_TEST_DEPENDS} |
| 101 | + mlir-capi-pdl-test |
| 102 | + mlir-pdll-lsp-server |
| 103 | + mlir-pdll |
| 104 | + ) |
| 105 | +``` |
| 106 | + |
| 107 | +Co-authored-by: Erick Ochoa < [email protected]> |
| 108 | +--- |
| 109 | + mlir/test/CMakeLists.txt | 4 ++++ |
| 110 | + 1 file changed, 4 insertions(+) |
| 111 | + |
| 112 | +diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt |
| 113 | +index df95e5db11f1..4d2d738b734e 100644 |
| 114 | +--- a/mlir/test/CMakeLists.txt |
| 115 | ++++ b/mlir/test/CMakeLists.txt |
| 116 | +@@ -150,6 +150,10 @@ if(MLIR_ENABLE_CUDA_RUNNER) |
| 117 | + list(APPEND MLIR_TEST_DEPENDS mlir_cuda_runtime) |
| 118 | + endif() |
| 119 | + |
| 120 | ++if(MLIR_ENABLE_EXECUTION_ENGINE) |
| 121 | ++ list(APPEND MLIR_TEST_DEPENDS mlir-capi-execution-engine-test) |
| 122 | ++endif() |
| 123 | ++ |
| 124 | + if(MLIR_ENABLE_ROCM_RUNNER) |
| 125 | + list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime) |
| 126 | + endif() |
| 127 | +-- |
| 128 | +2.46.0 |
| 129 | + |
0 commit comments