mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:50:51 +01:00
[PR #1445] tools: read each shader's root-layout and used-resource tables from its FSSM record, with a census (FSSM-ROOT-LAYOUT-TABLES) #1476
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#1476
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/1445
Author: @QemmHD
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:claude/fssm-root-layout-tables📝 Commits (1)
62137d4tools: fssm_root_layout reads each program's root-layout and used-resource tables, with a census (FSSM-ROOT-LAYOUT-TABLES)📊 Changes
6 files changed (+1347 additions, -2 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+72 -1)📝
docs/fssm_crosscheck.md(+6 -1)➕
tests/test_fssm_root_layout.py(+652 -0)📝
tests/test_missing_input_exit_codes.py(+2 -0)➕
tools/fssm_root_layout.py(+293 -0)➕
tools/root_layout_census.py(+322 -0)📄 Description
Claimed in the coordination issue as: FSSM-ROOT-LAYOUT-TABLES (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7147663051)
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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.