Search

CN-122019170-A - High throughput prediction method and device supporting parallel prediction of multiple dynamic branches

CN122019170ACN 122019170 ACN122019170 ACN 122019170ACN-122019170-A

Abstract

A high throughput prediction method and device supporting multiple dynamic branch parallel prediction comprises the steps of obtaining branch information of a first branch instruction and at least one second branch instruction in a target prediction period, enabling an execution sequence of the second branch instruction to be located behind the first branch instruction, selecting a historical context snapshot when predicting the first branch instruction, determining a prediction result of the first branch instruction according to the historical context snapshot and the branch information of the first branch instruction, and determining the prediction result of the second branch instruction according to the historical context snapshot used when predicting the first branch instruction and the branch information of the second branch instruction when predicting the second branch instruction. The methods herein enable prediction and training of subsequent branches to be performed on a historical basis consistent with the first branch, thereby supporting processor implementations of higher throughput parallel prediction and consistent training updates.

Inventors

  • CHEN YULONG

Assignees

  • 成都群芯微电子科技有限公司

Dates

Publication Date
20260512
Application Date
20260130

Claims (11)

  1. 1. A high throughput prediction method supporting parallel prediction of multiple dynamic branches, the method comprising: Acquiring branch information of a first branch instruction and at least one second branch instruction in a target prediction period, wherein the program execution sequence of the second branch instruction is positioned behind the first branch instruction; when predicting the first branch instruction, acquiring a history context snapshot selected in a prediction stage; determining a predicted result of the first branch instruction according to the historical context snapshot and the branch information of the first branch instruction; When predicting the second branch instruction, determining a predicted result of the second branch instruction according to the same historical context snapshot used in predicting the first branch instruction and the branch information of the second branch instruction.
  2. 2. The method of claim 1, wherein the predicted times of the first branch instruction and the second branch instruction are both within the target prediction period.
  3. 3. The method of claim 1, wherein the step of determining the position of the substrate comprises, The first branch instruction and the second branch instruction are contiguous or non-contiguous in an address space of the instruction.
  4. 4. The method of claim 1, wherein the step of determining the position of the substrate comprises, The prediction of the second branch instruction is independent of historical context information updated based on the predicted outcome or execution outcome of the first branch instruction.
  5. 5. The method according to claim 1, wherein the method further comprises: After the execution of the first branch instruction or the second branch instruction is completed, training and updating the prediction structure according to the actual execution result of the branch instruction, Wherein the training update is based on a historical reference state that is consistent with a historical context snapshot used by the corresponding branch instruction prediction stage.
  6. 6. The method of claim 5, wherein the method further comprises: After the execution of the branch instruction is completed, the actual branch behavior information of the first branch and/or the second branch instruction is updated to the historical context information according to a preset historical maintenance rule.
  7. 7. The method of claim 6, wherein the step of providing the first layer comprises, The history maintenance rules include any one or a combination of the following: a selection rule of whether to perform history record on branch instructions; compression, sampling or filtering rules of historical information; updating the history information is actually a rule.
  8. 8. The method of claim 1, wherein the branch information comprises program count information.
  9. 9. A high throughput prediction apparatus supporting parallel prediction of multiple dynamic branches, the apparatus comprising: A branch information obtaining unit, configured to obtain branch information of a first branch instruction and at least one second branch instruction in a target prediction period, where a program execution sequence of the second branch instruction is located after the first branch instruction; a history context snapshot obtaining unit, configured to select a history context snapshot in a prediction stage when predicting the first branch instruction; A prediction unit, configured to determine a prediction result of the first branch instruction according to the historical context snapshot and branch information of the first branch instruction; when predicting the second branch instruction, determining a predicted result of the second branch instruction according to the same historical context snapshot used in predicting the first branch instruction and the branch information of the second branch instruction.
  10. 10. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, implements the method of any of claims 1 to 8.
  11. 11. A computer program product, characterized in that the computer program product comprises a computer program which, when executed by a processor, implements the method of any of claims 1 to 8.

Description

High throughput prediction method and device supporting parallel prediction of multiple dynamic branches Technical Field The embodiment of the specification relates to the technical field of computers, in particular to a high throughput prediction method and device supporting parallel prediction of multiple dynamic branches. Background In modern high-performance processors, technical means such as a multi-stage pipeline structure, superscalar execution, speculative execution and the like are generally adopted in order to improve the parallelism of instruction levels and the overall processing performance. Among them, the branch prediction technique is an important component for implementing speculative execution, and it is capable of fetching and executing instructions on a prediction path in advance by predicting whether a branch jumps and a corresponding target address before the branch instruction is actually executed. When the predicted result is correct, the pipeline pause caused by waiting for the branch execution result can be avoided, thereby improving the front-end bandwidth utilization rate and the overall execution efficiency. With the increase of the fetching capability of the front end of the processor, the throughput capability of branch prediction becomes one of the important factors affecting the performance of the processor. Therefore, how to improve throughput of branch prediction is a technical problem to be solved. Disclosure of Invention In order to solve the problems in the prior art, the embodiments of the present disclosure provide a high throughput prediction method and apparatus for supporting parallel prediction of multiple dynamic branches, where the method selects and multiplexes the same historical context reference for multiple branches in a prediction stage, so that multiple branches associated in program execution sequence can generate prediction results in parallel under the same historical reference, and maintain consistency of prediction and historical references adopted by training in a training stage, thereby improving prediction throughput capability of the branch prediction stage. The specific technical scheme of the embodiment of the specification is as follows: in one aspect, embodiments of the present disclosure provide a high throughput prediction method supporting parallel prediction of multiple dynamic branches, the method comprising: Acquiring branch information of a first branch instruction and at least one second branch instruction in a target prediction period, wherein the program execution sequence of the second branch instruction is positioned behind the first branch instruction; when predicting the first branch instruction, acquiring a history context snapshot selected in a prediction stage; determining a predicted result of the first branch instruction according to the historical context snapshot and the branch information of the first branch instruction; When predicting the second branch instruction, determining a predicted result of the second branch instruction according to the same historical context snapshot used in predicting the first branch instruction and the branch information of the second branch instruction. Further, the predicted times of the first branch instruction and the second branch instruction are both within the target prediction period. Further, the first branch instruction and the second branch instruction are contiguous or non-contiguous in an address space of the instruction. Further, the prediction of the second branch instruction is independent of historical context information updated based on the predicted outcome or execution outcome of the first branch instruction. Further, the method further comprises: After the execution of the first branch instruction or the second branch instruction is completed, training and updating the prediction structure according to the actual execution result of the branch instruction, Wherein the training update is based on a historical reference state that is consistent with a historical context snapshot used by the corresponding branch instruction prediction stage. Further, the method further comprises: After the execution of the branch instruction is completed, the actual branch behavior information of the first branch and/or the second branch instruction is updated to the historical context information according to a preset historical maintenance rule. Further, the history maintenance rules include any one or a combination of the following: a selection rule of whether to perform history record on branch instructions; compression, sampling or filtering rules of historical information; updating the history information is actually a rule. Further, the branch information includes program count information. In another aspect, embodiments of the present disclosure further provide a high throughput prediction apparatus supporting parallel prediction of multiple dynamic branches, the apparatus inclu