Skip to content

Rosenbrock23 drops SLArray labels in out-of-place stage broadcast #4178

Description

@ChrisRackauckas-Claude

Reproducer

The LabelledArrays.jl/Core job in RecursiveArrayTools' integration workflow fails on clean RecursiveArrayTools master (88fc415) and current OrdinaryDiffEq packages:

using LabelledArrays, OrdinaryDiffEq, SciMLBase

LorenzVector = @SLArray (3,) (:x, :y, :z)
LorenzParameterVector = @SLArray (3,) (, , )

function f(u, p, t)
    x = p.σ * (u.y - u.x)
    y = u.x * (p.ρ - u.z) - u.y
    z = u.x * u.y - p.β * u.z
    return LorenzVector(x, y, z)
end

u0 = LorenzVector(1.0, 0.0, 0.0)
p = LorenzParameterVector(10.0, 28.0, 8 / 3)
solve(ODEProblem(f, u0, (0.0, 10.0), p), Rosenbrock23())
FieldError: type StaticArraysCore.SizedArray has no field `y`, available fields: `data`
  [1] f(u::StaticArraysCore.SizedVector{3, Float64, Vector{Float64}}, ...)
  [2] perform_step!(..., ::Rosenbrock23ConstantCache, ...)

Failing clean-master runs:

I reproduced the same error locally from a detached clean RecursiveArrayTools master checkout and a fresh LabelledArrays master checkout.

Regression range

The last green integration run on 2026-07-24 resolved OrdinaryDiffEq 7.1.3 / OrdinaryDiffEqRosenbrock 2.4.2. The first failing run on 2026-08-03 resolved OrdinaryDiffEq 7.2.1 / OrdinaryDiffEqRosenbrock 2.6.3.

Running the old RecursiveArrayTools source (8d8c6a2, used by the last green run) against today's resolver still fails identically, so this is not a RecursiveArrayTools source regression.

OrdinaryDiffEq commit 100fe2369 (#3996) is the relevant source transition: it changed the Rosenbrock constant-cache linear-solve result from a generic reshape to ArrayInterface.restructure(uprev, ...). With an SLArray template today:

r = ArrayInterface.restructure(u0, ones(3))
typeof(r)            # LArray{...}
typeof(r * 2)        # LArray{...}
typeof(u0 .+ r)      # SizedVector{3, ...}
typeof(u0 + r)       # SLArray{...}

The constant cache then computes tmp = @.. uprev + dto2 * k₁; FastBroadcast drops the labels and passes the resulting SizedVector to f.

This is related to wrapper preservation in #4101 and JuliaArrays/ArrayInterface.jl#498, but those changes cover AD tracked arrays, not static labelled arrays. A fix should preserve the state container at every out-of-place Rosenbrock stage and add this LabelledArrays solve as a regression test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions