[MLIR] Single lit config attribute for CMAKE_LIBRARY_OUTPUT_DIRECTORY
authorChristian Sigg <csigg@google.com>
Sat, 3 Sep 2022 07:15:34 +0000 (09:15 +0200)
committerChristian Sigg <csigg@google.com>
Sat, 3 Sep 2022 14:04:07 +0000 (16:04 +0200)
Replace the following config attributes with `mlir_lib_dir`:
- `mlir_runner_utils_dir`
- `linalg_test_lib_dir`
- `spirv_wrapper_library_dir`
- `vulkan_wrapper_library_dir`
- `mlir_integration_test_dir`

I'm going to clean up substitutions in separate changes.

Reviewed By: aartbik, mehdi_amini

Differential Revision: https://reviews.llvm.org/D133217

mlir/test/CMakeLists.txt
mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/lit.local.cfg
mlir/test/lit.cfg.py
mlir/test/lit.site.cfg.py.in

index 74f8058..b8386a5 100644 (file)
@@ -10,15 +10,8 @@ endif()
 set(MLIR_CMAKE_DIR
   "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir")
 
-# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
-# for linalg integration tests.
-set(MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
-set(MLIR_RUNNER_UTILS_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
-
-# Passed to lit.site.cfg.py.in to set up the path where to find the libraries
-# for the mlir spirv / vulkan runner tests.
-set(MLIR_SPIRV_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
-set(MLIR_VULKAN_WRAPPER_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+# Passed to lit.site.cfg.py.in to set up the path where to find libraries.
+set(MLIR_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
 if (MLIR_INCLUDE_INTEGRATION_TESTS)
   set(INTEL_SDE_EXECUTABLE "" CACHE STRING
@@ -35,8 +28,6 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
   option(MLIR_RUN_X86VECTOR_TESTS "Run X86Vector tests.")
   option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.")
   option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE tests.")
-  # Passed to lit.site.cfg.py.in to set up the path where to find the libraries.
-  set(MLIR_INTEGRATION_TEST_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 
 
   # The native target may not be enabled when cross compiling, raise an error.
@@ -45,13 +36,14 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
   endif()
 
   # Copy test data over.
+  # TODO: drop copy and load files relative to MLIR_SOURCE_DIR / %mlir_src_root.
   file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns
             ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx
             ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric.mtx
             ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric_complex.mtx
             ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns
             ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx
-          DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/)
+          DESTINATION ${MLIR_LIB_DIR}/data/)
 endif()
 
 llvm_canonicalize_cmake_booleans(
index dab696b..8f84117 100644 (file)
@@ -10,12 +10,10 @@ if sys.platform == 'win32':
 
 lli_cmd = 'lli'
 if config.arm_emulator_lli_executable:
-   lli_cmd = config.arm_emulator_lli_executable
+    lli_cmd = config.arm_emulator_lli_executable
 
-if config.arm_emulator_utils_lib_dir:
-    config.substitutions.append(('%mlir_native_utils_lib_dir', config.arm_emulator_utils_lib_dir))
-else:
-    config.substitutions.append(('%mlir_native_utils_lib_dir', config.mlir_integration_test_dir))
+config.substitutions.append(('%mlir_native_utils_lib_dir',
+    config.arm_emulator_utils_lib_dir or config.mlir_lib_dir))
 
 if config.arm_emulator_executable:
     # Run test in emulator (qemu or armie)
index 7c3d086..3f7e594 100644 (file)
@@ -46,12 +46,6 @@ llvm_config.use_default_substitutions()
 config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt',
                    'lit.cfg.py', 'lit.site.cfg.py']
 
-# test_source_root: The root path where tests are located.
-config.test_source_root = os.path.dirname(__file__)
-
-# test_exec_root: The root path where tests should be run.
-config.test_exec_root = os.path.join(config.mlir_obj_root, 'test')
-
 # Tweak the PATH to include the tools dir.
 llvm_config.with_environment('PATH', config.mlir_tools_dir, append_path=True)
 llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
@@ -82,11 +76,13 @@ tools.extend([
     ToolSubst('toy-ch3', unresolved='ignore'),
     ToolSubst('toy-ch4', unresolved='ignore'),
     ToolSubst('toy-ch5', unresolved='ignore'),
-    ToolSubst('%linalg_test_lib_dir', config.linalg_test_lib_dir, unresolved='ignore'),
-    ToolSubst('%mlir_runner_utils_dir', config.mlir_runner_utils_dir, unresolved='ignore'),
-    ToolSubst('%spirv_wrapper_library_dir', config.spirv_wrapper_library_dir, unresolved='ignore'),
-    ToolSubst('%vulkan_wrapper_library_dir', config.vulkan_wrapper_library_dir, unresolved='ignore'),
-    ToolSubst('%mlir_integration_test_dir', config.mlir_integration_test_dir, unresolved='ignore'),
+    ToolSubst('%mlir_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
+    # The substitutions below will be replaced by '%mlir_lib_dir' shortly.
+    ToolSubst('%linalg_test_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
+    ToolSubst('%mlir_runner_utils_dir', config.mlir_lib_dir, unresolved='ignore'),
+    ToolSubst('%spirv_wrapper_library_dir', config.mlir_lib_dir, unresolved='ignore'),
+    ToolSubst('%vulkan_wrapper_library_dir', config.mlir_lib_dir, unresolved='ignore'),
+    ToolSubst('%mlir_integration_test_dir', config.mlir_lib_dir, unresolved='ignore'),
 ])
 
 python_executable = config.python_executable
index affdc2f..6b35070 100644 (file)
@@ -18,22 +18,19 @@ config.llvm_use_linker = "@LLVM_USE_LINKER@"
 config.host_arch = "@HOST_ARCH@"
 config.mlir_src_root = "@MLIR_SOURCE_DIR@"
 config.mlir_obj_root = "@MLIR_BINARY_DIR@"
-config.mlir_runner_utils_dir = "@MLIR_RUNNER_UTILS_DIR@"
 config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
 config.mlir_cmake_dir = "@MLIR_CMAKE_DIR@"
-config.linalg_test_lib_dir = "@MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR@"
+config.mlir_lib_dir = "@MLIR_LIB_DIR@"
+
 config.build_examples = @LLVM_BUILD_EXAMPLES@
 config.run_cuda_tests = @MLIR_ENABLE_CUDA_CONVERSIONS@
 config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@
 config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@
 config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@
 config.rocm_test_chipset = "@ROCM_TEST_CHIPSET@"
-config.spirv_wrapper_library_dir = "@MLIR_SPIRV_WRAPPER_LIBRARY_DIR@"
 config.enable_spirv_cpu_runner = @MLIR_ENABLE_SPIRV_CPU_RUNNER@
-config.vulkan_wrapper_library_dir = "@MLIR_VULKAN_WRAPPER_LIBRARY_DIR@"
 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@