Skip to content

SPIR-V patching utility operating on the IR level to patch new code, or specialize existing code.

Notifications You must be signed in to change notification settings

SiebenCorgie/spv-patcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPIR-V Patcher

SPIR-V patching utility operating on the IR level to patch new code, or specialise existing code.

dependency status

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

Dependencies

Generally all build dependencies get resolved by cargo. For runtime we depend on two tools / SDKs:

  1. Vulkan SDK (specifically the LunarG validation layer)
  2. 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.

Building

  1. Download & Install Rust, usually via Rustup.
  2. Build test shader (if you intend to use testing) by changing to crates/spv-tester/resources and executing compile_shader.sh in that directory.
  3. Compile everything via cargo build --release, or run a test with cargo run --bin spv-tester -- const_mutate

Testing

To run all tests execute

cargo run --bin spv-tester static_mutate non_uniform_patch static_replace dyn_replace function_finder

You might want to bless your results if you are sure they are correct by appending bless to the sequence.

Benchmarking

There are two benchmarks. One is the GPU-Performance benchmark. Use

cargo run --bin spv-benchmark --release

to 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 bench

is enough. The Results can be found at target/criterion/report/index.html

About

SPIR-V patching utility operating on the IR level to patch new code, or specialize existing code.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages