Generate device-compatible FullSpecialize initialization maps - #5045
Generate device-compatible FullSpecialize initialization maps#5045ChrisRackauckas-Claude wants to merge 7 commits into
Conversation
|
Plan/status: generate single dropped-body RuntimeGeneratedFunctions only for explicit FullSpecialize; preserve AutoSpecialize and AutoDespecialize behavior; verify map structure and output against existing maps; run Initialization and local hygiene checks; track the independently reproduced upstream/master QA failures in the required parallel investigation before final handoff. |
|
CI Runic failure is pre-existing formatter-version drift in three files untouched by this PR. The mechanical cleanup is isolated in draft PR #5046. This feature PR should be rebased after that cleanup lands; no formatting-only changes will be mixed into this behavior diff. |
|
Follow-up: the isolated formatting PR #5046 now passes CI Runic, Runic Suggestions, and spelling. This confirms the formatter failure here is resolved by that base cleanup rather than a change to this feature diff. |
|
Follow-up commit |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
b325660 to
d3c8a49
Compare
|
Added array-valued callable-parameter support in d3c8a49. Failure on the preceding implementation ( The same namespaced The complete ModelingToolkitNeuralNets suite also passes against this branch (10 + 1 + 37 + 55 + 7 passing assertions, with its 2 pre-existing broken tests). This directly covers the |
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
|
CI exposed a mutable-buffer regression in the first generated-parameter implementation: https://github.com/SciML/ModelingToolkit.jl/actions/runs/33355753893/job/99377920719 failed six Fixed in 93854e0 by selecting Local verification after the fix: |
Use SizedVector-backed storage when a mutable FullSpecialize parameter buffer contains non-isbits values, while retaining MVector for isbits element types. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
|
Commit 613bdd1 fixes the non-isbits mutable-buffer regression found by the FMI LTS job: https://github.com/SciML/ModelingToolkit.jl/actions/runs/33358934228/job/99386604733. Failing before (CI): Passing after (local): Runic 1.10, typos over the diff, and |
Assert the declared array shape instead of the SymbolicIndexingInterface classification enum, which differs across supported dependency versions while the generated map behavior remains identical. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
|
Commit 010bc30 addresses the downgraded Initialization failure: https://github.com/SciML/ModelingToolkit.jl/actions/runs/33366256108/job/99407718377. The failed job used SymbolicIndexingInterface 0.3.46, where the callable parameter is classified as Local Julia 1.10 reproduction pinned the relevant CI floors (ArrayInterface 7.28.0, SciMLBase 3.48.0, StaticArraysCore 1.4.3, SymbolicUtils 4.37.0, SymbolicIndexingInterface 0.3.46, Symbolics 7.37.0): The same semantic assertions also pass |
Read the callable parameter shape from SymbolicUtils directly so the regression works across supported versions that do not re-export shape through ModelingToolkitBase. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: OpenAI Codex <noreply@openai.com> Agent-Harness: Codex (version unknown) Agent-Model: unknown Agent-Session: local session ID 01a04feb-43da-7ce1-99e4-a68438c69833
|
Follow-up commit 258f72c fixes the remaining downgrade error from https://github.com/SciML/ModelingToolkit.jl/actions/runs/33387712747/job/99474377835. SymbolicUtils 4.37 provides Exact CI-floor local result after using the owner API: The current-stack owner-API shape assertions pass |
|
CI confirmation on head 258f72c:
At this update, 38 checks pass, 66 remain in progress, 2 known base checks fail, and 1 is skipped. No completed branch-relevant check fails. |
Ignore this PR until it has been reviewed by @ChrisRackauckas.
What changed and why
Explicit
FullSpecializeproblem construction now generates each initialization state/parameter transfer map as oneRuntimeGeneratedFunction. The generated maps drop their expression bodies, use static output buffers, and avoid capturing the dynamicInitializationMap/closure graph that blocked device-compatible problem capture in #5043.The AutoSpecialize/AutoDespecialize path is unchanged. Specialization is propagated through
NonlinearLeastSquaresProblemandSteadyStateProblemconstruction, and the generated parameter map handlesDiffCache, immutable nonnumeric buffers, and array-valued callable parameters such as the namespaced Lux function used by ModelingToolkitNeuralNets.Verification
Failing before
On unmodified
upstream/masteratf9131984d9, the issue reproducer reported:The new regression predicates therefore failed before the implementation: the state map was neither a
RuntimeGeneratedFunctionnor isbits and retained the dynamic wrapper graph.The existing
DiffCacheregression initially discriminated two parameter-map bugs. Before support was added it failed with:After removing that rejection but before correcting immutable nonnumeric-buffer reconstruction, it failed with:
The latter came from querying
fieldtype(C, i)while reconstructingN; this PR queriesfieldtype(N, i).The namespaced array-valued callable reproducer on the prior feature commit
b3256600f9failed with:That is the same storage shape exercised by ModelingToolkitNeuralNets'
lux_applyparameter.Passing after
The focused issue regression executes both generated maps and checks their types, dropped expression bodies, static outputs, and equality with AutoSpecialize output:
The array-valued callable regression passes and confirms that the generated parameter map preserves the exact function object:
The existing
DiffCachegradient test passes:The rebased Initialization group was run through the repository's ModelingToolkitBase test runner using the resolved package-test environment:
The complete ModelingToolkitNeuralNets test suite against this branch passed:
Local hygiene checks completed with exit code 0 and no findings:
Known base-branch failures
GROUP=InterfaceIIpassed the corrected IndexCache test, then reached the independently failingSDEs + jumps with symbolic tstopstest:A clean-base reproduction and bisect identified the ModelingToolkit dependency-widening commit and reduced the doubled callback to a standalone non-MTK reproducer. It is tracked at SciML/OrdinaryDiffEq.jl#4439. InterfaceII is not claimed as passing.
Root QA on the rebased branch passed 19/20 checks. Its only failure was the same clean-base public-reexport drift (
Unknown,scalarize,shape,unwrap); method ambiguity, dependency, compat, piracy, ExplicitImports, and public-documentation checks passed. ModelingToolkitBase QA separately retains the known 263 JET findings tracked at #4958. QA is not claimed as passing.CI-detected mutable-buffer regression
The first CI run found that generated
SVectorparameter buffers broke the existing mutating SciMLStructures interface:Commit 93854e0 preserves static sizing while selecting
MVectorfor mutable isbits prototypes,SizedVectorfor mutable non-isbits prototypes, andSVectorfor immutable prototypes. The focused tunable/constantreplace!reproducer exits successfully, and the full group now reports:CI-detected non-isbits mutable-buffer regression
The subsequent FMI LTS job exercised mutable parameter buffers containing vectors and FMI functors.
MVectorcannot implementsetindex!for non-isbits element types, so the two co-simulation cases failed before commit 613bdd1:The helper now selects immutable
SVectorstorage, mutableMVectorstorage for isbits elements, and mutableSizedVectorstorage backed byVectorfor non-isbits elements. The exact FMI group now passes locally:The final Initialization group also passes:
\n## Not verified
RuntimeGeneratedFunction, isbits map object, dropped body, and static buffers).Fixes #5043.
Related downstream workaround: SciML/DiffEqGPU.jl#516.
🤖 Generated with Codex (version unknown) (model: unknown). Session: local session ID
01a04feb-43da-7ce1-99e4-a68438c69833.