Skip to content

Test that fuse_broadcasts reaches the DAE residual codegen - #5283

Draft
xtalax wants to merge 3 commits into
SciML:masterfrom
xtalax:fuse-broadcasts-test
Draft

xtalax wants to merge 3 commits into
SciML:masterfrom
xtalax:fuse-broadcasts-test

Conversation

@xtalax

@xtalax xtalax commented Oct 16, 2026

Copy link
Copy Markdown
Member

This PR only adds a test; no source changes. DAEProblem, DAEFunction and generate_rhs already pass keywords they don't consume into Symbolics.CodegenFunctionOptions, and process_kwargs filters them out of the solver keywords. So DAEProblem(sys, op, tspan; fuse_broadcasts = true) turns on SymbolicUtils' fused broadcast codegen as soon as Symbolics has that option. This test pins that path.

What it checks, on a 32-state array DAE:

  • The generated residual is never fused by default.
  • It is fused with fuse_broadcasts = true exactly when Symbolics has the field and SymbolicUtils defines Code.FUSE_BROADCASTS_KEY.
  • The fused residual is bitwise equal to the unfused one.

On registered Symbolics and SymbolicUtils the keyword is ignored and the test checks only that nothing changes, so it passes before the dependencies are released.

Depends on:

Verified: 4/4 locally on this branch, with ModelingToolkitBase from SciML master @ 9082f85, Symbolics#2103 @ 0d4f2049 and SymbolicUtils#1161 @ a4505986, so fusion was on.

Downstream user: SciML/MethodOfLines.jl#722, the FDTD residuals.

🤖 Posted by an AI agent · harness: Claude Code 2.1.302 · model: claude-opus-5-5
Review: unreviewed
Session: aa65e380-52df-443a-9f57-8c20c56babb9

xtalax and others added 3 commits October 16, 2026 22:55
DAEProblem, DAEFunction and generate_rhs already pass keywords they do not
consume into Symbolics.CodegenFunctionOptions, and process_kwargs filters
them out of the problem's solver keywords. So
DAEProblem(sys, op, tspan; fuse_broadcasts = true) turns on SymbolicUtils'
fused broadcast codegen once Symbolics has the fuse_broadcasts option, with
no source change here.

The test pins that path: the generated residual contains fused broadcasts
exactly when Symbolics and SymbolicUtils support them, never by default,
and the fused residual is bitwise equal to the unfused one.

Agent-Harness: Claude Code 2.1.302
Agent-Model: claude-opus-5-5
Agent-Session: aa65e380-52df-443a-9f57-8c20c56babb9
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Conflict in lib/ModelingToolkitBase/test/array_equation_dae.jl: both sides appended a testset at the end of the file; kept both (the fuse_broadcasts testset from this PR and master's mixed array initial parameters testset).

Agent-Harness: Claude Code 2.1.312
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
Keep both testsets in array_equation_dae.jl: upstream's one-element slice
test and this PR's fuse_broadcasts test.

Agent-Harness: Claude Code 2.1.325
Agent-Model: claude-sonnet-5-5
Agent-Session: de59b94f-0227-49ea-adb5-b158639dad0b
Agent-Review: unreviewed
Co-authored-by: Claude Code <agent@noreply.juliahub.com>
@xtalax-droid

Copy link
Copy Markdown
Contributor

Pushed 4fef7fa905 (merge of current master, after #5274). The only conflict was in array_equation_dae.jl, where both sides added a testset; both are kept, since the fuse_broadcasts test is distinct from the one-element-slice test. array_equation_dae.jl passes (12 testsets) and Codex review approved with no findings.


🤖 Posted by an AI agent · harness: Claude Code 2.1.325 · model: claude-sonnet-5-5
Review: unreviewed
Session: de59b94f-0227-49ea-adb5-b158639dad0b

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.

2 participants