# US 11,119,785 B2 · Delaying branch prediction updates specified by a suspend branch prediction instruction until after a transaction is completed

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

- Number: US 11,119,785 B2
- Document ID: US11119785B2
- Status: Granted
- Kind: B2
- Application number: 16/507,719
- Filed: 2019-07-10
- Published: 2019-10-31
- Granted: 2021-09-14
- Earliest claimed: 2014-06-02
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Michael K. Gschwind; Valentina Salapura
- Web page: https://patentgrep.com/patent/US11119785B2

## CPC

- G06F 9/3844: {using dynamic branch prediction, e.g. using branch history tables}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/30076: {to perform miscellaneous control operations, e.g. NOP}
- G06F 9/30087: {Synchronisation or serialisation instructions}
- G06F 9/3834: {Maintaining memory consistency}
- G06F 9/3842: {Speculative instruction execution}
- G06F 9/3854: {Instruction completion, e.g. retiring, committing or graduating}
- G06F 9/3858: {Result writeback, i.e. updating the architectural state or memory}
- G06F 9/38585: {with result invalidation, e.g. nullification}
- G06F 9/466: {Transaction processing}
- G06F 9/467: {Transactional memory (G06F9/528 takes precedence)}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

In a branch predictor in a processor capable of executing transactional memory transactions, the branch predictor speculatively predicts the outcome of branch instructions, such as taken/not-taken, the target address and the target instruction. Branch prediction information is buffered during a transaction and is only loaded into the branch predictor when the transaction is completed. The branch prediction information is discarded if the transaction aborts.

## Claims

### Claim 1

A computer system for delaying branch prediction updates, the computer system comprising:
a memory; and
a processor in communication with the memory, wherein the computer system is configured to perform a method, the method comprising:
executing, by the processor, one or more first branch instructions in a non-transactional execution mode, the executing using a branch predictor to predict an outcome of the one or more first branch instructions;
updating the branch predictor based on execution of the one or more first branch instructions;
entering, pursuant to an execute transactional mode instruction, a transactional execution mode for executing a transaction;
setting, in the transactional execution mode, a prediction suppression indicator to indicate suppression of specified updates to the branch predictor, the prediction suppression indicator configured to have a first state indicating no suppression of updates to the branch predictor and a second state indicating suppression of updates to the branch predictor, wherein the setting the prediction suppression indicator in the transactional execution mode is pursuant to a suspend branch prediction instruction, where the suspend branch prediction instruction is a different instruction from the execute transactional mode instruction, and the specified updates being suppressed are indicated by the suspend branch prediction instruction, and the setting sets the prediction suppression indicator to the second state;
executing, in the transactional execution mode, one or more second branch instructions, the one or more second branch instructions being of the transaction;
suppressing branch prediction information updates to the branch predictor for the one or more second branch instructions and buffering branch prediction information for the one or more second instructions in a prediction buffer to provide buffered branch prediction information;
resetting the prediction suppression indicator to the first state for execution of first branch instructions in the non-transactional execution mode;
determining that the transaction has completed; and
based on the transaction completing, updating the branch predictor with the buffered branch prediction information from the prediction buffer and exiting the transactional execution mode.

### Claim 2 (depends on 1)

The computer system of claim 1, wherein the prediction suppression indicator is separate from a transaction state indicator that indicates whether the processor is executing in transactional execution mode.

### Claim 3 (depends on 1)

The computer system of claim 1, wherein the method further comprises:
determining that the transaction is being aborted;
based on the transaction aborting, not updating the branch predictor with the buffered branch prediction information from the prediction buffer; and
exiting the transactional execution mode.

### Claim 4 (depends on 1)

The computer system of claim 1, wherein the branch predictor comprises a branch taken prediction.

### Claim 5 (depends on 1)

The computer system of claim 1, wherein the branch predictor comprises a branch target prediction.

### Claim 6 (depends on 1)

The computer system of claim 1, wherein the resetting the prediction suppression indicator is performed in the transactional execution mode.

### Claim 7

A computer program product for delaying branch prediction updates, the computer program product comprising:
a computer-readable storage medium readable by a processor and storing instructions to perform a method, the method comprising:
executing one or more first branch instructions in a non-transactional execution mode, the executing using a branch predictor to predict an outcome of the one or more first branch instructions;
updating the branch predictor based on execution of the one or more first branch instructions;
entering, pursuant to an execute transactional mode instruction, a transactional execution mode for executing a transaction;
setting, in the transactional execution mode, a prediction suppression indicator to indicate suppression of specified updates to the branch predictor, the prediction suppression indicator configured to have a first state indicating no suppression of updates to the branch predictor and a second state indicating suppression of updates to the branch predictor, wherein the setting the prediction suppression indicator in the transactional execution mode is pursuant to a suspend branch prediction instruction, where the suspend branch prediction instruction is a different instruction from the execute transactional mode instruction, and the specified updates being suppressed are indicated by the suspend branch prediction instruction, and the setting sets the prediction suppression indicator to the second state;
executing, in the transactional execution mode, one or more second branch instructions, the one or more second branch instructions being of the transaction;
suppressing branch prediction information updates to the branch predictor for the one or more second branch instructions and buffering branch prediction information for the one or more second instructions in a prediction buffer to provide buffered branch prediction information;
resetting the prediction suppression indicator to the first state for execution of first branch instructions in the non-transactional execution mode;
determining that the transaction has completed; and
based on the transaction completing, updating the branch predictor with the buffered branch prediction information from the prediction buffer and exiting the transactional execution mode.

### Claim 8 (depends on 7)

The computer program product of claim 7, wherein the prediction suppression indicator is separate from a transaction state indicator that indicates whether the processor is executing in transactional execution mode.

### Claim 9 (depends on 7)

The computer program product of claim 7, wherein the method further comprises:
determining that the transaction is being aborted;
based on the transaction aborting, not updating the branch predictor with the buffered branch prediction information from the prediction buffer; and
exiting the transactional execution mode.

### Claim 10 (depends on 7)

The computer program product of claim 7, wherein the branch predictor comprises a branch taken prediction.

### Claim 11 (depends on 7)

The computer program product of claim 7, wherein the branch predictor comprises a branch target prediction.

### Claim 12 (depends on 7)

The computer program product of claim 7, wherein the resetting the prediction suppression indicator is performed in the transactional execution mode.

### Claim 13

A computer-implemented method of delaying branch prediction updates, the computer-implemented method comprising:
executing one or more first branch instructions in a non-transactional execution mode, the executing using a branch predictor to predict an outcome of the one or more first branch instructions;
updating the branch predictor based on execution of the one or more first branch instructions;
entering, pursuant to an execute transactional mode instruction, a transactional execution mode for executing a transaction;
setting, in the transactional execution mode, a prediction suppression indicator to indicate suppression of specified updates to the branch predictor, the prediction suppression indicator configured to have a first state indicating no suppression of updates to the branch predictor and a second state indicating suppression of updates to the branch predictor, wherein the setting the prediction suppression indicator in the transactional execution mode is pursuant to a suspend branch prediction instruction, where the suspend branch prediction instruction is a different instruction from the execute transactional mode instruction, and the specified updates being suppressed are indicated by the suspend branch prediction instruction, and the setting sets the prediction suppression indicator to the second state;
executing, in the transactional execution mode, one or more second branch instructions, the one or more second branch instructions being of the transaction;
suppressing branch prediction information updates to the branch predictor for the one or more second branch instructions and buffering branch prediction information for the one or more second instructions in a prediction buffer to provide buffered branch prediction information;
resetting the prediction suppression indicator to the first state for execution of first branch instructions in the non-transactional execution mode;
determining that the transaction has completed; and
based on the transaction completing, updating the branch predictor with the buffered branch prediction information from the prediction buffer and exiting the transactional execution mode.

### Claim 14 (depends on 13)

The computer-implemented method of claim 13, wherein the prediction suppression indicator is separate from a transaction state indicator that indicates whether a processor is executing in transactional execution mode.

### Claim 15 (depends on 13)

The computer-implemented method of claim 13, wherein the method further comprises:
determining that the transaction is being aborted;
based on the transaction aborting, not updating the branch predictor with the buffered branch prediction information from the prediction buffer; and
exiting the transactional execution mode.
