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 2 commits 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.
|
Thanks @kacper-serewis. Your recount matches (8–20 VS/PS, 13–17 MS/GS, 2,689/2,689 CS). The |
… through them are all static) heap_index_census over all 26,503 listings: S# loads through s11 (CS), s24 (MS) and s16 (PS) all have static offsets; dynamic-offset S# loads appear only in the 1,043 sampler-only PS (s11, s10). Review on ProjectLeonida#5224. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Agreed, and fixed in d813549.
§3.4 now marks the sampler-heap base inferred for all three stages, with these counts. The resource-heap bases ( |
|
Re-checked
Tests. I did not redo the read-bound comparison against AI-assisted (Claude Code). |
|
Tested d813549 merged with main 00f5ce6 on Linux (WSL2), CPython 3.12.16, CPU only: pass. The merge of docs/d3d12_vulkan.md was automatic; python -I tests/test_fssm_header.py ran 48 tests, OK. Negative control: with tools/fssm_header.py reverted to main's version the same test file fails (6 errors), and passes again once restored. |
|
Tested
I didn't re-run the read-bound comparison against |
…otRexed#5092 ItsNotRexed#5232 ItsNotRexed#5263 ItsNotRexed#5408 ItsNotRexed#5410 ItsNotRexed#5411 ItsNotRexed#5418 ItsNotRexed#5423 ItsNotRexed#5434 ItsNotRexed#5437 ItsNotRexed#5446 ItsNotRexed#5458 ItsNotRexed#5461 ItsNotRexed#5465 ItsNotRexed#5473 ItsNotRexed#5486 ItsNotRexed#5495 ItsNotRexed#5562 ItsNotRexed#5594 ItsNotRexed#5619 ItsNotRexed#5644 ItsNotRexed#8919 fork integration. Each parent after the first is an exact reviewed PR head. ItsNotRexed#5224 d813549 ItsNotRexed#5224 (comment) ItsNotRexed#5336 d0e66fa ItsNotRexed#5336 (comment) ItsNotRexed#5092 36be9f5 ItsNotRexed#5092 (comment) ItsNotRexed#5232 2d9649a ItsNotRexed#5232 (comment) ItsNotRexed#5263 9cabfcf ItsNotRexed#5263 (comment) ItsNotRexed#5408 133f7ef ItsNotRexed#5408 (comment) ItsNotRexed#5410 08faade ItsNotRexed#5410 (comment) ItsNotRexed#5411 dd278f5 ItsNotRexed#5411 (comment) ItsNotRexed#5418 605dbc4 ItsNotRexed#5418 (comment) ItsNotRexed#5423 1775bf6 ItsNotRexed#5423 (comment) ItsNotRexed#5434 4c399d8 ItsNotRexed#5434 (comment) ItsNotRexed#5437 ab12086 ItsNotRexed#5437 (comment) ItsNotRexed#5446 eb9a54c ItsNotRexed#5446 (comment) ItsNotRexed#5458 4444f0d ItsNotRexed#5458 (comment) ItsNotRexed#5461 d6a973a ItsNotRexed#5461 (comment) ItsNotRexed#5465 2107ca9 ItsNotRexed#5465 (comment) ItsNotRexed#5473 aaf5bd2 ItsNotRexed#5473 (comment) ItsNotRexed#5486 6d3a621 ItsNotRexed#5486 (comment) ItsNotRexed#5495 eb7dd0c ItsNotRexed#5495 (comment) ItsNotRexed#5562 5c450f5 ItsNotRexed#5562 (comment) ItsNotRexed#5594 560bf65 ItsNotRexed#5594 (comment) ItsNotRexed#5619 b782d57 ItsNotRexed#5619 (comment) ItsNotRexed#5644 9984867 ItsNotRexed#5644 (comment) AI-assisted integration.
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