Repository navigation
Translator: a wave64 VALU mask SDST printed as one SGPR is the SGPR pair - #2231
simonbronk wants to merge 1 commit into
Conversation
|
Tested
Setup: runtime test programs built from |
|
Tested 435e3c8 on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass. The PR's diff applied cleanly to
|
|
Corpus run of 435e3c8 merged with
It also sits fine next to #2241 (the same wave32 listing syntax on the source side: the |
|
GPU check on an AMD Radeon RX 9070 (RDNA4, gfx1201, 32..64 subgroups, so native wave64 too), Windows 11, Vulkan SDK 1.4.363. Tested head 435e3c8 merged onto
AI-assisted (Claude Code); runs on my machine. |
The corpus is disassembled for gfx1013 without +wavefrontsize64, so the 64-bit SDST of a wave64 v_cmp_*_e64 or carry-out prints as one register (v_cmp_gt_f32_e64 s0, ...) while the wave writes s[0:1]. lane_masks.py took it as s0 alone, so s1 was unknown and a later s_and_b64 / s_or_b64 of two compare results took the 64-bit data path: SCC was each lane's own bit instead of the wave's vote, and s_bcnt1_i32_b64 of it counted data bits. lane_masks.step/analyse take the shader's wave size; mask_sdst widens a one-register VALU mask destination to the pair in wave64. rdna2spirv's valu_mask_dst writes both registers: since 804f4ae a pair read as a wave64 mask takes lanes 32-63 from the high register, which the one-register write left stale. Corpus (26,503 shaders): one-register SDSTs in 18,866 of 23,839 wave64 shaders; 18,868 translate differently, all wave64; the same 26,501 still translate and pass spirv-val as on main. New GPU test cs_w64_sdst_pair (corpus form) and tests/semantic/test_w64_sdst_pair.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
435e3c8 to
8276a25
Compare
|
Rebased on Rechecked on the rebased head:
The body has the updated numbers. AI-assisted (Claude Code). Counts only, no game data. |
|
AI-assisted (Claude Code). No game files; hand-written listings; CPU wave interpreter only (Windows 11, Python 3.14.7). New evidence for the priority of this pull request, from the root-cause census of the wave64 graphics tiers (#4686, run on the corpus by This pull request conflicts with
After the merge (commit One part is not in this pull request: |
A narrow-printed v_cmp_*_e64 s4 holds the whole per-lane mask in s4 and never writes s5; widening it read stale s5 for lanes 32-63 (regression of c559706). Half masks, EITHER and data still widen to the pair. Limit (later s5 write) resolves with ItsNotRexed#2231. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Corpus check of 8276a25 against its merge base
Tested as-is: the PR now conflicts with Counts only, no game files. AI-assisted (Claude Code). |
…R pair The corpus listings print the 64-bit mask destination of a wave64 v_cmp_*_e64 or carry-out as one register. write of one register, so the high register kept the taint, the tag and the reaching definitions of its old value, and a later 64-bit mask read of the pair was tier C (tainted-exec, stale-scalar) in an exact shader. operands() now widens that destination with lane_masks.mask_sdst (v_cmp with an SGPR destination, the carry-out of the VOP3b instructions). tests/semantic/test_wave64_halves_sdst_pair.py: each hand-written listing in the one-register and in the pair spelling, as one 64-lane wave and as two 32-lane waves. 5 of its 9 tests fail without the change. Builds on ItsNotRexed#2231. No game data. The corpus effect is not measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…R pair The corpus listings print the 64-bit mask destination of a wave64 v_cmp_*_e64 or carry-out as one register. write of one register, so the high register kept the taint, the tag and the reaching definitions of its old value, and a later 64-bit mask read of the pair was tier C (tainted-exec, stale-scalar) in an exact shader. operands() now widens that destination with lane_masks.mask_sdst (v_cmp with an SGPR destination, the carry-out of the VOP3b instructions). tests/semantic/test_wave64_halves_sdst_pair.py: each hand-written listing in the one-register and in the pair spelling, as one 64-lane wave and as two 32-lane waves. 5 of its 9 tests fail without the change. Builds on ItsNotRexed#2231. No game data. The corpus effect is not measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…R pair The corpus listings print the 64-bit mask destination of a wave64 v_cmp_*_e64 or carry-out as one register. write of one register, so the high register kept the taint, the tag and the reaching definitions of its old value, and a later 64-bit mask read of the pair was tier C (tainted-exec, stale-scalar) in an exact shader. operands() now widens that destination with lane_masks.mask_sdst (v_cmp with an SGPR destination, the carry-out of the VOP3b instructions). tests/semantic/test_wave64_halves_sdst_pair.py: each hand-written listing in the one-register and in the pair spelling, as one 64-lane wave and as two 32-lane waves. 5 of its 9 tests fail without the change. Builds on ItsNotRexed#2231. No game data. The corpus effect is not measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
New SHADER item, follow-up to SHADER-21 (#210). Claimed in #1902 (comment).
Problem
shader_disasm.pydisassembles for gfx1013 without+wavefrontsize64. As a result, the 64-bit SDST of a wave64v_cmp_*_e64or carry-out (v_add_co_u32,v_mad_u64_u32, ...) prints as one register:v_cmp_gt_f32_e64 s0, ..., even though the wave writess[0:1].tools/lane_masks.pymarked onlys0as a mask, which lefts1unknown. A laters_and_b64 s[4:5], s[0:1], s[2:3]then took the 64-bit data path. Two things went wrong:s_bcnt1_i32_b64of it counted data bits.Corpus count: 284,353
v_cmp_*_e64and 6,988 carry-outs write a one-register SDST. They appear in 18,866 of the 23,839 wave64 shaders.Change
tools/lane_masks.py:stepandanalysetake the shader's wave size.mask_sdstwidens a one-register VALU mask destination to the pair in wave64.v_cmpxis unaffected, since it has no SDST and returns early throughNO_DESTINATION.tools/rdna2spirv.py:park_maskspasseswave64=self.wave64.valu_mask_dstwrites both registers of a widened VALU mask SDST (v_cmp*,v_cmp_class, 64-bit compares, carry-outs,v_mad_u64_u32). Since804f4aefonmain, a pair read as a wave64 mask takes lanes 32-63 from the high register (mask_src), so marking it inlane_masksalone lefts[r+1]stale.docs/design.md: a contract row, "Wave64 VALU mask destination printed as one SGPR".Tests
runtime/test/shaders/cs_w64_sdst_pair.asm. It is written in the corpus's one-register form, with nomattrline.s_bcnt1_i32_b64and the lane's bit.check.pyandrun_gpu_tests.py.4871 4871 4871 70407 70407 4871 4871 4871.main1628210 still gives0 0 0 73735 73735 0 0 0on both GPUs below (re-measured after the rebase).tests/semantic/test_w64_sdst_pair.py(spirv_wave_interp, 64 lanes). It covers one-register compares, pair compares and a one-register carry-out. Two of its three tests fail onmain.Windows 11, LLVM 21.1.8
llvm-mc, GPU picked withVK_LOADER_DRIVERS_SELECT:run_gpu_tests.pyLEONIDA_W64_EMULATE=1The 15 tests are skipped on
maintoo: they are run by the d3d12 tests, andps_w64x_readlaneneeds a 64-wide fragment subgroup.Other checks:
python -m unittest discover -s tests/semantic: 4145 tests, OK.python -m compileall -q make_game.py tools tests: clean.Corpus (the player's own copy, 1.0.2.1, 26,503 shaders,
--wave64-emulate, 8 shards):main1628210, 26,501 translate and passspirv-val. The same 26,501 do with this PR.Relation to #293
#293 (a lane mask read as data gives the wave's bits) hits the same gap. Without this fix, it inserts about 98,900 wave-bit gathers in about 9,300 shaders for pairs that are really masks, measured on an older
main. With this fix, 775 gathers remain in 46 shaders. #293 is rebased on this PR.AI-assisted (Claude Code). No game data in the PR.
🤖 Generated with Claude Code