Branch Predictor Using Multiple Byte Offsets for Variable-Length Instructions

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing branch prediction techniques face challenges in accurately predicting the presence, direction, and target addresses of branch instructions, especially in variable-length instruction sets and long processor pipelines, due to the random location of branch instructions within fetched blocks.

Innovation Solution

A branch predictor that hashes a more accurate representation of conditional branch instruction addresses to generate indexes into a conditional branch predictor, utilizing a branch target address cache and a conditional branch predictor to improve prediction accuracy by incorporating branch history and global branch patterns.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If instructions are fetched from instruction cache in large blocks (e.g., 16 bytes), then the number of branch instructions that can be predicted increases, but the random location of branch instructions within the block makes prediction accuracy difficult to achieve

Engineering Contradiction:
Improvenumber of branch instructions predictedVSAvoidprediction accuracy
Core Design Contradiction:
ProductivityVSMeasurement precision

Solution Approach 1:

The instruction cache block is segmented into multiple 4-byte sub-blocks, each processed independently by separate predictor circuits. This segmentation allows each predictor to handle a smaller, more manageable portion of the block while maintaining overall high prediction throughput. The block address is divided into sub-block addresses that index into separate prediction tables.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a new dimension to the prediction index by combining the sub-block address with the lower 2 bits of the program counter (PC). This creates a multi-dimensional indexing scheme where predictions are based on both the sub-block location and the specific instruction offset within that sub-block, significantly improving prediction accuracy for randomly located branch instructions.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Reliability

If multiple branch instructions are present in a fetched block with random locations, then the complexity of predicting their presence and targets increases, but accurate prediction is needed for long processor pipelines

Engineering Contradiction:
Improveprediction reliabilityVSAvoidprediction system complexity
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The prediction system is divided into multiple independent predictor circuits, each responsible for a specific 4-byte sub-block. Each predictor contains its own pattern history table and saturation counter, allowing parallel prediction of multiple branches without interference. This segmentation reduces the complexity of any single predictor while maintaining the ability to handle multiple branches in a block.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

Each predictor circuit autonomously predicts branches in its assigned sub-block using locally stored pattern history and saturation counters. The system does not require complex centralized control logic to coordinate predictions across the block, as each predictor independently determines presence, target address, and direction based on its own historical data.

Inventive Principle:
Principle #25Self-service

3Adaptability or versatility

If variable-length instructions are used (e.g., x86, ARM), then the flexibility of the instruction set increases, but the random byte offset of branch instructions within the block makes prediction more challenging

Engineering Contradiction:
Improveinstruction set flexibilityVSAvoidbranch location prediction accuracy
Core Design Contradiction:
Adaptability or versatilityVSMeasurement precision

Solution Approach 1:

The patent adds the lower 2 bits of the program counter as an additional indexing dimension combined with the sub-block address. This allows the predictor to distinguish between instructions at different byte offsets within a sub-block, accurately handling variable-length instructions regardless of their random positions. The multi-dimensional index (sub-block address + PC bits) directly addresses the challenge of unpredictable branch locations in variable-length instruction sets.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

Data Source

PatentEP3306467B1Branch predictor that uses multiple byte offsets in hash of instruction block fetch address and branch pattern to generate conditional branch predictor indexes
Publication Date: 2022.10.19 VIA ALLIANCE SEMICON CO LTD
  • EP3306467B1 patent drawingFigure 1
  • EP3306467B1 patent drawingFigure 2
  • EP3306467B1 patent drawingFigure 3

AI summary

A branch predictor has a block address useable to access a block of instruction bytes of an instruction cache and first/second byte offsets within the block of instruction bytes. Hashing logic hashes a branch pattern and respective first/second address formed from the block address and the respective first/second byte offsets to generate respective first/second indexes. A conditional branch predictor receives the first/second indexes and in response provides respective first/second direction predictions of first/second conditional branch instructions in the block of instruction bytes. In one embodiment, a branch target address cache (BTAC) provides the byte offsets, and the first/second direction predictions are statically associated with first/second target addresses also provided by the BTAC. Alternatively, the byte offsets are predetermined values, and the first/second direction predictions are dynamically associated with the first/second target addresses based on the relative sizes of the byte offsets provided by the BTAC.