xshader: emit simple paired Wave64 ALU assignments directly #242

Closed
Valdi320 wants to merge 1 commit from upstream-pr/242 into main
Valdi320 commented 2026-11-26 15:38:58 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Valdi320 on 2026-11-26T15:38:58Z.


Change

Lower a restricted subset of integer vector ALU instructions directly into paired VGPR assignments instead of duplicating shadow registers and copying them back. Require a single predicated destination assignment, no mask writes, and a closed operand/expression whitelist. All other forms keep the generic path. Both DPP source reads still precede either lane write, and row/bank gating is preserved. Native/any-host records are unchanged.

Measurements

Synthetic 512-exchange compute program; same base 3b8a220, production DXC flags and five alternating runs per version:

  • HLSL: 638802 -> 486364 bytes (-23.9%).
  • DXC median: 1.197 -> 0.994 s (-17.0%).
  • Peak RSS median: 81228 -> 65508 KiB (-19.4%).
  • All ten DXIL binaries have identical SHA-256, 73540 bytes. These measurements do not establish retail FPS or startup savings.
  • This is independent of #234; combined benefits not measured.

Validation

  • Structural regression before/after, negative expression cases, host-profile records (paired route only), all six no-GPU check groups passed.
  • Real GPU CPU-oracle comparison: 22 programs, 1441792 words, zero mismatches; dependent integer chain under sparse EXEC, DPP8/DPP16, single and multiwave groups.
  • 8/8 Lanes gates on RTX 4080 / GE-Proton11-14, using unchanged same-base provider and fixtures (source equality checked), current translator.
  • No retail data included.

Draft pending full GPU suite on exact branch and AMD validation; actual retail performance not measured.

<!-- greyfinch-sync:brcly/TuxBox:issue:5512950103 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/242). Originally posted by [Valdi320](https://github.com/Valdi320) on 2026-11-26T15:38:58Z. --- ## Change Lower a restricted subset of integer vector ALU instructions directly into paired VGPR assignments instead of duplicating shadow registers and copying them back. Require a single predicated destination assignment, no mask writes, and a closed operand/expression whitelist. All other forms keep the generic path. Both DPP source reads still precede either lane write, and row/bank gating is preserved. Native/any-host records are unchanged. ## Measurements Synthetic 512-exchange compute program; same base 3b8a220, production DXC flags and five alternating runs per version: - HLSL: 638802 -> 486364 bytes (-23.9%). - DXC median: 1.197 -> 0.994 s (-17.0%). - Peak RSS median: 81228 -> 65508 KiB (-19.4%). - All ten DXIL binaries have identical SHA-256, 73540 bytes. These measurements do not establish retail FPS or startup savings. - This is independent of #234; combined benefits not measured. ## Validation - Structural regression before/after, negative expression cases, host-profile records (paired route only), all six no-GPU check groups passed. - Real GPU CPU-oracle comparison: 22 programs, 1441792 words, zero mismatches; dependent integer chain under sparse EXEC, DPP8/DPP16, single and multiwave groups. - 8/8 Lanes gates on RTX 4080 / GE-Proton11-14, using unchanged same-base provider and fixtures (source equality checked), current translator. - No retail data included. Draft pending full GPU suite on exact branch and AMD validation; actual retail performance not measured.
brcly commented 2026-11-26 16:17:37 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-26T16:17:37Z.


Thanks for these. I measured #234, #242 and #243 on real recorded ProjectScarlett .wave32 requests, to see how the synthetic gains carry over. This comment covers all three.

Setup: 83 requests translated with --wave32-host; main (4d3dd26) and every PR build compile the same 74 and refuse the same 9. DXC 1.9.2609, -O1 -disable-lifetime-markers, 4 jobs on a Ryzen 7 9800X3D, build order rotated, median of 3 runs, with a second copy of main as a noise control. For the builds with #234 I kept main's copy of the conflicting test files. #243 conflicts with #242 in paired_wave64.rs, so I didn't combine those.

DXC CPU time, excluding the largest shader (it took either about 19 s or about 26 s whichever build compiled it):

build DXC change HLSL size, all 74 DXIL size, all 74
main 80.0 s
main again 79.9 s -0.2%
#234 80.0 s 0.0% -0.2% -0.2%
#242 77.4 s -3.2% -10.6% +0.0%
#243 79.7 s -0.4% -0.6% -0.0%
#234 + #242 77.3 s -3.4% -10.8% -0.2%
  • With #242, 55 of the 74 DXIL outputs are byte-identical to main's.
  • NVIDIA pipeline creation for the largest shader (RTX 4070 Ti SUPER, 620.73.4, disk caches off, one run each) took 28.8-30.2 s for main, #234, #243 and #234 + #242, which I read as no difference.
  • Translation is slightly faster with all three, from about 1.5 s total.

So on these shaders the gains are much smaller than on the synthetic programs, and I wouldn't expect a noticeable startup change. #242 still looks like a reasonable cleanup. For startup time, it would help to base the next optimisations on stage timings from real shaders (#238 looks useful for that), with driver time included.

Not checked: output correctness of the changed shaders, AMD, or any game run.

<!-- greyfinch-sync:brcly/TuxBox:comment:7197449561 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/242#issuecomment-7197449561). Originally posted by [brcly](https://github.com/brcly) on 2026-11-26T16:17:37Z. --- Thanks for these. I measured #234, #242 and #243 on real recorded ProjectScarlett `.wave32` requests, to see how the synthetic gains carry over. This comment covers all three. **Setup:** 83 requests translated with `--wave32-host`; `main` (`4d3dd26`) and every PR build compile the same 74 and refuse the same 9. DXC 1.9.2609, `-O1 -disable-lifetime-markers`, 4 jobs on a Ryzen 7 9800X3D, build order rotated, median of 3 runs, with a second copy of `main` as a noise control. For the builds with #234 I kept `main`'s copy of the conflicting test files. #243 conflicts with #242 in `paired_wave64.rs`, so I didn't combine those. DXC CPU time, excluding the largest shader (it took either about 19 s or about 26 s whichever build compiled it): | build | DXC | change | HLSL size, all 74 | DXIL size, all 74 | | --- | --- | --- | --- | --- | | `main` | 80.0 s | | | | | `main` again | 79.9 s | -0.2% | | | | #234 | 80.0 s | 0.0% | -0.2% | -0.2% | | #242 | 77.4 s | -3.2% | -10.6% | +0.0% | | #243 | 79.7 s | -0.4% | -0.6% | -0.0% | | #234 + #242 | 77.3 s | -3.4% | -10.8% | -0.2% | - With #242, 55 of the 74 DXIL outputs are byte-identical to `main`'s. - NVIDIA pipeline creation for the largest shader (RTX 4070 Ti SUPER, 620.73.4, disk caches off, one run each) took 28.8-30.2 s for `main`, #234, #243 and #234 + #242, which I read as no difference. - Translation is slightly faster with all three, from about 1.5 s total. So on these shaders the gains are much smaller than on the synthetic programs, and I wouldn't expect a noticeable startup change. #242 still looks like a reasonable cleanup. For startup time, it would help to base the next optimisations on stage timings from real shaders (#238 looks useful for that), with driver time included. **Not checked:** output correctness of the changed shaders, AMD, or any game run.
Valdi320 commented 2026-11-26 23:21:11 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by Valdi320 on 2026-11-26T23:21:11Z.


Deferred: maintainer measured ~3.2% savings on the recorded corpus, no material startup improvement established. Revisit only with new performance evidence. Closing this draft to make the review queue manageable, per the maintainer's request. The branch and history remain intact at 7fae66b; no branch deleted.

<!-- greyfinch-sync:brcly/TuxBox:comment:7205468896 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/242#issuecomment-7205468896). Originally posted by [Valdi320](https://github.com/Valdi320) on 2026-11-26T23:21:11Z. --- Deferred: maintainer measured ~3.2% savings on the recorded corpus, no material startup improvement established. Revisit only with new performance evidence. Closing this draft to make the review queue manageable, per the maintainer's request. The branch and history remain intact at `7fae66b`; no branch deleted.

Pull request closed

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!242
No description provided.