Flux.jl
Flux.jl copied to clipboard
fix Vararg warning in test
Tests print a lot of
WARNING: Wrapping `Vararg` directly in UnionAll is deprecated (wrap the tuple instead).
You may need to write `f(x::Vararg{T})` rather than `f(x::Vararg{<:T})` or `f(x::Vararg{T}) where T` instead of `f(x::Vararg{T} where T)`.
We need to find the source of this and fix it
Can we trigger a CI run with julia --depwarn=error to enumerate these?
Yes you can, xref https://github.com/JuliaLang/julia/pull/56662
I think they are from inside Enzyme somewhere... ok I found where I looked, and the pointer was this line:
https://github.com/EnzymeAD/Enzyme.jl/blob/main/src/absint.jl#L98
on 23 November, at least:
Enzyme grad check Chain(Dense, Dense): Error During Test at /Users/me/.julia/dev/Flux/test/ext_enzyme/enzyme.jl:115
Got exception outside of a @test
Wrapping `Vararg` directly in UnionAll is deprecated (wrap the tuple instead).
You may need to write `f(x::Vararg{T})` rather than `f(x::Vararg{<:T})` or `f(x::Vararg{T}) where T` instead of `f(x::Vararg{T} where T)`.
Stacktrace:
[1] UnionAll(v::TypeVar, t::Any)
@ Core ./boot.jl:256
[2] absint(arg::LLVM.CallInst, partial::Bool)
@ Enzyme.Compiler ~/.julia/packages/Enzyme/RTS5U/src/absint.jl:98
[3] abs_typeof(arg::LLVM.CallInst, partial::Bool, seenphis::Set{LLVM.PHIInst})
@ Enzyme.Compiler ~/.julia/packages/Enzyme/RTS5U/src/absint.jl:716
[4] abs_typeof(arg::LLVM.CallInst, partial::Bool)
@ Enzyme.Compiler ~/.julia/packages/Enzyme/RTS5U/src/absint.jl:283
[5] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
@ Enzyme.Compiler ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:7169
[6] codegen
@ ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:6146 [inlined]
[7] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool)
@ Enzyme.Compiler ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:8468
[8] _thunk
@ ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:8468 [inlined]
[9] cached_compilation
@ ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:8509 [inlined]
[10] thunkbase(ctx::LLVM.Context, mi::Core.MethodInstance, ::Val{0x0000000000007d08}, ::Type{Const{var"#loss#402"}}, ::Type{Active}, tt::Type{Tuple{Duplicated{Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}}, Duplicated{Vector{Float32}}}}, ::Val{Enzyme.API.DEM_ReverseModeCombined}, ::Val{1}, ::Val{(false, false, false)}, ::Val{true}, ::Val{false}, ::Type{EnzymeCore.FFIABI}, ::Val{true}, ::Val{false})
@ Enzyme.Compiler ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:8641
[11] #s2103#19072
@ ~/.julia/packages/Enzyme/RTS5U/src/compiler.jl:8778 [inlined]
[12] var"#s2103#19072"(FA::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, ReturnPrimal::Any, ShadowInit::Any, World::Any, ABI::Any, ErrIfFuncWritten::Any, RuntimeActivity::Any, ::Any, ::Type, ::Type, ::Type, tt::Any, ::Type, ::Type, ::Type, ::Type, ::Type, ::Type, ::Type, ::Any)
@ Enzyme.Compiler ./none:0
[13] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
@ Core ./boot.jl:602
[14] autodiff
@ ~/.julia/packages/Enzyme/RTS5U/src/Enzyme.jl:473 [inlined]
[15] autodiff(::EnzymeCore.ReverseMode{true, false, EnzymeCore.FFIABI, false, false}, ::var"#loss#402", ::Type{Active}, ::Duplicated{Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}}, ::Duplicated{Vector{Float32}})
@ Enzyme ~/.julia/packages/Enzyme/RTS5U/src/Enzyme.jl:512
[16] gradient_ez(::Function, ::Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, ::Vararg{Any})
@ Main ~/.julia/dev/Flux/test/ext_enzyme/enzyme.jl:30
[17] test_enzyme_grad(loss::var"#loss#402", model::Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, x::Vector{Float32})
@ Main ~/.julia/dev/Flux/test/ext_enzyme/enzyme.jl:53
I think they are from inside Enzyme somewhere... ok I found where I looked, and the pointer was this line: https://github.com/EnzymeAD/Enzyme.jl/blob/main/src/absint.jl#L98
@wsmoses can this be fixed?
Yeah, can you find a MWE so we can figure out how to fix?