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)

4

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)

5

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)

6

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 } } bit[32] foo(bit[32] x) ... { if (false) { // G return x & 0xffffffff; // A } else { return x | 0xffffffff; // B } }

... Symbolic)search) Explicit)search) Adaptive)concretization)

bit[32] foo(bit[32] x) ... { if (true) { // G return x & ??; // A } }

... eq(foo(x), bvAND(x, A))

...

bit[32] foo(bit[32] x) ... { if (false) { ... } else { return x | ??; // B } }

... eq(foo(x), bvOR(x, B))

slide-6
SLIDE 6

Symbolic)Constraints)

7

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)

8

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

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-9
SLIDE 9

Partial)Concretization)

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

10

!"#$

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-10
SLIDE 10

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-11
SLIDE 11

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-12
SLIDE 12

Unknowns)for)Computation)

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

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( &(

!"#$

|( B_9(

slide-13
SLIDE 13

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(

!"#$

|( B_9(

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

slide-14
SLIDE 14

InMluence)Estimation)

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

15

High) inMluence) Low) inMluence)

slide-15
SLIDE 15

Degree)of)Concretization)

  • Threshold)for)concretization)
  • Probability)of)concretizing)a)high)inMluence)unknown)

16

0) ∞) (symbolic)) all)nodes)have) no)chance)of) concretization) (explicit)) all)nodes)have) ½)chance)of) concretization) (mixed)) The)higher)the)inMluence,) the)higher)the)chance)of) concretization) d)

slide-16
SLIDE 16

The)“V”,)Abstractly)

  • Optimal)degree)has)best)tradeoff)of)amount)of)

concretization)vs.)probability)of)success)

17

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

Running(time(

slide-17
SLIDE 17

Adaptive)Concretization)

  • Basic)algorithm)
  • Start)with)degree)low=1,)high=2)
  • Trials)at)low)degrees)will)be)very)fast,)since)mostly)concrete)
  • Exponentially)climb)until)optimum)degree)between)low,)high)
  • Use)a)statistical)test)to)determine)which)degree)is)faster)
  • Binary)search)between)low,)high)to)Mind)optimal)degree)
  • Repeatedly)run)concretization)at)Minal)degree)
  • Exit)at)any)time)if)solution)found)
  • Naturally)parallelize)
  • Using)different)cores)to)run)different)trials)

18

slide-18
SLIDE 18

Estimated)Running)Time)

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

19

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

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)

20

slide-20
SLIDE 20

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

Widening)

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

21

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

22

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)

23

slide-23
SLIDE 23

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

Binary)Search)

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

24

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)

25

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)

26

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)

27

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

28

slide-28
SLIDE 28

Backup)Slides)

slide-29
SLIDE 29

Program)Synthesis)

  • Syntax@guided)synthesis)very)successful)
  • Programming)by)example,)auto@grading,)cache)coherence,)

database)query)optimization,)etc.)

  • Two)basic)approaches)
  • symbolic)search)–)constraint)solving)via)SAT/SMT)solver)
  • explicit)search)–)systematic/stochastic)enumeration)
  • Neither)approach)is)strictly)better)
  • SyGuS)2014)

30

slide-30
SLIDE 30

Adaptive)Concretization)

  • Combine)the)best)of)the)two)approaches)
  • Concretize)highly1in2luential)unknowns)
  • Use)symbolic)search)for)remaining)unknowns)
  • Challenge)1:)inMluence)calculation)
  • Practically)compute)the)precise)inMluence)of)an)unknown)
  • Challenge)2:)degree)of)concretization)
  • Probability)of)concretizing)a)high)inMluence)unknown)
  • Challenge)3:)estimate)the)optimal)degree)online)
  • Hill)climbing)+)binary)search)(based)on)a)statistical)test))

31

slide-31
SLIDE 31

Results)

  • Implemented)on)top)of)Sketch)
  • Optimal)degree)of)concretization)varies)
  • Adaptive)concretization)searches)for)the)best)degree)online)
  • Ran)26)benchmarks)
  • Selected)from)SyGuS)2014,)Sketch)performance)benchmarks,)

automated)tutoring,)etc.)

  • Outperforms)Sketch)on)23)benchmarks)
  • Competitive)with)or)outperforms)SyGuS)2014)winner)
  • Reasonable)parallel)scalability)

32

slide-32
SLIDE 32

Sketch)

  • ??)is)unknown)32@bit)integer)
  • Sketch)has)65)unknown)bits)
  • Too)large)to)enumerate,)but)easy)for)a)SAT)solver)
  • Sketch)solves)in)50ms)
  • Key)observation:)Unknowns)are)not)all)equally)important)

33

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

slide-33
SLIDE 33

InMluence)of)Unknowns)

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

34

H__0 4 5 18 30 42 54 66 78 90 102 114 126 138 150 162 174 186 198 210 222 234 246 258 270 282 294 306 318 330 342 354 370 386 H__2_0 3 2 7 10 17 20 22 29 32 34 41 44 46 53 56 58 65 68 70 77 80 82 89 92 94 101 104 106 113 116 118 125 128 130 137 140 142 149 152 154 161 164 166 173 176 178 185 188 190 197 200 202 209 212 214 221 224 226 233 236 238 245 248 250 257 260 262 269 272 274 281 284 286 293 296 298 305 308 310 317 320 322 329 332 334 341 344 346 353 356 359 362 369 372 374 375 378 385 388 390 391 395 398 H__1_0 8 12 11 23 35 47 59 71 83 95 107 119 131 143 155 167 179 191 203 215 227 239 251 263 275 287 299 311 323 335 347 360 363 376 396 13 14 H__2_1 H__1_1 21 24 25 26 H__2_2 H__1_2 33 36 37 38 H__2_3 H__1_3 45 48 49 50 H__2_4 H__1_4 57 60 61 62 H__2_5 H__1_5 69 72 73 74 H__2_6 H__1_6 81 84 85 86 H__2_7 H__1_7 93 96 97 98 H__2_8 H__1_8 105 108 109 110 H__2_9 H__1_9 117 120 121 122 H__2_10 H__1_10 129 132 133 134 H__2_11 H__1_11 141 144 145 146 H__2_12 H__1_12 153 156 157 158 H__2_13 H__1_13 165 168 169 170 H__2_14 H__1_14 177 180 181 182 H__2_15 H__1_15 189 192 193 194 H__2_16 H__1_16 201 204 205 206 H__2_17 H__1_17 213 216 217 218 H__2_18 H__1_18 225 228 229 230 H__2_19 H__1_19 237 240 241 242 H__2_20 H__1_20 249 252 253 254 H__2_21 H__1_21 261 264 265 266 H__2_22 H__1_22 273 276 277 278 H__2_23 H__1_23 285 288 289 290 H__2_24 H__1_24 297 300 301 302 H__2_25 H__1_25 309 312 313 314 H__2_26 H__1_26 321 324 325 326 H__2_27 H__1_27 333 336 337 338 H__2_28 H__1_28 345 348 349 350 H__2_29 H__1_29 357 364 377 394 1 361 365 366 H__2_30 H__1_30 373 380 379 392 381 382 H__2_31 389 400 393 399 397 401 402

H__0 4 3 106 166 178 238 155 227 153 225

#node)488)

slide-34
SLIDE 34

Highly)InMluential)Unknown)

  • The)more)neighborhoods)an)unknown)has,)

the)more)likely)highly)inMluential)it)is.)

35

bit[32] foo(bit[32] x) implements spec { if (T/F) { // H_0 return x & ??; // H_1 } else { return x | ??; // H_2 } }

H__0_0 2 x_2_4_idx_0_0 4 6 11 12 19 20 27 28 35 36 43 44 51 52 59 60 67 68 75 76 83 84 91 92 99 100 107 108 115 116 123 124 131 132 139 140 147 148 155 156 163 164 171 172 179 180 187 188 195 196 203 204 211 212 219 220 227 228 235 237 240 247 248 249 252 259 260 261 265 268 3 5 13 21 29 37 45 53 61 69 77 85 93 101 109 117 125 133 141 149 157 165 173 181 189 197 205 213 221 229 238 241 250 266 7 8 H__0_1 x_2_4_idx_1_0 14 15 16 H__0_2 x_2_4_idx_2_0 22 23 24 H__0_3 x_2_4_idx_3_0 30 31 32 H__0_4 x_2_4_idx_4_0 38 39 40 H__0_5 x_2_4_idx_5_0 46 47 48 H__0_6 x_2_4_idx_6_0 54 55 56 H__0_7 x_2_4_idx_7_0 62 63 64 H__0_8 x_2_4_idx_8_0 70 71 72 H__0_9 x_2_4_idx_9_0 78 79 80 H__0_10 x_2_4_idx_10_0 86 87 88 H__0_11 x_2_4_idx_11_0 94 95 96 H__0_12 x_2_4_idx_12_0 102 103 104 H__0_13 x_2_4_idx_13_0 110 111 112 H__0_14 x_2_4_idx_14_0 118 119 120 H__0_15 x_2_4_idx_15_0 126 127 128 H__0_16 x_2_4_idx_16_0 134 135 136 H__0_17 x_2_4_idx_17_0 142 143 144 H__0_18 x_2_4_idx_18_0 150 151 152 H__0_19 x_2_4_idx_19_0 158 159 160 H__0_20 x_2_4_idx_20_0 166 167 168 H__0_21 x_2_4_idx_21_0 174 175 176 H__0_22 x_2_4_idx_22_0 182 183 184 H__0_23 x_2_4_idx_23_0 190 191 192 H__0_24 x_2_4_idx_24_0 198 199 200 H__0_25 x_2_4_idx_25_0 206 207 208 H__0_26 x_2_4_idx_26_0 214 215 216 H__0_27 x_2_4_idx_27_0 222 223 224 H__0_28 x_2_4_idx_28_0 230 231 232 H__0_29 x_2_4_idx_29_0 242 236 251 264 1 239 243 244 H__0_30 x_2_4_idx_30_0 254 253 262 255 256 H__0_31 x_2_4_idx_31_0 270 263 269 267 271 272

set)false)) ⇒)2ms)to)UNSAT) set)true)) ⇒)30ms)to)solution) #node)488)⇒)391)

slide-35
SLIDE 35

InMluence)of)Unknowns)

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

36

H__0 4 5 18 30 42 54 66 78 90 102 114 126 138 150 162 174 186 198 210 222 234 246 258 270 282 294 306 318 330 342 354 370 386 H__2_0 3 2 7 10 17 20 22 29 32 34 41 44 46 53 56 58 65 68 70 77 80 82 89 92 94 101 104 106 113 116 118 125 128 130 137 140 142 149 152 154 161 164 166 173 176 178 185 188 190 197 200 202 209 212 214 221 224 226 233 236 238 245 248 250 257 260 262 269 272 274 281 284 286 293 296 298 305 308 310 317 320 322 329 332 334 341 344 346 353 356 359 362 369 372 374 375 378 385 388 390 391 395 398 H__1_0 8 12 11 23 35 47 59 71 83 95 107 119 131 143 155 167 179 191 203 215 227 239 251 263 275 287 299 311 323 335 347 360 363 376 396 13 14 H__2_1 H__1_1 21 24 25 26 H__2_2 H__1_2 33 36 37 38 H__2_3 H__1_3 45 48 49 50 H__2_4 H__1_4 57 60 61 62 H__2_5 H__1_5 69 72 73 74 H__2_6 H__1_6 81 84 85 86 H__2_7 H__1_7 93 96 97 98 H__2_8 H__1_8 105 108 109 110 H__2_9 H__1_9 117 120 121 122 H__2_10 H__1_10 129 132 133 134 H__2_11 H__1_11 141 144 145 146 H__2_12 H__1_12 153 156 157 158 H__2_13 H__1_13 165 168 169 170 H__2_14 H__1_14 177 180 181 182 H__2_15 H__1_15 189 192 193 194 H__2_16 H__1_16 201 204 205 206 H__2_17 H__1_17 213 216 217 218 H__2_18 H__1_18 225 228 229 230 H__2_19 H__1_19 237 240 241 242 H__2_20 H__1_20 249 252 253 254 H__2_21 H__1_21 261 264 265 266 H__2_22 H__1_22 273 276 277 278 H__2_23 H__1_23 285 288 289 290 H__2_24 H__1_24 297 300 301 302 H__2_25 H__1_25 309 312 313 314 H__2_26 H__1_26 321 324 325 326 H__2_27 H__1_27 333 336 337 338 H__2_28 H__1_28 345 348 349 350 H__2_29 H__1_29 357 364 377 394 1 361 365 366 H__2_30 H__1_30 373 380 379 392 381 382 H__2_31 389 400 393 399 397 401 402

308 320 332 344 356 369 372 385 388 H__1_25 H__1_26 H__1_27 H__1_28 H__2_30 H__2_31

#node)488)

slide-36
SLIDE 36

Unknown)for)Computation)

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

37

bit[32] foo(bit[32] x) implements spec { if (??) { // H_0 bit[31] h = ??; // H_1’ return x & (h + 0/1); } else { return x | ??; // H_2 } }

H__0 4 5 18 30 42 54 66 78 90 102 114 126 138 150 162 174 186 198 210 222 234 246 258 270 282 294 306 318 330 342 354 370 386 H__2_0 3 x_4_b_idx_0_0 7 10 17 20 22 29 32 34 41 44 46 53 56 58 65 68 70 77 80 82 89 92 94 101 104 106 113 116 118 125 128 130 137 140 142 149 152 154 161 164 166 173 176 178 185 188 190 197 200 202 209 212 214 221 224 226 233 236 238 245 248 250 257 260 262 269 272 274 281 284 286 293 296 298 305 308 310 317 320 322 329 332 334 341 344 346 353 356 359 362 369 372 374 375 378 385 388 389 393 396 H__1_0 8 12 9 11 23 35 47 59 71 83 95 107 119 131 143 155 167 179 191 203 215 227 239 251 263 275 287 299 311 323 335 347 360 363 376 394 13 14 H__2_1 x_4_b_idx_1_0 H__1_1 21 24 25 26 H__2_2 x_4_b_idx_2_0 H__1_2 33 36 37 38 H__2_3 x_4_b_idx_3_0 H__1_3 45 48 49 50 H__2_4 x_4_b_idx_4_0 H__1_4 57 60 61 62 H__2_5 x_4_b_idx_5_0 H__1_5 69 72 73 74 H__2_6 x_4_b_idx_6_0 H__1_6 81 84 85 86 H__2_7 x_4_b_idx_7_0 H__1_7 93 96 97 98 H__2_8 x_4_b_idx_8_0 H__1_8 105 108 109 110 H__2_9 H__1_9 117 120 121 122 H__2_10 H__1_10 129 132 133 134 H__2_11 H__1_11 141 144 145 146 H__2_12 H__1_12 153 156 157 158 H__2_13 H__1_13 165 168 169 170 H__2_14 H__1_14 177 180 181 182 H__2_15 H__1_15 189 192 193 194 H__2_16 H__1_16 201 204 205 206 H__2_17 H__1_17 213 216 217 218 H__2_18 H__1_18 225 228 229 230 H__2_19 H__1_19 237 240 241 242 H__2_20 H__1_20 249 252 253 254 H__2_21 H__1_21 261 264 265 266 H__2_22 H__1_22 273 276 277 278 H__2_23 H__1_23 285 288 289 290 H__2_24 H__1_24 297 300 301 302 H__2_25 H__1_25 309 312 313 314 H__2_26 H__1_26 321 324 325 326 H__2_27 H__1_27 333 336 337 338 H__2_28 H__1_28 345 348 349 350 H__2_29 H__1_29 357 364 377 392 1 361 365 366 H__2_30 H__1_30 373 380 379 390 381 382 H__2_31 387 398 391 397 395 399 400

#node)488)⇒)486) set)one)bit)incorrectly) ⇒)50ms)to)UNSAT) set)one)bit)correctly) ⇒)50ms)to)solution)

slide-37
SLIDE 37

InMluence)Estimation)

  • Need)to)estimate)an)unknown’s)inMluence)
  • Ideal:)how)much)concretizing)affects)solution)time)
  • Another)idea:)how)much)concretizing)affects)formula)size)
  • Still)too)expensive)to)actually)substitute)and)simplify)
  • Our)approach:)Estimate)effect)on)formula)size)
  • Sketch)represents)formulae)as)graphs)
  • Focusing)on)the)immediate)neighborhood)of)unknowns)

38

slide-38
SLIDE 38

InMluence)and)BeneMit)

  • For)an)unknown)n)in)tree,)deMine)

inMluence(n))=)Σ)beneMit(d,)n))where)d)∈)use(n))

  • beneMit(d,)n))measures)how)formula)might)shrink)

if)we)concretize)node)n)that’s)used)by)node)d)

  • High)inMluence)means)concretizing)will)likely)shrink)

formula)a)lot)

39

d( beneCit(d,(n)( d)=)ite(n,)a,)b)) 1) d)=)ite(c,)n,)b)) 0) d)=)ite(c,)a,)n)) 0) d)=)¬n) inMluence(d)) d)=)other)boolean) 0.5) d)=)arithmetic)op) @)∞)

slide-39
SLIDE 39

Degree)of)Concretization)

  • What)inMluence)threshold)to)use)for)concretization?)
  • Problem)1:)inMluence)computation)is)an)estimate)
  • Problem)2:)may)vary)for)different)problems)(spoiler:)it)does))
  • Base)decision)on)degree)of)concretization)

) ) ) ) ) where)N)=)inMluence(n))

  • if)degree)0,)all)nodes)have)½)chance)of)concretization)
  • if)degree)∞,)all)nodes)have)no)chance)of)concretization)

40

p =    if N < 0 1.0 if N > 1500 1/(max(2, degree/N))

  • therwise
slide-40
SLIDE 40

Optimal)Degree)Experiment)

  • Ran)set)of)benchmarks)at)varying)degrees)
  • 7)benchmarks)
  • 6)degrees:)16,)64,)128,)512,)1024,)and)4096)
  • no)timeout)
  • Estimated)time)to)success)
  • p)=)fraction)of)the)256)runs)that)succeed)
  • t)=)running)time)of)run)
  • Estimated)time)to)succeed)=)t/p)
  • if)p)=)0,)estimated)time)=)∞)
  • Optimal)degree)varies)across)benchmarks)
  • Running)times)form)a)“V”)around)optimum)

41

slide-41
SLIDE 41

Optimal)Degree)Results)

42

  • ptimal)degree)varies)

across)benchmarks) vee)shape)

slide-42
SLIDE 42

Optimal)Degree)Results)

  • Optimal)degree)varies)across)benchmarks)
  • And)a)lot)of)variance)across)runs)
  • Notice:)running)times)form)a)“V”)around)optimum)
  • Hence)can)search)for)the)best)degree)

43

Bench Degree mark 16 64 128 512 1024 4096 p button

∞ ∞ ∞

22

18

60

55

56

65

p color

∞ ∞

23

8

10

3

31

10

4

1

p menu

∞ ∞ ∞

31

31

14

6

12

7

l prepend 77

62

116

114

94

94

179

258

716

643

1,490

270

l min

23

274

59

2,388

1,440 2,711 5,770 3,387 7,434 2,177 a mom 1

1,176

620

308

1,376

1,655 1,476 3,883 3,000 1,433 2,514 a mom 2

∞ ∞

9,262

5,920 9,610 22,468 20,03640,453 10,461 5,499

able 1: Expected running time (s) using empirical success rate. SIQR in sm

Expecting)running)time)(s))and)semi)interquartile)range)(SIQR))

slide-43
SLIDE 43

Running)an)Individual)Trial)

  • Concretization)space)size)is)number)of)possibilities)chosen)

among)for)concretization)

  • E.g.,)for)n)bits)would)be)2n)
  • Assuming)one)correct)solution,)returns)estimated)time)to)

success)

  • Can)execute)many)run_trials)in)parallel)

44

run_trial(degree) run Sketch with degree if (solution found) raise success else return running time / concretization space size

slide-44
SLIDE 44

Comparing)Two)Degrees)

  • Return)indicates)lower)estimated)completion)time)
  • Wilcoxon)Signed@Rank)Test)(returns)p@value))
  • determines)if)two)data)sets)are)from)distinct)populations)
  • threshold)T)to)determine)when)we)have)enough)data)
  • Cut)off)search)after)more)than)M)runs)

45

compare(deg_a, deg_b) dist_a, dist_b ← while wilcoxon(dist_a, dist_b) > T && |dist_a| < M dist_a = dist_a run_trial(deg_a) dist_b = dist_b run_trial(deg_b) if wilcoxon(dist_a, dist_b) > T then return tie elif avg(dist_a) < avg(dist_b) then return left else return right

slide-45
SLIDE 45

Searching)for)Optimum)

  • Phase)1:)Exponential)climbing)
  • Roughly)bound)the)optimal)degree)
  • Phase)2:)Binary)search)within)those)rough)bounds)
  • Why)exponential)climbing?)
  • Extremely)slow)if)binary)search)across)the)whole)range)
  • degree)1:)very)fast)vs.)degree)∞:)potentially)take)a)long)time)

46

main() (low, high) ← climb() deg ← bin_search(2low, 2high) while (true) run_trial(deg)

slide-46
SLIDE 46

Hill)Climbing)

  • Case)tie
  • Too)narrow)range)
  • Widen)it)

by)increasing)high)only)

47

climb() low, high ← 0, 1 while high < Max_exp case compare(2low, 2high) of left: break right: low ← high; high ← high + 1 tie: high ← high + 1 return (low, high)

low high high’

slide-47
SLIDE 47

Hill)Climbing)

  • Case)right
  • 2high)is)better)than)2low
  • Shift)up)to)the)next)range)

48

climb() low, high ← 0, 1 while high < Max_exp case compare(2low, 2high) of left: break right: low ← high; high ← high + 1 tie: high ← high + 1 return (low, high)

low low’ high’

slide-48
SLIDE 48

Hill)Climbing)

  • Case)left
  • 2low)is)better)than)2high)
  • Optimum)is)somewhere)

between)two;)stops)climbing)

49

climb() low, high ← 0, 1 while high < Max_exp case compare(2low, 2high) of left: break right: low ← high; high ← high + 1 tie: high ← high + 1 return (low, high)

low high

slide-49
SLIDE 49

Binary)Search)

  • Maintaining)invariant:)low)has)expected)faster)than)high
  • For)a)midpoint)mid:)
  • case)left:)low)is)still)better;)narrows)down)to)(low,)mid))
  • case)right:)mid)is)better;)shifts)to)(mid,)high))
  • case)tie:)no)difference;)returns)mid)as)the)optimum)

50

bin_search(low, high) mid ← (low + high) / 2 case compare(low, mid) of left: return bin_search(low, mid) right: return bin_search(mid, high) tie: return mid

slide-50
SLIDE 50

Performance)Results)

51

slide-51
SLIDE 51

Performance)Results)

  • AC)about)the)same)on)1)of)26)
  • AC)slower)(but)within)factor)of)about)two))on)last)two)
  • In)one)case,)degree)search)process)was)slow)
  • In)the)other,)running)time)dominated)by)checking)phase,)

so)no)beneMit)to)parallelization)

52

slide-52
SLIDE 52

Performance)Details)

53

Bench Sketch Adaptive Non-Adaptive mark LoC Time (s) Degree # Trials Time (s) # Trials Time (s) p button 3,436 50

4,160 639 51

8

249 21

6

p color 3,194 13 3,072 551 33

6

109 12

4

p menu 4,099 OOM 5,120 752 84

18

207 31

10

l prepend 708 96

8

32 98 20

4

110 25

4

l min 795 810

235

512 153 59

40

17 28

6

a mom 1 229 336

35

256 316 274

76

331 285

16

a mom 2 231 1,000

56

2,048 383 1,517

254

303 1,422

89

ar s 4 313 6

1

16 18 3 25 3 ar s 5 334 9 16 17 4 29 4

1

ar s 6 337 17

2

32 23 6 33 9

1

ar s 7 322 63

8

64 84 50

12

35 59

8

ar sum 328 618

282

16 11 50

19

27 31

8

slide-53
SLIDE 53

Performance)Details)

54

Bench Sketch Adaptive Non-Adaptive mark LoC Time (s) Degree # Trials Time (s) # Trials Time (s) hd 13 d5 310 88

47

16 3 11

2

7 8 hd 14 d1 304 156

41

16 5 29

12

10 22

7

hd 14 d5 329 1,294

388

16 23 229

47

16 239

83

hd 15 d5 329 733

370

32 9 177

16

6 213

39

s cg 124 18

4

64 161 15

2

160 14 s log2 49 971

314

128 114 349

105

25 131

89

s logcnt 30 225

206

32 90 21

26

84 16

6

s rev 136 327

202

256 165 53

22

11 43

14

deriv2 1,444 28

4

16 15 8 20 8

2

deriv3 1,410 28

2

32 9 7

1

10 7 deriv4 1,410 14 16 7 6 20 5 deriv5 1,410 14

1

16 7 6 19 5 q noti 262 12

6

32 100 8

2

79 6

1

q serv 2,005 105

60

32 11 22

2

9 23

2

Table 2: Comparing Sketch, adaptive, and non-adaptive concretization.

slide-54
SLIDE 54

Parallel)Scalability)Results)

55

slide-55
SLIDE 55

Parallel)Scalability)Details)

56

Bench Sketch # Cores (Time (s)) mark Time (s) 1 4 32 Real Real CPU Real CPU p button 50

∞ 818 ∞

70

30

148

142

51

8

406

179

p color 13

43

4

42

29

33

6

126

74

p menu OOM

304

275

501

589

84

18

780

300

l prepend 96

8

36

10

37

9

52

14

20

4

124

12

l min 810

235

159

62

287

172

59

40

425

324

a mom 1 336

35

455

97 1,545 460

274

76

3,055

802

a mom 2 1,000

56

1,469

144 4,730 647 1,517 254 20,18914,315

ar s 4 6

1

5

2

4 2 3 11

6

ar s 5 9 6

2

8

2

9

2

4 9

4

ar s 6 17

2

15

2

13

2

21

4

6 24

12

ar s 7 63

8 131 61

62

36

97

90

50

12

340

221

ar sum 618

282

97

46

103

70

168

60

50

19

74

31

slide-56
SLIDE 56

Parallel)Scalability)Details)

57

hd 13 d5 88

47 11 5

13

2

8

4

11

2

7

2

hd 14 d1 156

41

48

32

53

23

28

20

29

12

26

18

hd 14 d5 1,294

388

389

122

384

102

229

47

386

94

hd 15 d5 733

370 544 392

254

62

291

100

177

16

266

104

s cg 18

4 13 4

15

2

19

4

15

2

42

17

s log2 971

314

1,157

455 2,541 1,500

349

105

1,675 1,402 s logcnt 225

206 199 260

147

137

283

181

21

26

140

148

s rev 327

202 309

117

102

176

106

53

22

107

144

deriv2 28

4

19

7

12

4

14

7

8 18

4

deriv3 28

2

5

2

8

2

6

2

7

1

11

4

deriv4 14 4

2

6 3

1

6 6

2

deriv5 14

1

5

1

6 4 6 8

2

q noti 12

6

8

4

19

9

14

8

8

2

21

4

q serv 105

60

34

16

33

6

29

14

22

2

45

26

Table 3: Parallel scalability of adaptive concretization.

Bench Sketch # Cores (Time (s)) mark Time (s) 1 4 32 Real Real CPU Real CPU

slide-57
SLIDE 57

Comparison)to)Enum.)Solver)

58

Bench Sketch # Cores (Time (s)) Enum mark Time (s) 1 4 32 Time(s) Real Real CPU Real CPU 1,000

1,469 4,730 1,517 20,189 ar s 4 6

1

5

2

4 2 3 11

6 1,804 44

ar s 5 9 6

2

8

2

9

2

4 9

4

ar s 6 17

2

15

2

13

2

21

4

6 24

12

ar s 7 63

8 131 61

62

36

97

90

50

12

340

221

ar sum 618

282

97

46

103

70

168

60

50

19

74

31

hd 13 d5 88

47 11 5

13

2

8

4

11

2

7

2

8 hd 14 d1 156

41

48

32

53

23

28

20

29

12

26

18

8 hd 14 d5 1,294

388

389

122

384

102

229

47

386

94

201

1

hd 15 d5 733

370 544 392

254

62

291

100

177

16

266

104

424

13

s cg 18 13 15 19 15 42