mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:30:53 +01:00
[PR #1770] OLD-9776: scripts: measure the translator (us per instruction) and compare two tools/ trees #1783
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1783
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1770
Author: @potatoe0100
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:carry/old-9776📝 Commits (5)
5ffdc50scripts: a throughput benchmark for the translator (us per instruction)03a92eescripts: --compare A B, interleaved timing of two tools/ trees4c70aeabench_translate: honour --max-slowdown in --json too, and let a run save its own baseline3bcb621bench_translate: --compare honours --max-slowdown, and a partial baseline no longer abortsf03dfe2bench_translate: refuse flag combinations that were silently ignored, and require a baseline that exists📊 Changes
2 files changed (+436 additions, -0 deletions)
View changed files
➕
scripts/bench_translate.py(+309 -0)➕
tests/test_bench_translate.py(+127 -0)📄 Description
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 currentmainwith the author's five commits kept.The tests check what
tools/rdna2spirv.pyemits 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.pytimestranslate()on the hand-written semantic fixtures and on two generated straight-line programs (ALU work ands_nopdispatch), reports best-of-N microseconds per instruction, can compare twotools/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.pycovers the options and error cases. Its baseline numbers are from one machine, so--baseline/--write-baselinelet 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 1on currentmain'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
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.