WO2010053837A2 - Optimizing performance of instructions based on sequence detection or information associated with the instructions - Google Patents
Optimizing performance of instructions based on sequence detection or information associated with the instructions Download PDFInfo
- Publication number
- WO2010053837A2 WO2010053837A2 PCT/US2009/062736 US2009062736W WO2010053837A2 WO 2010053837 A2 WO2010053837 A2 WO 2010053837A2 US 2009062736 W US2009062736 W US 2009062736W WO 2010053837 A2 WO2010053837 A2 WO 2010053837A2
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- instruction
- copy
- incoming
- sequence
- code
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30145—Instruction analysis, e.g. decoding, instruction word fields
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/30032—Movement instructions, e.g. MOVE, SHIFT, ROTATE, SHUFFLE
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/3004—Arrangements for executing specific machine instructions to perform operations on memory
- G06F9/30043—LOAD or STORE instructions; Clear instruction
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/3017—Runtime instruction translation, e.g. macros
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30181—Instruction operation extension or modification
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/32—Address formation of the next instruction, e.g. by incrementing the instruction counter
- G06F9/322—Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address
- G06F9/325—Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address for loops, e.g. loop detection or loop counter
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3854—Instruction completion, e.g. retiring, committing or graduating
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3854—Instruction completion, e.g. retiring, committing or graduating
- G06F9/3856—Reordering of instructions, e.g. using queues or age tags
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3854—Instruction completion, e.g. retiring, committing or graduating
- G06F9/3858—Result writeback, i.e. updating the architectural state or memory
Definitions
- the processor provides instructions tuned for efficient implementation of copy or store operations. Optimized software for memory copy operations is tuned for a specific processor implementation. In many cases, the optimal way for performing the data copy is changing, and the code serves as a moving target for compiler, operating system (OS) kernel and application writers, which are forced to use multiple proliferations tuned for the different scenarios, different micro- architectures and so forth.
- OS operating system
- An iterative copy instruction can be used to copy a certain amount of data elements as specified by one of the instruction's parameters. Iterative copy operations may have different native data element lengths, such as byte, word double word, quad word, etc. The longer the native length is, the instruction may be more efficient in moving a quanta of data since it may use larger 'load' and 'store' operations. For example, in Intel® Architecture (IA32) architecture a repeat move byte (REP MOVSB) instruction uses the value in a given register as indicator of the length of the copy. In addition, the instruction receives source pointer and destination pointer as input parameters. Such instruction is defined to move one byte of data 'one at a time'.
- IA32 Intel® Architecture
- REP MOVSB repeat move byte
- the instruction's implementation may switch to a 'fast mode' where the operations are performed using longer operations (e.g., 16-bytes at a time).
- longer operations e.g. 16-bytes at a time.
- the IA32 programmer's reference manual defines the conditions in which such fast-mode may be executed in current processors.
- one solution for improving the efficacy of the copy operations with prior implementations of the iterative copy operations is to use a first iterative copy instruction that moves the majority of the string followed by a second iterative copy instruction that moves the remainder of the data (e.g., first copy operation moved double word at a time and second copy the last 0-3 bytes).
- Such sequence has two drawbacks: (a) the second instructions cost additional cycles that are always paid even when the remainder is zero; and (b) the optimization is tuned for a specific length of the first iterative copy instruction followed by only a limited sequence of instructions for the second; any other combination will cause a significant performance loss.
- branch predictors require time for training (building the history), have high costs (as much state needs to be saved), and their performance under flaky patterns is uncertain.
- FIG. 1 is a flow diagram of a method in accordance with one embodiment of the present invention.
- FIG. 2 is a block diagram of a sequence detector in accordance with one embodiment of the present invention.
- FIG. 3 is a state diagram of an example of a sequence decoder state machine in accordance with one embodiment of the present invention.
- FIG 4 is a block diagram of a processor in accordance with one embodiment of the present invention.
- FIG. 5 is a block diagram of a system in accordance with an embodiment of the present invention.
- properties of compiler-generated copy operations may be used to perform iterative copy operations more efficiently.
- copy operations is used as a generic term for memory copy, memory move and memory set operations that move data within, into or out of memory. Different environments may use different names for these generic operations.
- a 'fast mode' of these copy operations can be performed in many instances. Even when unavailable (e.g., when an alias ing-risk- test fails), in many cases (assuming random distribution) a mode faster than a native mode, in which a single data element is copied at a time, can still be performed.
- a processor instruction set may include one or more instructions to direct the processor to perform memory copy or memory set (store) operations which when implemented efficiently, can allow the processor hardware to keep its performance edge across different micro-architectural and architectural generations.
- one embodiment may include several main steps (described in details below), including the following: (1) performing checks for the rules required for starting the 'fast copy' and set up operations for later steps; (2) a head portion where conditional copies are done (to cover latency of the pipeline to prevent bubbles caused by propogation using conditional operations); (3) a fast fixed size iteration with flavors for handling interesting cases; and (4) a tail portion.
- the checks and the head portions are executed for all string lengths (i.e., copy length or block length). Note the head portion is executed in case all the checks pass; otherwise the hardware enters the native loop, which performs the copy operation at their native size one at a time.
- the fast loop and tail part are executed as needed depending on the copies' length as analyzed in the head portion. By making the decision early, the execution path may be selected with minimal pipeline bubbles and no branch miss predicts. There can be some additional restrictions applied for some of the lengths' or src-dst distance handling, such as in the 'fast loop' in some implementations there can be a non-accurate exception detection that will require re-executing some of the operations, for allowing going back up to 64B, in addition to the checks done at the head, a check needs to be done to see if destination point is no more than 63B behind the source pointer (i.e., (dst mod 4K) - (src mod 4K) ⁇ 63B ) .
- Method 100 can be performed in various locations of a processor such as a general-purpose or dedicated hardware unit. Method 100 may be used to perform iterative copy operations in an optimized manner. As shown in FIG. 1, method 100 may begin by performing checks and preparing for the copy operations (block 110). More specifically, various checks may be performed to determine the type of copy operations to be performed, as well as initializing various counters associated with the copy operations by loading into the counters various count values for use in the copy operations. First, several checks may be performed to determine if a fast flow, in which the copy operation is performed using load/store operations that are longer than native length of the instruction, can be executed.
- a native mode loop is executed, in which copy operations are done using a native length of the instruction, e.g., byte for byte move operations or double word for double word instructions (block 120).
- a native length of the instruction e.g., byte for byte move operations or double word for double word instructions (block 120).
- the checks use data obtained at the execution phase, where the information needed is already available and known. If any of the checks fail, a miss-speculation cost may occur along with the associated performance hit, however it is a rare case in the common use and the relative loss is also low due to the cost of the native loop.
- preparation for a fast loop may also be performed.
- this may include calculating a counter for the fast CL loop (for example if the length is specified in rex register in bytes, and each loop operates on 64 bytes, the number of iterations is calculated using rcx/64) and loading it to a zero overhead counter register (assuming that the "head" part copies up to 64B of data as to be discussed later and the counter is decremented by 1 when jumping into the fast loop 110).
- a constant may need to be subtracted from the rcx/64 calculation.
- the tail condition is calculated and placed in a zero overhead jump control register. If any of the checks fail, control passes to block 120, where the copy may be performed in native mode. In various embodiments, this native node can be used to perform the copy operation according to the native length mode, after which method 100 may conclude. Thus where the conditions needed for bunching copy operations are not met, the native length is used for each copy iteration (e.g., 1 byte per iteration for a repeat move byte instruction (REP MOVSB) case) using a zero overhead loop.
- REP MOVSB repeat move byte instruction
- a head portion of the copy operation may be performed. More specifically, a conditional load/store which can handle any length up to a predetermined amount of data, e.g., 64 bytes may be performed. As will be described herein, in one such embodiment up to eight copy operations may be performed to copy the up to 64 bytes. More specifically, if the checks at block 110 pass, at this point the processor knows that copy operations that are longer than the native copy length can be executed without impacting the correctness of the result.
- the copy operation is being using a 'conditional' operation, where each conditional copy of length 'N' bytes will be executed if the remaining length has at least 'N' bytes in it.
- the condition is checked at execute time, thus it does not depend in propagation of the length information from the execute back to decode stage.
- each iteration will increment by 'N' the src and dst pointers to be used by the subsequent operation and will decrement the remaining length by 'N'.
- the number of copy operations is set to allow the preparations done in the 'check' step (block 110) to propagate in the pipeline so that no penalty will be taken on them when they come to turn and be used at the decode stage.
- the time it takes for the 'load zero overhead counter' or 'zero over head branch condition' to go from decode to finishing execution - which is the window in which the conditional operations are decoded and executed and equal to the depth of the pipe from decode to execute.
- the copy sequence may be performed using a sequence of power of two lengths (which can be referred to as a power of two tree) as follows: 1, 1, 2, 4, ...
- N/2, N, N, N N.
- N 16 and assuming that the processor requires 8 operations to cover the pipeline delay, the sequence will be 1, 1, 2, 4, 8, 16, 16, 16; which gives a maximal copy of 64B.
- the sequence will be 1, 1, 2, 4, 8, 16, 16, 16; which gives a maximal copy of 64B.
- there is a subset of the above operations that can move exactly that amount of data e.g., to move 3 byte the 1 and 2 should be executed, or to move 10 byte the 2 and 8 should be executed).
- N 32 and 8 operations are needed to cover the pipeline delay, the sequence will be 1, 1, 2, 4, 8, 16, 32, 32, which amount to 96B.
- the sequence of operations is actually executed in reverse order to the above list (e.g., 16, 16, 16, 8, 4, 2, 1, 1) to simply generating the sub-set of the operations required for correctly copying any number of bytes in the range of 0 to 64B by the head portion of block 130. This is done by making the condition look at the remainder of the length and if Remainder Length - N > 0 the operation is done, otherwise it is skipped. The Remainder Length is updated after each copy operation with the length of the operation.
- the above list e.g., 16, 16, 16, 8, 4, 2, 1, 1
- a multiple way decision is taken using the counter, loop type selected and conditions prepared in block 110. More specifically, if the zero overhead counter value is equal or greater than 1, the counter is decremented by 1 and the Fast Loop of block 140 is performed, otherwise if a tail condition is true (i.e., the remaining number of bytes is less than 64 but greater than zero), the tail portion is performed at block 135, otherwise, if no additional data is to be copied, method 100 concludes.
- This is a fast loop that handles copy operations of a pre-defined length in the pre-loaded zero-overhead loop counter.
- a couple of checks are done that when hit will take a miss predict penalty (but will allow 'faster execution' in the cases where it happens).
- there can be an additional pointer's distance check performed this may be required if limitations of the Fast Loop are more stringent than those in the conditional copy in the head.
- a Fast Loop that does not keep track of its progress may need to re-execute from its beginning, which calls for a check of ((src mod 4K) - (dst mod 4K)) > 63 B in addition to all checks done before.
- NT_threshold parameter can be tuned with respect to the cache size to achieve the best performance impact.
- Alternative implementations may use multiple threshold levels to determine best usage of different caching hints.
- the fast_16 loop is similar to Fast Loop, but copies 16B in each iteration (according to an optimized sequence for this length of copy).
- the zero overhead counter is adjusted to allow 16B iterations prior to the loop's execution.
- a remainder of the copy operation of up to 63B may be left (note that the processor gets to this place only if there is such a tail).
- the tail is handled using a sequence of conditional copy operations at block 135 that similar to the sequence used by the head, with the difference that the sequence starts with a single one- byte (1,2,%), instead of two.
- the tail will be copied with the following data chunks: 16, 16, 16, 8, 4, 2, 1 bytes (7 operations), the reverse order is used to optimize the process of defining the sub set of operations to be moved, as discussed above for the head.
- the DF flag checked in block 110 is ' 1', the string is going in "reverse" order, and the source and destination pointers are decremented.
- the above- described algorithm treats this case with the native loop (by passing control to block 120).
- An alternate implementation may implement such copy operations using a similar 'fast copy' sequence by reversing the operations on the pointer's adjust operations using a symmetrical scheme.
- method 100 may be for an iterative copy operation using a REP MOVSB instruction
- other implementations may be used with other copy instructions.
- an algorithm for use with a store instruction e.g., REP STOSB
- REP STOSB may use the same scheme as REP MOVSB, using most of the steps described above with the changes that instead of load+store used for the copy operation, only a store is performed.
- simplifications that are taken for the REP STOSB case: (1) no need to check the distance between src and dst; (2) no need to check the conditions on the src pointer.
- While the implementation shown in FIG. 1 is for such a REP MOVSB and conditioned for 64-byte per iteration, other embodiments may be used to handle fast copy operations of different lengths. Furthermore, such operations may also be used to perform fast copy operations using other instructions such as a move double word length (e.g., REP MOVSD) or other such instruction. Alternate embodiments may take 'assumptions' regarding 'no aliasing' of pages (and thus removing the module 4K support). As described above, some code sequences are optimized to perform desired operations in their most efficient manner for certain types of instructions that they include, in other sequences the same instructions may not perform in their most optimal way. Accordingly, in various embodiments a sequence detection technique may be implemented to analyze an incoming sequence of instructions and provide to an execution unit a code to enable an optimized manner of performing one or more instructions of a given code sequence.
- a sequence detection technique may be implemented to analyze an incoming sequence of instructions and provide to an execution unit a code to enable an optimized manner of performing one
- IA32 REP MOVS and REP STOS operations are tuned for handling copy operations where the length is not known in advance.
- Current optimization is based on the use of REP MOVSD for moving the majority of the data and REP MOVSB for handling the remainder which in that usage is known to be 0-3 in length (information used to optimize the REP MOVSB execution time).
- An example of a code that implements these copy operations is shown in Table 1 (a similar structure applies to REP STOS):
- the REP MOVSB is optimized for this by handling quickly the cases where the length is 0-3 and taking a penalty on other lengths. Due to the operation preceding it, the scheme above makes sure the count never exceeds 0-3. However, there are various other sequences that may be used for performing this optimization, and especially for setting the count for the REP MOVSB instruction. Thus, changing the behavior of the REP MOVSB to be optimal for lengths other than 0-3, for example for using it in conjunction with a REP MOVSQ instruction will have a remainder length of 0-7, will cause such code to misbehave and lose performance in many cases (in the example, when the length is 4-7).
- the MOVSB follows shortly after a REP MOVSD instruction (to be referred to as a D+B sequence), this acts as a hint of the programmer's intention that the REP MOVSB instruction is to be for a limited number of bytes, e.g., 0-3 bytes.
- embodiments may leverage this sequence hint to provide different instruction codes to an execution unit to enable optimization of (at least) this second copy instruction. Since the exact instruction sequence may vary, and other codes may be used to achieve the same result, instead of searching for a specific sequence, hardware is searching for a REP MOVSB that follows the REP MOVSD instruction by a small number of instructions (e.g., 1-9).
- a processor 200 may include an instruction decoder 210 that receives instructions to be performed. When received in the decoder, such instructions may be stored in a buffer 215. Buffer 215 may act to provide the next instruction for execution to a decode logic 220, which further receives a decode path select signal from a feedback path including a sequence detector state machine 240.
- the instruction may be decoded and provided to an execution unit 230 for execution.
- decode logic 220 operates to receive incoming instructions and generate a decoded instruction therefrom.
- decoded instructions may be in the form of a machine code corresponding to the instruction, which is then provided to execution unit 230 to enable execution of an instruction.
- instruction code may cause the execution unit to execute a microcode sequence, or to select a given functional unit to perform the desired operation.
- some decode logic circuits may perform the decode of several instructions in parallel. Other decode logic circuits may convert a single instruction to multiple directives for the execution.
- the decoded instructions may be provided to a decoded instruction comparator 225 of the feedback path, where the decoded instruction may be compared to an expected instruction code received from state machine 240.
- This expected instruction code may correspond to a given instruction code that may be at the beginning of a code sequence desired to be optimized using state machine 240 and decode logic 220. In some implementations this may be implemented via an index to an internal micro- operations array. In some implementations, multiple such state machines and comparators may be provided, each of which is associated with a given instruction to be searched for in a code sequence. In other implementations, state machine 240 and comparator 225 may be extended to provide support for comparisons and analyses of such multiple instructions. As shown in the embodiment of FIG.
- state machine 240 further receives a stall signal (or an instruction decode indication) from instruction decoder 210 in each cycle.
- stall signal or an instruction decode indication
- Instruction decoder 210 holds the instruction that is fed into decode logic 220.
- Decode logic 220 in one embodiment may include a logic function that parses the instruction using certain state information (e.g., the mode of the machine which may define some instructions to be illegal).
- the output of the decoder is a code noted as 'instruction decoded,' which identifies the micro-operations that will be performed for this instruction.
- 'instruction decoded identifies the micro-operations that will be performed for this instruction.
- the nature of these operations depends on the micro- architectural implementation of the machine, but may be looked at as a binary value (or a range of values) that uniquely describe the instruction.
- This code is passed to execution unit 230 to perform the operations corresponding to the instruction decoded in one or more cycles.
- optimization is based on instruction sequences in a loose manner. It assumes that correct operation of the instruction is guaranteed regardless of the decision, which prevents the need to guarantee that the detection of the sequence is accurate in all cases, and can optimize to detect most of the sequence occurrences.
- Instruction comparator 225 compares the current instruction code from state machine 240 with the 'Next Instruction Code' received from instruction decoder 220. This code may cover a range of codes or more than one code depending on the state machine flow as will be discussed below. Once a match is detected, state machine 240 is moved to the next step. The state machine moves from one step to the other based on detection of a match (which may change from one state to the other) or based on time or instruction decoded count.
- a stall indication may be provided from instruction decoder 210 to prevent the state machine from 'counting' when instruction decoder 210 is stalled (e.g., due to waiting for fetch to complete from a lower level of the cache or memory or in the case that the execution unit is busy and can not take new instructions).
- the execution cycle counting becomes a close approximation to decoded instruction counting, and may be simpler to implement in some cases.
- Sequence detector state machine 240 feeds back to decode logic 220 a state information signal, shown in FIG. 2 as a 'Decode Path Select' signal. This state information changes decode logic 220 such that for the same instruction in the instruction buffer 215, decoder rules will signal different decoded instructions to execution unit 230.
- REP MOVSB used by itself for copying an un-known data length which is likely to be greater than three bytes (i.e., "long REP MOVSB” instruction); and REP MOVSB used in conjunction with REP MOVSD in a code sequence, in which case the length is expected to be in the range of 0-3 bytes for the REP MOVSB instruction, and referred to herein as "Short REP MOVSB".
- two different codes can be output from instruction decoder 210 to cause execution unit 230 to run a selected one of two different optimized copy operations.
- FIG. 3 is a state diagram of an example of a sequence decoder state machine in accordance with one embodiment of the present invention, and which illustrates the implementation of the state machine.
- the state machine is reset to the case where it is looking for a REP MOVSD or REP STOSD instruction.
- the Decode Path Select signal from the state machine is set to generate 'long REP MOVSB" codes if a REP MOVSB is encountered within the code sequence.
- the instruction detector is provided with the codes of REP MOVSD and REP STOSD, if either of the two is encountered, the indication is provided to the sequence detector state machine, which now switches to a mode where it is looking for a 'soon to follow' REP MOVSB or REP STOSB by providing the Decode Path Select signal to encode the code for a 'Short REP MOVSB" operation.
- nl may be equal to n if one instruction is decoded at the time or larger than n (e.g., 4n) if multiple instructions may be decoded at the same time.
- the counting is stalled to guarantee sequence detection.
- the number 'n' is small, for example, 4.
- the sequencer After that delay, regardless of whether a REP MOVSB arrived, the sequencer returns to the initial state 310 of looking for REP MOVSD or REP STOSD as a start indication of a new REP MOVSD+B sequence.
- the cases where no REP MOVSB or REP STOSB was not detected cover the scenario that the code included only REP MOVSD and may include in other places 'only' a REP MOVSB. Events such as an interrupt in the middle of the state machine operation may be ignored, in some embodiments, as the ratio of their occurrence multiplied by the penalty of miss predict is small compare to the cost of the event.
- the state machine will search for REP MOVSB or REP STOSB as an early exit from states 320 and 330 and back to state 310, however when the code sequence is short this is not needed (assuming there is no REP MOVSD to tightly follow the REP MOVSB and be missed on a fixed delay).
- the state machine can reset to the initial search state (state 310).
- the implementation of the sequence detector state machine can be relaxed to allow correctly handling cases where the flows are not exact and fluctuations occur.
- the use of a timer (counting non-stall clocks or instructions), instead of a search for an exact sequence can address this issue.
- Modern decoders may allow decoding of multiple instructions at the same time.
- the above-described implementation may be expanded in several ways to cover this.
- decoding of instructions being 'searched for' can be limited to be one at a time.
- the REP MOVSD and REP STOSD instructions will be decoded by themselves.
- multiple compare operations can be placed on the output of each decoder and serialized (flush later operations) or multiple comparators used for all expected codes to allow the state machine to follow the code sequence from any operation. If non-serializing decode is used, the state machine may be extended to support multiple step branches simultaneously (decode of second match in parallel to the first, etc).
- FIG. 4 shown is a block diagram of a processor in accordance with one embodiment of the present invention.
- processor 400 may be a multi-stage pipelined out-of-order processor.
- Processor 400 is shown with a relatively simplified view in FIG. 4 to illustrate various features used in connection with instruction tuning as described above.
- processor 400 includes front end units 410, which may be used to fetch macro-instructions to be executed and prepare them for use later in the processor.
- front end units 410 may include a fetch unit 404, an instruction cache 406, and an instruction decoder 408.
- front end units 410 may further include a trace cache, along with micro-code storage as well as an ⁇ op storage.
- Fetch unit 404 may fetch macro-instructions, e.g., from memory or instruction cache 406, and feed them to instruction decoder 408 to decode them into primitives, i.e., ⁇ ops for execution by the processor.
- Instruction decoder 408 may be configured in accordance with an embodiment of the present invention to include logic to perform sequence detection such that when an incoming group of instructions includes a predetermined sequence of two or more instructions (or a sequence of selected instructions within close proximity of each other, e.g., as discussed above) the logic may cause instruction decoder 408 to provide different decoded instructions, e.g., ⁇ ops for execution later in the processor pipeline, to optimize performance. Still further, in some implementations, when a given macro-instruction is received, instruction decoder 408 may cause a given microcode sequence to be sent for execution, where this sequence may handle fast mode copy operations in accordance with an embodiment of the present invention. In other implementations, an execution unit can be extended with certain hardware to perform such fast copy operations efficiently responsive to a decoded instruction.
- OOO engine 415 Coupled between front end units 410 and execution units 420 is an out of order (OOO) engine 415 that may be used to receive the micro-instructions and prepare them for execution. More specifically OOO engine 415 may include various buffers to re-order micro-instruction flow and allocate various resources needed for execution, as well as to provide renaming of logical registers onto storage locations within various register files such as register file 430 and extended register file 435. Register file 430 may include separate register files for integer and floating point operations. Extended register file 435 may provide storage for vector-sized units, e.g., 256 or 512 bits per register.
- ROB 440 may include various arrays and logic to receive information associated with instructions that are executed. This information is then examined by ROB 440 to determine whether the instructions can be validly retired and result data committed to the architectural state of the processor, or whether one or more exceptions occurred that prevent a proper retirement of the instructions. Of course, ROB 440 may handle other operations associated with retirement.
- ROB 440 is coupled to a cache 450 which, in one embodiment may be a low level cache (e.g., an Ll cache) although the scope of the present invention is not limited in this regard.
- execution units 420 can be directly coupled to cache 450. From cache 450, data communication may occur with higher level caches, system memory and so forth. While shown with this high level in the embodiment of FIG. 4, understand the scope of the present invention is not limited in this regard. Embodiments may be implemented in many different system types. Referring now to FIG. 5, shown is a block diagram of a system in accordance with an embodiment of the present invention. As shown in FIG.
- multiprocessor system 500 is a point-to-point interconnect system, and includes a first processor 570 and a second processor 580 coupled via a point-to-point interconnect 550.
- each of processors 570 and 580 may be multicore processors, including first and second processor cores (i.e., processor cores 574a and 574b and processor cores 584a and 584b).
- Each processor core may include hardware, software and firmware such as shown in FIGS. 1-4 to perform instruction tuning.
- first processor 570 further includes a memory controller hub (MCH) 572 and point-to-point (P-P) interfaces 576 and 578.
- MCH memory controller hub
- P-P point-to-point
- second processor 580 includes a MCH 582 and P-P interfaces 586 and 588.
- MCH's 572 and 582 couple the processors to respective memories, namely a memory 532 and a memory 534, which may be portions of main memory (e.g., a dynamic random access memory (DRAM)) locally attached to the respective processors.
- First processor 570 and second processor 580 may be coupled to a chipset 590 via P-P interconnects 552 and 554, respectively.
- chipset 590 includes P-P interfaces 594 and 598.
- chipset 590 includes an interface 592 to couple chipset 590 with a high performance graphics engine 538.
- chipset 590 may be coupled to a first bus 516 via an interface 596.
- various I/O devices 514 may be coupled to first bus 516, along with a bus bridge 518 which couples first bus 516 to a second bus 520.
- Various devices may be coupled to second bus 520 including, for example, a keyboard/mouse 522, communication devices 526 and a data storage unit 528 such as a disk drive or other mass storage device which may include code 530, in one embodiment.
- an audio I/O 524 may be coupled to second bus 520.
- Embodiments may be implemented in code and may be stored on a storage medium having stored thereon instructions which can be used to program a system to perform the instructions.
- the storage medium may include, but is not limited to, any type of disk including floppy disks, optical disks, compact disk read-only memories (CD- ROMs), compact disk rewritables (CD-RWs), and magneto-optical disks, semiconductor devices such as read-only memories (ROMs), random access memories (RAMs) such as dynamic random access memories (DRAMs), static random access memories (SRAMs), erasable programmable read-only memories (EPROMs), flash memories, electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, or any other type of media suitable for storing electronic instructions.
- ROMs read-only memories
- RAMs random access memories
- DRAMs dynamic random access memories
- SRAMs static random access memories
- EPROMs erasable programmable read-only memories
- EEPROMs
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Executing Machine-Instructions (AREA)
- Devices For Executing Special Programs (AREA)
- Advance Control (AREA)
Abstract
Description
Claims
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2011534805A JP5356531B2 (en) | 2008-11-05 | 2009-10-30 | Instruction optimization performance based on sequence detection or information associated with the instruction |
| BRPI0920790-2A BRPI0920790A2 (en) | 2008-11-05 | 2009-10-30 | performance optimization of instructions based on sequence detection or information associated with the instructions. |
| KR1020117007717A KR101267911B1 (en) | 2008-11-05 | 2009-10-30 | Optimizing performance of instructions based on sequence detection or information associated with the instructions |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US12/290,962 | 2008-11-05 | ||
| US12/290,962 US8543796B2 (en) | 2008-11-05 | 2008-11-05 | Optimizing performance of instructions based on sequence detection or information associated with the instructions |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| WO2010053837A2 true WO2010053837A2 (en) | 2010-05-14 |
| WO2010053837A3 WO2010053837A3 (en) | 2010-07-29 |
Family
ID=42132911
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/US2009/062736 Ceased WO2010053837A2 (en) | 2008-11-05 | 2009-10-30 | Optimizing performance of instructions based on sequence detection or information associated with the instructions |
Country Status (7)
| Country | Link |
|---|---|
| US (2) | US8543796B2 (en) |
| JP (1) | JP5356531B2 (en) |
| KR (1) | KR101267911B1 (en) |
| CN (1) | CN101788903B (en) |
| BR (1) | BRPI0920790A2 (en) |
| TW (1) | TWI434213B (en) |
| WO (1) | WO2010053837A2 (en) |
Families Citing this family (21)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9009689B2 (en) * | 2010-11-09 | 2015-04-14 | Intel Corporation | Speculative compilation to generate advice messages |
| JP5916355B2 (en) * | 2011-11-21 | 2016-05-11 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Apparatus for executing program instructions and system for caching instructions |
| CN104011647B (en) * | 2011-12-22 | 2018-06-15 | 英特尔公司 | Floating point rounding processor, method, system and instructions |
| US9971603B2 (en) | 2011-12-29 | 2018-05-15 | Intel Corporation | Causing an interrupt based on event count |
| US9575766B2 (en) * | 2011-12-29 | 2017-02-21 | Intel Corporation | Causing an interrupt based on event count |
| US9330014B2 (en) | 2012-12-31 | 2016-05-03 | Sunedison Semiconductor Limited (Uen201334164H) | Method and system for full resolution real-time data logging |
| US9519324B2 (en) * | 2014-03-26 | 2016-12-13 | Intel Corporation | Local power gate (LPG) interfaces for power-aware operations |
| US9916164B2 (en) * | 2015-06-11 | 2018-03-13 | Intel Corporation | Methods and apparatus to optimize instructions for execution by a processor |
| US11169925B2 (en) * | 2015-08-25 | 2021-11-09 | Samsung Electronics Co., Ltd. | Capturing temporal store streams into CPU caches by dynamically varying store streaming thresholds |
| US10261790B2 (en) * | 2016-03-31 | 2019-04-16 | Intel Corporation | Memory copy instructions, processors, methods, and systems |
| GB2552153B (en) * | 2016-07-08 | 2019-07-24 | Advanced Risc Mach Ltd | An apparatus and method for performing a rearrangement operation |
| US9984004B1 (en) * | 2016-07-19 | 2018-05-29 | Nutanix, Inc. | Dynamic cache balancing |
| US10394559B2 (en) * | 2016-12-13 | 2019-08-27 | International Business Machines Corporation | Branch predictor search qualification using stream length prediction |
| US10379827B2 (en) * | 2016-12-29 | 2019-08-13 | Intel Corporation | Automatic identification and generation of non-temporal store and load operations in a dynamic optimization environment |
| CN109032665B (en) * | 2017-06-09 | 2021-01-26 | 龙芯中科技术股份有限公司 | Method and device for processing instruction output in microprocessor |
| TWI876746B (en) * | 2018-12-28 | 2025-03-11 | 日商Jvc建伍股份有限公司 | Picture encoding device, picture encoding method, and picture encoding program, picture decoding device, picture decoding method, picture decoding program, storing method, and transmitting method |
| US11029953B2 (en) * | 2019-06-26 | 2021-06-08 | Intel Corporation | Branch prediction unit in service of short microcode flows |
| US11263014B2 (en) * | 2019-08-05 | 2022-03-01 | Arm Limited | Sharing instruction encoding space between a coprocessor and auxiliary execution circuitry |
| GB2593513B (en) | 2020-03-25 | 2022-09-21 | Nordic Semiconductor Asa | Method and system for optimizing data transfer from one memory to another memory |
| GB2593514B (en) * | 2020-03-25 | 2022-04-27 | Nordic Semiconductor Asa | Method and system for optimizing data transfer from one memory to another memory |
| CN114924792A (en) * | 2022-06-14 | 2022-08-19 | 平头哥(上海)半导体技术有限公司 | Instruction decoding unit, instruction execution unit and related apparatus and method |
Family Cites Families (29)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS57153341A (en) * | 1981-03-19 | 1982-09-21 | Mitsubishi Electric Corp | Microprogram processing system |
| JP2513884B2 (en) * | 1989-01-17 | 1996-07-03 | 富士通株式会社 | Microprocessor |
| US5185694A (en) * | 1989-06-26 | 1993-02-09 | Motorola, Inc. | Data processing system utilizes block move instruction for burst transferring blocks of data entries where width of data blocks varies |
| JP2677719B2 (en) * | 1991-05-08 | 1997-11-17 | 富士通株式会社 | Information processing device |
| JPH0721034A (en) * | 1993-06-28 | 1995-01-24 | Fujitsu Ltd | Character string copy processing method |
| US5781750A (en) * | 1994-01-11 | 1998-07-14 | Exponential Technology, Inc. | Dual-instruction-set architecture CPU with hidden software emulation mode |
| US5481684A (en) * | 1994-01-11 | 1996-01-02 | Exponential Technology, Inc. | Emulating operating system calls in an alternate instruction set using a modified code segment descriptor |
| US5542059A (en) * | 1994-01-11 | 1996-07-30 | Exponential Technology, Inc. | Dual instruction set processor having a pipeline with a pipestage functional unit that is relocatable in time and sequence order |
| US5761472A (en) * | 1994-03-09 | 1998-06-02 | Sun Microsystems, Inc. | Interleaving block operations employing an instruction set capable of delaying block-store instructions related to outstanding block-load instructions in a computer system |
| JPH1091430A (en) | 1996-09-13 | 1998-04-10 | Matsushita Electric Ind Co Ltd | Command decoding device |
| US5966734A (en) * | 1996-10-18 | 1999-10-12 | Samsung Electronics Co., Ltd. | Resizable and relocatable memory scratch pad as a cache slice |
| KR19980079634A (en) | 1997-03-13 | 1998-11-25 | 포맨 제프리 엘 | Efficient instruction sending method and apparatus in non-sequential processing system |
| US5923872A (en) * | 1997-11-26 | 1999-07-13 | Digital Equipment Corporation | Apparatus for sampling instruction operand or result values in a processor pipeline |
| US6173393B1 (en) * | 1998-03-31 | 2001-01-09 | Intel Corporation | System for writing select non-contiguous bytes of data with single instruction having operand identifying byte mask corresponding to respective blocks of packed data |
| US6269440B1 (en) * | 1999-02-05 | 2001-07-31 | Agere Systems Guardian Corp. | Accelerating vector processing using plural sequencers to process multiple loop iterations simultaneously |
| EP1050804A1 (en) * | 1999-05-03 | 2000-11-08 | STMicroelectronics SA | Execution of instruction loops |
| US6609193B1 (en) | 1999-12-30 | 2003-08-19 | Intel Corporation | Method and apparatus for multi-thread pipelined instruction decoder |
| US6810502B2 (en) * | 2000-01-28 | 2004-10-26 | Conexant Systems, Inc. | Iteractive decoder employing multiple external code error checks to lower the error floor |
| US7506328B2 (en) * | 2002-02-11 | 2009-03-17 | Xerox Corporation | Method and system for optimizing performance of an apparatus |
| US7346716B2 (en) | 2003-11-25 | 2008-03-18 | Intel Corporation | Tracking progress of data streamer |
| US7577947B2 (en) * | 2003-12-19 | 2009-08-18 | Intel Corporation | Methods and apparatus to dynamically insert prefetch instructions based on garbage collector analysis and layout of objects |
| US7496908B2 (en) * | 2004-01-14 | 2009-02-24 | International Business Machines Corporation | Method and apparatus for optimizing code execution using annotated trace information having performance indicator and counter information |
| TWI266238B (en) | 2004-04-12 | 2006-11-11 | Univ Nat Chiao Tung | Hierarchical instruction coding suitable for very long instruction word and decoder thereof |
| US7698354B2 (en) * | 2004-04-16 | 2010-04-13 | Analog Devices, Inc. | Programmable engine core for executing digital signal processing functions |
| US20070150705A1 (en) * | 2005-12-28 | 2007-06-28 | Intel Corporation | Efficient counting for iterative instructions |
| US20080244224A1 (en) * | 2007-03-29 | 2008-10-02 | Peter Sassone | Scheduling a direct dependent instruction |
| US8082233B2 (en) * | 2007-03-29 | 2011-12-20 | Microsoft Corporation | Comparing data sets through identification of matching blocks |
| US20080243840A1 (en) * | 2007-03-29 | 2008-10-02 | Microsoft Corporation | Comparing data sets through identification of matching blocks |
| CN100549938C (en) * | 2007-11-28 | 2009-10-14 | 北京中星微电子有限公司 | FIFO control circuit and control method |
-
2008
- 2008-11-05 US US12/290,962 patent/US8543796B2/en not_active Expired - Fee Related
-
2009
- 2009-10-30 KR KR1020117007717A patent/KR101267911B1/en not_active Expired - Fee Related
- 2009-10-30 JP JP2011534805A patent/JP5356531B2/en not_active Expired - Fee Related
- 2009-10-30 WO PCT/US2009/062736 patent/WO2010053837A2/en not_active Ceased
- 2009-10-30 BR BRPI0920790-2A patent/BRPI0920790A2/en not_active IP Right Cessation
- 2009-11-03 TW TW098137276A patent/TWI434213B/en not_active IP Right Cessation
- 2009-11-05 CN CN200911000152.7A patent/CN101788903B/en not_active Expired - Fee Related
-
2013
- 2013-08-28 US US14/012,344 patent/US8935514B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| WO2010053837A3 (en) | 2010-07-29 |
| TW201030606A (en) | 2010-08-16 |
| KR101267911B1 (en) | 2013-05-31 |
| KR20110050722A (en) | 2011-05-16 |
| US20130346728A1 (en) | 2013-12-26 |
| BRPI0920790A2 (en) | 2020-08-18 |
| US8543796B2 (en) | 2013-09-24 |
| CN101788903A (en) | 2010-07-28 |
| JP2012507805A (en) | 2012-03-29 |
| US20100115240A1 (en) | 2010-05-06 |
| JP5356531B2 (en) | 2013-12-04 |
| CN101788903B (en) | 2014-10-29 |
| US8935514B2 (en) | 2015-01-13 |
| TWI434213B (en) | 2014-04-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8543796B2 (en) | Optimizing performance of instructions based on sequence detection or information associated with the instructions | |
| US6247115B1 (en) | Non-stalling circular counterflow pipeline processor with reorder buffer | |
| US7814298B1 (en) | Promoting and appending traces in an instruction processing circuit based upon a bias value | |
| US7596683B2 (en) | Switching processor threads during long latencies | |
| CN101228506B (en) | Method and apparatus for predicting branch instructions | |
| CN1189816C (en) | Data processing system with branch control and method thereof | |
| CN105612494B (en) | For controlling the data processing equipment and method that speculate vector operation efficiency | |
| WO2002008893A1 (en) | A microprocessor having an instruction format containing explicit timing information | |
| US5918046A (en) | Method and apparatus for a branch instruction pointer table | |
| US10338923B2 (en) | Branch prediction path wrong guess instruction | |
| US7010676B2 (en) | Last iteration loop branch prediction upon counter threshold and resolution upon counter one | |
| KR100551544B1 (en) | Hardware loop | |
| US12530199B2 (en) | Systems and methods for load-dependent-branch pre-resolution | |
| KR100536018B1 (en) | Hardware loops | |
| CN119025164B (en) | RISC-V vector instruction configuration determination method and device | |
| US12498926B1 (en) | Microprocessor that builds consistent loop iteration count unrolled loop multi-fetch block macro-op cache entries | |
| US12498927B1 (en) | Microprocessor that allows same-fetch block start address co-residence of unrolled loop multi-fetch block macro-op cache entry and loop body macro-op cache entry used to build same | |
| US12493469B1 (en) | Microprocessor that extends sequential multi-fetch block macro-op cache entries | |
| US20130305017A1 (en) | Compiled control code parallelization by hardware treatment of data dependency | |
| Omondi | Control Flow: Branching and Control Hazards |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 09825264 Country of ref document: EP Kind code of ref document: A2 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2011534805 Country of ref document: JP |
|
| ENP | Entry into the national phase |
Ref document number: 20117007717 Country of ref document: KR Kind code of ref document: A |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 09825264 Country of ref document: EP Kind code of ref document: A2 |
|
| ENP | Entry into the national phase |
Ref document number: PI0920790 Country of ref document: BR Kind code of ref document: A2 Effective date: 20110401 |