Commit Graph

23 Commits

Author SHA1 Message Date
bf785cc204 fix(tools): invalidate permutation selectors on carry writes
A carry or scale flag can overwrite a known scalar selector through the second destination, inflating the feature scan counts.
2026-11-22 18:20:29 +01:00
23c6147946 Merge pull request #1811 from Vonsek 2026-11-22 09:48:23 -05:00
364d9a465a feature_scan: INVALID is modelled; d3d12_vulkan.md answers open question 16
A literal V# word 3 with FORMAT 0 (an unbound descriptor) reads 0 on the
hardware and in the translator, so it is not listed as a format the
translator lacks. Row 16 gets the counts over the 1.0.2.1 corpus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:23:28 +01:00
0fc69a771b feature_scan: answer open question 16 (UAV counters, typed buffer formats)
PSV0 resource bindings give the structured UAVs with a counter and the
typed buffer SRVs/UAVs; the listings give the MTBUF instruction formats
and, for MUBUF *_format ops, where V# word 3 comes from in the access's
basic block (literal, scalar load, computed, an earlier block or a
shader input). Formats are checked against rdna2spirv.Gen.FORMATS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:23:28 +01:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.

AI-assisted (Claude), on behalf of dev-ewann.
2026-11-22 14:20:30 +00:00
d92a395e10 feature_scan: refuse a --out inside the shader corpus it reads
`feature_scan.py <shaders> --out <shaders>/dxbc/index.json` wrote the report
over the corpus index and printed the counts with exit 0, so the next run of
the same command failed with "is not a shader list" and the shaders stage of
make_game.py had to be run again. A scanned .dxbc, a listing in dxbc/disasm
and the spirv/index.json the scan reads had the same problem.

--out is now checked against those inputs before anything is read: one line
and exit 2 naming the path, and nothing is written. Report paths outside the
shader folders are unchanged, including the missing-folder creation.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 06:44:57 -06:00
89cf18645e Merge pull request #1428 from Dominik 2026-11-22 06:38:01 -05:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00
7e7415618d feature_scan.py: keep invalid index fields from aborting the scan 2026-11-22 12:14:32 +01:00
e6e1694ca3 feature_scan: report malformed index shapes without a traceback 2026-11-22 03:26:52 -06:00
1b47daac4f Merge pull request #1092 from bbareth 2026-11-22 02:09:04 -05:00
523d79d63d feature_scan.py: shader variants that share an original name keep their own stages
main() built stage_of from the file stems, then overwrote it with the
original shader names. Two variants with the same original name but
different stages (same.dxbc as gs, same~1.dxbc as ms) both took the last
one's stage, so the disassembly counts gave {'ms': 2}. File stems now win;
original names are only a fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 07:52:57 +01:00
ef54f9e61b feature_scan, turing_atlas: create the --out folder instead of losing the run
Both tools opened --out with a bare open(..., "w"), so a path whose parent does
not exist threw FileNotFoundError after the whole scan or the whole compile run
had already finished (#934 is the same defect in hashdict.py). awc_manifest.py
and the other tools create the parent first; these two now do the same.

Tests: the existing CLI fixtures run each tool with --out inside a nested folder
that does not exist, and assert a clean exit and the file landing there. Both
fail without the change: feature_scan reports "FAIL --out creates a missing
folder", turing_atlas raises the FileNotFoundError the fix removes.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 23:19:04 -06:00
ff650ecefd feature_scan.py: count v_perm_b32 selector byte classes and document corpus counts 2026-11-22 02:50:50 +00:00
e5e35ef6e8 feature_scan.py: a missing or unreadable shaders folder is one line
main() opened <shaders>/dxbc/index.json straight away, so a mistyped
path, a file, a work folder whose shaders stage hasn't run, a broken
index.json and one that isn't a list all ended in tracebacks
(FileNotFoundError, NotADirectoryError, JSONDecodeError,
AttributeError). Each now prints one line naming the path, and what to
run when the index is missing, and exits 2 before --out is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:45:43 +01:00
c6194c7495 feature_scan.py: check DXBC part bounds before counting features 2026-11-22 00:59:52 +01:00
7356096650 Merge pull request #397 from Rayhan Robin 2026-11-21 18:43:25 -05:00
cdaaebcac0 Tools: report a short OSG1 signature instead of aborting feature_scan
streams() read `count` 32-byte elements at `first` without checking the part
length, so a truncated OSG1 raised struct.error out of scan_dxbc and killed the
whole count-only scan. Treat a signature whose element table does not fit (or
whose first element overlaps the 8-byte count/offset header) as carrying no
stream information, matching the existing len(sig) < 8 case. Well-formed
signatures are read exactly as before.

Synthetic regression test in tests/test_feature_scan.py: it fails on
unmodified main with struct.error and passes with the fix; a work folder with
one truncated OSG1 still prints the summary and keeps the real stream-1 count.
No game data, no GPU. Full CPU suite: 1559 passed, 150 skipped, 1 xfailed;
semantic suite: 423 passed; compileall and --help clean.

New BUILD item claimed in #374. AI-assisted (OpenCode).
2026-11-21 17:34:45 -06:00
186d8793cd feature_scan: say which DS counter ops the ordered/GWS group includes
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:39:19 +01:00
e8a07da4ff feature_scan: count s_getpc_b64 kept for code-embedded data per stage; d3d12_vulkan.md: answer §8.2 #10, per-stage counts for #14, tiled resources for #18
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:38:02 +01:00
321635899b Tools: feature_scan.py, a corpus scan for D3D12-layer features (SHADER-16)
Counts, from what the shaders stage leaves in <work>/shaders, the features docs/d3d12_vulkan.md
§8.2 #10 and #14 ask about: the DXIL program kind of every shader (hull, domain, amplification),
the SFI0 D3D_SHADER_REQUIRES_* flags (values from the Windows SDK's d3d12shader.h, among them
WAVE_MMA and SHADING_RATE), output-signature streams other than 0, native v_mfma/v_wmma and
GDS/ordered-count instructions in the disassembly, and uses_code_base per stage from
spirv/index.json. Prints counts only. tests/test_feature_scan.py checks it on a synthetic work
folder (hand-built DXBC parts, listings and index).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:37:43 +01:00
052cc571d0 feature_scan: count s_getpc_b64 kept for code-embedded data per stage; d3d12_vulkan.md: answer §8.2 #10, per-stage counts for #14, tiled resources for #18
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:12:07 +01:00
409f702bbb Tools: feature_scan.py, a corpus scan for D3D12-layer features (SHADER-16)
Counts, from what the shaders stage leaves in <work>/shaders, the features docs/d3d12_vulkan.md
§8.2 #10 and #14 ask about: the DXIL program kind of every shader (hull, domain, amplification),
the SFI0 D3D_SHADER_REQUIRES_* flags (values from the Windows SDK's d3d12shader.h, among them
WAVE_MMA and SHADING_RATE), output-signature streams other than 0, native v_mfma/v_wmma and
GDS/ordered-count instructions in the disassembly, and uses_code_base per stage from
spirv/index.json. Prints counts only. tests/test_feature_scan.py checks it on a synthetic work
folder (hand-built DXBC parts, listings and index).

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:10:38 +01:00