You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ltm: LTM helper variables push C-LEARN toward the VM slot limit #654
With LTM on, C-LEARN (test/xmutil_test_models/C-LEARN v77 for Vensim.mdl) generated about 30k helper variables, mostly to capture PREVIOUS(...) values, and compiled to 56,891 result slots against the bytecode VM's limit of 65,536.
A somewhat larger model would not have compiled with LTM.
Current state
C-LEARN with LTM now uses 30,896 slots, 34,640 under the limit, with 6,061 LTM variables. clearn_ltm_var_count_guardrail pins the variable count and its doc comment records the slot width after each change.
Two of the proposed reductions are in: PREVIOUS/INIT of a single declared element reads the slot directly, and generated equations accept an unambiguous bare element name as a static subscript instead of creating a helper.
A model that does exceed the limit gets a clear compile error suggesting running without LTM (check_layout_addressable), not corrupted output.
Remaining options
If headroom becomes a problem again:
pass each referenced variable's declared dimensions to qualify_element_index so ambiguous bare element names can be resolved by position instead of through a helper;
compile PREVIOUS(module·output) to a direct read of the output's slot.
changed the title [-]ltm: residual ~30k synthesized PREVIOUS helper-aux vars on C-LEARN threaten the VM 65k-slot ceiling[/-][+]ltm: LTM helper variables push C-LEARN toward the VM slot limit[/+]on Oct 12, 2026
clearn_ltm_var_count_guardrail (src/simlin-engine/tests/integration/simulate.rs:7227) pins C-LEARN's LTM variable count at 6,061, down from about 30k, and its doc comment records 30,896 slots against the 65,536 limit. Exceeding the limit is a clean compile error from check_layout_addressable (src/simlin-engine/src/compiler/symbolic.rs:985, called at db/assemble.rs:1628, tested at symbolic.rs:2344).
Activity
[-]ltm: residual ~30k synthesized PREVIOUS helper-aux vars on C-LEARN threaten the VM 65k-slot ceiling[/-][+]ltm: LTM helper variables push C-LEARN toward the VM slot limit[/+]bpowers commentedon Oct 12, 2026
Closing: already fixed on main.
clearn_ltm_var_count_guardrail(src/simlin-engine/tests/integration/simulate.rs:7227) pins C-LEARN's LTM variable count at 6,061, down from about 30k, and its doc comment records 30,896 slots against the 65,536 limit. Exceeding the limit is a clean compile error fromcheck_layout_addressable(src/simlin-engine/src/compiler/symbolic.rs:985, called at db/assemble.rs:1628, tested at symbolic.rs:2344).