mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 14:20:17 +00:00
c8d1388e6c
This patch adds a couple of tests for targeting Arm Streaming SVE (SSVE) mode, part of the Arm Scalable Matrix Extension (SME). SSVE is enabled in the backend at the function boundary by specifying the `aarch64_pstate_sm_enabled` attribute, as documented here [1]. SSVE can be targeted from MLIR by specifying this in the passthrough attributes [2] and compiling with -mattr=+sme,+sve -force-streaming-compatible-sve The passthrough will propagate to the backend where `smstart/smstop` will be emitted around the call to the SSVE function. The set of legal instructions changes in SSVE, `-force-streaming-compatible-sve` avoids the use of NEON entirely and instead lowers to (streaming-compatible) SVE. The behaviour this flag predicates will be hooked up to the function attribute in the future such that simply specifying this (should) lead to correct code-generation. Two tests are added: * A basic LLVMIR test verifying the attribute is passed through. * An integration test calling a SSVE function. The integration test can be run with QEMU. [1] https://llvm.org/docs/AArch64SME.html [2] https://mlir.llvm.org/docs/Dialects/LLVM/#attribute-pass-through Reviewed By: awarzynski, aartbik Differential Revision: https://reviews.llvm.org/D148111
174 lines
4.7 KiB
CMake
174 lines
4.7 KiB
CMake
add_subdirectory(CAPI)
|
|
add_subdirectory(lib)
|
|
|
|
if (MLIR_ENABLE_BINDINGS_PYTHON)
|
|
add_subdirectory(python)
|
|
endif()
|
|
|
|
# Provide the MLIR CMake module dir so that the out of tree Standalone
|
|
# dialect and can add it to the module path.
|
|
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 libraries.
|
|
set(MLIR_LIB_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
|
|
|
if (MLIR_INCLUDE_INTEGRATION_TESTS)
|
|
set(INTEL_SDE_EXECUTABLE "" CACHE STRING
|
|
"If set, arch-specific integration tests are run with Intel SDE.")
|
|
set(ARM_EMULATOR_EXECUTABLE "" CACHE STRING
|
|
"If set, arch-specific Arm integration tests are run with an emulator.")
|
|
set(ARM_EMULATOR_OPTIONS "" CACHE STRING
|
|
"If arch-specific Arm integration tests run emulated, pass these as parameters to the emulator.")
|
|
set(ARM_EMULATOR_LLI_EXECUTABLE "" CACHE STRING
|
|
"If arch-specific Arm integration tests run emulated, use this Arm native lli.")
|
|
set(ARM_EMULATOR_UTILS_LIB_DIR "" CACHE STRING
|
|
"If arch-specific Arm integration tests run emulated, find Arm native utility libraries in this directory.")
|
|
option(MLIR_RUN_AMX_TESTS "Run AMX 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_SM80_TESTS "Run CUDA A100 tests.")
|
|
option(MLIR_RUN_ARM_SVE_TESTS "Run Arm SVE tests.")
|
|
option(MLIR_RUN_ARM_SME_TESTS "Run Arm SME tests.")
|
|
|
|
|
|
# The native target may not be enabled when cross compiling, raise an error.
|
|
if(NOT MLIR_ENABLE_EXECUTION_ENGINE)
|
|
message(FATAL_ERROR "MLIR_INCLUDE_INTEGRATION_TESTS requires a native target")
|
|
endif()
|
|
|
|
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
|
|
MLIR_RUN_ARM_SVE_TESTS
|
|
MLIR_RUN_ARM_SME_TESTS
|
|
MLIR_RUN_CUDA_SM80_TESTS
|
|
)
|
|
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
|
)
|
|
configure_lit_site_cfg(
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
MAIN_CONFIG
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
|
)
|
|
|
|
set(MLIR_TEST_DEPENDS
|
|
FileCheck count not split-file
|
|
mlir-capi-ir-test
|
|
mlir-capi-llvm-test
|
|
mlir-capi-pass-test
|
|
mlir-capi-pdl-test
|
|
mlir-capi-quant-test
|
|
mlir-capi-sparse-tensor-test
|
|
mlir-capi-transform-test
|
|
mlir-linalg-ods-yaml-gen
|
|
mlir-lsp-server
|
|
mlir-pdll-lsp-server
|
|
mlir-opt
|
|
mlir-pdll
|
|
mlir-reduce
|
|
mlir-tblgen
|
|
mlir-translate
|
|
tblgen-lsp-server
|
|
)
|
|
|
|
# The native target may not be enabled, in this case we won't
|
|
# run tests that involves executing on the host: do not build
|
|
# useless binaries.
|
|
if(LLVM_ENABLE_PIC AND TARGET ${LLVM_NATIVE_ARCH})
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
mlir-cpu-runner
|
|
llc
|
|
mlir_async_runtime
|
|
mlir-capi-execution-engine-test
|
|
mlir_c_runner_utils
|
|
mlir_runner_utils
|
|
)
|
|
endif()
|
|
|
|
if (MLIR_INCLUDE_INTEGRATION_TESTS)
|
|
list(APPEND MLIR_TEST_DEPENDS lli)
|
|
endif()
|
|
|
|
if(MLIR_ENABLE_CUDA_RUNNER)
|
|
list(APPEND MLIR_TEST_DEPENDS mlir_cuda_runtime)
|
|
endif()
|
|
|
|
if(MLIR_ENABLE_ROCM_RUNNER)
|
|
list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime)
|
|
endif()
|
|
|
|
list(APPEND MLIR_TEST_DEPENDS MLIRUnitTests)
|
|
|
|
if(LLVM_BUILD_EXAMPLES)
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
toyc-ch1
|
|
toyc-ch2
|
|
toyc-ch3
|
|
toyc-ch4
|
|
toyc-ch5
|
|
)
|
|
if(MLIR_ENABLE_EXECUTION_ENGINE)
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
toyc-ch6
|
|
toyc-ch7
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
if(MLIR_ENABLE_SPIRV_CPU_RUNNER)
|
|
add_subdirectory(mlir-spirv-cpu-runner)
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
mlir-spirv-cpu-runner
|
|
mlir_test_spirv_cpu_runner_c_wrappers
|
|
)
|
|
endif()
|
|
|
|
if(MLIR_ENABLE_VULKAN_RUNNER)
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
mlir-vulkan-runner
|
|
)
|
|
endif()
|
|
|
|
if(MLIR_ENABLE_BINDINGS_PYTHON)
|
|
list(APPEND MLIR_TEST_DEPENDS
|
|
MLIRPythonModules
|
|
)
|
|
endif()
|
|
|
|
# This target can be used to just build the dependencies
|
|
# for the check-mlir target without executing the tests.
|
|
# This is useful for bots when splitting the build step
|
|
# from the testing step.
|
|
add_custom_target(check-mlir-build-only
|
|
DEPENDS ${MLIR_TEST_DEPENDS}
|
|
)
|
|
|
|
add_lit_testsuite(check-mlir "Running the MLIR regression tests"
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
DEPENDS ${MLIR_TEST_DEPENDS}
|
|
)
|
|
set_target_properties(check-mlir PROPERTIES FOLDER "Tests")
|
|
|
|
add_lit_testsuites(MLIR ${CMAKE_CURRENT_SOURCE_DIR}
|
|
DEPENDS ${MLIR_TEST_DEPENDS}
|
|
)
|