Skip to content

benchmark: make partition dispatch opt-in via create_benchmark_model arg#6

Merged
hmgaudecker merged 1 commit into
mainfrom
feature/benchmark-opt-in-dispatch
Apr 22, 2026
Merged

benchmark: make partition dispatch opt-in via create_benchmark_model arg#6
hmgaudecker merged 1 commit into
mainfrom
feature/benchmark-opt-in-dispatch

Conversation

@hmgaudecker

Copy link
Copy Markdown
Member

Summary

  • 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).
  • The benchmark module no longer imports DispatchStrategy, so it stays compatible with pylcm versions that pre-date the enum.

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 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 via pref_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 without DispatchStrategy.
  • prek run on the changed file clean (ruff / ruff-format pass).

🤖 Generated with Claude Code

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>
@hmgaudecker hmgaudecker merged commit adc8a19 into main Apr 22, 2026
1 check failed
@hmgaudecker hmgaudecker deleted the feature/benchmark-opt-in-dispatch branch April 22, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant