Extend tools/user_sgpr_census.py technique regex to recognize mesh
shaders ("MS_"), support configurable stage pairs in pair_census()
(defaulting to "vs" and "ps"), and report MS/PS pairings when MS
shaders are present in index.json.
Add test coverage for mesh shader lowest-pointer census, --expect ms=16,
technique name parsing, and MS/PS pair census.
AI-assisted (Claude Code)
#6268 made same_report_path resolve each path once and call _resolved_key and
_same_resolved_name directly, so patching the public path_key and
same_name_on_folding_volume no longer reaches the code under test. The
folding-volume case then only passed on a case-insensitive volume: on Linux
the real key comparison and the real volume probe both say "different", the
tool writes the report and the test fails with DID NOT RAISE SystemExit.
Patch the private helpers, as test_report_paths.py and test_psin_names.py do.
Squash-merged after diff review of PR #6276 - user_sgpr_census: read the index as utf-8-sig, so a Windows BOM is not a JSON error (EGEN-SGPRCENSUS-BOM)
test_report_paths' macOS normcase fix landed on main as f7c7d57b; take main's
version of the file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A full run with the temp folder in a profile named in Cyrillic found:
- tools/hw_oracle/runner.py wrote build_hw_oracle.cmd with encoding
"ascii", so any non-ASCII path (the temp work folder, Visual Studio,
the source) raised UnicodeEncodeError before hw_oracle compiled
anything. Non-ASCII paths now go in as their 8.3 short names, the file
in the OEM code page cmd.exe reads it with (UTF-8 elsewhere). New check
in test_hw_oracle: a work folder named "Пользователь".
- test_spirv_metal_set0_extra: its subprocess stubs didn't take the
errors= argument this branch added to tools/spirv_metal_set0.py.
- test_user_sgpr_census, test_anim_index, test_awc_manifest,
test_gamedata_graph, test_manifest_verifier, test_world_build: they
decoded the Python child's output as UTF-8, but the tool writes in the
locale encoding (the ANSI code page on Windows), so a non-ASCII temp
path never matched; test_awc_manifest's reader thread died (no errors=).
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The census opened index.json and called .values()/.get() on whatever it
held, so a missing file, a folder, an empty or non-JSON file, a top-level
array, or an entry or read of the wrong type each ended in a traceback
(FileNotFoundError, JSONDecodeError, UnicodeDecodeError, AttributeError,
TypeError). A --json path in a missing folder did the same after the scan.
load_index() now reads and checks the index before the census runs, with
the wording tools/root_sig_contract.py already uses for the same file
(object of entries, each entry an object, user_sgpr_reads an array, each
read with 'sgpr' and a string 'kind'), plus a string 'stage' and a
nonnegative integer 'sgpr'. Entries with no stage or no reads are counted
as before. Each failure is one "ERROR: ..." line and exit 2, which keeps
exit 1 for an --expect mismatch. A --json report that cannot be written is
reported the same way.
tests/test_user_sgpr_census.py: 25 new cases (the CLI under -I and main()
in process); 24 of them fail on the tool as it was.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
tools/user_sgpr_census.py (standard library only) reads spirv/index.json
(user_sgpr_reads from tools/shader_meta.py) and reports, per stage: the
lowest user SGPR read as a pointer, pointer width (ptr32_lo vs ptr64), the
distance between consecutive pointer SGPRs, how the SGPR after a 32-bit
pointer is read, and reads below a given stage base. --expect stage=sgpr
turns the result into a check.
docs/d3d12_vulkan.md 3.5: the measured counts next to the current packing
description. Physical SGPRs only; no packer change.
Tests: tests/test_user_sgpr_census.py builds both packing models by hand
and checks they are told apart, plus a failing --expect.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>