An AssertionError, TypeError, AttributeError, ZeroDivisionError or
RecursionError from translate() now counts as 'translator error <type>', as
IndexError/KeyError/ValueError already did: the program's old module and
index entry are dropped and the run goes on. Before, one assert (#3976's
--wave64-emulate case) ended make_game.py's whole shaders stage.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts were both-sides additions: docs/design.md (main's DPP, EXEC and
saveexec row updates kept; this branch's Control flow row kept) and
tools/rdna2spirv.py (main's _out_inside_input and --opt kept next to
_depth_arg and --max-structured-depth).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merges that each passed alone but clash together:
- v_cmp_class_f64: the earlier cmp_class_f64 (685d16ed9) (operand-form checks, test_cmp_class_f64) and the later f64 branch
in cmp_class both handled the opcode; f64 goes to cmp_class_f64 again, f16 stays in cmp_class.
- rdna2spirv CLI tests: spirv-as/spirv-val now run in the output folder with the staging file's bare name, so
the test doubles resolve it against cwd; assemble_spirv decodes the output only when it is bytes. (The doubles
had been writing .spirv-*.tmp files into the repository root.)
- ps_w64 fixtures (TEST-722): an 18th fixture (ps_w64_a_discard) landed; its killed lanes export nothing and
keep the clear value.
- first_light: a run without an OBJ removes mesh.bin, and harness_env reads manifest["files"]; batch_glb's stats
name failures and dropped textures; run_gpu_tests reports a frame never written as a missing readback
(TEST-837).
- make_game TRANSLATION_SOURCES and runtime.yml's paths include spirv_opt.py and report_paths.py (and
wave64_emulate_opt.py), which the translator imports.
Repo rules: stdout guard on six tools; encoding on two opens (gen_gdk_runtime_classes' helper is read_utf8);
newline on one write; anim_skeleton_match's joaat encodes like hashdict.joaat; test_feature_scan's new test is
listed with the others its globals() runner reaches.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
assemble_spirv raises FileNotFoundError when spirv-as or spirv-val is not on
PATH. Report that once from main (exit 2) instead of failing the first shader
with a traceback; image_fuzz reproduces it when SPIRV-Tools is absent.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Translating with --out equal to the input disasm folder (or a folder inside it) wrote .spvasm/.spv/index.json among the .s inputs and exited 0. Resolve both paths and refuse with one ERROR line and exit 2 before mkdir or any output is written. The --merge path is exempt: it does not read src, and merging shard parts in place is how a shard run finishes.
Tests: out==input, out inside input, and a distinct out control.
Conflicts: tools/rdna2spirv.py (--pc-tail-ubo and --max-structured-depth
both added next to --max-shared-memory: kept both) and docs/design.md
(upstream reworded the neighbouring rows: kept theirs and re-applied the
SHADER-427 sentence of the "Control flow" row).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
needs_barrier_rounds() looked at the unbounded structured tree, while
assemble() emits the dispatch loop once the tree nests deeper than
MAX_STRUCTURED_DEPTH. A wave32 compute shader with a top-level s_barrier
over the bound then got the dispatch loop without barrier rounds. Both
now use capped_tree(). With the default bound (64) no corpus module is
affected (the deepest is 29); it matters when --max-structured-depth is
set below a shader's depth.
The CLI test now pins the default to the literal 64.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since #1904 the corpus's deepest structured tree is 29, not 118. With the
SHADER-299 bound at 16, 1,031 modules (747 CS, 284 PS) still took the
dispatch-loop form, which saves only 12% of their spirv-val time but
compiles 1.67x (PS) to 2.0x (CS) slower on an RTX 5070 Ti / 621.24.
The bound now sits above the corpus as a guard, and
--max-structured-depth N (0 = never) sets it per run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validate --out right after parsing arguments: a file, a path under a file,
a dangling symlink or an unmapped drive root is now one argparse error line
with exit 2, instead of a FileExistsError/NotADirectoryError traceback, and
before --merge or os.makedirs can write anything. Matches the guards in
shader_disasm.py (#1607) and tex_export.py (#1632).
Add subprocess tests for those paths and a control that a new output folder
with missing parents still translates. CPU-only; no game data.
parse_file reads tab-indented instruction lines only, so a hand-written or
re-indented .s parses to an empty shader. That used to translate to a module
that passes spirv-val, lands in index.json and does no work at all: the CLI
printed "1 shaders: 1 translated, 1 pass spirv-val" for a file whose only
line was a comment.
Refuse it in translate() with "no instructions (nothing tab-indented?)", so
it is reported like any other unsupported shader and no .spv is published.
Found while writing a fixture with spaces instead of tabs; the new test uses
that exact shape.
A shader that raises Unsupported or a translator error on a retried partial
run kept the .spv and index.json entry an earlier successful run published:
only spirv-as/val rejections went through the invalid set that the index
merge pops. The stale entry masks the regression from make_game.py, which
takes index.json as proof the translation finished, and the stale module
stays loadable by the runtime.
Route all three failure paths through one drop_stale helper: unlink the old
.spv and mark the name for the index merge to drop. The .spvasm text stays
for diagnosis, as it does on a rejection. Shard and --limit runs write their
index fresh from this run's metadata, so they only gain the unlink.
Tests: two synthetic CLI tests (s_barrier in a PS is Unsupported before any
SPIR-V tool runs; a mocked ValueError covers the translator-error path).
Both fail without the change. Standard library only, no game data.
AI-assisted. Tested on CPU (Windows 11, Python 3.12): tests/test_rdna2spirv_cli.py
(14 tests), unittest discover tests/semantic, and pytest tests/test_rdna2spirv_cli.py
tests/test_translate.py with llvm-mc 23.1.5 (AMDGPU) and SPIRV-Tools v2026.4.
No GPU was used.
`files[: a.limit] if a.limit else files` read --limit 0 as "no limit"
and translated the whole corpus, and a negative --limit dropped the
last shaders instead of being refused. --shard was split and used
unchecked: 0/0 ended in "slice step cannot be zero", 9/8 translated
nothing and wrote an empty index.part9.json that --merge then reads,
and anything that isn't i/n was a traceback.
Both are now argparse types: --limit must be at least 1, and --shard
must be i/n with n >= 1 and 0 <= i < n. A bad value is a usage error
(exit 2) before --out is created. The translation itself is unchanged,
and make_game.py's own "--shard i/jobs" values are all valid.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>