The title and example really say it all. I’m using Flux.jl version 0.12.7 and CUDA.jl 3.5.0.
MWE:
julia> using Flux
julia> x = [1, 2]
2-element Vector{Int64}:
1
2
julia> Flux.pullback(() -> gpu(x))
ERROR: this intrinsic must be compiled to be called
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0 [inlined]
[2] _pullback(::Zygote.Context, ::Core.IntrinsicFunction, ::String, ::Type{Int64}, ::Type{Tuple{Ptr{Int64}}}, ::Ptr{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:9
[3] _pullback
@ ./atomics.jl:358 [inlined]
[4] _pullback(ctx::Zygote.Context, f::typeof(getindex), args::Base.Threads.Atomic{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[5] _pullback
@ ~/.julia/packages/CUDA/YpW0k/lib/utils/threading.jl:46 [inlined]
[6] _pullback(::Zygote.Context, ::CUDA.APIUtils.var"##get!#4", ::Nothing, ::typeof(get!), ::CUDA.var"#162#163", ::CUDA.APIUtils.LazyInitialized{Vector{Bool}})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[7] _pullback
@ ~/.julia/packages/CUDA/YpW0k/lib/utils/threading.jl:46 [inlined]
[8] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/pool.jl:69 [inlined]
[9] _pullback(ctx::Zygote.Context, f::typeof(CUDA.stream_ordered), args::CUDA.CuDevice)
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[10] macro expansion
@ ~/.julia/packages/CUDA/YpW0k/src/pool.jl:189 [inlined]
[11] macro expansion
@ ./timing.jl:287 [inlined]
[12] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/pool.jl:187 [inlined]
[13] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/pool.jl:183 [inlined]
[14] _pullback(::Zygote.Context, ::CUDA.var"#_alloc##kw", ::NamedTuple{(:stream,), Tuple{Nothing}}, ::typeof(CUDA._alloc), ::Type{CUDA.Mem.DeviceBuffer}, ::Int64)
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[15] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/pool.jl:173 [inlined]
[16] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/pool.jl:169 [inlined]
[17] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/array.jl:44 [inlined]
[18] _pullback(::Zygote.Context, ::Type{CUDA.CuArray{Int64, 1, CUDA.Mem.DeviceBuffer}}, ::UndefInitializer, ::Tuple{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[19] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/array.jl:290 [inlined]
[20] _pullback
@ ~/.julia/packages/CUDA/YpW0k/src/array.jl:497 [inlined]
[21] _pullback(::Zygote.Context, ::typeof(Adapt.adapt_storage), ::CUDA.CuArrayAdaptor{CUDA.Mem.DeviceBuffer}, ::Vector{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[22] _pullback
@ ~/.julia/packages/Adapt/RGNRk/src/Adapt.jl:42 [inlined]
[23] _pullback
@ ~/.julia/packages/Adapt/RGNRk/src/Adapt.jl:40 [inlined]
[24] _pullback (repeats 2 times)
@ ~/.julia/packages/CUDA/YpW0k/src/array.jl:510 [inlined]
[25] _pullback
@ ~/.julia/packages/Flux/ZnXxS/src/functor.jl:66 [inlined]
[26] _pullback
@ ~/.julia/packages/Adapt/RGNRk/src/Adapt.jl:42 [inlined]
[27] _pullback
@ ~/.julia/packages/Adapt/RGNRk/src/Adapt.jl:40 [inlined]
[28] _pullback
@ ~/.julia/packages/Flux/ZnXxS/src/functor.jl:146 [inlined]
[29] _pullback
@ ~/.julia/packages/Functors/QVxVb/src/functor.jl:121 [inlined]
[30] _pullback(::Zygote.Context, ::Functors.var"##fmap#17", ::typeof(Flux._isbitsarray), ::typeof(Functors._default_walk), ::IdDict{Any, Any}, ::typeof(fmap), ::Flux.var"#132#133", ::Vector{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[31] _pullback
@ ~/.julia/packages/Functors/QVxVb/src/functor.jl:120 [inlined]
[32] _pullback(::Zygote.Context, ::Functors.var"#fmap##kw", ::NamedTuple{(:exclude,), Tuple{typeof(Flux._isbitsarray)}}, ::typeof(fmap), ::Flux.var"#132#133", ::Vector{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[33] _pullback
@ ~/.julia/packages/Flux/ZnXxS/src/functor.jl:146 [inlined]
[34] _pullback(ctx::Zygote.Context, f::typeof(gpu), args::Vector{Int64})
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[35] _pullback
@ ./REPL[3]:1 [inlined]
[36] _pullback(::Zygote.Context, ::var"#5#6")
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface2.jl:0
[37] _pullback(::Function)
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface.jl:34
[38] pullback(::Function)
@ Zygote ~/.julia/packages/Zygote/TaBlo/src/compiler/interface.jl:40
[39] top-level scope
@ REPL[3]:1