Integer Set Coalescing Sven Verdoolaege INRIA and KU Leuven - - PowerPoint PPT Presentation

integer set coalescing
SMART_READER_LITE
LIVE PREVIEW

Integer Set Coalescing Sven Verdoolaege INRIA and KU Leuven - - PowerPoint PPT Presentation

January 19, 2015 1 / 27 Integer Set Coalescing Sven Verdoolaege INRIA and KU Leuven January 19, 2015 January 19, 2015 2 / 27 Outline Introduction and Motivation 1 Polyhedal Model The need for coalescing Traditional Coalescing


slide-1
SLIDE 1

January 19, 2015 1 / 27

Integer Set Coalescing

Sven Verdoolaege

INRIA and KU Leuven

January 19, 2015

slide-2
SLIDE 2

January 19, 2015 2 / 27

Outline

1

Introduction and Motivation Polyhedal Model The need for coalescing Traditional “Coalescing”

2

Coalescing in isl Rational Cases Constraints adjacent to inequality Constraints adjacent to equality Wrapping Existentially Quantified Variables

3

Conclusions

slide-3
SLIDE 3

Introduction and Motivation January 19, 2015 3 / 27

Outline

1

Introduction and Motivation Polyhedal Model The need for coalescing Traditional “Coalescing”

2

Coalescing in isl Rational Cases Constraints adjacent to inequality Constraints adjacent to equality Wrapping Existentially Quantified Variables

3

Conclusions

slide-4
SLIDE 4

Introduction and Motivation Polyhedal Model January 19, 2015 4 / 27

Polyhedral Model

R: h(A[2]); for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) S: A[i + j] = f(i, j); for (int k = 0; k < 2; ++k) T: g(A[k], A[0]);

slide-5
SLIDE 5

Introduction and Motivation Polyhedal Model January 19, 2015 4 / 27

Polyhedral Model

R: h(A[2]); for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) S: A[i + j] = f(i, j); for (int k = 0; k < 2; ++k) T: g(A[k], A[0]);

Instance set (set of statement instances) I = { R(); S(0, 0); S(0, 1); S(1, 0); S(1, 1); T(0); T(1) }

slide-6
SLIDE 6

Introduction and Motivation Polyhedal Model January 19, 2015 4 / 27

Polyhedral Model

R: h(A[2]); for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) S: A[i + j] = f(i, j); for (int k = 0; k < 2; ++k) T: g(A[k], A[0]);

Instance set (set of statement instances) I = { R(); S(0, 0); S(0, 1); S(1, 0); S(1, 1); T(0); T(1) }

= { R(); S(i, j) : 0 ≤ i < 2 ∧ 0 ≤ j < 2; T(k) : 0 ≤ k < 2 }

slide-7
SLIDE 7

Introduction and Motivation The need for coalescing January 19, 2015 5 / 27

Equivalent Representations

extensive

{ S(0, 0); S(0, 1); S(1, 0); S(1, 1) } = { S(i, j) : (i = 0 ∧ j = 0) ∨ (i = 0 ∧ j = 1) ∨ (i = 1 ∧ j = 0) ∨ (i = 1 ∧ j = 1) }

intensive

{ S(i, j) : 0 ≤ i < 2 ∧ 0 ≤ j < 2 }

slide-8
SLIDE 8

Introduction and Motivation The need for coalescing January 19, 2015 5 / 27

Equivalent Representations

extensive

{ S(0, 0); S(0, 1); S(1, 0); S(1, 1) } = { S(i, j) : (i = 0 ∧ j = 0) ∨ (i = 0 ∧ j = 1) ∨ (i = 1 ∧ j = 0) ∨ (i = 1 ∧ j = 1) }

intensive

{ S(i, j) : 0 ≤ i < 2 ∧ 0 ≤ j < 2 }

alternative

{ S(i, j) : (i = 0 ∧ 0 ≤ j < 2) ∨ (i = 1 ∧ 0 ≤ j < 2) }

slide-9
SLIDE 9

Introduction and Motivation The need for coalescing January 19, 2015 5 / 27

Equivalent Representations

extensive

{ S(0, 0); S(0, 1); S(1, 0); S(1, 1) }

4

= { S(i, j) : (i = 0 ∧ j = 0) ∨ (i = 0 ∧ j = 1) ∨ (i = 1 ∧ j = 0) ∨ (i = 1 ∧ j = 1) }

intensive

{ S(i, j) : 0 ≤ i < 2 ∧ 0 ≤ j < 2 }

1 alternative

{ S(i, j) : (i = 0 ∧ 0 ≤ j < 2) ∨ (i = 1 ∧ 0 ≤ j < 2) }

2 In general, representation with fewer disjuncts is preferred (usually) occupies less memory

  • perations can be performed more efficiently

the outcome of some operations depends on chosen representation

◮ transitive closure approximation ◮ AST generation

⇒ coalescing: replace representation by one with fewer disjuncts

slide-10
SLIDE 10

Introduction and Motivation The need for coalescing January 19, 2015 6 / 27

Effect on AST Generation — guide

Without coalescing input

{ S1(i) → (i) : (1 ≤ i ≤ N ∧ i ≤ 2M) ∨ (1 ≤ i ≤ N ∧ i ≥ M); S2(i) → (i) : (N + 1 ≤ i ≤ 2N) } for (int c0 = 1; c0 <= min(2 * M, N); c0 += 1) S1(c0); for (int c0 = max(1, 2 * M + 1); c0 <= N; c0 += 1) S1(c0); for (int c0 = N + 1; c0 <= 2 * N; c0 += 1) S2(c0);

slide-11
SLIDE 11

Introduction and Motivation The need for coalescing January 19, 2015 6 / 27

Effect on AST Generation — guide

Without coalescing input

{ S1(i) → (i) : (1 ≤ i ≤ N ∧ i ≤ 2M) ∨ (1 ≤ i ≤ N ∧ i ≥ M); S2(i) → (i) : (N + 1 ≤ i ≤ 2N) } for (int c0 = 1; c0 <= min(2 * M, N); c0 += 1) S1(c0); for (int c0 = max(1, 2 * M + 1); c0 <= N; c0 += 1) S1(c0); for (int c0 = N + 1; c0 <= 2 * N; c0 += 1) S2(c0);

After coalescing input

{ S1(i) → (i) : 1 ≤ i ≤ N; S2(i) → (i) : (N + 1 ≤ i ≤ 2N) } for (int c0 = 1; c0 <= N; c0 += 1) S1(c0); for (int c0 = N + 1; c0 <= 2 * N; c0 += 1) S2(c0);

slide-12
SLIDE 12

Introduction and Motivation The need for coalescing January 19, 2015 7 / 27

Effect on AST Generation — cholesky

⇒ demo

slide-13
SLIDE 13

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection

slide-14
SLIDE 14

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection

slide-15
SLIDE 15

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction

slide-16
SLIDE 16

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction

slide-17
SLIDE 17

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction

slide-18
SLIDE 18

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction

slide-19
SLIDE 19

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction

slide-20
SLIDE 20

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

slide-21
SLIDE 21

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-22
SLIDE 22

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-23
SLIDE 23

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-24
SLIDE 24

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-25
SLIDE 25

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-26
SLIDE 26

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-27
SLIDE 27

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-28
SLIDE 28

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming min { (x, y) → (z) : z ≥ 0 ∧ x + z ≥ 0 ∧ y + z ≥ 0 }

−y −x

slide-29
SLIDE 29

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming Union

slide-30
SLIDE 30

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming Union

slide-31
SLIDE 31

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming Union Intersection

slide-32
SLIDE 32

Introduction and Motivation The need for coalescing January 19, 2015 8 / 27

Causes of Splintering

Several operations on integer sets may introduce coalescing opportunities Projection Subtraction Parametric integer programming Union Intersection

slide-33
SLIDE 33

Introduction and Motivation Traditional “Coalescing” January 19, 2015 9 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

slide-34
SLIDE 34

Introduction and Motivation Traditional “Coalescing” January 19, 2015 9 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

slide-35
SLIDE 35

Introduction and Motivation Traditional “Coalescing” January 19, 2015 9 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

slide-36
SLIDE 36

Introduction and Motivation Traditional “Coalescing” January 19, 2015 9 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

slide-37
SLIDE 37

Introduction and Motivation Traditional “Coalescing” January 19, 2015 9 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

Issues: Convex hull may have exponential number of constraints We may be able to remove some of them, but we still need to compute them first. Constraints of convex hull may have very large coefficients Convex hull is an operation on rational sets ⇒ mixture of operation on rational sets (convex hull) and integer sets (set

subtraction) ⇒ in isl, convex hull operation not fully defined on sets with existentially quantified variables

Convex hull is costly to compute

slide-38
SLIDE 38

Introduction and Motivation Traditional “Coalescing” January 19, 2015 9 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

Issues: Convex hull may have exponential number of constraints We may be able to remove some of them, but we still need to compute them first. Constraints of convex hull may have very large coefficients Convex hull is an operation on rational sets ⇒ mixture of operation on rational sets (convex hull) and integer sets (set

subtraction) ⇒ in isl, convex hull operation not fully defined on sets with existentially quantified variables

Convex hull is costly to compute

slide-39
SLIDE 39

Introduction and Motivation Traditional “Coalescing” January 19, 2015 10 / 27

Effect on AST Generation — covariance

With isl coalescing (in this case same result as no coalescing)

for (long c1 = n >= 1 ? ((n - 1) % 32) - n - 31 : 0; c1 <= (n >= 1 ? n - 1 : 0); c1 += 32) { /* .. */ }

With convex hull based “coalescing”

for (long c1 = 32 * floord(-1073741839 * n - 32749125633, 68719476720) - 1073741792; c1 <= floord(715827882 * n + 357913941, 1431655765) + 1073741823; c1 += 32) { /* .. */ }

slide-40
SLIDE 40

Introduction and Motivation Traditional “Coalescing” January 19, 2015 11 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

Issues: Convex hull may have exponential number of constraints We may be able to remove some of them, but we still need to compute them first. Constraints of convex hull may have very large coefficients Convex hull is an operation on rational sets ⇒ mixture of operation on rational sets (convex hull) and integer sets (set

subtraction) ⇒ in isl, convex hull operation not fully defined on sets with existentially quantified variables

Convex hull is costly to compute

slide-41
SLIDE 41

Introduction and Motivation Traditional “Coalescing” January 19, 2015 11 / 27

Traditional “Coalescing”

Traditional method (e.g., in CLooG with original PolyLib backend)

1

Compute convex hull H of S

2

Remove integer elements not in S from H

⇒ H \ (H \ S)

Issues: Convex hull may have exponential number of constraints We may be able to remove some of them, but we still need to compute them first. Constraints of convex hull may have very large coefficients Convex hull is an operation on rational sets ⇒ mixture of operation on rational sets (convex hull) and integer sets (set

subtraction) ⇒ in isl, convex hull operation not fully defined on sets with existentially quantified variables

Convex hull is costly to compute

slide-42
SLIDE 42

Introduction and Motivation Traditional “Coalescing” January 19, 2015 12 / 27

AST Generation Times

Generation times on isl AST generation test cases

isl coalescing

16.0s no coalescing 16.3s convex hull (FM) 24m00s convex hull (wrapping) 6m40s Note: isl may not have the most efficient convex hull implementation However, double description based implementations are costly too

slide-43
SLIDE 43

Coalescing in isl January 19, 2015 13 / 27

Outline

1

Introduction and Motivation Polyhedal Model The need for coalescing Traditional “Coalescing”

2

Coalescing in isl Rational Cases Constraints adjacent to inequality Constraints adjacent to equality Wrapping Existentially Quantified Variables

3

Conclusions

slide-44
SLIDE 44

Coalescing in isl January 19, 2015 14 / 27

Coalescing in isl

Coalescing in isl never increases the total number of constraints based on solving LP problems with same dimension as input set recognizes a set of patterns

slide-45
SLIDE 45

Coalescing in isl Rational Cases January 19, 2015 15 / 27

Coalescing Cases

slide-46
SLIDE 46

Coalescing in isl Rational Cases January 19, 2015 16 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-47
SLIDE 47

Coalescing in isl Rational Cases January 19, 2015 16 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-48
SLIDE 48

Coalescing in isl Rational Cases January 19, 2015 16 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

max t(x) < 0 over B

⇒separating constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-49
SLIDE 49

Coalescing in isl Rational Cases January 19, 2015 16 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

max t(x) < 0 over B

⇒separating constraint

  • therwise (attains both positive and negative

values over B)

⇒cut constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-50
SLIDE 50

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

slide-51
SLIDE 51

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-52
SLIDE 52

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-53
SLIDE 53

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-54
SLIDE 54

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B

2

Neither A nor B have separating constraints and all cut constraints of A are valid for the cut facets of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-55
SLIDE 55

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B

2

Neither A nor B have separating constraints and all cut constraints of A are valid for the cut facets of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-56
SLIDE 56

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B

2

Neither A nor B have separating constraints and all cut constraints of A are valid for the cut facets of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-57
SLIDE 57

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B

2

Neither A nor B have separating constraints and all cut constraints of A are valid for the cut facets of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-58
SLIDE 58

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B

2

Neither A nor B have separating constraints and all cut constraints of A are valid for the cut facets of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-59
SLIDE 59

Coalescing in isl Rational Cases January 19, 2015 17 / 27

Coalescing Cases

1

All constraints of A are valid for B ⇒ drop B

2

Neither A nor B have separating constraints and all cut constraints of A are valid for the cut facets of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-60
SLIDE 60

Coalescing in isl Constraints adjacent to inequality January 19, 2015 18 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-61
SLIDE 61

Coalescing in isl Constraints adjacent to inequality January 19, 2015 19 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

max t(x) < 0 over B

⇒separating constraint

  • therwise (attains both positive and negative

values over B)

⇒cut constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-62
SLIDE 62

Coalescing in isl Constraints adjacent to inequality January 19, 2015 19 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

max t(x) < 0 over B

⇒separating constraint

special cases:

◮ t = −u − 1 with u(x) ≥ 0 a constraints of B

⇒ constraint is adjacent to an inequality of B

  • therwise (attains both positive and negative

values over B)

⇒cut constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-63
SLIDE 63

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0 cut: otherwise

slide-64
SLIDE 64

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

3

single pair of adjacent inequalities (other constraints valid) ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-65
SLIDE 65

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

3

single pair of adjacent inequalities (other constraints valid) ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-66
SLIDE 66

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-67
SLIDE 67

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

4

A has single inequality adjacent to inequality of B (other constraints of A are valid) Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-68
SLIDE 68

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

4

A has single inequality adjacent to inequality of B (other constraints of A are valid) Result of replacing t(x) ≥ 0 by t(x) ≤ −1 and adding valid constraints of B is a subset of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-69
SLIDE 69

Coalescing in isl Constraints adjacent to inequality January 19, 2015 20 / 27

Coalescing Cases

4

A has single inequality adjacent to inequality of B (other constraints of A are valid) Result of replacing t(x) ≥ 0 by t(x) ≤ −1 and adding valid constraints of B is a subset of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-70
SLIDE 70

Coalescing in isl Constraints adjacent to equality January 19, 2015 21 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-71
SLIDE 71

Coalescing in isl Constraints adjacent to equality January 19, 2015 22 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

max t(x) < 0 over B

⇒separating constraint

special cases:

◮ t = −u − 1 with u(x) ≥ 0 a constraints of B

⇒ constraint is adjacent to an inequality of B

  • therwise (attains both positive and negative

values over B)

⇒cut constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-72
SLIDE 72

Coalescing in isl Constraints adjacent to equality January 19, 2015 22 / 27

Constraint types

Given two disjuncts A and B For each affine constraint t(x) ≥ 0 of A, determine its effect on B min t(x) > −1 over B

⇒valid constraint

max t(x) < 0 over B

⇒separating constraint

special cases:

◮ t = −u − 1 with u(x) ≥ 0 a constraints of B

⇒ constraint is adjacent to an inequality of B

◮ t(x) = −1 over B

⇒ constraint is adjacent to an equality of B

  • therwise (attains both positive and negative

values over B)

⇒cut constraint

Note: affine expression t(x) ≥ 0 has integer coefficients min and max computed using (incremental) LP solver

slide-73
SLIDE 73

Coalescing in isl Constraints adjacent to equality January 19, 2015 23 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

cut: otherwise

slide-74
SLIDE 74

Coalescing in isl Constraints adjacent to equality January 19, 2015 23 / 27

Coalescing Cases

5

A has single inequality adjacent to equality of B (other constraints of A are valid) Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-75
SLIDE 75

Coalescing in isl Constraints adjacent to equality January 19, 2015 23 / 27

Coalescing Cases

5

A has single inequality adjacent to equality of B (other constraints of A are valid) Result of replacing t(x) ≥ 0 by t(x) ≤ −1 is a subset of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-76
SLIDE 76

Coalescing in isl Constraints adjacent to equality January 19, 2015 23 / 27

Coalescing Cases

5

A has single inequality adjacent to equality of B (other constraints of A are valid) Result of replacing t(x) ≥ 0 by t(x) ≤ −1 is a subset of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-77
SLIDE 77

Coalescing in isl Constraints adjacent to equality January 19, 2015 23 / 27

Coalescing Cases

5

A has single inequality adjacent to equality of B (other constraints of A are valid) Result of replacing t(x) ≥ 0 by t(x) ≤ −1 is a subset of B ⇒ replace A ∪ B by set bounded by

all valid constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-78
SLIDE 78

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-79
SLIDE 79

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-80
SLIDE 80

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-81
SLIDE 81

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-82
SLIDE 82

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-83
SLIDE 83

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-84
SLIDE 84

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-85
SLIDE 85

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-86
SLIDE 86

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

6

A has single inequality adjacent to equality of B (other constraints of A are valid) Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-87
SLIDE 87

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-88
SLIDE 88

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-89
SLIDE 89

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-90
SLIDE 90

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-91
SLIDE 91

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-92
SLIDE 92

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-93
SLIDE 93

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-94
SLIDE 94

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-95
SLIDE 95

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-96
SLIDE 96

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-97
SLIDE 97

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

7

B extends beyond A by at most one and all cut constraints of B can be wrapped around shifted facet of A to include A ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints (check final number of constraints does not increase)

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-98
SLIDE 98

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-99
SLIDE 99

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

8

A has equality adjacent to equality

  • f B

Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A Non-valid constraints of A (except t(x) ≥ 0) can be wrapped around t(x) ≤ 0 to include B ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-100
SLIDE 100

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

8

A has equality adjacent to equality

  • f B

Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A Non-valid constraints of A (except t(x) ≥ 0) can be wrapped around t(x) ≤ 0 to include B ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-101
SLIDE 101

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

8

A has equality adjacent to equality

  • f B

Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A Non-valid constraints of A (except t(x) ≥ 0) can be wrapped around t(x) ≤ 0 to include B ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-102
SLIDE 102

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

8

A has equality adjacent to equality

  • f B

Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A Non-valid constraints of A (except t(x) ≥ 0) can be wrapped around t(x) ≤ 0 to include B ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-103
SLIDE 103

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

8

A has equality adjacent to equality

  • f B

Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A Non-valid constraints of A (except t(x) ≥ 0) can be wrapped around t(x) ≤ 0 to include B ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-104
SLIDE 104

Coalescing in isl Wrapping January 19, 2015 24 / 27

Coalescing Cases

8

A has equality adjacent to equality

  • f B

Non-valid constraints of B (except t(x) ≤ −1) can be wrapped around t(x) ≥ −1 to include A Non-valid constraints of A (except t(x) ≥ 0) can be wrapped around t(x) ≤ 0 to include B ⇒ replace A ∪ B by set bounded by

all valid constraints and all wrapped constraints

Constraint t(x) ≥ 0 valid: min t(x) > −1 separate: max t(x) < 0

◮ adjacent to inequality:

t = −u − 1

◮ adjacent to equality:

t = −1

cut: otherwise

slide-105
SLIDE 105

Coalescing in isl Existentially Quantified Variables January 19, 2015 25 / 27

Existentially Quantified Variables and Equalities

Quantifier elimination in isl replaces existentially quantified variables by integer divisions of affine expressions in other variables These integer divisions are sorted prior to coalescing A and B have same number of integer divisions/existentials

⇒ try all cases

integer divisions of A form subset of those of B (after exploiting equalities of B)

⇒ check if B is a subset of A

integer divisions of B form subset of those of A and equalities of B simplify away the integer divisions of A not in B

⇒ introduce integer divisions in B and try all cases

slide-106
SLIDE 106

Conclusions January 19, 2015 26 / 27

Outline

1

Introduction and Motivation Polyhedal Model The need for coalescing Traditional “Coalescing”

2

Coalescing in isl Rational Cases Constraints adjacent to inequality Constraints adjacent to equality Wrapping Existentially Quantified Variables

3

Conclusions

slide-107
SLIDE 107

Conclusions January 19, 2015 27 / 27

Conclusions

it is important to keep the number of disjuncts in a set representation as low as (reasonably) possible coalescing in isl

◮ never increases the total number of constraints ◮ based on solving LP problems with same dimension as the original set ◮ recognizes a set of patterns