The Effects of Predicated Execution on Branch Prediction

The Effects of Predicated Execution on Branch Prediction

The Effects of Predicated Execution on Branch Prediction Gary Scott Tyson Department of Computer Science University of California, Davis Davis, CA 95616 [email protected] Abstract of the problem can be eliminated if conditional branches can either be correctly predicted or removed entirely. High performance architectures have always had to This paper will focus on two techniques to achieve this deal with the performance-limiting impact of branch goal, Branch Prediction and Predication. operations. Microprocessor designs are going to have to Branch prediction eliminates much of the branch deal with this problem as well, as they move towards delay by predicting the direction the branch will take deeper pipelines and support for multiple instruction before the actual direction is known, and continuing issue. Branch prediction schemes are often used to allevi- instruction fetch along that instruction pathway. This has ate the negative impact of branch operations by allowing been an active area of research for many years, and con- the speculative execution of instructions after an tinues to be to this day [Smit81] [LeS84] [FiFr92] unresolved branch. Another technique is to eliminate [YeP93]. There are two main approaches to branch pred- branch instructions altogether. Predication can remove iction - static schemes, which predict at compile time, and forward branch instructions by translating the instructions dynamic schemes, which use hardware to try to capture following the branch into predicate form. the dynamic behavior of branches. In either case, if the This paper analyzes a variety of existing predica- branch is predicted incorrectly, there is a penalty that tion models for eliminating branch operations, and the must be paid to undo the incorrect prediction and proceed effect that this elimination has on the branch prediction down the proper path. (the misprediction penalty). schemes in existing processors, including single issue Predication, on the other hand, is a technique for architectures with simple prediction mechanisms, to the completely removing conditional branches from the newer multi-issue designs with correspondingly more instruction stream via the conditional execution (or com- sophisticated branch predictors. The effect on branch pletion) of individual instructions based on the result of a prediction accuracy, branch penalty and basic block size boolean condition. This is a much more recent area of is studied. research [CMCW91, DeHB89] although vector machines like the CRAY [Russ78] have long supported a type of Keywords: High-performance, Predication, Branch predicated execution with their vector masks. This is a Prediction, HP-RISC, Alpha, ATOM, Pentuim, PowerPC very promising area of research because, in addition to removing the branch itself from instruction stream, it pro- 1. Introduction and Background vides the additional bene®t of improving scheduling capa- All architectures that support some degree of bility. instruction level parallelism must deal with the Branch Prediction and Predication can be used performance-limiting effects of changes in control ¯ow together in a complimentary fashion to minimize perfor- (branches). This is certainly not a new problem -- pipe- mance impacts of branches. For example, the number of lined processors have been struggling with this problem cycles lost due to incorrectly predicted branches can be for decades, and with the advent of multiple-issue archi- reduced if the number of instructions that are tagged with tectures the problem has become even more critical. Most a false predicate is smaller than the branch misprediction ¡¢¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡ penalty itself. In addition, overall dynamic branch predic- This work was supported by National Science Foundation tion accuracy may improve, if the branches removed by Grants CCR-8706722 and CCR-90-11535. predication are some of the least predictable branches. ¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤¥¤ This paper will examine the effect of augmenting branch prediction schemes found in a number of existing processors with the ability to do predicated execution. The focus will be on how predication affects the accuracy and branch penalty of the branch prediction schemes and the increase in basic block size. Different predication models will also be examined to determine their effective- ness in removing branches. Emphasis will be placed on whether the newer architectural designs, with their more When a branch is encountered, the BTB is searched (by accurate predictors, will show the same degree of branch address) in an attempt to locate the target address improvement from removing short forward branches. of the branch. If an entry is found corresponding to the Section 2 presents the different branch prediction tech- branch address, the branch is predicted taken from that niques we studied, which is followed by a description of address; otherwise it is predicted not taken and instruc- various predication schemes, an analysis of the effects of tion ¯ow continues sequentially. predication on branch prediction, branch penalty and Once the branch outcome has been determined, the basic block size, and a conclusion. branch history table is updated. If the resulting history table value will predict taken on the next execution of the 2. Branch Prediction Schemes branch, then the branch address is added to the BTB. If Branch prediction schemes range in accuracy (and the history table value predicts not taken, then the branch complexity) from simple static techniques exhibiting address is removed from the BTB (if it currently resides moderate accuracy (≈ 60%) to sophisticated dynamic there). prediction methods that achieve prediction accuracies of The ®nal branch prediction strategy modeled is the over 97%. In this study, seven approaches are modeled - two level adaptive strategy developed by Yeh and Patt ®ve used in existing commercially available products, and [YeP91]. This strategy requires considerably more two others included for the sake of completeness. Each hardware resources than the other methods, but provides approach has an associated branch misprediction penalty, greater branch prediction performance than any of the indicating the number of cycles lost when a branch is other methods. incorrectly predicted. This scheme features a set of branch history regis- The simplest of schemes predicts that all branches ters in addition to a branch history pattern table. When a will be taken - thus the processor will always attempt to branch instruction is executed, the lower bits of the fetch instructions from the target of the branch. branch address are used to index into the set of history The Hewlett Packard Precision RISC Architecture registers. Each history register (implemented as a shift (PA-RISC) [AADM93] uses a static prediction method register) contains information about the branch history of for calculating the direction of instruction ¯ow across those branches that map into that register. This informa- branches termed Branch Backward. In this scheme, all tion is then used to index into the branch history pattern forward branches are predicted not to be taken and all table, which contains the information necessary to deter- backward branches are predicted to be taken. This mine the actual branch prediction. scheme performs better than branch always when applica- In the model used in this study the branch history tions contain forward branches that are not taken more register ®le contains 512 13-bit entries (which limits the often than they are taken. branch history pattern table to 8192 entries) and each The Alpha processor [McLe93, Site92] supports branch history pattern table entry is a 2 bit history three different prediction methods: opcode speci®ed hints, counter. a branch backward strategy, and a one bit branch history table. While a given implementation of the Alpha archi- 3. Predicated Execution Models tecture may use any or all of these methods, in this study As mentioned in the introduction, predicated execu- only the last two were modeled. The branch backward tion refers to the conditional execution (or completion) of strategy used in the Alpha operates the same way as in the instructions based on the result of a boolean condition. HP-RISC. The one-bit branch history table approach Several different approaches to providing predicated exe- used in the Alpha features a direct mapped, 2048 entry, cution have been proposed and implemented. They fall single bit history table. In this scheme, the low order bits into two broad categories referred to as restricted and of the address of a branch instruction are used to select a unrestricted. one bit entry in the history table, which is in turn used to In the restricted model a limited number of new predict the branch direction. The entry is later updated to predicate instructions are introduced which are used to re¯ect the actual condition of the branch. explicitly delay the effect of executing a statement on The prediction approach used by the Pentium pro- program variables. This is achieved by moving the state- cessor [AlAv93] features a 256 entry Branch Target ment in question up to before the branch, modifying it to Buffer (BTB). Each BTB entry contains the target write to a free register instead of a program variable, and address of the branch and a two bit counter used to store then using one of the special predicate operations to con- previous branch activity

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us