xshader: run lane permutes behind branches with the whole wave #548
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/548"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T21:28:10Z.
The branch is
5b3975d3onf482572a; the patch is identical to69596066(39463ea5) and58198ae6(97f21fad), which earlier results below name.A 32-lane compute program whose
ds_bpermute_b32sits behind a branch was refused. Where nothing else translates it, it now takes the whole-wave translation that lane reads in divergent loops already use. Every branch is proved to be uniform or is voted across the wave, so every lane reaches the permute and holds the value and EXEC bit another lane reads. A program that mixes masks and numbers is still refused, and so isds_permute_b32behind a branch.To run the programs that use it:
v_and_b32of the wave's mask with a lane's own bit takes the ballot (32-lane waves only).It recovers four
CS_GenerateShadowMasks_*programs andCS_ComputeStickyLipsin ProjectScarlett. Of the recorded programs, only those 15 requests (three recordings of each) change.Rebase onto
e5d2e913(eb8c05a9): main's formatting putpipeline.rsover 1,200 lines, so the retry wrapper is nowlockstep::translate_outputs, the branch testlockstep::permutes_apart, and the main pathtranslate_outputs_before_lockstep. The logic is the same, and the HLSL of 1,600 random recorded jobs and the 15 programs is identical to the old head's.Tested
97f21fad: 10,923 translate before, 10,953 after. 30 pairs recovered, 0 lost, 0 outputs changed, 0 refusal reasons changed, so no recorded program that translates today recompiles. All 15 recovered passed DXC and DXV (at most 1.9 s and 243 KB DXIL for those measured) on the2d6dc338output.f482572a(47,526 containers, linked pairs, stride retry): 15 compute programs newly accepted, none newly refused, none changed; all 15 compile and pass dxv.ds_permute_b32refusal. Nine mutations each fail a unit test (three repeated after the rebase onto4198b48c).check_lockstep_gpu.pygains four programs. Off the GPU, the emitted HLSL of 11 lockstep programs, those four included, matches the reference model in 336 input cases each on a 32-lane CPU simulator that fails when lanes diverge at a wave operation (repeated on4198b48c). These are synthetic programs.check_lockstep_gpu.pyon69596066: RTX 5090 (10de:2b85, 620.70.10) and AMD iGPU (1002:13c0, RADV): 720 cases, 276,480 words, all match the reference on both, with the four new programs.python tuxbox.py check --no-gpuat58198ae6: passed.python tuxbox.py checkofeb8c05a9(rebased ontoe5d2e913; retry code moved for the line limit, HLSL unchanged, see the rebase note above): RTX 5090 (10de:2b85, 620.70.10) 200 pass, 0 fail; AMD iGPU (1002:13c0, RADV) 199 pass, 0 fail. GE-Proton11-14.Not run: driver compile time, and the game for these programs. Game logs on an RTX 5090 (our integration builds) and an RX 9070 XT (@Kayotic1337) name none of the four shadow-mask programs, neither as unsupported, queued nor finished; the 5090 runs ended on a loading screen. So nothing yet shows the game using them. Host lane n being thread n of the wave is assumed, as in the existing wave lowerings.
Evidence: TuxBox check of
eb8c05a9d8, no uncommitted changes, GPU 10de:2b85: 16 passed, 0 failed, 0 not runEvidence: TuxBox check of
eb8c05a9d8, no uncommitted changes, GPU 1002:13c0: 16 passed, 0 failed, 0 not run🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-30T00:50:04Z.
Game runs on an RX 9070 XT (
1002:7550, RDNA 4, RADV / Mesa 26.3.1, GE-Proton11-14, Linux 7.3.6). Build:mainf482572a+ #557 + #546 (70781497) + #548 (58198ae6) + #535 (fbbe6e0e), all merged cleanly.f360038dwithout these PRs. That is roughly the 5 + 5 programs these PRs recover, but the runs differ in length and the log only names programs by hash, so I can't say which programs these are.TUXBOX_XMEM_PRIVATE_VIEWS=1): the menus run at about 300 presents per 10 s. It reaches frame 2716 of the first cutscene (int_prolo), then hits the same compute TCP write permission fault (0x741041) I saw onmainbefore these PRs.Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:14Z.
Heads-up: main just landed a large cleanup (up to
e5d2e913), so this PR needs a rebase.rustfmt.toml).unwrap(), lossyascasts and undocumentedunsafeoutside tests.cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.The least painful way is to format your branch first, so the rebase only shows real changes:
Then run
python tuxbox.py check --no-gpu, which now includes the format step.If clippy flags something new:
Fromfor widening,TryFromfor narrowing, and a mask for bit fields.unwrap(): use?, orexpectwith the reason it can't fail.unsafeblock: it needs a// SAFETY:comment.CONTRIBUTING's "Code checks" section lists the commands. Thanks!
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T09:26:04Z.
Merged into main as
647ef91d(squashed and credited to you), thanks!What I checked:
cs_6_6and passes dxv.Thanks also to @Kayotic1337 for the RDNA 4 game run.
Pull request closed