Repository navigation
D3D-318: user_sgpr_census --pairs — VS/PS of one technique read shared root SGPRs alike (one block in root order) - #2720
Conversation
|
Tested on Linux (WSL2 Ubuntu), Python 3.10.12, CPU only: pass. With upstream/main merged (clean), tests/test_user_sgpr_census.py runs 14 tests, all pass. Note it imports pytest and uses |
…Rs alike (D3D-318) docs/d3d12_vulkan.md left root-parameter visibility open: one block in root order (the layer's model) or the console omitting a stage's invisible parameters, which would put different parameters at the same SGPR in a VS and a PS. The game's shaders carry no RTS0 and the executable that pairs them into pipelines is not in the package, so --pairs pairs a VS with a PS by technique name (names alike apart from the VS_/PS_ token) and compares the user SGPRs both read, with all VS x PS combinations as a control. On the 1.0.2.1 corpus: 166 techniques have both stages, 358 combinations. All 379 shared reads have the same kind (pointer or constant), against 25.5% different over all 26,196,976 combinations; and all 111 shared reads above an SGPR only one stage reads still agree, where omission would have moved them. The doc records the counts and the limits: names approximate the pipelines, and a visible parameter a stage doesn't read looks like a hidden one. The tests build both models from one root signature and check that they give different counts. Names are used for pairing only, never printed. AI-assisted.
46e2e4f to
d6fe527
Compare
|
Rebased on
Rerun on my work folder, same numbers as before: 379/379 shared reads agree; control 25.5% different. AI-assisted. |
|
@kapitche thanks for the run and the negative control. On pytest: CI handles such files on purpose. The standard-library step skips files that match (Your 14 was the pre-rebase count. After the rebase onto AI-assisted. |
D3D-318 (claim). It covers the VS/PS half; @Ayinaki's compute census of the 29
RTS0signatures (claim) is separate.What
docs/d3d12_vulkan.md("Shader visibility") left one question open: does the console keep one block in root order (the layer's model), or omit the parameters a stage can't see? Omission would put different parameters at the same SGPR in a VS and a PS. The game's shaders carry noRTS0, and the executable that pairs them into pipelines isn't in the package. So:tools/user_sgpr_census.py --pairs: pairs a VS with a PS by technique name. The names must be alike apart from theVS_/PS_token, after the one-character prefix and without the 8-digit hash and_Wrapped.user_sgpr_reads, SGPR number and pointer/constant kind.docs/d3d12_vulkan.md: the measurement and its limits, in the "Shader visibility" item.tests/test_user_sgpr_census.py: five new tests. Two build both models from one root signature (a pixel-only parameter between shared ones) and check that one block agrees and omission doesn't. The others cover name parsing, unpaired shaders feeding only the control, and the CLI report without names.Measured (my own 1.0.2.1 copy, counts only)
At the control's rate about 97 of the 379 would differ, and about 28 of the 111. Neither has one. So the parameters both stages of a technique read sit at the same SGPRs, consistent with one block in root order.
What it can't show:
The executable's pipeline table would settle the rest.
Tests
python -m pytest tests/test_user_sgpr_census.py: 14 passed (9 existing, 5 new).test_docs_links,test_docs_list_itemsandtest_docs_repo_pathspass.compileallis clean.python -I, standard library only, in about 2 s over the 26,118-entry index, CPU only (Apple M4, macOS). Runtime and translator are untouched.No game files. AI-assisted.