Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula...

9
Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Transcript of Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula...

Page 1: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Data Flow in Static Profiling

Cathal Boogerd, Delft University, The Netherlands

Leon Moonen, Simula Research Lab, Norway

?

Page 2: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Why Static Profiling?

• Static Profiling: estimate a program’s execution profile by static program analysis– Frequency or likelihood?

• Applications include compiler optimization or WCET analysis– Previous work: prioritizing code inspection results

• Application domain: embedded systems– No hardware available for test during early development– Lack of complete test profile and infrastructure for

dynamic measurements

Page 3: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Execution Likelihood and Frequency

• Both concepts are relevant for our application

• Consider difference between v1, guaranteed to be executed ..

• .. And v2, typically executed many times

int main (int argc, char argv) { /* v1 */ int a = 1 ; foo(a) ; for (a = 0; a < argc; a++) { /* v2 */ } return 0;}

Page 4: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Data Flow in Static Profiling

• Previously: 65% of locations in test set predicted accurately with 5 percent point error margin– But: many locations had likelihood of either 1 or 0– Improve others by improving branch prediction

• Estimating frequencies requires techniques to estimate loop frequencies– Use operations on loop variable to derive estimate

Use data flow information!

Page 5: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

General Idea

• Use simplified version of existing branch prediction technique– Numeric range propagation, Patterson’s study

indicated this leads to small but noticeable improvement

– Computationally cheap variant: scalability is an issue, algorithms must cope with large software stacks (up to 5MLoC)

Page 6: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

General Idea: More Specific

• Track potential value ranges of all integer variables– Value range propagation as generalization of constant

propagation

• Use known ranges to improve estimates for conditions in which the corresponding variables occur

• Use ranges and operations on loop variables to estimate loop frequency

Page 7: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Application

• Loop variable a has ranges [6[0:5]]

• Variable b has ranges [3[1],3[3:5]]

• Point of interest has frequency 3

• Of all conditions in the test set, 8% had complete variable value info

a = 5 ;whi l e (a >= 0) { i f (a < 3) { b = 1 ; } else { b = a ; } i f (b > 2) { / * point of interest */ } a−−;}

Page 8: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Findings

• Simple data flow propagation algorithm only adds linear time overhead to previous solution

• However, simple data flow does not add significant information over type-based heuristics– Notably, the number of branches benefiting is limited

• Most likely culprits for differences with earlier study:– Numeric ranges instead of (simple) symbolic ones– Context-insensitivity instead of procedure cloning

Page 9: Data Flow in Static Profiling Cathal Boogerd, Delft University, The Netherlands Leon Moonen, Simula Research Lab, Norway ?

Summary

• Does data flow analysis for profiling work?– Previous control flow based solution works just as well– It is scalable, but it does not add value

Can data flow analyses increase accuracy of static profiling and remain scalable?