approximate program synthesis
play

Approximate Program Synthesis James Bornholt Emina Torlak Luis - PowerPoint PPT Presentation

Approximate Program Synthesis James Bornholt Emina Torlak Luis Ceze Dan Grossman University of Washington Writing approximate programs is hard Precise Implementation Writing approximate programs is hard Precise Implementation Writing


  1. Approximate Program Synthesis James Bornholt Emina Torlak Luis Ceze Dan Grossman University of Washington

  2. Writing approximate programs is hard Precise Implementation

  3. Writing approximate programs is hard Precise Implementation

  4. Writing approximate programs is hard Precise Implementation Desired Quality

  5. Writing approximate programs is hard Precise Implementation Approximate Compiler ACCEPT, Chisel, iACT, ExpAX, … Desired Quality

  6. Writing approximate programs is hard Precise Implementation Approximate Approximate Compiler Program ACCEPT, Chisel, iACT, ExpAX, … Desired Quality

  7. Writing approximate programs is hard s p e c 
 i fj c 
 m a p a p r g r o o x r i p m a t 
 i o n s n o o i p t a p t o o r n t u n n a i t i e s Precise Implementation Approximate Approximate Compiler Program ACCEPT, Chisel, iACT, ExpAX, … target 
 Desired Quality language q u global 
 a 
 l i t y m e t optimization r i c

  8. Synthesis: write programs automatically Programs Semantics

  9. Synthesis: write programs automatically Target Behavior f ( x ) = 4 x + 1 Programs Semantics

  10. Synthesis: write programs automatically Target Behavior f ( x ) = 4 x + 1 Programs Semantics

  11. Synthesis: write programs automatically 4*x + 1 Target Behavior f ( x ) = 4 x + 1 Programs Semantics

  12. Synthesis: write programs automatically 4*x + 1 Target Behavior f ( x ) = 4 x + 1 Programs Semantics

  13. Synthesis: write programs automatically 4*x + 1 (x<<2) + 1 Target Behavior f ( x ) = 4 x + 1 x + x + x + x + 1 Programs Semantics

  14. Synthesizing approximate programs 4*x + 1 (x<<2) + 1 Target Behavior f ( x ) = 4 x + 1 x + x + x + x + 1 Programs Semantics

  15. Synthesizing approximate programs 4*x + 1 Approximate (x<<2) + 1 Behavior Target Behavior f ( x ) = 4 x + 1 x + x + x + x + 1 Programs Semantics

  16. Synthesizing approximate programs 4*x + 1 Approximate (x<<2) + 1 Behavior Target Behavior f ( x ) = 4 x + 1 x<<2 x + x + x + x + 1 Programs Semantics

  17. Synthesizing approximate programs 4*x + 1 Approximate κ = 10 (x<<2) + 1 Behavior κ = 6 Target Behavior = κ 4 f ( x ) = 4 x + 1 x<<2 8 = κ x + x + x + x + 1 Programs Semantics

  18. Synthesizing approximate programs 4*x + 1 Approximate κ = 10 (x<<2) + 1 Behavior κ = 6 Target Behavior κ = 4 f ( x ) = 4 x + 1 x<<2 8 = κ x + x + x + x + 1 Programs Semantics

  19. Synthesis automates approximation s p e c 
 i fj c 
 m a p a p r g r o o x r i p m a t 
 i o n s n o o i p t a p t o o r n t u n n a i t i e s Precise Implementation Approximate Approximate Compiler Program ACCEPT, Chisel, iACT, ExpAX, … target 
 Desired Quality language q u global 
 a 
 l i t y m e t optimization r i c

  20. Synthesis automates approximation s p e c 
 i fj c 
 m a p a p r g r o o x r i p m a t 
 i o n s n o o i p t a p t o o r n t u n n a i t i e s Precise Implementation Approximate Approximate Program Program Synthesis target 
 Desired Quality language q u global 
 a 
 l i t y m e t optimization r i c

  21. Synthesis automates approximation speci fj c 
 Precise approximation 
 Implementation opportunities Approximate Approximate Program Program Synthesis target 
 Desired Quality global 
 program 
 language annotations optimization q u a 
 l i t y m e t r i c

  22. Existing synthesizers don’t scale enough Approximate benchmarks • fft • kmeans • inversek2j • sobel ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% † Alur et al. Syntax-Guided Synthesis . FMCAD 2013.

  23. Existing synthesizers don’t scale enough Approximate benchmarks • fft • kmeans • inversek2j • sobel Off-the-shelf synthesizers † • Symbolic ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% • Stochastic • Brute-force † Alur et al. Syntax-Guided Synthesis . FMCAD 2013.

  24. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { Approximate benchmarks float r = 0; • fft r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); • kmeans r += (p[2] - c[2])*(p[2] - c[2]); • inversek2j float ret = sqrt(r); • sobel return ret; } float f(float p[3], float c[3]) { ?? } Off-the-shelf synthesizers † • Symbolic assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% • Stochastic • Brute-force † Alur et al. Syntax-Guided Synthesis . FMCAD 2013.

  25. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { Approximate benchmarks float r = 0; • fft r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); • kmeans r += (p[2] - c[2])*(p[2] - c[2]); • inversek2j float ret = sqrt(r); • sobel return ret; } float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … Off-the-shelf synthesizers † • Symbolic assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% • Stochastic • Brute-force † Alur et al. Syntax-Guided Synthesis . FMCAD 2013.

  26. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { Approximate benchmarks float r = 0; • fft r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); • kmeans r += (p[2] - c[2])*(p[2] - c[2]); • inversek2j float ret = sqrt(r); • sobel return ret; } float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … Off-the-shelf synthesizers † • Symbolic assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% • Stochastic • Brute-force Reference Program being program synthesized † Alur et al. Syntax-Guided Synthesis . FMCAD 2013.

  27. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { Approximate benchmarks float r = 0; • fft r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); • kmeans r += (p[2] - c[2])*(p[2] - c[2]); • inversek2j float ret = sqrt(r); • sobel return ret; } float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … Off-the-shelf synthesizers † • Symbolic assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% • Stochastic • Brute-force Reference Program being program synthesized † Alur et al. Syntax-Guided Synthesis . FMCAD 2013.

  28. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { float r = 0; r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); r += (p[2] - c[2])*(p[2] - c[2]); float ret = sqrt(r); return ret; } float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% Programs Reference Program being program synthesized

  29. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { float r = 0; r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); r += (p[2] - c[2])*(p[2] - c[2]); float ret = sqrt(r); return ret; } float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% Programs Reference Program being program synthesized

  30. Existing synthesizers don’t scale enough float dist(float p[3], float c[3]) { float r = 0; r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); r += (p[2] - c[2])*(p[2] - c[2]); float ret = sqrt(r); 7.1 × 10 43 return ret; } programs float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% Programs Reference Program being program synthesized

  31. Use reference programs to guide synthesis float dist(float p[3], float c[3]) { float r = 0; r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); r += (p[2] - c[2])*(p[2] - c[2]); float ret = sqrt(r); 7.1 × 10 43 return ret; } programs float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% Programs Reference Program being program synthesized

  32. Use reference programs to guide synthesis float dist(float p[3], float c[3]) { float r = 0; r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); r += (p[2] - c[2])*(p[2] - c[2]); float ret = sqrt(r); 7.1 × 10 43 return ret; } programs float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% Programs Reference Program being program synthesized

  33. Use reference programs to guide synthesis float dist(float p[3], float c[3]) { float r = 0; r += (p[0] - c[0])*(p[0] - c[0]); r += (p[1] - c[1])*(p[1] - c[1]); r += (p[2] - c[2])*(p[2] - c[2]); float ret = sqrt(r); 7.1 × 10 43 return ret; } programs float f(float p[3], float c[3]) { ?? + - * / & | ^ } << >> … assert ∀ p, c. | dist ( p, c ) − f ( p, c ) | < 50% Programs Reference Program being program synthesized

Recommend


More recommend