Skip to content

Commit f43c814

Browse files
committed
[MLIR] Single lit config attribute for CMAKE_LIBRARY_OUTPUT_DIRECTORY
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
1 parent 5c759ed commit f43c814

File tree

4 files changed

+16
-33
lines changed

4 files changed

+16
-33
lines changed

mlir/test/CMakeLists.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,8 @@ endif()
1010
set(MLIR_CMAKE_DIR
1111
"${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir")
1212

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})
17-
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})
13+
# Passed to lit.site.cfg.py.in to set up the path where to find libraries.
14+
set(MLIR_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
2215

2316
if (MLIR_INCLUDE_INTEGRATION_TESTS)
2417
set(INTEL_SDE_EXECUTABLE "" CACHE STRING
@@ -35,8 +28,6 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
3528
option(MLIR_RUN_X86VECTOR_TESTS "Run X86Vector tests.")
3629
option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.")
3730
option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE tests.")
38-
# 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})
4031

4132

4233
# The native target may not be enabled when cross compiling, raise an error.
@@ -45,13 +36,14 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
4536
endif()
4637

4738
# Copy test data over.
39+
# TODO: drop copy and load files relative to MLIR_SOURCE_DIR / %mlir_src_root.
4840
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/mttkrp_b.tns
4941
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.mtx
5042
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric.mtx
5143
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric_complex.mtx
5244
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns
5345
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx
54-
DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/)
46+
DESTINATION ${MLIR_LIB_DIR}/data/)
5547
endif()
5648

5749
llvm_canonicalize_cmake_booleans(

mlir/test/Integration/Dialect/Vector/CPU/ArmSVE/lit.local.cfg

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ if sys.platform == 'win32':
1010

1111
lli_cmd = 'lli'
1212
if config.arm_emulator_lli_executable:
13-
lli_cmd = config.arm_emulator_lli_executable
13+
lli_cmd = config.arm_emulator_lli_executable
1414

15-
if config.arm_emulator_utils_lib_dir:
16-
config.substitutions.append(('%mlir_native_utils_lib_dir', config.arm_emulator_utils_lib_dir))
17-
else:
18-
config.substitutions.append(('%mlir_native_utils_lib_dir', config.mlir_integration_test_dir))
15+
config.substitutions.append(('%mlir_native_utils_lib_dir',
16+
config.arm_emulator_utils_lib_dir or config.mlir_lib_dir))
1917

2018
if config.arm_emulator_executable:
2119
# Run test in emulator (qemu or armie)

mlir/test/lit.cfg.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646
config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt',
4747
'lit.cfg.py', 'lit.site.cfg.py']
4848

49-
# test_source_root: The root path where tests are located.
50-
config.test_source_root = os.path.dirname(__file__)
51-
52-
# test_exec_root: The root path where tests should be run.
53-
config.test_exec_root = os.path.join(config.mlir_obj_root, 'test')
54-
5549
# Tweak the PATH to include the tools dir.
5650
llvm_config.with_environment('PATH', config.mlir_tools_dir, append_path=True)
5751
llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
@@ -82,11 +76,13 @@
8276
ToolSubst('toy-ch3', unresolved='ignore'),
8377
ToolSubst('toy-ch4', unresolved='ignore'),
8478
ToolSubst('toy-ch5', unresolved='ignore'),
85-
ToolSubst('%linalg_test_lib_dir', config.linalg_test_lib_dir, unresolved='ignore'),
86-
ToolSubst('%mlir_runner_utils_dir', config.mlir_runner_utils_dir, unresolved='ignore'),
87-
ToolSubst('%spirv_wrapper_library_dir', config.spirv_wrapper_library_dir, unresolved='ignore'),
88-
ToolSubst('%vulkan_wrapper_library_dir', config.vulkan_wrapper_library_dir, unresolved='ignore'),
89-
ToolSubst('%mlir_integration_test_dir', config.mlir_integration_test_dir, unresolved='ignore'),
79+
ToolSubst('%mlir_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
80+
# The substitutions below will be replaced by '%mlir_lib_dir' shortly.
81+
ToolSubst('%linalg_test_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
82+
ToolSubst('%mlir_runner_utils_dir', config.mlir_lib_dir, unresolved='ignore'),
83+
ToolSubst('%spirv_wrapper_library_dir', config.mlir_lib_dir, unresolved='ignore'),
84+
ToolSubst('%vulkan_wrapper_library_dir', config.mlir_lib_dir, unresolved='ignore'),
85+
ToolSubst('%mlir_integration_test_dir', config.mlir_lib_dir, unresolved='ignore'),
9086
])
9187

9288
python_executable = config.python_executable

mlir/test/lit.site.cfg.py.in

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,19 @@ config.llvm_use_linker = "@LLVM_USE_LINKER@"
1818
config.host_arch = "@HOST_ARCH@"
1919
config.mlir_src_root = "@MLIR_SOURCE_DIR@"
2020
config.mlir_obj_root = "@MLIR_BINARY_DIR@"
21-
config.mlir_runner_utils_dir = "@MLIR_RUNNER_UTILS_DIR@"
2221
config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
2322
config.mlir_cmake_dir = "@MLIR_CMAKE_DIR@"
24-
config.linalg_test_lib_dir = "@MLIR_DIALECT_LINALG_INTEGRATION_TEST_LIB_DIR@"
23+
config.mlir_lib_dir = "@MLIR_LIB_DIR@"
24+
2525
config.build_examples = @LLVM_BUILD_EXAMPLES@
2626
config.run_cuda_tests = @MLIR_ENABLE_CUDA_CONVERSIONS@
2727
config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@
2828
config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@
2929
config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@
3030
config.rocm_test_chipset = "@ROCM_TEST_CHIPSET@"
31-
config.spirv_wrapper_library_dir = "@MLIR_SPIRV_WRAPPER_LIBRARY_DIR@"
3231
config.enable_spirv_cpu_runner = @MLIR_ENABLE_SPIRV_CPU_RUNNER@
33-
config.vulkan_wrapper_library_dir = "@MLIR_VULKAN_WRAPPER_LIBRARY_DIR@"
3432
config.enable_vulkan_runner = @MLIR_ENABLE_VULKAN_RUNNER@
3533
config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@
36-
config.mlir_integration_test_dir = "@MLIR_INTEGRATION_TEST_DIR@"
3734
config.intel_sde_executable = "@INTEL_SDE_EXECUTABLE@"
3835
config.mlir_run_amx_tests = @MLIR_RUN_AMX_TESTS@
3936
config.mlir_run_x86vector_tests = @MLIR_RUN_X86VECTOR_TESTS@

0 commit comments

Comments
 (0)