Propagate ParameterArrayAssignments to SCC subsystems#4698
Merged
AayushSabharwal merged 2 commits intoJul 1, 2026
Merged
Conversation
The parameter array-variable decomposition computed by `compute_array_variable_buffer_idxs` is, like the parameter reordering, a pure function of the shared parameter layout. Compute the param-only decomposition once and propagate it to every SCC subsystem. The per-SCC callers (`generate_rhs`, `generate_update_A`, `generate_update_b`) append `cachesyms` as a suffix of the parameter slice, so the cache stores only the parameter buffers and `build_function_wrapper` decomposes the (small) cachesym tail on top of the cached result, shifting its slice-relative buffer indices past the parameter buffers. The callers pass `n_param_buffers` (the number of `reorder_parameters` buffers before the cachesyms) to mark the boundary. cachesyms are prior-SCC unknowns / CSE temporaries -- never array parameters -- so their array-variable keyset is disjoint from the parameters', making the split identical to decomposing the whole slice.
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.
This PR is on top of #4697 because it is kind of the same idea. The difference here is that we need to do a little bit of bookkeeping to keep track of the extra
cachesymsthat each subsystem appends.This takes
ODEProblemconstruction for a somewhat large model fromto
AI-generated commit message:
🤖
The parameter array-variable decomposition computed by
compute_array_variable_buffer_idxsis, like the parameter reordering, a purefunction of the shared parameter layout. Compute the param-only decomposition
once and propagate it to every SCC subsystem.
The per-SCC callers (
generate_rhs,generate_update_A,generate_update_b)append
cachesymsas a suffix of the parameter slice, so the cache stores onlythe parameter buffers and
build_function_wrapperdecomposes the (small)cachesym tail on top of the cached result, shifting its slice-relative buffer
indices past the parameter buffers. The callers pass
n_param_buffers(thenumber of
reorder_parametersbuffers before the cachesyms) to mark theboundary. cachesyms are prior-SCC unknowns / CSE temporaries -- never array
parameters -- so their array-variable keyset is disjoint from the parameters',
making the split identical to decomposing the whole slice.