Unified Runtime

March 21, 2026 · View on GitHub

Deploy documentation to Pages OpenSSF Scorecard Trivy

Table of contents

Contents of the project

⚠️ This repository is only a mirror.

The source code of Unified Runtime has been moved to intel/llvm under the unified-runtime top-level directory, all future development will now be carried out there.

This project contains the following:

  • API specification in YaML
  • API programming guide in RST
  • Loader and a null adapter implementation (partially generated)
  • Example applications
  • API C/C++ header files (generated)
  • API Python module (generated)
  • Sample C++ wrapper (generated)
  • Sample C/C++ import library (generated)

Integration

The recommended way to integrate this project into another is via CMake's FetchContent, for example:

include(FetchContent)

FetchContent_Declare(
    unified-runtime
    GIT_REPOSITORY https://github.com/oneapi-src/unified-runtime.git
    GIT_TAG main  # This will pull the latest changes from the main branch.
)
FetchContent_MakeAvailable(unified-runtime)

add_executable(example example.cpp)
target_link_libraries(example PUBLIC unified-runtime::headers)

Third-Party tools

The recommended method to install the third-party tools is using a Python virtual environment, for example:

$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r third_party/requirements.txt

Building

The requirements and instructions below are for building the project from source without any modifications. To make modifications to the specification, please see the Contribution Guide for more detailed instructions on the correct setup.

Requirements

Required packages:

  • C++ compiler with C++17 support
  • CMake >= 3.20.0
  • Python v3.6.6 or later

Windows

Generating Visual Studio Project. EXE and binaries will be in build/bin/{build_config}

$ mkdir build
$ cd build
$ cmake {path_to_source_dir} -G "Visual Studio 15 2017 Win64"

Linux

Executable and binaries will be in build/bin

$ mkdir build
$ cd build
$ cmake {path_to_source_dir}
$ make

CMake standard options

List of options provided by CMake:

NameDescriptionValuesDefault
UR_BUILD_EXAMPLESBuild example applicationsON/OFFON
UR_BUILD_TESTSBuild the testsON/OFFON
UR_BUILD_TOOLSBuild toolsON/OFFON
UR_FORMAT_CPP_STYLEFormat code styleON/OFFOFF
UR_DEVELOPER_MODETreat warnings as errorsON/OFFOFF
UR_ENABLE_FAST_SPEC_MODEEnable fast specification generation modeON/OFFOFF
UR_USE_ASANEnable AddressSanitizerON/OFFOFF
UR_USE_TSANEnable ThreadSanitizerON/OFFOFF
UR_USE_UBSANEnable UndefinedBehavior SanitizerON/OFFOFF
UR_USE_MSANEnable MemorySanitizer (clang only)ON/OFFOFF
UR_USE_CFIEnable Control Flow Integrity checks (clang only, also enables lto)ON/OFFOFF
UR_ENABLE_TRACINGEnable XPTI-based tracing layerON/OFFOFF
UR_ENABLE_SANITIZEREnable device sanitizer layerON/OFFON
UR_CONFORMANCE_TARGET_TRIPLESSYCL triples to build CTS device binaries forComma-separated listspir64
UR_CONFORMANCE_AMD_ARCHAMD device target ID to build CTS binaries forstring""
UR_CONFORMANCE_NVIDIA_ARCHNVIDIA shader model to build CTS binaries forstring""
UR_CONFORMANCE_SELECTORONEAPI_DEVICE_SELECTOR for conformance testingstringAll enabled adapters
UR_BUILD_ADAPTER_L0Build the Level-Zero adapterON/OFFOFF
UR_BUILD_ADAPTER_OPENCLBuild the OpenCL adapterON/OFFOFF
UR_BUILD_ADAPTER_CUDABuild the CUDA adapterON/OFFOFF
UR_BUILD_ADAPTER_HIPBuild the HIP adapterON/OFFOFF
UR_BUILD_ADAPTER_NATIVE_CPUBuild the Native-CPU adapterON/OFFOFF
UR_BUILD_ADAPTER_ALLBuild all currently supported adaptersON/OFFOFF
UR_BUILD_ADAPTER_L0_V2Build the (experimental) Level-Zero v2 adapterON/OFFOFF
UR_STATIC_ADAPTER_L0Build the Level-Zero adapter as static and embed in the loaderON/OFFOFF
UR_HIP_PLATFORMBuild HIP adapter for AMD or NVIDIA platformAMD/NVIDIAAMD
UR_ENABLE_COMGREnable comgr lib usageAMD/NVIDIAAMD
UR_DPCXXPath of the DPC++ compiler executable to build device binaries for testingFile path""
UR_DEVICE_CODE_EXTRACTORPath of the clang-offload-extract executable from the DPC++ package, required for CTS device binariesFile path"${dirname(UR_DPCXX)}/clang-offload-extract"
UR_DPCXX_BUILD_FLAGSBuild flags to pass to DPC++ when compiling device programsSpace-separated options list""
UR_SYCL_LIBRARY_DIRPath of the SYCL runtime library directory to build CTS device binariesDirectory path""
UR_HIP_ROCM_DIRPath of the default ROCm HIP installationDirectory path$ENV{ROCM_PATH} or /opt/rocm
UR_HIP_INCLUDE_DIRPath of the ROCm HIP include directoryDirectory path${UR_HIP_ROCM_DIR}/include
UR_HIP_HSA_INCLUDE_DIRSPath of the ROCm HSA include directoryDirectory path${UR_HIP_ROCM_DIR}/hsa/include;${UR_HIP_ROCM_DIR}/include
UR_HIP_LIB_DIRPath of the ROCm HIP library directoryDirectory path${UR_HIP_ROCM_DIR}/lib

Testing

Unified Runtime uses lit and FileCheck as part of its test suite. When built as part of an LLVM build, the binaries provided by LLVM will be used. When built standalone, both lit and FileCheck (or filecheck) must be visible on $PATH. The easiest way to do this is to install the Python packages for lit and filecheck.

$ source .venv/bin/activate
$ pip install -r third_party/requirements_testing.txt

Note: filecheck requires Python >= 3.10; if you get errors claiming that filecheck is not available, update your Python version or disable testing.

Once installed, tests can be executed using:

$ make
$ make test

Additional make targets

To run automated code formatting, configure CMake with UR_FORMAT_CPP_STYLE option and then run a custom cppformat target:

$ make cppformat

If you've made modifications to the specification, you can also run a custom generate target prior to building. It will generate the source code and run automated code formatting:

$ make generate

This target has additional dependencies which are described in the Build Environment section of the Contribution Guide.

Contributions

For those who intend to make a contribution to the project please read our Contribution Guide for more information.

Adapter naming convention

To maintain consistency and clarity in naming adapter libraries, it is recommended to use the following naming convention:

  • On Linux platforms, use libur_adapter_[name].so.
  • On Windows platforms, use ur_adapter_[name].dll.

Source code generation

Code is generated using included Python scripts.

Documentation

Documentation is generated from source code using Sphinx - see scripts dir for details.