# US 10,372,459 B2 · Training and utilization of neural branch predictor

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,372,459 B2
- Document ID: US10372459B2
- Status: Granted
- Kind: B2
- Application number: 15/712,112
- Filed: 2017-09-21
- Published: 2019-03-21
- Granted: 2019-08-06
- Earliest claimed: 2017-09-21
- Assignees: QUALCOMM Incorporated
- Applicants: QUALCOMM Incorporated
- Inventors: Gurkanwal Brar; Christopher Ahn; Gurvinder Singh Chhabra
- Web page: https://patentgrep.com/patent/US10372459B2

## CPC

- G06F 9/3848: {using hybrid branch prediction, e.g. selection between prediction techniques}
- G06F 9/3806: {using address prediction, e.g. return stack, branch history buffer}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems and methods for branch prediction include identifying a subset of branch instructions from an execution trace of instructions executed by a processor. The identified subset of branch instructions have greater benefit from branch predictions made by a neural branch predictor than branch predictions made by a non-neural branch predictor. During runtime, the neural branch predictor is selectively used for obtaining branch predictions of the identified subset of branch instructions. For remaining branch instructions outside the identified subset of branch instructions, branch predictions are obtained from a non-neural branch predictor. Further, a weight vector matrix comprising weight vectors for the identified subset of branch instructions of the neural branch predictor is pre-trained based on the execution trace.

## Claims

### Claim 1

A method of branch prediction, the method comprising:
identifying a subset of branch instructions from an execution trace of instructions executed by a processor, wherein the identified subset of branch instructions have greater benefit from branch predictions made by a neural branch predictor than branch predictions made by a non-neural branch predictor; and
during runtime, selectively using the neural branch predictor for obtaining branch predictions of the identified subset of branch instructions, and selectively using the non-neural branch predictor, without using the neural branch predictor, for obtaining branch predictions for the remaining branch instructions outside the identified subset of branch instructions.

### Claim 2 (depends on 1)

The method of claim 1, wherein determining that the identified subset of branch instructions have greater benefit from branch predictions made by the neural branch predictor than branch predictions made by the non-neural branch predictor comprises:
determining, for each branch instruction in the execution trace: a frequency of the branch instruction in the execution trace and a difference between misprediction rates using the neural branch predictor and the non-neural branch predictor; and
multiplying the difference by the frequency.

### Claim 3 (depends on 2)

The method of claim 2, further comprising pre-training a weight vector matrix of the neural branch predictor to generate a pre-trained weight vector matrix based on the execution trace, the pre-trained weight vector matrix comprising weight vectors for the identified subset of branch instructions.

### Claim 4 (depends on 3)

The method of claim 3, further comprising using the pre-trained weight matrix as a static weight vector during runtime, in obtaining branch predictions of the identified subset of branch instructions using the neural branch predictor.

### Claim 5 (depends on 3)

The method of claim 3, further comprising using the pre-trained weight matrix as an initial weight vector during runtime, in obtaining branch predictions of the identified subset of branch instructions using the neural branch predictor, and updating the initial weight vector during runtime.

### Claim 6 (depends on 1)

The method of claim 1, wherein the neural branch predictor comprises one of a Perceptron, Fast Path, Piecewise Linear branch predictor, or Tage predictor.

### Claim 7 (depends on 1)

The method of claim 1, wherein the non-neural branch predictor comprises a bimodal branch predictor.

### Claim 8 (depends on 1)

The method of claim 1, wherein selectively using the neural branch predictor for obtaining branch predictions of the identified subset of branch instructions comprises determining, in a filter, whether a branch instruction belongs to the identified subset of branch instructions and directing branch prediction of the branch instruction to the neural branch predictor.

### Claim 9 (depends on 8)

The method of claim 8, comprising determining that the branch instruction belongs to the identified subset of branch instructions based on a program counter (PC) of the branch instruction or one or more bits embedded in an encoding of the branch instruction.

### Claim 10

An apparatus comprising:
a neural branch predictor configured to provide neural branch predictions;
a non-neural branch predictor configured to provide non-neural branch predictions;
a filter configured to identify subset of branch instructions from an execution trace of instructions executed by a processor, wherein the identified subset of branch instructions have greater benefit from branch predictions made by a neural branch predictor than branch predictions made by a non-neural branch predictor;
wherein the filter is configured to, during runtime: selectively direct the identified subset of branch instructions to the neural branch predictor and selectively direct the remaining branch instructions outside the identified subset of branch instructions to the non-neural branch predictor, without directing the remaining branch instructions to the neural branch predictor.

### Claim 11 (depends on 10)

The apparatus of claim 10, further comprising logic configured to determine, for each branch instruction in the execution trace: a frequency of the branch instruction in the execution trace and a difference between misprediction rates using the neural branch predictor and the non-neural branch predictor, and multiplying the difference by the frequency.

### Claim 12 (depends on 11)

The apparatus of claim 11, further comprising a training block configured to pre-train a weight vector matrix of the neural branch predictor to generate a pre-trained weight vector matrix based on the execution trace, the pre-trained weight vector matrix comprising weight vectors for the identified subset of branch instructions.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the neural branch predictor is configured to use the pre-trained weight matrix as a static weight vector during runtime to generate branch predictions of the identified subset of branch instructions.

### Claim 14 (depends on 12)

The apparatus of claim 12, wherein the neural branch predictor is configured to use the pre-trained weight matrix as an initial weight vector during runtime to generate branch predictions of the identified subset of branch instructions, and update the initial weight vector during runtime.

### Claim 15 (depends on 10)

The apparatus of claim 10, wherein the neural branch predictor comprises one of a Perceptron, Fast Path, Piecewise Linear branch predictor, or Tage predictor.

### Claim 16 (depends on 10)

The apparatus of claim 10, wherein the non-neural branch predictor comprises a bimodal branch predictor.

### Claim 17 (depends on 10)

The apparatus of claim 10, wherein the filter is configured to selectively direct a branch instruction to one of the neural branch predictor or the non-neural branch predictor based on a program counter (PC) of the branch instruction or one or more bits embedded in an encoding of the branch instruction.

### Claim 18 (depends on 10)

The apparatus of claim 10, integrated into a device selected from the group consisting of a set top box, a server, a music player, a video player, an entertainment unit, a navigation device, a personal digital assistant (PDA), a fixed location data unit, a computer, a laptop, a tablet, a communications device, and a mobile phone.

### Claim 19

A non-transitory computer-readable storage medium comprising code, which, when executed by a computer, causes the computer to perform operations for branch prediction, the non-transitory computer-readable storage medium comprising:
code for identifying a subset of branch instructions from an execution trace of instructions executed by a processor, wherein the identified subset of branch instructions have greater benefit from branch predictions made by a neural branch predictor than branch predictions made by a non-neural branch predictor; and
code for, during runtime, selectively using the neural branch predictor for obtaining branch predictions of the identified subset of branch instructions, and selectively using the non-neural branch predictor, without using the neural branch predictor, for obtaining branch predictions for the remaining branch instructions outside the identified subset of branch instructions.

### Claim 20 (depends on 19)

The non-transitory computer-readable storage medium of claim 19, further comprising code for determining, for each branch instruction in the execution trace: a frequency of the branch instruction in the execution trace and a difference between misprediction rates using the neural branch predictor and the non-neural branch predictor, and code for multiplying the difference by the frequency.

### Claim 21 (depends on 19)

The non-transitory computer-readable storage medium of claim 19, further comprising code for pre-training a weight vector matrix of the neural branch predictor to generate a pre-trained weight vector matrix based on the execution trace, the pre-trained weight vector matrix comprising weight vectors for the identified subset of branch instructions.

### Claim 22 (depends on 21)

The non-transitory computer-readable storage medium of claim 21, comprising code for using the pre-trained weight matrix as a static weight vector during runtime, in obtaining branch predictions of the identified subset of branch instructions using the neural branch predictor.

### Claim 23 (depends on 21)

The non-transitory computer-readable storage medium of claim 21, comprising code for using the pre-trained weight matrix as an initial weight vector during runtime, in obtaining branch predictions of the identified subset of branch instructions using the neural branch predictor, and code for updating the initial weight vector during runtime.

### Claim 24 (depends on 19)

The non-transitory computer-readable storage medium of claim 19, comprising code for determining, in a filter, whether a branch instruction belongs to the identified subset of branch instructions and directing branch prediction of the branch instruction to the neural branch predictor.

### Claim 25 (depends on 24)

The non-transitory computer-readable storage medium of claim 24, comprising code for determining that the branch instruction belongs to the identified subset of branch instructions based on a program counter (PC) of the branch instruction or one or more bits embedded in an encoding of the branch instruction.

### Claim 26

A method of branch prediction, the method comprising:
identifying a subset of branch instructions from an execution trace of instructions executed by a processor, wherein:
the identified subset of branch instructions have greater benefit from branch predictions made by a neural branch predictor than branch predictions made by a non-neural branch predictor; and
determining that the identified subset of branch instructions have greater benefit from branch predictions made by the neural branch predictor than branch predictions made by the non-neural branch predictor comprises:
determining, for each branch instruction in the execution trace: a frequency of the branch instruction in the execution trace and a difference between misprediction rates using the neural branch predictor and the non-neural branch predictor; and
multiplying the difference by the frequency; and
during runtime, selectively using the neural branch predictor for obtaining branch predictions of the identified subset of branch instructions, and the non-neural branch predictor for obtaining branch predictions for remaining branch instructions outside the identified subset of branch instructions.
