Optimizing Synthesis with Metasketches
James Bornholt Emina Torlak Dan Grossman Luis Ceze
C- n
- m
- c
- R
*
E v a l u a t e d
* P O P L *
A r t i f a c t
* A E C
POPL 2016 University of Washington
SYNAPSE with Metasketches POPL 2016 James Bornholt Emina Torlak - - PowerPoint PPT Presentation
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
James Bornholt Emina Torlak Dan Grossman Luis Ceze
C*
E v a l u a t e d
* P O P L *
A r t i f a c t
* A E C
POPL 2016 University of Washington
James Bornholt Emina Torlak Dan Grossman Luis Ceze
C*
E v a l u a t e d
* P O P L *
A r t i f a c t
* A E C
POPL 2016 University of Washington
Precise Program
Precise Program Acceptability Criteria
Approximation Specification
Approximation Specification
Approximate Program Approximation Specification
Specification Program
Specification Program f(x) = 4x + 1
Specification Program f(x) = 4x + 1
4*x + 1
Specification Program f(x) = 4x + 1
4*x + 1 (x << 2) + 1
Specification Program
f(L, k) = Search(L, k)
Specification Program
f(L, k) = Search(L, k)
Specification Program
f(L, k) = Search(L, k)
Specification Program Syntactic Template Restricts the space of candidate programs (e.g. sketch, CFG)
f(L, k) = Search(L, k)
Specification Program Syntactic Template Restricts the space of candidate programs (e.g. sketch, CFG)
f(L, k) = Search(L, k)
Specification Program Syntactic Template Restricts the space of candidate programs (e.g. sketch, CFG) Linear search Binary search
f(L, k) = Search(L, k)
Specification Program Syntactic Template Restricts the space of candidate programs (e.g. sketch, CFG) Linear search Binary search 7.1 MB program
f(L, k) = Search(L, k)
Specification Program Syntactic Template Linear search Binary search Cost Function Selects the solution with minimal cost 7.1 MB program
f(L, k) = Search(L, k)
Specification Program Syntactic Template Linear search Binary search Cost Function Selects the solution with minimal cost
f(L, k) = Search(L, k)
Specification Program Syntactic Template Cost Function Selects the solution with minimal cost
Specification Program
Specification Program Metasketch Guides the search towards good solutions
Specification Program Metasketch
Guides the search towards good solutions
Specification Program Metasketch
Guides the search towards good solutions
Explicit control over search strategy
Operations: +, -, <, if, …
Operations: +, -, <, if, … Inputs + earlier outputs
Unbounded space of candidate programs
Unbounded space of candidate programs
Unbounded space of candidate programs
UNSAT
Unbounded space of candidate programs
UNSAT SAT, cost 5
Unbounded space of candidate programs
UNSAT SAT, cost 5 SAT, cost 4
Unbounded space of candidate programs
UNSAT SAT, cost 5 SAT, cost 4 4 4 4 3 3 3
Termination of optimal synthesis Unbounded space of candidate programs
UNSAT SAT, cost 5 SAT, cost 4 4 4 4 3 3 3
Termination of optimal synthesis Unbounded space of candidate programs
UNSAT SAT, cost 5 SAT, cost 4 4 4 4 3 3 3 Search order
Search order
Termination of optimal synthesis Unbounded space of candidate programs
Search order
Termination of optimal synthesis Unbounded space of candidate programs
Search order
Termination of optimal synthesis Unbounded space of candidate programs
Search order
Termination of optimal synthesis Unbounded space of candidate programs
Search order
κ : L → R
Termination of optimal synthesis Unbounded space of candidate programs
Search order
κ : L → R
Termination of optimal synthesis Unbounded space of candidate programs
Search order
κ : L → R g : R → 2S
Termination of optimal synthesis Unbounded space of candidate programs
Search order
κ : L → R g : R → 2S
Termination of optimal synthesis Unbounded space of candidate programs
Unbounded space of candidate programs Search order
κ : L → R g : R → 2S
Termination of optimal synthesis
Termination of optimal synthesis Unbounded space of candidate programs Search order
κ : L → R g : R → 2S
Termination of optimal synthesis Search order Unbounded space of candidate programs
κ : L → R g : R → 2S
Cooperating parallel searches
UNSAT
SAT, cost 2
SAT, cost 2
SAT, cost 2
SAT, cost 2
g(2) = {S1}
SAT, cost 2
SAT, cost 2
g(2) = {S1}
SAT, cost 2
SAT, cost 2
g(2) = {S1}
SAT, cost 2
g(2) = {S1}
SAT, cost 2
Novel sofuware-based approximations, automatically
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y Metasketch Polynomial Polynomial Polynomial Polynomial Superoptimization Superoptimization Superoptimization
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y Metasketch Polynomial Polynomial Polynomial Polynomial Superoptimization Superoptimization Superoptimization
Specification: < 50% error Cost function: sum of instruction costs
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y Metasketch Polynomial Polynomial Polynomial Polynomial Superoptimization Superoptimization Superoptimization Speedup 11.4× 12.0× 34.8× 10.0×
1.6×
10.6× 10.7×
Specification: < 50% error Cost function: sum of instruction costs
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y Metasketch Polynomial Polynomial Polynomial Polynomial Superoptimization Superoptimization Superoptimization Speedup 11.4× 12.0× 34.8× 10.0×
1.6×
10.6× 10.7× Error 21.3% 28.9% 16.3% 18.5% 14.9%
0.0% 0.0%
Specification: < 50% error Cost function: sum of instruction costs
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y Metasketch Polynomial Polynomial Polynomial Polynomial Superoptimization Superoptimization Superoptimization Speedup 11.4× 12.0× 34.8× 10.0×
1.6×
10.6× 10.7× Error 21.3% 28.9% 16.3% 18.5% 14.9%
0.0% 0.0%
Missed compiler
Specification: < 50% error Cost function: sum of instruction costs
Benchmark ffu-sin ffu-cos inversek2j-1 inversek2j-2 kmeans sobel-x sobel-y Metasketch Polynomial Polynomial Polynomial Polynomial Superoptimization Superoptimization Superoptimization Speedup 11.4× 12.0× 34.8× 10.0×
1.6×
10.6× 10.7× Error 21.3% 28.9% 16.3% 18.5% 14.9%
0.0% 0.0%
Solving Time (8 cores)
6.2 s
6.0 s11.5 s
6.7 s 2000.4 s
1611.9 s1740.6 s
Missed compiler
Specification: < 50% error Cost function: sum of instruction costs
?? ?? ??
cat not cat
. . . . .
64 inputs ?? ?? ?? ?? ??
?? ?? ??
cat not cat
. . . . .
64 inputs ?? ?? ?? ?? ??
xi∈X
?? ?? ??
cat not cat
. . . . .
64 inputs ?? ?? ?? ?? ??
xi∈X
?? ?? ??
cat not cat
. . . . .
64 inputs ?? ?? ?? ?? ??
xi∈X
Specification Optimal Program Metasketch
Specification Optimal Program Metasketch