fix: preserve per-instance params for duplicate benchmark names - #874
fix: preserve per-instance params for duplicate benchmark names#874k-rister wants to merge 3 commits into
Conversation
A run file with two "benchmarks[]" entries sharing the same name (e.g. two concurrent engine pairs of the same benchmark running in opposite directions) silently collapsed onto one entry's params: blockbreaker's get_mv_params() always matched the first occurrence by name, and load_bench_params() flattened every occurrence's params into one shared per-iteration list with no per-instance scoping. Fix get_mv_params() to resolve by the benchmark's array index instead of name, give each occurrence its own mv-params/bench-params files, and auto-scope every param from an ambiguous (duplicate-name) benchmark instance to that instance's own "ids" by default, while still letting an individual param set an explicit "id" to override it. Add expand_id_ranges() as a shared helper for id-range/set expansion, reused by dump_params()'s existing per-param id-scoping (now also accepting "+"-joined id sets) and by assign_bench_ids(). Adds 20 unit tests across tests/test_dump_params.py, tests/test_load_bench_params_duplicate_names.py (new), and util/tests/test-blockbreaker.py (+ new fixture). Fixes #873 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
PR Review: rickshaw#874 — fix: preserve per-instance params for duplicate benchmark namesSummary: Resolves parameter collision for run files containing multiple benchmark instances sharing the same name by indexing Bugs
Issues
File Coverage
Missing from diff:
Limitations
VerdictRequest changes — The core fix in |
atheurer
left a comment
There was a problem hiding this comment.
The approach for isolating duplicate benchmark instances via positional indexing in blockbreaker.py, indexing intermediate parameter files, and auto-scoping ambiguous instance parameters in rickshaw-run.py looks very good and well-tested.
One spot that needs a companion update:
-
rickshaw-post-process-bench.py(lines 56–57):
dump_params()in the post-processor still checks strict equality:if param_id is not None and cs_id is not None and str(param_id) != str(cs_id): continue
When an ambiguous benchmark instance has multiple IDs (e.g.
ids: "1-2"),load_bench_params()assignsparam["id"] = "1+2". During post-processing for engine1,str("1+2") != "1"causes all instance parameters to be skipped for post-processing scripts.Please update
dump_params()inrickshaw-post-process-bench.pyto matchrickshaw-run.py:if param_id is not None and cs_id is not None: if str(cs_id) not in str(param_id).split("+"): continue
With that update in place, this will be ready to go!
…rams()
rickshaw-post-process-bench.py maintains its own independent
dump_params() (a separate port of the Perl dump_params() function)
and its own inline id-range-expansion logic, neither of which were
updated by the duplicate-benchmark-name fix. A duplicate-name
instance spanning multiple engine ids (e.g. ids: "1-2") gets its
params auto-scoped to a "+"-joined id set ("1+2"), but this script's
dump_params() still compared with str(param_id) != str(cs_id), which
is always True for a joined set -- silently dropping every such
param during post-processing.
Extract expand_id_ranges() into a new shared rickshaw_lib.id_ranges
module so rickshaw-run.py and rickshaw-post-process-bench.py can't
diverge on what an ids string means, and use it to replace this
script's inline id-range-expansion loop. Fix dump_params() to split
on "+", matching rickshaw-run.py's dump_params().
Adds tests/test_post_process_bench_dump_params.py (4 tests) covering
this script's dump_params() id-scoping, previously untested.
Addresses review feedback on #874.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Thanks for the review — both points confirmed and addressed in 055dadd:
Also added |
rickshaw-run.py now imports from rickshaw_lib (id_ranges), joining rickshaw-post-process-bench.py in depending on RICKSHAW_HOME being set to append the repo root to sys.path. The rickshaw-run-tests CI job never set it, which was unexercised until this PR's new tests loaded scripts that need it.
Summary
benchmarks[]entries sharing the same name (e.g. two concurrent engine pairs of the same benchmark running in opposite directions) silently collapsed onto one entry's params. Found live while validating a new benchmark's bidirectional test scenario.get_mv_params()now resolves a benchmark'smv-paramsby its array index instead of first-name-match, and each occurrence gets its own intermediate files.load_bench_params()now auto-scopes every param from an ambiguous (duplicate-name) benchmark instance to that instance's ownidsby default -- an individual param can still set an explicitidto override this.expand_id_ranges()helper (also used to de-duplicateassign_bench_ids()), and generalizesdump_params()'s existing per-paramidscoping to accept"+"-joined id sets.tests/test_dump_params.py, newtests/test_load_bench_params_duplicate_names.py,util/tests/test-blockbreaker.py+ new fixture).Fixes #873
Test plan
pytest -v tests/*.py-- 72 passed, 0 regressionspytest -v blockbreaker.py validate_run_file.py tests/*.py(fromutil/) -- 14 passed, 1 skippedbenchmarks[]entries sharing a name, differentids) before writing the fix🤖 Generated with Claude Code