ZSF fork of the Zig SPIR-V Test Executor. Send issues and pull requests upstream!
  • Zig 81.4%
  • Python 18.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-14 22:23:46 +03:30
src use inheritParentFile 2026-10-14 22:23:46 +03:30
.gitignore feat!: migrate to Zig 0.17-dev and repair triage tooling 2026-06-16 20:32:18 +02:00
build.zig use inheritParentFile 2026-10-14 22:23:46 +03:30
build.zig.zon do not depend on spirv-tools 2026-10-12 22:41:15 +03:30
README.md build spirv tools 2026-10-12 04:56:50 +03:30
update-tests.py feat!: migrate to Zig 0.17-dev and repair triage tooling 2026-06-16 20:32:18 +02:00

Zig SPIR-V Test Executor

This is a program to run Zig tests for the SPIR-V target. This is currently mainly used for the compiler behavior tests, and only supports the Vulkan and OpenCL environment.

Requires Zig 0.18.0-dev.131+41f885830 or newer.

Running tests

To actually run tests, use something like the following:

$ zig test src/test_kernel.zig \
    --test-runner src/test_runner.zig \
    -target spirv64-vulkan \
    -mcpu vulkan_v1_2+int64+float64+float16 \
    -fno-llvm \
    --test-cmd zig-out/bin/zig-spirv-test-executor \
    --test-cmd --platform \
    --test-cmd Intel \
    --test-cmd-bin

Bulk test triage

update-tests.py runs a whole directory of Zig tests under SPIR-V and records which ones pass. It works in two phases: a first run inserts a SkipZigTest guard for every test (so they are all skipped by default), and a run with --recheck re-runs the guarded tests and removes the guard from the ones that now pass.

python3 update-tests.py <path-to-zig> <test-dir-or-file> \
    --recheck --platform Portable --timeout 60 -j 2

The test sources must match the compiler version, otherwise failures are dominated by unrelated language/std changes rather than real SPIR-V gaps.

Notes:

  • -j/--jobs limits parallel workers. The default uses all cores, which oversubscribes CPU-based drivers (e.g. POCL) badly enough that tests time out; lower it (-j 2, even -j 1) for stable results.
  • --no-fp16 drops float16 from the target features for drivers without cl_khr_fp16, such as POCL.
  • --todo prints how many tests still need work; --recheck re-evaluates already-generated guards.

Nix dependencies

The system dependencies above are available in nixpkgs as:

  • ocl-icd - the OpenCL ICD loader (libOpenCL).
  • opencl-headers - the OpenCL headers.

At runtime the loader dispatches to whichever ICD is registered (e.g. POCL or Mesa/Rusticl); that ICD must support SPIR-V ingestion (cl_khr_il_program). The 0.17 update has been verified end-to-end against POCL (CPU); it has not been re-tested against Mesa/Rusticl.