From abc9d72cf2338d51ae702812a14a2fa7fe517011 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Thu, 21 May 2026 06:51:09 -0400 Subject: [PATCH] Enable Enzyme SCC test on Julia 1.11+ (fixed by Enzyme 0.13.148) The IllegalTypeAnalysisException / SCCNonlinearProblem segfault that gated this test on `VERSION < v"1.11"` is fixed in Enzyme 0.13.148 (closes EnzymeAD/Enzyme.jl#3026). Verified `Enzyme.gradient` over the SCC loss returns the correct gradient on Julia 1.12.6. Leaves the comment about the vector-based SCC heterogeneous-function limitation (Enzyme.jl#3021) since that's a separate API question, not a Julia-version issue. Co-Authored-By: Chris Rackauckas --- test/scc_nonlinearsolve.jl | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/test/scc_nonlinearsolve.jl b/test/scc_nonlinearsolve.jl index 247033f18..08e552fbf 100644 --- a/test/scc_nonlinearsolve.jl +++ b/test/scc_nonlinearsolve.jl @@ -70,22 +70,11 @@ p_test = [4.0, 3.0] @test isapprox(fwd, fd, rtol = 0.05) end - # Enzyme through Tuple-based SCCNonlinearProblem now works reliably on - # Julia 1.10 (verified across 40+ consecutive runs with the current - # SCCNonlinearSolve, NonlinearSolveBase, and Enzyme releases). On Julia - # 1.11+, Enzyme still hits an `IllegalTypeAnalysisException` on - # `Base._typed_vcat!` inside SCCNonlinearSolve's solution assembly, - # which segfaults the worker process — gate the test on the LTS until - # the upstream Enzyme/NonlinearSolve issues are fixed. # Vector-based SCC remains unsupported because heterogeneous function # types get erased to Any. See Enzyme.jl#3021. @testset "Enzyme" begin - if VERSION < v"1.11" - enz = Enzyme.gradient(Enzyme.Reverse, loss, copy(p_test)) - @test isapprox(collect(enz[1]), fd, rtol = 0.05) - else - @test_skip true - end + enz = Enzyme.gradient(Enzyme.Reverse, loss, copy(p_test)) + @test isapprox(collect(enz[1]), fd, rtol = 0.05) end @testset "Mooncake" begin