Closed gdalle closed 2 months ago
@gdalle let's see if this resolves it: https://github.com/EnzymeAD/Enzyme.jl/pull/1403
Still failing but with one less error (48 instead of 49):
(jl_SISGSX) pkg> st
Status `/tmp/jl_SISGSX/Project.toml`
[7da242da] Enzyme v0.12.0 `https://github.com/EnzymeAD/Enzyme.jl#main`
julia> using JET, Enzyme
julia> @test_opt Enzyme.gradient(Enzyme.Reverse, sum, [1.0])
JET-test failed at REPL[13]:1
Expression: #= REPL[13]:1 =# JET.@test_opt Enzyme.gradient(Enzyme.Reverse, sum, [1.0])
═════ 48 possible errors found ═════
┌ gradient(::ReverseMode{false, FFIABI, false}, f::typeof(sum), x::Vector{Float64}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:932
│┌ active_reg_inner(::Type{Vector{Float64}}, seen::Tuple{}, world::Nothing, ::Val{true}) @ Enzyme.Compiler /home/guillaume/.julia/packages/Enzyme/y2lVn/src/compiler.jl:367
││┌ active_reg_inner(::Type{Vector{Float64}}, seen::Tuple{}, world::Nothing, ::Val{true}, ::Val{false}) @ Enzyme.Compiler /home/guillaume/.julia/packages/Enzyme/y2lVn/src/compiler.jl:367
│││ captured variable `seen` detected
││└────────────────────
││┌ active_reg_inner(::Type{Vector{Float64}}, seen::Tuple{}, world::Nothing, ::Val{true}, ::Val{false}) @ Enzyme.Compiler /home/guillaume/.julia/packages/Enzyme/y2lVn/src/compiler.jl:367
│││ captured variable `recur` detected
││└────────────────────
┌ gradient(::ReverseMode{false, FFIABI, false}, f::typeof(sum), x::Vector{Float64}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:937
│┌ make_zero(prev::Vector{Float64}) @ EnzymeCore /home/guillaume/.julia/packages/EnzymeCore/Z0CgU/src/EnzymeCore.jl:237
││┌ make_zero(prev::Vector{Float64}, ::Val{false}) @ EnzymeCore /home/guillaume/.julia/packages/EnzymeCore/Z0CgU/src/EnzymeCore.jl:237
│││┌ make_zero(::Type{Vector{Float64}}, seen::IdDict{Any, Any}, prev::Vector{Float64}, ::Val{false}) @ Enzyme.Compiler /home/guillaume/.julia/packages/Enzyme/y2lVn/src/compiler.jl:1190
││││ runtime dispatch detected: convert(::Vector{Float64}, %15::Any)::Vector{Float64}
│││└────────────────────
┌ gradient(::ReverseMode{false, FFIABI, false}, f::typeof(sum), x::Vector{Float64}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:938
│┌ autodiff(mode::ReverseMode{false, FFIABI, false}, f::typeof(sum), ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:287
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:166
│││┌ same_or_one(args::Vararg{Any}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:97
││││ runtime dispatch detected: (%1::Any Enzyme.:(==) -1)::Any
│││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:273
│││┌ default_adjoint(T::Type) @ Enzyme.Compiler /home/guillaume/.julia/packages/Enzyme/y2lVn/src/compiler.jl:5260
││││┌ string(::String, ::Type, ::String) @ Base ./strings/io.jl:189
│││││┌ print_to_string(::String, ::Type, ::String) @ Base ./strings/io.jl:148
││││││┌ print(io::IOBuffer, x::Type) @ Base ./strings/io.jl:35
│││││││┌ show(io::IOBuffer, x::Type) @ Base ./show.jl:953
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:956
│││││││││┌ show_type_name(io::IOBuffer, tn::Core.TypeName) @ Base ./show.jl:1043
││││││││││┌ show(io::IOBuffer, m::Module) @ Base ./show.jl:1237
│││││││││││┌ is_root_module(m::Module) @ Base ./lock.jl:269
││││││││││││┌ sprint(f::typeof(show), args::String; context::Any, sizehint::Integer) @ Base ./strings/io.jl:108
│││││││││││││┌ kwcall(::NamedTuple{(:sizehint,), <:Tuple{Integer}}, ::Type{IOBuffer}) @ Base ./iobuffer.jl:106
││││││││││││││┌ pairs(nt::NamedTuple) @ Base.Iterators ./iterators.jl:279
│││││││││││││││┌ (Base.Pairs{Symbol})(data::NamedTuple, itr::Tuple{Vararg{Symbol}}) @ Base ./essentials.jl:343
││││││││││││││││┌ eltype(::Type{A} where A<:NamedTuple) @ Base ./namedtuple.jl:237
│││││││││││││││││┌ nteltype(::Type{NamedTuple{names, T}} where names) where T<:Tuple @ Base ./namedtuple.jl:239
││││││││││││││││││┌ eltype(t::Type{<:Tuple{Vararg{E}}}) where E @ Base ./tuple.jl:208
│││││││││││││││││││┌ _compute_eltype(t::Type{<:Tuple{Vararg{E}}} where E) @ Base ./tuple.jl:231
││││││││││││││││││││┌ afoldl(op::Base.var"#54#55", a::Any, bs::Vararg{Any}) @ Base ./operators.jl:544
│││││││││││││││││││││┌ (::Base.var"#54#55")(a::Any, b::Any) @ Base ./tuple.jl:235
││││││││││││││││││││││┌ promote_typejoin(a::Any, b::Any) @ Base ./promotion.jl:172
│││││││││││││││││││││││┌ typejoin(a::Any, b::Any) @ Base ./promotion.jl:127
││││││││││││││││││││││││ runtime dispatch detected: Base.UnionAll(%403::Any, %405::Any)::Any
│││││││││││││││││││││││└────────────────────
││││││││││││││││││││┌ afoldl(op::Base.var"#54#55", a::Any, bs::Vararg{Any}) @ Base ./operators.jl:545
│││││││││││││││││││││┌ (::Base.var"#54#55")(a::Type, b::Any) @ Base ./tuple.jl:235
││││││││││││││││││││││┌ promote_typejoin(a::Type, b::Any) @ Base ./promotion.jl:172
│││││││││││││││││││││││┌ typejoin(a::Type, b::Any) @ Base ./promotion.jl:127
││││││││││││││││││││││││ runtime dispatch detected: Base.UnionAll(%398::Any, %400::Any)::Any
│││││││││││││││││││││││└────────────────────
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:958
│││││││││┌ show_typealias(io::IOBuffer, x::Type) @ Base ./show.jl:793
││││││││││┌ make_typealias(x::Type) @ Base ./show.jl:603
│││││││││││┌ modulesof!(s::Set{Module}, x::Type) @ Base ./show.jl:578
││││││││││││ runtime dispatch detected: Base.modulesof!(s::Set{Module}, %20::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ modulesof!(s::Set{Module}, x::Type) @ Base ./show.jl:579
││││││││││││ runtime dispatch detected: Base.modulesof!(s::Set{Module}, %35::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ modulesof!(s::Set{Module}, x::TypeVar) @ Base ./show.jl:572
││││││││││││ runtime dispatch detected: Base.modulesof!(s::Set{Module}, %1::Any)::Set{Module}
│││││││││││└────────────────────
│││││││││┌ show_typealias(io::IOBuffer, x::Type) @ Base ./show.jl:796
││││││││││┌ show_typealias(io::IOBuffer, name::GlobalRef, x::Type, env::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:743
│││││││││││┌ show_typeparams(io::IOContext{IOBuffer}, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:707
││││││││││││┌ show(io::IOContext{IOBuffer}, tv::TypeVar) @ Base ./show.jl:2737
│││││││││││││┌ (::Base.var"#show_bound#566")(io::IOContext{IOBuffer}, b::Any) @ Base ./show.jl:2729
││││││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, b::Any)::Any
│││││││││││││└────────────────────
│││││││││││┌ show_typeparams(io::IOContext{IOBuffer}, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:702
││││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, %243::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ show_typeparams(io::IOContext{IOBuffer}, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:705
││││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, %294::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ show_typeparams(io::IOContext{IOBuffer}, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:710
││││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, %192::Any)::Any
│││││││││││└────────────────────
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:961
│││││││││┌ show_datatype(io::IOBuffer, x::DataType) @ Base ./show.jl:1077
││││││││││┌ show_datatype(io::IOBuffer, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1080
│││││││││││┌ maybe_kws_nt(x::DataType) @ Base ./show.jl:1068
││││││││││││ runtime dispatch detected: eltype(%79::DataType)::Any
│││││││││││└────────────────────
││││││││││┌ show_datatype(io::IOBuffer, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1130
│││││││││││┌ show_typeparams(io::IOBuffer, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:707
││││││││││││┌ show(io::IOBuffer, tv::TypeVar) @ Base ./show.jl:2737
│││││││││││││┌ (::Base.var"#show_bound#566")(io::IOBuffer, b::Any) @ Base ./show.jl:2729
││││││││││││││ runtime dispatch detected: show(io::IOBuffer, b::Any)::Any
│││││││││││││└────────────────────
│││││││││││┌ show_typeparams(io::IOBuffer, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:702
││││││││││││ runtime dispatch detected: show(io::IOBuffer, %241::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ show_typeparams(io::IOBuffer, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:705
││││││││││││ runtime dispatch detected: show(io::IOBuffer, %291::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ show_typeparams(io::IOBuffer, env::Core.SimpleVector, orig::Core.SimpleVector, wheres::Vector{TypeVar}) @ Base ./show.jl:710
││││││││││││ runtime dispatch detected: show(io::IOBuffer, %191::Any)::Any
│││││││││││└────────────────────
││││││││││┌ show_datatype(io::IOBuffer, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1096
│││││││││││ runtime dispatch detected: show(io::IOBuffer, %94::Any)::Any
││││││││││└────────────────────
││││││││││┌ show_datatype(io::IOBuffer, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1102
│││││││││││ runtime dispatch detected: show(io::IOBuffer, %141::Any)::Any
││││││││││└────────────────────
││││││││││┌ show_datatype(io::IOBuffer, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1106
│││││││││││ runtime dispatch detected: show(io::IOBuffer, %162::Any)::Any
││││││││││└────────────────────
││││││││││┌ show_datatype(io::IOBuffer, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1116
│││││││││││ runtime dispatch detected: Base.show_at_namedtuple(io::IOBuffer, %219::Tuple, %220::DataType)::Any
││││││││││└────────────────────
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:964
│││││││││┌ show_unionaliases(io::IOBuffer, x::Union) @ Base ./show.jl:884
││││││││││┌ make_typealiases(x::Union) @ Base ./show.jl:805
│││││││││││┌ modulesof!(s::Set{Module}, x::Union) @ Base ./show.jl:578
││││││││││││ runtime dispatch detected: Base.modulesof!(s::Set{Module}, %3::Any)::Any
│││││││││││└────────────────────
│││││││││││┌ modulesof!(s::Set{Module}, x::Union) @ Base ./show.jl:579
││││││││││││ runtime dispatch detected: Base.modulesof!(s::Set{Module}, %17::Any)::Any
│││││││││││└────────────────────
│││││││││┌ show_unionaliases(io::IOBuffer, x::Union) @ Base ./show.jl:897
││││││││││ runtime dispatch detected: show(io::IOBuffer, %50::Any)::Any
│││││││││└────────────────────
│││││││││┌ show_unionaliases(io::IOBuffer, x::Union) @ Base ./show.jl:903
││││││││││ runtime dispatch detected: Base.show_typealias(io::IOBuffer, %133::Any, x::Union, %131::Core.SimpleVector, %132::Vector{TypeVar})::Any
│││││││││└────────────────────
│││││││││┌ show_unionaliases(io::IOBuffer, x::Union) @ Base ./show.jl:911
││││││││││ runtime dispatch detected: Base.show_typealias(io::IOBuffer, %179::Any, x::Union, %177::Core.SimpleVector, %178::Vector{TypeVar})::Any
│││││││││└────────────────────
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:968
│││││││││┌ show_delim_array(io::IOBuffer, itr::Vector{Any}, op::Char, delim::Char, cl::Char, delim_one::Bool) @ Base ./show.jl:1335
││││││││││┌ show_delim_array(io::IOBuffer, itr::Vector{Any}, op::Char, delim::Char, cl::Char, delim_one::Bool, i1::Int64, l::Int64) @ Base ./show.jl:1346
│││││││││││ runtime dispatch detected: show(%4::IOContext{IOBuffer}, %41::Any)::Any
││││││││││└────────────────────
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:995
│││││││││┌ show_datatype(io::IOContext{IOBuffer}, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1129
││││││││││┌ show_type_name(io::IOContext{IOBuffer}, tn::Core.TypeName) @ Base ./show.jl:1042
│││││││││││ runtime dispatch detected: Base.isvisible(%32::Symbol, %89::Module, %83::Any)::Bool
││││││││││└────────────────────
│││││││││┌ show_datatype(io::IOContext{IOBuffer}, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1096
││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, %94::Any)::Any
│││││││││└────────────────────
│││││││││┌ show_datatype(io::IOContext{IOBuffer}, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1102
││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, %144::Any)::Any
│││││││││└────────────────────
│││││││││┌ show_datatype(io::IOContext{IOBuffer}, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1106
││││││││││ runtime dispatch detected: show(io::IOContext{IOBuffer}, %166::Any)::Any
│││││││││└────────────────────
│││││││││┌ show_datatype(io::IOContext{IOBuffer}, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1116
││││││││││ runtime dispatch detected: Base.show_at_namedtuple(io::IOContext{IOBuffer}, %225::Tuple, %226::DataType)::Any
│││││││││└────────────────────
│││││││││┌ show_datatype(io::IOContext{IOBuffer}, x::DataType, wheres::Vector{TypeVar}) @ Base ./show.jl:1124
││││││││││ runtime dispatch detected: Base.show_at_namedtuple(io::IOContext{IOBuffer}, %268::Tuple, %273::DataType)::Any
│││││││││└────────────────────
││││││││┌ _show_type(io::IOBuffer, x::Type) @ Base ./show.jl:997
│││││││││ runtime dispatch detected: show(%74::IOContext{IOBuffer}, %75::Any)::Any
││││││││└────────────────────
│││││││┌ show(io::IOBuffer, x::Type) @ Base ./show.jl:953
││││││││ runtime dispatch detected: Base._show_type(io::IOBuffer, x::Type)::Nothing
│││││││└────────────────────
│││┌ default_adjoint(T::Type) @ Enzyme.Compiler /home/guillaume/.julia/packages/Enzyme/y2lVn/src/compiler.jl:5256
││││ runtime dispatch detected: Enzyme.Compiler.one(T::Type)::Any
│││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:165
│││ captured variable `args` detected
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:165
│││ runtime dispatch detected: Enzyme.map(Core.Typeof, args::Tuple{Duplicated{Vector{Float64}}})::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:167
│││ runtime dispatch detected: (%9::Any Enzyme.:(==) 0)::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:173
│││ runtime dispatch detected: Enzyme.map(#58, args::Tuple{Duplicated{Vector{Float64}}})::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:174
│││ runtime dispatch detected: codegen_world_age(::typeof(sum), %19::Type)::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:177
│││ runtime dispatch detected: return_type(sum, %19::Type)::Type
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:270
│││ runtime dispatch detected: thunk(%40::Val, ::Const{typeof(sum)}, ::Active, %5::Type, [quote]::Val{Enzyme.API.DEM_ReverseModeCombined}, %42::Val, [quote]::Val{(false, false)}, [quote]::Val{false}, [quote]::Val{false}, ::FFIABI)::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:184
│││ runtime dispatch detected: thunk(%68::Val, ::Const{typeof(sum)}, %69::Type{Duplicated{T}} where T, %5::Type, [quote]::Val{Enzyme.API.DEM_ReverseModeGradient}, %71::Val, [quote]::Val{(false, false)}, [quote]::Val{false}, [quote]::Val{true}, ::FFIABI)::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:184
│││ runtime dispatch detected: Base.indexed_iterate(%72::Any, 1)::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:184
│││ runtime dispatch detected: Base.indexed_iterate(%72::Any, 2, %75::Any)::Any
││└────────────────────
││┌ autodiff(::ReverseMode{false, FFIABI, false}, f::Const{typeof(sum)}, ::Type{Active}, args::Duplicated{Vector{Float64}}) @ Enzyme /home/guillaume/.julia/packages/Enzyme/y2lVn/src/Enzyme.jl:186
│││ runtime dispatch detected: (%81::Any)[1]::Any
││└────────────────────
ERROR: There was an error during testing
Should be fixed by https://github.com/EnzymeAD/Enzyme.jl/pull/1415 please reopen if it persists
I noticed the following change in https://github.com/gdalle/DifferentiationInterface.jl/pull/196:
Enzyme v0.11: type-stable
Enzyme v0.12: type-unstable