# Patent

## Title
Lazy runahead operation for a microprocessor

## Abstract

Embodiments related to managing lazy runahead operations at a microprocessor are disclosed. For example, an embodiment of a method for operating a microprocessor described herein includes identifying a primary condition that triggers an unresolved state of the microprocessor. The example method also includes identifying a forcing condition that compels resolution of the unresolved state. The example method also includes, in response to identification of the forcing condition, causing the microprocessor to enter a runahead mode.

## Background
RELATED APPLICATION(S)
This application is a Continuation of co-pending, commonly owned U.S. application Ser. No. 13/708,645, filed Dec. 7, 2012, entitled “Lazy Runahead Operation for a Microprocessor,” to Rozas et al., which is hereby incorporated by reference herein in its entirety.


BACKGROUND
Instructions in microprocessors are often re-dispatched for execution one or more times due to pipeline errors or data hazards. For example, an instruction may need to be re-dispatched when an instruction refers to a value not present in the cache (e.g., a cache miss). Because it is not known whether other unpredicted stalls will arise due to other misses during resolution of that cache miss, the microprocessor may perform a runahead operation configured to detect other misses while the initial miss is being resolved. However, the calculations performed during runahead are often invalidated and repeated. Repeating these calculations after re-entry into normal operation mode may diminish microprocessor performance.
SUMMARY OF THE INVENTION
In a first method embodiment in accordance with the present invention, a method includes identifying, while in a normal mode of operation, a primary condition that triggers an unresolved state of a processor, and subsequent to the identifying, and prior to resolving said unresolved state, executing at least one instruction in a normal mode of operation.
In accordance with another method embodiment of the present invention, a method includes while in a normal mode of operation, identifying a primary condition that triggers an unresolved state of a processor. Responsive to the identifying, setting a primary condition tracker. Subsequent to the identifying, executing at least one instruction in a normal mode of operation. Subsequent to the executing at least one instruction in a normal mode of operation, encountering a forcing condition that compels resolution of the unresolved state. The method further includes entering a runahead mode of operation responsive to the encountering of the forcing condition, executing a plurality of instructions in the runahead mode, and clearing said primary condition tracker responsive to resolution of said primary condition.
In accordance with a further embodiment of the present invention, a processor includes primary condition logic configured to determine that execution of a first instruction in a normal mode of said processor causes a first condition, the first condition indicating a long latency unresolved state of the processor, execution logic configured to execute one or more additional instructions in said normal mode subsequent to the first instruction until executing a second instruction that causes a second condition, the second condition being a condition that requires a resolution of the unresolved state of the processor, and runahead control logic configured to transition the processor into a runahead operation responsive to the second condition.
In accordance with yet another method embodiment of the present invention, a method includes operating said processor in a normal operating mode and within said normal operating mode, encountering a first condition that results in an unresolved state of said processor, wherein said first condition comprises a long latency event, and responsive to said first condition, continuing to operate said processor in said normal operating mode while said unresolved state exists and wherein said continuing to operate said processor in said normal operating mode comprises executing processor instructions in said normal operating mode and storing results of said instructions. Subsequent to said executing said processor instructions in said normal operating mode, encountering a second condition that compels resolution of said unresolved state, and responsive to said encountering said second condition, entering said processor into a runahead operating mode.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 schematically shows an example of lazy runahead operation according to an embodiment of the present disclosure.
FIG. 2 schematically shows a microprocessor according to an embodiment of the present disclosure.
FIG. 3A shows a portion of a method for entering runahead in a lazy fashion according to an embodiment of the present disclosure.
FIG. 3B shows another portion of the method shown in FIG. 3A.



DETAILED DESCRIPTION
In modern microprocessors, architectural-level instructions are often executed in a pipeline. Such instructions may be issued individually or as bundles of micro-operations to various execution mechanisms in the pipeline. Regardless of the form that an instruction takes when issued for execution, when the instruction is issued, it is not known whether execution of the instruction will complete or not. Put another way, it is not known at dispatch whether a miss or an exception will arise during execution of the instruction.
A common pipeline execution stall that may arise during execution of an instruction is a store operation that results in a store miss. Put another way, a stall may result from a store request where there is no permission to store in the requested cache line (e.g., in a cache line having shared state, such as in a memory system shared by a plurality of processing units included in a microprocessor) or where the requested cache line is not present. Such store misses may trigger an entrance into a runahead mode of operation (hereafter referred to as “runahead”) that is configured to detect, for example, other cache misses (e.g., store misses and/or load misses), instruction- and/or data-translation lookaside buffer misses, or branch mispredicts while the store load miss is being resolved.
As used herein, runahead describes any suitable speculative execution scheme performed during a long-latency event that triggers an unresolved state in the microprocessor. It will be appreciated that the nature and identity of such long-latency events may vary. Another example of such events is a load miss where the resulting load event pulls the missing instruction or data from a slower access memory location. Also, some long-latency floating point operations, such as some denormal square root operations, may be configured to trigger a runahead mode. Once the runahead-triggering event is detected, the state of the microprocessor (e.g., the registers and other suitable states) may be checkpointed so that the microprocessor may return to that state after runahead. The microprocessor then continues executing in a working state during runahead. After the initial long-latency event is resolved, the microprocessor exits runahead and normal operation resumes.
In some settings, the microprocessor may enter runahead immediately upon detection of a long-latency event. However, some microprocessors may be able to operate in a normal mode after an event that would otherwise trigger runahead. For example, it may be possible to operate some microprocessors utilizing a somewhat relaxed memory consistency model in normal mode for a limited time even after the occurrence of a store miss or other suitable event that triggers an unresolved state in the microprocessor. Similarly, some microprocessors implementing a sequential consistency model via a transactional memory system may continue executing past a store miss in normal mode so long as the transaction is not committed until after store permission is received.
Because runahead operation is a speculative execution scheme, the values resulting from runahead operation are typically invalid and are discarded on re-entry to normal operation after runahead. Thus, it may speed execution of the instructions to avoid entry into runahead in some circumstances. For example, if the potential time savings that may be realized by uncovering other long-latency events does not offset the time cost of re-executing the instructions, it may be desirable to avoid or delay entering runahead. However, while entry into runahead may be delayed for a while, a stall or exception may result if at some point the microprocessor attempts to use or access the missing data while the state triggered by the long-latency event is unresolved. In such situations, it may be desirable to enter runahead operation. Unfortunately, it may be hard to determine when to enter runahead and avoid the exception because the instruction initially triggering the unresolved state may be long gone.
Accordingly, the embodiments described herein relate to methods and hardware configured to manage entry and exit of a microprocessor into a runahead mode in response to a forcing condition that compels resolution of an unresolved state triggered by a primary condition occurring prior to instantiation of the runahead mode. For example, an embodiment of a method for operating a microprocessor described herein includes identifying a primary condition that triggers an unresolved state of the microprocessor. As used herein, a primary condition refers to a condition that triggers a long-latency event at the microprocessor, where the long-latency event may remain unresolved while the microprocessor continues to operate in a normal operation mode. Put another way, a primary condition is a condition that allows a delayed, lazy entry into runahead instead of causing a prompt, eager entry into runahead. It will be appreciated that primary conditions may vary according to architectural specifics of the microprocessor. Non-limiting examples of primary conditions include store misses and long-latency and/or dynamic-latency floating point operations. In some embodiments, a load miss may be a primary condition.
The example method also includes identifying a forcing condition that compels resolution of the unresolved state. As used herein, a forcing condition refers to a condition that, upon occurrence, causes the microprocessor to stall if the primary condition is unresolved. For example, encountering a barrier instruction configured to order/synchronize microprocessor operation may trigger a stall while awaiting resolution of a store miss. Such barrier instructions may be used with relaxed memory consistency model microprocessors. In this example, the store miss would be the primary condition and the barrier operation would be the forcing condition. As another example, a long-latency floating point operation may be encountered; in this example, the operation may be considered the primary condition. Encountering a request for a use of a result of that long-latency floating point operation (e.g., in a subsequent floating point operation) may be the forcing condition. In yet another example, a load miss may be encountered (in this example, the primary condition), though runahead may be delayed until an attempt to use the loaded data is made (the forcing condition in this example). It will be appreciated that a forcing condition may be related to a plurality of primary conditions in some embodiments. In other words, the occurrence of a particular forcing condition may compel resolution of one or more or all of the primary conditions related to that forcing condition.
The example method also includes, in response to identification of the forcing condition, causing the microprocessor to enter a runahead mode. Thus, instead of stalling the microprocessor upon identification of the forcing condition, the microprocessor enters a runahead mode. As a result, the microprocessor may enter runahead in a lazy fashion, so that the microprocessor may continue to operate in normal mode past an event that triggers an unresolved state until resolution of that state is compelled by the forcing event. Accordingly, delaying entry into runahead may allow the microprocessor to perform those calculations that may be completed, so that the results of those calculations may not be lost, as might occur with prompt entry into runahead. Once those calculations are completed, the microprocessor may then enter runahead to resolve one or more runahead-triggering events, which may enhance performance. Further, in some embodiments the microprocessor may operate in runahead mode until the unresolved state becomes resolved, at which time the microprocessor may exit runahead and return to normal operation. Consequently, the microprocessor may spend less time in runahead compared to microprocessors that immediately enter runahead upon the occurrence of a condition that triggers an unresolved state.
FIG. 1 schematically shows an example operation scheme 100 depicting lazy runahead operation of a program comprising instructions 1-8 at a microprocessor. At 102, a store miss event occurs, the store miss event being identified as a primary condition. Instead of immediately entering runahead mode, however, the microprocessor continues to operate in normal mode, even though the store miss remains unresolved, until a barrier event is encountered at 104. The occurrence of the barrier event compels resolution of the store miss, and so, at 106, the microprocessor enters a runahead mode of operation. The microprocessor operates in runahead mode until the store miss is resolved at 108, when the microprocessor re-enters normal mode by replaying the barrier instruction. In some settings, delaying entry into runahead in this lazy fashion may enhance performance relative to examples where runahead commences at the occurrence of the store miss event. As shown in FIG. 1, at least a portion of the time spent resolving the store miss occurred during normal mode, so that the results of calculations performed during normal mode are not invalidated during restart after runahead.
FIG. 2 schematically depicts an embodiment of a microprocessor 200 that may be employed in connection with the systems and methods described herein. Microprocessor 200 variously includes processor registers 209 and may also include a memory hierarchy 210, which may include an L1 processor cache 210A, an L2 processor cache 210B, an L3 processor cache 210C, main memory 210D (e.g., one or more DRAM chips), secondary storage 210E (e.g., magnetic and/or optical storage units) and/or tertiary storage 210F (e.g., a tape farm). It will be understood that the example memory/storage components are listed in increasing order of access time and capacity, though there are possible exceptions.
A memory controller 210G may be used to handle the protocol and provide the signal interface required of main memory 210D and to schedule memory accesses. The memory controller can be implemented on the processor die or on a separate die. It is to be understood that the memory hierarchy provided above is non-limiting and other memory hierarchies may be used without departing from the scope of this disclosure.
Microprocessor 200 also includes a pipeline, illustrated in simplified form in FIG. 2 as pipeline 202. Pipelining may allow more than one instruction to be in different stages of retrieval and execution concurrently. Put another way, a set of instructions may be passed through various stages included in pipeline 202 while another instruction and/or data is retrieved from memory. Thus, the stages may be utilized while upstream retrieval mechanisms are waiting for memory to return instructions and/or data, engaging various structures such as caches and branch predictors so that other cache misses and/or branch mispredicts may potentially be discovered. This approach may potentially accelerate instruction and data processing by the microprocessor relative to approaches that retrieve and execute instructions and/or data in an individual, serial manner.
As shown in FIG. 2, pipeline 202 includes fetch logic 220, decode logic 222, scheduling logic 224, execution logic 226, and commit logic 228. Fetch logic 220 retrieves instructions from the memory hierarchy 210, typically from either unified or dedicated L1 caches backed by L2-L3 caches and main memory. Decode logic 222 decodes the instructions, for example by parsing opcodes, operands, and addressing modes. Upon being parsed, the instructions are then scheduled by scheduling logic 224 for execution by execution logic 226.
In some embodiments, scheduling logic 224 may be configured to schedule instructions for execution in the form of instruction set architecture (ISA) instructions. Additionally or alternatively, in some embodiments, scheduling logic 224 may be configured to schedule bundles of micro-operations for execution, where each micro-operation corresponds to one or more ISA instructions or parts of ISA instructions. It will be appreciated that any suitable arrangement for scheduling instructions in bundles of micro-operations may be employed without departing from the scope of the present disclosure. For example, in some embodiments, a single instruction may be scheduling in a plurality of bundles of micro-operations, while in some embodiments a single instruction may be scheduling as a bundle of micro-operations. In yet other embodiments, a plurality of instructions may be scheduling as a bundle of micro-operations. In still other embodiments, scheduling logic 224 may schedule individual instructions or micro-operations, e.g., instructions or micro-operations that do not comprise bundles at all.
As shown in FIG. 2, the depicted embodiment of pipeline 202 includes execution logic 226 that may include one or more execution mechanism units configured to execute instructions issued by scheduling logic 224. Any suitable number and type of execution mechanism units may be included within execution logic 226. Once processed by execution logic 226, completed instructions may be stored in preparation for commitment by commit logic 228. Commit logic 228 alters the architectural state of microprocessor 200 by committing completed instructions to memory. Put another way, commit logic 228 performs writeback functionality for microprocessor 200.
The embodiment of microprocessor 200 shown in FIG. 2 depicts runahead control logic 230. Runahead control logic 230 controls entry to and exit from runahead mode for microprocessor 200. In some embodiments, runahead control logic 230 may also control memory operations related to entry and exit from runahead. For example, on entry to runahead, portions of microprocessor 200 may be checkpointed to preserve the state of microprocessor 200 while a non-checkpointed working state version of microprocessor 200 speculatively executes instructions during runahead. In some of such embodiments, runahead control logic 230 may restore microprocessor 200 to the checkpointed state on exit from runahead.
The embodiment of microprocessor 200 shown in FIG. 2 also includes primary condition logic 232 configured to identify a primary condition that triggers an unresolved state in the microprocessor. While the embodiment shown in FIG. 2 depicts primary condition logic 232 as an entity separate from other portions of microprocessor 200 for clarity, it will be appreciated that some or all of the functions of primary condition logic 232 may be distributed among suitable portions of microprocessor 200.
It will be appreciated that primary condition logic 232 may track any suitable number of primary conditions. In the embodiment shown in FIG. 2, primary condition logic 232 includes one or more primary condition logic subsystems 234 that detect and track various primary conditions. For example, in some embodiments, each primary condition logic subsystem 234 may detect and track a particular primary condition (e.g., based on an identifier) or a particular type of primary condition. Further, in some embodiments, each primary condition logic subsystem 234 may have a preselected primary condition or primary condition type with which it is associated. Alternatively, in some embodiments, primary condition logic 232 may perform all of the functions of individual primary condition logic subsystems 234, so that primary condition logic subsystems 234 are omitted.
As shown, primary condition logic subsystem 234 includes a primary condition detector 236, a primary condition tracker 238, a primary condition tracking register 239, a primary condition active status bit 240, and a counter 241.
As shown in FIG. 2, primary condition logic 232 operatively communicates with pipeline 202, so that primary condition logic 232 may receive microprocessor event information from portions of pipeline 202. It will be understood that primary condition logic 232 may be in operative communication with any suitable portion of microprocessor 200. In some embodiments, primary condition logic 232 may receive microprocessor event information from other portions of microprocessor 200 via operative communication links not shown in FIG. 2.
Primary condition detector 236 is configured to detect and identify a primary condition. For example, primary condition detector 236 may filter microprocessor events obtained from a load/store unit to identify a predetermined primary condition such as a store miss. Upon detection of the primary condition, primary condition logic subsystem 234 is operative to send a primary condition signal to forcing condition logic 242 (described below) and to cause primary condition tracker 238 to start tracking the primary condition. In some embodiments, primary condition tracker 238 may track the primary condition using information about the microprocessor event related to the primary condition as detected via event filtration. For example, primary condition tracking register 239 may comprise a register configured to store information about the primary condition such as a primary condition identifier (e.g., a transaction identifier, a cache location identifier, or a pointer identifier) or a primary condition type (e.g., a store miss, a floating point operation, etc.).
In some embodiments, primary condition logic subsystem 234 may track resolution of the primary condition via active status bit 240. For example, upon detection of the primary condition, primary condition logic subsystem 234 may set active status bit 240 to indicate that a particular primary condition is actively being tracked. Once the primary condition is resolved, primary condition logic active status bit 240 may be set to indicate an inactive status.
In some embodiments, primary condition logic subsystem 234 may track resolution of one or more primary conditions via a counter 241. For example, the occurrence of a store miss may increase a value held in counter 241, while resolution of a store miss may decrease the value held in counter 241. In turn, microprocessor 200 may enter runahead if the value held in counter 241 exceeds a preselected threshold value when a related forcing condition is encountered. It will be appreciated that, if included, counter 241 may be configured to track a single type of primary condition and/or may be configured to track a plurality of types of primary conditions concurrently. While the embodiment shown in FIG. 2 depicts counter 241 as being included within primary condition logic subsystem 234, it will be appreciated that the functionality provided by counter 241 may be included in any suitable portion of microprocessor 200 (e.g., forcing condition logic 242, runahead control logic 230, etc.) and/or may be distributed among various portions of microprocessor 200 described herein.
As shown in FIG. 2, primary condition logic 232 is in operative communication with forcing condition logic 242. While the embodiment shown in FIG. 2 depicts forcing condition logic 242 as an entity separate from other portions of microprocessor 200 for clarity, it will be appreciated that some or all of the functions of forcing condition logic 242 may be distributed among suitable portions of microprocessor 200.
Forcing condition logic 242 is configured to receive a primary condition signal from primary condition logic 232. In some embodiments, the primary condition signal may include information about the primary condition, such as an event type or a primary condition identifier. Such information may assist the forcing condition logic with tracking the primary condition. Alternatively, in some embodiments, the primary condition logic may be an on/off signal.
As shown in FIG. 2, forcing condition logic 242 also operatively communicates with pipeline 202 to receive microprocessor event information related to the forcing condition from suitable portions of pipeline 202. It will be understood that forcing condition logic 242 may also be in operative communication with any suitable portion of microprocessor 200 to receive microprocessor event information related to the forcing condition. In some embodiments, forcing condition logic 242 may receive microprocessor event information from other portions of microprocessor 200 via operative communication links not shown in FIG. 2.
In the depicted embodiment, forcing condition logic 242 includes one or more forcing condition logic subsystems 244. Forcing condition logic subsystem 244 is configured to monitor and, in some embodiments, track one or more primary conditions and to identify a forcing condition that compels resolution of the unresolved state for those primary conditions. It will be appreciated that forcing condition logic 242 may track any suitable number of forcing conditions and monitor any suitable number of primary conditions in any suitable way. In some embodiments, each forcing condition logic subsystem 244 may detect a forcing condition and monitor a particular primary condition (e.g., based on an identifier) or a particular type of primary condition. Further, in some embodiments, each forcing condition logic subsystem 244 may have a preselected forcing condition or forcing condition type with which it is associated. Alternatively, in some embodiments, forcing condition logic 242 may perform all of the functions of individual forcing condition logic subsystems 244, so that forcing condition logic subsystems 244 are omitted.
In the embodiment shown in FIG. 2, forcing condition logic subsystem 244 includes a primary condition collector 246, a forcing condition detector 248, a forcing condition tracker 250, a forcing condition tracking register 252, and a forcing condition active status bit 253. Primary condition collector 246 receives primary condition signals received from primary condition logic 232. In some embodiments where a single primary condition signal is received, primary condition collector 246 may be a wire-like connection. In some embodiments where a plurality of primary condition signals are received, primary condition collector 246 may include logic adapted to determine when preselected primary condition criteria are met. For example, primary condition collector 246 may implement logic so that each of a plurality of primary conditions is received prior to enabling the forcing condition detector. Such logic may represent conditions that, if present, would cause the microprocessor to stall upon the occurrence of the forcing condition. Thus, if the conditions are not all present when the forcing condition occurs, the microprocessor may not stall and runahead may be avoided, potentially speeding operation.
Forcing condition detector 248 identifies a forcing condition from microprocessor event information. For example, forcing condition detector 248 may filter microprocessor events obtained from scheduling logic 224 to identify a forcing event associated with a primary condition. In one non-limiting example, a barrier event associated with a store miss event may result in the identification of a forcing condition. Upon identification of the forcing condition and receipt of the primary condition signal, forcing condition logic subsystem 244 sends a runahead condition signal to runahead control logic 230 so that microprocessor 200 may enter runahead.
In some embodiments, forcing condition tracker 250 may track the primary condition using information about the microprocessor event related to the primary condition being tracked. For example, forcing condition tracking register 252 may store a primary condition identifier (e.g., a transaction identifier, a cache location identifier, or a pointer identifier) or a primary condition type (e.g., a store miss, a floating point operation, etc.) received with a primary condition signal.
In some embodiments, forcing condition logic subsystem 244 may track resolution of the primary condition via active status bit 253. For example, upon receipt of a primary condition signal, forcing condition logic subsystem 244 may set active status bit 253 to indicate that a particular primary condition is unresolved.
It will be understood that the above stages shown in pipeline 202 are illustrative of a typical RISC implementation, and are not meant to be limiting. For example, in some embodiments, the fetch logic and the scheduling logic functionality may be provided upstream of a pipeline, such as compiling VLIW instructions or code-morphing. In some other embodiments, the scheduling logic may be included in the fetch logic and/or the decode logic of the microprocessor. More generally a microprocessor may include fetch, decode, and execution logic, each of which may comprise one or more stages, with mem and write back functionality being carried out by the execution logic. The present disclosure is equally applicable to these and other microprocessor implementations, including hybrid implementations that may use VLIW instructions and/or other logic instructions.
In the described examples, instructions may be fetched and executed one at a time, possibly requiring multiple clock cycles. During this time, significant parts of the data path may be unused. In addition to or instead of single instruction fetching, pre-fetch methods may be used to enhance performance and avoid latency bottlenecks associated with read and store operations (e.g., the reading of instructions and loading such instructions into processor registers and/or execution queues). Accordingly, it will be appreciated that any suitable manner of fetching, scheduling, and dispatching instructions may be used without departing from the scope of the present disclosure.
FIGS. 3A and 3B show an embodiment of a method 300 for causing a microprocessor to enter into and operate in runahead in a lazy fashion. It will be appreciated that embodiments of method 300 may be used to operate any suitable microprocessor in runahead without departing from the scope of the present disclosure.
As shown in FIG. 3A, method 300 includes, identifying, at primary condition logic, a primary condition that triggers an unresolved state in the microprocessor at 302. It will be appreciated that any suitable number of primary conditions may be identified. For example, in some embodiments, a plurality of primary conditions may be identified at 302. In some embodiments, identifying the primary condition at 302 may include identifying a primary condition type associated with the primary condition. For example, the primary condition logic may identify the primary condition as being store miss type in one scenario. Identifying the type of primary condition may assist with tracking the source of the primary condition in embodiments where the primary condition logic identifies and tracks more than one primary condition concurrently.
In some embodiments, identifying the primary condition at 302 may include filtering microprocessor events according to one or more predetermined unresolved state triggering events. By filtering the events, the microprocessor may be able to discriminate among various types of events that may lead to stalls later on and identify a particular microprocessor event associated with a selected primary condition. For example, a plurality of microprocessor events may be filtered according to a lazy runahead policy that includes predetermined events related to respective primary conditions. In one scenario, a lazy runahead policy may include filtering criteria configured to ignore prefetch store misses and capture share-permission store misses. Upon the occurrence of an unpermitted store event at a cache location, the primary condition logic may determine that a share-permission store miss primary condition has occurred.
Upon identification of the primary condition, method 300 includes, at 304, initializing a tracker configured to track a status of the unresolved state. For example, the primary condition logic may set an active status bit that indicates whether the primary condition is unresolved. In some embodiments, the primary condition logic may track the primary condition by an event type and/or a primary condition identifier.
Once the primary condition has been identified, method 300 includes, at 306, sending a primary condition signal indicating the occurrence of the primary condition from the primary condition logic to forcing condition logic configured to identify the forcing condition and, at the forcing condition logic, collecting one or more primary condition signals received from the primary condition logic. In some embodiments, the primary condition signal may include status information about the primary condition (e.g., whether the primary condition is resolved). For example, the primary condition logic may enable a primary condition signal to the forcing condition logic while the primary condition is unresolved and disable the primary condition signal upon resolution of the primary condition. It will be appreciated that, when sent, the primary condition signal may be updated and/or transmitted continuously or at any suitable interval without departing from the scope of the present disclosure.
Additionally, in some embodiments, the signal may include information about the primary condition, such as an event type and/or a primary condition identifier that may be used to match a particular primary condition to a forcing condition associated with that primary condition. For example, a transaction identifier associated with a store miss event may be used to match the primary condition for that store miss event to a forcing condition. As another example, a store miss type (e.g., unavailable vs. permission upgrade) may be used to match the associated primary condition with a forcing condition.
At 308, method 300 includes, at the forcing condition logic, identifying a forcing condition that compels resolution of an unresolved state associated with a particular primary condition. Identification of the forcing condition may be performed based on any suitable criteria for associating one or more primary conditions with a forcing condition that compels resolution of those primary conditions. In some embodiments, the forcing condition may be identified according to primary condition identifier and/or event type information as described above.
In some embodiments, identifying the forcing condition at 308 may include filtering microprocessor events according to one or more predetermined forcing condition events. By filtering the microprocessor events, the forcing condition logic may discriminate among various microprocessor events that may lead to a stall if the primary condition(s) associated with those events is unresolved. For example, a plurality of microprocessor events may be filtered according to a lazy runahead policy comprising filtering criteria configured to identify a forcing condition. In one scenario, a forcing condition may be identified when a barrier event that will cause the microprocessor to stall if a share-permission store miss primary condition is unresolved.
It will be appreciated that any suitable number of forcing conditions may be identified that are associated with respective primary conditions. For example, another forcing condition related to an unresolved state triggered by another primary condition may be identified, where the other forcing condition compels resolution of the other primary condition.
Upon the occurrence of the forcing condition and the existence of one or more unresolved primary conditions associated with that forcing condition (e.g., one or more primary conditions for which the forcing condition compels resolution to continue normal operation of the microprocessor), the microprocessor may enter runahead. Thus, at 310, method 300 includes, in response to the occurrence of the forcing condition and the unresolved status of the one or more primary conditions associated with that forcing condition, sending a runahead control signal to the runahead control logic. In response, method 300 includes, at 312, causing the microprocessor to enter into a runahead mode responsive to identification of the forcing condition.
Turning to FIG. 3B, method 300 includes, at 314, tracking the status of the unresolved state associated with a particular primary condition at the primary condition logic. In some embodiments, the unresolved state for a given primary condition may be tracked according to a primary condition identifier and/or a primary condition type. For example, a transaction identifier associated with a store miss may be associated to a preselected value upon resolution of the store miss, so that the value associated with the transaction identifier can be used to determine resolution of the unresolved state and the identifier may be used to distinguish that specific primary condition from other primary conditions that may remain unresolved. By tracking the status using an identifier, the primary condition logic may update the forcing condition logic about the status of the unresolved state triggered by the particular primary condition associated with that identifier. In turn, the forcing condition logic may make determinations about whether to exit runahead at the transaction level.
As another example, a value associated with a store miss type of primary condition may be adjusted in response to resolution of the store miss, so that the value may be used to determine resolution and the type may be used to distinguish resolution of one type of primary condition from other types of primary conditions. In some embodiments, such a value may be adjusted by a counter that may track more than one type of primary condition concurrently. For example, the occurrence of a store miss may cause the counter to increase the value, while the resolution of a store miss causes the counter to decrease the value. The primary condition signal sent to the forcing condition logic may include the value and updates to the value. In turn, the occurrence of a forcing condition related to a store miss type of primary condition while the value is greater than zero may cause the microprocessor to enter runahead, while the occurrence of a forcing condition while the value is zero would not. While this approach may not provide detail at the memory transaction-level granularity to the forcing condition logic, it may provide type-specific detail while conserving memory within the primary condition logic.
In some embodiments where a single forcing condition logic subsystem receives information about more than one type of primary condition from a single primary condition logic subsystem, the forcing condition logic subsystem may track the status of the underlying primary conditions. Thus, in some of such embodiments, method 300 may include, at 316, tracking the primary condition at the forcing condition logic. In some of such embodiments, the primary condition may be tracked using the status of the signal received from the primary condition logic. For example, resolution of one or more primary conditions may cause respective primary condition signals to be de-asserted. In some of such embodiments, the primary condition may be tracked according to a primary condition identifier or a primary condition type.
At 318, method 300 includes determining a resolution of one or more of the unresolved states at the primary condition logic, and, at 320, signaling the forcing control logic that those primary conditions have been resolved. For example, upon the resolution of a store miss, the primary condition logic may signal the forcing condition logic that the store miss condition has been resolved by de-asserting the primary condition signal to the forcing condition logic.
In some embodiments, method 300 may include, at 322, determining whether resolution of those primary conditions permits the microprocessor to exit runahead. This may permit exit from runahead upon the resolution of at least one of a plurality of unresolved states, potentially allowing an early exit from runahead. It will be appreciated that such determinations may be based upon any suitable criteria, including primary condition type, order of occurrence, and so on. For example, if a store miss primary condition is resolved even though a long-latency square root operation primary condition remains unresolved, the forcing condition logic may determine that the microprocessor may exit runahead. If the forcing control logic determines that the microprocessor may exit runahead, method 300 comprises sending a signal from the forcing control logic to the runahead control logic that the microprocessor may exit runahead at 324. In some embodiments, sending the signal may include signaling the runahead control logic that the unresolved state has been resolved. At 326, method 300 includes causing the microprocessor to exit runahead mode. If it is judged that the microprocessor is to remain in runahead despite the resolution of the one or more unresolved, the microprocessor remains in runahead.
It will be appreciated that, in some embodiments, the microprocessor may remain in runahead even after resolution of one of a plurality of unresolved states. This may provide an approach to extend runahead operation. Decisions to extend runahead operation may be based on any suitable criteria, such as primary condition type. In some embodiments, a decision to extend runahead operation may include consideration of the occurrence of conditions during runahead that might trigger runahead. For example, if runahead operation uncovers a branch mispredicts or a cache load miss, runahead operation may be extended until such conditions are resolved. As another example, a primary condition may occur during non-runahead operation while a forcing condition related to that primary condition may be encountered during runahead operation. As yet another example, a primary condition and a forcing condition related to that primary condition may be initiated during non-runahead operation, but detection of long-latency nature of the primary condition may not occur until the microprocessor is in runahead operation. In such examples, runahead may be extended until the underlying primary condition is resolved.
Once all of the unresolved states have been resolved, the microprocessor exits runahead. In the embodiment shown in FIG. 3B, method 300 includes, at 328, determining at the primary control logic that all of the unresolved states are resolved and, at 330, sending a signal to the forcing control logic that all of the unresolved states are resolved. At 332, method 300 comprises, at the forcing control logic, sending a signal to the runahead control logic that the microprocessor may exit runahead. In some embodiments, sending the signal may include signaling the runahead control logic that the unresolved state has been resolved. At 334, method 300 includes causing the microprocessor to exit runahead mode.
It will be appreciated that methods described herein are provided for illustrative purposes only and are not intended to be limiting. Accordingly, it will be appreciated that in some embodiments the methods described herein may include additional or alternative processes, while in some embodiments, the methods described herein may include some processes that may be reordered or omitted without departing from the scope of the present disclosure. Further, it will be appreciated that the methods described herein may be performed using any suitable hardware including the hardware described herein.
This written description uses examples to disclose the invention, including the best mode, and also to enable a person of ordinary skill in the relevant art to practice the invention, including making and using any devices or systems and performing any incorporated methods. The patentable scope of the invention is defined by the claims, and may include other examples as understood by those of ordinary skill in the art. Such other examples are intended to be within the scope of the claims.

## Claims

1. A method comprising:
while in a normal mode of operation, identifying a primary condition caused by a first instruction that triggers an unresolved state of a processor; and
subsequent to the identifying, and prior to resolving said unresolved state, starting and completing execution of a second instruction in a normal mode of operation.

2. The method of claim 1 further comprising:
subsequent to the starting and completing execution of said second instruction in a normal mode of operation, identifying a forcing condition that compels resolution of the unresolved state; and
entering a runahead mode of operation responsive to the identifying of the forcing condition.

3. The method of claim 2 further comprising executing instructions in said runahead mode until said forcing condition is resolved.

4. The method of claim 3 further comprising exiting said runahead mode responsive to resolving said forcing condition.

5. The method of claim 2 further comprising exiting said runahead mode responsive to resolving said unresolved state.

6. The method of claim 2 further comprising:
subsequent to the identifying the primary condition, second identifying a second primary condition that triggers an unresolved state of a processor; and
subsequent to the second identifying, executing at least one instruction in a normal mode of operation.

7. The method of claim 1, further comprising tracking a status of the unresolved state using a primary condition identifier associated with the primary condition, wherein said primary condition is a long latency event.

8. A method comprising:
while in a normal mode of operation, identifying a primary condition that triggers an unresolved state of a processor;
responsive to the identifying, setting a primary condition tracker;
subsequent to the identifying, executing at least one instruction in a normal mode of operation;
subsequent to the executing at least one instruction in a normal mode of operation, encountering a forcing condition that compels resolution of the unresolved state;
entering a runahead mode of operation responsive to the encountering of the forcing condition;
executing a plurality of instructions in the runahead mode; and
clearing said primary condition tracker responsive to resolution of said primary condition.

9. The method of claim 8 wherein said primary condition tracker tracks the primary condition via an identifier associated with the primary condition.

10. The method of claim 8 wherein said primary condition tracker tracks the primary condition via a condition type associated with the primary condition.

11. The method of claim 8 further comprising:
exiting the runahead mode responsive to resolving the forcing condition prior to resolution of the primary condition, wherein said primary condition is a long latency event.

12. The method of claim 8 further comprising:
exiting the runahead mode responsive to resolving the unresolved state.

13. The method of claim 8 wherein said primary condition tracker is operable to track more than one primary condition.

14. The method of claim 8 wherein said identifying a primary condition further comprises identifying the primary condition by filtering microprocessor events according to one or more predetermined unresolved state triggering events to identify a particular microprocessor event associated with the primary condition.

15. A processor comprising:
primary condition logic configured to determine that execution of a first instruction in a normal mode of said processor causes a first condition, the first condition indicating a long latency unresolved state of the processor;
execution logic configured to execute one or more additional instructions in said normal mode subsequent to the first instruction until executing a second instruction that causes a second condition, the second condition being a condition that requires a resolution of the unresolved state of the processor; and
runahead control logic configured to transition the processor into a runahead operation responsive to the second condition.

16. The processor of claim 15 wherein said runahead control logic is further configured to operate said processor in said runahead operation until said forcing condition is resolved.

17. The processor of claim 15 wherein said runahead control logic is further configured to operate said processor in said runahead operation until said unresolved state is resolved.

18. The processor of claim 15 wherein said runahead control logic is further configured to operate said processor in said runahead operation after resolution of said second condition and prior to resolution of said unresolved state.

19. The processor of claim 15 further comprising tracking logic configured to track the status of the unresolved state using a primary condition identifier associated with the primary condition.

20. The processor of claim 19 wherein said primary condition logic is further configured to identify the primary condition by filtering processor events according to one or more predetermined unresolved state triggering events to identify a particular processor event associated with the primary condition.

21. A method of operating a processor, said method comprising:
operating said processor in a normal operating mode and within said normal operating mode, encountering a first condition that results in an unresolved state of said processor, wherein said first condition comprises a long latency event;
responsive to said first condition, continuing to operate said processor in said normal operating mode while said unresolved state exists and wherein said continuing to operate said processor in said normal operating mode comprises executing processor instructions in said normal operating mode and storing results of said instructions;
subsequent to said executing said processor instructions in said normal operating mode, encountering a second condition that compels resolution of said unresolved state; and
responsive to said encountering said second condition, entering said processor into a runahead operating mode.

22. A method as described in claim 21 further comprising, responsive to said entering said processor into said runahead operating mode, checkpointing a state of said processor.

23. A method as described in claim 21 wherein said second condition comprises a condition that, upon occurrence, causes said processor to stall if the first condition remains unresolved and if the processor remains in the normal operating mode.

24. A method as described in claim 21 further comprising exiting said runahead operating mode and entering said normal operating mode responsive to resolving said unresolved state of said processor.

25. A method as described in claim 24 further comprising maintaining said results of said instructions subsequent to said entering said normal operating mode.

26. A method as described in claim 21 further comprising committing said instructions to memory.