Skip to content

Add readable and fast compiled model modes#191

Draft
VEZY wants to merge 8 commits intomainfrom
compile-models
Draft

Add readable and fast compiled model modes#191
VEZY wants to merge 8 commits intomainfrom
compile-models

Conversation

@VEZY
Copy link
Copy Markdown
Member

@VEZY VEZY commented Apr 28, 2026

Summary

  • Add mode=:readable | :fast to compiled model generation and preserve Status-backed execution semantics
  • Emit clearer generated code with stable per-block locals, inputs/outputs comments, and improved source rewriting for current-model and hard-dependency references
  • Tighten MTG loop bounds for dynamic growth and keep multirate compilation parity intact
  • Expand compiler coverage for readable output, fast mode, unsupported modes, alias-based hard dependencies, and MTG/multirate regressions

Testing

  • Focused compiler test suite passes for single-scale, multiscale, multirate, and cross-scale hard-dependency cases
  • Combined regression with existing ModelMapping coverage passes
  • git diff --check passes

VEZY added 8 commits March 18, 2026 14:52
Added generated GraphSimulation compatibility validation in src/compiled_model.jl (line 68). Compiled scripts now embed a model signature and fail early if called with a different mapping/model set or wrong same-rate vs multirate mode.
Added the compatibility signature to generated script headers for inspection.
Hoisted multirate per-node setup out of the timestep loop in src/compiled_model.jl (line 338): node metadata, model, model spec, and model clock are now generated as stable locals like _mr_Leaf_carbon_assimilation_model_clock.
Kept temporal input resolution, meteo sampling, output publishing, and requested exports delegated to the existing runtime helpers.
Kept the GraphSimulation(...; type_promotion=...) constructor fix in src/mtg/GraphSimulation.jl (line 37).
Added tests for compatibility validation and multirate hoisting in test/test-compiled-model.jl (line 113).
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