[Mlir-commits] [mlir] 505afd1 - [mlir] Clean up boolean flags usage in LIT tests
Vladislav Vinogradov
llvmlistbot at llvm.org
Tue Oct 12 02:05:18 PDT 2021
Author: Vladislav Vinogradov
Date: 2021-10-12T11:44:48+03:00
New Revision: 505afd1e648355b3301d167a0fdc3d3bb402b351
URL: https://github.com/llvm/llvm-project/commit/505afd1e648355b3301d167a0fdc3d3bb402b351
DIFF: https://github.com/llvm/llvm-project/commit/505afd1e648355b3301d167a0fdc3d3bb402b351.diff
LOG: [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
Added:
Modified:
mlir/test/CMakeLists.txt
mlir/test/Integration/Dialect/Vector/CPU/AMX/lit.local.cfg
mlir/test/Integration/Dialect/Vector/CPU/X86Vector/lit.local.cfg
mlir/test/Integration/GPU/CUDA/TensorCore/lit.local.cfg
mlir/test/Integration/lit.local.cfg
mlir/test/lit.site.cfg.py.in
mlir/test/python/integration/lit.local.cfg
Removed:
################################################################################
diff --git a/mlir/test/CMakeLists.txt b/mlir/test/CMakeLists.txt
index ff39be5def24..33ea11ba9782 100644
--- a/mlir/test/CMakeLists.txt
+++ b/mlir/test/CMakeLists.txt
@@ -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
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/AMX/lit.local.cfg b/mlir/test/Integration/Dialect/Vector/CPU/AMX/lit.local.cfg
index ec6038bf427b..12c97dbfa61b 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/AMX/lit.local.cfg
+++ b/mlir/test/Integration/Dialect/Vector/CPU/AMX/lit.local.cfg
@@ -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.
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/lit.local.cfg b/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/lit.local.cfg
index 1415fb0c1758..0e22874db1d1 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/lit.local.cfg
+++ b/mlir/test/Integration/Dialect/Vector/CPU/X86Vector/lit.local.cfg
@@ -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.
diff --git a/mlir/test/Integration/GPU/CUDA/TensorCore/lit.local.cfg b/mlir/test/Integration/GPU/CUDA/TensorCore/lit.local.cfg
index fc19e5af86f1..451b9fcbed3d 100644
--- a/mlir/test/Integration/GPU/CUDA/TensorCore/lit.local.cfg
+++ b/mlir/test/Integration/GPU/CUDA/TensorCore/lit.local.cfg
@@ -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
diff --git a/mlir/test/Integration/lit.local.cfg b/mlir/test/Integration/lit.local.cfg
index f428e2534065..837d1b7c898d 100644
--- a/mlir/test/Integration/lit.local.cfg
+++ b/mlir/test/Integration/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.mlir_include_integration_tests != 'ON':
+if not config.mlir_include_integration_tests:
config.unsupported = True
diff --git a/mlir/test/lit.site.cfg.py.in b/mlir/test/lit.site.cfg.py.in
index 06d6e73bbaa1..a6f2eeb2a371 100644
--- a/mlir/test/lit.site.cfg.py.in
+++ b/mlir/test/lit.site.cfg.py.in
@@ -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.
diff --git a/mlir/test/python/integration/lit.local.cfg b/mlir/test/python/integration/lit.local.cfg
index f428e2534065..837d1b7c898d 100644
--- a/mlir/test/python/integration/lit.local.cfg
+++ b/mlir/test/python/integration/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.mlir_include_integration_tests != 'ON':
+if not config.mlir_include_integration_tests:
config.unsupported = True
More information about the Mlir-commits
mailing list