Adaptive)Concretization)for) Parallel)Program)Synthesis) - - PowerPoint PPT Presentation

adaptive concretization for parallel program synthesis
SMART_READER_LITE
LIVE PREVIEW

Adaptive)Concretization)for) Parallel)Program)Synthesis) - - PowerPoint PPT Presentation

Adaptive)Concretization)for) Parallel)Program)Synthesis) Jinseong(Jeon 1 ,)Xiaokang)Qiu 2 ,) Armando)Solar@Lezama 2 ,)and)Jeffrey)S.)Foster 1) ) 1.)University)of)Maryland,)College)Park) 2.)MIT)CSAIL ) Syntax@guided)Synthesis) bit[32]


slide-1
SLIDE 1

Adaptive)Concretization)for) Parallel)Program)Synthesis)

Jinseong(Jeon1,)Xiaokang)Qiu2,) Armando)Solar@Lezama2,)and)Jeffrey)S.)Foster1) )

1.)University)of)Maryland,)College)Park) 2.)MIT)CSAIL)

slide-2
SLIDE 2

Syntax@guided)Synthesis)

2

bit[32] spec(bit[32] x) { return x – (x % 8); } bit[32] foo(bit[32] x) implements spec { if (??) { // G return x & ??; // A } else { return x | ??; // B } }

unknown) 32@bit)integer) program) speciMication) starts)from) structural) hypothesis) (a.k.a.)template))

slide-3
SLIDE 3

Explicit)Search)

  • Stochastic/systematic)enumeration)of)candidate)space)

3

bit[32] foo(bit[32] x) implements spec { if (??) { // G return x & ??; // A } else { return x | ??; // B } }

65)(=1)+)32*2)) unknown)bits)

bit[32] foo(bit[32] x) ... { if (true) { // G return x & 0x00000000; // A } else { return x | 0x00000000; // B } } bit[32] foo(bit[32] x) ... { if (true) { // G return x & 0x00000001; // A } else { return x | 0x00000000; // B } } bit[32] foo(bit[32] x) ... { if (false) { // G return x & 0xffffffff; // A } else { return x | 0xffffffff; // B } }

...

slide-4
SLIDE 4

Symbolic)Search)

  • Constraint)solving)via)SAT/SMT)solver)

4

bit[32] foo(bit[32] x) implements spec { if (??) { // G return x & ??; // A } else { return x | ??; // B } }

Sketch)solves) in)50ms) eq(spec(x), bvSub(x, bvMod(x, 8))) eq(foo(x), spec(x)) eq(foo(x), ite(G, bvAND(x, A), bvOR(x, B)))

bit[32] spec(bit[32] x) { return x – (x % 8); }

slide-5
SLIDE 5

Adaptive)Concretization)

5 eq(spec(x), bvSub(x, bvMod(x, 8))) eq(foo(x), spec(x)) eq(foo(x), ite(G, bvAND(x, A), bvOR(x, B)))

bit[32] foo(bit[32] x) ... { if (true) { // G return x & 0x00000000; // A } else { return x | 0x00000000; // B } } bit[32] foo(bit[32] x) ... { if (true) { // G return x & 0x00000001; // A } else { return x | 0x00000000; // B } }

...

Symbolic)search) Explicit)search) Adaptive)Concretization)

?)

slide-6
SLIDE 6

Symbolic)Constraints)

6

bit[32] foo(bit[32] x) implements spec { if (??) { // G return x & ??; // A } else { return x | ??; // B } }

eq(spec(x), bvSub(x, bvMod(x, 8))) eq(foo(x), spec(x)) eq(foo(x), ite(G, bvAND(x, A), bvOR(x, B)))

bit[32] spec(bit[32] x) { return x – (x % 8); }

slide-7
SLIDE 7

Low@level)SAT)Formula)

7

eq(spec(x), bvSub(x, bvMod(x, 8))) eq(foo(x), spec(x)) eq(foo(x), ite(G, bvAND(x, A), bvOR(x, B)))

G)

x)@)x)%)8)

x0) =) ite) &) A_0) |) B_0) x1) =) ite) &) A_1) |) B_1) x2) =) ite) &) A_2) |) B_2) x3) =) ite) &) A_3) |) B_3) x4) =) ite) &) A_4) |) B_4) x5) =) ite) &) A_5) |) B_5) x6) =) ite) &) A_6) |) B_6) x7) =) ite) &) A_7) |) B_7) x8) =) ite) &) A_8) |) B_8) x9) =) ite) &) A_9) |) B_9)

#node)488) 50ms)to)solution)

slide-8
SLIDE 8

CEGIS)

  • Synthesis:))
  • Counter@Example)Guided)Inductive)Synthesis)
  • All)x)⇒)xi)in)E)
  • Candidate)solution)for)c)is)checked)
  • Counter)example)is)added)to)E;)and)repeat)
  • Reducing)the)formula)Q)is)a)big)win)

8

a ∃c.∀x.Q(x, c).

m ∧xi∈EQ(xi, c),

G)

x)@)x)%)8)

x0) =) ite) &) A_0) |) B_0) x1) =) ite) &) A_1) |) B_1) x2) =) ite) &) A_2) |) B_2) x3) =) ite) &) A_3) |) B_3) x4) =) ite) &) A_4) |) B_4) x5) =) ite) &) A_5) |) B_5) x6) =) ite) &) A_6) |) B_6) x7) =) ite) &) A_7) |) B_7) x8) =) ite) &) A_8) |) B_8) x9) =) ite) &) A_9) |) B_9)

E E’ E’’

G)

x)@)x)%)8)

x0) =) ite) &) A_0) |) B_0) x1) =) ite) &) A_1) |) B_1) x2) =) ite) &) A_2) |) B_2) x3) =) ite) &) A_3) |) B_3) x4) =) ite) &) A_4) |) B_4) x5) =) ite) &) A_5) |) B_5) x6) =) ite) &) A_6) |) B_6) x7) =) ite) &) A_7) |) B_7) x8) =) ite) &) A_8) |) B_8) x9) =) ite) &) A_9) |) B_9) G)

x)@)x)%)8)

x0) =) ite) &) A_0) |) B_0) x1) =) ite) &) A_1) |) B_1) x2) =) ite) &) A_2) |) B_2) x3) =) ite) &) A_3) |) B_3) x4) =) ite) &) A_4) |) B_4) x5) =) ite) &) A_5) |) B_5) x6) =) ite) &) A_6) |) B_6) x7) =) ite) &) A_7) |) B_7) x8) =) ite) &) A_8) |) B_8) x9) =) ite) &) A_9) |) B_9)
slide-9
SLIDE 9

G(

x(+(x(%(8(

x0( =( ite( &( A_0( |( B_0( x1( =( ite( &( A_1( |( B_1( x2( =( ite( &( A_2( |( B_2( x3( =( ite( &( A_3( |( B_3( x4( =( ite( &( A_4( |( B_4( x5( =( ite( &( A_5( |( B_5( x6( =( ite( &( A_6( |( B_6( x7( =( ite( &( A_7( |( B_7( x8( =( ite( &( A_8( |( B_8( x9( =( ite( &( A_9( |( B_9(

Highly)InMluential)Unknowns)

  • Key)observation:)Unknowns)are)not)all)equally)important)

9

slide-10
SLIDE 10

Partial)Concretization)

  • Replacing)an)unknown)with)a)concrete)value)

10

true x(+(x(%(8(

x0( =( ite( &( A_0( |( B_0( x1( =( ite( &( A_1( |( B_1( x2( =( ite( &( A_2( |( B_2( x3( =( ite( &( A_3( |( B_3( x4( =( ite( &( A_4( |( B_4( x5( =( ite( &( A_5( |( B_5( x6( =( ite( &( A_6( |( B_6( x7( =( ite( &( A_7( |( B_7( x8( =( ite( &( A_8( |( B_8( x9( =( ite( &( A_9( |( B_9(

slide-11
SLIDE 11

Partial)Concretization)

  • Then)simplifying)the)formula)

11

x(+(x(%(8(

x0( =( &( A_0( x1( =( &( A_1( x2( =( &( A_2( x3( =( &( A_3( x4( =( &( A_4( x5( =( &( A_5( x6( =( &( A_6( x7( =( &( A_7( x8( =( &( A_8( x9( =( &( A_9(

#node)488)⇒)391) 50)⇒)30ms)to)solution)

true

slide-12
SLIDE 12

Partial)Concretization)

  • BeneMicial)even)with)a)wrong)concrete)value)
  • Running)two)trials)(incorrect)one)and)then)correct)one))is)

faster)than)pure)symbolic)search)

12

x(+(x(%(8(

x0( =( |( B_0( x1( =( |( B_1( x2( =( |( B_2( x3( =( |( B_3( x4( =( |( B_4( x5( =( |( B_5( x6( =( |( B_6( x7( =( |( B_7( x8( =( |( B_8( x9( =( |( B_9(

false

#node)488)⇒)391) 50)⇒)2ms)to)UNSAT)

slide-13
SLIDE 13

G(

x(+(x(%(8(

x0( =( ite( &( A_0( |( B_0( x1( =( ite( &( A_1( |( B_1( x2( =( ite( &( A_2( |( B_2( x3( =( ite( &( A_3( |( B_3( x4( =( ite( &( A_4( |( B_4( x5( =( ite( &( A_5( |( B_5( x6( =( ite( &( A_6( |( B_6( x7( =( ite( &( A_7( |( B_7( x8( =( ite( &( A_8( |( B_8( x9( =( ite( &( A_9( |( B_9(

InMluence)of)Unknowns)

  • Key)observation:)Unknowns)are)not)all)equally)important)

13

slide-14
SLIDE 14

Unknowns)for)Computation)

  • Arithmetic)unknowns)are)best)left)to)the)solver)

14

G(

x(+(x(%(8(

x0( =( ite( &( A_0( |( B_0( x1( =( ite( &( A_1( |( B_1( x2( =( ite( &( A_2( |( B_2( x3( =( ite( &( A_3( |( B_3( x4( =( ite( &( A_4( |( B_4( x5( =( ite( &( A_5( |( B_5( x6( =( ite( &( A_6( |( B_6( x7( =( ite( &( A_7( |( B_7( x8( =( ite( &( A_8( |( B_8( x9( =( ite( &(

true

|( B_9(

slide-15
SLIDE 15

Unknowns)for)Computation)

  • Arithmetic)unknowns)are)best)left)to)the)solver)

15

G(

x(+(x(%(8(

x0( =( ite( &( A_0( |( B_0( x1( =( ite( &( A_1( |( B_1( x2( =( ite( &( A_2( |( B_2( x3( =( ite( &( A_3( |( B_3( x4( =( ite( &( A_4( |( B_4( x5( =( ite( &( A_5( |( B_5( x6( =( ite( &( A_6( |( B_6( x7( =( ite( &( A_7( |( B_7( x8( =( ite( &( A_8( |( B_8( x9( =( ite(

true

|( B_9(

#node)488)⇒)486) 50ms)to)solution/UNSAT)

slide-16
SLIDE 16

InMluence)Estimation)

  • Key)observation:)Unknowns)are)not)all)equally)important)
  • But,)this)inMluence)computation)is)an)estimate.)
  • We)opt)to)randomize!)

16

High) inMluence) Low) inMluence)

slide-17
SLIDE 17

The)“V”,)Abstractly)

17

16) 32) 64) 128) 256) 512) 1024) 2048) 4096) 8192)

Running(time( degree)of)concretization) 0) ∞) explicit) symbolic) mixed)

slide-18
SLIDE 18
  • Starts)from)low)degrees)(to)avoid)long@running)high)degree))
  • Runs)trials)(in)parallel))and)estimates)running)time)

18

16# 32# 64# 128# 256# 512# 1024# 2048# 4096# 8192#

Estimated)Running)Time)

slide-19
SLIDE 19

16# 32# 64# 128# 256# 512# 1024# 2048# 4096# 8192#

Comparing)Two)Degrees)

  • Wilcoxon)Signed@Rank)Test)
  • determines)if)two)data)sets)are)from)distinct)populations)

19

slide-20
SLIDE 20

16# 32# 64# 128# 256# 512# 1024# 2048# 4096# 8192#

Widening)

  • Widen)the)range)
  • if)not)distinguishable)

20

slide-21
SLIDE 21

16# 32# 64# 128# 256# 512# 1024# 2048# 4096# 8192#

Shifting)

  • Shift)to)the)next)range)
  • if)distinguishable)and)the)high)pivot)is)faster)(i.e.,)down@hill))

21

slide-22
SLIDE 22

16# 32# 64# 128# 256# 512# 1024# 2048# 4096# 8192#

Climbing)

  • Keep)climbing)until)the)up@hill)appears)
  • optimum)likely)lies)between)that)range)

22

slide-23
SLIDE 23

16# 32# 64# 128# 256# 512# 1024# 2048# 4096# 8192#

Binary)Search)

  • Binary)search)between)the)rough)range)

23

slide-24
SLIDE 24

Experiment)

  • 26)sketches)from)5)domains)
  • Pasket)–)framework)model)synthesis)
  • The)motivation)for)this)work)
  • Several)Pasket)examples)could)not)run)under)plain)Sketch)
  • Data)structure)manipulation)
  • Invariants)for)stencils)@)ScientiMic)computation)
  • SyGuS)2014)
  • Sketch)performance)benchmarks)
  • Did)13)runs)on)server)with)forty)2.4GHz)CPUs,)99GB)RAM,)

Ubuntu)14.04.1)LTS)

  • 2@hour)timeout,)32GB)memory)bound)

24

slide-25
SLIDE 25

Performance)Results)

  • Running)on)32)cores,)compared)to)Sketch)
  • Adaptive)Concretization)(AC))better)on)23)of)26)
  • In)one)case,)Sketch)often)aborts)with)out)of)memory)
  • Many)cases)with)speedups)from)3x)to)14x)

25

slide-26
SLIDE 26

Parallel)Scalability)Results)

  • Run)on)1,)4,)and)32)cores)
  • AC)faster)on)1@core)in)17)of)26)cases)
  • AC)generally)speeds)up)with)more)cores)
  • Best)performance)at)32)cores)in)20)of)26)cases)
  • Implementation)does)not)fully)utilize)cores)
  • Current)source)of)overhead:)re@loading)input)Mile)every)time)
  • Compared)to)Enumerative)Solver)(SyGuS)2014)winner))
  • Faster)on)6)of)9)benchmarks)
  • Competitive)on)others)

26

slide-27
SLIDE 27

Conclusion)

  • Adaptive)Concretization)
  • Concretized)high)inMluence)unknowns)
  • Degree)of)concretization)controls)probability)of)concretizing)
  • Parallel)synthesis)algorithm)
  • Key)results)
  • Degree)of)concretization)varies)with)problem)
  • Adaptive)concretization)much)faster)than)Sketch)
  • Reasonable)parallel)scalability)
  • http://plum@umd.github.io/adaptive@concretization/)

27