xshader: lower a reduction whose result read waits for loads first #577

Closed
NickStallman wants to merge 1 commit from upstream-pr/577 into main
NickStallman commented 2026-11-30 07:08:51 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T07:08:51Z.


Refs #533.

The console compiler can put s_waitcnt between the last combine of a wave reduction and the lane read that takes its result. The lowering expects the read directly after the combine, so the program was refused.

s_waitcnt writes no register and no memory. The lane read and the EXEC restore touch registers only, so the wave reaches the same state with the wait after them; it is moved there before lowering. It stays put when a branch lands on the read or the restore (then the program is refused as before).

Effect on recorded ProjectScarlett requests (47,526 containers, compute for both hosts, 1,907 linked pairs, stride retries, against e5d2e913): 2 requests newly accepted (one ray-traced shadow program, one of 26 compute programs that are stand-ins in every run), 0 changed, 0 newly refused; one rootless twin changes its refusal text. Both compile with DXC 1.9.2609 and pass dxv.

Tested

  • 5 new unit tests that fail without the change; 12 mutations, each caught.
  • The wave extrema GPU check gains two programs with the wait. python tuxbox.py check --no-gpu at 6b8f96f7: 12 of 12.
  • Full python tuxbox.py check of 6b8f96f7 (on e5d2e913, GE-Proton11-14): RTX 5090 (10de:2b85, 620.70.10) 200 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 199 pass, 0 fail. The wave extrema check passes with 32 and 64 lanes on both.
  • Translation time over all jobs 1278 s before, 1283 s after.

Not run: the game. Read, not measured: that s_waitcnt has no effect on registers or memory. No claim about the picture.

Evidence: TuxBox check of 6b8f96f762, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run
Evidence: TuxBox check of 6b8f96f762, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run

🤖 Generated with Claude Code

<!-- greyfinch-sync:brcly/TuxBox:issue:5560709949 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/577). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T07:08:51Z. --- Refs #533. The console compiler can put `s_waitcnt` between the last combine of a wave reduction and the lane read that takes its result. The lowering expects the read directly after the combine, so the program was refused. `s_waitcnt` writes no register and no memory. The lane read and the EXEC restore touch registers only, so the wave reaches the same state with the wait after them; it is moved there before lowering. It stays put when a branch lands on the read or the restore (then the program is refused as before). **Effect on recorded ProjectScarlett requests** (47,526 containers, compute for both hosts, 1,907 linked pairs, stride retries, against e5d2e913): 2 requests newly accepted (one ray-traced shadow program, one of 26 compute programs that are stand-ins in every run), 0 changed, 0 newly refused; one rootless twin changes its refusal text. Both compile with DXC 1.9.2609 and pass dxv. ## Tested - 5 new unit tests that fail without the change; 12 mutations, each caught. - The wave extrema GPU check gains two programs with the wait. `python tuxbox.py check --no-gpu` at 6b8f96f7: 12 of 12. - Full `python tuxbox.py check` of 6b8f96f7 (on e5d2e913, GE-Proton11-14): RTX 5090 (`10de:2b85`, 620.70.10) 200 pass, 0 fail; AMD iGPU (`1002:13c0`, RADV) 199 pass, 0 fail. The wave extrema check passes with 32 and 64 lanes on both. - Translation time over all jobs 1278 s before, 1283 s after. **Not run:** the game. Read, not measured: that `s_waitcnt` has no effect on registers or memory. No claim about the picture. Evidence: TuxBox check of 6b8f96f76228, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not run Evidence: TuxBox check of 6b8f96f76228, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run 🤖 Generated with [Claude Code](https://claude.com/claude-code)
brcly commented 2026-11-30 10:58:47 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T10:58:47Z.


Merged into main as ba7680e5 (squashed and credited to you). Thanks.

The corpus check here matches yours: 2 gained, 0 lost, 0 changed, and 1 refusal text changed. Both gained programs compile at -O3 and pass dxv.

<!-- greyfinch-sync:brcly/TuxBox:comment:7276353756 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/577#issuecomment-7276353756). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T10:58:47Z. --- Merged into main as ba7680e5 (squashed and credited to you). Thanks. The corpus check here matches yours: 2 gained, 0 lost, 0 changed, and 1 refusal text changed. Both gained programs compile at -O3 and pass dxv.

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