4 if (MLIR_ENABLE_BINDINGS_PYTHON)
5 add_subdirectory(python)
8 # Passed to lit.site.cfg.py.so that the out of tree Standalone dialect test
9 # can find MLIR's CMake configuration
11 "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir")
13 # Passed to lit.site.cfg.py.in to set up the path where to find the libraries
14 # for linalg integration tests.
15 set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
16 set(MLIR_RUNNER_UTILS_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
18 # Passed to lit.site.cfg.py.in to set up the path where to find the libraries
19 # for the mlir spirv / vulkan runner tests.
20 set(MLIR_SPIRV_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
21 set(MLIR_VULKAN_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
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.")
26 option(MLIR_RUN_AMX_TESTS "Run AMX tests.")
27 option(MLIR_RUN_X86VECTOR_TESTS "Run X86Vector tests.")
28 option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.")
29 # Passed to lit.site.cfg.py.in to set up the path where to find the libraries.
30 set(MLIR_INTEGRATION_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
32 # Copy test data over.
33 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns
34 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx
35 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric.mtx
36 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns
37 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx
38 ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/zero.mtx
39 DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/)
42 llvm_canonicalize_cmake_booleans(
44 MLIR_ENABLE_BINDINGS_PYTHON
45 MLIR_ENABLE_CUDA_CONVERSIONS
46 MLIR_ENABLE_CUDA_RUNNER
47 MLIR_ENABLE_ROCM_CONVERSIONS
48 MLIR_ENABLE_ROCM_RUNNER
49 MLIR_ENABLE_SPIRV_CPU_RUNNER
50 MLIR_ENABLE_VULKAN_RUNNER
51 MLIR_INCLUDE_INTEGRATION_TESTS
53 MLIR_RUN_CUDA_TENSOR_CORE_TESTS
54 MLIR_RUN_X86VECTOR_TESTS
57 configure_lit_site_cfg(
58 ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
59 ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
61 ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
63 configure_lit_site_cfg(
64 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
65 ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
67 ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
72 mlir-capi-execution-engine-test
76 mlir-capi-sparse-tensor-test
78 mlir-linalg-ods-yaml-gen
90 if (MLIR_INCLUDE_INTEGRATION_TESTS)
91 list(APPEND MLIR_TEST_DEPENDS lli)
94 if(MLIR_ENABLE_CUDA_RUNNER)
95 list(APPEND MLIR_TEST_DEPENDS mlir_cuda_runtime)
98 if(MLIR_ENABLE_ROCM_RUNNER)
99 list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime)
102 list(APPEND MLIR_TEST_DEPENDS MLIRUnitTests)
104 if(LLVM_BUILD_EXAMPLES)
105 list(APPEND MLIR_TEST_DEPENDS
116 if(MLIR_ENABLE_SPIRV_CPU_RUNNER)
117 add_subdirectory(mlir-spirv-cpu-runner)
118 list(APPEND MLIR_TEST_DEPENDS
119 mlir-spirv-cpu-runner
120 mlir_test_spirv_cpu_runner_c_wrappers
124 if(MLIR_ENABLE_VULKAN_RUNNER)
125 list(APPEND MLIR_TEST_DEPENDS
130 if(MLIR_ENABLE_BINDINGS_PYTHON)
131 list(APPEND MLIR_TEST_DEPENDS
136 # This target can be used to just build the dependencies
137 # for the check-mlir target without executing the tests.
138 # This is useful for bots when splitting the build step
139 # from the testing step.
140 add_custom_target(check-mlir-build-only
141 DEPENDS ${MLIR_TEST_DEPENDS}
144 add_lit_testsuite(check-mlir "Running the MLIR regression tests"
145 ${CMAKE_CURRENT_BINARY_DIR}
146 DEPENDS ${MLIR_TEST_DEPENDS}
148 set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
150 add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
151 DEPENDS ${MLIR_TEST_DEPENDS}