Branch prediction for free

Many compilers rely on branch prediction to improve program performance by identifying frequently executed regions and by aiding in scheduling instructions.Profile-based predictors require a time-consuming and inconvenient compile-profile-compile cycle in order to make predictions. We present a program-based branch predictor that performs well for a large and diverse set of programs written in C and Fortran. In addition to using natural loop analysis to predict branches that control the iteration of loops, we focus on heuristics for predicting non-loop branches, which dominate the dynamic branch count of many programs. The heuristics are simple and require little program analysis, yet they are effective in terms of coverage and miss rate. Although program-based prediction does not equal the accuracy of profile-based prediction, we believe it reaches a sufficiently high level to be useful. Additional type and semantic information available to a compiler would enhance our heuristics.

[1]  David W. Wall,et al.  Predicting program behavior using real or estimated profiles , 2004, SIGP.

[2]  W. G. Morris,et al.  CCG: a prototype coagulating code generator , 1991, PLDI '91.

[3]  Richard L. Sites,et al.  Alpha Architecture Reference Manual , 1995 .

[4]  Eugene R. Speer APPENDIX A. Graphs , 1969 .

[5]  Joseph A. Fisher,et al.  Trace Scheduling: A Technique for Global Microcode Compaction , 1981, IEEE Transactions on Computers.

[6]  Robert B. Murray,et al.  Compiling for the CRISP Microprocessor , 1987, COMPCON.

[7]  Alexandru Nicolau,et al.  Parallel processing: a smart compiler and a dumb machine , 1984, SIGP.

[8]  Alan Jay Smith,et al.  Branch Prediction Strategies and Branch Target Buffer Design , 1995, Computer.

[9]  Susan L. Graham,et al.  An execution profiler for modular programs , 1983, Softw. Pract. Exp..

[10]  Karl Pettis,et al.  Profile guided code positioning , 1990, PLDI '90.

[11]  Alexandru Nicolau,et al.  Parallel processing: a smart compiler and a dumb machine , 1984, SIGPLAN '84.

[12]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[13]  David A. Patterson,et al.  Computer Architecture: A Quantitative Approach , 1969 .

[14]  Joseph A. Fisher,et al.  Predicting conditional branch directions from previous runs of a program , 1992, ASPLOS V.

[15]  Gerry Kane,et al.  MIPS RISC Architecture , 1987 .

[16]  James R. Larus,et al.  Optimally profiling and tracing programs , 1992, POPL '92.

[17]  S. McFarling,et al.  Reducing the cost of branches , 1986, ISCA '86.