Building the ML Emulation Layer for Vulkan®

The build system must have:

  • C/C++ 17 compiler: GCC or Clang on Linux, Clang on Darwin, or MSVC on Windows®.

  • CMake 3.25 or later.

  • Ninja 1.8.2 or later.

  • Python 3.10 or later and uv 0.9.26. Python tooling dependencies are declared in pyproject.toml and locked in uv.lock.

  • Vulkan® SDK 1.4.328.1 or later.

The following dependencies are also needed:

For the preferred dependency versions see the manifest file.

Building with the script

To make the build configuration options easily discoverable, we provide a python build script. When you run the script from a git-repo manifest checkout, the script uses default paths and does not require any additional arguments. If you do not use the script, you must specify paths to the dependencies.

To build on the current platform, for example on Linux or Windows®, run the following command:

python3 $SDK_PATH/sw/emulation-layer/scripts/build.py -j $(nproc)

To cross compile for AArch64 architecture, add the following option:

python3 $SDK_PATH/sw/emulation-layer/scripts/build.py -j $(nproc) --target-platform aarch64

To enable and run tests, use the --test option. To lint the tests, use the --lint option. To build the documentation, use the --doc option. To build the documentation, you must have sphinx and doxygen installed on your machine.

You can install the build artifacts for this project into a specified location. To install the build artifacts, pass the --install option with the required path.

To create an archive with the build artifacts option, you must add the --package option. The archive is stored in the provided location.

For more command line options, see the help output:

python3 $SDK_PATH/sw/emulation-layer/scripts/build.py --help

Code coverage

Sync the locked tooling dependencies, then run the unit tests on Linux with GCC coverage instrumentation:

uv sync --locked --no-install-project --no-default-groups --group test --group tooling
uv run --no-sync python scripts/build.py --coverage --build-dir build-coverage

The coverage command writes a detailed HTML report to build-coverage/coverage/index.html and a machine-readable JSON summary to build-coverage/coverage/summary.json. Coverage is collected for the common, graph, tensor, and utility sources; tests and bundled dependencies are excluded.