This section describes how to configure and build the Tensile project. We assume the user has a ROCm installation, Python 3.8 or newer and CMake 3.21.2 or newer.
The Tensile project consists of three components:
- host library
- device libraries
- client applications
Each component has a corresponding subdirectory. The host and device libraries are independently configurable and buildable but the client applications require the host library at build time and the device libraries at runtime.
To use Tensile in your project, add it as an out of source subdirectory as follows:
add_subdirectory(/path/to/Tensile/next-cmake ${CMAKE_CURRENT_BINARY_DIR}/Tensile)
Tensile provides modern CMake support and relies on native CMake functionality with exception of some project specific options. As such, users are advised to refer to the CMake documentation for general usage questions. For details on all configuration options see the options section.
Note
Tensile is designed to be consumed via add_subdirectory and therefore isn't intended to be consumed via standalone builds. Standalone builds are only supported for development and testing purposes.
cd Tensile/next-cmake # configure cmake -B build \ -S . \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_PREFIX_PATH=/opt/rocm \ -D CMAKE_CXX_COMPILER=/opt/rocm/bin/amdclang++ \ -D GPU_TARGETS=gfx90a # build cmake --build build --parallel 32
CMake options:
CMAKE_BUILD_TYPE: Any of Release, Debug, RelWithDebInfo, MinSizeRelCMAKE_INSTALL_PREFIX: Base installation directory (defaults to /opt/rocm on Linux, C:/hipSDK on Windows)CMAKE_PREFIX_PATH: Find package search path (consider setting to$ROCM_PATH)CMAKE_EXPORT_COMPILE_COMMANDS: Export compile_commands.json for clang tooling support (default:ON)
Project wide options:
GPU_TARGETS: List of GPU targets to build for, if unset or set to "all", all supported targets will be built (default: unset)TENSILE_ENABLE_HOST: Enables generation of host library (default:ON)TENSILE_ENABLE_DEVICE: Enables generation of device libraries (default:ON)TENSILE_ENABLE_CLIENT: Enables generation of client applications (default:ON)TENSILE_BUILD_TESTING: Build host library tests (default:ON)TENSILE_CXX_STANDARD: C++ standard version to use (14, 17, 20) (default:17)
Host library options:
TENSILE_BUILD_SHARED_LIBS: Build the Tensile shared or static library (default:OFF)TENSILE_ENABLE_MSGPACK: Enable MessagePack support (default:ON)TENSILE_ENABLE_LLVM: Use LLVM YAML library; this should only be used by project developers and for testing (default:OFF)
Client options:
TENSILE_ENABLE_ROCM_SMI: Enable rocm_smi support (default:ONon Linux,OFFon Windows)
roc::tensile-host: Main Tensile host library target