This guide walks through building the core compiler and runtime parts of IREE from source. Auxiliary components like the Python bindings and Vulkan driver are not documented for macOS at this time.
IREE is not officially supported on macOS at this time. It may work, but it is not a part of our open source CI, and may be intermittently broken. Contributions related to macOS support and documentation are welcome however.
This guide uses Homebrew to install IREE's dependencies.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
IREE uses CMake version >= 3.13.4
. Brew ships the latest release.
$ brew install cmake $ cmake --version # >= 3.13.4
Ninja is a fast build system that you can use as a CMake generator.
$ brew install ninja
Clone the repository and initialize its submodules:
$ git clone https://github.com/google/iree.git $ cd iree $ git submodule update --init
Tip:
Editors and other programs can also clone the repository, just make sure that they initialize the submodules.
Configure:
$ cmake -G Ninja -B ../iree-build/ .
Note: this should use Clang
by default on macOS. GCC
is not fully supported by IREE.
Tip:
The root CMakeLists.txt file has options for configuring which parts of the project to enable.
These are further documented in CMake Options and Variables.
Build all targets:
$ cmake --build ../iree-build/
Check out the contents of the ‘tools’ build directory:
$ ls ../iree-build/iree/tools $ ../iree-build/iree/tools/iree-translate --help
Translate a MLIR file and execute a function in the compiled module:
$ ../iree-build/iree/tools/iree-run-mlir $PWD/iree/samples/models/simple_abs.mlir \ -function-input="f32=-2" -iree-hal-target-backends=vmvx -print-mlir