Skip to content

Float32 kernel DAE initialization without Float64 (needs SimpleNonlinearSolve 2.14.6) - #562

Merged
ChrisRackauckas merged 3 commits into
masterfrom
gpu-init-float32-trust-region
Oct 16, 2026
Merged

ChrisRackauckas merged 3 commits into
masterfrom
gpu-init-float32-trust-region

Conversation

@ChrisRackauckas

@ChrisRackauckas ChrisRackauckas commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Please ignore this draft until reviewed by @ChrisRackauckas.

Depends on SciML/NonlinearSolve.jl#1342 being merged and SimpleNonlinearSolve 2.14.6 being registered. Until then, CI here cannot resolve dependencies.

What changed and why

In-kernel DAE initialization (ode_solve_kernel / ode_asolve_kernel → gpu_initialization_solve) compiled Float64 into Float32 kernels. oneAPI/SPIR-V rejects that ("Unsupported use of double value"). There were two sources:

  1. SimpleTrustRegion()'s Float64 hyperparameter defaults (upstream). These are fixed in SimpleNonlinearSolve by SimpleTrustRegion: no Float64 defaults so Float32 solves carry no doubles NonlinearSolve.jl#1342. Here, the only change is the compat bump: SimpleNonlinearSolve = "2.14.6". Per review, there's no local workaround.
  2. The fixed-step kernel's 1.0e-6 initialization tolerances (DiffEqGPU's own). These are now eltype(prob.u0)(1.0e-6).

A new test in test/gpu_kernel_de/conversions.jl ("Float32 initialization solve carries no Float64") checks that code_typed(DiffEqGPU.gpu_initialization_solve, Tuple{typeof(prob), Nothing, Float32, Float32}) contains no Float64, and that the init solve succeeds.

Verification

I ran locally in a scratch environment, with this branch and the #1342 branch (SimpleNonlinearSolve 2.14.6) both dev'd.

The new test, with #1342's trust_region.jl reverted (still versioned 2.14.6):

Float32 initialization solve carries no Float64: Test Failed at .../dgpu_item.jl:15
Test Summary:                                   | Pass  Fail  Total
Float32 initialization solve carries no Float64 |    2     1      3

With #1342:

Test Summary:                                   | Pass  Total
Float32 initialization solve carries no Float64 |    3      3

GROUP=CPU (runtests.jl, Julia 1.12.7) against the #1342 branch:

GPU Kernelized Stiff ODE Mass Matrix          |   8   8
GPU Kernelized DAE Mass Matrix                |  84  84
GPU Kernelized Non Stiff ODE Regression       |  50  50
Tsit5 accuracy                                | 144 144
GPU Kernelized Non Stiff ODE DiscreteCallback |  78  78
GPU Kernelized Stiff ODE Regression           |  75  75
GPU Kernelized Stiff ODE DiscreteCallback     |  46  46
GPU Kernelized ForwardDiff tests              |   0      (0 tests on CPU, unchanged)
GPU Kernelized FiniteDiff tests               |   5   5
GPU Kernelized Auto-Conversion tests          |  24  24
Public generic interfaces                     |  35  35
EnsembleGPUArray host concatenation           |   6   6
EnsembleGPUArray scalar batch parameters      |  55  55
Adaptive endpoint termination                 | 132 132
EXIT 0

runic --check is clean. The previous revision passed GROUP=QA (27/27, JET 75/75). This revision only removes code and bumps compat, and I did not re-run QA.

Not verified

For the reviewer to push back on

  • If u0 is ever integer-typed, eltype(u0)(1.0e-6) would throw. Every GPU-kernel ODE path I know of uses float u0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JbJS6cQK5XUwhDpYPQcsM6

(AI-generated: Claude Code cloud session, model claude-opus-5-5, on behalf of @ChrisRackauckas.)


Generated by Claude Code

The in-kernel DAE initialization used `SimpleTrustRegion()` (Float64
hyperparameter defaults) and, in the fixed-step kernel, `1.0e-6` Float64
tolerances. A Float32 problem therefore compiled double loads and
truncations into the kernel, which fp64-less devices (oneAPI) reject with
"Unsupported use of double value". Build the default algorithm with
`eltype(u0)` hyperparameters and convert the fixed-step tolerances.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JbJS6cQK5XUwhDpYPQcsM6

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>

Copy link
Copy Markdown
Member Author

Documentation is red on this PR, but the failure isn't caused by this PR. makedocs stops on :missing_docs for DiffEqGPU.ensemble_param and DiffEqGPU.pack_ordinary_parameters. Both docstrings were added to master in #555, and this PR touches neither function. I reproduced the same two names on unmodified master with a local version of the missing-docs check.

The fix is in its own PR, #563, which turns the two internal-helper docstrings into comments. I kept it separate so this PR stays focused. I didn't re-run the job, since it fails deterministically until #563 is merged.

(AI-generated: Claude Code cloud session, model claude-opus-5-5, on behalf of @ChrisRackauckas.)


Generated by Claude Code

Copy link
Copy Markdown
Member Author

CUDA Tests (Julia 1) is also red, and this PR didn't cause it either. The only error is in test/ensemblegpuarray_scalar_batch.jl:102, a test added in #555: sol.u[end][1] scalar-indexes the CuArray returned by vectorized_map_solve ("Scalar indexing is disallowed", 54 passed / 1 errored). That test was also red on #555 itself. I reproduced it on unmodified master with the JLArrays backend, and fixed it in the same PR as the docs failure: #563 (Array(sol.u[end])[1]). Every other group in that CUDA run passed, including the ones that exercise this PR's change: DAE Mass Matrix (84/84) and Auto-Conversion (24/24, which includes the new Float32 initialization test).

(AI-generated: Claude Code cloud session, model claude-opus-5-5, on behalf of @ChrisRackauckas.)


Generated by Claude Code

T = eltype(initprob.u0)
return SimpleTrustRegion(;
max_trust_radius = zero(T), initial_trust_radius = zero(T),
step_threshold = T(1.0e-4), expand_factor = T(2)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should instead be fixed upstream

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c55fa85. I dropped the initialization_algorithm workaround, so the file is back to master and the kernels pass plain SimpleTrustRegion() again. SimpleNonlinearSolve compat is now 2.14.6, the version that SciML/NonlinearSolve.jl#1342 now bumps to with the upstream fix. The one DiffEqGPU-side change left is the fixed-step kernel's 1.0e-6 initialization tolerances, which are DiffEqGPU's own Float64 literals.

This PR's CI can't resolve until SimpleNonlinearSolve 2.14.6 is registered. Locally, with both branches dev'd, the new test fails without the upstream change (2 pass / 1 fail) and passes with it (3/3). GROUP=CPU passes in full.

(AI-generated: Claude Code cloud session, model claude-opus-5-5, on behalf of @ChrisRackauckas.)


Generated by Claude Code

Per review, drop the Float32-typed `initialization_algorithm` workaround
and require SimpleNonlinearSolve 2.14.6, whose `SimpleTrustRegion()`
defaults carry no Float64 (SciML/NonlinearSolve.jl#1342). The fixed-step
kernel still converts its `1.0e-6` initialization tolerances to
`eltype(u0)`; that Float64 literal is DiffEqGPU's own.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JbJS6cQK5XUwhDpYPQcsM6

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas changed the title Type in-kernel initialization trust-region solve like u0 (no Float64 on oneAPI) Float32 kernel DAE initialization without Float64 (needs SimpleNonlinearSolve 2.14.6) Sep 28, 2026

Copy link
Copy Markdown
Member Author

oneAPI result for the approach. Buildkite build https://buildkite.com/julialang/diffeqgpu-dot-jl/builds/1742 ran on the previous head 3c0c206, which had the local Float32-typed SimpleTrustRegion and the 1.0e-6 tolerance conversion, against released SimpleNonlinearSolve 2.14.5:

  • julia-oneapi-run-tests-on-julia-v1: success
  • julia-oneapi-run-tests-on-julia-v1-dot-10: success
  • Metal v1 and v1.10: success. (The build's overall "failure" comes from the AMDGPU step being cancelled when c55fa85 was pushed.)

Both oneAPI jobs were red on #553 and on master, with "Unsupported use of double value". So making the trust-region hyperparameters and the tolerances Float32 clears oneAPI. The current head gets the same Float32 hyperparameters from upstream (#1342 / SimpleNonlinearSolve 2.14.6) instead of locally. I couldn't read the job logs without a Buildkite login, so this rests on the job status alone.

Every red check on c55fa85 is the same dependency-resolution error: SimpleNonlinearSolve ... restricted to versions 2.14.6 - 2 by DiffEqGPU — no versions left. The General registry is still at 2.14.5.

(AI-generated: Claude Code cloud session, model claude-opus-5-5, on behalf of @ChrisRackauckas.)


Generated by Claude Code

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 16, 2026 10:14
@ChrisRackauckas
ChrisRackauckas merged commit a15a995 into master Oct 16, 2026
13 of 15 checks passed
ChrisRackauckas referenced this pull request Oct 17, 2026
Bump version to 3.21.6
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Agent-Harness: Claude Code 2.1.302
Agent-Model: claude-sonnet-5-5
Claude-Session: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq
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