fast synthesis of fast collections
play

Fast Synthesis of Fast Collections Calvin Loncaric Emina Torlak - PowerPoint PPT Presentation

Fast Synthesis of Fast Collections Calvin Loncaric Emina Torlak Michael D. Ernst University of Washington Data structures are everywhere 2 Data structures are everywhere 2 Data structures are everywhere 2 Data structures are


  1. 
 
 
 Outlines → Implementations class Structure { 
 HashLookup ( 
 HMap<int ,V > data; 
 data , 
 Iterator<Entry> 
 e.queryId = q ) retrieve (q) { … } 
 } 
 V = ArrayList<Entry> 15

  2. 
 
 
 Outlines → Implementations class Structure { 
 HashLookup ( 
 HMap<int ,V > data; 
 data , 
 Iterator<Entry> 
 e.queryId = q ) retrieve (q) { … } 
 } 
 V = ArrayList<Entry> V = LinkedList<Entry> 15

  3. 
 
 
 Outlines → Implementations class Structure { 
 HashLookup ( 
 HMap<int , V> data; 
 data , 
 Iterator<Entry> 
 e.queryId = q ) retrieve (q) { … } 
 } 
 16

  4. 
 
 
 
 Outlines → Implementations class Structure { 
 HashLookup ( 
 HMap<int , V> data; 
 data , 
 Iterator<Entry> 
 e.queryId = q ) retrieve (q) 
 { v = data.get(q); 
 return v.iterator(); } 17

  5. 
 
 
 
 Outlines → Implementations add, remove, class Structure { 
 update HashLookup ( 
 HMap<int , V> data; 
 data , 
 Iterator<Entry> 
 e.queryId = q ) retrieve (q) 
 { v = data.get(q); 
 return v.iterator(); } 17

  6. Specification → Outline Rep. Rep. Impl. Impl. Inductive Inductive Specification Specification Outline Outline Rep. Rep. Impl. Impl. Verifier Verifier Synthesizer Synthesizer Rep. Rep. Impl. Impl. 18

  7. Specification → Outline Rep. Impl. Inductive Specification Outline Rep. Impl. Verifier Synthesizer Rep. Impl. 18

  8. Specification → Outline CEGIS candidate Inductive Verifier Synthesizer retrieve : all e where 
 e.queryId = q and … counterexample - or - certification of correctness 19

  9. Specification → Outline CEGIS Remembers all examples; only reasons about examples collected candidate thus far. Inductive Verifier Synthesizer retrieve : all e where 
 e.queryId = q and … counterexample - or - certification of correctness 19

  10. Specification → Outline CEGIS Remembers all Must ensure the examples; only outline is correct for reasons about all possible inputs examples collected and all possible data candidate thus far. structure states. Inductive Verifier Synthesizer retrieve : all e where 
 e.queryId = q and … counterexample - or - ∀ I ∀ S , out = certification of correctness { e | e ∈ S ∧ P ( I , e ) } 19

  11. Cost Model Filter ( 
 HashLookup ( 
 All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) 20

  12. Cost Model O (1) Filter ( 
 HashLookup ( 
 All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) 20

  13. Cost Model O ( n ) O (1) Filter ( 
 HashLookup ( 
 All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) 20

  14. Cost Model O ( n ) O (1) O (1) Filter ( 
 HashLookup ( 
 All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) 20

  15. Cost Model O ( n ) O (1) O (1) O (1) Filter ( 
 HashLookup ( 
 All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) 20

  16. Cost Model O ( n ) O (1) O (1) O (1) Filter ( 
 HashLookup ( 
 > All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) 20

  17. Cost Model O ( n ) O (1) O (1) O (1) Filter ( 
 HashLookup ( 
 > All (), 
 All (), 
 e.queryId = q ) e.queryId = q ) Cozy prefers outlines with lower cost 20

  18. Inductive Synthesis Enumerative search 21

  19. Inductive Synthesis Enumerative search size 1 All 21

  20. Inductive Synthesis Enumerative search size 1 size 2 HashLookup(All, x=y) All Filter(All, x=y) BinarySearch(All, x>y) … 21

  21. Inductive Synthesis Enumerative search size 1 size 2 HashLookup(All, x=y) All Filter(All, x=y) BinarySearch(All, x>y) … 21

  22. Inductive Synthesis Enumerative search Concat( HashLookup(…) ,…) vs Concat( Filter(…) ,…) size 1 size 2 HashLookup(All, x=y) All Filter(All, x=y) BinarySearch(All, x>y) … 21

  23. Inductive Synthesis Enumerative search size 1 size 2 size 3 HashLookup( HashLookup(All, x=y) HashLookup(…), a=b) Filter( All Filter(All, x=y) HashLookup(…), p=q) Filter( BinarySearch(All, x>y) BinarySearch(…), x<y) … … 21

  24. Inductive Synthesis Enumerative search correct on all current examples size 1 size 2 size 3 HashLookup( HashLookup(All, x=y) HashLookup(…), a=b) Filter( Filter( All Filter(All, x=y) HashLookup(…), p=q) HashLookup(…), p=q) Filter( BinarySearch(All, x>y) BinarySearch(…), x<y) … … 21

  25. 
 
 
 Outline Verification Specification: Entry has: 
 queryId : Int, 
 subqueryId : Int, 
 … retrieve : all e where 
 P e.queryId = q and … 
 22

  26. 
 
 
 Outline Verification Specification: { e | e ∈ S ∧ P ( I , e ) } Entry has: 
 queryId : Int, 
 subqueryId : Int, 
 … retrieve : all e where 
 P e.queryId = q and … 
 22

  27. 
 
 
 Outline Verification Specification: HashLookup ( 
 All (), 
 { e | e ∈ S ∧ P ( I , e ) } Entry has: 
 queryId : Int, 
 e.queryId = q) subqueryId : Int, 
 … retrieve : all e where 
 P e.queryId = q and … 
 22

  28. 
 
 
 Outline Verification Specification: HashLookup ( 
 All (), 
 { e | e ∈ S ∧ P ( I , e ) } Entry has: 
 queryId : Int, 
 e.queryId = q) subqueryId : Int, 
 … representative predicate Q retrieve : all e where 
 P e.queryId = q and … 
 e.queryId = q 22

  29. 
 
 
 Outline Verification Specification: HashLookup ( 
 All (), 
 { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } Entry has: 
 queryId : Int, 
 e.queryId = q) subqueryId : Int, 
 … representative predicate Q retrieve : all e where 
 P e.queryId = q and … 
 e.queryId = q 22

  30. Outline Verification ? = { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } 23

  31. Outline Verification ? = { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } yes if and only if for all I , e : P ( I , e ) = Q ( I , e ) 23

  32. Outline Verification ? = { e | e ∈ S ∧ P ( I , e ) } { e | e ∈ S ∧ Q ( I , e ) } yes if and only if for all I , e : P ( I , e ) = Q ( I , e ) equivalence can be checked with an SMT solver 23

  33. Evaluation 24

  34. Evaluation • Improve correctness 24

  35. Evaluation • Improve correctness • Save programmer effort 24

  36. Evaluation • Improve correctness • Save programmer effort • Match performance 24

  37. Evaluation • Improve correctness • Save programmer effort • Match performance 24

  38. Case studies 25

  39. Case studies • Myria: analytics Analytics data indexed by timespan and by request ID 25

  40. Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID 25

  41. Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID • Bullet: volume tree Stores axis-aligned bounding boxes for fast collision detection 25

  42. Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID • Bullet: volume tree • Sat4j: variable metadata Stores axis-aligned Tracks information bounding boxes for fast about each variable collision detection in the formula 25

  43. Case studies • Myria: analytics • ZTopo: tile cache Analytics data Tracks map tiles in a indexed by least-recently-used timespan and by cache request ID 11 bugs • Bullet: volume tree • Sat4j: variable metadata Stores axis-aligned Tracks information bounding boxes for fast about each variable collision detection in the formula 15 bugs 7 bugs 25

  44. Specifications vs. Implementations Original Spec 2582 Lines of code 1383 269 292 22 25 11 23 Myria ZTopo Sat4j Bullet 26

  45. Synthesis Time Outline Synthesis Auto-Tuning 90 Time (s) 60 30 0 Myria ZTopo Sat4j Bullet 27

  46. Performance Original Synthesized 28

  47. Performance Original Synthesized Data structures are nearly identical ZTopo 28

  48. Performance Original Synthesized Data structures are Binary search tree vs. nearly identical space partitioning tree ZTopo Bullet 28

  49. Performance Original Synthesized Data structures are Binary search tree vs. nearly identical space partitioning tree ZTopo Bullet 28

  50. Performance Original Synthesized Data structures are Binary search tree vs. Small overhead; nearly identical space partitioning tree performance dominated by other factors ZTopo Bullet Sat4j 28

  51. Performance Original Synthesized Data structures are Binary search tree vs. Small overhead; Original implementation has nearly identical space partitioning tree performance dominated worst-case linear time by other factors Myria ZTopo Bullet Sat4j 28

  52. Performance Original Synthesized Data structures are Binary search tree vs. Small overhead; Original implementation has nearly identical space partitioning tree performance dominated worst-case linear time by other factors Myria ZTopo Bullet Sat4j 28

  53. Related Work 29

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend