Title: A Symbolic Approach to Bernstein Expansion for Program Analysis and Optimization
1A Symbolic Approachto Bernstein Expansionfor
Program Analysis and Optimization
- Philippe Clauss Irina Tchoupaeva
- ICPS/LSIIT Université Louis Pasteur
- Strasbourg - France
2ANALYSIS OPTIMIZATION
Programs
3Static Analysis
- Gives the most accurate and general results
- But is not always possible
- Non-predictable behavior
- dynamic approach
- Complex models and expressions
- Adapted mathematical frameworks
- Usable in optimizing tools or compilers
- Giving the most accurate and error-free results
- Example the polytope model
4The Polytope Model
- Geometric transformations translate to nested
loops transformations - Some characteristics translate to quantitative
evaluations
5Example live range of an array element axy
- Number of iterations where any axy was
accessed and will be accessed again? - Number of iterations between the first and last
access to axy?
6- For each reference aij, aj-1Ni-j,
ai-1j-i - Computation of the number of iterations occurring
before the iteration that references axy
7- Example for reference aij
- axy is referenced when ix and jy, i.e., at
iteration (x,y) - Number of iterations occurring before (x,y)
8- and
-
- are parameterized polytopes
- Number of integer points of each polytope
- Ehrhart polynomial of each polytope
- Implemented in Polylib
9- Computed Ehrhart polynomials
-
-
10Linear to non-linear model
- How can such a non-linear expression be used?
- Maximum value maximum number of simultaneously
alive elements - Would be useful for array contraction
- Cannot be handled by the polytope model
- Limited to linear (in-)equalities
- Need of additionnal tools
11Non-linear cases in program analysis
- Can this loop be
- parallelized?
- Does reference aq
- overlap reference
- aialpha1?
12(No Transcript)
13- Conventional value range analysis
- The value range of ialpha1 is entirely included
in the range of -i210ialpha-25 - The loop cannot be parallelized
- Is this true?
14- Better value range analysis using the Horner form
of -i210ialpha-25 alpha-25(10-i)i - More accurate bound
- Same conclusion
- Is this true?
NO! The exact value range is alpha-25,alpha
and the loop CAN be parallelized!
15Bernstein Expansion
- Gives an enclosure of the range of a polynomial
over a given interval - Avoids function evaluation
- Gives more accurate results than classic interval
methods - Applies for any multi-variate polynomial without
restriction - Exact range can be obtained
16- Implicit power form linear combination in the
power basis - Bernstein form linear combination in the
Bernstein basis
17Basis conversion
- Univariate case
- i-th Bernstein polynomial
- i-th Bernstein coefficient
18Basis conversion
- Multivariate case notations
19Basis conversion
- Multivariate polynomial
- I-th Bernstein polynomial
- I-th Bernstein coefficient
20Important theorems
- THEOREM 1 the minimum and maximum Bernstein
coefficients give an enclosure of the range of a
polynomial over the interval 0,1 - THEOREM 2 - VERTEX CONDITION - if the minimum and
maximum Bernstein coefficients occur at the
vertices of the Bernstein coefficients array,
then the enclosure is the exact range.
21?
!
Minimum bernstein coefficient Maximum bernstein
coefficient
Exact range
22From 0,1 to any interval
- Can any interval a,b be considered?
- Any interval can be mapped linearly onto 0,1
- The Bernstein coefficients of p(x) on a,b are
equal to the Bernstein coefficients of the
corresponding polynomial p(y) on 0,1 - The Bernstein coefficients of p(y) give an
enclosure of the range of p(x) on a,b
23From 0,1 to any interval
where
24Symbolic Bernstein expansion
- To handle parameterized polynomials over
intervals with bounds depending on variables and
parameters - quite more powerful for general program
analysis - Bernstein expansion allows it!
25Symbolic Bernstein expansion
- By considering polynomial coefficients on
parameters - The same formulas apply!
26Symbolic Bernstein expansion
- Mapping onto 0,1 can be done for parameterized
boxes by evicting some values
must be ? 0
where
27Example (with parameterized coefficients)
28Example (with parameterized coefficients)
29Example (with intervals depending on parameters
and variables)
- Not valid for N0 or i0
- (0,0) excluded
- New mapping
- ? Consider Ngt1
30(No Transcript)
31Example (contd.) array contraction
- Consider a as a temporary array
- Transform a into a smaller array
32- Minimum memory amount needed
- maximum number of simultaneously
- alive array elements
- maximum live range for all array elements
- Live range of any array element axy
33- Not valid for N5 and N3
- Let us consider N gt 5
34- Bernstein coefficients
- Maximum coefficient
35- Array a contracted from to
- elements
36Related works
- Decomposition of polynomials into affine
constraints and hyperbolic/elliptical equations
(Maslov Pugh) - Analysis of monotonic polynomials (Blume
Eigenmann) - Univariate and monotonic polynomials (Van Engelen)
37Complexity
- Primitive algorithm
- O(nv), vnumber of variables
- Linear complexity algorithm proposed by Delgado
Peña
38Conclusion
- Many other application fields
- Many static analysis issues data reuse distance
in loops, memory consumption, - Symbolic cache behavior modeling
- Program trace analysis (polynomial interpolation)
- Partially implemented
- Parameterized intervals not yet considered
39Conclusion
- Further developments
- Iterative Bernstein expansion when Bernstein
coefficients are not linear - Tighter bounds through degree elevation
- Parameterized polynomial inequations solving for
the general case - Symbolic number of solutions for systems of
parameterized polynomial inequations
40 THANK YOU !