Download presentation
Presentation is loading. Please wait.
Published byMadlyn Gibbs Modified over 8 years ago
1
Ghent University Veerle Desmet Lieven Eeckhout Koen De Bosschere Using Decision Trees to Improve Program-Based and Profile-Based Static Branch Prediction
2
VEERLE DESMET – Ghent University2 if (input >= 0) { for (i=0; i<10; i++) { /* a loop :) */ } else printf(“input < 0”); compiler architecture loop i<10 loopheader end if (input ≥ 0) printf() Control flow High-level program code
3
VEERLE DESMET – Ghent University3 Static fixed prediction per static branch predicts most frequently direction backward branches typically taken e.g 1 misprediction for 10 predictions Applications compiler optimizations embedded systems for guiding dynamic branch prediction loop i<10 loopheader end if (input ≥ 0) printf() Branch Prediction Least likely path Most likely path loop i<10 loopheader end if (input ≥ 0) printf() taken not-taken
4
VEERLE DESMET – Ghent University4 Outline Introduction Decision Trees Extended feature set Heuristics Ordering Two new heuristics Results Conclusion
5
VEERLE DESMET – Ghent University5 Decision trees C4.5 Set examples Choose best split (information gainratio) Divide examples in subtrees Repeat for subtrees Classification model forward branch direction branch type backward takennot-taken taken beq bgt bne features
6
VEERLE DESMET – Ghent University6 Features Literature [Calder et al.] branch direction, branch type, successor basic block is a loopheader, postdominance relations,... New candidate features number of instructions in successor basic block dependency distance number of incoming edges … Branch Type Branch Direction Branch Operand Opcode Branch Operand Function Branch Operand Type RA Opcode RA Function RA Type RB Opcode RB Function RB Type Procedure Type Loop Header Branch Dominates Branch Postdominates Successor Ends Successor Loop Successor Back Edge Successor Exit Edge Successor UseDef Successor Call Language Register Looplevel Basic Block Size Dependency Distance RA Register RA Distance RB Register RB Distance Successor Looplevel Successor Basic Block Size Incoming Edges Successor Incoming Edges Successor Loop Sequence Features 2.8%
7
VEERLE DESMET – Ghent University7 Fair evaluation Programs C4.5 Prediction model Evaluation SPECint2000 SPECint95 forward branch direction branch type backward takennot-taken taken beq bgt bne
8
VEERLE DESMET – Ghent University8 Outline Introduction Decision Trees Extended feature set Heuristics Automatic Ordering Two new heuristics Results Conclusion
9
VEERLE DESMET – Ghent University9 Loops for, while,... 11% static 35% dynamic Loops are repeated 81% correct 88% static upper limit loop i<10 loopheader end if (input ≥ 0) printf() Heuristic:
10
VEERLE DESMET – Ghent University10 Opcode Negative numbers denote error values Pointer Pointer ≠ NULL Pointers differ Loopheader Loops are entered... loop i<10 loopheader end if (input ≥ 0) printf() Non-loops Heuristics:
11
VEERLE DESMET – Ghent University11 Heuristic ordering Loop → pointer → call → opcode → return → store → loopheader → guard + random [Ball & Larus] Optimal ordering out of 8! possibilities Dependent on program set Automated way loop i<10 loopheader end if (input ≥ 0) printf() Priority:
12
VEERLE DESMET – Ghent University12 Optimal tree loop opcode call return loopheader store pointer heuristic not-taken taken not-takentaken SPECint2000 SPECint95 ordering
13
VEERLE DESMET – Ghent University13 New heuristic 1 If one successor is postdominator Predict the non- postdominating successor if -block without else -block: if -block will be executed if -block postdominating block if (input ≥ 0) Postdominating heuristic NEW
14
VEERLE DESMET – Ghent University14 New heuristic 2 “number of instructions between branch and its register defining instruction” ld r3, (r1) beq r2... cmplt r1, 10, r2 add r3, r4, r5 bne r2 distance 2undefined distance NEW Dependency distance heuristic
15
VEERLE DESMET – Ghent University15 Final ordering loop opcode call return loopheader store postdom heuristic not-taken taken not-taken SPECint2000 SPECint95 taken distance not-taken <3undefined≥3 noyes
16
VEERLE DESMET – Ghent University16 IPM Instructions Per Mispredicted branch “ how many instructions, including correctly predicted branches, one passes on average before encountering a mispredicted branch” [Fisher & Freudenberger] HIGHER-IS-BETTER
17
VEERLE DESMET – Ghent University17 Results 0 10 20 30 40 50 60 70 80 90 100 gzip vpr gcc mcf crafty parser perlgap vortex bzip2 twolf compress go ijpeg li m88ksim average IPM Ball & Larus order: 31.3 IPM 18.5% Higher-is-better + postdominating heuristic: 34.7 IPM + dependency distance heuristic: 37.1 IPM Decision Tree order: 32.1 IPM
18
VEERLE DESMET – Ghent University18 Conclusion This presentation: Set extra features provides 2.8% gain in IPM Decision trees for heuristic ordering automatic extracting new heuristics 18.5% gain in IPM In paper also: Coverage for heuristics Profile-based branch prediction up to 11% gain in IPM
19
Ghent University Paper: proceedings pp. 336—352 Presentation: www.elis.ugent.be/~vdesmet VEERLE DESMET – Ghent University
20
Ghent University Veerle Desmet Lieven Eeckhout Koen De Bosschere Using Decision Trees to Improve Program-Based and Profile-Based Static Branch Prediction
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.