+ All Categories
Home > Documents > Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege,...

Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege,...

Date post: 03-Jan-2016
Category:
Upload: donna-lang
View: 217 times
Download: 0 times
Share this document with a friend
Popular Tags:
29
Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler Construction - 2005
Transcript
Page 1: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

Experiences with Enumeration of Integer Projections of Parametric Polytopes

Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor

Compiler Construction - 2005

Page 2: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

2Overview

Explaining the title. Useful in which Compiler Analyses? High-level Algorithm Overview Experiments Conclusion

Page 3: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

3Overview

Explaining the title. Useful in which Compiler Analyses? High-level Algorithm Overview Experiments Conclusion

Page 4: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

4Introduction

Counting problems in compiler: How many executed calculations? How many data addresses accessed? How many cache misses? How many dynamically allocated bytes? How many live array elements at a

symbolic iteration (i,j)? How much communication between

parallel processes? …

Often, answering these questions lead to counting the number integer solutions to a system of linear inequalities:-when the code consists of loops with linear loop bounds.-when the array index expressions have a linear form.

Page 5: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

5

Example 1: Counting solutions to systems of linear inequalities

void s(int N, int M){ int i,j; for(i=max(0,N-M); i<=N-M+3; i++) for(j=0; j<=N-2*i; j++) S1;}

How many times is statement S1 executed?Equals the number of elements in the set:

linear inequalities defining a bounded domain polytope

parameters parametric

Page 6: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

6

Geometric representation: parametric integer polytope

Page 7: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

7

Solution: counting the number of integer points in a parametric polytope

Algorithm see CASES2004:“Analytical Computation of Ehrhart Polynomials: Enabling more Compiler Analyses and Optimizations”.

Solution:

Page 8: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

8

Contribution: Extension to include existential variables

Goal: count the solution in parameterized sets of the form:

CASES2004:

CC2005:

Page 9: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

9

l = 6i+9j-7

1 <= j <= P and1 <= i <= 8

Example: How many array elements accessed in following loop?

for j:= 1 to P do for i:= 1 to 8 do a(6i+9j-7) += 5

Page 10: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

10

Geometric representation: Integer projection of parametric polytope.

for j:= 1 to P do for i:= 1 to 8 do a(6i+9j-7) += 5

P = 3

Answer:

Not a polytope!

Page 11: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

11Overview

Explaining the title. Useful in which Compiler Analyses? High-level Algorithm Overview Experiments Conclusion

Page 12: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

12

Examples of compiler analyses benefiting from our work

Data placement while taking into account real-time constraints Anantharaman et al., RTSS 1998

Memory size estimation of loop nests after translation to VLSI designs

Balasa et al., IEEE T.VLSI 1995 Zhao et al., IEEE T.VLSI 2000

Compilation to parallel FPGA / VLSI Bednara et al., Samos 2002 Hannig et al., PaCT 2001

Calculating Cache Behavior Beyls et al., JSA 2005 Chatterjee et al., PLDI 2001

Computing communication in distributed memory computers (HPF)

Boulet et al., Euro-Par 1998 Heine et al., Euro-Par 2000 Su et al., ICS 1995

Low-Power Compilation D’Alberto et al., COLP 2001

Page 13: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

13Usefulness

In many of the above papers, the authors spent most of the paper discussing estimation methods to get approximate answers to the question: How many elements in S?

In this paper, we answer this question exactly.

Page 14: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

14Overview

Explaining the title. Useful in which Compiler Analyses? High-level Algorithm Overview Experiments Conclusion

Page 15: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

15Overall idea: PIP/heuristics + Barvinok

PIP(Feautrier’88)

Ehrhart(Clauss’96)

Solution: closed form Ehrhart quasi-polynomial

3 Heuristics(novel)

Barvinok(Verdoolaege’04)

Boulet(1998):Worst-case exponentialexec. time, even for fixednumber of variables

Novel method:Worst-case polynomialexec. time, for fixednumber of variables

Page 16: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

16

PIP(Feautrier’88)

Parametric Integer Programming (PIP)

PIP allows to compute the lexicographical minimal element of a parametric polytope

Compute the lexicographical minimum of all points in S that are projected onto the same point in S’. (Worst-case exponential time)

Page 17: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

17

3 Heuristics(novel)

3 Polynomial-time Heuristics

1. Unique existential variables “thickness” always smaller than 1: treat

existential variable as regular variable

2. Redundant existential variables “thickness” always larger than 1: project

polytopes, and count project. Legal, since there are no “holes”. (=Omega test).

3. Independent splits If none of the above applies, try to split

polytope in multiple polytopes, for which one of the above rules applies

Page 18: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

18

3 Heuristics(novel)

3 Heuristics: example

“thickness” ≥1

“thickness” ≤1

Page 19: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

19Overview

Explaining the title. Useful in which Compiler Analyses? High-level Algorithm Overview Experiments Conclusion

Page 20: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

20Experiments

Reuse Distance Calculation [Beyls05]

Communication volume computation in HPF [Boulet98]

Memory Size Estimation [Balasa95] Parametric Cache Miss Calculation

[Chatterjee01]

Page 21: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

21Reuse Distance Calculation

Computes the number of data locations accessed between two consecutive reuses of the same data.

Parameters: iteration point where reuse occurs + program parameters.

Page 22: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

22

Test 1: Matrix multiply, matrix size multiple of cache line size.

PIP vs. Heuristics

PIP(Feautrier’88)

3 Heuristics(novel)

Barvinok(Verdoolaege’04)

Page 23: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

23

Test 2: Matrix multiply, matrix size 19 and 41, cache line size 4

Heuristics: 2 sets couldn’t be computed in one hour of time.(vertex calculation during change of basis)

PIP: 4 sets couldn’t be computed in an hour of time.

Conclusion: There are sets for which neither method can compute the solution in reasonable time.

Page 24: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

24Test 3: Ehrhart vs. Barvinok

PIP(Feautrier’88)

Ehrhart(Clauss’96)

Barvinok(Verdoolaege’04)

Page 25: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

25

Other applications.a) communication in HPF [Boulet98]

Computation of communication volume (HPF, Boulet98):

Ehrhart Barvinok

8x8 processors

713s/0.04s 0.01s

64x64 processors

6855s/1.43s 0.01s

Page 26: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

26

Other applicationsb) Memory size estimation [Balasa95]

Ehrhart Barvinok

4 memory references

1.38s/0.01s/1.41s/1.41s

0.06s/0.01s/0.07s/0.04s

Memory accessed by 4 different references in a motion estimation loop kernel, with symbolic loop bounds

Page 27: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

27

Other applicationsc) Cache miss analysis [Chatterjee01]

Computes the number of cache misses in a two-way set-associative cache, for matrix-vector multiplication with symbolic loop bounds.

PIP+Ehrhart

PIP+Barvinok

Heuristics+Barvinok

symbolic cache miss counting

> 15 h 449.39s 434.47s

Page 28: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

28Overview

Explaining the title. Useful in which Compiler Analyses? High-level Algorithm Overview Experiments Conclusion

Page 29: Experiences with Enumeration of Integer Projections of Parametric Polytopes Sven Verdoolaege, Kristof Beyls, Maurice Bruynooghe, Francky Catthoor Compiler.

29Conclusions

Many compiler analyses and optimization require the enumeration of integer projections of parametric polytopes.

Can be done by reduction to enumeration of parametric polytopes.

No clear performance difference between PIP and heuristics.

Can solve many problems that were previously considered very difficult or unsolvable.

Software available athttp://freshmeat.net/projects/barvinok


Recommended