Minimally integrate SPIR-T (opt-in via RUSTGPU_CODEGEN_ARGS=--spirt
).
#940
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please see the SPIR-T repository for more information, but to quote the top of its
README
:This PR integrates it into Rust-GPU in a very limited capacity, in the middle of a sequence of passes operating on SPIR-V, as a
... -> SPIR-V -> SPIR-T -> SPIR-V -> ...
conversion, with the only SPIR-T -> SPIR-T pass being the CFG structurizer (substituting our own structurizer, which we may want to delete?).That alone is enough to show some compile-time speedups of over 30% in some workloads, while adding only marginal overhead (~0.1%), and it's still being limited by our existing passes (see EmbarkStudios/spirt#6).
To enable, you can use
RUSTGPU_CODEGEN_ARGS=--spirt
- to quote the (more detailed)codegen-args.md
docs:Opening this PR as a draft because there are some discussions that need to be had, i.e.:(click to open outdated bullet points)
the debuginfo we don't guarantee so it's maybe fine? we can also improve it over time#[spirv(unroll_loops)]
is effectively broken and would need to be rewritten to operate on SPIR-Tthir_body
to inject loop merge points for structurization. #944should we just delete code this supersedes? (our old structurizer)should we wait for0.4
to release, so that the SPIR-T dependency can be only0.5
onward?this would allow more time to refine it before we need to releasespirt 0.1
on crates.io0.4
, and by default only later (0.5
or so)