Branch prediction method, device, equipment and program product
By constructing a branch prediction model for multi-convolution neural network slices, using historical information and attention mechanism modules to extract branch features, the problem of low prediction accuracy of branch instructions in the existing technology is solved, and the accuracy of branch prediction is significantly improved Rate.
Patent Information
- Application Number
- CN202411288108.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-20
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-03
AI Technical Summary
When facing branch instructions with complex historical information, existing branch prediction technology has low prediction accuracy, resulting in reduced processor performance.
Multiple convolutional neural network slices are used to construct a branch prediction model, and multiple historical information collections are generated by inputting historical information of predicted branch instructions. The convolutional neural network and attention mechanism modules are used to extract branch features and predict jump directions.
The accuracy of branch prediction is improved, especially in branch scenarios with complex historical information, which significantly improves prediction accuracy compared with existing solutions.
Smart Images

Figure CN119065720A_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the China Patent Office on October 20, 2023, with application number 202311367044.3 and invention name “A high-performance intelligent branch prediction method”, all contents of which are incorporated by reference in this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a branch prediction method, device, equipment and program product. Background Art
[0003] Branch prediction technology means that when the processor processes a branch instruction, it does not wait for the branch instruction to be executed, but directly predicts the current branch jump direction and jump target. Using branch prediction technology can achieve an uninterrupted instruction flow. Branch prediction technology can effectively improve the speed of instruction execution, but it also brings certain hidden dangers. If the predicted direction is wrong, the processor extracts the wrong next instruction. In order to correct this error, the pipeline will discharge all instructions after this instruction and re-read the correct instruction, which will greatly reduce the performance of the processor.
[0004] In the field of branch prediction, there are already technical solutions for predicting branch jump directions through branch predictors and perceptrons, but these solutions have low prediction accuracy for branch instructions with more complex historical information. Summary of the invention
[0005] Based on the above technical problems, the present application proposes a branch prediction method, device, equipment and program product, which can improve the accuracy of branch prediction.
[0006] The first aspect of the present application provides a branch prediction method, comprising:
[0007] Inputting historical information of the predicted branch instruction into a pre-trained branch prediction model so that the branch prediction model predicts the jump direction of the predicted branch instruction;
[0008] Among them, the historical information of the predicted branch instruction includes the historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction; the branch prediction model includes multiple convolutional neural network slices, each of the convolutional neural network slices is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices.
[0009] In some implementations, inputting historical information of predicted branch instructions into a pre-trained branch prediction model includes:
[0010] Based on the historical information of the predicted branch instruction, generate a plurality of historical information sets; wherein the number of the historical information sets is equal to the number of the convolutional neural network slices, and the historical information sets include historical information of a specific length of the predicted branch instruction;
[0011] Each historical information set is input one-to-one into each convolutional neural network slice of the pre-trained branch prediction model.
[0012] In some implementations, the branch prediction model includes five convolutional neural network slices; based on the historical information of the predicted branch instruction, multiple historical information sets are generated, including:
[0013] Based on the history information of the predicted branch instruction, generating a first history information set, a second history information set, a third history information set, a fourth history information set and a fifth history information set;
[0014] The first history information set includes 10 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0015] The second history information set includes 20 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0016] The third history information set includes 30 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0017] The fourth history information set includes 50 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0018] The fifth history information set includes 200 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions.
[0019] In some implementations, the historical information of the predicted branch instruction includes the encoding matrix of the historical addresses of the branch path where the predicted branch instruction is located and the corresponding jump directions, and the encoding matrix includes the encoding of the historical addresses of the branch path where the predicted branch instruction is located and the corresponding jump directions.
[0020] In some implementations, the method further includes:
[0021] Binary encode each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction to obtain the code corresponding to each historical address;
[0022] The codes corresponding to the respective historical addresses of the branch path where the predicted branch instruction is located are concatenated to obtain the historical information of the predicted branch instruction.
[0023] In some implementations, the convolutional neural network slice includes a first convolutional layer, a first average pooling layer, a first fully connected layer, a second convolutional layer, a second average pooling layer, and an output layer, wherein the first convolutional layer includes an attention mechanism module;
[0024] The output layers of the multiple convolutional neural network slices are respectively connected to the second fully connected layer.
[0025] In some implementations, the number of input channels of the first convolution layer is 1, the number of output channels is 16, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the first average pooling layer is 2×2, and the step size is 1; the number of input channels of the second convolution layer is 16, the number of output channels is 4, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the second average pooling layer is 2×2, and the step size is 1.
[0026] In some implementations, the attention mechanism module includes an SE channel attention module.
[0027] In some implementations, the training process of the branch prediction model includes:
[0028] Extracting global history information of each branch path from the running process record of the test program in the setting database, wherein the global history information includes each historical address of the branch path and the jump direction corresponding to each historical address;
[0029] Performing encoding processing on each historical information pair in the global historical information to obtain historical information encodings corresponding to each historical information pair; wherein the historical information pair includes a historical address and a jump direction corresponding to the historical address;
[0030] Multiple historical information codes corresponding to the same branch path are concatenated to obtain a historical information code matrix;
[0031] The historical information encoding matrix is input into a pre-built branch prediction model, and jump direction prediction training is performed on the branch prediction model.
[0032] In some implementations, encoding the historical information pair includes:
[0033] Performing one-bit binary quantization on the jump direction in the historical information pair to obtain a jump direction code, and performing binary quantization on the historical address in the historical information pair to obtain a historical address code;
[0034] Shift the historical address code left by one position, and use the jump direction code to fill the empty position after the shift;
[0035] The numerical value corresponding to the last N bits of the padded historical address code is obtained as the historical information code of the historical information pair, where N is a positive integer.
[0036] A second aspect of the present application provides a branch prediction device, comprising:
[0037] A branch prediction unit, used for inputting historical information of predicted branch instructions into a pre-trained branch prediction model, so that the branch prediction model predicts the jump direction of the predicted branch instruction;
[0038] Among them, the historical information of the predicted branch instruction includes the historical address of the branch path where the predicted branch instruction is located; the branch prediction model includes multiple convolutional neural network slices, each of the convolutional neural network slices is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices.
[0039] A third aspect of the present application provides a branch prediction device, comprising:
[0040] Memory and processor;
[0041] The memory is connected to the processor and is used to store programs;
[0042] The processor is used to implement the above-mentioned branch prediction method by running the program in the memory.
[0043] A fourth aspect of the present application provides a computer program product, comprising computer program instructions, which, when executed by a processor, enable the processor to execute the above-mentioned branch prediction method.
[0044] The branch prediction method proposed in the present application processes the historical information of the predicted branch instruction through a pre-trained branch prediction model to predict the jump direction of the branch instruction. The branch prediction model includes multiple convolutional neural network slices, each of which is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices. Since the convolutional neural network has good processing performance in complex information processing, the above-mentioned branch prediction model can better mine the useful information scattered in the complex historical information of the predicted branch instruction through the convolutional neural network, thereby realizing accurate jump direction prediction. In addition, the multiple convolutional neural network slices of the above-mentioned branch prediction model can more comprehensively and effectively extract the branch features hidden in the historical information of the predicted branch instruction, and then predict the jump direction based on these branch features, which can further improve the accuracy of jump direction prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0046] Figure 1 A schematic diagram of the structure of a branch prediction model proposed in an embodiment of the present application.
[0047] Figure 2 A schematic diagram of the structure of another branch prediction model provided in an embodiment of the present application.
[0048] Figure 3 A schematic diagram of the structure of the SE module provided in an embodiment of the present application.
[0049] Figure 4 A schematic diagram of the historical information encoding results provided in an embodiment of the present application.
[0050] Figure 5 A schematic diagram of historical information encoding and historical information encoding splicing provided in an embodiment of the present application.
[0051] Figure 6 A schematic diagram of the structure of a branch prediction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0052] With the increasing demand for computer performance and the demand for high-performance hardware brought about by increasingly complex software, current processors need to speed up instruction processing. Among the current methods of accelerating instruction processing, pipelines and parallel instructions have been proven to be effective means. Among them, pipelines are one of the most effective means to improve the efficiency of processor instruction processing. In the current mainstream processor design, the processing efficiency of instructions is improved by continuously deepening the pipeline depth. However, as the pipeline depth continues to deepen, the risks brought by instruction hazard are also increasing.
[0053] Under the von Neumann storage instruction structure, the execution of instructions contains three types of hazards: structural hazards, data hazards, and control hazards. Control hazards are caused by branch instructions, which can interrupt the instruction flow during program execution, thus causing the program to be unable to continue execution.
[0054] Branch prediction technology means that when the processor processes a branch instruction, it does not wait for the branch instruction to be executed, but directly predicts the current branch jump direction and jump target. Using branch prediction technology can achieve an uninterrupted instruction flow. Branch prediction technology can effectively improve the speed of instruction execution, but it also brings certain hidden dangers. If the predicted direction is wrong, the processor extracts the wrong next instruction. In order to correct this error, the pipeline will discharge all instructions after this instruction and re-read the correct instruction, which will greatly reduce the performance of the processor.
[0055] The branch predictor uses branch history (BranchHistory) to predict the branch jump direction, including global history (Global History), path history (Path History) and local history (Local History). Global history refers to the historical jump direction of a branch and its related branches, 1 represents a jump and 0 represents no jump. Path history refers to the branch address that the current branch instruction has passed through recently, and the last 16 bits are usually intercepted as the virtual address. Local history is the earliest proposed branch feature, which contains the performance status of the current branch in the previous branch predictions. However, since the branch address does not take into account the correlation of the branch, it is usually used in combination with other branch features in modern branch predictors.
[0056] In the field of branch prediction, there have been relatively mature studies. The TAGE-SC-L branch predictor proposed by researchers won the championship of the 5th Branch Prediction Competition. The TAGE-SC-L branch predictor is composed of a base predictor (TAGE), a statistical correction component (SC), and a loop component (L). The TAGE branch predictor uses the global history of branch instructions for prediction. The main purpose of the loop component (Loop Predictor Component) is to identify loops with many iterations and improve the prediction accuracy of branch instructions with fixed loop times. The statistical correction component (Statistical Corrector Component) mainly records branch instructions whose branch characteristics are not obvious but have a strong jump tendency. Through the superposition of the three components, the TAGE-SC-L branch predictor achieves a high branch prediction accuracy. However, when faced with branches with noise in the history, such as branch instructions with more complex historical information, the prediction accuracy is not very high.
[0057] With the development of neural networks, especially the success of machine learning in pattern recognition and learning, researchers have applied machine learning to the field of branch prediction, using perceptrons as a model for branch prediction. By building a perceptron model, the jump direction of the current branch is obtained through the input branch history information. The branch predictor based on machine learning can well identify the key branch history information scattered in the history, and can improve the prediction accuracy for branches with more complex history information compared to the branch predictor. However, the accuracy improvement of complex branch prediction is limited, and there are still some cases where the prediction is inaccurate.
[0058] In response to the above technical problems, the inventors of the present application further explored a more accurate branch prediction solution.
[0059] With the development of Convolutional Neural Network (CNN), CNN has been proven to have better performance in pattern recognition than perceptron. Therefore, the inventor of the present application uses CNN for branch jump direction prediction with complex historical information, and proposes a new branch prediction scheme based on this idea. It has been verified that this scheme can improve the accuracy of branch prediction in branch prediction scenarios with complex historical information compared with existing schemes.
[0060] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0061] The branch prediction method proposed in the embodiment of the present application is applicable to an application scenario in which the jump direction of a predicted branch instruction is predicted based on the historical information of the predicted branch instruction. Specifically, it can be applied in an execution environment in which branch jump direction prediction is performed, such as by a computer that performs branch prediction tasks, or by a processor when performing branch prediction. For example, when a processor using an instruction pipeline mode performs branch prediction, it can be implemented by executing the branch prediction method proposed in the embodiment of the present application. The embodiment of the present application does not limit the specific execution environment and application scenario of the branch prediction method proposed in the present application. In the subsequent embodiments, the specific processing process of the branch prediction method will be mainly introduced.
[0062] The embodiment of the present application first proposes a branch prediction model, which is constructed based on a convolutional neural network (CNN).
[0063] See also Figure 1 As shown, the branch prediction model proposed in the embodiment of the present application includes multiple convolutional neural network slices, each convolutional neural network slice is a convolutional neural network structure, and the structures of each convolutional neural network slice are the same, and the parameters of each convolutional neural network slice can be the same or different. For example, each convolutional neural network slice can use the same network parameters, or some convolutional neural network slices can use the same network parameters while other convolutional neural network slices use different network parameters, or each convolutional neural network slice can use different network parameters.
[0064] Each convolutional neural network slice is used to predict the jump direction of a branch instruction. That is to say, each convolutional neural network slice can input the historical information of the predicted branch instruction, and based on the historical information of the predicted branch instruction, predict the jump direction of the predicted branch instruction to obtain a jump direction prediction result.
[0065] The final jump direction predicted by the predicted branch instruction is determined by the jump direction prediction results output by each convolutional neural network slice. The outputs of each convolutional neural network slice are connected by a fully connected layer, which selects the output results with high confidence from each slice as the final jump direction.
[0066] In some embodiments, see Figure 2As shown, the above-mentioned convolutional neural network slices include, from front to back, the first convolutional layer, the first average pooling layer, the first fully connected layer, the second convolutional layer, the second average pooling layer and the output layer. The output layers of the multiple convolutional neural network slices are respectively connected to the second fully connected layer, and the second fully connected layer summarizes the outputs of each convolutional neural network slice and outputs the final jump direction prediction result. For example, the output of each convolutional neural network slice includes 2 neurons, corresponding to the two situations of jump and no jump. The second fully connected layer is used to determine which slice's output result has a higher confidence, and then select the slice output result with the highest confidence to obtain the final branch prediction result.
[0067] Among them, the number of input channels of the first convolution layer is 1, the number of output channels is 16, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the first average pooling layer is 2×2, and the step size is 1; the number of input channels of the second convolution layer is 16, the number of output channels is 4, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the second average pooling layer is 2×2, and the step size is 1.
[0068] In addition, if Figure 2 As shown, the embodiment of the present application also sets an attention mechanism module in the first convolution layer of each convolutional neural network slice. The attention mechanism module assigns different weights to the data of each channel output by the first convolution layer, so that the model is able to judge which channel represents more important features, and there is no need to make major changes to the original convolution layer.
[0069] The attention mechanism module can be implemented by any module that can implement the attention mechanism (Attention Mechanism), and the embodiment of the present application does not limit the specific structure of the above-mentioned attention mechanism module. Squeeze-and-Excitation (SE) is a channel attention model that enhances the attention to important channels by adjusting the weights of each channel, thereby improving the expressiveness of the model. Experiments show that SE can achieve better performance in tasks such as image classification, object detection, and segmentation. Therefore, the attention mechanism module added in each convolutional neural network slice in the embodiment of the present application is implemented in the manner of the above-mentioned SE module.
[0070] like Figure 3As shown in the figure, after the input data X is input to the first convolutional layer for processing, the first convolutional layer outputs 16 channels of 1×99 data. After entering the attention mechanism module, the data is first globally pooled, and the 799 values on each channel are added to obtain the weight of the current channel. Then it enters a fully connected layer. At this time, the division by r is to reduce the amount of calculation of the fully connected layer. In the actual design, r is taken as 4 to balance the results of accuracy and calculation. Then after being processed by the ReLU activation function, it is input to the second fully connected layer. At this time, the weights of the 16 channels are restored, and then normalized by the Sigmoid function, so that 16 weights between 0 and 1 are obtained. Finally, the values of these 16 weights are multiplied by the 799 values of the 16 corresponding channels to obtain the final output X′ of the first convolutional layer.
[0071] In other embodiments, the branch prediction model includes 5 convolutional neural network slices, and the 5 convolutional neural network slices are configured to process history information of different lengths, that is, the 5 convolutional neural network slices are respectively used to receive history information of different lengths of the predicted branch instructions, for example, the 5 convolutional neural network slices respectively receive history information of 10, 20, 30, 50, and 200 lengths from the predicted branch instructions. Through the above configuration, when the 5 convolutional neural network slices perform branch prediction at the same time, the jump direction of the predicted branch can be predicted by different convolutional neural network slices with the help of history information of different lengths, and finally the output results of each convolutional neural network slice are integrated, so that in the process of branch prediction, the branch information appearing at a farther position can be considered while taking into account the intervals where the branch information at a closer position appears frequently, so that useful information can be more comprehensively mined from the data of different intervals to improve the accuracy of branch prediction.
[0072] After the branch prediction model is constructed through the above-mentioned embodiment, the embodiment of the present application predicts the branch prediction model through the following processing methods of steps A1-A4:
[0073] A1. Extract the global history information of each branch path from the running process record of the test program in the setting database.
[0074] Specifically, the embodiment of the present application uses SPEC CPU2006 as a database, obtains the running process record trace of each test program in the database through the PinTool tool, and uses a script to extract the global history information of each branch path in the running process record of the test program. Among them, the global history information includes two data types, namely PC and history. PC represents the address of the branch instruction, that is, the historical address where the current branch address appears in the global history, and history represents all the historical information of the program, saves all the branch instruction information of the currently executed program, and records the address of each branch instruction and the corresponding jump direction.
[0075] Furthermore, in an embodiment of the present application, the trace of each test program is also used to perform branch prediction using a branch predictor to obtain the prediction accuracy of each branch instruction, and then branches with a prediction accuracy of less than 95% are defined as complex branches. These complex branches are usually branches that contain a large amount of historical information, or branches whose jump directions can only be accurately predicted by processing a large amount of historical information. Since the branch predictor has a low prediction accuracy for these branches, the embodiment of the present application uses the historical information of these branches to train the branch prediction model, so that the trained branch prediction model can achieve accurate prediction of these types of branches. Therefore, in this embodiment, the global historical information of each branch path is extracted from the running process record of the test program in the set database, specifically the global historical information of each complex branch is extracted.
[0076] A2. Perform encoding processing on each historical information pair in the global historical information to obtain historical information codes corresponding to each historical information pair.
[0077] Specifically, the embodiment of the present application represents the global history information of the branch path in the form of a history information pair (PC, direction), wherein PC represents the history address of the branch path, and direction represents the jump direction corresponding to PC.
[0078] Since PC can take many different values in a computer, in order to enable the PC in each historical information pair to be processed by the branch prediction model, the embodiment of the present application encodes each historical information pair to obtain the historical information encoding corresponding to each historical information pair.
[0079] Exemplarily, the embodiment of the present application performs one-bit binary quantization on the jump direction direction in the historical information pair, that is, a binary number is used to represent the jump direction, such as 0 for no jump and 1 for jump, to obtain the jump direction code. At the same time, the historical address PC in the historical information pair is binary quantized, that is, the address code is represented in binary to obtain the historical address code.
[0080] Then, the historical address code is shifted left by one position, and the jump direction code is used to fill the shifted empty position. That is, the historical address code is shifted left by one position as a whole, and a vacancy appears at the last position, and then the jump direction code is filled in the vacancy.
[0081] Finally, the value corresponding to the last N bits of the padded historical address code is obtained as the historical information code of the historical information pair, where N is a positive integer.
[0082] In this embodiment, the decimal value corresponding to the last 8 bits of the padded historical address code is extracted as the historical information code of the historical information pair.
[0083] Exemplarily, the encoding of historical information pairs can be achieved by the following formula:
[0084] (PC<<1+dir)&(2 k -1)
[0085] Among them, PC represents the binary encoding of the last 8 bits of the historical address in the historical information pair, PC<<1 means shifting the binary encoding of the last 8 bits of the historical address one bit to the left, dir represents the encoding of the jump direction in the historical information pair, k is 8, (PC<<1+dir)&(2 k -1) can convert the binary code of (PC<<1+dir) into a decimal value.
[0086] like Figure 4 As shown in , according to the encoding method of the above embodiment of the present application, for the branch path recorded in the program counter, the historical information encoding corresponding to each historical information pair can be calculated respectively. For example, 40062a represents the historical address, and its corresponding jump direction is "jump". The historical information encoding of the historical information pair obtained by the above embodiment is 85, and the corresponding binary encoding is 01010101.
[0087] A3. Concatenate multiple historical information codes corresponding to the same branch path to obtain a historical information code matrix.
[0088] Specifically, since a branch path includes multiple historical addresses, and the prediction of branch instructions also requires information of multiple historical addresses, the embodiment of the present application will splice multiple historical information codes corresponding to the same branch path to obtain a historical information code matrix.
[0089] like Figure 5 As shown, the historical position indicates the position where the current branch occurs, 200 represents the branch instruction on the current branch, in the jump direction, T represents jump, NT represents no jump, and the numerical value represents the historical information encoding obtained after encoding according to the above embodiment. Figure 5 The matrix on the right in the middle shows the historical information encoding matrix obtained after splicing.
[0090] A4. Input the historical information encoding matrix into a pre-built branch prediction model, and perform jump direction prediction training on the branch prediction model.
[0091] Specifically, for each convolutional neural network slice in the branch prediction model, historical information of a specific length is extracted from the running process record of the test program to obtain corresponding historical information pairs, and the historical information pairs are processed by performing the above steps A1-A3 to obtain a historical information encoding matrix. The historical information encoding matrix is input into each convolutional neural network slice of the branch prediction model, so that each convolutional neural network slice is trained for jump direction prediction.
[0092] During the training process, the second fully connected layer of the branch prediction model determines which slice's output result has the highest credibility based on the output of each convolutional neural network slice, and uses the output result of the slice as the final jump direction prediction result.
[0093] The loss function between the prediction result and the jump direction label is used to optimize the parameters of each convolutional neural network slice of the branch prediction model, making the prediction result of the branch prediction model more and more accurate.
[0094] The branch prediction model trained as above can be used to predict the jump direction of any predicted branch instruction, and is particularly suitable for predicting the jump direction of branch instructions with complex historical information.
[0095] Based on the branch prediction model constructed and trained in the above-mentioned embodiments, the branch prediction method proposed in the embodiments of the present application inputs the historical information of the predicted branch instruction into the pre-trained branch prediction model when predicting the jump direction of the predicted branch instruction, so that the branch prediction model predicts the jump direction of the predicted branch instruction.
[0096] The historical information of the predicted branch instruction includes the historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction, that is, the PC of the branch path where the predicted branch instruction is located and the corresponding direction.
[0097] In some embodiments, since the branch prediction model includes multiple convolutional neural network branches, the historical information of the predicted branch instructions is grouped and the inputs corresponding to each convolutional neural network branch are generated respectively.
[0098] Specifically, based on the history information of the predicted branch instruction, multiple history information sets are generated; wherein the number of the history information sets is equal to the number of the convolutional neural network slices, and the history information sets include history information of a specific length of the predicted branch instruction. That is, the length of the history information in the history information set corresponding to each convolutional neural network slice is equal to the processable length of the history information set for the convolutional neural network slice.
[0099] Then, each historical information set can be input one-to-one into each convolutional neural network slice of the pre-trained branch prediction model, so that each convolutional neural network slice performs the jump direction prediction task.
[0100] In some embodiments, it is specifically disclosed that the branch prediction model includes 5 convolutional neural network slices, and the processable historical information lengths are set to 10, 20, 30, 50, and 200 respectively.
[0101] Based on the above configuration, when multiple historical information sets are generated based on the historical information of the predicted branch instruction, it specifically includes:
[0102] Based on the history information of the predicted branch instruction, generating a first history information set, a second history information set, a third history information set, a fourth history information set and a fifth history information set;
[0103] The first history information set includes 10 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0104] The second history information set includes 20 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0105] The third history information set includes 30 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0106] The fourth history information set includes 50 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0107] The fifth history information set includes 200 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions.
[0108] That is, through the above processing, among the first 200 historical addresses of the predicted branch instructions, starting from the address of the predicted branch instruction, 10, 20, 30, 50, and 200 historical addresses and their corresponding jump direction information are extracted forward respectively, and 5 historical information sets are obtained. These 5 historical information sets can be used to input 5 convolutional neural network slices for jump direction prediction respectively.
[0109] It is also disclosed in another embodiment that, in order to facilitate the branch prediction model to process the historical information of the predicted branch instruction, the historical information of the predicted branch instruction is encoded according to the encoding method introduced in the above embodiment, and the encoding matrix of each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction is obtained, and the encoding matrix is input into the branch prediction model.
[0110] That is to say, in the above embodiment, the historical information of the predicted branch instructions input to each convolutional neural network slice of the branch prediction model is specifically in the form of a coding matrix of each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction.
[0111] The above encoding matrix is obtained in the same manner as the encoding and concatenation manner described in the above embodiment. The final encoding matrix is as follows: Figure 5 The matrix form shown on the right.
[0112] Exemplarily, when encoding the historical information of the predicted branch instruction, firstly, binary code each historical address and corresponding jump direction of the branch path where the predicted branch instruction is located to obtain the code corresponding to each historical address. Then, concatenate the codes corresponding to each historical address of the branch path where the predicted branch instruction is located to obtain a coding matrix as the historical information of the predicted branch instruction.
[0113] Specifically, according to the processing method shown in steps A2 and A3 in the above embodiment, each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction (historical information pair) are encoded, and the encoding results are spliced to obtain the encoding matrix of the historical information of the predicted branch instruction.
[0114] From the above introduction, it can be seen that the branch prediction method proposed in the embodiment of the present application processes the historical information of the predicted branch instruction through a pre-trained branch prediction model to predict the jump direction of the branch instruction. The branch prediction model includes multiple convolutional neural network slices, each of which is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices. Since the convolutional neural network has good processing performance in complex information processing, the above-mentioned branch prediction model can better mine useful information scattered in the complex historical information of the predicted branch instruction through the convolutional neural network, thereby realizing accurate jump direction prediction. In addition, the multiple convolutional neural network slices of the above-mentioned branch prediction model can more comprehensively and effectively extract the branch features hidden in the historical information of the predicted branch instruction, and then predict the jump direction based on these branch features, which can further improve the accuracy of the jump direction prediction.
[0115] The embodiment of the present application tests the prediction accuracy of the above-mentioned branch prediction method through experiments. During the experiment, 15 benchmark test program sets in the SEPC CPU2006 test set were selected as test programs, and branch prediction tests were performed using the TAGE_SC_L branch predictor and the branch prediction method introduced in the above embodiment of the present application. Test data shows that for complex branches, the prediction accuracy of the TAGE_SC_L branch predictor reaches 85.45%. The branch prediction model introduced in the above embodiment of the present application performs well in the bzip2, gobmk, mcf, and soplex benchmark test programs, which are decompression and compression programs, artificial intelligence go programs, combinatorial optimization programs, and linear programming programs, respectively. The branch prediction accuracy rates are increased by 4.66%, 12.27%, 3.18%, and 3.17, respectively, and the average accuracy rate reaches 86.46%, which is 1.01% higher than the most advanced branch predictor TAGE_SCL.
[0116] Corresponding to the above-mentioned branch prediction method, an embodiment of the present application further provides a branch prediction device, which includes:
[0117] A branch prediction unit, used for inputting historical information of predicted branch instructions into a pre-trained branch prediction model, so that the branch prediction model predicts the jump direction of the predicted branch instruction;
[0118] Among them, the historical information of the predicted branch instruction includes the historical address of the branch path where the predicted branch instruction is located; the branch prediction model includes multiple convolutional neural network slices, each of the convolutional neural network slices is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices.
[0119] In some implementations, inputting historical information of predicted branch instructions into a pre-trained branch prediction model includes:
[0120] Based on the historical information of the predicted branch instruction, generate a plurality of historical information sets; wherein the number of the historical information sets is equal to the number of the convolutional neural network slices, and the historical information sets include historical information of a specific length of the predicted branch instruction;
[0121] Each historical information set is input one-to-one into each convolutional neural network slice of the pre-trained branch prediction model.
[0122] In some implementations, the branch prediction model includes five convolutional neural network slices; based on the historical information of the predicted branch instruction, multiple historical information sets are generated, including:
[0123] Based on the history information of the predicted branch instruction, generating a first history information set, a second history information set, a third history information set, a fourth history information set and a fifth history information set;
[0124] The first history information set includes 10 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0125] The second history information set includes 20 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0126] The third history information set includes 30 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0127] The fourth history information set includes 50 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions;
[0128] The fifth history information set includes 200 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions.
[0129] In some implementations, the historical information of the predicted branch instruction includes the encoding matrix of the historical addresses of the branch path where the predicted branch instruction is located and the corresponding jump directions, and the encoding matrix includes the encoding of the historical addresses of the branch path where the predicted branch instruction is located and the corresponding jump directions.
[0130] In some implementations, the branch prediction unit is further configured to:
[0131] Binary encode each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction to obtain the code corresponding to each historical address;
[0132] The codes corresponding to the respective historical addresses of the branch path where the predicted branch instruction is located are concatenated to obtain the historical information of the predicted branch instruction.
[0133] In some implementations, the convolutional neural network slice includes a first convolutional layer, a first average pooling layer, a first fully connected layer, a second convolutional layer, a second average pooling layer, and an output layer, wherein the first convolutional layer includes an attention mechanism module;
[0134] The output layers of the multiple convolutional neural network slices are respectively connected to the second fully connected layer.
[0135] In some implementations, the number of input channels of the first convolution layer is 1, the number of output channels is 16, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the first average pooling layer is 2×2, and the step size is 1; the number of input channels of the second convolution layer is 16, the number of output channels is 4, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the second average pooling layer is 2×2, and the step size is 1.
[0136] In some implementations, the attention mechanism module includes an SE channel attention module.
[0137] In some implementations, the training process of the branch prediction model includes:
[0138] Extracting global history information of each branch path from the running process record of the test program in the setting database, wherein the global history information includes each historical address of the branch path and the jump direction corresponding to each historical address;
[0139] Performing encoding processing on each historical information pair in the global historical information to obtain historical information encodings corresponding to each historical information pair; wherein the historical information pair includes a historical address and a jump direction corresponding to the historical address;
[0140] Multiple historical information codes corresponding to the same branch path are concatenated to obtain a historical information code matrix;
[0141] The historical information encoding matrix is input into a pre-built branch prediction model, and jump direction prediction training is performed on the branch prediction model.
[0142] In some implementations, encoding the historical information pair includes:
[0143] Performing one-bit binary quantization on the jump direction in the historical information pair to obtain a jump direction code, and performing binary quantization on the historical address in the historical information pair to obtain a historical address code;
[0144] Shift the historical address code left by one position, and use the jump direction code to fill the empty position after the shift;
[0145] The numerical value corresponding to the last N bits of the padded historical address code is obtained as the historical information code of the historical information pair, where N is a positive integer.
[0146] The branch prediction device provided in this embodiment belongs to the same application concept as the branch prediction method provided in the above embodiments of this application, and can execute the branch prediction method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the specific processing content of the branch prediction method provided in the above embodiments of this application, and will not be repeated here.
[0147] The functions implemented by the above branch prediction units can be implemented by the same or different processors respectively, and the embodiments of the present application are not limited thereto.
[0148] It should be understood that the units in the above devices can be implemented in the form of a processor calling software. For example, the device includes a processor, the processor is connected to a memory, and instructions are stored in the memory. The processor calls the instructions stored in the memory to implement any of the above methods or realize the functions of each unit of the device, wherein the processor can be a general-purpose processor, such as a CPU or a microprocessor, etc., and the memory can be a memory in the device or a memory outside the device. Alternatively, the units in the device can be implemented in the form of hardware circuits, and the functions of some or all units can be realized by designing the hardware circuits. The hardware circuit can be understood as one or more processors; for example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above units are realized by designing the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be implemented by PLD, taking FPGA as an example, which can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured by the configuration file, so as to realize the functions of some or all of the above units. All units of the above devices can be implemented in the form of a processor calling software, or in the form of hardware circuits, or in part by a processor calling software, and the remaining part is implemented in the form of hardware circuits.
[0149] In an embodiment of the present application, a processor is a circuit with the ability to process signals. In one implementation, the processor may be a circuit with the ability to read and run instructions, such as a CPU, a microprocessor, a GPU, or a DSP; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit is fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, DPU, etc.
[0150] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.
[0151] In addition, all or part of the units in the above device can be integrated together, or can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a SOC. The SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device. The type of the at least one processor may be different, for example, including a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.
[0152] Another embodiment of the present application further provides a branch prediction device, see Figure 6 As shown, the device includes:
[0153] Memory 200 and processor 210;
[0154] The memory 200 is connected to the processor 210 and is used to store programs;
[0155] The processor 210 is used to implement the branch prediction method disclosed in any of the above embodiments by running the program stored in the memory 200.
[0156] Specifically, the branch prediction device may further include: a bus, a communication interface 220 , an input device 230 and an output device 240 .
[0157] The processor 210, the memory 200, the communication interface 220, the input device 230 and the output device 240 are connected to each other via a bus.
[0158] A bus may include a pathway that transfers information between components of a computer system.
[0159] The processor 210 may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the scheme of the present invention. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0160] The processor 210 may include a main processor, and may also include a baseband chip, a modem, and the like.
[0161] The memory 200 stores a program for executing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes a computer operation instruction. More specifically, the memory 200 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.
[0162] The input device 230 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.
[0163] Output device 240 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0164] The communication interface 220 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0165] The processor 210 executes the program stored in the memory 200 and calls other devices, which can be used to implement each step of any branch prediction method provided in the above embodiments of the present application.
[0166] An embodiment of the present application also proposes a chip, which includes a processor and a data interface. The processor reads and runs a program stored in a memory through the data interface to execute the branch prediction method introduced in any of the above embodiments. The specific processing process and its beneficial effects can be found in the above-mentioned branch prediction method embodiment introduction.
[0167] In addition to the above methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the branch prediction method described in any of the above embodiments of this specification.
[0168] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0169] In addition, an embodiment of the present application may also be a storage medium on which a computer program is stored, and the computer program is executed by a processor to execute the steps of the branch prediction method described in any of the above embodiments of this specification.
[0170] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0171] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0172] The steps in the methods of each embodiment of the present application can be adjusted in order, combined and deleted according to actual needs, and the technical features recorded in each embodiment can be replaced or combined.
[0173] The modules and sub-modules in the devices and terminals of the various embodiments of the present application can be combined, divided and deleted according to actual needs.
[0174] In the several embodiments provided in the present application, it should be understood that the disclosed terminals, devices and methods can be implemented in other ways. For example, the terminal embodiments described above are only schematic, for example, the division of modules or submodules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0175] The modules or submodules described as separate components may or may not be physically separated, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place, or they may be distributed on multiple network modules or submodules. Some or all of the modules or submodules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0176] In addition, each functional module or submodule in each embodiment of the present application may be integrated into one processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into one module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or in the form of software functional modules or submodules.
[0177] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0178] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly by hardware, software units executed by a processor, or a combination of the two. The software units may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0179] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0180] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A branch prediction method, characterized in that: include: Inputting historical information of the predicted branch instruction into a pre-trained branch prediction model so that the branch prediction model predicts the jump direction of the predicted branch instruction; Among them, the historical information of the predicted branch instruction includes the historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction; the branch prediction model includes multiple convolutional neural network slices, each of the convolutional neural network slices is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices.
2. The method according to claim 1, characterized in that The historical information of the predicted branch instructions is input into the pre-trained branch prediction model, including: Based on the historical information of the predicted branch instruction, generate a plurality of historical information sets; wherein the number of the historical information sets is equal to the number of the convolutional neural network slices, and the historical information sets include historical information of a specific length of the predicted branch instruction; Each historical information set is input one-to-one into each convolutional neural network slice of the pre-trained branch prediction model.
3. The method according to claim 2, characterized in that The branch prediction model includes 5 convolutional neural network slices; Based on the historical information of the predicted branch instruction, multiple historical information sets are generated, including: Based on the history information of the predicted branch instruction, generating a first history information set, a second history information set, a third history information set, a fourth history information set and a fifth history information set; The first history information set includes 10 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions; The second history information set includes 20 consecutive history addresses extracted from the address of the predicted branch instruction and along the branch path where the predicted branch instruction is located, and the corresponding jump directions; The third history information set includes 30 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions; The fourth history information set includes 50 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions; The fifth history information set includes 200 consecutive history addresses extracted from the address of the predicted branch instruction and forward along the branch path where the predicted branch instruction is located, and the corresponding jump directions.
4. The method according to claim 1, characterized in that: The historical information of the predicted branch instruction includes the encoding matrix of each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction, and the encoding matrix includes the encoding of each historical address of the branch path where the predicted branch instruction is located and the corresponding jump direction.
5. The method according to any one of claims 1 to 4, characterized in that: The convolutional neural network slice includes a first convolutional layer, a first average pooling layer, a first fully connected layer, a second convolutional layer, a second average pooling layer and an output layer, wherein the first convolutional layer includes an attention mechanism module; The output layers of the multiple convolutional neural network slices are respectively connected to the second fully connected layer.
6. The method according to claim 5, characterized in that The number of input channels of the first convolution layer is 1, the number of output channels is 16, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the first average pooling layer is 2×2, and the step size is 1; the number of input channels of the second convolution layer is 16, the number of output channels is 4, the convolution kernel size is 3×3, and the step size is 1; the pooling kernel size of the second average pooling layer is 2×2, and the step size is 1.
7. The method according to any one of claims 1 to 4, characterized in that The training process of the branch prediction model includes: Extracting global history information of each branch path from the running process record of the test program in the setting database, wherein the global history information includes each historical address of the branch path and the jump direction corresponding to each historical address; Performing encoding processing on each historical information pair in the global historical information to obtain historical information encodings corresponding to each historical information pair; wherein the historical information pair includes a historical address and a jump direction corresponding to the historical address; Multiple historical information codes corresponding to the same branch path are concatenated to obtain a historical information code matrix; The historical information encoding matrix is input into a pre-built branch prediction model, and jump direction prediction training is performed on the branch prediction model.
8. A branch prediction device, characterized in that: include: A branch prediction unit, used for inputting historical information of predicted branch instructions into a pre-trained branch prediction model, so that the branch prediction model predicts the jump direction of the predicted branch instruction; Among them, the historical information of the predicted branch instruction includes the historical address of the branch path where the predicted branch instruction is located; the branch prediction model includes multiple convolutional neural network slices, each of the convolutional neural network slices is used to predict the jump direction of the branch instruction, and the jump direction of the predicted branch instruction is determined based on the jump direction predicted by each of the convolutional neural network slices.
9. A branch prediction device, characterized in that: include: Memory and processor; The memory is connected to the processor and is used to store programs; The processor is used to implement the branch prediction method according to any one of claims 1 to 7 by running the program in the memory.
10. A computer program product, characterized in that The method comprises computer program instructions, which, when executed by a processor, cause the processor to perform the branch prediction method according to any one of claims 1 to 7.
