spl
play

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


  1. A presentation by Samuel Häusler about the paper: SPL A Language and Compiler for DSP Algorithms Jiangxing Jong, Jeremy Johnson, Robert Johnson and David Padua

  2. Overview  Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

  3. Motivation Digital Signal Processing is part of everyday life Pictures: wikipedia.org

  4. Signal transformations: Output signa l Input signal y = M ⋅ x Transformation matrix Example: Discrete Fourier transformation (1D) F 4 = ( − i ) 1 1 1 1 y = F n ⋅ x 2 π i 1 − i − 1 i pq with ω= e n where F pq =ω n − 1 − 1 1 1 1 i − 1

  5. Fast signal transforms ( x 3 ) x 1 x 2 ( x 1 + 2 x 3 ) ( 2 ) x 1 + 2 x 3 1 0 2 3 x 2 0 3 0 1 0

  6. ( x 3 ) ( x 3 ) x 1 x 1 x 2 x 2 ( 3 ) ( 1 ) 1 2 3 1 ( 1 3 ) y y 2 1 2 3 1 1 2

  7. Fast Fourier Transform F 4 = ( − i ) = ( − 1 ) ⋅ ( − i ) ⋅ ( − 1 ) ⋅ ( 1 ) 1 1 1 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 1 − i − 1 i 0 1 0 1 0 1 0 0 1 − 1 0 0 0 0 1 0 − 1 − 1 − 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 1 0 0 1 i − 1 0 1 0 0 0 0 0 0 1 0 0 0 4 ( I 2 ⊗ F 2 ) L 2 4 F 4 =( F 2 ⊗ I 2 ) T 2 F 2 = ( − 1 ) I 2 = ( 1 ) 1 1 1 0 1 0

  8. Implementation of signal transformations F 4 Automate Look for good Matrix representation Search for a good implementation Implement Optimize Evaluate Final Code

  9. Example: F 4 Algorithm generator Look for good Matrix representation Search for a good implementation SPL Compiler Implement Optimize Evaluate Final Code Logo:Spiral.net

  10. Algorithm generator: 4 ( I 2 ⊗ F 2 ) L 2 4 F 4 =( I 2 ⊗ F 2 ) T 2 (compose (tensor (F 2) (I 2)) (T 4 2) (tensor (I 2) (F 2)) (L 4 2)) )

  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))

  12. Overview  Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

  13. The language SPL A SPL program is a transformation matrix #language c #Compiler directive (define A (I 1)) (define B (F 2)) (matrix definitions) ⋅ x y = #subname myfunction (compose A B) (matrix operation)

  14. General matrix definitions (matrix ((a11 a12 a13)(a21 a22 a23)(a31 a32 a33 ) ( a33 ) a11 a12 a13 a21 a22 a23 a31 a32 (diagonal (a11 a22 a33)) ( a33 ) a11 0 0 0 a22 0 0 0 ( 0 ) 0 1 0 (permutation(3 1 2)) 0 0 1 1 0

  15. Parametrized matrices Identity matrix: (I n) Fourier transformation: (F n) 4 = ( 1 ) 1 0 0 0 Stride permutation matrix: (L mn n) 0 0 1 0 L 2 n : j ⇒ j ⋅ r mod n for index j: F r 0 1 0 0 0 0 0 mn = ( ( n − 1 ) ) I 0 0 0 W m 0 T m Twiddle matrix: (T mn n) 0 0 W m

  16. Matrix operations Matrix product: (compose A B) (direct-sum A B) Direct sum: Tensor product: (tensor A B) ( 2 ) ⊗ A = ( 2A ) 1 0 2 A 0 2 A 0 3 0 0 3 A 0 1 0 A 0

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

  18. Program example (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)) 16 ( I 4 ⊗ F 4 ) L 4 16 , where F 4 =( F 2 ⊗ I 2 ) T 2 4 ( I 2 ⊗ F 2 ) L 2 4 F 16 =( F 4 ⊗ I 4 ) T 4

  19. Overview  Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

  20. The compiler SPL source code Search for a good implementation Implement Optimize SPL program

  21. Parsing Abstract syntax tree: A+B-C + A - B C

  22. Example (compose (F 4) (T 4 4)) (Compose (F 4) (T 4 4)) Compose F T 4 4 4

  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))

  24. Templates (template pattern condition i-code)

  25. Templates Templates: Compiler: (template I n_) (I 1) (Template compose X_ Y_) (compose (F 2) (F 2))

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

  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))

  28. Picture:paper

  29. Overview  Motivation  The language SPL  The SPL compiler  Experiments and results  Conclusion

  30. Experiments and results ...onFFT transformsF 2 i fori = 1 − 20 SPL Compiler Search Strategy Compared results with „fftw“ library results

  31. Search strategy Dynamic programming over factorization by: rs ( I r ⊗ F s ) L r rs F rs =( F r ⊗ I s ) T s

  32. SPARC Picture:paper

  33. MIPS Picture:paper

  34. Pentium II Picture:paper

  35. Memory usage

  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

Recommend


More recommend