OLD-9776: scripts: measure the translator (us per instruction) and compare two tools/ trees #1770

Merged
potatoe0100 merged 5 commits from upstream-pr/1770 into main 2026-11-28 08:03:49 +00:00
potatoe0100 commented 2026-11-25 11:47:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by potatoe0100 on 2026-11-25T11:47:51Z.


Claimed in the coordination issue as: OLD-9776 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161510791)

What and why

Carries on old PR 9776 by @pes7 (draft #54, branch old-pr/9776, listed in #17), rebased on current main with the author's five commits kept.

The tests check what tools/rdna2spirv.py emits but nothing about how long it takes, so a change to the parser or the instruction table can slow a full shader build a lot and still pass. scripts/bench_translate.py times translate() on the hand-written semantic fixtures and on two generated straight-line programs (ALU work and s_nop dispatch), reports best-of-N microseconds per instruction, can compare two tools/ trees with interleaved timing (--compare A B), prints JSON, and can fail on --max-slowdown. Standard library only; no game data, LLVM or SPIRV-Tools. tests/test_bench_translate.py covers the options and error cases. Its baseline numbers are from one machine, so --baseline/--write-baseline let a run use its own.

Tested

  • python -I tests/test_bench_translate.py: 10 tests OK (Linux, Python 3.13; also OK on Windows 11, Python 3.14).
  • python -I scripts/bench_translate.py --runs 1 on current main's translator: runs, 52 fixtures timed, 54 compute/mesh listings skipped as designed (they need an FSSM header). Python 3.13, Linux.
  • python -m compileall -q scripts tests: clean.

GPUs tested: n/a (no GPU code)

AI-assisted: yes (Claude rebased and tested; the change is pes7's)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5490727552 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1770). Originally posted by [potatoe0100](https://github.com/potatoe0100) on 2026-11-25T11:47:51Z. --- Claimed in the coordination issue as: OLD-9776 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161510791) ### What and why Carries on old PR 9776 by @pes7 (draft #54, branch `old-pr/9776`, listed in #17), rebased on current `main` with the author's five commits kept. The tests check what `tools/rdna2spirv.py` emits but nothing about how long it takes, so a change to the parser or the instruction table can slow a full shader build a lot and still pass. `scripts/bench_translate.py` times `translate()` on the hand-written semantic fixtures and on two generated straight-line programs (ALU work and `s_nop` dispatch), reports best-of-N microseconds per instruction, can compare two `tools/` trees with interleaved timing (`--compare A B`), prints JSON, and can fail on `--max-slowdown`. Standard library only; no game data, LLVM or SPIRV-Tools. `tests/test_bench_translate.py` covers the options and error cases. Its baseline numbers are from one machine, so `--baseline`/`--write-baseline` let a run use its own. ### Tested - `python -I tests/test_bench_translate.py`: 10 tests OK (Linux, Python 3.13; also OK on Windows 11, Python 3.14). - `python -I scripts/bench_translate.py --runs 1` on current `main`'s translator: runs, 52 fixtures timed, 54 compute/mesh listings skipped as designed (they need an FSSM header). Python 3.13, Linux. - `python -m compileall -q scripts tests`: clean. GPUs tested: n/a (no GPU code) AI-assisted: yes (Claude rebased and tested; the change is pes7's) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DadaCap commented 2026-11-28 08:03:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T08:03:51Z.


Merged into main (merge commit 73a5f3b10), approved by DadaCap (maintainer). Thanks!

Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (f03dfe23a).

AI-assisted (Claude Code), posted for DadaCap.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236338419 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1770#issuecomment-7236338419). Originally posted by [DadaCap](https://github.com/DadaCap) on 2026-11-28T08:03:51Z. --- Merged into `main` (merge commit 73a5f3b10), approved by DadaCap (maintainer). Thanks! Checked before merging: Tested in our local release candidate (main + 41 PRs): translator suite 512 files / 6,442 tests clean, Python suite with no new failure versus main, and 360 s game runs on an RTX 5080 with no regression. The merge was pinned to the head commit that was tested (f03dfe23a). _AI-assisted (Claude Code), posted for DadaCap._
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!1770
No description provided.