220 likes | 349 Views
Aliasing and Anti-Aliasing in Branch History Table Prediction Kris Breen EE 710 A2 Nov. 26, 2002. OUTLINE. Introduction Theory Experiment Results Conclusions & Future Work. Aliasing and Anti-Aliasing in BHT Prediction. OUTLINE. Introduction Theory Experiment Results
E N D
Aliasing and Anti-Aliasing in Branch History Table Prediction Kris Breen EE 710 A2 Nov. 26, 2002
OUTLINE • Introduction • Theory • Experiment • Results • Conclusions & Future Work Aliasing and Anti-Aliasing in BHT Prediction
OUTLINE • Introduction • Theory • Experiment • Results • Conclusions & Future Work Aliasing and Anti-Aliasing in BHT Prediction
INTRODUCTION • Branch history predictors have advantage of simplicity • Prediction accuracy limited by table size, due to aliasing Aliasing and Anti-Aliasing in BHT Prediction
INTRODUCTION 2n-entry BHT n Hash Function PC of branch Aliasing and Anti-Aliasing in BHT Prediction
INTRODUCTION 2n-entry BHT PC of branch 1 n Hash Function ALIASING PC of branch 2 Aliasing and Anti-Aliasing in BHT Prediction
OUTLINE • Introduction • Theory • Experiment • Results • Conclusions & Future Work Aliasing and Anti-Aliasing in BHT Prediction
THEORY • What performance loss occurs due to aliasing? • Can reasonably assume that aliasing has a negative impact on branch prediction. • Start by assuming that hash function simply uses low bits of address. • Analyze static program properties first. Aliasing and Anti-Aliasing in BHT Prediction
THEORY • m = total number of addresses in program • size of predictor table • pb = probability that an instruction is a branch • p(0 branches hash to x) = (1 - pb)m • p(2 or more branches hash to x) = • 1 - p(0 branches hash to x)- p(1 branch hashes to x) • = 1 - (1 - pb)m - pb(1 - pb)m-1 Aliasing and Anti-Aliasing in BHT Prediction
THEORY • Assuming 1 in 7 instructions is a branch, and a program size 10 times larger than the table size, • p(2 or more branches hash to x) = 71% • For a 1024 entry table, this means that about 700 entries are experiencing aliasing. Further evaluation shows that of the remaining 300 entries, about 250 of them likely have no branches hashing to them. These can be used for anti-aliasing. Aliasing and Anti-Aliasing in BHT Prediction
OUTLINE • Introduction • Theory • Experiment • Results • Conclusions & Future Work Aliasing and Anti-Aliasing in BHT Prediction
EXPERIMENT • Used SimpleScalar to analyze effects of aliasing in programs • Based experiments on PISA architecture • Used 2-bit predictor and hash function based on low bits of address Aliasing and Anti-Aliasing in BHT Prediction
EXPERIMENT • Modified bpred.[ch] to remember entire branch PC when BHT lookup is done. • On every BHT lookup, bpred.c compares the current branch PC to the stored branch PC. If these differ, then a lookup alias has occurred, and it is recorded. • On BHT update, bpred.c checks if the prediction was correct. If it wasn’t, and it was from an aliased table entry, a miss due to aliasing is recorded. Aliasing and Anti-Aliasing in BHT Prediction
EXPERIMENT • Simulations were run using Todd Austin’s SPEC2000-derived benchmarks (gcc, anagram, compress, go) • Branch history table sizes of 32, 256, 1024, and 8192 were each used for each benchmark. • Percentage of aliased lookups and percentage of misses due to aliasing were recorded for each simulation. Aliasing and Anti-Aliasing in BHT Prediction
OUTLINE • Introduction • Theory • Experiment • Results • Conclusions & Future Work Aliasing and Anti-Aliasing in BHT Prediction
RESULTS • Sample simulation output (from gcc using a 1024 entry table): • bpred_bimod.lookups 56329774 # total number of bpred lookups • bpred_bimod.dir_hits 49575889 # total number of direction-predicted hits • bpred_bimod.misses 6753885 # total number of misses • bpred_bimod.aliases 3991026 # total number of aliases • bpred_bimod.alias_rate 0.0709 # alias rate (aliases/lookups) • bpred_bimod.alias_misses 2614746 # number of mispredictions due to aliasing Aliasing and Anti-Aliasing in BHT Prediction
RESULTS Aliasing and Anti-Aliasing in BHT Prediction
RESULTS • Miss rate when using aliased BHT entries ranged from 44% to 61%, which supports concept that aliased accesses provide effectively random information Aliasing and Anti-Aliasing in BHT Prediction
OUTLINE • Introduction • Theory • Experiment • Results • Conclusions & Future Work Aliasing and Anti-Aliasing in BHT Prediction
CONCLUSIONS • Reduction of aliasing can provide a substantial performance gain at minimal cost when using BHT • Worst case miss rate = • predictor miss rate + alias rate • For a predictor miss rate of 10% and an alias rate of 10%, halving the alias rate improves overall prediction by 25% Aliasing and Anti-Aliasing in BHT Prediction
FUTURE WORK • Attempt to reduce loss due to aliasing by passing hash information to processor from program • Determine program properties (pb, m) for which anti-aliasing will be effective Aliasing and Anti-Aliasing in BHT Prediction
fin Aliasing and Anti-Aliasing in BHT Prediction