Browse Prior Art Database

A Method and System for Handling Look-ahead Branch Prediction Latency by Correlating to Instruction Fetching Disclosure Number: IPCOM000237565D
Publication Date: 2014-Jun-24
Document File: 5 page(s) / 272K

Publishing Venue

The Prior Art Database


A method and system is disclosed for handling look-ahead branch prediction latency by correlating to instruction fetching.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 40% of the total text.

Page 01 of 5

A Method and System for Handling Look-ahead Branch Prediction Latency by Correlating to Instruction Fetching

When using look-ahead branch prediction in which branch prediction lookups and Instruction Fetching (I-fetching) run independently, there are situations when a Branch Target Buffer (BTB) and/or a Branch History Table (BHT) of the branch prediction search can fall behind I-fetching. If the BTB/BHT results are not available at the point in the pipeline where branch instructions from the I-fetching are to be marked with the branch predictions, then the results of the BTB/BHT cannot be used or some less accurate method of prediction must be used. In many workloads, rather than using the less accurate predictor, the better option may be to improve performance by halting the instruction in the pipeline to wait for the BTB result to catch up. As a result, BTB predictions can always be used prior to instruction execution.

Disclosed is a method and system for handling look-ahead branch prediction latency by correlating to I-fetching. The method and system disclosed herein halts the instruction processing when the BTB is not ahead of the I-fetch in the pipeline.

In accordance with an embodiment, the method and system disclosed herein tracks the progress of both the BTB search and the I-fetch paths at a branch marking point or at some earlier point in the pipeline. A stream identifier for the BTB and the I-fetch and the amount of memory that has been sequentially searched or fetched in the stream are compared at a particular point in the pipeline to determine whether the BTB search is behind the I-fetch. If the BTB search is determined to potentially behind, the instruction processing can be halted until the BTB search has caught up. Accordingly, all BTB results for the instructions at that point are known and the BTB results can be used for branch marking. As a result, BTB results are always used for branch marking with maximum accuracy.

Fig. 1 illustrates the steps performed while processing BTB search state in accordance to the method and system disclosed herein.


Page 02 of 5

Figure 1

In accordance with fig. 1, an Instruction Fetch Buffer (IFB) unit provides information to the Instruction Stall for Branch Prediction (ISBP) logic about the current BTB search state. Specifically, the IFB provides a stream ID for which the stream is being searched and an OctWord number for the start of the stream that needs to be searched. Upon any event that restarts both the BTB and I-fetch to the same initial point, the BTB resets the stream ID and the OctWord number to 0. As the BTB searches sequentially on a

stream for predictions, the OctWord since the start of the stream (OctWord Number) is incremented by the number of OctWords that has been searched on the stream. If the BTB encounters a guess taken branch prediction, then the BTB increments the stream ID and resets the OctWord number to 0 before the BTB starts the search on a new stream.