SPL A Language and Compiler for DSP Algorithms Jiangxing Jong, - - PowerPoint PPT Presentation

spl
SMART_READER_LITE
LIVE PREVIEW

SPL A Language and Compiler for DSP Algorithms Jiangxing Jong, - - PowerPoint PPT Presentation

A presentation by Samuel Husler about the paper: SPL A Language and Compiler for DSP Algorithms Jiangxing Jong, Jeremy Johnson, Robert Johnson and David Padua Overview Motivation The language SPL The SPL compiler Experiments


slide-1
SLIDE 1

SPL

A Language and Compiler for DSP Algorithms

Jiangxing Jong, Jeremy Johnson, Robert Johnson and David Padua

A presentation by Samuel Häusler about the paper:

slide-2
SLIDE 2

Overview

 Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

slide-3
SLIDE 3

Motivation

Digital Signal Processing is part of everyday life

Pictures: wikipedia.org

slide-4
SLIDE 4

Signal transformations:

y=M⋅x

Input signal Output signal Transformation matrix

Example: Discrete Fourier transformation (1D)

y=F n⋅x

where F pq=ωn

pq with ω=e 2 πi n

F 4=( 1 1 1 1 1 −i −1 i 1 −1 1 −1 1 i −1 −i)

slide-5
SLIDE 5

Fast signal transforms

(

x1 x2 x3)

(

1 2 3 1 2) (

x1+2 x3 3 x2 x1+2 x3)

slide-6
SLIDE 6

(

x1 x2 x3)

(

1 2 3 1 2 3 1 2 3) y

(

x1 x2 x3)

(

1 1 1) (1 2 3) y

slide-7
SLIDE 7

Fast Fourier Transform

= ( 1 1 1 1 1 −1 1 −1) ⋅( 1 1 1 −i) ⋅( 1 1 1 −1 1 1 1 −1) ⋅( 1 1 1 1) F 4=( 1 1 1 1 1 −i −1 i 1 −1 1 −1 1 i −1 −i)

F 4=(F2⊗I 2)T 2

4(I 2⊗F 2) L2 4

F 2=( 1 1 1 −1) I 2=( 1 1)

slide-8
SLIDE 8

Implementation of signal transformations

Look for good Matrix representation

F 4

Search for a good implementation Implement Optimize Evaluate Final Code

Automate

slide-9
SLIDE 9

Example:

Look for good Matrix representation

F 4

Search for a good implementation Implement Optimize Evaluate Final Code

Algorithm generator SPL Compiler Logo:Spiral.net

slide-10
SLIDE 10

Algorithm generator:

F 4=(I 2⊗F 2)T 2

4(I 2⊗F 2) L2 4

(compose (tensor (F 2) (I 2)) (T 4 2) (tensor (I 2) (F 2)) (L 4 2)))

slide-11
SLIDE 11

Compiler

(template (compose A B)) [A.in_size==B.out_size] (B_ ($in,$t0,0,0,1,1) A_($t0,$out,0,0,1,1))

slide-12
SLIDE 12

Overview

 Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

slide-13
SLIDE 13

The language SPL

#language c (define A (I 1)) (define B (F 2)) #subname myfunction (compose A B)

A SPL program is a transformation matrix

y = ⋅x

#Compiler directive (matrix operation) (matrix definitions)

slide-14
SLIDE 14

General matrix definitions

(matrix ((a11 a12 a13)(a21 a22 a23)(a31 a32 a33) (diagonal (a11 a22 a33)) (permutation(3 1 2))

(

a11 a12 a13 a21 a22 a23 a31 a32 a33)

(

a11 a22 a33)

(

1 1 1 0)

slide-15
SLIDE 15

Parametrized matrices

Identity matrix: (I n) Fourier transformation: (F n) Stride permutation matrix: (L mn n) Twiddle matrix: (T mn n)

T m

mn=(

I W m W m

(n−1))

L2

4=(

1 1 1 1) for index j: F r

n: j⇒ j⋅r mod n

slide-16
SLIDE 16

Matrix operations

Matrix product: (compose A B) Direct sum: (direct-sum A B) Tensor product: (tensor A B)

(

1 2 3 1 2) ⊗A=( A 2 A 3 A A 2A)

slide-17
SLIDE 17

Name assignment: (define name formula) e.g. (define A (I 1))

slide-18
SLIDE 18

Program example

F 16=(F 4⊗I 4)T 4

16(I 4⊗F 4) L4 16, where F 4=(F 2⊗I 2)T 2 4(I 2⊗F 2) L2 4

(define F4 (compose (tensor (F 2) (I 2)) (T 4 2) (tensor (I 2) (F 2)) (L 4 2))) #subname fft16 (compose (tensor F4 (I 4)) (T 16 4) (tensor (I 4) F4) (L 16 4))

slide-19
SLIDE 19

Overview

 Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

slide-20
SLIDE 20

The compiler

Search for a good implementation Implement Optimize

SPL source code SPL program

slide-21
SLIDE 21

Parsing Abstract syntax tree:

A+B-C + A

  • B

C

slide-22
SLIDE 22

Example (compose (F 4) (T 4 4))

(Compose (F 4) (T 4 4)) Compose F T 4 4 4

slide-23
SLIDE 23

Templates

(template (F n_) [n_>0] (do $i=0, n_-1 $out($i0)=0 do $i1=0,n_-1 $r0 = $i0 * $i1 $f0 = W(n_ $r0)*$in($i1) $out($i0)=$out($i0)+$f0 end end))

slide-24
SLIDE 24

Templates

(template pattern condition i-code)

slide-25
SLIDE 25

Templates

(template I n_) (I 1) (compose (F 2) (F 2)) (Template compose X_ Y_)

Templates: Compiler:

slide-26
SLIDE 26

Templates

(L m_ n_) with condition [m_==2*n] (L 4 2) (L 4 1)

slide-27
SLIDE 27

Templates Example: A template for (F n)

(template (F n_) [n_>0] (do $i=0, n_-1 $out($i0)=0 do $i1=0,n_-1 $r0 = $i0 * $i1 $f0 = W(n_ $r0)*$in($i1) $out($i0)=$out($i0)+$f0 end end))

slide-28
SLIDE 28

Picture:paper

slide-29
SLIDE 29

Overview

 Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

slide-30
SLIDE 30

Experiments and results

...onFFT transformsF2i fori=1−20

SPL Compiler

Compared results with „fftw“ library results

Search Strategy

slide-31
SLIDE 31

Search strategy Dynamic programming over factorization by:

F rs=( Fr⊗I s)T s

rs( I r⊗F s) Lr rs

slide-32
SLIDE 32

SPARC

Picture:paper

slide-33
SLIDE 33

MIPS

Picture:paper

slide-34
SLIDE 34

Pentium II

Picture:paper

slide-35
SLIDE 35

Memory usage

slide-36
SLIDE 36

Conclusions

 Competitive with fftw if connected with search library  More general, not only fft  Results show power of domain-specific language and compilers  Many more domain-specific projects in future