Skip to content

Normalize Mooncake promote_f tuple tangents - #4242

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-mooncake-promote-f-tangent
Aug 22, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/fix-mooncake-promote-f-tangent

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed

Mooncake represents the tangent and forward data for a tuple whose fields are both nondifferentiable as a single NoTangent / NoFData, not as a two-element tuple. The promote_f rules added in #4201 always constructed the latter, so FullSpecialize solves failed a generated type assertion before integration.

This normalizes the two nondifferentiable fields to Mooncake's collapsed representation in both the reverse and forward rules, while preserving tuple representation when either field carries data. The regression test covers both Mooncake gradient and scalar derivative paths through a FullSpecialize solve.

Verification

Julia 1.12.6, current upstream master 293f1195207aa66a9416be563297f05f13a53c61.

Failing before, clean master:

GROUP=AD julia +release --startup-file=no --project=. -e 'using Pkg; Pkg.test(coverage=false)'

The first phases passed, then the existing discrete-adjoint gradient errored:

AD Tests              | 28299 passed
Autodiff Events Tests | 5 passed, 1 existing broken
TypeError: expected CoDual{Tuple{ODEFunction{FullSpecialize...}, NullParameters}, NoFData},
got CoDual{Tuple{ODEFunction{FullSpecialize...}, NullParameters}, Tuple{NoFData, NoFData}}
Discrete Adjoint Tests | 1 error / 1 total

Passing after:

GROUP=AD julia +release --startup-file=no --project=. -e 'using Pkg; Pkg.test(coverage=false)'
AD Tests               | 28299/28299 passed
Autodiff Events Tests  | 5 passed, 1 existing broken
Discrete Adjoint Tests | 4/4 passed
Testing OrdinaryDiffEq tests passed
GROUP=QA julia +release --startup-file=no --project=. -e 'using Pkg; Pkg.test(coverage=false)'
Quality Assurance Tests | 90/90 passed
Testing OrdinaryDiffEq tests passed

DiffEqBase QA also passed 9/9. Runic, typos over the diff, and git diff --check passed.

No public API or documentation changed, so I did not run the docs build.

Not verified

I did not run Julia LTS/pre-release, GPU, or downstream package groups locally.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/fix-mooncake-promote-f-tangent branch from b89414a to d1f8288 Compare August 20, 2026 19:25
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 22, 2026 07:31
@ChrisRackauckas
ChrisRackauckas merged commit c7941ed into SciML:master Aug 22, 2026
116 of 136 checks passed
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