JuliaMath / JuliaMath/AbstractFFTs.jl

Handling wrapper array inputs

Open
#119 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
134
Forks
40
PR merge metrics
No merged PRs in 30d

Description

We do not correctly handle wrapper array input types for non-CPU arrays. For example:
```julia
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.