Skip to content

Commit

Permalink
Document example CMake configurations and update options page. (iree-…
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd authored Jun 4, 2024
1 parent 7388d75 commit bb7fc1f
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 15 deletions.
53 changes: 47 additions & 6 deletions docs/website/docs/building-from-source/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,62 @@ settings can improve compile and link times substantially.

### :octicons-gear-16: Optional components

Enabled components and other configurations can be changed via
[CMake options](../developers/building/cmake-options.md), listed in the root
[`CMakeLists.txt`](https://github.com/iree-org/iree/blob/main/CMakeLists.txt).
We also maintain a few
[CMake presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html)
at
[`build_tools/cmake/presets`](https://github.com/iree-org/iree/tree/main/build_tools/cmake/presets)
for common configurations.

By default, the CMake build includes:

* All compiler targets (`llvm-cpu`, `cuda`, `vulkan-spirv`, etc.)
* All runtime HAL drivers (`local-task`, `cuda`, `vulkan`, etc.)
* All compiler input formats (StableHLO, TOSA, etc.)
* All [compiler targets](../developers/building/cmake-options.md#iree_target_backend_)
(`llvm-cpu`, `cuda`, `vulkan-spirv`, etc.)
* All [runtime HAL drivers](../developers/building/cmake-options.md#iree_hal_driver_)
(`local-task`, `cuda`, `vulkan`, etc.)
* All [compiler input formats](../developers/building/cmake-options.md#iree_input_)
(PyTorch, StableHLO, TOSA, etc.)
* All compiler output formats (VM bytecode, C)

The default build does _not_ include:

* Compiler or runtime bindings (Python, TFLite, etc.)
* Python and other language bindings for the compiler or runtime
* Advanced features like AddressSanitizer or tracing instrumentation
* Experimental components

These can be changed via the `IREE_` CMake options listed in the root
[`CMakeLists.txt`](https://github.com/iree-org/iree/blob/main/CMakeLists.txt).
!!! example "Configuration examples"

=== "Disable all backends except CPU"

This configure command will

* Disable all compiler target backends then enable just `llvm-cpu`
* Disable all runtime HAL drivers then enable just the CPU "local" runtime
HAL drivers

``` shell
cmake -G Ninja -B ../iree-build/ -S . \
-DIREE_TARGET_BACKEND_DEFAULTS=OFF \
-DIREE_TARGET_BACKEND_LLVM_CPU=ON \
-DIREE_HAL_DRIVER_DEFAULTS=OFF \
-DIREE_HAL_DRIVER_LOCAL_SYNC=ON \
-DIREE_HAL_DRIVER_LOCAL_TASK=ON
```

=== "Disable just CUDA"

This configure command will

* Disable just the CUDA compiler target backend
* Disable just the CUDA runtime HAL driver

``` shell
cmake -G Ninja -B ../iree-build/ -S . \
-DIREE_TARGET_BACKEND_CUDA=OFF \
-DIREE_HAL_DRIVER_CUDA=OFF
```

### Extensions and integrations

Expand Down
30 changes: 21 additions & 9 deletions docs/website/docs/developers/building/cmake-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ Builds the IREE TFLite C API compatibility shim. Defaults to `ON`.
Builds the IREE TFLite Java bindings with the C API compatibility shim.
Defaults to `ON`.

### `IREE_BUILD_EXPERIMENTAL_REMOTING`

* type: BOOL

Builds experimental remoting component. Defaults to `OFF`.

### `IREE_HAL_DRIVER_DEFAULTS`

* type: BOOL
Expand All @@ -97,7 +91,14 @@ Default setting for each `IREE_HAL_DRIVER_*` option.

* type: BOOL

Individual options enabling the build for each runtime HAL driver.
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`

Expand All @@ -109,13 +110,24 @@ Default setting for each `IREE_TARGET_BACKEND_*` option.

* type: BOOL

Individual options enabling the build for each compiler target backend.
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_*`

* type: BOOL

Individual options enabling each set of input dialects.
Individual options enabling each set of input dialects:

* `IREE_INPUT_STABLEHLO`
* `IREE_INPUT_TORCH`
* `IREE_INPUT_TOSA`

### `IREE_OUTPUT_FORMAT_C`

Expand Down

0 comments on commit bb7fc1f

Please sign in to comment.