Abstract:
As instruction windows become larger and pipelines become deeper in high-performance processors, the overhead caused by pipeline flushes and state recovery after branch mispredictions continues to increase. As a result, branch prediction accuracy has an increasingly significant impact on overall processor performance. For loop branches, the branch direction is mainly determined by the relationship between the past iteration count and the loop trip count, making it difficult for general-purpose history-based predictors to accurately identify loop exit boundaries. To address this problem, this paper proposes RALBP, a Runtime-Adaptive Loop Branch Predictor. To accurately track loop execution progress, RALBP adopts a decoupled update mechanism for the past iteration count and the loop trip count. Specifically, the past iteration count is speculatively updated at the prediction stage to ensure timeliness, while the loop trip count is trained at the commit stage using non-speculative execution information to achieve fast convergence. Meanwhile, RALBP uses a benefit register to track its runtime performance benefit and determine whether to use its predictions. In addition, RALBP introduces a new stride field to support loops whose trip counts change with a fixed stride. Experimental results on the XiangShan processor using SPEC CPU2006 and SPEC CPU2017 show that, compared with the loop predictor in TAGE-SC-L (tagged geometric history length predictor with a statistical corrector and a loop predictor), RALBP improves the geometric mean of IPC (instructions per cycle) by 0.52% and reduces MPKI (mispredictions per kilo instructions) by 6.58%. At the same time, the cell area of the entire BPU (branch prediction unit) increases by 0.5%, with no noticeable increase in power consumption.