IP Library Granted Patent US 7,689,813
Granted Patent B2
US 7,689,813 · App. 11/083,263 · Granted Mar 30, 2010

Method and apparatus for enforcing membar instruction semantics in an execute-ahead processor

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 7,689,813
App. No.
11/083,263
Granted
Mar 30, 2010
Kind
B2
Abstract

Embodiments of the present invention provide a system that facilitates executing a memory barrier (membar) instruction in an execute-ahead processor, wherein the membar instruction forces buffered loads and stores to complete before allowing a following instruction to be issued.

Claims (52)

1. An apparatus for executing a membar instruction in an execute-ahead processor, wherein the membar instruction forces buffered loads and stores to complete before allowing any following loads or stores to complete, comprising:

a processor;

an execution mechanism within the processor configured to issue instructions for execution in a normal-execution mode, and further configured to enter an execute-ahead mode if, while issuing instructions for execution in the normal-execution mode, an instruction cannot be executed because of an unresolved data dependency;

wherein while issuing instructions for execution in the execute-ahead mode, instructions that cannot be executed because of an unresolved data dependency are deferred by placing the instructions in a deferred queue, and non-deferred instructions are executed in program order;

wherein, upon encountering a membar instruction while issuing instructions for execution in the normal-execution mode, the execution mechanism is configured to determine if either a load buffer or a store buffer is non-empty and, if so, the execution mechanism is further configured to:

defer the membar instruction by placing the membar instruction in the deferred queue;

execute subsequent instructions in the execute-ahead mode; and

defer all load and store instructions encountered by the execution mechanism in execute-ahead mode after deferring the membar instruction by placing these instructions in the deferred queue in program order following the membar instruction; and

wherein the execution mechanism is configured to initialize a stores-after-launch counter upon each entry to execute-ahead mode that is caused by an unresolved data dependency other than the membar instruction, wherein the stores-after-launch counter is incremented for each store encountered while the processor is executing in execute-ahead mode, and wherein the stores-after-launch counter is not decremented after the stores-after-launch counter is initialized upon each entry to execute-ahead mode that is caused by an unresolved data dependency other than the membar instruction;

when all stores and loads that precede the membar instruction have been committed to memory from the store buffer and the load buffer, the execution mechanism is configured to enter a deferred mode, wherein the execution mechanism executes the deferred instructions including the membar instruction; and

if all deferred instructions are executed in the deferred mode, the mechanism is configured to return to the normal-execution mode to resume normal program execution from the point where the execute-ahead mode left off.

2. The apparatus of claim 1 , wherein the deferred queue is a FIFO structure.

3. The apparatus of claim 2 , wherein the execution mechanism is configured such that executing deferred instructions in the deferred mode involves:

issuing deferred instructions for execution in program order from the deferred queue;

deferring execution of deferred instructions that still cannot be executed because of unresolved data dependencies by placing these instructions in the deferred queue in program order; and

executing other deferred instructions that are able to be executed in program order.

4. The apparatus of claim 3 , wherein at the end of deferred mode, the execution mechanism is configured such that if some deferred instructions are deferred again, the execution mechanism returns to execute-ahead mode at the point where execute-ahead mode left off.

5. The apparatus of claim 1 , wherein when the membar instruction is deferred, a status indicator is set to tell the processor that the membar instruction has been deferred.

6. The apparatus of claim 5 , wherein the status indicator is cleared when the membar instruction completes.

7. The apparatus of claim 5 , wherein deferring a load or a store in execute-ahead mode involves generating a prefetch for the load or store.

8. The apparatus of claim 1 , wherein the execution mechanism is configured such that while executing instructions in the execute-ahead mode, the store buffer is gated so that stores that enter the store buffer during execute-ahead mode remain in the store buffer until the execution mechanism leaves the execute-ahead mode.

9. The apparatus of claim 1 , wherein the load buffer and the store buffer generate a signal to indicate that the buffered loads and stores that entered the load buffer and store buffer prior to the membar instruction have cleared.

10. The apparatus of claim 1 , wherein if a non-memory-dependent stall condition occurs while the processor is in execute-ahead mode, the execution mechanism is configured such that it immediately enters a scout mode wherein instructions are speculatively executed to prefetch future loads, but wherein results are not committed to the architectural state of the processor.

11. The apparatus of claim 1 , wherein the execution mechanism is configured such that if the membar instruction is encountered in execute-ahead mode when the stores-after-launch counter is non-zero, the execution mechanism immediately enters a scout mode, wherein instructions are speculatively executed to prefetch future loads, but wherein results are not committed to the architectural state of the processor.

12. A computer system for executing a membar instruction in an execute-ahead processor, wherein the membar instruction forces buffered loads and stores to complete before allowing any following loads or stores to complete, comprising:

a processor;

a memory;

an execution mechanism within the processor configured to issue instructions for execution in a normal-execution mode, and further configured to enter an execute-ahead mode if, while issuing instructions for execution in the normal-execution mode, an instruction cannot be executed because of an unresolved data dependency;

wherein while issuing instructions for execution in the execute-ahead mode, instructions that cannot be executed because of an unresolved data dependency are deferred by placing the instructions in a deferred queue, and non-deferred instructions are executed in program order;

wherein, upon encountering a membar instruction while issuing instructions for execution in the normal-execution mode, the execution mechanism is configured to determine if either a load buffer or a store buffer is non-empty and, if so, the execution mechanism is configured to:

defer the membar instruction by placing the membar instruction in the deferred queue;

execute subsequent instructions in the execute-ahead mode; and

defer all load and store instructions encountered by the execution mechanism in execute-ahead mode after deferring the membar instruction by placing these instructions in the deferred queue in program order following the membar instruction; and

wherein the execution mechanism is configured to initialize a stores-after-launch counter upon each entry to execute-ahead mode that is caused by an unresolved data dependency other than the membar instruction, wherein the stores-after-launch counter is incremented for each store encountered while the processor is executing in execute-ahead mode, and wherein the stores-after-launch counter is not decremented after the stores-after-launch counter is initialized upon each entry to execute-ahead mode that is caused by an unresolved data dependency other than the membar instruction;

when all stores and loads that precede the membar instruction have been committed to memory from the store buffer and the load buffer, the execution mechanism is configured to enter a deferred mode, wherein the execution mechanism executes the deferred instructions including the membar instruction; and

if all deferred instructions are executed in the deferred mode, the mechanism is configured to return to the normal-execution mode to resume normal program execution from the point where the execute-ahead mode left off.

13. A method for executing a membar instruction in an execute-ahead processor, wherein the membar instruction forces buffered loads and stores to complete before allowing any following loads or stores to complete, comprising:

issuing instructions for execution in a normal-execution mode;

if, while issuing instructions for execution in the normal-execution mode, an instruction cannot be executed because of an unresolved data dependency, entering an execute-ahead mode, wherein instructions that cannot be executed because of an unresolved data dependency are deferred by placing the instructions in a deferred queue, and wherein non-deferred instructions are executed in program order;

upon encountering a membar instruction while issuing instructions for execution in the normal-execution mode, determining if either a load buffer or a store buffer is non-empty and, if so, deferring the membar instruction by placing the membar instruction in the deferred queue and executing subsequent instructions in the execute-ahead mode;

deferring all load and store instructions encountered by the execution mechanism in execute-ahead mode after deferring the membar instruction by placing these instructions in the deferred queue in program order following the membar instruction;

initializing a stores-after-launch counter upon each entry to execute-ahead mode that is caused by an unresolved data dependency other than the membar instruction;

incrementing the stores-after-launch counter for each store encountered while the processor is executing in execute-ahead mode;

when all stores and loads that precede the membar instruction have been committed to memory from the store buffer and the load buffer during the execute-ahead mode, entering a deferred mode, wherein the processor executes the deferred instructions including the membar instruction; and

if all deferred instructions are executed in deferred mode, returning to the normal-execution mode to resume normal program execution from the point where the execute-ahead mode left off;

wherein the stores-after-launch counter is not decremented after the stores-after-launch counter is initialized upon each entry to execute-ahead mode that is caused by an unresolved data dependency other than the membar instruction.

14. The method of claim 13 , wherein the deferred queue is a FIFO structure.

15. The method of claim 13 , wherein executing deferred instructions in the deferred mode involves:

issuing deferred instructions for execution in program order from the deferred queue;

deferring execution of deferred instructions that still cannot be executed because of unresolved data dependencies by placing these instructions in the deferred queue in program order; and

executing other deferred instructions that are able to be executed in program order.

16. The method of claim 15 , wherein at the end of deferred mode, if some deferred instructions are deferred again, the method further comprises returning to execute-ahead mode at the point where execute-ahead mode left off.

Assignments (1)
MERGER AND CHANGE OF NAME Recorded Dec 16, 2015
From: ORACLE USA, INC.; SUN MICROSYSTEMS, INC.; ORACLE AMERICA, INC.
To: ORACLE AMERICA, INC.
Reel/Frame 037306/0268 →