Repository navigation
Conversation
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>
…ange Conflicts: tools/lane_masks.py (main added v_div_scale_* to the VOP3b mask line, ItsNotRexed#2231 the mask_sdst call: both kept), scripts/run_gpu_tests.py (main's name tuple plus cs_w64_sdst_pair), docs/design.md (main's rows plus the row ItsNotRexed#2231 adds). 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. ItsNotRexed#2231 makes the translator and lane_masks.py write and mark the pair. wave64_halves.py still took it as a 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>
Kam471
left a comment
There was a problem hiding this comment.
Ran at cdea51c1d on Windows 11, RTX 5070 Ti:
tests/semantic/test_w64_sdst_pair.py-> 3 tests, OK;test_wave64_halves_sdst_pair.py-> 9 tests, OK.test_wave64_halves.py101 OK,test_wave64_halves_soundness.py30 OK.- GPU emulated:
LEONIDA_W64_EMULATE=1 run_gpu_tests.py --filter sdst_pair-> 1/1 passed,cs_w64_sdst_pair->4871 4871 4871 70407 70407 4871 4871 4871; translator 1/1 +spirv-val. git diff --checkclean.
A VALU mask destination printed as one SGPR now consumes the SGPR pair in lane_masks.py/wave64_halves.py/the translator, and the docs note it; the new semantic and GPU fixture cover the pair write. No blocking issue.
|
Verified AI-assisted (Devin); no game files. |
|
Tested Result: pass; the new fixture passes on both GPUs and nothing else changes.
Tested and written by Claude (Claude Code), posting from @theswiss24's account. |
kacper-serewis
left a comment
There was a problem hiding this comment.
Independent operand census at cdea51c: 8,825 of 13,405 wave64 graphics listings contain a candidate single-SGPR mask destination (199,475 compare and 1,049 carry/secondary mask sites). Across all stages we found 18,870 candidates among 23,841 wave64 listings, versus 18,866/23,839 reported on #2231; discrepancy unresolved. Nine synthetic controls passed. The single-register and explicit-pair cases both reach tier A with equal interpreted exports; the lane-ID control remains tier C. Static candidate counts do not measure retail tier changes. AI-assisted CPU/cached inputs only.
|
AI-assisted (Claude Code). No game files; I cannot count the corpus, so this is a reading of the code only. @kacper-serewis about 18,870 of 23,841 against 18,866 of 23,839 on #2231: I see two possible causes in the code, and I cannot tell from here which one applies.
A count of the candidates for each mnemonic (counts only) can show it: if |
|
VERIFIED, no defects found at head Not a bug: Note it depends on #2231. AI-assisted review, no game files, no GPU. |
Claimed in the coordination issue as: new SHADER item (claim)
Depends on: #2231
This branch is
main98fa503fwith #2231 (8276a25c) merged in, and one commit on top (cdea51c1). #2231 conflicts withmainin three files at this time; the merge commit7aacc969has my resolution (see "The merge of #2231"). The change of this pull request is the last commit only:tools/wave64_halves.py, one new test file, one sentence indocs/design.mdand one intests/semantic/README.md.What and why
The corpus listings are disassembled for wave32. Thus the 64-bit mask destination of a wave64
v_cmp_*_e64or carry-out prints as one register:v_cmp_gt_f32_e64 s0, ...writess[0:1]. #2231 found this (284,353 compares in 18,866 wave64 shaders) and corrects the translator andtools/lane_masks.py.tools/wave64_halves.pyhas the same defect in its own operand table, and #2231 does not change that file.operands()takes the destination ass0only. Thens1keeps what the analysis knew about its old value:A later 64-bit read of
s[0:1]as a mask (s_and_saveexec_b64,s_and_b64, ...) gets that old state, and an exact shader is tier Ctainted-execorstale-scalar.The census of #4686 shows the size of the problem. @Kev-Ball ran
--census --whyon the corpus at a head without #2231. The largest rows are avcc_branchwhose producer is a SALU instruction and whose sources are av_cmpand one more writer (s_load,input,salu): that is a 64-bit mask instruction on a pair whose low register av_cmpwrote and whose high register still has an older value. A hand-written listing in the one-register spelling gives these same lines atmain, and the pair spelling of the same listing is tier A (details in my comment on #4686). About 3,700 of the 8,245 first reasons have a source of that form. #2231 removes the main part (the pair becomes a mask forlane_masks). This pull request removes the part that stays in the tier analysis after #2231.The change.
operands()widens the mask destination withlane_masks.mask_sdst(a, True)(the helper of #2231; this module analyses wave64 programs only):v_cmp*with an SGPR destination (notv_cmpx, not the VCC form);v_*_co_*,v_mad_u64_u32,v_mad_i64_i32,v_div_scale_*), the same list thatlane_masks.pyhas.A pair that the listing prints as a pair is not changed. Other one-register SGPR destinations (
v_readfirstlane_b32, SALU, scalar loads) are not changed.Why it is exact. The hardware writes the two registers (#2231: the listings are made without
+wavefrontsize64; its GPU testcs_w64_sdst_pairpasses on native wave64 devices). After the instruction, the two registers hold the new mask, so the old state of the high register cannot reach a later read. The change only makes the analysis of the one-register spelling equal to the analysis of the pair spelling, which was already there.Tested
Head
cdea51c1. Windows 11 Pro (10.0.26200), Python 3.14.7, CPU only. No GPU. Nollvm-mcand no SPIRV-Tools on this machine, so I did not build the GPU fixtures and I did not runspirv-val. No game files.New test file
tests/semantic/test_wave64_halves_sdst_pair.py(9 tests). Each program is a hand-written vertex shader, written in the one-register spelling and in the pair spelling. It is translated and run onspirv_wave_interp.pyas one 64-lane wave and as two 32-lane waves.s_bcnt1_i32_b64of EXEC before the comparev_readfirstlane_b32of a varying valuev_add_co_u32_e64 v9, s14, ...) after a lane count in the high registers_and_b64 vcc, exec, s[14:15]and a vote; two compares ANDed; the compare intos_and_saveexec_b64tainted-exectainted-execcross-laneoperands()unit checks: which destinations become pairs and which do notNegative control: with
wave64_halves.pyof the merge commit (main and #2231, without this change), 5 of the 9 tests fail: the first four rows are tier Ctainted-execin the one-register spelling, and the unit check fails. The census shapes (row five) are tier A there already; they pin the effect of #2231 on the tier.tests/semantic/test_wave64_halves.py,test_wave64_halves_soundness.py,test_w64_sdst_pair.py(of #2231)python -I -m unittest discover -s tests/semantictest_loop_ballot_barrier(5) andtest_vcmp16_opsel(1). These are the same 6 tests, by name, that fail on this machine onmain(measured at2d3369a4, 6,245 tests); none of them is in a file that this pull request or #2231 changespytestontests/test_wave64_halves_fixtures.py,test_lane_masks.py, the docs row tests,test_semantic_translator_use.py,test_text_write_line_endings.py,test_resource_hygiene.pyllvm-mc)python -I -m compileall -q tools tests,git diff --check,scripts/check_no_game_data.pyThe merge of #2231
git mergeof8276a25cintomain98fa503fhas three conflicts. My resolutions, for the author of #2231 if they are useful:tools/lane_masks.py:mainaddedv_div_scale_f32/v_div_scale_f64to the VOP3b mask line, Translator: a wave64 VALU mask SDST printed as one SGPR is the SGPR pair #2231 changed the same line toput(state, mask_sdst(a[1], wave64), MASK). I kept the two changes.scripts/run_gpu_tests.py: the name tuple ofmainplus"cs_w64_sdst_pair".docs/design.md: the rows ofmainplus the row that Translator: a wave64 VALU mask SDST printed as one SGPR is the SGPR pair #2231 adds.After the merge,
tests/semantic/test_w64_sdst_pair.py(3 tests),tests/test_lane_masks.pyand the docs row tests pass.Not measured: the corpus
I have no copy of the game. @Kev-Ball, or any person with their own copy: please run the tier census three times, counts only, on indexes translated at
main98fa503f,7aacc969(main and Translator: a wave64 VALU mask SDST printed as one SGPR is the SGPR pair #2231),cdea51c1,with
python -I tools/wave64_halves.py --census <spirv>/index.json. The difference between 1 and 2 is the effect of #2231 on the tiers; the difference between 2 and 3 is the effect of this pull request. If #4686 is in your tree,--wave64-whyand--census --whyon 2 and 3 show what stays.Limits
v_cndmask_b32mask, aco_cicarry-in) is the subject of Translator: wave64 VOP3 v_cndmask mask and co_ci carry-in printed as sN read the SGPR pair; mask-data tier C (SHADER-200) #2241, not of this pull request.Overlap
MASK_LO/MASK_HIkinds oflane_masks. Without Translator: a wave64 VALU mask SDST printed as one SGPR is the SGPR pair #2231, each one-register compare leaves the high register without a mask kind, so I expect that wave64_halves: an SGPR-pair mask with one half overwritten is mask-half #4624 givesmask-halfto these pairs; with Translator: a wave64 VALU mask SDST printed as one SGPR is the SGPR pair #2231 they are complete pairs. I did not test that combination.WhyAnalysis) usesoperands()and gets the wider destination with no change.operands(), the line before one of the two lines that this pull request changes: a small text merge for the one that merges second. The other open pull requests ontools/wave64_halves.py(wave64_halves: a buffer_load with idxen at a wave-uniform address gives a wave-uniform VGPR (new SHADER item) #4630, wave64_halves: a vote on a wave-uniform compare is not a lane vote (new SHADER item) #4138, SHADER-747: wave64_halves refuses a vote whose run side widens EXEC before the join #4541, wave64_halves: preserve destination taint on partial writes and reject asymmetric DPP row_mask #4373, Tools: wave64_halves, a VGPR written under a narrowed EXEC is tier C once EXEC widens #4619, wave64_halves: a lane mask accumulated by lane-local defs is not stale (SHADER-821) #4656, wave64_halves: count v_cmpx as an EXEC write #4585) do not change these two lines.AI-assisted: yes (Claude Code). It wrote the change and ran all the checks above on this machine.
Checklist
docs/design.md, with how it was confirmed.🤖 Generated with Claude Code