mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:00:52 +01:00
[PR #54] scripts: measure the translator (us per instruction) and compare two tools/ trees #107
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#107
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/54
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9776📝 Commits (5)
7528472scripts: a throughput benchmark for the translator (us per instruction)9022fe5scripts: --compare A B, interleaved timing of two tools/ trees77c47ddbench_translate: honour --max-slowdown in --json too, and let a run save its own baseline908fe04bench_translate: --compare honours --max-slowdown, and a partial baseline no longer aborts99fe480bench_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
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Nothing in this repository measures how long the translator takes. This adds the number — and a way to compare two versions of
tools/rdna2spirv.pyon the same machine, which is what every performance claim needs.A build translates 26,503 shaders. A change to the parser, the operand splitter or the instruction table can cost a large share of that build and still pass every test,
spirv-valincluded. There is no test that would notice.What it adds
scripts/bench_translate.pys_nopdispatch, so a slower parser and a slower code generator can be told apart);--json;--max-slowdown Fagainst a baseline;--write-baseline FILE/--baseline FILEso the comparison is against the machine in front of you, not against somebody else's CPU;--compare A Btimes twotools/trees interleaved (alternating order, warm-up round dropped, best of N per side)tests/test_bench_translate.py--compareratios, the refusals, the partial baselineNo game data, no LLVM, no SPIRV-Tools. Inputs are the repository's own fixtures plus generated listings.
What it already measured on
mains_nopSo ~44% of the per-instruction cost is line parsing and dispatch, not code generation, and scaling is linear from 204 to 16,004 instructions. That is the kind of thing this repository could not answer before, in one run.
The calibration that makes
--comparetrustworthy: identical trees give 1.01x / 1.00x / 0.99x. A harness that cannot read "no change" cannot be used to claim a change.Review already applied
Three independent reviewers ran it; all their findings are fixed and covered by tests:
--jsonused to skip the slowdown check,--compareignored--max-slowdown, a partial baseline raisedKeyError, the flag combinations were silently ignored, a failing run could overwrite the baseline it failed against, and--comparewould happily compare two trees whose measurements cover different programs.cc
@ItsNotRexed@KoertLichtendonkChecklist
docs/design.md. (Not applicable: no translator change.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.