# US 2021/0342157 A1 · Selective use of branch prediction hints

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

- Number: US 2021/0342157 A1
- Document ID: US20210342157A1
- Status: Published application
- Kind: A1
- Application number: 17/033,749
- Filed: 2020-09-26
- Published: 2021-11-04
- Earliest claimed: 2020-04-29
- Assignees: Intel Corporation
- Applicants: Intel Corporation
- Inventors: Jared W. Stark; Ahmad Yasin; Ajay Amarsingh Singh
- Web page: https://patentgrep.com/patent/US20210342157A1

## CPC

- G06F 9/3842: {Speculative instruction execution}
- G06F 9/3848: {using hybrid branch prediction, e.g. selection between prediction techniques}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/30145: {Instruction analysis, e.g. decoding, instruction word fields}
- G06F 9/3846: {using static prediction, e.g. branch taken strategy}
- G06F 9/3867: {using instruction pipelines}
- G06F 12/0804: with main memory updating (G06F12/0806 takes precedence)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Embodiments of apparatuses, methods, and systems for selective use of branch prediction hints are described. In an embodiment, an apparatus includes an instruction decoder and a branch predictor. The instruction decoder is to decode a branch instruction having a hint. The branch predictor is to provide a prediction and a hint-override indicator. The hint-override indicator is to indicate whether the prediction is based on stored information about the branch instruction. The prediction is to override the hint if the hint-override indicator indicates that the prediction is based on stored information about the branch instruction.

## Claims

### Claim 1

An apparatus comprising:
an instruction decoder to decode a branch instruction having a hint; and
a branch predictor to provide a prediction and a hint-override indicator, wherein the hint-override indicator is to indicate whether the prediction is based on stored information about the branch instruction, and wherein the prediction is to override the hint if the hint-override indicator indicates that the prediction is based on stored information about the branch instruction.

### Claim 2 (depends on 1)

The apparatus of claim 1, further comprising a tagged structure to provide the stored information.

### Claim 3 (depends on 1)

The apparatus of claim 1, wherein the instruction decoder is to associate a branch hint override indicator to the decoded branch instruction.

### Claim 4 (depends on 3)

The apparatus of claim 3, wherein the branch hint override indicator is to be passed down an execution core pipeline from the instruction decoder.

### Claim 5 (depends on 4)

The apparatus of claim 4, wherein override the hint includes flushing of the execution pipeline of instructions following a hint path.

### Claim 6 (depends on 1)

The apparatus of claim 1, further comprising a counter to count conditional branch instructions for which the branch predictor has no stored information and for which the prediction is to not take a branch.

### Claim 7 (depends on 1)

The apparatus of claim 1, further comprising a counter to count correct predictions for conditional branch instructions for which the branch predictor has no stored information and for which the prediction is to not take a branch.

### Claim 8 (depends on 1)

The apparatus of claim 1, further comprising a counter to count mispredictions for conditional branch instructions for which the branch predictor has no stored information and for which the prediction is to not take a branch.

### Claim 9 (depends on 1)

The apparatus of claim 1, further comprising a counter to count conditional branch instructions for which the branch predictor has no stored information and for which the prediction is to take a branch.

### Claim 10 (depends on 1)

The apparatus of claim 1, further comprising a counter to count correct predictions for conditional branch instructions for which the branch predictor has no stored information and for which the prediction is to take a branch.

### Claim 11 (depends on 1)

The apparatus of claim 1, further comprising a counter to count mispredictions for conditional branch instructions for which the branch predictor has no stored information and for which the prediction is to take a branch.

### Claim 12

A method comprising:
receiving, by a branch predictor, a branch instruction with a hint;
making a prediction;
determining whether the prediction was based on stored information about the branch instruction;
setting a hint-override indicator if the prediction was based on stored information; and
overriding the hint if the hint-override indicator indicates that the prediction was based on stored information.

### Claim 13 (depends on 12)

The method of claim 12, further comprising using the hint if the hint-override indicator indicates that the prediction was not based on stored information.

### Claim 14 (depends on 12)

The method of claim 12, wherein overriding the hint includes flushing an execution pipeline of instructions following a hint path.

### Claim 15 (depends on 14)

The method of claim 14, further comprising counting conditional branch instructions for which the branch predictor had no stored information and for which the prediction was to not take a branch.

### Claim 16 (depends on 14)

The method of claim 14, further comprising counting correct predictions for conditional branch instructions for which the branch predictor had no stored information and for which the prediction was to not take a branch.

### Claim 17 (depends on 14)

The method of claim 14, further comprising counting mispredictions for conditional branch instructions for which the branch predictor had no stored information and for which the prediction was to not take a branch.

### Claim 18

A method comprising:
executing code including branch instructions having hints on a processor having a branch predictor to provide a prediction and a hint-override indicator, wherein the hint-override indicator is to indicate whether the prediction is based on stored information about the branch instruction;
overriding the hints if the hint-override indicator indicates that the prediction is based on stored information about the corresponding branch instruction; and
counting mispredictions for conditional branch instructions for which the branch predictor had no stored information and for which the prediction was to not take a branch.

### Claim 19 (depends on 18)

The method of claim 18, further comprising profiling the code based on the count of mispredictions.

### Claim 20 (depends on 19)

The method of claim 19, wherein profiling includes finding branch instructions to which to add hints.
