Delaying branch prediction updates specified by a suspend branch prediction instruction until after a transaction is completed
AssigneeInternational Business Machines Corporation
InventorsMichael K. Gschwind, Valentina Salapura
Life of this patent
Estimating the term…
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.
Claims15
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.
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.
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.
Dependencies are inferred from the claim text.