xshader: keep VCC when a paired-wave64 v_cmpx narrows EXEC #380
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/380"
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 NathansDomainSolutions on 2026-11-28T07:55:24Z.
On RDNA2,
v_cmpx_*writes EXEC only. GFX10 dropped the VCC/SDST write that GCN's CMPX had. The decoder still gives every VOPC instruction an implicitVccLodestination (runtime/dxbc/src/rdna2/operands.rs). The ordinary emitter handles this correctly (vector_wide.rswritesExecLoforv_cmpx), but the two-lanes-per-thread translation (paired_wave64.rs) also counted VCC as written and rebuilt it:Here
tbx_exec_lois EXEC before the compare. Every lane another mask had already turned off lost its VCC bit. So a program that sets VCC under a wider EXEC, narrows EXEC (withs_and_saveexec, thenv_cmpx), restores EXEC and reads VCC sees zeros there. This translation is what 32-lane hosts (NVIDIA, Intel) run for 64-lane console programs.Change
For
v_cmpx_*, the paired translation now treats EXEC as the only mask written, as the ordinary one does. The per-lane VCC shadows and the two ballots that rebuilt VCC are no longer emitted.Checks
RTX 4070 (
10de:2786), driver 620.73.04, GE-Proton11-14, oncba382c.cmpx_vcc(andcmpx_vcc_half) intools/check_paired_wave64.py. It sets VCC, narrows EXEC withs_and_saveexec, narrows it again withv_cmpx, restores EXEC, then runsv_cndmask/s_bcnt1on VCC. The reference model already treats CMPX as EXEC-only.main:FAIL: 2 of 51 programs,WRONG cmpx_vcc: wave 2 lane 0 s20 got 3 wanted 8andWRONG cmpx_vcc_half: wave 4 lane 0 s20 got 0 wanted 13.PASS: 51 programs, 3342336 words.tools/check_translator_gpu.py(all checks): 59 of 59 passed.tuxbox.py verify --only lanes-shader-cache --only lanes-raster-tables --only lanes-compute-root --only lanes-compute-root-recovery --only lanes-bindless-compute: 28 of 28 passed.tuxbox.py check --no-gpu: all passed.host_profiles.txtwas re-blessed. The rows that changed are paired (two-lanes) andwave32-hosttranslations of programs containing av_cmpx. Every one of them does, because the check's prologue starts each program with one. The only differences are the removed VCC shadows and ballots.Effect on recorded requests. Over the 394
_w32requests ProjectScarlett 1.0.2.1 made on this card in a live run, 342 translations change and 52 are identical. Their HLSL total goes from 167.3 MB to 163.9 MB, which is two fewer wave ballots perv_cmpx. I didn't work out which of the 342 actually read VCC after the narrowed region, so the visible effect in the game is unmeasured.Missing: an AMD run. 64-lane AMD hosts don't take this path unless forced with
TUXBOX_HOST_PROFILE, so the result shouldn't depend on the vendor, but CONTRIBUTING asks for both.AI-assisted: found and written with Claude Code (Claude Opus 5.5). I reviewed the change and ran the checks above.
🤖 Generated with Claude Code