跳转至

FFT Operators

本页暂无中文版。以下为英文原文。

Every op on this page is used the same way: construct it once, then call it. The constructor takes what the kernel is compiled with; the call takes the tensors. Both are documented under each op — __init__ and forward, where forward is what runs when you call op(...).

Complex-to-complex

tileops.fft.FFTC2CFwdOp

1D Complex-to-Complex Fast Fourier Transform (FFT), equivalent to torch.fft.fft.

Transforms the last axis; leading dimensions are batched. Every power-of-two length from 1 to 2**28 is served in complex64 and complex128 on sm_80, sm_86, sm_89, and sm_90.

  • n = 1 returns a copy of the input.
  • Up to 16384 (8192 at complex128), one launch holds a whole transform. With 99 KB of shared memory per block (sm_86, sm_89), 8192 (complex128) and 16384 (complex64) take the two-launch decomposition instead.
  • Longer lengths are a four-step decomposition: two launches up to 2**24, three above. Each call allocates one intermediate buffer the size of the input.

Relative error max|got - ref| / max|ref| against a float64 reference is at most 9.8e-07 (complex64) and 1.6e-15 (complex128), within 2.2x of cuFFT's.

__init__

__init__(
    *,
    target=None
)

Build the op. Shapes and dtype are taken from the first call.

Parameters:

  • target (Target, default: None ) –

    Which set of kernels serves this op — a target name, BUILTIN for the in-tree kernels, or None to decide from the input device.

forward

forward(
    input,
)

Compute 1D FFT of complex input.

Parameters:

  • input (Tensor) –

    Input tensor of shape (..., n) with complex dtype.

Returns:

  • Tensor –

    Output tensor of same shape as input with FFT applied along the

  • Tensor –

    last dimension.