Shader: order deferred wave-mask exchanges at their definition #53

Closed
github-bot wants to merge 1 commit from gh-pr/53/head into gh-pr/53/base
Owner

@⁠steven-seagull27 on GitHub · 2026-11-27 01:06 UTC · original
steven-seagull27:codex/deferred-wave-mask-exchange → main · +188 −12 · 4 files · 1 commits · closed without merging

A 128-thread synthetic compute shader on 69718c0 defines a lane mask in a block reached by the entire group and reads it as a scalar inside a later, conditional block. The translator emits the exchange at the definition. It used the consumer’s participation when choosing a barrier, overwrote the predecessor’s branch, and panicked during bitcode emission with use of a void value.

This change takes participation from the block that emits the exchange. A group-uniform definition uses a group barrier. A deferred exchange that needs a per-wave meet in an already terminated block returns a translation refusal and preserves its existing branch. The serializer assertion remains in place.

The regression constructs its input from instructions in the test. It checks valid DXIL, covers a nested case that must be refused, and reads back five sets of 128 output words.

Adapter Wave32 output comparisons
NVIDIA GeForce RTX 5080 640/640 matched
Microsoft WARP 1.0.22 640/640 matched
Windows inbox WARP Advertised Wave4 only, so 0 Wave32 comparisons ran

For example, with mask limit 68 and active limit 87, threads 63, 64 and 86 produced 149, 166 and 188. Thread 87 kept its initial zero. All three wait-counter dwords stayed zero in every case on both Wave32 adapters.

The focused tests are in crates/victory-shader/src/emit/wave64_tests.rs. Run cargo test --locked -p victory-shader --features host --lib emit::wave64_tests:: -- --nocapture --test-threads=1 to exercise this group.

**@⁠steven-seagull27** on GitHub · 2026-11-27 01:06 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/53) `steven-seagull27:codex/deferred-wave-mask-exchange` → `main` · +188 −12 · 4 files · 1 commits · closed without merging A 128-thread synthetic compute shader on `69718c0` defines a lane mask in a block reached by the entire group and reads it as a scalar inside a later, conditional block. The translator emits the exchange at the definition. It used the consumer’s participation when choosing a barrier, overwrote the predecessor’s branch, and panicked during bitcode emission with `use of a void value`. This change takes participation from the block that emits the exchange. A group-uniform definition uses a group barrier. A deferred exchange that needs a per-wave meet in an already terminated block returns a translation refusal and preserves its existing branch. The serializer assertion remains in place. The regression constructs its input from instructions in the test. It checks valid DXIL, covers a nested case that must be refused, and reads back five sets of 128 output words. | Adapter | Wave32 output comparisons | | --- | --- | | NVIDIA GeForce RTX 5080 | 640/640 matched | | Microsoft WARP 1.0.22 | 640/640 matched | | Windows inbox WARP | Advertised Wave4 only, so 0 Wave32 comparisons ran | For example, with mask limit 68 and active limit 87, threads 63, 64 and 86 produced 149, 166 and 188. Thread 87 kept its initial zero. All three wait-counter dwords stayed zero in every case on both Wave32 adapters. The focused tests are in `crates/victory-shader/src/emit/wave64_tests.rs`. Run `cargo test --locked -p victory-shader --features host --lib emit::wave64_tests:: -- --nocapture --test-threads=1` to exercise this group.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 06:08:00 +00:00
github-bot closed this pull request 2026-11-27 06:08:00 +00:00
Author
Owner

@⁠DoubleGhosty on GitHub · 2026-11-27 05:14 UTC · original

Applied to main as a patch — thank you for the contribution.

**@⁠DoubleGhosty** on GitHub · 2026-11-27 05:14 UTC · [original](https://github.com/DoubleGhosty/cool_fox/pull/53#issuecomment-7210466541) Applied to main as a patch — thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.