Commit Graph

18 Commits

Author SHA1 Message Date
1e0554da8f user_sgpr_census: support MS stage techniques and pairing with PS (USER-SGPR-CENSUS-MS-TECHNIQUE)
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)
2026-11-25 15:14:11 +03:00
608a24a1cd tests: the sgpr census folding-volume case keeps the name's case through realpath on Windows 2026-11-24 09:27:41 +05:30
9ebd8cf868 tests: the sgpr census folding-volume case mocks the helpers same_report_path calls
#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.
2026-11-24 03:53:40 +02:00
696cce455d user_sgpr_census: decode index.json with utf-8-sig to handle UTF-8 BOM (#6271)
Squash-merged after diff review of PR #6271 - user_sgpr_census: decode index.json with utf-8-sig
2026-11-23 08:25:57 -06:00
779c8da45a user_sgpr_census: use shared report_paths.same_report_path (BUILD-589) (#6299)
Squash-merged after diff review of PR #6299 - user_sgpr_census: use shared report_paths.same_report_path (BUILD-589)
2026-11-23 08:23:11 -06:00
05961f0eeb user_sgpr_census: read the index as utf-8-sig, so a Windows BOM is not a JSON error (EGEN-SGPRCENSUS-BOM) (#6276)
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)
2026-11-23 08:21:26 -06:00
d2cdb4e4fb Merge pull request #2984 from lines9686-rgb
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:06:34 -05:00
35d498d8b4 Merge pull request #2364 from bbareth
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:05:34 -05:00
5dbfab6bd3 Merge main into test-windows-nonascii
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>
2026-11-23 01:17:02 +03:00
6e2e3a4606 Merge upstream main and preserve both changes
Conflict resolution AI-assisted with DeepSeek V4 Pro. Focused synthetic tests passed on macOS arm64.
2026-11-22 22:57:17 +01:00
511732b468 hw_oracle: write the vcvars script for non-ASCII paths; more tests read child output right
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>
2026-11-22 22:52:11 +03:00
d6fe52767c user_sgpr_census --pairs: VS/PS of one technique read shared root SGPRs 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.
2026-11-22 19:11:04 +01:00
b1896288d0 user_sgpr_census: stabilize the lowest-pointer mode when counts tie 2026-11-22 17:47:11 +01:00
e40f7de7d7 user_sgpr_census: a bad index or an unwritable --json is one ERROR line, not a traceback
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>
2026-11-22 10:47:40 -05:00
8d3b3afe6c Merge pull request #1861 from FreddyxS 2026-11-22 09:48:51 -05:00
f8d185ef32 Test that the SGPR census preserves its input index 2026-11-22 15:39:02 +01:00
3ea9b40792 user_sgpr_census: validate stage assignments before scanning 2026-11-22 11:27:40 -03:00
0f183fcafd Tools: user-SGPR census per stage (evidence for d3d12_vulkan.md 3.5)
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>
2026-11-22 14:03:22 +01:00