Repository navigation
Conversation
…ource tables, with a census (FSSM-ROOT-LAYOUT-TABLES) docs/d3d12_vulkan.md section 3.5 infers where root arguments arrive from the user SGPRs the shaders read and calls the graphics bases (s8 for VS/PS/GS, s16 for mesh) a hypothesis: the SGPR census cannot see root-parameter indices or a spill. Each native program's FSSM record names two tables that state it directly: a root-layout table (root type, user-data dwords, first user-data dword and root parameter index per parameter) and a used-resource table. The record layout is the one VIctory reads (Marvisak/VIctory, GPL-3.0, crates/victory-shader/src/native.rs). The parser is written for this repository from that layout and contains no VIctory code. tools/fssm_root_layout.py is a new module on its own. root_tables(fssm) returns the programs of one blob with both tables. It raises FssmLayoutError (a ValueError) for a header that is not version 0x101 with a matching payload size, a record or code range outside the payload, records that overlap each other or the slot table, and a table that runs past the payload or overlaps a record, its program's code or the program's other table. Unnamed types and non-zero reserved fields are kept so they can be counted. Its command line prints the tables of a file or a folder as JSON, or writes them with --out, one file in memory at a time. tools/root_layout_census.py reads the user's own .fssm blobs or carved containers and prints counts per hardware stage: the lowest SGPR a parameter arrives in, the dwords each root type takes, root types and used-resource kinds, compute programs with a spilled parameter and the first spilled dword, and how many programs agree with the section 3.5 hypothesis, with the reasons for the rest. It also counts what would show the reading to be wrong (unread blobs by reason, record offsets, reserved fields, unnamed types). With no input it says so. No retranslation: tools/fssm_unpack.py and every other file in make_game's TRANSLATION_SOURCES are untouched, and neither new file is imported by the translator or make_game.py, so a translated shader library stays valid. A test holds the two new names out of make_game.py, translator_deps.cmake, fssm_unpack.py, rdna2spirv.py and shader_meta.py. Nothing here was run on real shader data. Which fields are VIctory's reading and which this corpus's earlier measurements already support (the two table offsets are the header's `code_end` and `meta_ptr`) is in section 3.5, with the commands and the open questions. The runtime does not use the tables yet. Tested: tests/test_fssm_root_layout.py (32 tests: hand-built records with constants, a root descriptor, tables, an immediate sampler, a heap and a spilled compute layout; truncated, overlapping and overflowing tables; every prefix and 4,000 seeded corruptions of a three-program blob; both command lines) and the fssm_unpack, pal_stages, fssm_header, fssm_crosscheck, missing-input, line-ending and CI-registration tests pass. The repository-consistency set gives 578 passed, 5 skipped. No game files. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: FSSM-ROOT-LAYOUT-TABLES (#14 (comment))
What and why
docs/d3d12_vulkan.md§3.5 works out where root arguments arrive from the user SGPRs the shaders read, and it calls the graphics bases (s8 for VS/PS/GS, s16 for mesh) a hypothesis: that census can't see root-parameter indices or a spill. Each native program's FSSM record names two tables that state the layout directly: a root-layout table and a used-resource table. This PR reads them.tools/fssm_root_layout.py(new):root_tables(fssm)returns each program's two tables. It raisesFssmLayoutErrorfor a bad header, a record or code range outside the payload, overlapping records, or a table that runs past the payload or overlaps a record, the code or the other table. Its command line prints the tables of a file or folder as JSON, or writes them with--out.tools/root_layout_census.py <your work folder>(new): prints counts per hardware stage. That covers the lowest SGPR a parameter arrives in, dwords per root type, the root types used, the compute spill start, and how many programs agree with the §3.5 hypothesis, with reasons for the rest. It also counts anything that would show the reading to be wrong. With no input, it says so.The record layout follows VIctory's reading (Marvisak/VIctory, GPL-3.0,
crates/victory-shader/src/native.rs). The parser was written for this repository from that layout, and no VIctory code is copied. §3.5 says field by field which parts are VIctory's reading and which this corpus's earlier measurements already support: the two table offsets line up with the header'scode_end/meta_ptrwords fromdocs/fssm_crosscheck.md.No retranslation is needed.
tools/fssm_unpack.pyand every other file inmake_game.py'sTRANSLATION_SOURCESare untouched, and neither new file is imported by the translator ormake_game.py, so an already translated shader library stays valid. As with any new file undertools/, an interrupted--jobstranslation restarts its shard parts.Nothing here was run on real shader data. The offsets need a census on a real library to confirm; the open questions are listed in §3.5. The runtime doesn't use the tables yet. Wiring them into
rt::rootsig::pack_stageis a follow-up, and it complements #974 and #1009 by giving them a measured layout.Tested
python -I tests/test_fssm_root_layout.py: 32 tests on hand-built records. They cover constants, a root descriptor, tables, an immediate sampler, a heap and a spilled compute layout; truncated, overlapping and overflowing tables; every prefix and 4,000 seeded corruptions; both command lines; and a check that the two tools stay out of the translation inputs. Seven hand mutations of the bounds checks each make it fail.python -m compileall -q tools scripts make_game.py, andscripts/check_no_game_data.pyon the changed files.GPUs tested: n/a (tooling; no GPU)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly.docs/design.md, with how it was confirmed. (n/a: no translator rule)AI-assisted (Claude Code, Claude Opus 5.5).
🤖 Generated with Claude Code
https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf