shader: accept proven uniform forward reduction guards #46

Manually merged
github merged 3 commits from gh-pr/46/head into gh-pr/46/base 2026-11-26 06:27:28 +00:00
Owner

@⁠Valdi320 on GitHub · 2026-11-24 11:11 UTC · original
Valdi320:work/scarlett-uniform-reduction-guards → main · +1229 −8 · 7 files · 3 commits · merged 2026-11-24 13:42 UTC

The public ProjectScarlett log in #39 has 396 distinct refusals from wave_sum's divergent-control-flow guard. This narrow change accepts a forward SCC branch over an entire fixed-width reduction only when its comparison uses immediates or the scalar broadcast from an immediately preceding verified reduction. Other edges overlapping the proof window, alternate entries, intervening writes, early exits and indirect transfers remain rejected. EXEC/VCC and unknown SCC branches still fail closed. Wave-width requirements are unchanged.

Validation on Bazzite:

  • 68 shader compiler unit tests passed.
  • Four new tests cover wave32/wave64, divergent branches, alternate entries, loops, overwritten results, and actual synthetic RDNA2 -> HLSL translation.
  • Both emitted synthetic HLSL shaders compiled with Microsoft DXC cs_6_6 and passed DXV.

No retail shader inputs locally; the 396 refusals are not claimed fixed. A retest of the recorded requests would determine whether this specific branch pattern occurs and which remaining patterns need support. No game files or shader binaries included. AI-assisted contribution.

Portable wave64 follow-up: For a verified single 64x1x1 compute group, exact integer reductions can now use synchronized group-shared lane exchanges without a host WaveSize(64) requirement. Unknown collectives, mask escapes, multi-wave groups and unproven branches keep the old native path or rejection. On RTX 4080 with stock Proton, 70 wave64 readbacks (35 scenarios, sums and state) and 32 wave32 readbacks matched all 39,168 words against the CPU oracle. 69 Rust tests passed. The reproducible test and both JSON receipts are included. These are synthetic native ISA controls, not a measured retail compatibility increase.

**@⁠Valdi320** on GitHub · 2026-11-24 11:11 UTC · [original](https://github.com/brcly/TuxBox/pull/46) `Valdi320:work/scarlett-uniform-reduction-guards` → `main` · +1229 −8 · 7 files · 3 commits · merged 2026-11-24 13:42 UTC The public ProjectScarlett log in #39 has 396 distinct refusals from wave_sum's divergent-control-flow guard. This narrow change accepts a forward SCC branch over an entire fixed-width reduction only when its comparison uses immediates or the scalar broadcast from an immediately preceding verified reduction. Other edges overlapping the proof window, alternate entries, intervening writes, early exits and indirect transfers remain rejected. EXEC/VCC and unknown SCC branches still fail closed. Wave-width requirements are unchanged. Validation on Bazzite: - 68 shader compiler unit tests passed. - Four new tests cover wave32/wave64, divergent branches, alternate entries, loops, overwritten results, and actual synthetic RDNA2 -> HLSL translation. - Both emitted synthetic HLSL shaders compiled with Microsoft DXC cs_6_6 and passed DXV. No retail shader inputs locally; the 396 refusals are not claimed fixed. A retest of the recorded requests would determine whether this specific branch pattern occurs and which remaining patterns need support. No game files or shader binaries included. AI-assisted contribution. **Portable wave64 follow-up:** For a verified single 64x1x1 compute group, exact integer reductions can now use synchronized group-shared lane exchanges without a host WaveSize(64) requirement. Unknown collectives, mask escapes, multi-wave groups and unproven branches keep the old native path or rejection. On RTX 4080 with stock Proton, 70 wave64 readbacks (35 scenarios, sums and state) and 32 wave32 readbacks matched all 39,168 words against the CPU oracle. 69 Rust tests passed. The reproducible test and both JSON receipts are included. These are synthetic native ISA controls, not a measured retail compatibility increase.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:27:28 +00:00
github manually merged commit 48e4431b78 into gh-pr/46/base 2026-11-26 06:27:28 +00:00
Author
Owner

@⁠trigger337 on GitHub · 2026-11-24 11:37 UTC · original

AI-assisted: yes

Hardware validation on Linux (CachyOS, Linux 6.18, AMD Radeon RX 6900 XT / RADV Navi 21, Vulkan 1.4.333):

  1. tuxbox-xshader Rust unit test suite (cargo test --target x86_64-unknown-linux-gnu --manifest-path tools/shader-compiler/Cargo.toml):

    • 69/69 passed cleanly (0 failed, 0 ignored).
    • Validated new tests:
      • hlsl::wave_sum::tests::uniform_literal_guard_must_skip_the_entire_reduction: pass
      • hlsl::wave_sum::tests::prior_reduction_result_is_uniform_only_without_intervening_writes: pass
      • hlsl::wave_sum::tests::alternate_entry_and_loop_edges_invalidate_uniform_guard: pass
      • hlsl::wave_sum::tests::portable_wave64_requires_a_single_group_and_no_other_wave_operations: pass
      • hlsl::wave_sum::tests::translates_two_native_reductions_with_a_uniform_scc_guard: pass
  2. Integration & Guest Smoke Tests (python3 -m unittest discover -s tests):

    • 125/125 tests passed (including Frosty compute pipelines, Scarlett shader preparation cache & rejection classification, chase/menu shader caching).

The strict proof window logic (ensuring SCC forward branches over reductions reject intervening writes, alternate entries, and loops while correctly accepting proven uniform constants or preceding reductions) builds cleanly and passes all test suites on Linux/RADV.

**@⁠trigger337** on GitHub · 2026-11-24 11:37 UTC · [original](https://github.com/brcly/TuxBox/pull/46#issuecomment-7130333822) AI-assisted: yes Hardware validation on Linux (CachyOS, Linux 6.18, AMD Radeon RX 6900 XT / RADV Navi 21, Vulkan 1.4.333): 1. **`tuxbox-xshader` Rust unit test suite (`cargo test --target x86_64-unknown-linux-gnu --manifest-path tools/shader-compiler/Cargo.toml`)**: - **69/69 passed** cleanly (0 failed, 0 ignored). - Validated new tests: - `hlsl::wave_sum::tests::uniform_literal_guard_must_skip_the_entire_reduction`: pass - `hlsl::wave_sum::tests::prior_reduction_result_is_uniform_only_without_intervening_writes`: pass - `hlsl::wave_sum::tests::alternate_entry_and_loop_edges_invalidate_uniform_guard`: pass - `hlsl::wave_sum::tests::portable_wave64_requires_a_single_group_and_no_other_wave_operations`: pass - `hlsl::wave_sum::tests::translates_two_native_reductions_with_a_uniform_scc_guard`: pass 2. **Integration & Guest Smoke Tests (`python3 -m unittest discover -s tests`)**: - **125/125 tests passed** (including Frosty compute pipelines, Scarlett shader preparation cache & rejection classification, chase/menu shader caching). The strict proof window logic (ensuring SCC forward branches over reductions reject intervening writes, alternate entries, and loops while correctly accepting proven uniform constants or preceding reductions) builds cleanly and passes all test suites on Linux/RADV.
This discussion has been locked. Commenting is limited to contributors.
No description provided.