# Study of Register Value Branch Predictor Based on CNN
## 1 Introduction  
Modern processors use techniques like pipelining, cache, superscalar, etc., to improve processor performance [1], and the techniques above require the continuous flow of instructions. In pipeline processors, the next instruction of the branch instructions needs to be fetched before executing. In order not to block the instruction flow, a branch predictor is required to judge which instruction is to be fetched. If the instruction is fetched incorrectly, the processor must waste about 14 to 25 clock cycles to recover the correct instruction flow [2]. Therefore, the branch predictor is a key structure in processor design that affects the performance of the processor.  
Branch predictors, developed from static predictors, have shared the latest TAGE predictor and its variants [3, 4, 5] for decades and are nearly perfect in predicting static branches. According to statistical results [6], today's state-of-the-art predictors achieve not less than 99% accuracy for 99% of static branch predictions on the SPEC 2017 benchmarks. In that situation, people have shifted their attention from overall prediction accuracy to those specific branches with low accuracy and high MPKI, which have deep impacts on programs. These branches are difficult for predictors which have the inputsof branch history and program counter to predict and have significant influence on program execution and have been called hard-to-predict (H2P) branches.  
Neural network branch predictors have been studied since the beginning of this century. In the last decade, the neural network has shown its power in the fields of image recognition, video processing, etc. Researchers have also begun to study branch prediction with machine learning and neural networks, which they regard as a binary classification problem. Through features such as stronger pattern recognition and deeper input history length, the neural network branch predictor shows similar or even higher prediction accuracy than the traditional predictor; for H2P branches, it can also dig deeper into the prediction information hidden in the branching history to improve prediction.  
In the proposed neural network branch predictor, the input is still the branch execution history. For some H2P branches, digging deeper into the branch execution history can learn their complex relationship between history and direction so that improving their prediction is achieved. However, for other H2P branches, their execution relies on other information, such as the value of specific registers or data in memory. This is what is not available from the branch history and is one of the reasons why all the current predictors can hardly give the right predictions. But, the neutral predictor's feature of offline training allows us to collect additional content from other parts of the processor and add it to the predictor's inputs. Through that process, the predictor will have the potential ability to improve the prediction of the aforementioned H2P branches. In this paper, we explore the impact of adding register values to CNN neural branch predictors for predicting H2P branch prediction.  
The contributions of this paper are the following: based on the previous BranchNet [7] neural network branch predictor, additional channels for processing register values are added, the network channel parameters are modified according to the need of analyzing register values, and its structure diagram is shown in Figure 1; trace files containing the register values are generated on the SPEC2017 benchmarks using Intel Pintool for training and tests; and finally, through experiments, the results are obtained and the effect of adding register values to branch prediction is analyzed.