A PPM-like, Tag-based Predictor.
Pierre Michaud · The journal of instruction-level parallelism · 2005
The predictor proposed is a tag-based, global-history predictor derived from PPM. It features five tables. Each table is indexed with a different history length. The prediction for a branch is given by the up-down saturating counter associated with the longest matching history. For this kind of predictor to work well, the update must be done carefully. We propose a new update method that improves the mispredict rate. We also propose a method for implementing hashing functions in hardware. 1 Overview The predictor proposed is a global-history predictor derived from the PPM. PPM was originally introduced for text compression [2], and it was used in [1] for branch prediction. Figure 1 shows a synopsis of the proposed predictor, which features 5 tables. It can be viewed as a 4th order approximation to PPM [6], while YAGS [3] can be viewed as a 1st order approximation. The leftmost table on Figure 1 is a bimodal predictor [4]. We refer to this table as table 0. It has 4k entries, and is indexed with the 12 least significant bits of the branch PC. Each entry of table 0 contains a 3-bit up-down saturating counter, and a bit m (m stands for meta-predictor) which function is described in Section 3. Table 0 uses a total of 4k × (3 + 1) = 16 Kbits of storage. The 4 other tables are indexed both with the branch PC and some global history bits : tables 1,2,3 and 4 are indexed respectively with the 10,20,40 and 80 most recent bits in the 80-bit global history, as indicated on Figure 1. When the number of global history bits exceeds the number of index bits, the global history is “folded” by a bit-wise XOR of groups of consecutive history bits, then it is XORed with the branch PC as in a gshare predictor [4]. For example, table 3 is indexed with 40 history bits, and the index may be implemented as pc[0 : 9] ⊕ h[0 : 9] ⊕ h[10 : 19] ⊕ h[20 : 29] ⊕ h[30 : 39] where ⊕ denotes the bit-wise XOR. Section 4 describes precisely the index functions that were used for the submission. Each of the tables 1 to 4 has 1k entries. Each entry contains a 8-bit tag, a 3-bit up-down saturating counter, and a bit u (u stands for “useful entry”, its function is described in Section 3), for a total of 12 bits per entry. So each of the tables 1 to 4 uses 1k × (3 + 8 + 1) = 12 Kbits. The total storage used by the predictor is 16k + 4 × 12k = 64 Kbits. 2 Obtaining a prediction At prediction time, the 5 tables are accessed simultaneously. While accessing the tables, a 8-bit tag is computed for each table 1 to 4. The hash function used to compute the 8-bit tag is different from the one used to index the table, but it takes as input the same PC and global history bits. Once the access is done, we obtain four 8-bits tags from tables 1 to 4, and 5 prediction bits from tables 0 to 4 (the prediction bit is the most significant bit of the 3-bit counter). We obtain a total of 4×8+5 = 37 bits. These 37 bits are then reduced to a 0/1 final prediction, which is obtained as the most significant bit of the