Skip to content

Allow plans to have fewer dimensions than the data  #122

@maximilian-gelbrecht

Description

@maximilian-gelbrecht

I think it's a good idea to allow FFT plans to be applied to data that has more dimensions than the plan, as long as those are only the trailing dimensions. The expected behaviour in this case would be a batched FFT.
CUDA.jl PR JuliaGPU/CUDA.jl#1903 initially implemented this behaviour for CUFFT, but it was removed because it is not in accordance with AbstractFFTs.

As an example

using CUDA 
A = CUDA.rand(100); B = CUDA.rand(100,10); 
plan = CUDA.CUFFT.plan_fft(A) 
plan * A # works 
plan * B # doesn't work

In this case the expected behaviour would be (plan * B)[:,i] == (plan * B[:,i]).

You'd only need a single plan to apply the plan to data in different batch sizes as well. E.g. in the following situation:

A = rand(100,10); B = rand(100,20); C = rand(100) 

I'd like to have a plan that performs an FFT along the first dimension, but can apply to both A and B. It's a very common setup e.g. in ML applications, that the batch size is variable and not set when allocating the model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions