Selective Ahead Branch Prediction for Call and Indirect Instructions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing branch prediction techniques, such as 'predict ahead,' face challenges in maintaining accuracy for certain types of branch instructions like call, return, and indirect branches, leading to increased latency and capacity or conflict misses due to inefficient indexing and hotspot creation in the branch target buffer.

Innovation Solution

Implementing a method to selectively perform ahead or non-ahead branch prediction based on the type of branch instruction, where ahead prediction is used for conditional and unconditional branches, and non-ahead prediction is used for call, return, and indirect branches, with the branch predictor flushing speculative states and re-initiating predictions based on the correct indexing to maintain accuracy and reduce latency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of time

If ahead branch prediction is used for all branch instructions, then latency is reduced, but accuracy deteriorates for call, return, and indirect branches due to hotspot creation and capacity misses

Engineering Contradiction:
Improvebranch prediction latencyVSAvoidbranch prediction accuracy
Core Design Contradiction:
Loss of timeVSReliability

Solution Approach 1:

The patent segments the branch prediction process by identifying and separating different types of branch instructions (call, return, indirect, conditional, unconditional). It applies different prediction strategies to different segments: ahead prediction for conditional and unconditional branches, and non-ahead prediction for call, return, and indirect branches. This segmentation resolves the contradiction by allowing latency optimization for some branch types while maintaining accuracy for others.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent implements dynamic selection of branch prediction techniques based on the type of branch instruction encountered. The system dynamically switches between ahead and non-ahead prediction modes depending on the branch instruction type, rather than using a static approach. This dynamic adaptation allows the system to optimize latency when appropriate while maintaining accuracy when needed.

Inventive Principle:
Principle #15Dynamics

2Productivity

If ahead prediction is used, then speculative execution is improved, but capacity misses and conflict misses increase due to inefficient indexing

Engineering Contradiction:
Improvespeculative execution efficiencyVSAvoidbranch target buffer capacity utilization
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

The patent applies local quality by using different indexing and prediction approaches for different types of branch instructions. Instead of a uniform approach, it tailors the prediction strategy to the specific characteristics of each branch type, optimizing buffer utilization for each case and reducing overall capacity and conflict misses.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

By segmenting the branch prediction handling based on instruction type, the patent prevents hotspots in the branch target buffer that would occur with uniform ahead prediction. This segmentation distributes buffer access more evenly, improving capacity utilization and reducing conflict misses while maintaining speculative execution benefits where applicable.

Inventive Principle:
Principle #1Segmentation

3Reliability

If non-ahead prediction is used for all branches, then accuracy is maintained, but latency increases due to inability to speculatively execute subsequent instructions

Engineering Contradiction:
Improvebranch prediction accuracyVSAvoidbranch prediction latency
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent segments branch instructions into categories where ahead prediction is beneficial (conditional, unconditional) and where non-ahead prediction is necessary (call, return, indirect). This allows the system to achieve low latency for the majority of branches while maintaining high accuracy for critical branches that require precise prediction.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system dynamically selects the appropriate prediction mode based on branch instruction type, enabling speculative execution and reducing latency for suitable branches while maintaining accuracy for branches where precision is critical. This dynamic approach optimizes the trade-off between latency and accuracy on a per-branch basis.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS11416256B2Selectively performing ahead branch prediction based on types of branch instructions
Publication Date: 2022.08.16 ADVANCED MICRO DEVICES INC
  • US11416256B2 patent drawing
  • US11416256B2 patent drawing
  • US11416256B2 patent drawing

AI summary

A set of entries in a branch prediction structure for a set of second blocks are accessed based on a first address of a first block. The set of second blocks correspond to outcomes of one or more first branch instructions in the first block. Speculative prediction of outcomes of second branch instructions in the second blocks is initiated based on the entries in the branch prediction structure. State associated with the speculative prediction is selectively flushed based on types of the branch instructions. In some cases, the branch predictor can be accessed using an address of a previous block or a current block. State associated with the speculative prediction is selectively flushed from the ahead branch prediction, and prediction of outcomes of branch instructions in one of the second blocks is selectively initiated using non-ahead accessing, based on the types of the one or more branch instructions.