Docsity

Accelerating Fourier Transforms on GPUs: A Deep Dive into Implementation and Performance, Slides of Electronics engineering

Toggle sidebar
bg1
The FFT on a GPU
Graphics Hardware
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Accelerating Fourier Transforms on GPUs: A Deep Dive into Implementation and Performance and more Slides Electronics engineering in PDF only on Docsity!

The FFT on a GPU

Graphics Hardware

Overview

  • Introduction
    • Motivation, FFT review.
  • FFT Techniques
    • Exploitable FFT properties.
  • Implementation
  • Results
    • Performance, applications, conclusions.

The Discrete Fourier Transform

  • Converts data in the spatial or temporal

domain into frequencies the data comprise.

     (^)   

1

0

1 N

x

ux f xWN N

F f x F u

     (^)   

   

1

0

1

N

u

ux

F F u f x F u WN

j N WN e

 2  

The Discrete Fourier Transform

  • 2D transform can be computed by applying

the transform in one direction, then the other.

     (^)   

1

0

1

0

N

y

M

x

vy N

ux f x y WM W MN

F f x y F u v

     (^)   

    

1

0

1

0

1 , , ,

N

v

M

u

vy N

ux

F F u v f x y F u vWM W

DFT

IDFT

Index Magic

  • Do not use recursion.
    • Use dynamic programming: iterate over entire

array computing all values for each recursive

depth together, like mergesort.

  • Indexing is non-obvious.
    • Unlike mergesort, recursive step does not divide

array into contiguous chunks.

  • At any iteration, what partition does a given index

belong to, and where can one find the applicable

values of the sub-partitions?

Index Magic

  • Common solution: rearrange data by reversing

the bits of indices.

  • FFT can occur with contiguous partitions.
  • Requires an extra data copy.
  • Our solution, determine indexing in place.

     

i i i

i u Ai nAi  1 nuN 2  W 2 i A  1 nuN 2  N 2

Note that the paper has a typo.

i un div N 2

Fourier Transform of Real

Functions

  • Pick two functions, let them be f ( x ) and

g ( x ).

  • Let h ( x ) = f ( x ) + j g ( x ).
    • Note that there is no loss of information.
  • Can perform FFT of h in half the time as

performing the brute force FFT of f and g individually.

  • Simply point to one row of image as real components and another as imaginary components.

f

g

Untangling Fourier Transform Pairs

  • Fourier transform is linear.
    • H ( u ) = F ( u ) + j G ( u )
  • We can “untangle” using symmetry of F and

G.

  • Add and subtract H ( u ) and H ( N – u ) to cancel out

conjugate terms of      F and G .     

     I  I

R R

2 j 2

2 2 j

j

H u H N u F u G u

F u G u

H u H N u F u F N u G u G N u

Packing Transforms of Real

Functions

  • We can store

Fourier transform

in an array the

same size as the

input.

  • Throw away

conjugate

duplicates.

  • Throw away

imaginary values

0 N  1  N 2 ^1^ N 2 N 2 ^1  N  1 Real Values Imaginary Values

Column-wise FFT

  • We have two

columns with real

values.

  • Use same “tangled”

approach.

  • All other columns

are complex

numbers.

  • Use regular FFT.

Real Real

Paired for Complex

Available Resources

  • nVidia GeForce FX 5800 Ultra.
    • Full 32-bit floating point pipeline and frame

buffers.

  • Fully programmable vertex and fragment units.
  • Cg
  • High level language for vertex and fragment

programs.

  • Traditional CPU: 1.7 GHz Intel Zeon
    • Freely available high performance FFT

implementations.

Implementation

  • Using a SIMD model for parallel computation.
    • Draw quadrilateral parallel to screen.
    • Rasterizer invokes the same fragment program “in

parallel” over all pixels covered by quadrilateral.

  • Inputs/output dependent on location of pixel the

fragment program is running.

  • We require many rendering passes.
    • Use “render to texture” extension.
    • Use two frame buffers: one for retrieving values of

last pass and one for storing results of current

Fragment Programs

  • Written in Cg, compiled for GeForce FX.

Program Instructions

Arithmetic Texture

FFT 27 3

Untangle 4 2

Scale 1 1

Tangle 1 2

Pass 0 1

Multiply 66 4

Applications

  • Digital image filtering.