Skip to content

CMake optionslink

Frequently-used CMake optionslink

CMAKE_BUILD_TYPElink

  • type: STRING

Sets the build type. Possible values are Release, Debug, RelWithDebInfo and MinSizeRel. If unset, build type is set to Release.

CMAKE_<LANG>_COMPILERlink

  • 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_TRACINGlink

  • type: BOOL

Enables instrumented runtime tracing. Defaults to OFF.

IREE_ENABLE_COMPILER_TRACINGlink

  • type: BOOL

Enables instrumented compiler tracing. This requires that IREE_ENABLE_RUNTIME_TRACING also be set. Defaults to OFF.

IREE_BUILD_COMPILERlink

  • type: BOOL

Builds the IREE compiler. Defaults to ON.

IREE_BUILD_TESTSlink

  • type: BOOL

Builds IREE unit tests. Defaults to ON.

IREE_BUILD_DOCSlink

  • type: BOOL

Builds IREE documentation files. Defaults to OFF.

IREE_BUILD_SAMPLESlink

  • type: BOOL

Builds IREE sample projects. Defaults to ON.

IREE_BUILD_PYTHON_BINDINGSlink

  • type: BOOL

Builds the IREE python bindings. Defaults to OFF.

IREE_BUILD_BINDINGS_TFLITElink

  • type: BOOL

Builds the IREE TFLite C API compatibility shim. Defaults to ON.

IREE_BUILD_BINDINGS_TFLITE_JAVAlink

  • type: BOOL

Builds the IREE TFLite Java bindings with the C API compatibility shim. Defaults to ON.

IREE_HAL_DRIVER_DEFAULTSlink

  • 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_DEFAULTSlink

  • 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_Clink

  • type: BOOL

Enables the vm-c compiler output format, using MLIR EmitC. Defaults to ON.

IREE_DEV_MODElink

  • 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_LLDlink

  • 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_ASANlink

  • type: BOOL

Enable address sanitizer if the current build type is Debug and the compiler supports it.

IREE_ENABLE_MSANlink

  • type: BOOL

Enable memory sanitizer if the current build type is Debug and the compiler supports it.

IREE_ENABLE_TSANlink

  • type: BOOL

Enable thread sanitizer if the current build type is Debug and the compiler supports it.

IREE_ENABLE_UBSANlink

  • type: BOOL

Enable undefiend behavior sanitizer if the current build type is Debug and the compiler supports it.

IREE_ENABLE_RUNTIME_COVERAGElink

  • 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-exportlink

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-alllink

Erases all coverage/runtime* files (.profraw/.profdata/*.info). Invoke this to completely clear all collected coverage data.

iree-runtime-coverage-clear-artifactslink

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.