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

Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Gagandeep Singh Markus Püschel Martin Vechev

Department of Computer Science

ETH Zurich

Fast Polyhedra Abstract Domain

Page 2: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain AnalysisAutomatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Page 3: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain AnalysisAutomatic 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

Page 4: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain AnalysisAutomatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Introduced by Patrick Cousot and Nicolas Halbwachs

Represents linear constraints between program variables

y ≤ 3

-x ≤

2

Patrick Cousot Nicolas Halbwachs

Page 5: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain Analysis

Page 6: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain Analysis

if(*){

y:=2x-1;

}

else{

y:=2x-2;

}

assert(y<=2x);

Page 7: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain Analysis

if(*){

y:=2x-1;

}

else{

y:=2x-2;

}

Abstract

Domain

Can Prove the

Assertion?

Interval ❌

Pentagon ❌

Zones ❌

Octagon ❌

Polyhedra ✅assert(y<=2x);

Page 8: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Polyhedra Domain Analysis

if(*){

y:=2x-1;

}

else{

y:=2x-2;

}

Abstract

Domain

Can Prove the

Assertion?

Interval ❌

Pentagon ❌

Zones ❌

Octagon ❌

Polyhedra ✅assert(y<=2x);

Polyhedra analysis: time and space exponential in number of variables

Page 9: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

This work: contributions

Page 10: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

This work: contributions

Online decomposition: reduction in space and time without losing precision

Page 11: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

This work: contributions

Online decomposition: reduction in space and time without losing precision

Constant factor improvements via reduced operation count and cache optimizations

Page 12: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

This work: contributions

Online decomposition: reduction in space and time without losing precision

Constant factor improvements via reduced operation count and cache optimizations

elina.ethz.ch

Complete end-to-end

implementation

Page 13: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

This work: contributions

Online decomposition: reduction in space and time without losing precision

Constant factor improvements via reduced operation count and cache optimizations

elina.ethz.ch

Complete end-to-end

implementation

Driver NewPolka PPL ELINA

500 var

39K LOC

OOM

(> 12 GB)

OOM

(> 12 GB)

4 sec

0.9 GB

650 var

25K LOC

TO

(> 4 hr)

TO

(> 4 hr)

2 sec

0.4 GB

Page 14: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Double Representation of Polyhedron

Page 15: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

x1

x2 = 2

x2

𝒞 = {-x2 ≤ -2, x2 ≤ 2x1}

m: number of constraints

Constraints(⊔) easy

with the Generators

Double Representation of Polyhedron

Page 16: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

x1

x2 = 2

x2

𝒞 = {-x2 ≤ -2, x2 ≤ 2x1}

m: number of constraints

x1

x2

Vertices 𝒱 = {(1,2)},

Rays ℛ = {(1,2), (1,0)},

Lines 𝒵 = ∅g: number of generators

(1,2) (1,0)

Generators (⊔) easy

with the GeneratorsConstraints(⊔) easy

with the Generators

Double Representation of Polyhedron

Page 17: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Asymptotic Time Complexity of Polyhedra

Page 18: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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) Ο(𝑛)

Page 19: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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) Ο(𝑛)

Constraints Generators

exp(n,m)

exp(n,g)

Page 20: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Key Idea: Online Decomposition

Page 21: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Key Idea: Online Decomposition

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

Polyhedron

Page 22: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Key Idea: Online Decomposition

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

Polyhedron {𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

Set of factors

Page 23: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Key Idea: Online Decomposition

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

Polyhedron {𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

Set of factors

Partition (𝜋) =

set of blocks

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 24: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Key Idea: Online Decomposition

working on smaller Polyhedra enables reduction in space and time

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

Polyhedron {𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

Set of factors

Partition (𝜋) =

set of blocks

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 25: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Permissible Partitions

Page 26: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Permissible Partitions

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

Polyhedron

Page 27: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Permissible Partitions

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

PolyhedronBest (finest)

partition (𝜋)

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 28: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Permissible Partitions

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

PolyhedronBest (finest)

partition (𝜋)

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓, 𝒙𝟔}

Permissible

partition (𝜋)

Page 29: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Permissible Partitions

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

PolyhedronBest (finest)

partition (𝜋)

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓, 𝒙𝟔}

Permissible

partition (𝜋)

Invalid

partition

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑, 𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 30: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Permissible Partitions

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

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟔 = 𝟐}

PolyhedronBest (finest)

partition (𝜋)

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓, 𝒙𝟔}

Permissible

partition (𝜋)

Invalid

partition

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑, 𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 31: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Partition of Variable Set: Summary

Page 32: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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

Page 33: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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

Page 34: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Conditional

Page 35: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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 𝜋𝑂 = 𝜋𝑃 ↑ ℬ

Page 36: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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 𝜋𝑂 = 𝜋𝑃 ↑ ℬ

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 37: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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 𝜋𝑂 = 𝜋𝑃 ↑ ℬ

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

if( 𝒙𝟐 ≤ 𝟐𝒙𝟒)

Page 38: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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 𝜋𝑂 = 𝜋𝑃 ↑ ℬ

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

O 𝜋𝑂{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟐 ≤ 𝟐𝒙𝟒}

{𝒙𝟔 = 𝟐} {𝒙𝟔}

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑,

𝒙𝟒, 𝒙𝟓}if( 𝒙𝟐 ≤ 𝟐𝒙𝟒)

Page 39: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

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 𝜋𝑂 = 𝜋𝑃 ↑ ℬ

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

O 𝜋𝑂{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓,

𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟐 ≤ 𝟐𝒙𝟒}

{𝒙𝟔 = 𝟐} {𝒙𝟔}

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑,

𝒙𝟒, 𝒙𝟓}if( 𝒙𝟐 ≤ 𝟐𝒙𝟒)

𝓑 = {𝒙𝟐, 𝒙𝟒}

Page 40: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Assignment

Page 41: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Assignment

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

Page 42: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Assignment

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

𝒙𝟐∶= 𝟐𝒙𝟒

Page 43: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Assignment

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

O 𝜋𝑂

{𝒙𝟏 ≤ 𝟒,

𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟑,

{𝒙𝟔 = 𝟐} {𝒙𝟔}

{𝒙𝟏, 𝒙𝟑}

𝒙𝟐∶= 𝟐𝒙𝟒{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟐= 𝟐𝒙𝟒}

{𝒙𝟐, 𝒙𝟒, 𝒙𝟓}

Page 44: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Assignment

Theorem (finest partition after assignment):

Let ℬ be block containing all variables appearing for assignment 𝒙𝒊 ≔ 𝒆 , and let 𝜋𝒊 = {𝒳 ∖{𝒙𝒊}, {𝒙𝒊}}, then 𝜋𝑂 = (𝜋𝑃 ⊓ 𝜋𝒊) ↑ ℬ

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

O 𝜋𝑂

{𝒙𝟏 ≤ 𝟒,

𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟑,

{𝒙𝟔 = 𝟐} {𝒙𝟔}

{𝒙𝟏, 𝒙𝟑}

𝒙𝟐∶= 𝟐𝒙𝟒{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟐= 𝟐𝒙𝟒}

{𝒙𝟐, 𝒙𝟒, 𝒙𝟓}

Page 45: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Assignment

Theorem (finest partition after assignment):

Let ℬ be block containing all variables appearing for assignment 𝒙𝒊 ≔ 𝒆 , and let 𝜋𝒊 = {𝒳 ∖{𝒙𝒊}, {𝒙𝒊}}, then 𝜋𝑂 = (𝜋𝑃 ⊓ 𝜋𝒊) ↑ ℬ

{𝒙𝟏 ≤ 𝟐𝒙𝟐,

𝒙𝟐 = 𝟐,𝒙𝟏 + 𝒙𝟐 + 𝟐𝒙𝟑 ≤ 𝟓}

{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏}

{𝒙𝟔 = 𝟐}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐, 𝒙𝟑}

{𝒙𝟒, 𝒙𝟓}

{𝒙𝟔}

O 𝜋𝑂

{𝒙𝟏 ≤ 𝟒,

𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟑,

{𝒙𝟔 = 𝟐} {𝒙𝟔}

{𝒙𝟏, 𝒙𝟑}

𝒙𝟐∶= 𝟐𝒙𝟒{𝒙𝟒 - 𝒙𝟓 ≤ 𝟑,

𝒙𝟓 = 𝟏,

𝒙𝟐= 𝟐𝒙𝟒}

{𝒙𝟐, 𝒙𝟒, 𝒙𝟓}𝓑 = {𝒙𝟐, 𝒙𝟒}

Page 46: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Lattice Operators

Page 47: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Lattice Operators

Theorem (finest partition for ⊑):

If 𝑃 ⊑ 𝑄 and 𝑃 ≠⊥, then 𝜋𝑄 ⊑ 𝜋𝑃

Theorem: (finest partition after ⊓):

If 𝑃 ⊓ 𝑄 ≠⊥ , then 𝜋𝑂 = 𝜋𝑃 ⊔ 𝜋𝑄

For join (⊔), no general relationship exists between 𝜋𝑂, 𝜋𝑃 and 𝜋𝑄

Page 48: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

Page 49: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

Page 50: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

Page 51: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

{𝒙𝟏 ≤ 𝟐}

{𝒙𝟑 = 𝟎}

Q 𝜋𝑄

{𝒙𝟏}

{𝒙𝟑}

⊔ ∅ {𝒙𝟐}

Page 52: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

{𝒙𝟏 ≤ 𝟐}

{𝒙𝟑 = 𝟎}

Q 𝜋𝑄

{𝒙𝟏}

{𝒙𝟑}

⊔ ∅ {𝒙𝟐}

{𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟐,

−𝒙𝟑 ≤ 𝟎,

𝒙𝟑 ≤ 𝟏}

O 𝜋𝑂

{𝒙𝟏, 𝒙𝟑}

{𝒙𝟐}

Page 53: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

{𝒙𝟏 ≤ 𝟐}

{𝒙𝟑 = 𝟎}

Q 𝜋𝑄

{𝒙𝟏}

{𝒙𝟑}

⊔ ∅ {𝒙𝟐}

{𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟐,

−𝒙𝟑 ≤ 𝟎,

𝒙𝟑 ≤ 𝟏}

O 𝜋𝑂

{𝒙𝟏, 𝒙𝟑}

{𝒙𝟐}

𝜋𝑃 ⊔ 𝜋𝑄 = 𝜋𝑃 ≠ 𝜋𝑂

Page 54: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

{𝒙𝟏 ≤ 𝟐}

{𝒙𝟑 = 𝟎}

Q 𝜋𝑄

{𝒙𝟏}

{𝒙𝟑}

⊔ ∅ {𝒙𝟐}

{𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟐,

−𝒙𝟑 ≤ 𝟎,

𝒙𝟑 ≤ 𝟏}

O 𝜋𝑂

{𝒙𝟏, 𝒙𝟑}

{𝒙𝟐}

𝜋𝑃 ⊔ 𝜋𝑄 = 𝜋𝑃 ≠ 𝜋𝑂

𝜋𝑃 ⊓ 𝜋𝑄 = 𝜋𝑄 ≠ 𝜋𝑂

Page 55: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

{𝒙𝟏 − 𝒙𝟐 ≤ 𝟎,

𝒙𝟏 ≤ 𝟎}

{𝒙𝟑 = 𝟏}

P 𝜋𝑃

{𝒙𝟏, 𝒙𝟐}

{𝒙𝟑}

{𝒙𝟏 ≤ 𝟐}

{𝒙𝟑 = 𝟎}

Q 𝜋𝑄

{𝒙𝟏}

{𝒙𝟑}

⊔ ∅ {𝒙𝟐}

{𝒙𝟏 + 𝟐𝒙𝟑 ≤ 𝟐,

−𝒙𝟑 ≤ 𝟎,

𝒙𝟑 ≤ 𝟏}

O 𝜋𝑂

{𝒙𝟏, 𝒙𝟑}

{𝒙𝟐}

𝜋𝑃 ⊔ 𝜋𝑄 = 𝜋𝑃 ≠ 𝜋𝑂

𝜋𝑃 ⊓ 𝜋𝑄 = 𝜋𝑄 ≠ 𝜋𝑂

For Join, 𝜋𝑂 depends on both P and Q

Page 56: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

Page 57: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

Theorem: Let P and Q be two Polyhedra with the same permissiblepartition 𝜋 = {𝒳1, 𝒳2, . . . , 𝒳𝑟} and let 𝜋 be a permissible partition for the join, that is, 𝜋𝑃⊔𝑄 ⊑ 𝜋. If for any block 𝒳𝑘 ∈ 𝜋,𝑃𝑘 = 𝑄𝑘 , then 𝒳𝑘 ∈ 𝜋

Page 58: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

Theorem: Let P and Q be two Polyhedra with the same permissiblepartition 𝜋 = {𝒳1, 𝒳2, . . . , 𝒳𝑟} and let 𝜋 be a permissible partition for the join, that is, 𝜋𝑃⊔𝑄 ⊑ 𝜋. If for any block 𝒳𝑘 ∈ 𝜋,𝑃𝑘 = 𝑄𝑘 , then 𝒳𝑘 ∈ 𝜋

x2

x1=4

x2=1

x2=2

x1=3

x1=1

x1=2

x2=4

x1=2x1

x2=-2x1+10

P

Q

x1P1

Q1

P2

Q2

Page 59: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operator: Join (⊔)

Theorem: Let P and Q be two Polyhedra with the same permissiblepartition 𝜋 = {𝒳1, 𝒳2, . . . , 𝒳𝑟} and let 𝜋 be a permissible partition for the join, that is, 𝜋𝑃⊔𝑄 ⊑ 𝜋. If for any block 𝒳𝑘 ∈ 𝜋,𝑃𝑘 = 𝑄𝑘 , then 𝒳𝑘 ∈ 𝜋

x2

x1=4

x2=1

x2=2

x1=3

x1=1

x1=2

x2=4

x1=2x1

x2=-2x1+10

P

Q

x1P1

Q1

x2

x1=4

x2=1

x2=2

x1=4

x1=1

x1=1

x2=4

P

Q

x1P1

Q1

P2

Q2

P2

Q2

Page 60: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operators with Permissible Partitions

Page 61: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Operators with Permissible Partitions

Theorem (permissible partition after join):

Let 𝜋 = 𝜋𝑃 ⊔ 𝜋𝑄 and 𝒰 = {𝒳𝑘 | 𝑃𝑘 = 𝑄𝑘 , 𝒳𝑘 ∈ 𝜋}.

Then 𝜋𝑃⊔𝑄 = 𝒰 ∪ ⨃𝒯∈𝜋 ∖𝒰𝒯 is permissible for 𝑃 ⊔ 𝑄

Theorem (permissible partition after meet):

𝜋𝑃 ⊔ 𝜋𝑄 is permissible for 𝑃 ⊓ 𝑄

Theorem (permissible partition after conditional):

If output O ≠⊥, then, 𝜋𝑃 ↑ ℬ is permissible for conditional

Theorem (permissible partition after assignment):

𝜋𝑃 ↑ ℬ is permissible for the output O of assignment

Page 62: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Asymptotic Complexity of Operators with Permissible Partitions

r: number

of blocks

Operator Before

(using both)

Our work

(using decomposition)

Join (⊔) Ο(𝑛𝑔) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖 + 𝑛𝑚𝑎𝑥𝑚𝑚𝑎𝑥)

Meet (⊓) Ο(𝑛𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖)

Inclusion (⊑) Ο(𝑛𝑔𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖)

Assignment Ο(𝑛𝑔) Ο(𝑛𝑚𝑎𝑥𝑔𝑚𝑎𝑥)

Conditional Ο(𝑛) Ο(𝑛𝑚𝑎𝑥)

Conversion exp(n,g) exp(𝑛𝑚𝑎𝑥 , 𝑔𝑚𝑎𝑥)

Page 63: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Experimental Evaluation

We compared performance of ELINA against NewPolka and PPL

Using the Seahorn verification framework [CAV’15]• written in C, analyzes llvm-bitcode• produces Polyhedra invariants

> 1500 benchmarks from the software verification competition

Time limit: 4 hours

Memory limit: 12 GB

Page 64: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Experimental Evaluation

Page 65: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Experimental Evaluation

Page 66: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Experimental Evaluation

Page 67: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Experimental Evaluation

Page 68: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Evaluation

𝑛𝐸𝐿𝐼𝑁𝐴 < 𝑛𝑁𝑒𝑤𝑃𝑜𝑙𝑘𝑎 , large speedup as conversion is exponential in n

Page 69: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Related Work

Page 70: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Related Work

• Variable Packing • Blanchet et al. [PLDI’03]

• decomposition based on syntactic criteria

• loses precision

• Matrix based decomposition• Halbwachs et al. [FMSD’06]

• does not work with generators

• decomposition too coarse for join

Page 71: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Conclusion

Page 72: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Conclusion

Page 73: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Conclusion

Operator Both Online

decomposition

Join (⊔) Ο(𝑛𝑔) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖

+ 𝑛𝑚𝑎𝑥𝑚𝑚𝑎𝑥)

Meet (⊓) Ο(𝑛𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖)

Inclusion (⊑) Ο(𝑛𝑔𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖)

Assignment Ο(𝑛𝑔) Ο(𝑛𝑚𝑎𝑥𝑔𝑚𝑎𝑥)

Conditional Ο(𝑛) Ο(𝑛𝑚𝑎𝑥)

Page 74: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Conclusion

Operator Both Online

decomposition

Join (⊔) Ο(𝑛𝑔) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖

+ 𝑛𝑚𝑎𝑥𝑚𝑚𝑎𝑥)

Meet (⊓) Ο(𝑛𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖)

Inclusion (⊑) Ο(𝑛𝑔𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖)

Assignment Ο(𝑛𝑔) Ο(𝑛𝑚𝑎𝑥𝑔𝑚𝑎𝑥)

Conditional Ο(𝑛) Ο(𝑛𝑚𝑎𝑥)

http://elina.ethz.ch

Page 75: Fast PolyhedraAbstract Domainelina.ethz.ch/slides/popl2017-fast-polyhedra.pdf · Polyhedra Domain Analysis Automatic Discovery of Linear Restraints Among Variables of a Program, POPL’78

Conclusion

Operator Both Online

decomposition

Join (⊔) Ο(𝑛𝑔) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖

+ 𝑛𝑚𝑎𝑥𝑚𝑚𝑎𝑥)

Meet (⊓) Ο(𝑛𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖)

Inclusion (⊑) Ο(𝑛𝑔𝑚) Ο(∑𝑖=1𝑟 𝑛𝑖𝑚𝑖𝑔𝑖)

Assignment Ο(𝑛𝑔) Ο(𝑛𝑚𝑎𝑥𝑔𝑚𝑎𝑥)

Conditional Ο(𝑛) Ο(𝑛𝑚𝑎𝑥)

http://elina.ethz.ch

Driver NewPolka PPL ELINA

500 var

39K LOC

OOM

(> 12 GB)

OOM

(> 12 GB)

4 sec

0.9 GB

650 var

25K LOC

TO

(> 4 hr)

TO

(> 4 hr)

2 sec

0.4 GB