benchmark: make partition dispatch opt-in via create_benchmark_model arg#6
Merged
Merged
Conversation
Move the partition-lifted dispatch from a module-level constant into an optional override on `create_benchmark_model(pref_type_grid=...)`. Default is a plain `DiscreteGrid(BenchmarkPrefType)` (fused vmap). Why: importing `DispatchStrategy` unconditionally ties aca-model to pylcm versions that ship the enum. The benchmark setup is useful on older pylcms too (e.g. the aca-baseline asv-benchmark PR predates the dispatch-strategy PR), and the 2-pref-type speedup stands on its own without partition lifting. Callers that want partition-lifted dispatch — recommended for aca-model at scale — construct the grid themselves and pass it via `pref_type_grid`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_benchmark_model(pref_type_grid=...).DiscreteGrid(BenchmarkPrefType)(fused vmap).DispatchStrategy, so it stays compatible with pylcm versions that pre-date the enum.Why: importing
DispatchStrategyunconditionally ties aca-model to pylcm versions that ship the enum. The benchmark setup is useful on older pylcms too (e.g. the aca-baseline asv-benchmark PR on pylcm predates the dispatch-strategy PR), and the 2-pref-type speedup stands on its own without partition lifting. Callers that want partition-lifted dispatch — recommended for aca-model at scale — construct the grid themselves and pass it viapref_type_grid.Test plan
pixi run -e py314 python -c "from aca_model.benchmark import create_benchmark_model; create_benchmark_model()"succeeds on a pylcm withoutDispatchStrategy.prek runon the changed file clean (ruff / ruff-format pass).🤖 Generated with Claude Code