



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















Overview
-^ Why we fail to fully optimise •^ How to overcome this •^ Profile Directed Compilation •^ Iterative Compilation •^ Critical evaluation and conclusion M. O’Boyle^
Profile directed compilation
-^ Direct addresses problem of compile time unknown data •^ Key(simple) idea: run program once and collect some useful information •^ Use this runtime information to better improve program performance •^ In effect move the first runtime into the compile time phase •^ Makes sense if gathering the profile data is cheap and user willing to pay for 2compiles. Can still use after first compile. •^ Allows specialisation to runtime data - pros and cons? M. O’Boyle^
PDC schematic Compiler^
executable
program
data^0 results
Compiler^
data executable
profile
results
0
1 1
Profile information is an additional output.Data can change from run to run. Executable still correct. M. O’Boyle
PDC Example 1
Sequence of basic blocksFrequency of execution on edges andnodesPrimarily ABEFOther entry/exit control-flowprevents mergingSuper-block - frequently executed pathMerge and tidy-upOptimise larger unit
D^
E F
C A 100
10 B (^9090100) 0
10 10 (^90090900) 1 99
PDC Example 2
Selecting the traceStart at most frequent blockAdd blocks on most frequent successorsRepeat on other nodesDone in both control-flow directionsDo on remaining nodes
D^
E F
C A 100
10 B 90 90 0
10 10 (^90090900) 1 99
F 100
Beyond Path profiling
-^ Although useful, the performance gains are modest •^ Challenge of undecidability and processor behaviour not addressed. •^ What happens if data changes on the second run?? •^ Really focuses on persistent control-flow behaviour •^ All other information eg runtime values, memory locations accessed ignored •^ Can we get more out of knowing data and its impact on program behaviour? M. O’Boyle^
Evolution of PDC
PDC one compile
Iterative: multiple compiles
UltraSparc: space within 20% of minimum
N^ = 400
10 20 30
Tile Size Unroll Minimum at: Unroll = 3 and Tile size = 57.Near minimum: 2.6%. Original 4.99 secs, Minimum 0.56 secs M. O’Boyle
UltraSparc
N^ = 400 0 20 40
Number of Evaluations Within % of minimium 50 steps: within 0.0%. Initially 2.65 times slower than minimum M. O’Boyle
Alpha^ N
= 512 0 20 40
Number of Evaluations Within % of minimium 50 steps: within 21.9%.Originally 5.25 times slower than minimum M. O’Boyle
Pentium Pro: space within 20% of minimum
N^ = 400
10 20 30
Tile Size Unroll Minimum at: Unroll = 19 and Tile size = 57.Near minimum: 4.3%. Original 4.88 Minimum 1.43 M. O’Boyle
R10000:
N^ = 512 10 20 30
Tile Size Unroll Minimum at: Unroll = 4 and Tile size = 85.Near minimum: 7.2%. Original 2.79, Minimum 1.09 M. O’Boyle
R
N^ = 512 0 20 40
Number of Evaluations Within % of minimium 50 steps: within 4.9%. M. O’Boyle