[mlir] Clean up boolean flags usage in LIT tests

* Call `llvm_canonicalize_cmake_booleans` for all CMake options,
  which are propagated to `lit.local.cfg` files.
* Use Python native boolean values instead of strings for such options.

This fixes the cases, when CMake variables have values other than `ON` (like `TRUE`).
This might happen due to IDE integration or due to CMake preset usage.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D110073
This commit is contained in:
Vladislav Vinogradov 2021-09-20 17:35:57 +03:00
parent e2d5a380e0
commit 505afd1e64
7 changed files with 24 additions and 20 deletions

View File

@ -1,17 +1,6 @@
add_subdirectory(CAPI)
add_subdirectory(lib)
llvm_canonicalize_cmake_booleans(
MLIR_ENABLE_BINDINGS_PYTHON
LLVM_BUILD_EXAMPLES
MLIR_ENABLE_CUDA_CONVERSIONS
MLIR_ENABLE_CUDA_RUNNER
MLIR_ENABLE_ROCM_CONVERSIONS
MLIR_ENABLE_ROCM_RUNNER
MLIR_ENABLE_SPIRV_CPU_RUNNER
MLIR_ENABLE_VULKAN_RUNNER
)
# Passed to lit.site.cfg.py.so that the out of tree Standalone dialect test
# can find MLIR's CMake configuration
set(MLIR_CMAKE_DIR
@ -45,6 +34,21 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/)
endif()
llvm_canonicalize_cmake_booleans(
LLVM_BUILD_EXAMPLES
MLIR_ENABLE_BINDINGS_PYTHON
MLIR_ENABLE_CUDA_CONVERSIONS
MLIR_ENABLE_CUDA_RUNNER
MLIR_ENABLE_ROCM_CONVERSIONS
MLIR_ENABLE_ROCM_RUNNER
MLIR_ENABLE_SPIRV_CPU_RUNNER
MLIR_ENABLE_VULKAN_RUNNER
MLIR_INCLUDE_INTEGRATION_TESTS
MLIR_RUN_AMX_TESTS
MLIR_RUN_CUDA_TENSOR_CORE_TESTS
MLIR_RUN_X86VECTOR_TESTS
)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py

View File

@ -1,7 +1,7 @@
import sys
# AMX tests must be enabled via build flag.
if config.mlir_run_amx_tests != 'ON':
if not config.mlir_run_amx_tests:
config.unsupported = True
# No JIT on win32.

View File

@ -1,7 +1,7 @@
import sys
# X86Vector tests must be enabled via build flag.
if config.mlir_run_x86vector_tests != 'ON':
if not config.mlir_run_x86vector_tests:
config.unsupported = True
# No JIT on win32.

View File

@ -1,5 +1,5 @@
import sys
# TensorCore tests must be enabled via build flag.
if config.mlir_run_cuda_tensor_core_tests != 'ON':
if not config.mlir_run_cuda_tensor_core_tests:
config.unsupported = True

View File

@ -1,2 +1,2 @@
if config.mlir_include_integration_tests != 'ON':
if not config.mlir_include_integration_tests:
config.unsupported = True

View File

@ -48,10 +48,10 @@ config.enable_vulkan_runner = @MLIR_ENABLE_VULKAN_RUNNER@
config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@
config.mlir_integration_test_dir = "@MLIR_INTEGRATION_TEST_DIR@"
config.intel_sde_executable = "@INTEL_SDE_EXECUTABLE@"
config.mlir_run_amx_tests = "@MLIR_RUN_AMX_TESTS@"
config.mlir_run_x86vector_tests = "@MLIR_RUN_X86VECTOR_TESTS@"
config.mlir_run_cuda_tensor_core_tests = "@MLIR_RUN_CUDA_TENSOR_CORE_TESTS@"
config.mlir_include_integration_tests = "@MLIR_INCLUDE_INTEGRATION_TESTS@"
config.mlir_run_amx_tests = @MLIR_RUN_AMX_TESTS@
config.mlir_run_x86vector_tests = @MLIR_RUN_X86VECTOR_TESTS@
config.mlir_run_cuda_tensor_core_tests = @MLIR_RUN_CUDA_TENSOR_CORE_TESTS@
config.mlir_include_integration_tests = @MLIR_INCLUDE_INTEGRATION_TESTS@
# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.

View File

@ -1,2 +1,2 @@
if config.mlir_include_integration_tests != 'ON':
if not config.mlir_include_integration_tests:
config.unsupported = True