SPIR-V patching utility operating on the IR level to patch new code, or specialise existing code.
NOTE: Some of the GPU tests are currently broken.
All in one SPIR-V analyser, patcher and verifyer. Focuses on speed to make partial runtime SPIR-V patching possible.
Compared to simple linking, this patcher allows not just linking in new functions, but also patching existing code / basic-blocks. This enables for instance
- rewrite resource bindings
- patch code to make it compatible. For instance making SPIR-V DXIL compatible
- injecting runtime linked code
- make pipeline stages compatible
- make non-uniform buffer access valid
Generally all build dependencies get resolved by cargo. For runtime we depend on two tools / SDKs:
- Vulkan SDK (specifically the LunarG validation layer)
- SPIR-V tools
The tools spirv-val and spirv-dis must be accessible in $PATH for all tests to succeed. Otherwise the SPIR-V-Validator will be skipped when testing.
- Download & Install Rust, usually via Rustup.
- Build test shader (if you intend to use testing) by changing to
crates/spv-tester/resourcesand executingcompile_shader.shin that directory. - Compile everything via
cargo build --release, or run a test withcargo run --bin spv-tester -- const_mutate
To run all tests execute
cargo run --bin spv-tester static_mutate non_uniform_patch static_replace dyn_replace function_finderYou might want to bless your results if you are sure they are correct by appending bless to the sequence.
There are two benchmarks. One is the GPU-Performance benchmark. Use
cargo run --bin spv-benchmark --releaseto run GPU the benchmarks.
For the CPU site we use Criterion. This is one of the main Rust benchmarking frameworks. It integrates with our projects. Therefor running
cargo benchis enough. The Results can be found at target/criterion/report/index.html