A .pyc does not help ast.parse. test_runtime_paths.py, test_isa_coverage.py,
test_shader_stage_resume.py, test_cmake_translator_deps.py and
test_resource_hygiene.py read the syntax tree of tools/rdna2spirv.py, seven
whole-file parses of 7 s each on CPython 3.12, 3.13.0 to 3.13.15 and 3.14.0
to 3.14.7. They now call tests/semantic/piecewise_parse.parse, which gives
the same tree (tests/test_piecewise_parse.py) in about 1 s.
tools/isa_coverage.py parses inside scan_translator and accepted_names;
its test patches ast.parse around those two calls on the real translator
instead of changing the tool.
Python 3.14.7, valid .pyc of the translator, two runs each:
test_runtime_paths 16.0 -> 3.7 s, test_isa_coverage 15.0 -> 2.5 s,
test_shader_stage_resume 14.2 -> 8.2 s, test_cmake_translator_deps
7.6 -> 1.4 s, test_resource_hygiene 7.6 -> 1.3 s.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Remove dead and invalid instructions identified in docs/isa_coverage.md:
- s_and_b32_mask, s_or_b32_mask (invalid instructions not in RDNA2)
along with unused op.endswith('_mask') check.
- v_subrev_u16, v_and_b16, v_or_b16, v_xor_b16 (dead Vega/GFX9 spellings).
Update docs/isa_coverage.md, docs/design.md, tests/test_isa_coverage.py,
and tests/semantic/test_valu_int16.py accordingly.
tools/valu_int_diff.py generated v_subrev_u16 from its OPS table and
modelled it, so with the translator's support gone the fuzzer stopped with
"harness error: v_subrev_u16" (and --self-test with it); the opcode is
dropped from the table and the model there too.
In Python's ast module, ast.Load() and operator tokens are singletons. When a refused branch used a tuple comparator (such as op in ('s_denorm_mode', 's_round_mode')), accepted_names() recorded id(ast.Load()) in skip and _in_skipped() then rejected every tuple/list comparator in the file (dropping 212 of 492 accepted exact mnemonics in tools/rdna2spirv.py).
Also avoid descending into ast.Not when positive_only=True and separate unconditional opcode refusals from operand-guarded 'and' checks (which belong in partial, not refused).
Claim: https://github.com/ItsNotRexed/Leonida/issues/2300#issuecomment-7082476941
v_mac_legacy_f32 came in with 58706b5b; llvm-mc accepts it for gfx1013 (v_mac_legacy_f32_e32).
The docs give the counts with the commit they were taken at, and the README row no longer
quotes numbers that every new rule changes. Reported by @josevictorp in #1562.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reads AMD's machine-readable RDNA2 ISA spec (path given with --isa, not vendored), scans
tools/rdna2spirv.py statically with ast and reports, per encoding, which instructions have a
rule, are refused or are unknown, plus every matched name that is not an RDNA2 instruction.
Tests use a small hand-written fixture; the real-XML test skips without LEONIDA_RDNA2_ISA_XML.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>