[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
This commit is contained in:
Christian Sigg 2022-09-03 09:15:34 +02:00
parent 5c759edc57
commit f43c81470b
4 changed files with 16 additions and 33 deletions

View File

@ -10,15 +10,8 @@ endif()
set(MLIR_CMAKE_DIR set(MLIR_CMAKE_DIR
"${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir") "${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 # Passed to lit.site.cfg.py.in to set up the path where to find libraries.
# for linalg integration tests. set(MLIR_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
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})
if (MLIR_INCLUDE_INTEGRATION_TESTS) if (MLIR_INCLUDE_INTEGRATION_TESTS)
set(INTEL_SDE_EXECUTABLE "" CACHE STRING 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_X86VECTOR_TESTS "Run X86Vector tests.")
option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.") option(MLIR_RUN_CUDA_TENSOR_CORE_TESTS "Run CUDA Tensor core WMMA tests.")
option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE 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. # The native target may not be enabled when cross compiling, raise an error.
@ -45,13 +36,14 @@ if (MLIR_INCLUDE_INTEGRATION_TESTS)
endif() endif()
# Copy test data over. # 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 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.mtx
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test_symmetric.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_symmetric_complex.mtx
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/test.tns
${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx ${CMAKE_CURRENT_SOURCE_DIR}/Integration/data/wide.mtx
DESTINATION ${MLIR_INTEGRATION_TEST_DIR}/data/) DESTINATION ${MLIR_LIB_DIR}/data/)
endif() endif()
llvm_canonicalize_cmake_booleans( llvm_canonicalize_cmake_booleans(

View File

@ -10,12 +10,10 @@ if sys.platform == 'win32':
lli_cmd = 'lli' lli_cmd = 'lli'
if config.arm_emulator_lli_executable: 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.substitutions.append(('%mlir_native_utils_lib_dir', config.arm_emulator_utils_lib_dir)) config.arm_emulator_utils_lib_dir or config.mlir_lib_dir))
else:
config.substitutions.append(('%mlir_native_utils_lib_dir', config.mlir_integration_test_dir))
if config.arm_emulator_executable: if config.arm_emulator_executable:
# Run test in emulator (qemu or armie) # Run test in emulator (qemu or armie)

View File

@ -46,12 +46,6 @@ llvm_config.use_default_substitutions()
config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt', config.excludes = ['Inputs', 'CMakeLists.txt', 'README.txt', 'LICENSE.txt',
'lit.cfg.py', 'lit.site.cfg.py'] '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. # 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.mlir_tools_dir, append_path=True)
llvm_config.with_environment('PATH', config.llvm_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-ch3', unresolved='ignore'),
ToolSubst('toy-ch4', unresolved='ignore'), ToolSubst('toy-ch4', unresolved='ignore'),
ToolSubst('toy-ch5', unresolved='ignore'), ToolSubst('toy-ch5', unresolved='ignore'),
ToolSubst('%linalg_test_lib_dir', config.linalg_test_lib_dir, unresolved='ignore'), ToolSubst('%mlir_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
ToolSubst('%mlir_runner_utils_dir', config.mlir_runner_utils_dir, unresolved='ignore'), # The substitutions below will be replaced by '%mlir_lib_dir' shortly.
ToolSubst('%spirv_wrapper_library_dir', config.spirv_wrapper_library_dir, unresolved='ignore'), ToolSubst('%linalg_test_lib_dir', config.mlir_lib_dir, unresolved='ignore'),
ToolSubst('%vulkan_wrapper_library_dir', config.vulkan_wrapper_library_dir, unresolved='ignore'), ToolSubst('%mlir_runner_utils_dir', config.mlir_lib_dir, unresolved='ignore'),
ToolSubst('%mlir_integration_test_dir', config.mlir_integration_test_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 python_executable = config.python_executable

View File

@ -18,22 +18,19 @@ config.llvm_use_linker = "@LLVM_USE_LINKER@"
config.host_arch = "@HOST_ARCH@" config.host_arch = "@HOST_ARCH@"
config.mlir_src_root = "@MLIR_SOURCE_DIR@" config.mlir_src_root = "@MLIR_SOURCE_DIR@"
config.mlir_obj_root = "@MLIR_BINARY_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_tools_dir = "@MLIR_TOOLS_DIR@"
config.mlir_cmake_dir = "@MLIR_CMAKE_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.build_examples = @LLVM_BUILD_EXAMPLES@
config.run_cuda_tests = @MLIR_ENABLE_CUDA_CONVERSIONS@ config.run_cuda_tests = @MLIR_ENABLE_CUDA_CONVERSIONS@
config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@ config.enable_cuda_runner = @MLIR_ENABLE_CUDA_RUNNER@
config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@ config.run_rocm_tests = @MLIR_ENABLE_ROCM_CONVERSIONS@
config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@ config.enable_rocm_runner = @MLIR_ENABLE_ROCM_RUNNER@
config.rocm_test_chipset = "@ROCM_TEST_CHIPSET@" 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.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_vulkan_runner = @MLIR_ENABLE_VULKAN_RUNNER@
config.enable_bindings_python = @MLIR_ENABLE_BINDINGS_PYTHON@ 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.intel_sde_executable = "@INTEL_SDE_EXECUTABLE@"
config.mlir_run_amx_tests = @MLIR_RUN_AMX_TESTS@ config.mlir_run_amx_tests = @MLIR_RUN_AMX_TESTS@
config.mlir_run_x86vector_tests = @MLIR_RUN_X86VECTOR_TESTS@ config.mlir_run_x86vector_tests = @MLIR_RUN_X86VECTOR_TESTS@