Repository navigation
d3d12_vulkan.md: the graphics stages' user-SGPR count, from FSSM u32[0xD4] bits 20:16 (whole corpus) - #5224
d3d12_vulkan.md: the graphics stages' user-SGPR count, from FSSM u32[0xD4] bits 20:16 (whole corpus)#5224throny wants to merge 1 commit into
Conversation
…0xD4] bits 20:16 (whole corpus) The field equals COMPUTE_PGM_RSRC2 USER_SGPR in all 2,689 compute blobs and is 8-20 in VS/PS, 13-17 in MS/GS. No pointer read lies past it (+8 for MS/GS) in any of the 26,503 shaders. fssm_header.user_sgpr_count() reads it; the CLI prints it per stage with the compute check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 06634796e on Windows 11: pytest tests/test_fssm_header.py -q -> 48 passed, 6 subtests passed; test_docs_table_rows.py 2 OK; git diff --check clean.
fssm_header now decodes the graphics stages' user-SGPR count from u32[0xD4] bits 20:16, and the D3D12-on-Vulkan doc states the whole-corpus count; the added cases cover the field next to the existing wave-size bit. I cannot recount the corpus here; the synthetic test and docs validate. No blocking issue.
|
Tested
|
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted independent CPU recount at 0663479. Across all 23,814 cached graphics listings, the field was 8–20 in VS/PS and 13–17 in MS/GS. Resolved descriptor bases fit the proposed windows. In MS the trace found 6,308 texture and 4,536 buffer load sites through s23, but zero dynamic 32-bit loads with a sampler consumer. Please qualify the MS s24 sampler assignment as inferred. The CS field matched USER_SGPR in 2,689/2,689 sidecars; the independent CS descriptor trace reconstructed 2,676 of those listings. Static counts support register bounds but cannot establish hardware assignment.
shayderrr
left a comment
There was a problem hiding this comment.
Review
Reviewed change in PR #5224: d3d12_vulkan.md: the graphics stages' user-SGPR count, from FSSM u32[0xD4] bits 20:16 (whole corpus).
Scope: docs/d3d12_vulkan.md, tests/test_fssm_header.py, tools/fssm_header.py
Diff: +113 / -5 across 3 file(s).
The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.
Reviewed by shayderrr via automated batch review.
Claim: #5156 (comment) (no item ID assigned yet).
Related: the graphics root-argument layout proposal on #313 (D3D-448 follow-up) and #4312, which use the compute
USER_SGPRcount; this gives the same count for VS/PS/GS/MS.What the doc said
docs/d3d12_vulkan.md§3.4 (lines 1348-1351): "For VS, PS, MS and GS no user-SGPR count is measured; every base lies belows32… the user count of the graphics stages … is what would confirm it." §3.5 (line 1594): "belows32for the graphics stages, whose user count is not measured yet".What was measured (all 26,503 FSSM blobs of 1.0.2.1)
u32[0xD4](bit 5 = wave size, already used) holds the user-SGPR count in bits 20:16. In 2,689/2,689 compute blobs it equalsCOMPUTE_PGM_RSRC2USER_SGPR(u32[0x138]bits 5:1).user_sgpr_readsinspirv/index.json(all 26,503): no pointer read (ptr32_lo,ptr64_lo/hi,vsharp,tsharp) lies at or past the count in CS/VS/PS, or past count + 8 in MS/GS. So the heap bases of D3D-329 are user data in every stage. Reads past those bounds are allconst32: 4 VS, 129 PS (besidess[count]), 10 MS.s[count]asconst32in 10,277 of 12,101; 10,267 of those have an FSSM interpolant table (40 PS with a table don't read it, 10 without one do). Consistent withPRIM_MASKfollowing the user SGPRs. MS/GS read up to count + 7, consistent with user data starting ats8in the merged stages. Both are labelled hypotheses in the doc.Method and limits
os.listdir(26,503, matchesindex.json; 0 missing inspirv/index.json).user_sgpr_readscomes from a linear read-before-write scan: it says nothing about values a loop carries. ThePRIM_MASKands8-base readings are inferred from counts, not from a driver or the executable.spirv/index.json(counts only, not committed).Changes
docs/d3d12_vulkan.md: §3.4 paragraph and the §3.5 "Direct heap indexing" item updated with the counts and the command.tools/fssm_header.py:user_sgpr_count()(bits 20:16 ofu32[0xD4]) andcompute_rsrc2_user_sgprs(); per-fileuser_sgprs=, auser SGPRs <stage>histogram per stage, andCS user SGPRs equal COMPUTE_PGM_RSRC2 USER_SGPR in N/M. Docstring updated.tests/test_fssm_header.py: 6 tests on synthetic headers, including a lookalike word with only the neighbouring bits set (wave32 bit, bits 0, 2, 21-23, 26), which reads as 0.Run
python -I tools/fssm_header.py <work>/shaders/dxbc/fssm→CS user SGPRs equal COMPUTE_PGM_RSRC2 USER_SGPR in 2689/2689and the per-stage lines above.python -m compileall -q make_game.py tools tests;tests/test_fssm_header.py(48 OK),test_fssm_crosscheck.py,test_fssm_wave_size.py, alltests/test_docs_*.py,tests/test_text_write_line_endings.py,scripts/check_no_game_data.py: pass. (tests/test_user_sgpr_census.pyneeds pytest, not installed here; that file is unchanged.)AI-assisted (Claude Code). No GPU needed. Counts only; no shader names or content.
🤖 Generated with Claude Code