Commit Graph

13 Commits

Author SHA1 Message Date
7aa255ab8e Merge pull request #2237 from syfyra/perf/translator-piecewise-parse
tests: parse the translator in pieces: 7 s -> 1 s per uncached import, 60 s -> 17 s in five standalone tests (TEST-TRANSLATOR-PIECEWISE-PARSE)
2026-12-01 16:18:04 +01:00
53604abbfc tests: the five tests that parse the translator source do it in pieces, 60 s -> 17 s (TEST-TRANSLATOR-PIECEWISE-PARSE)
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>
2026-11-26 12:27:30 +01:00
23fad6301f tools: harden isa_coverage.py BOM, SyntaxError, encoding and zero-division paths 2026-11-25 20:16:43 +08:00
8e352b85da Merge pull request #4427 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:38 -05:00
62e7f03404 rdna2spirv: remove dead GFX9 and invalid opcodes
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.
2026-11-23 03:39:40 +02:00
9d7a002d1c isa_coverage: a stalled llvm-mc is one error line, not a TimeoutExpired traceback 2026-11-23 02:22:56 +01:00
1089113429 Merge pull request #2747 from IAmNotSiob 2026-11-22 15:11:34 -05:00
52f7466f9d Merge pull request #2540 from Vonsek 2026-11-22 13:16:01 -05:00
ee0253c1fb isa_coverage: count op.endswith dispatch families (s_*_saveexec_b32/b64) 2026-11-22 19:08:21 +01:00
bf6774f8f4 fix(tools): distinguish LLVM probe failures from opcode support
The ISA coverage report treated an unavailable compiler target as proof that each probed instruction was accepted.
2026-11-22 18:24:51 +01:00
ca935bb734 isa_coverage: exclude non-expr AST singletons from accepted_names skip set
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
2026-11-22 14:01:59 -03:00
6290b0acd4 isa_coverage: allow v_mac_legacy_f32 (gfx1013 VOP2, missing from AMD's XML); counts at current main; wrap long lines
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>
2026-11-22 13:53:11 +01:00
e901a7b99a tools: isa_coverage.py, RDNA2 ISA coverage of the translator from AMD's XML
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>
2026-11-22 13:14:44 +01:00