mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #2231] tools: chain_check.py, one page of counts for the whole shader chain (TOOL-CHAIN-CHECK) #2234
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2234
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2231
Author: @MoonEyes
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:tools/chain-check📝 Commits (4)
d41d6a1tools: chain_check.py, one page of counts for the whole shader chain (TOOL-CHAIN-CHECK)044e271chain_check: close the free-text filters and pin the runtime lines it readsa6ec8f3chain_check: pin an unknown interface, a non-builtin exception and the slot-57 line1b1fb2dMerge remote-tracking branch 'origin/main' into tools/chain-check📊 Changes
3 files changed (+1213 additions, -0 deletions)
View changed files
📝
docs/dev-tools.md(+33 -0)➕
tests/test_chain_check.py(+405 -0)➕
tools/chain_check.py(+775 -0)📄 Description
Claimed in the coordination issue as: TOOL-CHAIN-CHECK
What and why
The shader chain (game files → llvm-mc → translator → SPIR-V → runtime pipelines) fails quietly link by link. On one Windows machine, llvm-mc 21.1.8 left 840 of the 2,684 compute programs of the pipeline library untranslated (839 "fall-through into undecodable words", 1
s_sethalt; #1923 measures the same gap). At boot the runtime then logged 843slot 67 ... failed with 0x80070057lines. Today nothing connects those two counts: the build prints no "N of M" for the library, andboot.ps1's digest shows neither slot failures nor failedCreatePipelineStatecalls.tools/chain_check.pyprints one page with one block per link, each with OK / WARN / FAIL and its most likely cause, then the weakest link:disasm.done,<family>_build.json) and its AMDGPU target, spirv-val, and the recorded translator digest against the same digest recomputed frommake_game.py'sTRANSLATION_SOURCES(a test pins it equal totranslation_sources_digest());invalid_words), translated (index entries with their.spv), up to 5 refusal reasons fromlogs/shaders.log;fspx_compute...);--log: modules loaded, failed slot calls by slot and HRESULT, failed D3D12 calls, compute builds, compile-gate waits, device faults, exit code.Counts and fixed words only. A refusal reason is printed only when it matches a message
rdna2spirv.pyraises (read from its source), with a variable part kept only when it is a mnemonic oftools/rdna2_isa_tables.pyor a built-in exception name; everything else counts asother. A D3D12 method name from a trace is printed only when it is a string literal of the runtime's sources (orInterface::Methodwith such an interface), and the end of a boot digest only in the three formsboot.ps1writes. Paths appear only with--show-paths. Standard library only. It reads files; probing runs onlyllvm-mc --version,spirv-val --versionandgit rev-parse(--no-proberuns nothing). Exit 0 (a report), 1 with--stricton FAIL, 2 for bad arguments. Documented indocs/dev-tools.md.Not done here (possible follow-up, separate PR): making
make_game.pyprint "N of M translated" for the library and FSPX and warn on llvm-mc older than 23, and adding the slot failures, failedCreatePipelineStatecalls and tagged/plain count toscripts/windows-boot/boot.ps1's digest. The tool reports; it does not fix, retranslate or change any threshold of the build.Sample report (real work folder after a full build with llvm-mc 21.1.8, and one 783 s boot; work folder path removed):
(abridged: the cause lines of the tools, game, fspx, bvh, exe, contract and runtime blocks and the fspx reasons line are left out, and the bvh/exe count lines are shortened)
Tested
python -I tests/test_chain_check.py: 23 tests OK (synthetic work folders built by the test: broken and clean chains, mixed llvm-mc versions, refusal reasons and trace method names closed to what the sources contain, an index entry without its.spvis not counted, the 1% threshold on both sides, no names/paths without--show-paths, empty and partial folders give n/a or a verdict,--strict,--helpthresholds, digest equal tomake_game.translation_sources_digest(), UTF-16 log with and without BOM). One test reads the runtime sources andboot.ps1and checks the 21 format-string fragments the log patterns depend on, so a reworded log line fails the test instead of silently reporting zero.tests/test_runner_calls_all_tests.py3 OK,tests/test_ci_registration.py16 OK, all 13tests/test_docs_*.pyOK.python -I scripts/check_no_game_data.py tools/chain_check.py tests/test_chain_check.py docs/dev-tools.md: exit 0;git diff --check origin/main..HEADclean.GPUs tested: n/a for the tool; the sample report comes from an NVIDIA RTX 4060, driver 610.88
AI-assisted: yes (Claude Code, Claude Opus 5.5, wrote the tool and its test; a second agent reviewed it)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.