blob: 74f805865d2d31b2016a42ea165445026a3c8e1e [file] [log] [blame]
Alex Zinenko75f239e2020-08-05 12:36:161add_subdirectory(CAPI)
Nicolas Vasilachedac75ae2019-06-24 21:35:212add_subdirectory(lib)
Nicolas Vasilache5c64d2a2019-05-13 17:59:043
Alex Zinenko14c92072021-10-14 15:18:284if (MLIR_ENABLE_BINDINGS_PYTHON)
5 add_subdirectory(python)
6endif()
7
Krzysztof Drewniakb5324552021-06-02 17:21:178# Passed to lit.site.cfg.py.so that the out of tree Standalone dialect test
9# can find MLIR's CMake configuration
10set(MLIR_CMAKE_DIR
John Ericsone941b032022-08-19 02:44:4611 "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir")
Krzysztof Drewniakb5324552021-06-02 17:21:1712
Nicolas Vasilache6aa5cc82019-05-15 16:26:2713# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
14# for linalg integration tests.
Nicolas Vasilache9059cf32019-11-26 16:47:1415set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
Uday Bondhugula7fca0e92020-03-27 09:20:0516set(MLIR_RUNNER_UTILS_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
Nicolas Vasilache6aa5cc82019-05-15 16:26:2717
Stephan Herhute8b21a72019-07-04 14:49:5218# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
Christian Sigga825fb22021-03-19 07:22:5019# for the mlir spirv / vulkan runner tests.
George Mitenkov89808ce2020-10-23 14:46:1820set(MLIR_SPIRV_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
Denis Khalikov896ee362020-02-19 14:11:2221set(MLIR_VULKAN_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
Stephan Herhute8b21a72019-07-04 14:49:5222
Mehdi Amini99b00322021-02-23 00:56:0123if (MLIR_INCLUDE_INTEGRATION_TESTS)
24 set(INTEL_SDE_EXECUTABLE "" CACHE STRING
25 "If set, arch-specific integration tests are run with Intel SDE.")
Javier Setoainccb54d52021-06-03 09:34:4426 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 Bik6ad7b972021-03-15 22:32:5734 option(MLIR_RUN_AMX_TESTS "Run AMX tests.")
Emilio Cota8508a632021-04-12 17:15:3535 option(MLIR_RUN_X86VECTOR_TESTS "Run X86Vector tests.")
Navdeep Kumare552fa22021-05-22 10:46:0836 option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.")
Javier Setoainccb54d52021-06-03 09:34:4437 option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE tests.")
Mehdi Amini99b00322021-02-23 00:56:0138 # 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 Amini5a68a852022-01-14 06:57:5141
42 # The native target may not be enabled when cross compiling, raise an error.
Nikita Popov57a9bcc2022-08-03 13:28:4943 if(NOT MLIR_ENABLE_EXECUTION_ENGINE)
Mehdi Amini5a68a852022-01-14 06:57:5144 message(FATAL_ERROR "MLIR_INCLUDE_INTEGRATION_TESTS requires a native target")
45 endif()
46
Mehdi Amini99b00322021-02-23 00:56:0147 # Copy test data over.
Gus Smith22911582021-06-16 21:07:1548 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns
49 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx
Bixia Zheng027104132021-11-22 23:24:5250 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric.mtx
bixia15b1c5fc2022-06-07 23:45:3451 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric_complex.mtx
Mehdi Amini99b00322021-02-23 00:56:0152 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns
Aart Bika0c5b7e2021-04-01 23:23:1753 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx
Mehdi Amini99b00322021-02-23 00:56:0154 DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/)
55endif()
56
Vladislav Vinogradov505afd12021-09-20 14:35:5757llvm_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 Pienaar1273af22019-03-30 05:10:1272configure_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 )
78configure_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
85set(MLIR_TEST_DEPENDS
Mehdi Amini46b1e832022-01-14 07:29:5086 FileCheck count not split-file
Alex Zinenko75f239e2020-08-05 12:36:1687 mlir-capi-ir-test
Adam Paszke35d45932021-07-02 17:03:4688 mlir-capi-llvm-test
Mehdi Aminif61d1022020-11-03 21:38:3489 mlir-capi-pass-test
Stella Laurenzobcfa7ba2021-05-09 23:14:0590 mlir-capi-sparse-tensor-test
Alex Zinenko9bcf13b2022-01-03 18:01:0791 mlir-capi-quant-test
Denys Shabalina8a2ee62022-01-13 10:33:4292 mlir-capi-pdl-test
Tobias Gysi9a2769d2021-05-19 13:10:2893 mlir-linalg-ods-yaml-gen
River Riddle751c14f2021-04-21 21:33:0494 mlir-lsp-server
River Riddle52b34df2022-03-11 07:44:5395 mlir-pdll-lsp-server
Jacques Pienaar1273af22019-03-30 05:10:1296 mlir-opt
River Riddle11d26bd2021-12-16 01:48:1997 mlir-pdll
Mauricio Sifontesec04ce42020-07-07 23:42:4098 mlir-reduce
Jacques Pienaar1273af22019-03-30 05:10:1299 mlir-tblgen
100 mlir-translate
River Riddle5de12bb2022-05-09 17:36:48101 tblgen-lsp-server
Jacques Pienaar1273af22019-03-30 05:10:12102 )
103
Mehdi Amini8d20d832022-01-14 07:33:06104# 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 Amini46b1e832022-01-14 07:29:50107if(TARGET ${LLVM_NATIVE_ARCH})
108 list(APPEND MLIR_TEST_DEPENDS
109 mlir-cpu-runner
110 llc
Mehdi Amini772f7b82022-01-14 07:47:47111 mlir_async_runtime
112 mlir-capi-execution-engine-test
113 mlir_c_runner_utils
114 mlir_runner_utils
Mehdi Amini46b1e832022-01-14 07:29:50115 )
116endif()
117
Mehdi Amini68ec4aa2021-07-16 21:06:38118if (MLIR_INCLUDE_INTEGRATION_TESTS)
119 list(APPEND MLIR_TEST_DEPENDS lli)
120endif()
121
Uday Bondhugula9c21ddb2021-05-22 14:25:38122if(MLIR_ENABLE_CUDA_RUNNER)
Christian Sigg9d7be772021-03-03 10:24:38123 list(APPEND MLIR_TEST_DEPENDS mlir_cuda_runtime)
124endif()
125
Uday Bondhugula9c21ddb2021-05-22 14:25:38126if(MLIR_ENABLE_ROCM_RUNNER)
Christian Sigga825fb22021-03-19 07:22:50127 list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime)
128endif()
129
Mehdi Amini09cfec62021-02-11 01:17:24130list(APPEND MLIR_TEST_DEPENDS MLIRUnitTests)
Michał Górny2aa1af92021-02-02 19:09:45131
Mehdi Amini38b71d62019-04-02 17:02:07132if(LLVM_BUILD_EXAMPLES)
133 list(APPEND MLIR_TEST_DEPENDS
134 toyc-ch1
Mehdi Amini213dda62019-04-02 20:11:20135 toyc-ch2
Mehdi Amini092f3fa2019-04-04 02:16:32136 toyc-ch3
Mehdi Aminid33a9dc2019-04-05 01:31:31137 toyc-ch4
Mehdi Aminic39592b2019-04-09 06:00:49138 toyc-ch5
River Riddle0372eb42019-10-17 21:21:44139 toyc-ch6
River Riddle6b4e30b2019-11-07 17:53:27140 toyc-ch7
Mehdi Amini38b71d62019-04-02 17:02:07141 )
142endif()
143
Uday Bondhugula9c21ddb2021-05-22 14:25:38144if(MLIR_ENABLE_SPIRV_CPU_RUNNER)
George Mitenkov89808ce2020-10-23 14:46:18145 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 )
150endif()
151
Uday Bondhugula9c21ddb2021-05-22 14:25:38152if(MLIR_ENABLE_VULKAN_RUNNER)
Denis Khalikov896ee362020-02-19 14:11:22153 list(APPEND MLIR_TEST_DEPENDS
154 mlir-vulkan-runner
155 )
156endif()
157
Uday Bondhugula9c21ddb2021-05-22 14:25:38158if(MLIR_ENABLE_BINDINGS_PYTHON)
Stella Laurenzo722475a2020-07-07 06:05:46159 list(APPEND MLIR_TEST_DEPENDS
Stella Laurenzo310c9492021-07-22 19:57:41160 MLIRPythonModules
Stella Laurenzo722475a2020-07-07 06:05:46161 )
162endif()
163
Mehdi Aminia1d1c312021-10-02 04:06:17164# 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.
168add_custom_target(check-mlir-build-only
169 DEPENDS ${MLIR_TEST_DEPENDS}
170)
171
Jacques Pienaar1273af22019-03-30 05:10:12172add_lit_testsuite(check-mlir "Running the MLIR regression tests"
173 ${CMAKE_CURRENT_BINARY_DIR}
174 DEPENDS ${MLIR_TEST_DEPENDS}
175 )
176set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
177
178add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
Stephen Neuendorffer62828862020-05-15 17:33:13179 DEPENDS ${MLIR_TEST_DEPENDS}
Jacques Pienaar1273af22019-03-30 05:10:12180)