fast polyhedra abstract domain
play

Fast Polyhedra Abstract Domain Gagandeep Singh Markus Pschel - PowerPoint PPT Presentation

Fast Polyhedra Abstract Domain Gagandeep Singh Markus Pschel Martin Vechev Department of Computer Science ETH Zurich Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL 78 Polyhedra


  1. Fast Polyhedra Abstract Domain Gagandeep Singh Markus Püschel Martin Vechev Department of Computer Science ETH Zurich

  2. Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL ’ 78

  3. Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL ’ 78 Introduced by Patrick Cousot and Nicolas Halbwachs Represents linear constraints between program variables Patrick Cousot Nicolas Halbwachs

  4. Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL ’ 78 Introduced by Patrick Cousot and Nicolas Halbwachs Represents linear constraints between program variables Patrick Cousot Nicolas Halbwachs y ≤ 3 -x ≤ 2

  5. Polyhedra Domain Analysis

  6. Polyhedra Domain Analysis if(*){ y:=2x-1; } else{ y:=2x-2; } assert(y<=2x);

  7. Polyhedra Domain Analysis if(*){ Abstract Can Prove the Domain Assertion? y:=2x-1; Interval } ❌ Pentagon else{ ❌ y:=2x-2; Zones ❌ } Octagon ❌ Polyhedra assert(y<=2x); ✅

  8. Polyhedra Domain Analysis if(*){ Abstract Can Prove the Domain Assertion? y:=2x-1; Interval } ❌ Pentagon else{ ❌ y:=2x-2; Zones ❌ } Octagon ❌ Polyhedra assert(y<=2x); ✅ Polyhedra analysis: time and space exponential in number of variables

  9. This work: contributions

  10. This work: contributions Online decomposition: reduction in space and time without losing precision

  11. This work: contributions Online decomposition: Constant factor improvements reduction in space and time via reduced operation count and without losing precision cache optimizations

  12. This work: contributions Online decomposition: Constant factor improvements reduction in space and time via reduced operation count and without losing precision cache optimizations elina.ethz.ch Complete end-to-end implementation

  13. This work: contributions Online decomposition: Constant factor improvements reduction in space and time via reduced operation count and without losing precision cache optimizations Driver NewPolka PPL ELINA elina.ethz.ch  500 var OOM OOM 4 sec Complete end-to-end  39K LOC (> 12 GB) (> 12 GB) 0.9 GB implementation  650 var TO TO 2 sec  25K LOC (> 4 hr) (> 4 hr) 0.4 GB

  14. Double Representation of Polyhedron

  15. Double Representation of Polyhedron Constraints( ⊔ ) easy with the Generators x 2 x 2 = 2 x 1 𝒟 = {-x 2 ≤ -2, x 2 ≤ 2x 1 } m: number of constraints

  16. Double Representation of Polyhedron Generators ( ⊔ ) easy Constraints( ⊔ ) easy with the Generators with the Generators x 2 x 2 (1,2) (1,0) x 2 = 2 x 1 x 1 𝒟 = {-x 2 ≤ -2, x 2 ≤ 2x 1 } Vertices 𝒲 = {(1,2)}, m: number of constraints Rays ℛ = {(1,2), (1,0)}, Lines 𝒶 = ∅ g: number of generators

  17. Asymptotic Time Complexity of Polyhedra

  18. Asymptotic Time Complexity of Polyhedra Operator Constraints Generators Both Join ( ⊔ ) exp(n,m) Ο(𝑜𝑕) Ο(𝑜𝑕) Meet ( ⊓ ) exp(n,g) Ο(𝑜𝑛) Ο(𝑜𝑛) Inclusion ( ⊑ ) exp(n,m) exp(n,g) Ο(𝑜𝑕𝑛) Assignment Ο(𝑜𝑛 2 ) Ο(𝑜𝑕) Ο(𝑜𝑕) Conditional exp(n,g) Ο(𝑜) Ο(𝑜)

  19. Asymptotic Time Complexity of Polyhedra Operator Constraints Generators Both Join ( ⊔ ) exp(n,m) Ο(𝑜𝑕) Ο(𝑜𝑕) Meet ( ⊓ ) exp(n,g) Ο(𝑜𝑛) Ο(𝑜𝑛) Inclusion ( ⊑ ) exp(n,m) exp(n,g) Ο(𝑜𝑕𝑛) Assignment Ο(𝑜𝑛 2 ) Ο(𝑜𝑕) Ο(𝑜𝑕) Conditional exp(n,g) Ο(𝑜) Ο(𝑜) exp(n,m) Constraints Generators exp(n,g)

  20. Key Idea: Online Decomposition

  21. Key Idea: Online Decomposition Polyhedron { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 }

  22. Key Idea: Online Decomposition Set of factors Polyhedron { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , 𝒚 𝟑 = 𝟑, { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , {𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 } 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 } {𝒚 𝟕 = 𝟑 }

  23. Key Idea: Online Decomposition Partition ( 𝜌 ) = set of blocks Set of factors Polyhedron { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , {𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , { 𝒚 𝟓 , 𝒚 𝟔 } 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 } 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 } {𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 }

  24. Key Idea: Online Decomposition Partition ( 𝜌 ) = set of blocks Set of factors Polyhedron { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , {𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , { 𝒚 𝟓 , 𝒚 𝟔 } 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 } 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 } {𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 } working on smaller Polyhedra enables reduction in space and time

  25. Permissible Partitions

  26. Permissible Partitions Polyhedron { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 }

  27. Permissible Partitions Best (finest) Polyhedron partition ( 𝜌 ) { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , { 𝒚 𝟓 , 𝒚 𝟔 } 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 }

  28. Permissible Partitions Best (finest) Permissible Polyhedron partition ( 𝜌 ) partition ( 𝜌 ) { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , { 𝒚 𝟓 , 𝒚 𝟔 } { 𝒚 𝟓 , 𝒚 𝟔 , 𝒚 𝟕 } 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 , 𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 }

  29. Permissible Partitions Best (finest) Invalid Permissible Polyhedron partition ( 𝜌 ) partition partition ( 𝜌 ) { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } { 𝒚 𝟐 , 𝒚 𝟑 } { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , { 𝒚 𝟒 , 𝒚 𝟓 , 𝒚 𝟔 } { 𝒚 𝟓 , 𝒚 𝟔 } { 𝒚 𝟓 , 𝒚 𝟔 , 𝒚 𝟕 } 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 , { 𝒚 𝟕 } 𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 }

  30. Permissible Partitions Best (finest) Invalid Permissible Polyhedron partition ( 𝜌 ) partition partition ( 𝜌 ) { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } { 𝒚 𝟐 , 𝒚 𝟑 } { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 , { 𝒚 𝟒 , 𝒚 𝟓 , 𝒚 𝟔 } { 𝒚 𝟓 , 𝒚 𝟔 } { 𝒚 𝟓 , 𝒚 𝟔 , 𝒚 𝟕 } 𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , 𝒚 𝟔 = 𝟐 , { 𝒚 𝟕 } 𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 } Definition: A partition 𝜌 is permissible for Polyhedron P, if there are no two variables 𝒚 𝒋 and 𝒚 𝒌 in different blocks of 𝜌 related by a constraint in P

  31. Partition of Variable Set: Summary

  32. Partition of Variable Set: Summary The set of all partitions of variable set 𝒴 form a lattice ordered by “ finer than ” ( < ) relation The best (finest) partition 𝜌 𝑄 for Polyhedron P is unique Any 𝜌, s.t., 𝜌 𝑄 < 𝜌 , is permissible An unconstrained variable 𝑦 𝑗 yields a singleton set { 𝑦 𝑗 } in the partition

  33. Partition of Variable Set: Summary The set of all partitions of variable set 𝒴 form a lattice ordered by “ finer than ” ( < ) relation The best (finest) partition 𝜌 𝑄 for Polyhedron P is unique Any 𝜌, s.t., 𝜌 𝑄 < 𝜌 , is permissible An unconstrained variable 𝑦 𝑗 yields a singleton set { 𝑦 𝑗 } in the partition Challenge: maintain permissible partitions for > 30 operators

  34. Operator: Conditional

  35. Operator: Conditional Definition: Let 𝜌 be a partition and ℬ be a block, then 𝜌 ↑ ℬ is the finest partition 𝜌 ’ such that 𝜌 ⊑ 𝜌 ’ and ℬ is a subset of an element of 𝜌 ’ Theorem (finest partition after conditional) : If O ≠⊥ and let ℬ be block containing all variables appearing in the conditional, then 𝜌 𝑃 = 𝜌 𝑄 ↑ ℬ

  36. Operator: Conditional Definition: Let 𝜌 be a partition and ℬ be a block, then 𝜌 ↑ ℬ is the finest partition 𝜌 ’ such that 𝜌 ⊑ 𝜌 ’ and ℬ is a subset of an element of 𝜌 ’ P 𝜌 𝑄 { 𝒚 𝟐 ≤ 𝟑𝒚 𝟑 , { 𝒚 𝟐 , 𝒚 𝟑 , 𝒚 𝟒 } 𝒚 𝟑 = 𝟑, 𝒚 𝟐 + 𝒚 𝟑 + 𝟑𝒚 𝟒 ≤ 𝟔 } {𝒚 𝟓 - 𝒚 𝟔 ≤ 𝟒 , { 𝒚 𝟓 , 𝒚 𝟔 } 𝒚 𝟔 = 𝟐 } {𝒚 𝟕 = 𝟑 } { 𝒚 𝟕 } Theorem (finest partition after conditional) : If O ≠⊥ and let ℬ be block containing all variables appearing in the conditional, then 𝜌 𝑃 = 𝜌 𝑄 ↑ ℬ

Recommend


More recommend