Repository navigation
Conversation
|
Tested
No game files. AI-assisted (Devin). |
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 09f87b921 on Windows 11: tests/semantic/test_wave64_halves_why.py -> 12 tests, OK; test_wave64_halves.py -> 101 tests, OK; test_docs_table_rows.py 2 OK; git diff --check clean.
wave64_halves --census --why now reports where each tier-C reason comes from, with the --why counts tested against the analysis and the docs row corrected (no stray vertical bar). The new 287-line test covers the census totals and the reason breakdown. No blocking issue.
|
Tested 09f87b9 merged with main 98fa503 on Linux (Python 3.12.16): pass - test_wave64_halves_why.py 12 OK; all tests/semantic/test_wave64*.py 210 OK; tests/test_docs_*.py all OK; negative control: tools/wave64_halves.py and tools/rdna2spirv.py from main, new test kept: FAILED (failures=1, errors=11) of 12. |
|
Full 1.0.2.1 corpus census at For the author’s
The source and producer EXEC tags agree in every one of those 532 rows. These counts describe the first diagnostic; a shader can have additional blockers, so estimating how many tiers move still takes a rule-specific before/after comparison. Stage totals, top first-reason rows, and producer/source counts
First reason per tier-C shader, 20 most frequent combinations:
First reason by reason (top 20): First reason by producer (top 20): First reason by source (top 20): Reproduction: verified the input shader archive against the repository manifest, disassembled for gfx1013 with LLVM 23.1.5, and ran Flag-off control on the same revision: |
|
AI-assisted (Claude Code). No game files; hand-written listings; CPU wave interpreter only (Windows 11, Python 3.14.7). @Kev-Ball thank you, the counts are what this option was made for. I read the largest rows and made hand-written listings that give the same lines. 1. The largest group has one cause: a mask destination that the listing prints as one SGPR (#2231). Rows such as
In your table "first reason by source", the sources that mix 2. A smaller part stays after #2231, in 3. The 4. Not explained yet: Request. If you can, please run the tier census (and |
|
Corpus run: partly blocked, and what I could measure. My own 1.0.2.1 copy, counts only, no shader names or code. Corpus shape ( The population this census needs (
So 13,405 wave64 VS/PS/GS, of which 9,440 carry at least one candidate cross-half opcode. Your index's 9,287 tier C is consistent with that (the tier analysis then clears the tier A/B ones), which is the first independent confirmation of the count the #3570 census reports. The translation needs LLVM 18 or newer: That is the
Tests on the head, as a code read: AI-assisted. |
|
Verified at this head: compileall clean; the wave64_halves why/soundness/regular semantic suites pass under python -I, the fixtures pytest file 9/9, the translator-use guard passes, and the docs guards confirm --census --why and --wave64-why are implemented as documented. One note for reviewers: this is not the docs one-liner the title suggests — it adds the second-pass WhyAnalysis to wave64_halves/rdna2spirv plus a new semantic test; the design.md row requirement is satisfied. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
|
Follow-up on the blocked corpus run, so the next volunteer does not repeat the dead ends. The Python backend avoids the LLVM-15 encoding refusal, but its listing names do not match the carve names. So there are two working routes to the census: LLVM 18+ (CI's toolchain, the straightforward one), or the Python backend plus those 857 symlinks. The population counts in my previous comment do not depend on that route. |
|
AI-assisted (Claude Code). No game files; synthetic names and blobs only (Windows 11, Python 3.14.7). @mewajda thank you for the two reports. 1. LLVM version. The description now has a "Toolchain" paragraph: the translation needs the 2. The
So on |
|
Correction and a dead end, so nobody spends time on it: the Python-backend route does not resolve with the name symlinks I described. Creating Use LLVM 18 or newer and the normal |
|
Tested
Not tested: AI-assisted (Claude Code). |
|
One robustness note on I am fixing it as a second commit on #4892 ( |
|
Corpus census with Tiers (13,405 wave64 VS/PS/GS, which is the same total
Reasons: First reason of a shader (top 15, the table the issue asks for): Margins (what would move the most shaders): What the numbers say about the #94 hypothesis. "Most of tier C is compiler code for values that are the same in each lane" holds for the scalar-value half: For the rules named in the issue: the EXEC family ( Full command output available on request; nothing here names a shader. |
|
Tested
|
Tier C has about 3 reasons per shader, and a reason name does not say which missing rule is behind it.
analyse(..., why=True) now gives, for a tier C program, one line per reason in program order:
reason|sink|producer@exec|source@exec|source of the source
with instruction families only: the instruction where the reason was found, the first instruction that
made the value depend on the partition, the instructions that wrote the producer's operands and the ones
that wrote the operands of those, and if EXEC was the launch mask at the producer and at the source writes.
- WhyAnalysis is a subclass of Analysis that wraps entry, block, join and step with two side tables. It
runs as a second pass for tier C programs only, and its result is dropped if it fails or finds other
reasons, so it cannot change a tier.
- rdna2spirv.py --wave64-why writes the lines to the index as wave64_graphics_why. Without the option the
index and the translation time are as before. The emitted SPIR-V is the same in the two cases.
- wave64_halves.py --census <index> --why [--top N] prints the counts: the first reason of each shader,
its marginals by sink, producer and source, and the first site of each reason. No names, no code.
tests/semantic/test_wave64_halves_why.py: 14 hand-written tier C listings with the lines derived by hand.
No game data. Not run on the corpus.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
09f87b9 to
9295fa2
Compare
|
Tested 9295fa2 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 (wave64_halves/rdna2spirv helpers); no runtime C++ changes. GPU suite not re-run. AI-assisted (OpenCode). |
|
AI-assisted (Claude Code). No game files; CPU only (Windows 11, Python 3.14.7). Rebased on
|
|
AI-assisted (Claude Code). No game files; hand-written listings. The description said that the command line of
|
|
Tested 9295fa2 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)
Depends on: none. It builds on no open pull request. The text conflicts with other open pull requests are in "Overlap".
What and why
The census of the wave64 graphics tiers (#3570) has 9,287 tier C shaders and about 30,000 reason entries. A reason name such as
cross-laneorunsafe-vote-branchdoes not say which rule is missing. The research note for #94 thinks that most of tier C is compiler code for values that are the same in each lane, but that is not measured. This pull request adds the measurement. It changes no tier and no emitted SPIR-V.1.
tools/rdna2spirv.py --wave64-why(off by default). For each tier C wave64 VS/PS/GS, the index getswave64_graphics_why: one line for each reason, in program order.sinkexport,store,vcc_branch,exec_write, ...)producerv_readfirstlane,s_bcnt,v_mbcnt, ...). For a reason that is about the instruction itself (a vote, a mask half), it is the sinksourcebuffer_load,image,v_interp,valu,salu,s_load,v_cmp,input,const, ...)source of the source@launch,@narrowed,@bothA line has instruction families only: no register number, no constant, no offset, no shader name. Examples from the hand-written tests:
The first line is the case of #4630 (a scalar read from a loaded VGPR). The second is the case of #2469 (a uniform value under a narrowed EXEC). The third is a vote on an interpolated value, which no rule can accept. The last is the
breakloop mask of my finding in #4571.2.
tools/wave64_halves.py --census <index.json> --why [--top N]prints counts only:Without
--whythe census prints what it printed before.How it is made.
WhyAnalysisis a subclass ofAnalysis. It wrapsentry,block,joinandstepand adds two tables to the state: the origin of the taint of each register, and the families that wrote each register. The base class makes all decisions.analyse(..., why=True)runs it as a second pass for a tier C program only, and drops its result if it fails or does not find the same reasons. No line of the existing analysis changes, so the open pull requests ontools/wave64_halves.pyconflict with this one only where they also changeanalyse().Tested
The numbers below are from the head
09f87b92(withmain2d3369a4merged in). The branch is now one commit onmain561b65a8(head9295fa29); my comment of the rebase has the runs at that head. One test listing changed in the rebase: the vote on a compare of a scalar copy is tier A onmainsince #4138, so the listing now compares the low bit of the vertex number. 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.tests/semantic/test_wave64_halves_why.py(12 tests)tests/semantic/test_wave64_halves.py,test_wave64_halves_soundness.pypython -I -m unittest discover -s tests/semanticmain), 3 failures and 3 errors.main2d3369a4gives 6,245 tests with the same 3 failures and 3 errors on this machine, compared by test name:test_loop_ballot_barrier(5) andtest_vcmp16_opsel(1). None of them is in a file that this pull request changespytestontests/test_wave64_halves_fixtures.py,test_shader_index.py,test_fssm_wave_size.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.pyWhat the new tests check, all on hand-written listings:
v_readfirstlane_b32of a loaded VGPR into an export and into a scalar branch; the same under a narrowed EXEC; a vote on a compare of a VALU result and of an interpolated value; lane id; lane count;v_readlane_b32;v_writelane_b32; a mask half; code on the EXEC-zero side; a stale SGPR; thebreakloop mask;s_ff1_i32_b64.--wave64-why, the index entry of each listing has no new key and is equal to the entry with the option minus that key, and the translator callsanalyse()withwhy=False.One more check that is not in the tests: for the 372 analyses that
test_wave64_halves.py,test_wave64_halves_soundness.pyand the new file make, the second pass gave the same violations, idioms andv_readlane_b32rewrite set as the first pass, and each of the 290 tier C analyses gave lines.Cost. On a hand-written tier C listing of 2,402 instructions,
analyse()took 109 ms and 276 ms withwhy=True; the full translation of that listing without the option took 0.22 s. This is why the option is off by default.Not tested. The command line of
rdna2spirv.pywith--wave64-whyfrom start to end: the translator needs SPIRV-Tools to write an index, and this machine has none. The tests set the option in the module and check that--helphas it.Request: please run it on the corpus
I have no copy of the game. If you have your own copy, please translate the wave64 VS/PS/GS with the option and post the counts (the output has no shader name and no code):
Toolchain. The translation needs the
llvm-mcthat the README asks for: LLVM 21 or newer with the AMDGPU target (CI installs LLVM 21; the corpus run in this thread used 23.1.5). With LLVM 15 each listing is refused by the encoding check ofrdna2spirv.py(same_encoding: the old disassembler prints theop_selfield of a gfx1013 VOPC instruction as 0), so the index stays empty and there are no lines to count (reported bymewajdabelow). I did not test LLVM 16 to 20.shader_disasm.py --backend pythonneeds no LLVM for the listings.The most useful parts are the table "first reason of a shader" and the lines "first reason by producer" and "first reason by source". They show, for example, how many tier C shaders start with a
v_readfirstlaneof abuffer_load, of animageload or of avaluresult, and if EXEC was the launch mask there. That says which of #4630, #2469, #4138 and the rules that are not written yet moves the most shaders.Limits
valuandsaluare all other vector and scalar instructions.Overlap
tools/wave64_halves.py. This pull request adds code after theAnalysisclass and replaces the body ofanalyse(); a pull request that also changesanalyse()needs a small merge there.docs/design.md, so this pull request conflicts there with each of the others.Checklist
docs/design.md, with how it was confirmed. (No new rule; the row describes the option and the census.)AI-assisted: yes (Claude Code). It wrote the change and ran all the checks above on this machine.
🤖 Generated with Claude Code