Repository navigation
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Ran this at f99eb65f on Windows 11. All four suites pass:
tests/semantic/test_wave64_halves_partial_dst.py-> 13 tests, OKtests/semantic/test_wave64_uniform_load.py-> 12 tests, OKtests/semantic/test_spirv_wave_interp.py-> 15 tests, OKtests/semantic/test_wave64_halves.py-> 73 tests, OKgit diff --checkclean.
The new _preserves_dst covers the partial-destination forms (RMW ops, SDWA with UNUSED_PRESERVE, asymmetric DPP row/bank masks, _e64/op_sel 16-bit writes, f16/u16/i16 results, d16 loads, image_load/image_sample with an odd dmask) and makes the preserved destination a source; uniform_load recognises a buffer_load with idxen from a wave-uniform address, excluding any memory the shader itself writes (MEM_WRITES). The interpreter is extended to run the partial-dst cases.
Merge check: git merge-tree with #4619, #4624 -> clean; with #4620 -> conflict only in docs/design.md (both edit rows there), no code conflict. No blocking issue.
|
BLOCKED: it needs a rebase and depends on #4373. The rule itself is sound: with But: it conflicts with current AI-assisted review, no game files, no GPU. |
|
Tested f99eb65 on AMD Radeon RX 9070 XT (RADV GFX1201, wave32/64) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
AI-assisted (Claude Code). No game files; CPU only (Windows 11, Python 3.14.7). The branch now has What the merge changed
Runs at
I did not run the full semantic suite again at this head. The dependency stays. |
|
Tested 58b68a9 merged with main 98fa503 on Linux (Python 3.12.16): pass - test_wave64_uniform_load 12, test_wave64_halves_partial_dst 13, test_spirv_wave_interp 21 OK; all tests/semantic/test_wave64*.py 223 OK (with test_spirv_wave*.py); tests/test_docs_*.py all OK; negative control: tools/wave64_halves.py and spirv_wave_interp.py from main, PR tests kept: uniform_load FAILED (failures=5, errors=6) of 12, spirv_wave_interp FAILED (errors=2) of 21, partial_dst FAILED (failures=10) of 13; with only wave64_halves.py reverted: uniform_load 6 failures, partial_dst 10 failures. |
|
Census (TEST-1006) of Setup. Each PR is merged onto
So wave-uniform AI-assisted (Claude Code). Part of TEST-1006 on the coordination issue. |
|
Tested
|
|
Verified on Linux: merges cleanly with current main and everything runnable is green — test_wave64_uniform_load, test_wave64_halves_partial_dst, the modified test_spirv_wave_interp, the existing wave64_halves suites, the fixture suite (9 passed, pytest), the translator-use guard and the docs table tests; compileall is clean. The uniform-load rule is properly fenced (idxen MUBUF only, EXEC at the launch mask, uniform and untainted operands, no shader memory writes — the last one keeps the two halves' reads identical). Two heads-ups: this carries two rules (partial-write taint / DPP row_mask plus the idxen load) though the title names one, and a rebase onto main alone would hit a conflict in the docs/design.md Wave64 row. The red joaat/rdna2_decode suites here are the known current-main regressions (#4421). CI pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
…es a wave-uniform VGPR A v_readfirstlane_b32 / v_readlane_b32 of a VGPR that a buffer_load loaded was tier C (cross-lane, tainted-branch) even when every lane loaded the same word, because only VALU results of scalars entered the uniform set st["u"]. Analysis.uniform_load puts the destination of a load into st["u"] when all of these hold: - a MUBUF buffer_load_* with idxen (idxen ignores ADD_TID_ENABLE; without idxen a run-time V# can add the lane number), not a d16 form; - EXEC is the launch mask; - the index and offset VGPRs are uniform, the descriptor and soffset are untainted scalars; - the shader has no store and no atomic (the two halves read the word one after the other). tests/semantic/test_wave64_uniform_load.py runs each hand-written vertex shader on spirv_wave_interp.py (with its memory) as one 64-lane wave and as two 32-lane waves: 5 accepted shapes are tier B and equal, 5 near misses are tier C and differ, 2 are classification only. spirv_wave_interp.py: the PhysicalStorageBuffer branch of OpLoad was inside OpAccessChain, behind a return, so a load through such a pointer raised IndexError. It is moved to OpLoad (MemoryLoad, 3 tests). The near miss with an index written in part (SDWA UNUSED_PRESERVE) relies on the partial-write rule that main has since ItsNotRexed#4138. No game data. The corpus effect is not measured. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
58b68a9 to
ddc4fe3
Compare
|
Tested ddc4fe3 on Steam Deck LCD (Jupiter), AMD Custom GPU 0405 "Van Gogh", RADV Mesa 26.2.0-devel (git-5c65d4fc31), Vulkan 1.4.350, SteamOS 3.9.5 (holo), kernel 7.2.7-valve2-2-neptune-72-g31504582a073.
Tools/tests/docs changes only (wave64_halves/semantic tests); no runtime C++ changes. GPU suite not re-run. AI-assisted (OpenCode). |
|
Tested
No game files. AI-assisted (Claude Code). |
|
AI-assisted (Claude Code). No game files; CPU only (Windows 11, Python 3.14.7). Rebased on
|
|
Tested ddc4fe3 on AMD gfx1036 (26.11.2) and RTX 4070 Ti SUPER (621.14), Windows 11: pass.
Setup: Windows 11. GPUs are an AMD Ryzen 7 9800X3D iGPU (RDNA2 gfx1036, driver 26.11.2, subgroup 32..64) and an RTX 4070 Ti SUPER (NVIDIA 621.14, subgroup 32). Each PR was tested in its own worktree with:
Baseline is main
The NVIDIA failure is |
Claimed in the coordination issue as: new SHADER item (claim)
This pull request has one commit on
main561b65a8(headddc4fe32). It hadDepends on: #4373before, for the partial-write rule that the near misstest_c_index_written_in_partneeds.mainhas such a rule since #4138 was merged, so the commit of #4373 is no longer in this branch and the dependency is removed. The numbers in "Tested" are from the first headf99eb65f, except where a line says something different; my comment of the rebase has the runs at the new head.What and why
tools/wave64_halves.pyknows that a VGPR is the same in each lane only when a VALU instruction wrote it from immediates, scalars and other such VGPRs (st["u"]). A VGPR that abuffer_loadwrote is never in that set. Thus this code is tier C (cross-lane, ortainted-branchwhen the scalar goes to a branch), although each lane loads the same word:The research note for #94 names this as a probable cause of many tier C shaders (not measured).
The rule.
Analysis.uniform_loadputs the destination of a load intost["u"]when all of these conditions are true:buffer_load_*withidxen, and not ad16form (those keep half of the destination).st["f"]), so each lane that the program runs does the load.st["u"]. The descriptor andsoffsetare scalars that are not a lane mask. No operand has a taint bit.MEM_WRITES).After that, the rules that are already there do the work:
v_readfirstlane_b32andv_readlane_b32of the VGPR are tier B (readfirstlane-uniform,readlane-uniform), and the translator makes av_readlane_b32of it read the lane's own copy.Why it is exact.
idxen: the "Swizzled buffer addressing" row ofdocs/design.md(measured on RDNA2) says thatidxenignores ADD_TID_ENABLE. Withoutidxen, a V# with ADD_TID_ENABLE adds the lane number to the index, and the V# is a run-time value. Thus a load withoutidxenis not accepted. The new test shows the two cases with one V#.Tested
Windows 11 Pro (10.0.26200), Python 3.14.7, CPU only. No GPU, no
llvm-mc, 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_uniform_load.py(12 tests). Each program is a hand-written vertex shader. It is translated and then run onspirv_wave_interp.pyas one 64-lane wave and as two 32-lane waves. The memory is a structured buffer of 16 records, record i = 1000 + i.v_readfirstlane_b32of a load at a constant indexv_readlane_b32at lanes 40 and 7 of a load at a scalar index (s4 = 5)idxenandoffen(index 3, offset 4, records of 8 bytes)cross-lanecross-lanecross-lanev_mov_b32_sdwa ... UNUSED_PRESERVE)cross-lanesoffsetiss_bcnt1_i32_b64of EXEClane-countbuffer_store_dwordor abuffer_atomic_addidxencross-lanelanein lanelane, and theidxenload with the same V# is tier B and equalNegative controls.
idxenpart of the last row.maind0835dd9(before wave64_halves: a vote on a wave-uniform compare is not a lane vote (new SHADER item) #4138 and wave64_halves: preserve destination taint on partial writes and reject asymmetric DPP row_mask #4373), 1 test fails: the index that is written in part is tier B, and the two runs differ.main561b65a8has the partial-write rule of wave64_halves: a vote on a wave-uniform compare is not a lane vote (new SHADER item) #4138, and all 12 tests pass on it with no other pull request.The wave interpreter.
maingot a memory forspirv_wave_interp.pyafter this pull request was opened (TEST-722), so this branch now uses that one and its first read-only memory is gone. One correction is necessary: onmainthe PhysicalStorageBuffer branch ofOpLoadis inOpAccessChain, behind areturn, so each load through such a pointer raisesIndexError. This branch moves it toOpLoad.tests/semantic/test_spirv_wave_interp.pyhas 3 new tests (MemoryLoad); 2 of them fail with the interpreter ofmain(21 tests, all pass here).Other runs.
tests/semantic/test_wave64_halves.py,test_wave64_halves_soundness.py,test_wave64_halves_partial_dst.pypython -I -m unittest discover -s tests/semantic47b43d81gives 7,469 tests with the same 7 failures and 3 errors on this machine, compared by test name:test_loop_ballot_barrier(5),test_cmp_class_f64(2),test_mutations(2),test_vcmp16_opsel(1). None of them is in a file that this pull request changespytestontests/test_wave64_halves_fixtures.py,test_w64_graphics_args.py,test_w64_graphics_reference.py,test_wave64_graphics_scan.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 make_game.py tools tests,git diff --check,scripts/check_no_game_data.pyThe 9 more listings: an index from an SGPR that is set in a skip region (tier C, different); a descriptor word from
v_readfirstlane_b32of a varying value (tier C, different); a load whose destination is its index register (tier B, equal); a load in a loop with a scalar trip count (tier B, equal);v_readfirstlane_b32of the loaded VGPR under a narrowed EXEC (tier B, equal, as for a VGPR written from a scalar). One listing is tier B and the two runs differ: the load is in the run side of an EXEC vote that restores the launch mask before the join. That is the defect that #4541 corrects; the same listing withv_mov_b32_e32 v4, s4in the place of the load is tier B onmainand differs also. In a local merge of this branch with #4541, the two listings are tier Cunconfined-vote-sideand all tests of the two pull requests pass.Effect on the emitted SPIR-V. The rule changes the tier metadata, and it adds instructions to the set whose
v_readlane_b32reads the lane's own copy (the rewrite that thereadlane-uniformidiom already uses). No other emitted code changes.Not measured: the corpus
I have no copy of the game, so I cannot say how many shaders this rule moves from tier C. If you have your own copy, please run the census before and after, counts only:
on an index translated at
main561b65a8and on one translated with this branch. The numbers of interest are tier A/B/C for each stage, the reasonscross-lane,tainted-branch,tainted-execandwaterfall-scalar, and the idiom tagsreadfirstlane-uniformandreadlane-uniform. A shader that has other reasons too stays tier C, so the reason counts can move more than the tiers.Limits
buffer_load_*withidxen.tbuffer_load_format_*,global_load_*and the image loads with an explicit level are possible later, each with its own test.idxen(a raw buffer) stays out because of ADD_TID_ENABLE. If the census shows that such loads are frequent, that needs a decision about run-time V#s.st["ua"]) is the work for values that are uniform in the lanes that are on.Overlap
st["u"]for its uniform compares: a loaded value that goes to a uniform compare and ans_cbranch_vcczif/else is tier A and the two runs are equal.operands()for partial writes. This pull request does not need it any more.tools/wave64_halves.py. The SHADER-10 row is one line ofdocs/design.md, so each of these pull requests conflicts there with the others.Checklist
docs/design.md, with how it was confirmed.AI-assisted (Claude Code): it wrote the change and ran all the checks above on this machine.
🤖 Generated with Claude Code