Alex Zinenko | 75f239e | 2020-08-05 12:36:16 | [diff] [blame] | 1 | add_subdirectory(CAPI) |
Nicolas Vasilache | dac75ae | 2019-06-24 21:35:21 | [diff] [blame] | 2 | add_subdirectory(lib) |
Nicolas Vasilache | 5c64d2a | 2019-05-13 17:59:04 | [diff] [blame] | 3 | |
Alex Zinenko | 14c9207 | 2021-10-14 15:18:28 | [diff] [blame] | 4 | if (MLIR_ENABLE_BINDINGS_PYTHON) |
| 5 | add_subdirectory(python) |
| 6 | endif() |
| 7 | |
Krzysztof Drewniak | b532455 | 2021-06-02 17:21:17 | [diff] [blame] | 8 | # Passed to lit.site.cfg.py.so that the out of tree Standalone dialect test |
| 9 | # can find MLIR's CMake configuration |
| 10 | set(MLIR_CMAKE_DIR |
John Ericson | e941b03 | 2022-08-19 02:44:46 | [diff] [blame] | 11 | "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir") |
Krzysztof Drewniak | b532455 | 2021-06-02 17:21:17 | [diff] [blame] | 12 | |
Nicolas Vasilache | 6aa5cc8 | 2019-05-15 16:26:27 | [diff] [blame] | 13 | # Passed to lit.site.cfg.py.in to set up the path where to find the libraries |
| 14 | # for linalg integration tests. |
Nicolas Vasilache | 9059cf3 | 2019-11-26 16:47:14 | [diff] [blame] | 15 | set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) |
Uday Bondhugula | 7fca0e9 | 2020-03-27 09:20:05 | [diff] [blame] | 16 | set(MLIR_RUNNER_UTILS_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) |
Nicolas Vasilache | 6aa5cc8 | 2019-05-15 16:26:27 | [diff] [blame] | 17 | |
Stephan Herhut | e8b21a7 | 2019-07-04 14:49:52 | [diff] [blame] | 18 | # Passed to lit.site.cfg.py.in to set up the path where to find the libraries |
Christian Sigg | a825fb2 | 2021-03-19 07:22:50 | [diff] [blame] | 19 | # for the mlir spirv / vulkan runner tests. |
George Mitenkov | 89808ce | 2020-10-23 14:46:18 | [diff] [blame] | 20 | set(MLIR_SPIRV_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) |
Denis Khalikov | 896ee36 | 2020-02-19 14:11:22 | [diff] [blame] | 21 | set(MLIR_VULKAN_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) |
Stephan Herhut | e8b21a7 | 2019-07-04 14:49:52 | [diff] [blame] | 22 | |
Mehdi Amini | 99b0032 | 2021-02-23 00:56:01 | [diff] [blame] | 23 | if (MLIR_INCLUDE_INTEGRATION_TESTS) |
| 24 | set(INTEL_SDE_EXECUTABLE "" CACHE STRING |
| 25 | "If set, arch-specific integration tests are run with Intel SDE.") |
Javier Setoain | ccb54d5 | 2021-06-03 09:34:44 | [diff] [blame] | 26 | set(ARM_EMULATOR_EXECUTABLE "" CACHE STRING |
| 27 | "If set, arch-specific Arm integration tests are run with an emulator.") |
| 28 | set(ARM_EMULATOR_OPTIONS "" CACHE STRING |
| 29 | "If arch-specific Arm integration tests run emulated, pass these as parameters to the emulator.") |
| 30 | set(ARM_EMULATOR_LLI_EXECUTABLE "" CACHE STRING |
| 31 | "If arch-specific Arm integration tests run emulated, use this Arm native lli.") |
| 32 | set(ARM_EMULATOR_UTILS_LIB_DIR "" CACHE STRING |
| 33 | "If arch-specific Arm integration tests run emulated, find Arm native utility libraries in this directory.") |
Aart Bik | 6ad7b97 | 2021-03-15 22:32:57 | [diff] [blame] | 34 | option(MLIR_RUN_AMX_TESTS "Run AMX tests.") |
Emilio Cota | 8508a63 | 2021-04-12 17:15:35 | [diff] [blame] | 35 | option(MLIR_RUN_X86VECTOR_TESTS "Run X86Vector tests.") |
Navdeep Kumar | e552fa2 | 2021-05-22 10:46:08 | [diff] [blame] | 36 | option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.") |
Javier Setoain | ccb54d5 | 2021-06-03 09:34:44 | [diff] [blame] | 37 | option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE tests.") |
Mehdi Amini | 99b0032 | 2021-02-23 00:56:01 | [diff] [blame] | 38 | # Passed to lit.site.cfg.py.in to set up the path where to find the libraries. |
| 39 | set(MLIR_INTEGRATION_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) |
| 40 | |
Mehdi Amini | 5a68a85 | 2022-01-14 06:57:51 | [diff] [blame] | 41 | |
| 42 | # The native target may not be enabled when cross compiling, raise an error. |
Nikita Popov | 57a9bcc | 2022-08-03 13:28:49 | [diff] [blame] | 43 | if(NOT MLIR_ENABLE_EXECUTION_ENGINE) |
Mehdi Amini | 5a68a85 | 2022-01-14 06:57:51 | [diff] [blame] | 44 | message(FATAL_ERROR "MLIR_INCLUDE_INTEGRATION_TESTS requires a native target") |
| 45 | endif() |
| 46 | |
Mehdi Amini | 99b0032 | 2021-02-23 00:56:01 | [diff] [blame] | 47 | # Copy test data over. |
Gus Smith | 2291158 | 2021-06-16 21:07:15 | [diff] [blame] | 48 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns |
| 49 | ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx |
Bixia Zheng | 02710413 | 2021-11-22 23:24:52 | [diff] [blame] | 50 | ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric.mtx |
bixia1 | 5b1c5fc | 2022-06-07 23:45:34 | [diff] [blame] | 51 | ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric_complex.mtx |
Mehdi Amini | 99b0032 | 2021-02-23 00:56:01 | [diff] [blame] | 52 | ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns |
Aart Bik | a0c5b7e | 2021-04-01 23:23:17 | [diff] [blame] | 53 | ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx |
Mehdi Amini | 99b0032 | 2021-02-23 00:56:01 | [diff] [blame] | 54 | DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/) |
| 55 | endif() |
| 56 | |
Vladislav Vinogradov | 505afd1 | 2021-09-20 14:35:57 | [diff] [blame] | 57 | llvm_canonicalize_cmake_booleans( |
| 58 | LLVM_BUILD_EXAMPLES |
| 59 | MLIR_ENABLE_BINDINGS_PYTHON |
| 60 | MLIR_ENABLE_CUDA_CONVERSIONS |
| 61 | MLIR_ENABLE_CUDA_RUNNER |
| 62 | MLIR_ENABLE_ROCM_CONVERSIONS |
| 63 | MLIR_ENABLE_ROCM_RUNNER |
| 64 | MLIR_ENABLE_SPIRV_CPU_RUNNER |
| 65 | MLIR_ENABLE_VULKAN_RUNNER |
| 66 | MLIR_INCLUDE_INTEGRATION_TESTS |
| 67 | MLIR_RUN_AMX_TESTS |
| 68 | MLIR_RUN_CUDA_TENSOR_CORE_TESTS |
| 69 | MLIR_RUN_X86VECTOR_TESTS |
| 70 | ) |
| 71 | |
Jacques Pienaar | 1273af2 | 2019-03-30 05:10:12 | [diff] [blame] | 72 | configure_lit_site_cfg( |
| 73 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in |
| 74 | ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py |
| 75 | MAIN_CONFIG |
| 76 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py |
| 77 | ) |
| 78 | configure_lit_site_cfg( |
| 79 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in |
| 80 | ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py |
| 81 | MAIN_CONFIG |
| 82 | ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py |
| 83 | ) |
| 84 | |
| 85 | set(MLIR_TEST_DEPENDS |
Mehdi Amini | 46b1e83 | 2022-01-14 07:29:50 | [diff] [blame] | 86 | FileCheck count not split-file |
Alex Zinenko | 75f239e | 2020-08-05 12:36:16 | [diff] [blame] | 87 | mlir-capi-ir-test |
Adam Paszke | 35d4593 | 2021-07-02 17:03:46 | [diff] [blame] | 88 | mlir-capi-llvm-test |
Mehdi Amini | f61d102 | 2020-11-03 21:38:34 | [diff] [blame] | 89 | mlir-capi-pass-test |
Stella Laurenzo | bcfa7ba | 2021-05-09 23:14:05 | [diff] [blame] | 90 | mlir-capi-sparse-tensor-test |
Alex Zinenko | 9bcf13b | 2022-01-03 18:01:07 | [diff] [blame] | 91 | mlir-capi-quant-test |
Denys Shabalin | a8a2ee6 | 2022-01-13 10:33:42 | [diff] [blame] | 92 | mlir-capi-pdl-test |
Tobias Gysi | 9a2769d | 2021-05-19 13:10:28 | [diff] [blame] | 93 | mlir-linalg-ods-yaml-gen |
River Riddle | 751c14f | 2021-04-21 21:33:04 | [diff] [blame] | 94 | mlir-lsp-server |
River Riddle | 52b34df | 2022-03-11 07:44:53 | [diff] [blame] | 95 | mlir-pdll-lsp-server |
Jacques Pienaar | 1273af2 | 2019-03-30 05:10:12 | [diff] [blame] | 96 | mlir-opt |
River Riddle | 11d26bd | 2021-12-16 01:48:19 | [diff] [blame] | 97 | mlir-pdll |
Mauricio Sifontes | ec04ce4 | 2020-07-07 23:42:40 | [diff] [blame] | 98 | mlir-reduce |
Jacques Pienaar | 1273af2 | 2019-03-30 05:10:12 | [diff] [blame] | 99 | mlir-tblgen |
| 100 | mlir-translate |
River Riddle | 5de12bb | 2022-05-09 17:36:48 | [diff] [blame] | 101 | tblgen-lsp-server |
Jacques Pienaar | 1273af2 | 2019-03-30 05:10:12 | [diff] [blame] | 102 | ) |
| 103 | |
Mehdi Amini | 8d20d83 | 2022-01-14 07:33:06 | [diff] [blame] | 104 | # The native target may not be enabled, in this case we won't |
| 105 | # run tests that involves executing on the host: do not build |
| 106 | # useless binaries. |
Mehdi Amini | 46b1e83 | 2022-01-14 07:29:50 | [diff] [blame] | 107 | if(TARGET ${LLVM_NATIVE_ARCH}) |
| 108 | list(APPEND MLIR_TEST_DEPENDS |
| 109 | mlir-cpu-runner |
| 110 | llc |
Mehdi Amini | 772f7b8 | 2022-01-14 07:47:47 | [diff] [blame] | 111 | mlir_async_runtime |
| 112 | mlir-capi-execution-engine-test |
| 113 | mlir_c_runner_utils |
| 114 | mlir_runner_utils |
Mehdi Amini | 46b1e83 | 2022-01-14 07:29:50 | [diff] [blame] | 115 | ) |
| 116 | endif() |
| 117 | |
Mehdi Amini | 68ec4aa | 2021-07-16 21:06:38 | [diff] [blame] | 118 | if (MLIR_INCLUDE_INTEGRATION_TESTS) |
| 119 | list(APPEND MLIR_TEST_DEPENDS lli) |
| 120 | endif() |
| 121 | |
Uday Bondhugula | 9c21ddb | 2021-05-22 14:25:38 | [diff] [blame] | 122 | if(MLIR_ENABLE_CUDA_RUNNER) |
Christian Sigg | 9d7be77 | 2021-03-03 10:24:38 | [diff] [blame] | 123 | list(APPEND MLIR_TEST_DEPENDS mlir_cuda_runtime) |
| 124 | endif() |
| 125 | |
Uday Bondhugula | 9c21ddb | 2021-05-22 14:25:38 | [diff] [blame] | 126 | if(MLIR_ENABLE_ROCM_RUNNER) |
Christian Sigg | a825fb2 | 2021-03-19 07:22:50 | [diff] [blame] | 127 | list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime) |
| 128 | endif() |
| 129 | |
Mehdi Amini | 09cfec6 | 2021-02-11 01:17:24 | [diff] [blame] | 130 | list(APPEND MLIR_TEST_DEPENDS MLIRUnitTests) |
Michał Górny | 2aa1af9 | 2021-02-02 19:09:45 | [diff] [blame] | 131 | |
Mehdi Amini | 38b71d6 | 2019-04-02 17:02:07 | [diff] [blame] | 132 | if(LLVM_BUILD_EXAMPLES) |
| 133 | list(APPEND MLIR_TEST_DEPENDS |
| 134 | toyc-ch1 |
Mehdi Amini | 213dda6 | 2019-04-02 20:11:20 | [diff] [blame] | 135 | toyc-ch2 |
Mehdi Amini | 092f3fa | 2019-04-04 02:16:32 | [diff] [blame] | 136 | toyc-ch3 |
Mehdi Amini | d33a9dc | 2019-04-05 01:31:31 | [diff] [blame] | 137 | toyc-ch4 |
Mehdi Amini | c39592b | 2019-04-09 06:00:49 | [diff] [blame] | 138 | toyc-ch5 |
River Riddle | 0372eb4 | 2019-10-17 21:21:44 | [diff] [blame] | 139 | toyc-ch6 |
River Riddle | 6b4e30b | 2019-11-07 17:53:27 | [diff] [blame] | 140 | toyc-ch7 |
Mehdi Amini | 38b71d6 | 2019-04-02 17:02:07 | [diff] [blame] | 141 | ) |
| 142 | endif() |
| 143 | |
Uday Bondhugula | 9c21ddb | 2021-05-22 14:25:38 | [diff] [blame] | 144 | if(MLIR_ENABLE_SPIRV_CPU_RUNNER) |
George Mitenkov | 89808ce | 2020-10-23 14:46:18 | [diff] [blame] | 145 | add_subdirectory(mlir-spirv-cpu-runner) |
| 146 | list(APPEND MLIR_TEST_DEPENDS |
| 147 | mlir-spirv-cpu-runner |
| 148 | mlir_test_spirv_cpu_runner_c_wrappers |
| 149 | ) |
| 150 | endif() |
| 151 | |
Uday Bondhugula | 9c21ddb | 2021-05-22 14:25:38 | [diff] [blame] | 152 | if(MLIR_ENABLE_VULKAN_RUNNER) |
Denis Khalikov | 896ee36 | 2020-02-19 14:11:22 | [diff] [blame] | 153 | list(APPEND MLIR_TEST_DEPENDS |
| 154 | mlir-vulkan-runner |
| 155 | ) |
| 156 | endif() |
| 157 | |
Uday Bondhugula | 9c21ddb | 2021-05-22 14:25:38 | [diff] [blame] | 158 | if(MLIR_ENABLE_BINDINGS_PYTHON) |
Stella Laurenzo | 722475a | 2020-07-07 06:05:46 | [diff] [blame] | 159 | list(APPEND MLIR_TEST_DEPENDS |
Stella Laurenzo | 310c949 | 2021-07-22 19:57:41 | [diff] [blame] | 160 | MLIRPythonModules |
Stella Laurenzo | 722475a | 2020-07-07 06:05:46 | [diff] [blame] | 161 | ) |
| 162 | endif() |
| 163 | |
Mehdi Amini | a1d1c31 | 2021-10-02 04:06:17 | [diff] [blame] | 164 | # This target can be used to just build the dependencies |
| 165 | # for the check-mlir target without executing the tests. |
| 166 | # This is useful for bots when splitting the build step |
| 167 | # from the testing step. |
| 168 | add_custom_target(check-mlir-build-only |
| 169 | DEPENDS ${MLIR_TEST_DEPENDS} |
| 170 | ) |
| 171 | |
Jacques Pienaar | 1273af2 | 2019-03-30 05:10:12 | [diff] [blame] | 172 | add_lit_testsuite(check-mlir "Running the MLIR regression tests" |
| 173 | ${CMAKE_CURRENT_BINARY_DIR} |
| 174 | DEPENDS ${MLIR_TEST_DEPENDS} |
| 175 | ) |
| 176 | set_target_properties(check-mlir PROPERTIES FOLDER "Tests") |
| 177 | |
| 178 | add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR} |
Stephen Neuendorffer | 6282886 | 2020-05-15 17:33:13 | [diff] [blame] | 179 | DEPENDS ${MLIR_TEST_DEPENDS} |
Jacques Pienaar | 1273af2 | 2019-03-30 05:10:12 | [diff] [blame] | 180 | ) |