# US 2016/0259643 A1 · Confidence-driven selective predication of processor instructions

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

- Number: US 2016/0259643 A1
- Document ID: US20160259643A1
- Status: Published application
- Kind: A1
- Application number: 15/156,844
- Filed: 2016-05-17
- Published: 2016-09-08
- Earliest claimed: 2012-11-01
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Michael Karl Gschwind
- Web page: https://patentgrep.com/patent/US20160259643A1

## CPC

- G06F 9/3844: {using dynamic branch prediction, e.g. using branch history tables}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/30072: {to perform conditional operations, e.g. using predicates or guards}
- G06F 9/3017: {Runtime instruction translation, e.g. macros}
- G06F 9/3802: {Instruction prefetching}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An apparatus includes a network interface, memory, and a processor. The processor is coupled with the network interface and memory. The processor is configured to determine that an instruction instance is a branch instruction instance. Responsive to a determination that an instruction instance is a branch instruction instance, the processor is configured to obtain a branch prediction for the branch instruction instance and a confidence value of the branch prediction. The processor is further configured to determine that the confidence for the branch prediction is low based on the confidence value, and responsive to such a determination, generate predicated instruction instances based on the branch instruction instance.

## Claims

### Claim 1

A method comprising:
determining that a first instruction instance is a first branch instruction instance;
responsive to determining that the first instruction instance is the first branch instruction instance, obtaining a first branch prediction for the first branch instruction instance and a first confidence level of the first branch prediction, wherein the first branch prediction and the first confidence level are based, at least in part, on history of branch executions for a program that comprises the first branch instruction instance;
determining that the first confidence level is below a threshold; and
responsive to determining that the first confidence level is below the threshold, generating predicated instruction instances based on the first branch instruction instance.

### Claim 2 (depends on 1)

The method of claim 1, wherein the threshold is based, at least in part, on the history of branch executions.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
keeping the history of branch executions, wherein the history indicates whether the first branch instruction instance was previously taken.

### Claim 4 (depends on 1)

The method of claim 1, wherein generating the predicated instruction instances comprises:
fetching one or more instructions of a first instruction execution path and one or more instructions of a second instruction execution path, the first instruction execution path and the second instruction execution path associated with the first branch instruction instance; and
converting the one or more instructions of the first instruction execution path and the one or more instructions of the second instruction execution path to predicated instruction instances.

### Claim 5 (depends on 4)

The method of claim 4, wherein converting comprises one member of the group consisting of:
adding a first predicate to each of the one or more instructions of the first instruction execution path and adding a second predicate to each of the one or more instructions of the second instruction execution path; and
inserting selection instructions between each of the one or more instructions of the first instruction execution path and inserting selection instructions between each of the one or more instructions of the second instruction execution path.

### Claim 6 (depends on 1)

The method of claim 1, further comprising:
responsive to determining that the first confidence level is higher than the threshold, fetching one or more instructions of a predicted instruction execution path.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
determining that a second instruction instance is a second branch instruction instance;
responsive to determining that the second instruction instance is the second branch instruction instance, obtaining a second branch prediction for the second branch instruction instance and a second confidence value of the second branch prediction;
determining a second confidence level for the second branch prediction based on the second confidence value; and
responsive to determining that the second confidence level is high, executing a third set of instructions that correspond to the second branch prediction.

### Claim 8 (depends on 1)

The method of claim 1, further comprising updating the first confidence level for the first branch prediction based, at least in part, on one of a predicate condition corresponding to predicate instruction instances and a branch condition corresponding to the first branch instruction instance.

### Claim 9

A computer program product comprising:
a non-transitory computer readable storage medium having computer usable program code embodied therewith, the computer usable program code configured to:
determine that a first instruction instance is a first branch instruction instance;
responsive to a determination that the first instruction instance is the first branch instruction instance, obtaining a first branch prediction for the first branch instruction instance and a first confidence level of the first branch prediction, wherein the first branch prediction and the first confidence level are based, at least in part, on a history of branch executions for a program that comprises the first branch instruction instance;
determine that the first confidence level is below a threshold; and
responsive to determining that the first confidence level is below the threshold, generate predicated instruction instances based on the first branch instruction instance.

### Claim 10 (depends on 9)

The computer program product of claim 9, wherein the threshold is based, at least in part, on the history of branch executions.

### Claim 11 (depends on 9)

The computer program product of claim 9, wherein the computer usable program code is further configured to:
keep the history of branch executions, wherein the history indicates whether the first branch instruction instance was previously taken.

### Claim 12 (depends on 9)

The computer program product of claim 9, wherein the computer usable program code configured to generate the predicated instruction instances comprises the computer usable program code configured to:
fetch one or more instructions of a first instruction execution path and one or more instructions of a second instruction execution path, the first instruction execution path and the second instruction execution path associated with the first branch instruction instance; and
convert the one or more instructions of the first instruction execution path and the one or more instructions of the second instruction execution path to predicated instruction instances.

### Claim 13 (depends on 9)

The computer program product of claim 9, wherein the computer usable program code is further configured to:
update the first confidence level for the first branch prediction based, at least in part, on one of a predicate condition corresponding to predicate instruction instances and a branch condition corresponding to the first branch instruction instance.

### Claim 14 (depends on 9)

The computer program product of claim 9, wherein the computer usable program code is further configured to:
determine that a second instruction instance is a second branch instruction instance;
responsive to a determination that the second instruction instance is the second branch instruction instance, obtain a second branch prediction for the second branch instruction instance and a second confidence value of the second branch prediction;
determine a second confidence level for the second branch prediction based on the second confidence value; and
responsive to a determination that the second confidence level is high, execute a third set of instructions that corresponds to the second branch prediction.

### Claim 15 (depends on 9)

The computer program product of claim 9, wherein the computer usable program code is further configured to:
update the first confidence level for the first branch prediction based, at least in part, on one of a predicate condition corresponding to predicate instruction instances and a branch condition corresponding to the first branch instruction instance.

### Claim 16

An apparatus comprising:
a network interface;
memory; and
a processor coupled with the network interface and the memory, configured to:
determine that a first instruction instance is a first branch instruction instance;
responsive to a determination that the first instruction instance is the first branch instruction instance, obtaining a first branch prediction for the first branch instruction instance and a first confidence level of the first branch prediction, wherein the first branch prediction and the first confidence level are based, at least in part, on a history of branch executions for a program that comprises the first branch instruction instance;
determine that the first confidence level is below a threshold; and
responsive to determining that the first confidence level is below the threshold, generate predicated instruction instances based on the first branch instruction instance.

### Claim 17 (depends on 16)

The apparatus of claim 16, wherein the threshold is based, at least in part, on the history of branch executions.

### Claim 18 (depends on 16)

The apparatus of claim 16, wherein the processor is further configured to:
keep the history of branch executions, wherein the history indicates whether the first branch instruction instance was previously taken.

### Claim 19 (depends on 16)

The apparatus of claim 16, wherein the processor is further configured to:
update the first confidence level for the first branch prediction based, at least in part, on one of a predicate condition corresponding to predicate instruction instances and a branch condition corresponding to the first branch instruction instance.

### Claim 20 (depends on 16)

The apparatus of claim 16, the processor further configured to:
determine that a second instruction instance is a second branch instruction instance;
responsive to a determination that the second instruction instance is the second branch instruction instance, obtain a second branch prediction for the second branch instruction instance and a second confidence value of the second branch prediction;
determine a second confidence level for the second branch prediction based on the second confidence value; and
responsive to a determination that the second confidence level is high, execute a third set of instructions that corresponds to the second branch prediction.
