-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
Description
MWE on v1.11:
using OrdinaryDiffEq, LinearAlgebra, ForwardDiff
# The exact minimal case that causes infinite loop
n = 5
u0 = ones(n)
function f!(du, u, p, t)
du .= p * u
end
# The key: Tridiagonal jac_prototype
jac_proto = Tridiagonal(zeros(n-1), zeros(n), zeros(n-1))
# This is the exact pattern that causes the infinite loop
function solve_with_tridiagonal(p)
prob = ODEProblem(ODEFunction(f!, jac_prototype=jac_proto), u0, (0.0, 0.1), p)
sol = solve(prob, Rodas4P(), saveat=0.1)
return sum(sol[end])
end
println("Direct solve works:")
result = solve_with_tridiagonal(1.0)
println("Result: ", result)
println("\nNow attempting ForwardDiff.derivative...")
println("This will cause infinite loop during compilation/type inference")
# This is the minimal case that infinite loops
ForwardDiff.derivative(solve_with_tridiagonal, 1.0)
[48497] signal 3: Quit: 3
apply_cl at .../julia-release-1-dot-11/src/flisp/flisp.c:1060
...
ijl_code_for_staged at .../julia-release-1-dot-11/src/method.c:666
get_staged at ./compiler/utilities.jl:123
retrieve_code_info at ./compiler/utilities.jl:135 [inlined]
InferenceState at ./compiler/inferencestate.jl:497
typeinf_edge at ./compiler/typeinfer.jl:913
...