f a i c t t r A C o m p * * l e t t n e e * A t * s i W s E n e L o l l C C P D * o O * e c s u P u m e E e R n * o t e v t d y s a E * a d l e u t a Optimizing Synthesis SYNAPSE with Metasketches POPL 2016 James Bornholt Emina Torlak Dan Grossman Luis Ceze University of Washington
f a i c t t r A C o m p * * l e t t n e e * A t * s i W s E n e L o l l C C P D * o O * e c s u P u m e E e R n * o t e v t d y s a E * a d l e u t a Optimizing Synthesis SYNAPSE with Metasketches d e t a m o POPL 2016 t u A r o f e t a m i x o r p p A James Bornholt g n i m m a r Emina Torlak g o r P Dan Grossman Luis Ceze University of Washington
Approximate computing in the future
Approximate computing in the future Precise Program
Approximate computing in the future Precise Acceptability Program Criteria
Approximate computing in the future Approximation Specification
Approximate computing in the future Approximation Specification Magical Approximate Compiler
Approximate computing in the future Approximation Specification Magical Approximate Compiler Approximate Program
Synthesis finds programs automatically Specification Program Synthesis Program
Synthesis finds programs automatically f ( x ) = 4 x + 1 Specification Program Synthesis Program
Synthesis finds programs automatically f ( x ) = 4 x + 1 Specification Program Synthesis Program 4*x + 1
Synthesis finds programs automatically f ( x ) = 4 x + 1 Specification Program Synthesis Program 4*x + 1 (x << 2) + 1
What if synthesis doesn’t work? Specification Program Synthesis Program
What if synthesis doesn’t work? f ( L, k ) = Search ( L, k ) Specification Program Synthesis Program
What if synthesis doesn’t work? f ( L, k ) = Search ( L, k ) Specification Program Synthesis Program
What if synthesis doesn’t work? f ( L, k ) = Search ( L, k ) Restricts the space of Syntactic candidate programs Specification Template (e.g. sketch, CFG) Program Synthesis Program
What if synthesis doesn’t work? f ( L, k ) = Search ( L, k ) Restricts the space of Syntactic candidate programs Specification Template (e.g. sketch, CFG) Syntax-Guided Synthesis Program
What if synthesis doesn’t work? f ( L, k ) = Search ( L, k ) Restricts the space of Syntactic candidate programs Specification Template (e.g. sketch, CFG) Syntax-Guided Synthesis Linear search Program Binary search
What if synthesis doesn’t work? f ( L, k ) = Search ( L, k ) Restricts the space of Syntactic candidate programs Specification Template (e.g. sketch, CFG) Syntax-Guided Synthesis Linear search Program Binary search 7.1 MB program
What if synthesis doesn’t work? Selects the solution f ( L, k ) = Search ( L, k ) with minimal cost Cost Syntactic Specification Function Template Syntax-Guided Synthesis Linear search Program Binary search 7.1 MB program
What if synthesis doesn’t work? Selects the solution f ( L, k ) = Search ( L, k ) with minimal cost Cost Syntactic Specification Function Template Optimal Synthesis Linear search Program Binary search
What if synthesis doesn’t work? Selects the solution f ( L, k ) = Search ( L, k ) with minimal cost Cost Syntactic Specification Function Template Optimal Synthesis Program
Metasketches o ff er control over synthesis Specification Optimal Synthesis Program
Metasketches o ff er control over synthesis Guides the search towards good solutions Specification Metasketch Optimal Synthesis Program
Metasketches o ff er control over synthesis Guides the search towards good solutions 1. Metasketches Specification Metasketch 2. Solving Optimal Synthesis 3. Results Program
Metasketches o ff er control over synthesis Guides the search towards good solutions 1. Metasketches Specification Metasketch 2. Solving Optimal Synthesis 3. Results Program
Metasketches Explicit control over search strategy
Synthesizing straight-line SSA programs max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) o2 = ?? op (?? a , ?? a , ?? a ) return o2
Synthesizing straight-line SSA programs Operations: +, -, <, if, … max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) o2 = ?? op (?? a , ?? a , ?? a ) return o2
Synthesizing straight-line SSA programs Operations: +, -, <, if, … max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) o2 = ?? op (?? a , ?? a , ?? a ) return o2 Inputs + earlier outputs
Synthesizing straight-line SSA programs max(x, y): o1 = >(x, y) o2 = ?? op (?? a , ?? a , ?? a ) return o2
Synthesizing straight-line SSA programs max(x, y): o1 = >(x, y) o2 = ite(o1, x, y) return o2
Synthesizing straight-line SSA programs max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) o2 = ?? op (?? a , ?? a , ?? a ) return o2
Synthesizing straight-line SSA programs max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 o2 = ?? op (?? a , ?? a , ?? a ) return o2
Synthesizing straight-line SSA programs max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 S 4 S 5 S 6 S 7 S 8 S 9 …
Synthesizing straight-line SSA programs max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs UNSAT S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs UNSAT S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 SAT, cost 5 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs UNSAT S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 SAT, cost 5 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 SAT, cost 4 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs UNSAT S 1 return o1 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 2 SAT, cost 5 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 SAT, cost 4 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 4 4 4 3 3 3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs UNSAT S 1 return o1 Termination of optimal max(x, y): synthesis o1 = ?? op (?? a , ?? a , ?? a ) S 2 SAT, cost 5 o2 = ?? op (?? a , ?? a , ?? a ) return o2 max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 SAT, cost 4 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 4 4 4 3 3 3 S 4 S 5 S 6 S 7 S 8 S 9 …
Optimal synthesis could be unbounded max(x, y): Unbounded space of o1 = ?? op (?? a , ?? a , ?? a ) candidate programs UNSAT S 1 return o1 Termination of optimal max(x, y): synthesis o1 = ?? op (?? a , ?? a , ?? a ) S 2 SAT, cost 5 o2 = ?? op (?? a , ?? a , ?? a ) return o2 Search order max(x, y): o1 = ?? op (?? a , ?? a , ?? a ) S 3 SAT, cost 4 o2 = ?? op (?? a , ?? a , ?? a ) o3 = ?? op (?? a , ?? a , ?? a ) return o3 4 4 4 3 3 3 S 4 S 5 S 6 S 7 S 8 S 9 …
Metasketches control search strategy Unbounded space of candidate programs Termination of optimal synthesis Search order
Metasketches control search strategy A metasketch consists of: Unbounded space of candidate programs Termination of optimal synthesis Search order
Metasketches control search strategy A metasketch consists of: Unbounded space of • An ordered countable set of sketches S candidate programs Termination of optimal synthesis Search order
Recommend
More recommend