# Flux, CUDA, Zygote : InvalidIRError: compiling kernel getindex\_kernel(CUDA.CuKernelContext, CuDeviceArray

**URL:** <https://discourse.julialang.org/t/flux-cuda-zygote-invalidirerror-compiling-kernel-getindex-kernel-cuda-cukernelcontext-cudevicearray/52557>\
**Category:** New to Julia\
**Tags:** cuda, flux, zygote\
**Created:** [December 29, 2020, 6:13am UTC](https://discourse.julialang.org/t/flux-cuda-zygote-invalidirerror-compiling-kernel-getindex-kernel-cuda-cukernelcontext-cudevicearray/52557 "2020-12-29T06:13:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [December 29, 2020, 10:35am UTC](https://discourse.julialang.org/t/flux-cuda-zygote-invalidirerror-compiling-kernel-getindex-kernel-cuda-cukernelcontext-cudevicearray/52557/4 "2020-12-29T10:35:57Z")

</div>

> [@kadir-gunel](#):
>
> ```julia
> ERROR: MethodError: no method matching plan_brfft(::CuArray{Complex{ForwardDiff.Dual{Nothing,Float32,2}},4}, ::Int64, ::Int64)
> Closest candidates are:
> plan_brfft(::CuArray{T,N}, ::Integer, ::Any) where {T<:Union{Complex{Float32}, Complex{Float64}}, N} at /opt/.julia/packages/CUDA/YeS8q/lib/cufft/fft.jl:306
> plan_brfft(::AbstractArray, ::Integer; kws...) at /opt/.julia/packages/AbstractFFTs/mhQvY/src/definitions.jl:285
> 
> ```

Haven’t figured out why ForwardDiff is being used here, but it I think it doesn’t work with FFT, e.g. yesterday: [ForwardDiff and Zygote cannot automatically differentiate (AD) function from C^n to R that uses FFT](https://discourse.julialang.org/t/forwarddiff-and-zygote-cannot-automatically-differentiate-ad-function-from-c-n-to-r-that-uses-fft/52440)

---

_[View the full topic](https://discourse.julialang.org/t/flux-cuda-zygote-invalidirerror-compiling-kernel-getindex-kernel-cuda-cukernelcontext-cudevicearray/52557)._
