Download presentation
Presentation is loading. Please wait.
Published byBruce Flowers Modified over 9 years ago
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
Page 2 Dataflow Frequency Analysis n Goal –accurately computing frequencies of data flow facts n Problem: –high costs for computing accurate frequencies requires whole program path efficient data structures and algorithm? n 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
Page 3 Outline n Motivation n WPP profiling n Properties of bi-distributive DFAs n Algorithm n Experiments n Conclusion
4
Page 4 Program Classical Approach n Drawback: n Classical Program Optimization: transformation data flow analysis optimizer binary information Optimized program Optimized program Optimizer heavily rarely never
5
Page 5 Program Profiling Approach n Advantage: n Probabilistic Program Optimization: transformation dataflow freq. analysis Optimizer based on profiling frequency information Optimized program Optimized program Optimizer heavily rarely never Profile
6
Page 6 Running Example n CFG Example –simple code fragment –8 times left branch –terminates via right branch n Reaching definitions problem –two definitions: d 1, d 2 –d 1 kills d 2 and vice versa –use of x at the end of loop n Questions –How often does d 1 hold at node 5? –How often does d 2 hold at node 5? s 1 32 4 5 d 1 : x:=...d 2 : x:=......x...
7
Page 7 WPP Profiling n Captures the whole program path –Larus at PLDI’99 n Path profiling techniques for acyclic paths –minimal insertion of instrumentation code –keeps executable fast n 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
Page 8 WPP Example s 1 32 4 5 n CFG Example n Program Run - 8x left branch - 1x right branch A S abc S a A A A b c A b b n WPP Graph & Grammar n Terminals: a: [s,1,2,4] b: [1,2,4] c: [1,3,4,5]
9
Page 9 Bi-Distributive Dataflow Problems n Properties –finite lattice 2 D (power set of dataflow facts) –transition functions are monotone –transition functions distribute –representation relation –covers bit-vector problems n Due to properties –transition functions represented as 0/1-matrices –states represented as 0/1-vectors
10
Page 10 Representation Relation Transition function f : 2 D 2 D –represented by f r : D 2 D –artificial data fact 2 4 d 1 : x:=... 1 {d1, } {}d2d2 d1d1 M(2 4) r D n Example
11
Page 11 Matrix Representation n Matrix representation of function f n Example
12
Page 12 Dataflow Frequencies 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 n Approach for fast computation –adopt definition for grammar symbols of SEQUITUR s v
13
Page 13 Frequency Matrix n Definition of frequency matrices –sum computation due matrix calculus n Frequency matrices for eliminating sum n Computation of frequency matrices for grammar symbols
14
Page 14 Terminals n Transition function –compose function for acyclic path t:[u 1, u 2,..., u k ] –represent transition function as matrix n Frequency matrix
15
Page 15 Nonterminals n Transition function –compose transition function for nt X 1, X 2,..., X k –represent transition function as matrix n Frequency matrix
16
Page 16 Example Terminal b: [1,2,4] 2 4 d 1 : x:=... 1 Nonterminal A bb
17
Page 17 Algorithm forall v N do forall t T do compute terminal t for node v endfor forall nt NT in reverse topological order do compute nonterminal nt for node v endfor endfor n Pseudo-Code
18
Page 18 Example A S abc n Transition matrices and frequency matrices for terminals A S abc a A S abc b A S abc c
19
Page 19 Example A S abc n Transition matrices and frequency matrices for nonterminals A S abc A A S abc S Frequency matrix of start symbol S contains the dataflow frequency information!
20
Page 20 Experiments n Gcc-Compiler 2.95.2 –data flow frequency analysis written in C++/C –implementation of WPP (runtime & compiletime) n Benchmark –some programs of SpecInt95 –reaching definitions problem n Environment –Sun Ultra Enterprise 450 (4 x 296 MhZ) with 2.5 GB
21
Page 21 Node Statistics n about 40% of nodes are executed n no computations for 60% of nodes required
22
Page 22 WPP Size & Overhead n WPP Size in Kbytes n Compile Overhead in % - Compile time overhead almost proportional to WPP size
23
Page 23 Conclusion n Novel dataflow frequency analysis –designed for bi-distributive dataflow analysis problems –matrix representation of transition functions –employs SEQUITUR Grammars n Accurate and efficient algorithm n Experiments –platform: gcc for Ultra 450 –benchmark: reaching definitions problem for SpecInt95 –overhead is proportional to the size of WPP
24
Page 24 Stop!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.