pso_code_base_pairs: count PSOs by code-base stage (SHADER-CODEBASE-PAIRS) #1423
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1423"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-24T23:52:09Z.
Item: SHADER-CODEBASE-PAIRS — claimed in #14 before this PR.
The question
docs/d3d12_vulkan.md§5.2 leaves the push-constant shape open: keep one 64-bit code base at dwords 34–35 in the144-byte block, or grow it to 168 bytes with one slot per stage, or use a per-stage buffer. It says to decide after
measuring how many real PSOs have two code-base stages. Row 14 of the
docs/boot.mdchecklist asks the same thing,and
tools/feature_scan.py's header says the package cannot answer it: "Which stages are paired in one PSO is in theexecutable, not in
shaders.rpf."It can. The pipeline library in
shaders.rpf's zlib part names a program per stage slot for all 25,471 graphicsrecords (
tools/shader_library.py), and a stage's resource-layout blob ends with the 16-byteHASHdigest of thecontainer its code came from — the same digest
shader_carve.pyleaves in every container it carved to<work>/shaders/dxbc, whose file stem is the translation index's key. Soand each stage of a PSO picks up that program's
uses_code_base.Answer: none, for 1.0.2.1
Over all 25,471 graphics records of library
0x65F41EDD930.048.020:The 444 are 343 MS, 60 PS, 41 VS. The stage census is 13,383 VS+PS, 10,726 MS+PS, 1,336 MS, 24 VS and 2 VS+PS+slot 6.
21 records (19 VS+PS, 2 with slot 6) are left unknown: a stage's program has no carved container in the carve output,
so its code base is unknown rather than absent. The tool's per-stage program counts (38 VS, 46 PS, 260 MS, 263 CS)
are lower than the corpus's published 54 / 93 / 266 / 263 of 26,503 because the library holds a second compiled form
of 6,522 carved shaders and one program can serve two stage slots; the corpus counts are reproduced by
tools/feature_scan.pyunchanged, so the join sees the same shaders.So the 144-byte block with one code base is enough for this package, and the runtime's refusal of a PSO whose two
stages both read it (section 3.2) can stay. The docs say that now, the stale
feature_scan.pyheader line iscorrected, and
tools/shader_library.py's header note about slot 6 matches the measured 2 records (both with VS+PS).Tool
tools/pso_code_base_pairs.py(standard library only,python -I), counts only — no shader name, listing, code ordata leaves the work folder:
Accepts the archive or a library saved with
tools/shader_library.py --save; reads bothspirv/index.jsonshapes(an object keyed by container stem, or a list of rows keyed by their own
file/name); a container carved under twostems counts as code-base if either row does;
--outrefuses to name one of its own inputs (report_paths).Testing
No GPU and nothing online. On Windows 10 Pro 22H2 (19045), Python 3.12.10, 16 cores, an RTX 2080 Ti that this change never touches:
python -I tests/test_pso_code_base_pairs.py— 9 tests, OK. The library, the carve folder and both index shapes arebuilt from bytes with the builders in
tests/test_shader_library.py: a VS+PS record with both stages on a codebase, an MS+PS record with only the PS, an unresolved record, a container carved twice, list- and map-shaped
indexes, archive and saved-library inputs, that the report names no shader, the
--outguard and a missing folder.python -I tests/test_shader_library.py(21) andpython -I tests/test_text_write_line_endings.py(3) — OK.python -m compileall -q tools tests, andpython -I scripts/check_no_game_data.pyon every file in the commit —clean.
tests/tree through the runner,python -I scripts/run_semantic_tests.py tests -j 4, at89d7dfcf5:plain reports 522 files, 8,099 tests, 42 files failed; with this commit 523 files, 8,108 tests, 42 files failed. The
two failed lists differ only by
test_run_wine_testsandtest_build_batch_launch, which pass alone here and failunder
-j 4on a loaded machine. The 42 are not touched by this commit: 30 are pytest-based filespython -Icannot import, 6 more are script-style files the runner collects nothing from (
ci.yml:87sends both kinds to thepytest job), and the rest are the Windows-only failures I filed as findings on #14. Rebased onto
6fe83805aafterthat; the re-run goes in a comment below.
AI-assisted. Counts only, no game data, per the coordination issue's rules.
Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-25T00:05:05Z.
Re-run on the rebased head (
230be6c59, base6fe83805a), same machine, same command:The failed set is the pre-existing one, unchanged by this commit: 30 files
python -Icannot import pytest in,6 script-style files the runner collects nothing from,
test_mesh_alloc_single_writer(relativesys.pathinsert),and
test_run_wine_tests, which passes alone (72 tests) and fails under-j 4on a loaded box — filed as findingson #14.
test_ci_registrationisgreen here because the rebase picked up
fd0a53907; the file count is 528 rather than 523 because main has 5 moretest files than the
89d7dfcf5this was first measured against.python -I tests/test_pso_code_base_pairs.py(9),python -I tests/test_shader_library.py(21),python -I tests/test_text_write_line_endings.py(3),python -I tests/test_tool_stdout_encoding.py(4) andpython -m compileall -q tools tests make_game.pyare all green at this head.Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-25T00:05:09Z.
Tested
230be6c59on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), againstmain364ab4eab(Python tooling; no GPU or game data):python3 -I tests/test_pso_code_base_pairs.py: 9/9 OK at this head (0.2 s; the fixtures build the pipeline library, containers and index synthetically, as the test header says).python3 -m compileall -q tools/pso_code_base_pairs.py tools/shader_library.py tools/feature_scan.py tests/test_pso_code_base_pairs.py: exit 0.main:tools/pso_code_base_pairs.pydoes not exist there, so the test fails at import. I did not run the realshaders.rpfscan, only the synthetic tests.AI-assisted; synthetic fixtures only, no game data.
Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-25T00:06:28Z.
Rebased onto
1154976d4(main now), heade17069dec; the rebase is clean and the measured lines in §5.2 and boot row 14 are intact. Nothing in the 19 commits since the previous base touchestools/pso_code_base_pairs.py,tools/shader_library.py,tools/feature_scan.pyordocs/shader_library.md;docs/d3d12_vulkan.mdmoved in the resource-heap and query sections, well above §5.2.tests/test_pso_code_base_pairs.py(9),tests/test_tool_stdout_encoding.py(4) andscripts/check_no_game_data.pyon all seven files are green at the new head; the whole-tree run at this base follows in a comment below.Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-25T00:24:12Z.
@mumogg rebased since the "stale" review — ready for another look. (No permission to re-request the review from this account, so: this comment is the ping.)
What the rebase touched: nothing of mine.
docs/d3d12_vulkan.mdmoved in the resource-heap and query sections above§5.2, and the rebase was clean; §5.2 and
docs/boot.mdrow 14 still carry the measured count.tools/pso_code_base_pairs.py,tools/shader_library.py,tools/feature_scan.pyanddocs/shader_library.mdare untouched upstream.Checked at this head on Windows 10 Pro 22H2 (19045) / Python 3.12.10, no GPU, no game data in the commit:
tests/test_pso_code_base_pairs.py9 OK,tests/test_tool_stdout_encoding.py4 OK,tests/test_shader_library.py21 OK,
tests/test_text_write_line_endings.py3 OK,compileall -q tools tests make_game.pyexit 0,scripts/check_no_game_data.pyon all seven files clean. Whole-treerun_semantic_tests.py tests -j 4numbers forthis base are in the next comment; the failed set is the pre-existing 41 (30 pytest-import files, 6 script-style
files, 5 Windows-only), none of them touched here.
Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-25T01:07:36Z.
Whole-tree run at this base, both trees, same box (Windows 10 Pro 22H2 build 19045, Python 3.12.10, 16 cores), same command, back to back:
+1 file and +9 tests are
tools/pso_code_base_pairs.pyandtests/test_pso_code_base_pairs.py. The two failed listsdiffer by one name,
test_build_batch_launch, which is the third file ofthe load-sensitivity finding: it
passes alone here (
Ran 2 tests, 10 s) and fails under-j 4while a 16-threadvk_pipeline_checkwas running; itpassed in the other two runs on this box. Everything else in the 41 predates this branch and is filed on #14: 30
pytest-based files
python -Icannot import pytest in, 6 script-style files the runner collects nothing from(
ci.yml:87sends both kinds to the pytest job),test_mesh_alloc_single_writer(relativesys.path.insert(0, 'tools')),test_world_names/test_bink_names/test_opus_tags(PermissionErrorrepr), andtest_run_wine_tests(same load finding).Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-25T01:09:36Z.
Heads-up for whoever picks this up: CI has not run on this PR.
check-runsone17069decis 0 and the commitstatus is
pending— first-time-contributor workflows sit until someone with Actions access approves the run, so areviewer waiting for green checks will wait forever. Nothing here depends on them: the suite numbers,
compileall,and
scripts/check_no_game_data.pyresults for this head are in the three comments above, andtests/test_pso_code_base_pairs.pybuilds its pipeline library, containers and index by hand, so it needs no GPU, nogame files and no CI.
Imported from ubiquitarianism/leonida. Originally posted by GTAVIB4GTAVI on 2026-11-26T05:34:52Z.
Rebased onto
maina73a57e13(wase17069dec, 828 commits back). One conflict, indocs/shader_library.md:mainadded a--compute-hashesbullet where this PR adds thepso_code_base_pairs.pybullet, so both are kept.tests/test_pso_code_base_pairs.pyre-run after the rebase: 9 tests, 0 failures. Nothing else changed.Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T11:26:32Z.
#1423 | head
7c2de8a936897b2322caf574c991746dfe732b01|python3 -I tests/test_pso_code_base_pairs.py -v| red: import error (pso_code_base_pairs absent, 0 tests ran) | green: 9 passed | Import-only baseline → passThe new pso_code_base_pairs tool was absent on main, so the baseline stopped at import. The nine synthetic code-base pairing and CLI tests passed after merging.
Copied the PR tests onto clean main
4a54aedcb6b66525e0c9f72a6ea10263337c9141for the baseline, then merged that main into the recorded PR head and reran those files. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Unittest failure/error counts include subtests where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:42:02Z.
Merged, thank you @GTAVIB4GTAVI! This PR (pso_code_base_pairs: count PSOs by code-base stage (SHADER-CODEBASE-PAIRS)) passed its own tests with main merged in during sodove's verification of this shader batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.