shader: accept proven uniform forward reduction guards #46

Merged
Valdi320 merged 3 commits from upstream-pr/46 into main 2026-11-24 13:42:08 +00:00
Valdi320 commented 2026-11-24 11:11:50 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Valdi320 on 2026-11-24T11:11:50Z.


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.

<!-- greyfinch-sync:brcly/TuxBox:issue:6580474852 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/46). Originally posted by [Valdi320](https://github.com/Valdi320) on 2026-11-24T11:11:50Z. --- 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.
trigger337 commented 2026-11-24 11:37:19 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by trigger337 on 2026-11-24T11:37:19Z.


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.

<!-- greyfinch-sync:brcly/TuxBox:comment:7130333822 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/46#issuecomment-7130333822). Originally posted by [trigger337](https://github.com/trigger337) on 2026-11-24T11:37:19Z. --- 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!46
No description provided.