Building the ML Workload Library for Vulkan®

Enable the library when configuring the standalone project:

cmake -S . -B build

Link one of the build-tree targets:

target_link_libraries(my_target PRIVATE mlworkloadlib)

or, if you prefer a namespaced target in the same build:

target_link_libraries(my_target PRIVATE MLWorkloadLibraryForVulkan::mlworkloadlib)

Installed package usage

When the ML Workload Library for Vulkan® is installed, the package exports mlworkloadlib through the MLWorkloadLibraryForVulkan package. Downstream consumers should use MLWorkloadLibraryForVulkan::mlworkloadlib.

find_package(MLWorkloadLibraryForVulkan CONFIG REQUIRED)
target_link_libraries(my_target PRIVATE MLWorkloadLibraryForVulkan::mlworkloadlib)

The package target expects the VGF and VulkanHeaders packages to be discoverable at configure time.

Optional source module support

SPIR-V™ modules are supported by the base library. GLSL and HLSL source compilation are optional and can be enabled when building:

python3 scripts/build.py --enable-glsl-support
python3 scripts/build.py --enable-hlsl-support

Use --glslang-path or --dxc-path when the dependency is not in the default location. For direct CMake configuration, use ML_WORKLOAD_LIB_ENABLE_GLSL_SUPPORT with GLSLANG_PATH, or ML_WORKLOAD_LIB_ENABLE_HLSL_SUPPORT with DXC_PATH.

Applications can query the source backends available in the linked library with mlworkloadlib::supports(...).

Documentation

Install Doxygen and the Python documentation tool dependencies and build the HTML documentation:

python3 -m pip install -r tooling-requirements.txt
python3 scripts/build.py --doc

The generated documentation is available at build/docs/out/index.html.