CMake optionslink
Frequently-used CMake optionslink
CMAKE_BUILD_TYPE
link
- type: STRING
Sets the build type. Possible values are Release
, Debug
,
RelWithDebInfo
and MinSizeRel
. If unset, build type is set to Release
.
CMAKE_<LANG>_COMPILER
link
- type: STRING
This is the command that will be used as the <LANG>
compiler, which are C
and CXX
in IREE. These variables are set to compile IREE with clang
or
rather clang++
. Once set, these variables can not be changed.
IREE-specific CMake optionslink
This gives a brief explanation of IREE specific CMake options and variables.
IREE_ENABLE_RUNTIME_TRACING
link
- type: BOOL
Enables instrumented runtime tracing. Defaults to OFF
.
IREE_ENABLE_COMPILER_TRACING
link
- type: BOOL
Enables instrumented compiler tracing. This requires that
IREE_ENABLE_RUNTIME_TRACING
also be set. Defaults to OFF
.
IREE_BUILD_COMPILER
link
- type: BOOL
Builds the IREE compiler. Defaults to ON
.
IREE_BUILD_TESTS
link
- type: BOOL
Builds IREE unit tests. Defaults to ON
.
IREE_BUILD_DOCS
link
- type: BOOL
Builds IREE documentation files. Defaults to OFF
.
IREE_BUILD_SAMPLES
link
- type: BOOL
Builds IREE sample projects. Defaults to ON
.
IREE_BUILD_PYTHON_BINDINGS
link
- type: BOOL
Builds the IREE python bindings. Defaults to OFF
.
IREE_BUILD_BINDINGS_TFLITE
link
- type: BOOL
Builds the IREE TFLite C API compatibility shim. Defaults to ON
.
IREE_BUILD_BINDINGS_TFLITE_JAVA
link
- type: BOOL
Builds the IREE TFLite Java bindings with the C API compatibility shim.
Defaults to ON
.
IREE_HAL_DRIVER_DEFAULTS
link
- type: BOOL
Default setting for each IREE_HAL_DRIVER_*
option.
IREE_HAL_DRIVER_*
link
- type: BOOL
Individual options enabling the build for each runtime HAL driver:
IREE_HAL_DRIVER_CUDA
IREE_HAL_DRIVER_HIP
IREE_HAL_DRIVER_LOCAL_SYNC
IREE_HAL_DRIVER_LOCAL_TASK
IREE_HAL_DRIVER_VULKAN
IREE_HAL_DRIVER_METAL
IREE_TARGET_BACKEND_DEFAULTS
link
- type: BOOL
Default setting for each IREE_TARGET_BACKEND_*
option.
IREE_TARGET_BACKEND_*
link
- type: BOOL
Individual options enabling the build for each compiler target backend:
IREE_TARGET_BACKEND_VMVX
IREE_TARGET_BACKEND_LLVM_CPU
IREE_TARGET_BACKEND_LLVM_CPU_WASM
IREE_TARGET_BACKEND_METAL_SPIRV
IREE_TARGET_BACKEND_VULKAN_SPIRV
IREE_TARGET_BACKEND_ROCM
IREE_INPUT_*
link
- type: BOOL
Individual options enabling each set of input dialects:
IREE_INPUT_STABLEHLO
IREE_INPUT_TORCH
IREE_INPUT_TOSA
IREE_OUTPUT_FORMAT_C
link
- type: BOOL
Enables the vm-c compiler output format, using MLIR EmitC. Defaults to ON
.
IREE_DEV_MODE
link
- type: BOOL
Configure settings to optimize for IREE development (as opposed to CI or
release). Defaults to OFF
. For example, this will downgrade some compiler
diagnostics from errors to warnings.
IREE_ENABLE_LLD
link
- type: BOOL
Use lld when linking. Defaults to OFF
. This option is equivalent to
-DIREE_USE_LINKER=lld
. The option IREE_ENABLE_LLD
and IREE_USE_LINKER
can
not be set at the same time.
IREE_ENABLE_ASAN
link
- type: BOOL
Enable address sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_MSAN
link
- type: BOOL
Enable memory sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_TSAN
link
- type: BOOL
Enable thread sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_UBSAN
link
- type: BOOL
Enable undefiend behavior sanitizer if the current build type is Debug and the compiler supports it.
IREE_ENABLE_RUNTIME_COVERAGE
link
- type: BOOL
Enable LLVM code coverage for the runtime code. All runtime libraries and binaries will be compiled with instrumentation and CMake targets will be exposed for performing common coverage tasks.
iree-runtime-coverage-export
link
Merges and export coverage data to coverage/runtime.lcov.info
.
All of coverage/runtime/*.profraw
files will be merged as if they had been
produced in the same run, written to coverage/runtime.profdata
, and then
exported into LCOV format.
iree-runtime-coverage-clear-all
link
Erases all coverage/runtime*
files (.profraw/.profdata/*.info).
Invoke this to completely clear all collected coverage data.
iree-runtime-coverage-clear-artifacts
link
Erases only merged coverage/runtime.*
files (.profdata/.info).
Invoke this after adding more *.profraw files to update the coverage.
VSCode Coverage Integrationlink
VSCode can be configured with these targets/artifacts to show coverage information by adding the following workspace configuration:
"cmake.preRunCoverageTarget": "iree-runtime-coverage-clear-all",
"cmake.postRunCoverageTarget": "iree-runtime-coverage-export",
"cmake.coverageInfoFiles": [
"${command:cmake.buildDirectory}/coverage/runtime.lcov.info"
],
Coverage runs with the Test Explorer will clear, accumulate coverage for each test selected, and then export an LCOV file that will be rendered in the coverage panel/overlay.
See the VSCode Testing Documentation for more information.
Cross-compilationlink
When cross compiling (using a toolchain file like
android.toolchain.cmake
),
first build and install IREE's tools for your host configuration, then use the
IREE_HOST_BIN_DIR
CMake option to point the cross compiled build at the
host tools.