Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling wrapper array inputs #119

Open
gaurav-arya opened this issue Sep 4, 2023 · 0 comments
Open

Handling wrapper array inputs #119

gaurav-arya opened this issue Sep 4, 2023 · 0 comments

Comments

@gaurav-arya
Copy link
Contributor

gaurav-arya commented Sep 4, 2023

We do not correctly handle wrapper array input types for non-CPU arrays. For example:

julia> using CUDA.CUFFT

julia> P = plan_fft(CuArray([1,2,3]))
CUFFT d.p. complex forward plan for 3-element CuArray of ComplexF64

julia> x = CuArray([1.0 2.0; 3.0 4.0])
2×2 CuArray{Float64, 2, CUDA.Mem.DeviceBuffer}:
 1.0  2.0
 3.0  4.0

julia> P = plan_fft(CuArray([1,2,3]))
CUFFT d.p. complex forward plan for 3-element CuArray of ComplexF64

julia> P * view(x, axes(x)...)
ERROR: StackOverflowError:
Stacktrace:
 [1] Array
   @ AbstractFFTs ./boot.jl:477 [inlined]
 [2] Array
   @ AbstractFFTs ./boot.jl:485 [inlined]
 [3] Array
   @ AbstractFFTs ./boot.jl:492 [inlined]
 [4] copy1(::Type{ComplexF64}, x::Vector{ComplexF64})
   @ AbstractFFTs ~/AbstractFFTs.jl/src/definitions.jl:53 [inlined]
 [5] *(p::CUDA.CUFFT.cCuFFTPlan{ComplexF64, -1, false, 1}, x::Matrix{ComplexF64}) (repeats 64932 times)
   @ AbstractFFTs ~/AbstractFFTs.jl/src/definitions.jl:224
 [6] *(p::CUDA.CUFFT.cCuFFTPlan{ComplexF64, -1, false, 1}, x::SubArray{Float64, 2, CuArray{…}, Tuple{…}, false})
   @ AbstractFFTs ~/AbstractFFTs.jl/src/definitions.jl:224
 [7] top-level scope
   @ REPL[80]:1
Some type information was truncated. Use `show(err)` to see complete types.

I don't know whether there is a standard solution to this issue? Possibly we would want to design a cleverer fallback * dispatch, that, perhaps using parent, would find its way to the more specific dispatch.

Related: #32, #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant