1 / 24

Dataflow Frequency Analysis based on Whole Program Paths

Dataflow Frequency Analysis based on Whole Program Paths. Eduard Mehofer Institute for Software Science University of Vienna mehofer@par.univie.ac.at www.par.univie.ac.at/~mehofer. Bernhard Scholz Institute of Computer Languages Vienna University of Technology

Download Presentation

Dataflow Frequency Analysis based on Whole Program Paths

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dataflow Frequency Analysis based on Whole Program Paths Eduard Mehofer Institute for Software Science University of Vienna mehofer@par.univie.ac.at www.par.univie.ac.at/~mehofer Bernhard Scholz Institute of Computer Languages Vienna University of Technology scholz@complang.tuwien.ac.at www.complang.tuwien.ac.at/scholz

  2. Dataflow Frequency Analysis • Goal • accurately computing frequencies of data flow facts • Problem: • high costs for computing accurate frequencies • requires whole program path • efficient data structures and algorithm? • Approach: • exploiting algebraic properties of bi-distributive DFA problems • employing WPPs to capture control flow • computing frequencies in a bottom-up style on the WPP graph

  3. Outline • Motivation • WPP profiling • Properties of bi-distributive DFAs • Algorithm • Experiments • Conclusion

  4. Classical Approach • Classical Program Optimization: optimizer data flow analysis Program Optimized program binaryinformation transformation • Drawback: heavily rarely never Optimizer

  5. Program Profile Profiling Approach • Probabilistic Program Optimization: Optimizer based on profiling dataflow freq. analysis Optimized program frequencyinformation transformation • Advantage: heavily rarely never Optimizer

  6. Running Example s 1 2 3 d1: x:=... d2: x:=... • CFG Example • simple code fragment • 8 times left branch • terminates via right branch • Reaching definitions problem • two definitions: d1, d2 • d1 kills d2 and vice versa • use of x at the end of loop • Questions • How often does d1 hold at node 5? • How often does d2 hold at node 5? 4 ...x... 5

  7. WPP Profiling • Captures the whole program path • Larus at PLDI’99 • Path profiling techniques for acyclic paths • minimal insertion of instrumentation code • keeps executable fast • Sequitur for compression • builds a grammar • terminals are acyclic paths • nonterminals have only one production • graph representation of grammar • grammar has only sentence • best case: logarithmic size reduction

  8. WPP Graph & Grammar S S  a A A A b c s A  bb A 1 a b c 2 3 4 • Terminals: • a: [s,1,2,4] • b: [1,2,4] • c: [1,3,4,5] 5 WPP Example • CFG Example • Program Run • 8x left branch • 1x right branch

  9. Bi-Distributive Dataflow Problems • Properties • finite lattice 2D (power set of dataflow facts) • transition functions are monotone • transition functions distribute • representation relation • covers bit-vector problems • Due to properties • transition functions represented as 0/1-matrices • states represented as 0/1-vectors

  10. Example 1 D M(24)r d1 {} 2 d2 {} d1: x:=... 4  {d1, } Representation Relation • Transition function f: 2D 2D • represented by f r : D 2D • artificial data fact 

  11. Example Matrix Representation • Matrix representation of function f

  12. Dataflow Frequencies s v • Definition of dataflow frequencies for node v • r whole program path • prefix: set of all sub-paths from start node to node v • : converts data flow facts to 0/1-vector • state(): data flow facts which hold along path  • sums up the occurrences of data flow facts which hold in v • Approach for fast computation • adopt definition for grammar symbols of SEQUITUR

  13. Frequency matrices for eliminating sum • Computation of frequency matrices for grammar symbols Frequency Matrix • Definition of frequency matrices • sum computation due matrix calculus

  14. Frequency matrix Terminals • Transitionfunction • compose function for acyclic path t:[u1, u2, ..., uk] • represent transition function as matrix

  15. Frequency matrix Nonterminals • Transitionfunction • compose transition function for ntX1, X2, ..., Xk • represent transition function as matrix

  16. 1 2 d1: x:=... 4 • Nonterminal Abb Example • Terminal b: [1,2,4]

  17. Algorithm • Pseudo-Code forallvNdo foralltTdo compute terminaltfor nodev endfor forallntNT in reverse topological orderdo compute nonterminal ntfor nodev endfor endfor

  18. S S a b A A a b c a b c S S c A A a b c a b c Example • Transition matrices and frequency matrices for terminals

  19. S A S A a b c S A a b c Example • Transition matrices and frequency matrices for nonterminals S A a b c Frequency matrix of start symbol S contains the dataflow frequency information!

  20. Experiments • Gcc-Compiler 2.95.2 • data flow frequency analysis written in C++/C • implementation of WPP (runtime & compiletime) • Benchmark • some programs of SpecInt95 • reaching definitions problem • Environment • Sun Ultra Enterprise 450 (4 x 296 MhZ) with 2.5 GB

  21. Node Statistics • about 40% of nodes are executed • no computations for 60% of nodes required

  22. WPP Size & Overhead • Compile Overhead in % • WPP Size in Kbytes • Compile time overhead almost proportional to WPP size

  23. Conclusion • Novel dataflow frequency analysis • designed for bi-distributive dataflow analysis problems • matrix representation of transition functions • employs SEQUITUR Grammars • Accurate and efficient algorithm • Experiments • platform: gcc for Ultra 450 • benchmark: reaching definitions problem for SpecInt95 • overhead is proportional to the size of WPP

  24. Stop!

More Related