Skip to content

Forward reassemble_alg through generate_control_function - #5260

Draft
ChrisRackauckas-Claude wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-5255-control-function-options
Draft

ChrisRackauckas-Claude wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix-5255-control-function-options

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

generate_control_function accepted reassemble_alg without error, but the keyword was packaged into Symbolics.CodegenFunctionOptions and never reached the internal mtkcompile call. This change takes reassemble_alg as an explicit keyword (like simplify/split) and forwards it when compiling an unscheduled system, so linear algebraic loops can be eliminated the same way as with a direct mtkcompile(...; reassemble_alg).

Failing before (src stashed)

Test Summary:                                     | Pass  Fail  Error  Total   Time
generate_control_function forwards reassemble_alg |    2     1      1      4  27.8s

Failure: isequal(dvs, [x]) evaluated [x(t), y(t)]; only(f(...)) then errored (multi-element).

Passing after (with fix)

Test Summary:                                     | Pass  Total   Time
generate_control_function forwards reassemble_alg |    4      4  23.5s

Test group / targeted run

Ran the owning test file lib/ModelingToolkitBase/test/input_output_handling.jl via a scratch env that develops this checkout (group InterfaceI owns this file). Exit 0; new testset 4/4. Runic --check and typos on the three touched files: exit 0.

CI triage (PR vs master; not caused by this PR)

Branch is 0 commits behind master (fd0cbadb43). Diff touches only generate_control_function + its regression test. Fetched failing job logs via gh api .../actions/jobs/<id>/logs, stripped ANSI, and compared signatures to master's recent runs.

Failure class PR jobs Actual error Verdict / evidence
InterfaceI (Julia 1 + lts) sublibrary-ci MTKBase InterfaceI variable_parsing.jl:66 — ArgumentError: Variable x must have default of matching size. Got [1, 2] Pre-existing / Symbolics. Identical on master Sublibrary CI run 37486847188 job 112352183435. Local probe on this PR: same ArgumentError. Untouched by this diff.
Extended (Julia 1 + lts) sublibrary-ci MTKBase Extended ccompile.jl:11 — CTarget with expression=Val{false} is not supported Pre-existing / Symbolics. Identical on master job 112352182552. Local probe: same ArgumentError. Untouched by this diff.
RegressionI (Julia 1 + lts) sublibrary-ci MTKBase RegressionI latexify.jl:68 — ReferenceTests needs JULIA_REFERENCETESTS_UPDATE Pre-existing / reference drift. Identical on master job 112352182774. Untouched by this diff.
Optimization (sublibrary + top-level Tests, Julia 1 + lts; downgrade-mtkbase Optimization) several optimizationsystem.jl:814 AmplNLWriter BoundsError (1-element Vector{Expr} at [2]); :874 iprob.f.cons_expr.exprs === nothing fails Pre-existing. Identical on master Tests run 37488901413 job 112358564208 (same lines/errors). Untouched by this diff.
Benchmarks (lts; 1 cancelled) Benchmarks failed to clone ... GitError(... early EOF) Environmental network/git clone on runner.
SciMLBase.jl/SymbolicIndexingInterface/1/ IntegrationTest SCCNonlinearProblem has no field u0 inside SciMLBase tests Downstream / unrelated to this PR's MTKBase change.

No PR-caused CI failure found; no additional code change. Our regression reconfirmed locally after triage: 4/4 pass.

Opus review: MERGE, low risk (reviews/opus-1007-5260/REVIEW.md).

What I did NOT verify

  • Full GROUP=InterfaceI / Pkg.test() suite for ModelingToolkitBase or the top-level package (CI runs them; failing subsets above are master-shared).
  • Downstream ControlSystemsMTK / named_ss integration beyond the issue's algebraic-loop example.
  • Forwarding of other mtkcompile keywords beyond reassemble_alg.

Reviewer pushback

  • Whether other structural-simplification kwargs should also be peeled out of the codegen kwargs... dump rather than only reassemble_alg.
  • Whether nothing as the default sentinel is preferable to always constructing DefaultReassembleAlgorithm().

Fixes #5255

Please ignore this draft until reviewed by @ChrisRackauckas.

Risk assessment

pending independent review

🤖 Generated with Cursor Agent CLI 2026.10.01-14929f9 (model: auto), transcript /log.txt

Risk assessment (independent review, Claude Code 2.1.301 claude-opus-5-5, reviewed head 36b63ae)


🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5 (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq

ChrisRackauckas and others added 2 commits October 7, 2026 12:07
Previously the keyword was accepted via kwargs but swallowed by
CodegenFunctionOptions, so linear algebraic loops were not eliminated.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/jobs/fix-ModelingToolkit.jl-5255/log.txt on amdci2.julia.csail.mit.edu

This branch has not been deployed

No deployments
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.

generate_control_function does not pass options of the structural simplification (reassemble_alg) to mtkcompile

2 participants