Hardware to bypass security checks during speculative execution when it is deemed safe

By omitting security checks in speculative execution through compiler hints, the strategy addresses inefficiencies in processor architectures, improving performance and optimizing resource usage while ensuring security policies are enforced only when necessary.

JP7533832B2Active Publication Date: 2024-08-14INTEL CORP
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
JP2020104078
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2019-09-27
Filing Date
2020-06-16
Publication Date
2024-08-14
Estimated Expiration
2040-06-16

AI Technical Summary

Technical Problem

Existing processor architectures face inefficiencies due to unnecessary overhead from security checks during speculative execution, particularly in scenarios where speculative errors are infrequent, leading to performance bottlenecks and resource wastage.

Method used

Implementing a strategy to omit security checks in speculative execution by providing compiler hints that indicate when security checks are necessary only for potentially missed speculative operations, allowing the processor to dynamically optimize execution based on the safety of the operation.

Benefits of technology

This approach enhances processor performance by reducing unnecessary security check overhead and enabling more efficient speculative execution, while maintaining desired security policies without requiring stringent compliance checks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007533832000009
    Figure 0007533832000009
  • Figure 0007533832000026
    Figure 0007533832000026
  • Figure 0007533832000021
    Figure 0007533832000021
Patent Text Reader

Abstract

To provide hardware for omitting security check in speculative execution.SOLUTION: A method using a computer system includes: determining a security check policy, to be enforced for potentially mis-speculated execution, from a plurality of security check policies based on a security check field by a speculation manager of a processor core and an execution unit; performing one or more associated checks of the security check policy on the instruction to determine whether the instruction is potentially mis-speculated or not; scheduling the instruction for execution when the instruction is not deemed safe according to the one or more associated checks; omitting the instruction when the instruction is deemed safe according to the one or more associated checks; and executing the instruction that is scheduled for execution.SELECTED DRAWING: Figure 4
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] [Background technology] A processor, or set of processors, executes instructions from an instruction set, e.g., an instruction set architecture (ISA). An instruction set is a portion of a computer architecture related to programming and generally includes native data types, instructions, register architecture, addressing modes, memory architecture, interrupt and exception handling, and external input and output (I / O). Note that, as used herein, the term instruction may refer to, e.g., macroinstructions, which are instructions provided to a processor for execution, or microinstructions, which are instructions resulting from, e.g., decoding a macroinstruction by a decoder of the processor. [Brief description of the drawings]

[0002] Various embodiments according to the present disclosure will now be described with reference to the drawings.

[0003] [Figure 1] 1 illustrates a computer system including a processor core according to an embodiment of the present disclosure.

[0004] [Diagram 2] 1 illustrates a flow diagram for omitting security check instructions according to an embodiment of the present disclosure.

[0005] [Diagram 3] 1 illustrates a flow diagram for issuing hints in code according to an embodiment of the present disclosure.

[0006] [Figure 4] 1 illustrates a flow diagram according to an embodiment of the present disclosure.

[0007] [Figure 5A] FIG. 2 is a block diagram illustrating a generic vector friendly instruction format and its class A instruction templates, according to an embodiment of the present disclosure.

[0008] [Figure 5B] FIG. 2 is a block diagram illustrating a generic vector friendly instruction format and its class B instruction templates, according to an embodiment of the present disclosure.

[0009] [Figure 6A] FIG. 5C is a block diagram illustrating fields for the generic vector friendly instruction format in FIGS. 5A and 5B in accordance with an embodiment of the present disclosure.

[0010] [Figure 6B] FIG. 6B is a block diagram illustrating the fields that make up the full opcode field of the specific vector instruction format in FIG. 6A in accordance with one embodiment of the present disclosure.

[0011] [Figure 6C] FIG. 6B is a block diagram illustrating the fields that make up the register index field of the specific vector instruction format in FIG. 6A in accordance with one embodiment of the present disclosure.

[0012] [Figure 6D] FIG. 6B is a block diagram illustrating the fields that make up the extended operation field 550 of the specific vector specific instruction format in FIG. 6A in accordance with one embodiment of the present disclosure.

[0013] [Figure 7] FIG. 2 is a block diagram of a register architecture according to one embodiment of the present disclosure.

[0014] [Figure 8A] 2A-2C are block diagrams illustrating both an exemplary in-order pipeline and an exemplary register renaming, out-of-order issue / execution pipeline, in accordance with an embodiment of the present disclosure.

[0015] [Figure 8B]1 is a block diagram illustrating both an exemplary embodiment in-order architecture core and an exemplary register renaming, out-of-order issue / execution architecture core to be included in a processor, in accordance with an embodiment of the present disclosure.

[0016] [Figure 9A] 1 illustrates a block diagram of a single processor core connected to an on-die interconnect network and with a local subset of its Level 2 (L2) cache, according to an embodiment of the present disclosure.

[0017] [Figure 9B] FIG. 9B is an expanded view of a portion of the processor core in FIG. 9A according to an embodiment of the present disclosure.

[0018] [Figure 10] FIG. 2 is a block diagram of a processor that may have two or more cores, may have an integrated memory controller, and may have integrated graphics, according to an embodiment of the present disclosure.

[0019] [Figure 11] FIG. 1 is a block diagram of a system according to one embodiment of the present disclosure.

[0020] [Figure 12] FIG. 2 is a block diagram of a more specific example system according to an embodiment of the present disclosure.

[0021] [Figure 13] FIG. 2 is a block diagram of a second, more specific, exemplary system according to an embodiment of the present disclosure.

[0022] [Figure 14] 1 illustrates a block diagram of a system on a chip (SoC) according to an embodiment of the present disclosure.

[0023] [Figure 15]1 is a block diagram contrasting the use of a software instruction converter to convert binary instructions in a source instruction set to binary instructions in a target instruction set, according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0024] In the following description, numerous specific details are set forth. However, it should be understood that embodiments of the present disclosure may be practiced without these specific details. In other instances, well-known circuits, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

[0025] References herein to "one embodiment," "an embodiment," "an example embodiment," and the like indicate that the embodiment being described may include a particular feature, structure, or characteristic, but not all embodiments necessarily include the particular feature, structure, or characteristic. Moreover, such phrases do not necessarily refer to the same embodiment. Moreover, when a particular feature, structure, or characteristic is described in connection with one embodiment, it is believed to be within the knowledge of one of ordinary skill in the art that such feature, structure, or characteristic also applies with respect to other embodiments, whether or not expressly described.

[0026] A (e.g., hardware) processor (e.g., having one or more cores) may execute instructions (e.g., threads of instructions) to perform processing, e.g., arithmetic, logical or other functions, on data. For example, software may request an operation, and a hardware processor (e.g., a core or cores of a hardware processor) may perform the operation in response to the request. The software may include one or more branches (e.g., branch instructions) that result in the execution of an instruction sequence out of program order. A branch instruction may be an unconditional branch that always results in a branch, or a conditional branch that may or may not result in a branch depending on certain conditions. Certain processors are pipelined to allow more instructions to complete faster. This generally means starting the execution of an instruction (e.g., speculatively) without waiting for a previous instruction to complete. However, conditional branches create problems with this approach. In particular, when a processor encounters a conditional branch, the processor does not know whether to take the branch or not if the outcome of the condition has not yet been calculated. Branch prediction is what certain processors use to determine whether to take a conditional branch. It is important to obtain this information as accurately as possible because an inaccurate prediction (e.g., a misprediction) can cause a particular processor to discard all instructions that did not need to be executed and start over with the correct set of instructions, a process that can be particularly costly when using deeply pipelined processors, for example. In one embodiment, the processor's branch predictor speculates aggressively, e.g., increasing the out-of-order depth and width to obtain significant performance gains.

[0027] In certain embodiments, code to be executed by a hardware processor that supports speculative execution (e.g., including branch prediction) includes one or more security checks (e.g., security check instructions). Certain security checks (e.g., enforcing memory safety checks or type safety checks) may be omitted using static analysis (e.g., by a compiler), but that analysis should be extended to take speculative execution into account. Enforcing the desired security policy against all possible execution paths, including misspeculated execution paths, can result in additional security checks. However, in certain embodiments, misspeculation is a rare occurrence, and so in these embodiments, these security checks impose additional overhead that is not typically necessary.

[0028] In particular embodiments, memory safety checks check for memory access errors, such as buffer overflows and dangling pointers, etc. In one embodiment, memory safety checks check array bounds and pointer dereferences.

[0029] In particular embodiments, type safety checks check for inconsistencies between different data types for program constants, variables, and methods (e.g., functions) (e.g., for memory access requirements), such as errors in treating data that is an integer (int) as a floating-point number (float).

[0030] Certain embodiments herein extend the architecture of a processor to read hints (e.g., issued by a compiler) that a particular security check is required only if the operation being checked can potentially be misspeculated. If the processor determines that the operation is not considered safe, the check may be performed and the speculation may continue, thereby improving optimization opportunities. On the other hand, in these embodiments, if the processor determines that such an operation is safe by the time the operation is ready to be executed, the associated security check may be skipped, reducing overhead. Certain embodiments herein provide a way to specify that a security check should be performed only if an instruction can be misspeculated. Future compilers may increase the number of security check instructions issued by the compiler, resulting in checks enforcing safety (e.g., type) for potentially speculative control flows. In such cases, certain embodiments herein provide advantageous efficiencies by communicating information to the microarchitecture (e.g., from the compiler) about which security checks can be skipped for control flows that are correctly predicted / known to be architecturally correct.

[0031] Fences can be used to restrict speculative execution of operations restricted by a preceding security check until that check is completed. Unlike embodiments herein that allow for the omission of security checks in speculative execution, fences may also restrict speculative execution of operations that do not depend on security checks, thus limiting the ability to optimize the performance of the processor.

[0032] In a particular embodiment, a strategy for defending against hardware speculation attacks in a hardware processor is to make speculation invisible in the data cache hierarchy, for example, to more accurately determine when a load can safely proceed without affecting the microarchitectural state in a way that could leak information, and without buffering state changes earlier than the point at which speculative execution is allowed to continue. In one embodiment, the strategy blocks microarchitectural covert and side channels through the multiprocessor data cache hierarchy, for example, without modifying the multiprocessor data cache hierarchy because of a speculative load that is unsafe, such as when the unsafe speculative load reads data into a speculative buffer. Once the loads are safe, the strategy makes them visible to the rest of the system. The strategy identifies loads that may have violated memory integrity, at which point it forces a verification step to be performed on these loads. Unlike the embodiments herein for omitting security checks in speculative execution, the above strategies are overly pessimistic in determining when it is safe to execute a load if the developer is only interested in enforcing looser security policies (such as memory safety or type safety) rather than the stricter full compliance checking of the architecture specifications of cache access visibility that the strategies enforce. This strategy also increases the demands on buffer space. The buffer logic also introduces additional overhead and complexity, especially since the strategies reissue the buffered load when the load is eventually allowed to execute. The embodiments herein for omitting security checks in speculative execution allow the developer to use security checks (e.g., inserted by the compiler) to enforce the particular security policies desired, and to execute these checks themselves speculatively, allowing an operation (e.g., a load) to be declared safe earlier than if these checks were not performed. Note that the embodiments herein for omitting security checks in speculative execution may be used in conjunction with buffers.

[0033] The embodiments herein for the omission of security checks in speculative execution define a new type of instruction (and modifiers to previously defined instructions) that includes security measures to enforce security policies desired by the developer, while at the same time allowing significant dynamic optimization. For example, the instruction allows for a bounds check instruction (e.g., a function for a pointer instruction or a Memory Protection Extensions (MPX) bounds check instruction (e.g., checking a lower or upper bound)) or a set of implicit bounds and type checks to be marked as necessary only if a load from the address being checked is deemed unsafe. If the safety criteria are already met (e.g., the correct direction of the preceding branch has been determined) when the processor reaches the instruction, the processor may skip the instruction. In a particular embodiment, a function in this context refers to a pointer with associated security metadata embedded in the pointer storage.

[0034] Type-safe languages ​​may be used by developers in their programs to avoid common security problems that may result in data leaks. In certain embodiments, memory safety may not be as strict (e.g., does not prevent type confusion), but may impose less overhead on execution. Embodiments herein for omitting security checks in speculative execution provide a way to more efficiently enforce a proper subset of security policies (e.g., memory safety and / or type safety) along both architectural and misspeculated paths of execution using hints (e.g., provided by a compiler) that inform the processor what security checks are necessary only for control flows that may be misspeculated. In certain embodiments, hints indicating necessary checks only for potentially misspeculated instructions are visible to the program in the code.

[0035] The basic concept underlying embodiments herein for omitting security checks in speculative execution is that some programs only need to enforce a proper subset (e.g., less than all) of the policies (e.g., memory safety and / or type safety policies) of the architectural specifications of the processor on which they are executed, rather than fully complying with them, thereby providing greater opportunities for speculative execution than would be possible for a particular set of processor resources if stricter policies were enforced.

[0036] Thus, one aspect of embodiments herein for omission of security checks in speculation is to gate speculation with certain narrow types of security checks, such as bounds and type checks, instead of requiring full architectural compliance. This may be accomplished by preventing adversarially visible microarchitectural state changes induced by security-sensitive operations (e.g., memory loads) from occurring before the relevant checks (e.g., pointer checks, MPX checks, or other defined features of the checks) are completed. For example, this may take the form of blocking further speculation until the checks are completed, or buffering the resulting state changes and rolling them back if the checks fail.

[0037] Second, it implies that more security checks may be needed to cover possible misspeculative control flows, whereas previously the compiler would have statically omitted checks for architecturally impossible flows. This requires that the compiler for a particular implementation have a model of speculative execution so that it can identify all possible speculative control flows.

[0038] Third, for efficiency reasons, the compiler of particular embodiments needs to be able to inform the processor about which security checks have been added (that would otherwise be omitted) so that the processor can skip those checks if the values ​​being checked conform to their architectural definitions. Skipping those checks (e.g., skipping dispatching those checks to an execution unit) saves energy, bandwidth, and other resources of the processor, and is thus an improvement to the processor (e.g., the computer that includes the processor).

[0039] The following code was developed with respect to this third aspect: The embodiments herein for omitting security checks in speculative execution allow the processor to use hints (e.g., provided by the compiler) regarding which security checks are only necessary if the operation restricted by the checks is not already considered safe in some way. For example, consider the following sample pseudocode: [Table 1]

[0040] In certain embodiments, bounds checking for the following access needs to be performed unconditionally since any value of "id" could be provided to this function (excluding possible inlining for this example). Type checking may not be necessary since the compiler can statically verify the type safety of this access, assuming that the socket's address is not speculated by the processor. Instead, if that level of speculation is possible, dynamic type safety checking may allow further speculation to be performed while at the same time ensuring that type safety is enforced.

[0041] However, note that in certain embodiments, even if address speculation is possible, a compiler may statically determine that type-safety checks are not necessary if the socket's address meets its architectural definition. For example, this latter condition is met if the processor (e.g., a central processing unit (CPU)) has already resolved any conditions, such as a pre-emptive branch or pre-emptive store, that could alias the memory location from which the socket's address was loaded, if applicable, or has retired any instructions that could have potentially caused the socket's address to deviate from the processor's architectural definition (e.g., a misspeculation).

[0042] Embodiments herein for omitting security checks in speculative execution allow a compiler to pass a hint to a processor indicating that if the address input to a following access has already been determined by the processor (e.g., CPU) to be architectural at the time the access is ready to be executed, then type safety checks can be omitted.

[0043] In one embodiment, the dynamic_cast routine in the pseudocode above receives a template parameter that specifies the type of pointer to which the parameter is to be cast. The dynamic_cast routine performs a dynamic check to determine whether the type of the input parameter is a subclass of the template parameter or whether they match exactly. If so, the result of the routine is a pointer to an object of the new type with the same address as the input pointer. Otherwise, dynamic_cast returns null.

[0044] As an example, this "if" statement causes the compiler to generate a branch instruction to perform a conditional control flow. If the previous branch has been resolved by the time the instructions in this branch of the if statement are executed, then the type check is passed. This implies that subsequent accesses to ts->port are also within the bounds of ts. Thus, this ts->port access may be provided with a hint indicating that if the address being accessed is already known to match the architecture definition and all preceding branches are already resolved, then type and bounds checks (e.g., bounds check instructions) may be omitted. Note that this is an even stronger restriction than the one specified for the access generated from the last statement in lookupSocket. For each type of restriction, multiple types of hints (e.g., different instruction prefixes or different instruction variants) may be defined.

[0045] As another example of the pseudocode above, if a branch is misspeculated, resulting in a LocalDomainSocket being accessed as if it were a TCPIPSocket, then the 16 bits of data stored just at the end of the LocalDomainSocket object are used to index into the tcpipServices array. If this were to happen where some secret data was stored, for example part of the server's private key, then that information could potentially determine which entries in the tcpipServices array would be cached, assuming the entire array is not cached initially. If an adversary could time subsequent accesses to the tcpipServices array, for example by attempting to connect to each service and timing how long it takes for the connection to be established, then it could leak the value of the secret data. The service that connects earliest could be the one with the port number equal to the secret data. Cryptographic keys could be larger than the example 16 bits, but leaking any secret key is potentially problematic. There could also be more complex scenarios than those described in this example that could result in more than just a key leak.

[0046] If an access is ready to be executed, but the access is not yet deemed safe by the criteria defined above, then bounds and type checks may be performed. If the branch is misspeculated, then both bounds and type checks will fail in this case. However, in other cases, only one type of check may fail.

[0047] In some cases, it may be useful to distinguish between pointers to the beginning of an object and pointers to other offsets within the object. As a result, with subtypes of the latter type of pointer, dynamic bounds checking may be performed on accesses, even when the pointer points to the base of the object and static checks would be sufficient. Efficiency may be improved by specifying in the pointer an indication of whether the pointer points to the beginning of an object or not. For example, when a pointer (or a fat pointer) is initialized to an object base, a reserved bit may be set in the pointer, and subsequent pointer updates may update that bit depending on whether the resulting pointer points to that object base or not.

[0048] FIG. 1 illustrates a computer system 100 including a processor core 109 according to an embodiment of the present disclosure. The processor core 109 may include a speculation manager 110 for managing control of the speculation features described herein. The scheduler 147 may include a speculation manager 110 including security check omissions in the speculative execution features described herein. In a particular embodiment, the speculation manager 110 includes a security check policy 112 for storing one or more associated checks to be performed for a particular security check policy. For example, a first security check policy may be a memory safety check policy 114 and a second security check policy may be a type safety check policy 116. In a particular embodiment, the speculation manager 110 accesses the code (e.g., the code 106 with the additional hints) (e.g., the instruction to which the hints were added or the decoded instructions of that instruction from the code 106), determines which policy to apply, and then determines whether it is safe or unsafe to omit one or more associated checks. In one embodiment, speculation manager 110 includes a path 110A to scheduler 147 of core 109, for example, to stop scheduling (and thus stop execution of) instructions (e.g., microcode) that are to be omitted. Path 110A may allow for one-way or two-way communication. In one embodiment, scheduler 147 schedules execution of instructions (e.g., microcode) on one or more execution units 154.

[0049] The illustrated computer system 100 includes a branch predictor 120 and a branch address calculator 142 (BAC) in pipelined processor cores 109(1)-109(N) according to an embodiment of the present disclosure. With reference to FIG. 1, a pipelined processor core (e.g., 109(1)) includes an instruction pointer generation (IP Gen) stage 111, a fetch stage 130, a decode stage 140, and an execution stage 150. In a particular embodiment, a retirement stage (e.g., including a reorder buffer (ROB)) follows the execution stage 150. In one embodiment, computer system (e.g., processor) 100 includes multiple cores 109(1-N), where N is any positive integer. In another embodiment, computer system (e.g., processor) 100 includes a single core. In a particular embodiment, each processor core 109(1-N) instance supports multithreading (e.g., executing a parallel set of two or more operations or threads on a first logical core and a second logical core), which may be done so in a variety of ways including time sliced ​​multithreading, simultaneous multithreading (e.g., where a single physical core provides a logical core for each of the threads on which the physical core is simultaneously multithreading), or a combination thereof (e.g., time sliced ​​fetch and decode followed by simultaneous multithreading). In the illustrated embodiment, each single processor core 109(1) through 109(N) includes an instance of a branch predictor 120. The branch predictor 120 may include a branch target buffer (BTB) 124.

[0050] In a particular embodiment, branch target buffer 124 stores (e.g., in a branch predictor array) predicted target instructions corresponding to each of multiple branch instructions (e.g., branch instructions in a section of code that has been executed multiple times). In the illustrated embodiment, branch address calculator (BAC) 142 includes a return stack buffer 144 (RSB) that the BAC accesses (e.g., contains). In a particular embodiment, return stack buffer 144 stores (e.g., in a last-in-first-out (LIFO) stack data structure) return addresses for any CALL instructions (e.g., that push their return addresses onto the stack).

[0051] A branch address calculator (BAC) 142 is used to calculate addresses for certain types of branch instructions and / or to verify branch predictions made by a branch predictor (e.g., BTB). In particular embodiments, the branch address calculator performs linear address calculations of the branch target and / or the next sequential. In particular embodiments, the branch address calculator performs static predictions for branches based on the address calculations.

[0052] In a particular embodiment, branch address calculator 142 includes a return stack buffer 144 for recording return addresses of CALL instructions. In one embodiment, the branch address calculator attempts to correct improper predictions made by branch predictor 120 to reduce the penalty of branch mispredictions. As one example, the branch address calculator verifies branch predictions for branches with targets that are uniquely determinable from the branch instruction and the instruction pointer.

[0053] In a particular embodiment, the branch address calculator 142 maintains a return stack buffer 144 to be used as a branch prediction mechanism to determine the target addresses of return instructions. For example, the return stack buffer 144 operates by monitoring all “call subroutine” and “return from subroutine” branch instructions. In one embodiment, when the branch address calculator detects a “call subroutine” branch instruction, the branch address calculator pushes the address of the next instruction into the return stack buffer, e.g., the top of the stack pointer marks the top of the return stack buffer. In this embodiment, the return stack buffer contains a stack of return addresses by pushing the address immediately following each “call subroutine” instruction into the return stack buffer. Later, when the branch address calculator detects a “return from subroutine” branch instruction, the branch address calculator retrieves the top return address from the return stack buffer, e.g., to verify the return address predicted by the branch predictor 120. In one embodiment, for direct branch types, the branch address calculator predicts the conditional branch as taken (e.g., always) and, e.g., if the branch predictor does not predict the direct branch as taken, the branch address calculator overrides the branch predictor's misprediction or incorrect prediction.

[0054] 1 includes circuitry for verifying branch predictions made by branch predictor 120. Each branch predictor 120 entry (e.g., in BTB 124) may further include a valid field and a bundle address (BA) field that are used to refine and verify branch predictions made by branch predictor 120, as described in more detail below. In one embodiment, the valid field and the BA field each comprise a 1-bit field. However, in other embodiments, the sizes of the valid field and the BA field may vary. In one embodiment, fetched instructions are sent to decoder 146 (e.g., by BAC 142, from line 137) to be decoded, and the decoded instructions are sent to scheduler 147 for scheduling for execution in one or more of execution units 154.

[0055] The illustrated computer system 100 includes a network device 101 , input / output (I / O) circuitry 103 (eg, a keyboard), a display 105 , and a system bus (eg, an interconnect) 107 .

[0056] In one embodiment, the branch instructions stored in the branch predictor 120 are preselected by a compiler as taken branch instructions. In a particular embodiment, compiler code 104 as shown stored in memory 102 of FIG. 1 includes code sequences that translate source code of a program written in a high-level language into executable machine code at run time. In one embodiment, the compiler code 104 further includes hints to form code 106 with additional hints. The compiler code may further predict target instructions of branch instructions (e.g., potentially taken branch instructions (e.g., preselected branch instructions)). The branch predictor 120 (e.g., its BTB 124) is then updated with the target instructions of the branch instructions. In one embodiment, software manages the hardware BTB, e.g., the software specifies the prediction mode or the prediction mode implicitly defined by the mode of the instruction writing to the BTB also sets mode bits in the entries.

[0057] As described below, the illustrated core (e.g., its branch predictor 120) includes access to one or more registers. In a particular embodiment, the core includes one or more general purpose registers 108.

[0058] In particular embodiments, each entry of branch predictor 120 (e.g., in its BTB 124) includes a tag field and a target field. In one embodiment, the tag field of each entry in the BTB store stores at least a portion of an instruction pointer (e.g., a memory address) that identifies a branch instruction. In one embodiment, the tag field of each entry in the BTB store stores an instruction pointer (e.g., a memory address) that identifies a branch instruction in the code. In one embodiment, the target field stores at least a portion of an instruction pointer for a target of a branch instruction identified in the tag field of the same entry. In other embodiments, an entry of branch predictor 120 (e.g., in its BTB 124) includes one or more other fields. In particular embodiments, an entry does not include a separate field to aid in predicting whether a branch instruction will be taken, e.g., if a branch instruction is present (e.g., in the BTB), the branch instruction is considered to be taken.

[0059] 1, IP Gen mux 113 of IP generation stage 111 receives an instruction pointer from line 114A. The instruction pointer provided via line 115A is generated by increment circuit 115, which receives a copy of the most recent instruction pointer from path 113A. Increment circuit 115 may increment the instruction pointer by a predetermined amount to obtain the next sequential instruction from the program sequence currently being executed by the core.

[0060] In one embodiment, upon receiving an IP from IP Gen mux 113, branch predictor 120 compares a portion of the IP to the tag field of each entry in branch predictor 120 (e.g., BTB 124). In this embodiment, if no match is found between the IP and the tag field of branch predictor 120, IP Gen mux proceeds to select the next sequential IP as the next instruction to be fetched. Conversely, if a match is found, branch predictor 120 reads the valid field of the branch predictor entry that matches the IP. In this embodiment, if the valid field is not set (e.g., has a logical value of 0), branch predictor 120 considers the respective entry to be "invalid" and ignores the match between the IP and the respective entry's tag, and, for example, the branch target of the respective entry is not forwarded to the IP Gen Mux. On the other hand, in this embodiment, if the valid field of the matching entry is set (e.g., has a logical value of 1), branch predictor 120 proceeds to perform a logical comparison between a predetermined portion of the instruction pointer (IP) and the branch address (BA) field of the matching branch predictor entry. If an "allowable condition" exists, the branch target of the matching entry is forwarded to the IP Gen mux. Otherwise, branch predictor 120 ignores the match between the IP and the tag of the branch predictor entry. In some embodiments, the entry indicator is formed not only from the current branch IP, but also from at least a portion of the global history.

[0061] More specifically, in one embodiment, the BA field indicates where the respective branch instruction is stored within a line of cache memory 132. In particular embodiments, the processor can begin executing multiple instructions per clock cycle, where the instructions are non-interdependent and do not use the same execution resources.

[0062] For example, each line of instruction cache 132 shown in FIG. 1 includes multiple instructions (e.g., six instructions). Also in this embodiment, in response to a fetch operation by fetch unit 134, instruction cache 132 responds by providing a full line of the cache to fetch unit 134 (e.g., in the case of a "hit"). Instructions within a line of the cache may be grouped into separate "bundles." For example, as shown in FIG. 1, the first three instructions in cache line 133 may be addressed as bundle 0, and the second three instructions may be addressed as bundle 1. Each of the instructions within a bundle is independent of the others (e.g., can be issued simultaneously for execution). In certain embodiments, a BA field provided within branch predictor 120 entries is used to identify the bundle address of the branch instruction corresponding to the respective entry. For example, in one embodiment, the BA identifies whether the branch instruction is stored in the first bundle or the second bundle of a particular cache line.

[0063] In one embodiment, the branch predictor 120 performs a logical comparison between the BA field of the matching entry and a predetermined portion of the IP to determine whether an "acceptable condition" exists. For example, in one embodiment, the fifth bit position of the IP (e.g., IP[4]) is compared to the BA field of the matching (e.g., BTB) entry. In one embodiment, an acceptable condition exists if IP[4] is not greater than BA. Such an acceptable condition helps prevent obviously unnecessary prediction of branch instructions, which may not be executed. That is, if less than the entire IP is considered when making the comparison with the branch predictor 120 tag, it is possible to have a match with the tag, but it may not be a true match. Nevertheless, a match between the IP and the branch predictor tag indicates a particular line of the cache, which includes a branch instruction corresponding to the respective branch predictor entry, and which may be about to be executed. Specifically, if the bundle address of the IP is not greater than the BA field of the matching branch predictor entry, the branch instruction in the respective cache line is about to be executed. Thus, in certain embodiments, performance benefits may be obtained by proceeding to fetch the target of the branch instruction.

[0064] As noted above, in this example, if an "allowable condition" exists, the branch target of the matching entry will be forwarded to the IP Gen mux. Otherwise, the branch predictor will ignore the match between the IP and the tag. In one embodiment, the branch target forwarded from the branch predictor is first sent to a branch prediction (BP) resteer mux 128 and then sent to the IP Gen mux. As shown in FIG. 1, the BP resteer mux 128 may also receive instruction pointers from other branch prediction devices. In one embodiment, the input lines received by the BP resteer mux are prioritized to determine which input lines can be passed from the BP resteer mux to the IP Gen mux.

[0065] In addition to forwarding the branch target to the BP resteer mux, upon detection of a match between the IP and the branch predictor tag, the BA of the matching branch predictor entry is forwarded to a branch address calculator (BAC) 142. In FIG. 1, BAC 142 is shown as being located in decode stage 140, but may be located at other stages. The BAC may receive cache lines from fetch unit 134 via line 137.

[0066] In this example, the IP selected by the IP Gen mux is also forwarded to fetch unit 134 via data lines 135. Once the IP is received by fetch unit 134, the cache line corresponding to that IP is fetched from instruction cache 132. The cache line received from the instruction cache is forwarded to the BAC via data lines 137.

[0067] In this example, upon receiving the BA, the BAC reads the BA and determines where the preselected branch instruction (e.g., identified in a matching branch predictor entry) is located within the next cache line to be read by the BAC (e.g., in the first bundle or the second bundle of the cache line). In one embodiment, where the branch instruction is located within the bundle of the cache line may be predetermined (e.g., in one bundle of three instructions, where the branch instruction is stored as the second instruction).

[0068] In an alternative embodiment, the BA includes additional bits to more specifically identify the address of the branch instruction within the cache line, so that the branch instruction is not limited to a particular instruction location within the bundle.

[0069] After the BAC determines the address of the preselected branch instruction in the cache line and receives each cache line from the fetch unit 134, the BAC decodes each instruction to verify the IP that truly corresponds to the branch instruction. If the instruction addressed by the BA in the received cache line is a branch instruction, no correction is required for the branch prediction. Conversely, if the instruction in the cache line is not a branch instruction (i.e., the IP does not correspond to a branch instruction), the BAC sends a message to the branch predictor to invalidate each branch predictor entry to prevent similar mispredictions in the same branch predictor entry. The invalidated branch predictor entry is then overwritten with a new branch predictor entry.

[0070] Also, in one embodiment, the BAC increments the IP by a predetermined amount and forwards the incremented IP to the BP resteer mux 128 via data lines 145. For example, the data lines 145 coming out of the BAC take priority over the data lines from the branch predictor, so that the incremented IP is forwarded to the IP Gen mux and passed to the fetch unit to correct the branch misprediction by fetching the instruction that follows sequentially after the IP.

[0071] Embodiments herein for omitting security checks in speculative execution may be instantiated with various architectures to enforce a particular security policy (e.g., memory safety policy and / or type safety policy). One example of this is with Intel® Memory Protection Extensions (MPX), which defines instructions (e.g., BNDCL / N / U) that check a pointer against a memory range indicated by a pair of registers (e.g., 64-bit). These instructions may therefore be used to enforce memory safety. Embodiments herein for omitting security checks in speculative execution may redefine instruction prefixes (e.g., segment overwrite prefixes) that are otherwise meaningless in the context of the instruction (e.g., MPX instruction) to hint to the processor that a check is only necessary if the pointer of the access is not already considered safe. The processor may identify the relevant accesses by enumerating which instructions use the register that contains the pointer. However, for example, since the actual access follows the associated MPX instruction, it is also possible to regard the instruction itself as if it were an access instruction and to determine safety on the basis of the access instruction.

[0072] The following pseudocode sequence shows how an MPX instruction can be modified with a hint that indicates that the security check is only required if the MPX instruction can be misspeculated. [Table 2]

[0073] This pseudocode example shows that, using the ES segment overwrite prefix, memory safety checks are not necessary (e.g., can be omitted) if the associated access is known not to be misspeculated. For example, in this context, the original purpose of the ES prefix is ​​not important, and therefore we consider it an available instruction prefix to use for hints here.

[0074] In certain embodiments, an instruction with a hint is treated as a no-operation (nop) if it is already deemed safe, an example of which is shown in FIG.

[0075] 2 illustrates a flow diagram 200 for skipping a security check instruction according to an embodiment of the present disclosure. The illustrated flow diagram 200 includes receiving 202 a request to execute a security check instruction with a hint (e.g., a security check field), determining 204 whether all associated accesses of the security check instruction are already safe, and if so, skipping (e.g., omitting) 206 the execution of the security check instruction, and if not, executing 208 the security check instruction.

[0076] In a particular embodiment, the omission removes a proper subset of the functionality of the instruction (e.g., security checking), but does not remove all of the functionality (e.g., removes only the security checking functionality of the partially omitted instruction). Pseudocode for this example is provided below.

[0077] A processor may have an encoded inline feature (EIC) as another security architecture that utilizes a separate security check instruction, and EIC may be treated somewhat similarly to an MPX instruction in the context of the embodiments herein for the omission of security checks. In a particular embodiment, the difference between MPX and EIC is that the bounds check instruction of EIC not only performs a bounds check similar to the MPX instruction, but also decodes the input pointer value so that it can be used by a subsequent memory access. While the MPX embodiment stores the bounds separately from the pointer, the EIC embodiment embeds the bounds information directly into the encoded pointer (e.g., 64 bits). This means that in a particular embodiment, the pointer is decoded to remove that additional information before attempting to access memory through the pointer. Thus, even if the access has been found to be safe and has been marked as requiring a security check only if potentially misspeculated, the EIC security check instruction of a particular embodiment still decodes the pointer and allows the subsequent memory access to proceed.

[0078] One example of an EIC security check instruction (e.g., referred to as CheckCap) takes input operands that specify an encoded pointer and the size of the access to be performed, e.g., so that decoding and executing the instruction performs a bounds check and, if the bounds check is successful, overwrites the encoded pointer with the decoded pointer.

[0079] This is illustrated in the following code sequence, which is based on the pseudocode above used in the MPX-based example. [Table 3]

[0080] Like the MPX-based example, the EIC example redefines the segment overwrite prefix ES to indicate to the processor that, in a particular embodiment, bounds checking needs to be performed only if the instruction is potentially misspeculated.

[0081] Other instructions can also be redefined that use the application or language runtime to manage the storage of bounds and type information, and perform the actual security checks when necessary. For example, the RBNDCL / N / U instructions may operate on bounds stored in general purpose registers (GPRs) rather than MPX bounds registers, and they may be modified in this context of the disclosure as well. Additionally, a type check (TYPECHK) instruction may be defined to compare two type identification values ​​(IDs) for equality and generate an exception if they do not match. These instructions may also be modified with hints such as the ES prefix to skip security checks if the instruction is safe.

[0082] Some architectures may not rely on separate instructions to perform security checks, and may instead perform security checks automatically before accessing memory. For example, if a pointer containing a tag value is used in a memory access, the memory tag may be automatically checked. The tag values ​​of all accessed memory locations may be loaded from tag storage and compared to the tags in the pointer. If any of these comparisons exhibit a mismatch, an exception may be generated. Similar to how hints can be provided for security check instructions, hints may be provided to memory accesses indicating that the automatic security check should be skipped. Below is an exemplary pseudocode based on the above example: [Table 4]

[0083] However, using certain segment overwrite prefixes as hints may have undesirable effects on memory access. For example, using the FS and GS prefixes to provide hints according to the present disclosure may result in the addition of a segment base address to the address specified in the memory access, which may result in accessing an incorrect memory location. For example, this type of address calculation occurs when these prefixes are already defined in the processor architecture. In other modes (e.g., using 32-bit linear addresses), more segment overwrite prefixes may result in unintended addition of addresses to the segment base. Therefore, in certain embodiments, it may be necessary to choose other prefixes that do not cause unintended effects, or to define new prefixes or other encodings for hints.

[0084] Some instructions combine multiple type checks in the same instruction. In one embodiment, an instruction checks both bounds and type information. To illustrate this, consider that the MPX bounds register and the corresponding bounds table entry may be extended to include type information, and that the MPX instruction may be extended to check that type information. For example, one variation of a bounds check (e.g., lower bound check) instruction accepts an address to be checked in a single register operand, and can be extended to accept an immediate operand that specifies a type ID. As an example, this extended instruction (e.g., BNDCL), called TYPEBNDCL, may compare the type ID in its immediate operand to the type ID in the bounds register and generate an exception if they do not match. Thus, a compiler may provide hints to selectively cancel one or both of the bounds check and the type check if the instruction is known to be safe. For example, the ES prefix may cancel the bounds check in such cases, and the FS segment overwrite prefix may cancel the type check in such cases. To cancel both of these checks, both prefixes may be provided, the ES prefix and the GS segment overwrite prefix, or a third hint may be defined for that purpose, e.g. the GS prefix.

[0085] Not all architectures define separate security check instructions for enforcing security policies, and approaches to modify instructions to generate accesses with instruction prefixes may be applied here as well. For example, memory tagging implicitly checks accesses against bounds metadata indexed by the address of the storage location being accessed. Since certain architectures are complex instruction set computing (CISC), many instructions may generate memory accesses, e.g., all instructions with memory operands. Other security architectures may also perform implicit checks, such as functional mechanisms to enforce memory and type safety using fat pointers. As shown in the sample code above, in some cases it is necessary to perform only one or the other of bounds and type checks for secure accesses, and thus separate qualifiers for each of these types of checks may be defined for architectures that support both within a single instruction.

[0086] Below, examples of inserting hints (e.g., security check fields) are described. In certain embodiments, each time the compiler issues a memory access and any associated security check instructions (if applicable), the compiler determines whether to also issue one or more hints as described herein. To do so, in certain of these embodiments, the compiler considers whether a security check may be omitted if the access is deemed safe. Several illustrative scenarios are described above, but are not exhaustive.

[0087] An exemplary flow for making these determinations is described below with reference to Figure 3. This flow may be executed multiple times per access, making different determinations for different types of policies, e.g., once for a memory safety checking policy and another time for a type safety checking policy. In certain embodiments, these decisions ultimately result in a merged hint as described above, e.g., indicating that if the access is deemed safe, then both memory safety and type safety checks are omitted.

[0088] 3 illustrates a flow diagram 300 for issuing hints in code according to an embodiment of the present disclosure. The illustrated flow 300 includes receiving 302 code (e.g., by or from a compiler) including a memory access and an associated security check instruction, determining 304 whether an applicable security policy may be violated if the access is deemed safe, and if not, issuing 306 the hint (e.g., as a security check field of the security check instruction) in the code, and if yes, not issuing 308 the hint (e.g., as a security check field of the security check instruction) in the code (e.g., so that the security check instruction is executed).

[0089] The following include examples of potential types of speculation and associated checks:

[0090] In one embodiment, the hint to the processor regarding security checks to be performed if (e.g., only if) an instruction may potentially be misspeculated specifies a type of policy to be enforced in the case of a potential misspeculation. Then, for example, the processor checks a condition that depends on the type of speculation that the processor supports to determine whether an instruction is potentially misspeculated.

[0091] The following describes non-exhaustive examples of types of potential speculation that may be supported by a processor, and associated checks that the processor may perform to determine whether an instruction may potentially be misspeculated for that particular type of speculation. If a processor supports multiple types of speculation, the processor may perform checks against all supported types of speculation to determine that an instruction will not be misspeculated in a manner that may violate a particular security policy (e.g., memory safety or type safety).

[0092] Note that there may be other types of speculations supported for which security checks may be skipped so as not to violate applicable security policies, even though the processor has not determined whether aspects of the instruction related to other types of speculation are correctly speculated. For example, consider data values ​​that may be speculated. Even if the data value of a store is misspeculated, it does not violate the memory safety or type safety policies of a particular embodiment, since, for example, the data value to be stored does not affect which address is used for the store.

[0093] Thus, particular embodiments distinguish between instructions that are "safe" (e.g., a memory access associated with a security check instruction) as opposed to instructions that are "correctly speculated" to refer to instructions for which the processor has determined that misspeculating some aspect of the instruction's execution would not undermine an applicable security policy (e.g., a memory access associated with a security check instruction). [Branch Prediction]

[0094] A processor may attempt to predict which direction a branch will take based on history from previous branches and other factors. In certain embodiments, this is used to speculatively execute the predicted branch target before the branch is resolved (e.g., the correct direction is fully determined). In certain embodiments, to determine that an instruction is on the correct speculated path, the processor must first resolve previous branches in the program. [Store buffer bypass speculation]

[0095] The processor may reorder loads and stores, and in some cases a load may occur that obtains data from a location that would be overwritten by an older store (e.g., that precedes the load in the program). That data may be used speculatively by operations that depend on that load. For example, the data may be interpreted as a pointer address or an integer or floating-point value, etc. In order for the processor to determine that the correct value is being loaded, the processor may use memory disambiguation circuitry to verify that the load references a location that is not also referenced by an older (e.g., in program order) store operation that has already been buffered. [Other possible types of security hardening]

[0096] There are other possible approaches to security hardening, such as waiting until all preceding branches are resolved before allowing a memory access that modifies the cache state that may be visible to an adversary. These can enforce even stricter policies than the examples shown above, which may otherwise allow modifications to the cache state that may be visible to an adversary after memory safety or type safety checks have been completed, but as part of enforcing these policies there may be some form of misspeculation that is not yet checked. For example, consider the following example pseudocode: [Table 5]

[0097] Considering that the read from the memory pointed to by priv may be delayed, the processor may misspeculate whether to execute the code in the if block or the else block. Memory safety and / or type safety checks may still be applicable to accesses to the array referenced through the arr variable. However, these checks do not necessarily prevent access to priv_array when foo is called from an unprivileged caller, regardless of whether the specific hints described in this disclosure are applied to these checks. In so doing, consider that a malicious caller could potentially use the return value from the function to affect the state of the cache in a manner that is visible to an adversary.

[0098] For such situations, another type of hint is defined here to selectively enforce a stricter policy, such as the one described in the pseudocode above. For example, the memory access generated by the return statement in the sample code may be modified with another segment-overwrite prefix, e.g., GS, to indicate that the memory access should be conditioned by a stricter policy. However, for some applications or a subset of applications, memory safety and type safety may be sufficient, and users of the code would benefit from additional optimizations that would be possible if only the looser policies were enforced. The ability to selectively enforce such a stricter policy may be useful in enforcing a looser policy by default, providing additional optimization opportunities, while also enforcing the stricter policy at critical points in the program.

[0099] The strategy of making speculation invisible in the data cache hierarchy is one example of a mechanism for enforcing the stricter type of policy that may be selected by this hint as described above.

[0100] 4 illustrates a flow diagram 400 according to an embodiment of the present disclosure. The illustrated flow 400 includes decoding an instruction with a decoder of a hardware processor into a decoded instruction 402, detecting a security check field in the instruction by the hardware processor 404, determining a security check policy to be enforced for potentially misspeculated execution from a plurality of security check policies by the hardware processor based on the security check field 406, performing one or more associated checks of the security check policies on the instruction to determine whether the instruction is potentially misspeculated 408, scheduling 410 the instruction for execution if the one or more associated checks deem the instruction unsafe, skipping 412 the instruction if the one or more associated checks deem the instruction safe, and executing 414 the instruction scheduled for execution using an execution unit of the hardware processor.

[0101] The following describes exemplary architectures, systems, etc. in which the above teachings may be used.

[0102] At least some embodiments of the techniques of this disclosure can be illustrated in light of the following examples. [Example 1] a decoder for decoding the instructions into decoded instructions; 1. A speculation manager circuit, comprising: Detecting hints (e.g., security check fields) in the instructions; determining a security check policy to be enforced for the potentially misspeculated execution from among a plurality of security check policies based on the hint (e.g., the security check field); performing one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling said instruction for execution if said one or more associated checks deem said instruction unsafe; a speculation manager circuit that omits the instruction if the one or more associated checks deem the instruction safe; and an execution unit for executing the instructions scheduled for execution. [Example 2] 2. The apparatus of example 1, wherein the hint (eg, the security check field) is a hint provided by a compiler. [Example 3] 2. The apparatus of example 1, wherein the speculation manager circuitry performs the one or more associated checks of the security checking policy on the set of associated memory accesses of the instruction. [Example 4] 2. The apparatus of example 1, wherein the security checking policy is a memory safety checking policy. [Example 5] The apparatus of example 1, wherein the security check policy is a type safety check policy. [Example 6] 2. The apparatus of example 1, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check. [Example 7] 2. The apparatus of example 1, wherein the one or more associated checks are less than a full compliance check of an architecture specification of the apparatus. [Example 8] 2. The apparatus of example 1, wherein the instruction is a security check instruction associated with a memory access instruction that follows in program order. [Example 9] Decoding the instruction into a decoded instruction using a decoder of a hardware processor; detecting, by said hardware processor, a security check field within said instruction; determining, by the hardware processor, a security check policy to be enforced for the potentially misspeculated execution from a plurality of security check policies based on the security check field; performing, by the hardware processor, one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling, by the hardware processor, the instruction for execution if the instruction is deemed unsafe by the one or more associated checks; omitting, by said hardware processor, said instruction if said one or more associated checks deem said instruction safe; and executing the instruction scheduled for execution using an execution unit of the hardware processor. [Example 10] 10. The method of example 9, wherein the security check field is a hint provided by the compiler. [Example 11] 10. The method of example 9, wherein the performing step includes performing the one or more associated checks of the security checking policy against the set of associated memory accesses of the instruction. [Example 12] 10. The method of example 9, wherein the security checking policy is a memory safety checking policy. [Example 13] 10. The method of example 9, wherein the security checking policy is a type safety checking policy. [Example 14] 10. The method of example 9, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check. [Example 15] 10. The method of example 9, wherein the one or more associated checks are less than a full compliance check of an architectural specification of the hardware processor. [Example 16] 10. The method of example 9, wherein the instruction is a security check instruction associated with a memory access instruction that follows in program order. [Example 17] A non-transitory machine-readable medium storing code that, when executed by a machine, causes the machine to perform a method, the method comprising: decoding the instructions into decoded instructions using a decoder of a hardware processor; detecting, by said hardware processor, a security check field within said instruction; determining, by the hardware processor, a security check policy to be enforced for the potentially misspeculated execution from a plurality of security check policies based on the security check field; performing, by the hardware processor, one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling, by the hardware processor, the instruction for execution if the instruction is deemed unsafe by the one or more associated checks; omitting, by the hardware processor, the instruction if the one or more associated checks deem the instruction safe; and and executing, with an execution unit of the hardware processor, the instructions that are scheduled for execution. [Example 18] 18. The non-transitory machine-readable medium of example 17, wherein the security check field is a hint provided by a compiler. [Example 19] 20. The non-transitory machine-readable medium of example 17, wherein the performing step includes performing the one or more associated checks of the security check policy against the set of associated memory accesses of the instructions. [Example 20] 18. The non-transitory machine-readable medium of example 17, wherein the security check policy is a memory safety check policy. [Example 21] 18. The non-transitory machine-readable medium of example 17, wherein the security check policy is a type safety check policy. [Example 22] 18. The non-transitory machine-readable medium of Example 17, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check. [Example 23] 20. The non-transitory machine-readable medium of example 17, wherein the one or more associated checks are less than a full compliance check of an architectural specification of the hardware processor. [Example 24] 20. The non-transitory machine-readable medium of example 17, wherein the instructions are security check instructions associated with a memory access instruction that follows in program order.

[0103] In yet another embodiment, an apparatus includes a data storage device storing code that, when executed by a hardware processor, causes the hardware processor to perform any of the methods disclosed herein. The apparatus may be as described in the detailed description. The method may be as described in the detailed description.

[0104] An instruction set may include one or more instruction formats. A particular instruction format may define various fields (e.g., number of bits, bit positions) that specify, among other things, the operation to be performed (e.g., opcode) and the operands and / or other data fields (e.g., masks) on which the operation is to be performed. Some instruction formats may be further subdivided by the definition of instruction templates (or sub-formats). For example, instruction templates of a particular instruction format may be defined to have different subsets of the instruction format's fields (wherein the included fields are usually in the same order, but at least some have different bit positions because fewer fields are included) and / or may be defined to have specific fields that differ in interpretation. Thus, each instruction of the ISA is expressed using a particular instruction format (and, if defined, a particular one of the instruction templates of that instruction format) and includes fields for specifying an operation and an operand. For example, an exemplary ADD instruction has an instruction format that includes a particular opcode and an opcode field for specifying the opcode and operand fields (source1 / destination and source2) for selecting the operand. Occurrences of this ADD instruction in the instruction stream will have particular content in the operand field that selects a particular operand. A set of SIMD extensions called Advanced Vector Extensions (AVX) (AVX1 and AVX2) and the use of the Vector Extensions (VEX) coding scheme have been released and / or published (see, e.g., Intel® 64 and IA-32 Architectures Software Developer's Manual, November 2018, and Intel® Architecture Instruction Set Extensions Programming Reference, October 2018). [Example instruction format]

[0105] Embodiments of the instructions described herein may be embodied in different formats. Additionally, exemplary systems, architectures, and pipelines are described below. Embodiments of the instructions may be executed on such systems, architectures, and pipelines, but are not limited to those described. [Generic vector instruction format]

[0106] A vector friendly instruction format is an instruction format that is suitable for vector instructions (e.g., there are certain fields that are specific to vector operations). Although embodiments are described in which the vector friendly instruction format supports both vector and scalar operations, alternative embodiments use only vector operations via the vector friendly instruction format.

[0107] 5A-5B are block diagrams illustrating a generic vector friendly instruction format and its instruction templates according to an embodiment of the present disclosure. FIG. 5A is a block diagram illustrating a generic vector friendly instruction format and its class A instruction templates according to an embodiment of the present disclosure, while FIG. 5B is a block diagram illustrating a generic vector friendly instruction format and its class B instruction templates according to an embodiment of the present disclosure. Specifically, generic vector friendly instruction format 500 defines class A and class B instruction templates, both of which include no memory access 505 and memory access 520 instruction templates. The term generic in the context of the vector friendly instruction format refers to an instruction format that is not tied to any particular instruction set.

[0108] This disclosure provides an understanding of how vector friendly instruction formats support vector operand lengths (or sizes) of 64 bytes with data element widths (or sizes) of 32 bits (4 bytes) or 64 bits (8 bytes) (thus a 64 byte vector is made up of 16 doubleword sized elements or alternatively 8 quadword sized elements); vector operand lengths (or sizes) of 64 bytes with data element widths (or sizes) of 16 bits (2 bytes) or 8 bits (1 byte); and vector operand lengths (or sizes) of 32 bits (4 bytes), 64 bits (8 bytes), 16 bits (2 bytes) or 8 bits (1 byte). While embodiments are described supporting a 32-byte vector operand length (or size) with 32 bits (4 bytes), 64 bits (8 bytes), 16 bits (2 bytes), or 8 bits (1 byte) data element widths (or sizes), alternative embodiments may support more, fewer, and / or different vector operand sizes (e.g., 256 byte vector operands) with more, fewer, or different data element widths (e.g., a 128-bit (16 byte) data element width).

[0109] The class A instruction templates in Figure 5A include 1) a no memory access, full round control type operation 510 instruction template and a no memory access, data transform type operation 515 instruction template shown in the no memory access 505 instruction templates, and 2) a memory access, temporal 525 instruction template and a memory access non-temporal 530 instruction template shown in the memory access 520 instruction templates. The class B instruction templates in Figure 5B include 1) a no memory access, write mask control, partial round control type 512 instruction template and a no memory access, write mask control, v size type operation 517 instruction template shown in the no memory access 505 instruction templates, and 2) a memory access, write mask control 527 instruction template shown in the memory access 520 instruction templates.

[0110] The generic vector friendly instruction format 500 includes the following fields in the order shown in FIGS. 5A-5B:

[0111] Format field 540: A particular value in this field (the instruction format identifier value) uniquely identifies the vector friendly instruction format and therefore the occurrence of an instruction in the vector friendly instruction format in an instruction stream. As such, this field is optional in the sense that it is not needed for an instruction set that has only a generic vector friendly instruction format.

[0112] Basic operation field 542: Its contents distinguish between different basic operations.

[0113] Register index field 544: its contents specify the location of the source and destination operands, whether in registers or in memory, either directly or through address generation. They contain a sufficient number of bits to select N registers from a PxQ (e.g., 32x512, 16x128, 32x1024, 64x1024) register file. In one embodiment, N may be up to three source registers and one destination register, while alternative embodiments may support a greater or lesser number of source and destination registers (e.g., up to two sources may be supported, where one of the sources also acts as a destination; up to three sources may be supported, where one of the sources also acts as a destination; up to two sources and one destination may be supported).

[0114] Qualifier field 546: its content distinguishes the occurrence of instructions in the generic vector instruction format that specify memory access from instructions that do not, i.e., between the no-memory-access 505 instruction template and the memory-access 520 instruction template. Memory access operations read and / or write to the memory hierarchy (possibly using values ​​in registers to specify source and / or destination addresses), while non-memory-access operations do not (e.g., the source and destination are registers). In one embodiment, this field also selects between three different ways to perform memory address calculations, while alternative embodiments may support more, less, or different ways to perform memory address calculations.

[0115] Extended operation field 550: its contents distinguish which of a variety of different operations are performed in addition to the basic operation. This field is context specific. In one embodiment of the present disclosure, this field is split into a class field 568, an alpha field 552 and a beta field 554. The extended operation field 550 allows a group of common operations to be performed within a single instruction instead of two, three or four instructions.

[0116] Scale field 560: its contents are the scale factor for memory address generation (e.g., 2 scale *Allows scaling of the contents of the index field (for address generation using index+base).

[0117] Displacement field 562A: its contents are used to generate memory addresses (e.g., 2 scale *Used as part of an address generation using index + base + displacement.

[0118] Displacement factor field 562B (note that the juxtaposition of displacement field 562A directly above displacement factor field 562B indicates that one or the other may be used): its contents are used as part of address generation; it specifies the displacement factor to be scaled by the size of the memory access (N), where N is the number of bytes in the memory access (e.g., 2 scale *For address generation using index + base + scaled displacement). Redundant low-order bits are ignored, and therefore the contents of the displacement factor field are multiplied by the total size of the memory operands (N) to generate the final displacement used in calculating the effective address. The value of N is determined by the processor hardware at runtime based on the full opcode field 574 (described later in this specification) and the data manipulation field 554C. The displacement field 562A and the displacement factor field 562B are optional in the sense that they are not used in the no memory access 505 instruction templates and / or different embodiments may implement only one or neither of the two.

[0119] Data element width field 564 - its contents distinguish which of multiple data element widths are used (in some embodiments for all instructions, in other embodiments for only some of the instructions). This field is optional in the sense that if only one data element width is supported and / or the data element width is supported using some aspect of the opcode, then this field is not required.

[0120] Write mask field 570: its contents control, on a per data element position basis, whether that data element position in the destination vector operand is reflected in the results of the basic and extended operations. Class A instruction templates support a merging write mask, while class B instruction templates support both a merging and a zeroing write mask. In the case of merging, the vector mask allows any set of elements of the destination to be protected from being updated during the execution of the operation (specified in the basic and extended operations). In another embodiment, the old value of each element of the destination is preserved if the corresponding mask bit has a zero value. In contrast, in the case of zeroing, the vector mask allows any set of elements of the destination to be zeroed during the execution of the operation (specified in the basic and extended operations). In one embodiment, an element of the destination is set to zero if the corresponding mask bit has a zero value. A subset of this functionality is the ability to control the vector length of the operation being performed (i.e., the span from the first to the last element being modified). However, the elements being modified need not be contiguous. Thus, the write mask field 570 allows for partial vector operations including loads, stores, arithmetic, logical, etc. While embodiments of the present disclosure are described in which the contents of the write mask field 570 select one of a number of write mask registers containing the write mask to be used (and thus the contents of the write mask field 570 indirectly identify the mask to be performed), alternative embodiments allow the contents of the write mask field 570 to alternatively or additionally directly specify the mask to be performed.

[0121] Immediate field 572 - its contents allow the specification of an immediate value. This field is optional in the sense that it is not present in implementations of the generic vector format that do not support immediate values, and it is not present in instructions that do not use immediate values.

[0122] Class field 568: its contents distinguish between different classes of instructions. With reference to Figures 5A-5B, the contents of this field select between class A and class B instructions. In Figures 5A-5B, rounded corner boxes are used to indicate that a particular value is present in the field (e.g., class A 568A and class B 568B for each class field 568 in Figures 5A-5B). [Class A instruction template]

[0123] For class A no memory access 505 instruction templates, the alpha field 552 is interpreted as an RS field 552A whose content distinguishes which of the different extended operation types is to be performed (e.g., round 552A.1 and data transform 552A.2 are specified for the no memory access, round type operation 510 and the no memory access, data transform type operation 515 instruction templates, respectively), while the beta field 554 distinguishes which of the specified types of operations is to be performed. In no memory access 505 instruction templates, the scale field 560, displacement field 562A and displacement scale field 562B are not present. [Non-memory access instruction template - full round control type operation]

[0124] In the non-memory access full round control type operation 510 instruction template, the beta field 554 is interpreted as a round control field 554A, whose contents provide static rounding. While in the described embodiment of the present disclosure, the round control field 554A includes a suppress all floating-point exceptions (SAE) field 556 and a round operation control field 558, alternative embodiments may support encoding both of these concepts into the same field, or may support having only one or the other of these concepts / fields (e.g., only having the round operation control field 558).

[0125] SAE field 556: its contents determine whether exception event reporting is disabled. If the contents of SAE field 556 indicate that suppression is enabled, the particular instruction will not report floating-point exception flags and will not raise the floating-point exception handler.

[0126] Round operation control field 558: its contents distinguish which of a set of round operations (e.g., round up, round down, round towards zero, and round towards nearest) is performed. Thus, the round operation control field 558 allows changing of the round mode on a per instruction basis. In one embodiment of the present disclosure where the processor includes a control register for specifying the round mode, the contents of the round operation control field 550 overwrite that register value. [Non-memory access instruction template - data transformation type operation]

[0127] In the no memory access data transform type operation 515 instruction template, the beta field 554 is interpreted as a data transform field 554B, and the contents of the data transform field 554B distinguish which of several data transforms (e.g., no data transform, swizzle, broadcast) is performed.

[0128] For class A memory access 520 instruction templates, alpha field 552 is interpreted as eviction hint field 552B, whose contents distinguish which eviction hint is used (in FIG. 5A , temporal 552B.1 and non-temporal 552B.2 are specified for memory access, temporal 525 instruction templates and memory access, non-temporal 530 instruction templates, respectively), while beta field 554 is interpreted as data manipulation field 554C, whose contents distinguish which of several data manipulation operations (also known as primitives) (e.g., no operation, broadcast, up-conversion of source, down-conversion of destination) is performed. Memory access 520 instruction templates include a scale field 560 and, optionally, a displacement field 562A or a displacement scale field 562B.

[0129] Vector memory instructions perform vector loads from memory and vector stores to memory, with conversion support. As with regular vector instructions, vector memory instructions transfer data to / from memory in whole data elements, with the elements actually transferred being described by the contents of the vector mask, which is selected as the writemask. [Memory Access Instruction Template - Temporary]

[0130] Transient data is data that is likely to be reused quickly enough to benefit from caching. However, this is a hint, and different processors may implement it differently, including ignoring the hint entirely. [Memory Access Instruction Template - Non-temporal]

[0131] Non-temporal data is data that is unlikely to be reused fast enough to benefit from caching in the first level cache, and should be given priority for eviction. However, this is a hint, and different processors may implement it differently, including ignoring the hint entirely. [Class B instruction template]

[0132] For class B instruction templates, the alpha field 552 is interpreted as a write mask control (Z) field 552C, and the contents of the write mask control (Z) field 552C distinguish whether the write mask controlled by the write mask field 570 should be merging or zeroing.

[0133] For class B no memory access 505 instruction templates, a portion of the beta field 554 is interpreted as an RL field 557A whose contents distinguish which of the different extended operation types is performed (e.g., round 557A.1 and vector length VSIZE 557A.2 are specified for the no memory access, write mask control, partial round control type operation 512 instruction template and the no memory access write mask control VSIZE type operation 517 instruction template, respectively), while the remainder of the beta field 554 distinguishes which of the specified types of operations is performed. The scale field 560, displacement field 562A, and displacement scale field 562B are not present in the no memory access 505 instruction templates.

[0134] In the no memory access, write mask control, partial round control type operation 510 instruction template, the remainder of the beta field 554 is interpreted as a round operation field 559A and exception event reporting is disabled (the particular instruction does not report any floating-point exception flags or raise any floating-point exception handlers).

[0135] Round operation control field 559A: Just like the round operation control field 558, its contents distinguish which of a set of round operations is performed (e.g., round up, round down, round towards zero, and round towards nearest). Thus, the round operation control field 559A allows for changing the round mode on a per instruction basis. In one embodiment of the present disclosure where the processor includes a control register for specifying the round mode, the contents of the round operation control field 550 overwrite that register value.

[0136] In the non-memory access write mask control VSIZE type operation 517 instruction template, the remainder of the beta field 554 is interpreted as a vector length field 559B, whose contents distinguish which of several data vector lengths (e.g., 128, 256 or 512 bytes) is to be executed.

[0137] For class B memory access 520 instruction templates, a portion of the beta field 554 is interpreted as a broadcast field 557B whose content distinguishes whether a broadcast-type data manipulation operation is performed, while the remainder of the beta field 554 is interpreted as a vector length field 559B. The memory access 520 instruction templates include a scale field 560 and, optionally, a displacement field 562A or a displacement scale field 562B.

[0138] For generic vector friendly instruction format 500, full opcode field 574 is illustrated to include format field 540, primitive operation field 542, and data element width field 564. While one embodiment is illustrated as full opcode field 574 including all of these fields, in embodiments that do not support all of these, full opcode field 574 includes less than all of these fields. Full opcode field 574 provides an operation code (opcode).

[0139] The extended operation field 550, data element width field 564, and write mask field 570 allow these functions to be specified on a per instruction basis in the generic vector friendly instruction format.

[0140] The write mask field and the data element width field combined form a type specific instruction in the sense that they allow masks to be applied based on different data element widths.

[0141] The various instruction templates found in class A and class B are useful in different situations. In some embodiments of the present disclosure, different processors or different cores within a processor may support only class A, only class B, or both classes. For example, a high performance general purpose out-of-order core for general purpose computing may support only class B, a core primarily for graphics and / or scientific (throughput) computing may support only class A, and a core for both may support both (of course, a core with some mix of templates and instructions from both classes, but not all templates and instructions from both classes, is within the scope of the present disclosure). Also, a single processor may include multiple cores, all of which support the same class, or different cores support different classes. For example, in a processor with separate graphics and general purpose cores, one of the graphics cores primarily for graphics and / or scientific computing may support only class A, while one or more of the general purpose cores may be a high performance general purpose core with out-of-order execution and register renaming for general purpose computing that supports only class B. Another processor that does not have a separate graphics core may include one or more general-purpose in-order or out-of-order cores that support both class A and class B. Of course, in different embodiments of the present disclosure, functions belonging to one class may be implemented in other classes. Programs written in high-level languages ​​are organized into a variety of different executable forms (e.g., run-time or static compilation). Such forms include: 1) forms that have only instructions of classes supported by the target processor for execution, or 2) forms that have alternative routines written using different combinations of all classes, and have control flow code that selects which routines to execute based on the instructions supported by the processor currently executing the code. [Example Vector Specific Instruction Format]

[0142] 6A-6D are block diagrams illustrating an example vector specific instruction format according to an embodiment of the present disclosure. FIGS. 6A-6D show a specific vector specific instruction format 600. The specific vector specific instruction format 600 is specific in the sense that it specifies the location, size, interpretation and field order as well as values ​​for some of these fields. The specific vector specific instruction format 600 may be used to extend the x86 instruction set, and thus some of the fields are similar or identical to those used in the existing x86 instruction set and its extensions (e.g., AVX). This format is consistent with the prefix encoding field, real opcode byte field, MOD R / M field, SIB field, displacement field and immediate field of the existing x86 instruction set with extensions. It is illustrated which fields in FIGS. 5A-5B map to which fields in FIGS. 6A-6D.

[0143] While embodiments of the present disclosure are described with respect to the specific vector instruction format 600 within the context of the generic vector instruction format 500 for illustrative purposes, it should be understood that the present disclosure is not limited to the specific vector instruction format 600 except as claimed. For example, while the generic vector instruction format 500 contemplates a variety of possible sizes for various fields, the specific vector instruction format 600 is illustrated as having fields of specific sizes. As a specific example, while the data element width field 564 is shown as a one-bit field in the specific vector instruction format 600, the present disclosure is not so limited (i.e., the generic vector instruction format 500 contemplates other sizes for the data element width field 564).

[0144] The generic vector friendly instruction format 500 includes the following fields in the order shown in FIG. 6A:

[0145] EVEX Prefix (bytes 0-3) 602: Encoded in 4-byte format.

[0146] Format field 540 (EVEX byte 0, bits [7:0]) - The first byte (EVEX byte 0) is the format field 540, which contains 0x62 (a unique value used to distinguish vector friendly instruction formats in one embodiment of the present disclosure).

[0147] The second through fourth bytes (EVEX bytes 1-3) contain multiple bit fields that provide specific functions.

[0148] REX field 605 (EVEX byte 1, bits [7-5]): consists of the EVEX.R bit field (EVEX byte 1, bit [7]-R), the EVEX.X bit field (EVEX byte 1, bit [6]-X) and the 557BEX byte 1, bit [5]-B. The EVEX.R, EVEX.X and EVEX.B bit fields serve the same functionality as the corresponding VEX bit fields and are encoded using one's complement format. That is, ZMM0 is encoded as 1111B and ZMM15 is encoded as 0000B. The other fields of the instruction encode the lower three bits of the register index (rrr, xxx and bbb) as known in the art. Thus, by adding EVEX.R, EVEX.X and EVEX.B, Rrrr, Xxxx and Bbbb may be formed.

[0149] REX' Field 510: This is the first part of the REX' field 510, the EVEX.R' bit field (EVEX byte 1, bit [4]-R') that is used to encode either the top 16 or the bottom 16 of the extended 32 register set. In one embodiment of the disclosure, this bit, along with others shown below, is stored in a bit-reversed format to distinguish it (in the well-known x86 32-bit mode) from the BOUND instruction, whose real opcode byte is 62, but whose MOD R / M field (see below) does not accept a value of 11 in the MOD field. Alternative embodiments of the disclosure do not store this and the other bits shown below in an inverted format. A value of 1 is used to encode the bottom 16 registers. In other words, R'Rrrr is formed by combining EVEX.R', EVEX.R, and other RRR from other fields.

[0150] Opcode map field 615 (EVEX byte 1, bits [3:0]‐mmmm): depending on its contents, encodes the implied initial opcode byte (0F, 0F 38 or 0F 3).

[0151] Data Element Width field 564 (EVEX byte 2, bit [7] - W) is represented by the notation EVEX.W. EVEX.W is used to define the granularity (size) of the data type (either 32-bit data elements or 64-bit data elements).

[0152] EVEX.vvvv 620 (EVEX byte 2, bits [6:3] - vvvv): The role of EVEX.vvvv may include: 1) EVEX.vvvv encodes the first source register operand specified in inverted (one's complement) format and is valid for instructions with two or more source operands; 2) EVEX.vvvv encodes the destination register operand specified in one's complement format for certain vector shifts; or 3) EVEX.vvvv does not encode any operand, the field is reserved and should contain 1111b. Thus, EVEX.vvvv field 620 encodes the four least significant bits of the first source register specifier stored in inverted (one's complement) format. Depending on the instruction, additional different EVEX bit fields are used to extend the specifier size to 32 registers.

[0153] EVEX.U568 Class field (EVEX byte 2, bit [2] - U): If EVEX.U=0, this indicates class A or EVEX.U0. If EVEX.U=1, this indicates class B or EVEX.U1.

[0154] Prefix encoding field 625 (EVEX byte 2, bits [1:0]-pp): provides additional bits to the basic operation field. In addition to providing support for legacy SSE instructions in EVEX prefix format, this also has the benefit of compressing the SIMD prefix (instead of requiring one byte to represent the SIMD prefix, the EVEX prefix only requires two bits). In one embodiment, to support legacy SSE instructions that use SIMD prefixes (66H, F2H, F3H) in both the legacy and EVEX prefix formats, these legacy SIMD prefixes are encoded in the SIMD prefix encoding field and expanded to the legacy SIMD prefixes at run time before being provided to the PLA in the decode circuitry (so that the PLA can execute both the legacy and EVEX formats of these legacy instructions without modification). Although newer instructions can use the contents in the EVEX prefix encoding field directly as an opcode extension, certain embodiments extend it in a similar fashion for consistency but to allow for different means to be specified by these legacy SIMD prefixes. Alternative embodiments can support 2-bit SIMD prefix encodings and therefore redesign the PLA to not require the extension.

[0155] Alpha field 552 (EVEX byte 3, bit [7] - EH: also known as EVEX.EH, EVEX.rs, EVEX.RL, EVEX.writemask control and EVEX.N, also denoted as α): As noted above, this field is context specific.

[0156] Beta field 554 (EVEX byte 3, bits [6:4] - SSS, EVEXs 2-0 , EVEXr 2-0 , EVEX.rr1, EVEX.LL0, EVEX.LLB, and also denoted as βββ). As stated above, this field is context specific.

[0157] REX' field 510: This is the remainder of the REX' field, the EVEX.V' bit field (EVEX byte 3, bit [3]-V') which can be used to encode either the top 16 or the bottom 16 of the extended 32 register set. This bit is stored in bit-reversed format. A value of 1 is used to encode the bottom 16 registers. In other words, EVEX.V', EVEX.vvvv combine to form V'VVVV.

[0158] Write mask field 570 (EVEX byte 3, bits [2:0]-kkk): its contents specify the index of a register in the write mask registers, as described above. In one embodiment of the present disclosure, a special value EVEX.kkk=000 has special behavior that implies that no write mask is used for the particular instruction (this may be implemented in a variety of ways, including a write mask hardwired to all ones or using hardware to bypass the masking hardware).

[0159] The real opcode field 630 (byte 4) is also known as the opcode byte. Part of the opcode is specified in this field.

[0160] MOD R / M field 640 (Byte 5) includes MOD field 642, Reg field 644, and R / M field 646. As mentioned above, the contents of MOD field 642 distinguish between memory access and non-memory access operations. The role of Reg field 644 can be summarized in two situations: either encoding a destination register operand or a source register operand, or it is treated as an opcode extension and is not used to encode an instruction operand. The role of R / M field 646 may include encoding an instruction operand that references a memory address, or encoding either a destination register operand or a source register operand.

[0161] Scale, Index, Base (SIB) Byte (Byte 6): As described above, the contents of the scale field 550 are used in memory address generation. SIB.xxx 654 and SIB.bbb 656: The contents of these fields were previously described for register indices Xxxx and Bbbb.

[0162] Displacement field 562A (bytes 7-10): If the MOD field 642 contains 10, then bytes 7-10 are the displacement field 562A, which works the same as the legacy 32-bit displacement (disp32) and operates at byte granularity.

[0163] Displacement factor field 562B (byte 7): When MOD field 642 contains 01, byte 7 is the displacement factor field 562B. The location of this field is identical to that of the legacy x86 instruction set 8-bit displacement (disp8), which operates at byte granularity. Since disp8 is sign-extended, it can only be addressed between offsets of -128 and 127 bytes. In terms of a 64-byte cache line, disp8 uses 8 bits that can only be set to four practically useful values ​​-128, -64, 0, and 64, and since a larger range is often needed, disp32 is used, but disp32 requires 4 bytes. In contrast to disp8 and disp32, the displacement factor field 562B is a reinterpretation of disp8, and when using the displacement factor field 562B, the actual displacement is determined by the contents of the displacement factor field multiplied by the size (N) of the memory operand access. This type of displacement is referred to as disp8*N. This reduces the average instruction length (a single byte is used for the displacement, but with a much larger range). Such a compressed displacement is based on the assumption that the effective displacement is a multiple of the granularity of the memory access, and therefore the redundant low-order bits of the address offset do not need to be encoded. In other words, the displacement factor field 562B replaces the 8-bit displacement of the legacy x86 instruction set. Hence, the displacement factor field 562B is encoded in the same way as the 8-bit displacement of the x86 instruction set, except only that disp8 is overloaded to disp8*N (so there is no change in the ModRM / SIB encoding rules). In other words, there is no change in the encoding rules or encoding length, but only in the interpretation of the displacement value by the hardware (which needs to scale the displacement by the size of the memory operand to get the address offset in bytes). The immediate field 572 works as described above. [Full Opcode Field]

[0164] 6B is a block diagram illustrating the fields of a specific vector instruction format 600 that make up the full opcode field 574 in accordance with one embodiment of the present disclosure. Specifically, the full opcode field 574 includes a format field 540, a primitive operation field 542, and a data element width (W) field 564. The primitive operation field 542 includes a prefix encoding field 625, an opcode map field 615, and a real opcode field 630. [Register index field]

[0165] 6C is a block diagram illustrating the fields of the specific vector instruction format 600 that make up the register index field 544, in accordance with one embodiment of the present disclosure. Specifically, the register index field 544 includes a REX field 605, a REX′ field 610, a MODR / M.reg field 644, a MODR / Mr / m field 646, a VVVV field 620, a xxx field 654, and a bbb field 656. [Extended operation field]

[0166] 6D is a block diagram illustrating the fields of the specific vector instruction format 600 that make up the extended operation field 550, according to one embodiment of the present disclosure. When the class (U) field 568 contains a 0, it means EVEX.U0 (Class A 568A), and when it contains a 1, it means EVEX.U1 (Class B 568B). When U=0 and the MOD field 642 contains 11 (signifying a non-memory access operation), the alpha field 552 (EVEX byte 3, bit [7] - EH) is interpreted as the rs field 552A. When the rs field 552A contains a 1 (round 552A.1), the beta field 554 (EVEX byte 3, bits [6:4] - SSS) is interpreted as the round control field 554A. The round control field 554A includes a 1-bit SAE field 556 and a 2-bit round operation field 558. If rs field 552A contains 0 (data transformation 552A.2), then beta field 554 (EVEX byte 3, bits [6:4]—SSS) is interpreted as a 3-bit data transformation field 554B. If U=0 and MOD field 642 contains 00, 01, or 10 (signifying a memory access operation), then alpha field 552 (EVEX byte 3, bit [7]—EH) is interpreted as an eviction hint (EH) field 552B and beta field 554 (EVEX byte 3, bits [6:4]—SSS) is interpreted as a 3-bit data manipulation field 554C.

[0167] If U=1, the alpha field 552 (EVEX byte 3, bit [7]—EH) is interpreted as a write mask control (Z) field 552C. If U=1 and the MOD field 642 contains 11 (representing a non-memory access operation), a portion of the beta field 554 (EVEX byte 3, bit [4]—S0) is interpreted as an RL field 557A. If it contains 1 (round 557A.1), the remainder of the beta field 554 (EVEX byte 3, bits [6-5]—S 2-1) is interpreted as the round operation field 559A, while if the RL field 557A contains zero (VSIZE 557.A2), the remainder of the beta field 554 (EVEX byte 3, bits [6-5]—S 2-1 ) is the vector length field 559B (EVEX byte 3, bits [6‐5]‐L 1-0 If U=1 and the MOD field 642 contains 00, 01, or 10 (indicating a memory access operation), the beta field 554 (EVEX byte 3, bits [6:4]-SSS) is interpreted as the vector length field 559B (EVEX byte 3, bits [6-5]-L 1-0 ) and broadcast field 557B (EVEX byte 3, bit [4]-B). [Example Register Architecture]

[0168] 7 is a block diagram of a register architecture 700 according to one embodiment of the disclosure. In the illustrated embodiment, there are 32 vector registers 710 that are 512 bits wide, and these registers are referred to as zmm0 through zmm31. The lower 256 bits of the lower 16 zmm registers are overlapped onto the ymm0-16 registers. The lower 128 bits of the lower 16 zmm registers (the lower 128 bits of the ymm registers) are overlapped onto the xmm0-15 registers. The vector specific instruction format 600 operates on these overlapped register files as shown in the table below. [Table 6]

[0169] In other words, the vector length field 559B selects between a maximum length and one or more other shorter lengths, each such shorter length being half the length of the preceding length, and instruction templates without the vector length field 559B operate on the maximum vector length. Furthermore, in one embodiment, the class B instruction templates of the specific vector friendly instruction format 600 operate on packed or scalar single / double precision floating point data and packed or scalar integer data. A scalar operation is an operation performed on the position of the least significant data element in a zmm / ymm / xmm register. Depending on the embodiment, the positions of the more significant data elements are either kept the same as before the instruction or are zeroed out.

[0170] Write Mask Registers 715: In the illustrated embodiment, there are eight write mask registers (k0 through k7), each 64 bits in size. In an alternative embodiment, the write mask registers 715 are 16 bits in size. As previously mentioned, in one embodiment of the present disclosure, the vector mask register k0 cannot be used as a write mask; if an encoding that would normally indicate k0 is used for a write mask, the vector mask register selects a hardwired write mask of 0xFFFF, effectively disabling write masking for that instruction.

[0171] General purpose registers 725: In the illustrated embodiment, there are sixteen 64-bit general purpose registers that are used in conjunction with the existing x86 addressing modes to address memory operands. These registers are referenced by the following names: RAX, RBX, RCX, RDX, RBP, RSI, RDI, RSP, and R8 through R15.

[0172] In the illustrated embodiment, scalar floating point stack register file (x87 stack) 745, which is an aliased portion of MMX packed integer flat register file 750, the x87 stack is an eight-element stack used to perform scalar floating point operations on 32 / 64 / 80 bit floating point data using the x87 instruction set extensions, while the MMX registers are used to perform operations on 64-bit packed integer data and to hold operands for some operations between MMX registers and XMM registers.

[0173] Alternative embodiments of the present disclosure may use wider or narrower registers, and alternative embodiments of the present disclosure may use more, fewer, or different register files and registers. [Exemplary Core Architectures, Processors, and Computer Architectures]

[0174] Processor cores may be implemented in different ways, for different purposes, and in different processors. For example, implementations of such cores may include: 1) general purpose in-order cores for general purpose computing; 2) high performance general purpose out-of-order cores for general purpose computing; 3) specialized cores primarily for graphics and / or scientific (throughput) computing. Implementations of different processors may include: 1) CPUs including one or more general purpose in-order cores for general purpose computing and / or one or more general purpose out-of-order cores for general purpose computing; and 2) co-processors including one or more specialized cores primarily for graphics and / or scientific (throughput). Such different processors result in different computer system architectures, which may include: 1) coprocessors on a separate chip from the CPU, 2) coprocessors on a separate die in the same package as the CPU, 3) coprocessors on the same die as the CPU (in which case such coprocessors may be referred to as special purpose logic, such as integrated graphics and / or scientific (throughput) logic, or special purpose cores), and 4) systems-on-chips on the same die (sometimes referred to as application cores or application processors) that may include the illustrated CPU, the coprocessors mentioned above, and additional functionality. Exemplary core architectures are now described, followed by descriptions of exemplary processors and computer architectures. [Example Core Architecture] [In-order and out-of-order core block diagram]

[0175] FIG. 8A is a block diagram illustrating both an exemplary in-order pipeline and an exemplary register renaming, out-of-order issue / execution pipeline according to an embodiment of the present disclosure. FIG. 8B is a block diagram illustrating both an exemplary embodiment in-order architecture core and an exemplary register renaming, out-of-order issue / execution architecture core included in a processor according to an embodiment of the present disclosure. The solid lined boxes in FIG. 8A-8B indicate the in-order pipeline and the in-order core, while the dashed lined boxes indicate optional additional register renaming, out-of-order issue / execution pipelines and cores. The out-of-order aspects will be described with the understanding that the in-order aspects are a subset of the out-of-order aspects.

[0176] In FIG. 8A , the processor pipeline 800 includes a fetch stage 802, a length decode stage 804, a decode stage 806, an allocation stage 808, a renaming stage 810, a scheduling (also known as dispatch or issue) stage 812, a register read / memory read stage 814, an execution stage 816, a writeback / memory write stage 818, an exception handling stage 822, and a commit stage 824.

[0177] 8B shows a processor core 890 that includes a front end unit 830 coupled to an execution engine unit 850, both of which are coupled to a memory unit 870. Core 890 may be a reduced instruction set computing (RISC) core, a complex instruction set computing (CISC) core, a very long instruction word (VLIW) core, or a hybrid or alternative core type. As yet another option, core 890 may be a special-purpose core, such as, for example, a network or communications core, a compression engine, a co-processor core, a general purpose computing graphics processing unit (GPGPU) core or a graphics core, etc.

[0178] The front-end unit 830 includes a branch prediction unit 832 coupled to an instruction cache unit 834, which is coupled to an instruction translation lookaside buffer (TLB) 836, which is coupled to an instruction fetch unit 838, which is coupled to a decode unit 840. The decode unit 840 (e.g., decode circuitry) decodes instructions (e.g., macro-instructions) and may generate as output one or more micro-operations, microcode entry points, microinstructions, other instructions, or other control signals that are decoded from, reflect, or are derived from the original instruction. The decode unit 840 may be implemented using a variety of different mechanisms. Examples of suitable mechanisms include, but are not limited to, look-up tables, hardware implementations, programmable logic arrays (PLAs), microcode read-only memories (ROMs), and the like. In one embodiment, core 890 includes a microcode ROM or other medium that stores microcode for particular macro instructions (e.g., in decode unit 840 or in front end unit 830). Decode unit 840 is coupled to a rename / allocator unit 852 in execution engine unit 850.

[0179] The execution engine units 850 include a rename / allocator unit 852 coupled to a retirement unit 854 and a set of one or more scheduler units 856. The scheduler units 856 represent any number of different scheduler circuits including reservation stations, central instruction window, etc. The scheduler units 856 are coupled to physical register file units 858. Each of the physical register file units 858 represents one or more physical register sets, different of which store one or more different data types such as scalar integer, scalar floating point, packed integer, packed floating point, vector integer, vector floating point, status (e.g., an instruction pointer, which is the address of the next instruction to be executed), etc. In one embodiment, the physical register file units 858 include a vector register unit, a write mask register unit, and a scalar register unit. These register units may provide architectural vector registers, vector mask registers, and general purpose registers. A physical register file unit 858 is layered on top of the retirement unit 854 to illustrate various ways in which register renaming and out-of-order execution may be implemented (e.g., using a reorder buffer and retirement register file, using a future file, a history buffer, and a retirement register file, using a register map and register pool, etc.). The retirement unit 854 and the physical register file unit 858 are coupled to an execution cluster 860. The execution cluster 860 includes a set of one or more execution units 862 (e.g., execution circuits) and a set of one or more memory access units 864. The execution units 862 may perform various operations (e.g., shift, add, subtract, multiply) on various data types (e.g., scalar floating point, packed integer, packed floating point, vector integer, vector floating point). While some embodiments may include multiple execution units dedicated to a particular function or set of functions, other implementations may include only one execution unit or multiple execution units that all perform all functions.Scheduler unit 856, physical register file unit 858, and execution cluster 860 are shown as multiple possibilities because in certain embodiments, separate pipelines are formed for particular data types / operations (e.g., a scalar integer pipeline, a scalar floating point / packed integer / packed floating point / vector integer / vector floating point pipeline, and / or a memory access pipeline, each of which has its own scheduler unit, physical register file unit, and / or execution cluster, and in the case of a separate memory access pipeline, a particular implementation is implemented in which only the execution cluster of this pipeline has a memory access unit 864). It should also be understood that if separate pipelines are used, one or more of these pipelines may be out-of-order issue / execution and the rest may be in-order.

[0180] A set of memory access units 864 is coupled to memory unit 870, including a data TLB unit 872 coupled to a data cache unit 874 coupled to a level 2 (L2) cache unit 876. In one exemplary embodiment, memory access units 864 may include a load unit, a store address unit, and a store data unit, each of which is coupled to the data TLB unit 872 of memory unit 870. Instruction cache unit 834 is further coupled to a level 2 (L2) cache unit 876 in memory unit 870. L2 cache unit 876 is coupled to one or more other levels of cache, and ultimately to main memory.

[0181] By way of example, an exemplary register renaming, out-of-order issue / execution core architecture may implement a pipeline 800 as follows: 1) an instruction fetch 838 performs a fetch stage 802 and a length decoding stage 804; 2) a decode unit 840 performs a decode stage 806; 3) a rename / allocator unit 852 performs an allocation stage 808 and a rename stage 810; 4) a scheduler unit 856 performs a scheduling stage 812; 5) a physical register file unit 858 and a memory unit 870 perform a register read / memory read stage 814, and an execution cluster 860 performs an execution stage 816; 6) a memory unit 870 and a physical register file unit 858 perform a write back / memory write stage 818; 7) various units may be involved in an exception handling stage 822; 8) a retirement unit 854 and a physical register file unit perform a commit stage 824.

[0182] Core 890 may support one or more instruction sets (e.g., the x86 instruction set (with some extensions added in newer versions), the MIPS instruction set from MIPS Technologies of Sunnyvale, California, the ARM instruction set from ARM Holdings of Sunnyvale, California (with optional extensions such as NEON)), including the instructions described herein. In one embodiment, core 890 includes logic to support packed data instruction set extensions (e.g., AVX1, AVX2), allowing operations used by many multimedia applications to be performed with packed data.

[0183] It will be appreciated that the cores may support multithreading (executing two or more parallel sets of operations or threads) and may do so in a variety of ways, including time sliced ​​multithreading, simultaneous multithreading (wherein a single physical core provides a logical core for each of the threads that the physical core is simultaneously multithreading), or a combination thereof (e.g., time sliced ​​fetch and decode followed by simultaneous multithreading, such as in Intel® Hyper-Threading Technology).

[0184] Although register renaming is described in the context of out-of-order execution, it should be understood that register renaming may be used in in-order architectures. While the illustrated embodiment of the processor includes separate instruction and data cache units 834 / 874 and a shared L2 cache unit 876, alternative embodiments may have a single internal cache for both instructions and data, such as, for example, a level 1 (L1) internal cache or multiple levels of internal cache. In some embodiments, the system may include a combination of an internal cache and an external cache that is external to the core and / or processor. Alternatively, all caches may reside external to the core and / or processor. [Specific Exemplary In-Order Core Architecture]

[0185] 9A-9B show block diagrams of a more specific exemplary in-order core architecture, where the core is one of several logic blocks (including other cores of the same and / or different types) in a chip. The logic block communicates with some fixed function logic, memory I / O interfaces, and other necessary I / O logic through a high bandwidth interconnect network (e.g., a ring network), depending on the application.

[0186] FIG. 9A illustrates a block diagram of a single processor core along with its connection to an on-die interconnect network 902 and its local subset of a level 2 (L2) cache 904, according to an embodiment of the disclosure. In one embodiment, an instruction decode unit 900 supports the x86 instruction set with packed data instruction set extension. An L1 cache 906 allows low latency access to cache memory into the scalar and vector units. While in one embodiment (for design simplicity) the scalar unit 908 and vector unit 910 use separate register sets (scalar registers 912 and vector registers 914, respectively) and data transferred between them is written to memory and then re-read from the level 1 (L1) cache 906, alternative embodiments of the disclosure may use different approaches (e.g., using a single register set or including a communication path that allows data transfer between the two register files without writing and re-reading).

[0187] The local subset of the L2 cache 904 is part of a global L2 cache that is divided into separate local subsets, one subset per processor core. Each processor core has a direct access path to its own local subset of the L2 cache 904. Data read by a processor core is stored in its L2 cache subset 904 and may be accessed quickly in parallel with other processor cores accessing their own local L2 cache subsets. Data written by a processor core is stored in its own L2 cache subset 904 and is flushed from other subsets if necessary. The ring network ensures coherency of shared data. The ring network is bidirectional to allow agents such as processor cores, L2 caches, and other logic blocks to communicate with each other within the chip. Each ring data path is 1012 bits wide in each direction.

[0188] FIG. 9B is an expanded view of a portion of the processor core in FIG. 9A according to an embodiment of the present disclosure. FIG. 9B includes an L1 data cache 906A, which is part of the L1 cache 904, and details regarding a vector unit 910 and vector registers 914. Specifically, the vector unit 910 is a 16-wide vector processing unit (VPU) (see 16-wide ALU 928), which executes one or more of integer, single-precision, and double-precision floating-point instructions. The VPU supports swizzling register inputs with swizzle unit 920, numeric conversion with numeric conversion units 922A-B, and replication to memory inputs with replication unit 924. A write mask register 926 allows for prediction of resulting vector writes.

[0189] 10 is a block diagram of a processor 1000 that may have two or more cores, may have an integrated memory controller, and may have integrated graphics, according to an embodiment of the disclosure. The solid lined box in FIG. 10 illustrates a processor 1000 having a single core 1002A, a system agent 1010, and a set of one or more bus controller units 1016, while the additional option of dashed lined boxes illustrates an alternative processor 1000 having multiple cores 1002A-N, a set of one or more integrated memory controller units 1014 in the system agent unit 1010, and dedicated logic 1008.

[0190] Thus, different implementations of the processor 1000 may include: 1) a CPU with special purpose logic 1008 that is integrated graphics and / or scientific (throughput) logic (which may include one or more cores) and one or more general purpose cores 1002A-N (e.g., general purpose in-order cores, general purpose out-of-order cores, combinations of the two), 2) a coprocessor with many special purpose cores 1002A-N primarily for graphics and / or scientific (throughput), and 3) a coprocessor with many general purpose in-order cores 1002A-N. Thus, the processor 1000 may be a general purpose processor, coprocessor, or special purpose processor, such as, for example, a network or communication processor, a compression engine, a graphics processor, a GPGPU (general purpose graphics processing unit), a high throughput MIC (Many Integrated Core) coprocessor, (including 30 or more cores), or an embedded processor. The processor may be implemented on one or more chips. The processor 1000 may be a part of and / or may be implemented on one or more substrates using any number of process technologies, such as, for example, BiCMOS, CMOS, or NMOS.

[0191] The memory hierarchy includes one or more levels of cache within the core, a set of shared cache units or one or more shared cache units 1006, and an external memory (not shown) coupled to a set of integrated memory controller units 1014. The set of shared cache units 1006 may include one or more intermediate levels of cache, such as a level 2 (L2), level 3 (L3), level 4 (L4) or other level cache, a last level cache (LLC), and / or combinations thereof. In one embodiment, a ring-based interconnect unit 1012 interconnects the integrated graphics logic 1008, the set of shared cache units 1006, and the system agent unit 1010 / integrated memory controller unit (1014), while alternative embodiments may use any number of well-known techniques for interconnecting such units. In one embodiment, coherency is maintained between the one or more cache units 1006 and the cores 1002-AN.

[0192] In some embodiments, one or more of the cores 1002A-N are capable of multithreading. The system agent 1010 includes these components that coordinate and operate the cores 1002A-N. The system agent unit 1010 may include, for example, a power control unit (PCU) and a display unit. The PCU may be or may include the logic and components necessary to coordinate the power state of the cores 1002A-N and the integrated graphics logic 1008. The display unit is for driving one or more externally connected displays.

[0193] The cores 1002A-N may be homogeneous or heterogeneous in terms of architectural instruction sets, i.e., two or more of the cores 1002A-N may be capable of executing the same instruction set, while others may be capable of executing a subset of that instruction set or a different instruction set. [Example Computer Architecture]

[0194] 11-14 are block diagrams of exemplary computer architectures. Other system designs and configurations known in the art for laptops, handheld PCs, personal digital assistants, engineering workstations, servers, network devices, network hubs, switches, embedded processors, digital signal processors (DSPs), graphics devices, video game devices, set-top boxes, microcontrollers, mobile phones, portable media players, handheld devices, and various other electronic devices are also suitable. In general, a vast number of different systems and electronic devices that can incorporate the processors and / or other execution logic disclosed herein are generally suitable.

[0195] 11, a block diagram of a system 1100 is shown according to one embodiment of the disclosure. The system 1100 may include one or more processors 1110, 1115, which are coupled to a controller hub 1120. In one embodiment, the controller hub 1120 includes a graphics memory controller hub (GMCH) 1190 and an input / output hub (IOH) 1150, which may be on separate chips. The GMCH 1190 includes a memory controller and a graphics controller, to which a memory 1140 and a coprocessor 1145 are coupled. The IOH 1150 couples an input / output (I / O) device 1160 to the GMCH 1190. Alternatively, one or both of the memory controller and the graphics controller may be integrated within the processor (as described herein), and the memory 1140 and the coprocessor 1145 are directly coupled to the controller hub 1120, which is on a single chip within the processor 1110 and the IOH 1150. Memory 1140 may include, for example, speculation manager code 1140A for storing code that, when executed, causes a processor to perform any of the methods of this disclosure.

[0196] The optional nature of the additional processors 1115 is indicated by dashed lines in Figure 11. Each processor 1110, 1115 may include one or more of the processing cores described herein and may be some version of processor 1000.

[0197] The memory 1140 may be, for example, dynamic random access memory (DRAM), phase change memory (PCM), or a combination of the two. In at least one embodiment, the controller hub 1120 communicates with the processors 1110, 1115 via a multi-drop bus such as a front side bus (FSB), a point-to-point interface such as a Quickpath Interconnect (QPI), or a similar connection 1195.

[0198] In one embodiment, the coprocessor 1145 is a special purpose processor, such as, for example, a high throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU or an embedded processor, etc. In one embodiment, the controller hub 1120 may include an integrated graphics accelerator.

[0199] There may be a wide variety of differences between the physical resources 1110, 1115 in terms of a wide range of value criteria including architectural characteristics, microarchitectural characteristics, thermal characteristics, power consumption characteristics, and the like.

[0200] In one embodiment, the processor 1110 executes instructions that control a general type of data processing operation. Coprocessor instructions may be embedded within the instructions. The processor 1110 recognizes these coprocessor instructions as being of a type that should be executed by an attached coprocessor 1145. The processor 1110 therefore issues these coprocessor instructions (or control signals representing the coprocessor instructions) to the coprocessor 1145 over a coprocessor bus or other interconnect. The coprocessor 1145 receives the coprocessor instructions and executes the received coprocessor instructions.

[0201] 12, a block diagram of a first, more specific, exemplary system 1200 is shown, according to an embodiment of the present disclosure. As shown in FIG. 12, the multiprocessor system 1200 is a point-to-point interconnect system and includes a first processor 1270 and a second processor 1280 coupled via a point-to-point interconnect 1250. Each of the processors 1270 and 1280 may be a particular version of the processor 1000. In one embodiment of the present disclosure, the processors 1270 and 1280 are the processors 1110 and 1115, respectively, while the coprocessor 1238 is the coprocessor 1145. In another embodiment, the processors 1270 and 1280 are the processors 1110 and 1145, respectively.

[0202] Processors 1270 and 1280 are shown to include integrated memory controller (IMC) units 1272 and 1282, respectively. Processor 1270 also includes point-to-point (P-P) interfaces 1276 and 1278 as part of its bus controller unit, and similarly, second processor 1280 includes P-P interfaces 1286 and 1288. Processors 1270, 1280 may exchange information over point-to-point (P-P) interface 1250 using P-P interface circuits 1278, 1288. As shown in FIG. 12, IMCs 1272 and 1282 couple the processors to their respective memories, i.e., memory 1232 and memory 1234, which may be part of a main memory locally attached to the respective processors.

[0203] Each of the processors 1270, 1280 may exchange information with a chipset 1290 via respective P-P interfaces 1252, 1254 using point-to-point interface circuits 1276, 1294, 1286, 1298. Optionally, the chipset 1290 may exchange information with a coprocessor 1238 via a high performance interface 1239. In one embodiment, the coprocessor 1238 is a special purpose processor, such as, for example, a high throughput MIC processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU, or an embedded processor.

[0204] A shared cache (not shown) may be included within either processor, or may be external to both processors but connected to the processors via a P-P interconnect so that when the processors enter a low power mode, local cache information of either or both processors may be stored in the shared cache.

[0205] Chipset 1290 may be coupled to a first bus 1216 via an interface 1296. In one embodiment, first bus 1216 may be a bus such as a Peripheral Component Interconnect (PCI) bus, or a PCI Express bus, or another third generation I / O interconnect bus, although embodiments of the disclosure are not so limited.

[0206] As shown in FIG. 12, various I / O devices 1214 may be coupled to the first bus 1216 along with a bus bridge 1218 that couples the first bus 1216 to a second bus 1220. In one embodiment, one or more additional processors 1215, such as a co-processor, a high throughput MIC processor, a GPGPU, an accelerator (e.g., a graphics accelerator or a digital signal processing (DSP) unit, etc.), a field programmable gate array, or any other processor, are coupled to the first bus 1216. In one embodiment, the second bus 1220 may be a low pin count (LPC) bus. For example, in one embodiment, various devices may be coupled to the second bus 1220, including a keyboard and / or mouse 1222, a communication device 1227, and a storage unit 1228, such as a disk drive or other mass storage device, that may contain instructions / code and data 1230. Additionally, audio I / O 1224 may be coupled to the second bus 1220. It should be noted that other architectures are possible: for example, instead of the point-to-point architecture of Figure 12, the system may implement a multi-drop bus or other such architecture.

[0207]

[0013] Referring now to Figure 13, there is shown a block diagram of a second, more specific, exemplary system 1300, according to an embodiment of the present disclosure. Like elements in Figures 12 and 13 are labeled with like reference numbers, and certain aspects of Figure 12 have been omitted from Figure 13 to avoid obscuring other aspects of Figure 13.

[0208] FIG. 13 shows that processors 1270, 1280 may include integrated memory and I / O control logic ("CL") 1272 and 1282, respectively. Thus, CL 1272, 1282 includes an integrated memory controller unit and includes I / O control logic. FIG. 13 shows that not only are memories 1232, 1234 coupled to CL 1272, 1282, but also I / O devices 1314 coupled to control logic 1272, 1282. Legacy I / O devices 1315 are coupled to chipset 1290.

[0209] Referring now to FIG. 14, a block diagram of an SoC 1400 according to an embodiment of the present disclosure is shown. Similar elements in FIG. 10 are labeled with similar reference numbers. Also, the dashed box is an optional feature on a more advanced SoC. In FIG. 14, the interconnect unit 1402 is coupled to an application processor 1410 including a set of one or more cores 202A-N and a shared cache unit 1006; a system agent unit 1010; a bus controller unit 1016; an integrated memory controller unit 1014; a set or one or more coprocessors 1420 that may include integrated graphics logic, image processors, audio processors, and video processors; a static random access memory (SRAM) unit 1430; a direct memory access (DMA) unit 1432; and a display unit 1440 for coupling to one or more external displays. In one embodiment, the coprocessor 1420 includes a dedicated processor, such as, for example, a network or communication processor, a compression engine, a GPGPU, a high-throughput MIC processor, or an embedded processor.

[0210] The embodiments disclosed herein (e.g., of the mechanisms) may be implemented in hardware, software, firmware, or a combination of such implementation approaches. The embodiments of the present disclosure may be implemented as a computer program or program code running on a programmable system comprising at least one processor, a storage system (volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.

[0211] Program code, such as code 1230 shown in Figure 12, may be applied to the input instructions to perform the functions described herein and to generate output information. The output information may be applied to one or more output devices, in known fashion. For purposes of this application, a processing system may include any system having a processor, such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0212] The program code may be implemented in a high level procedural or object oriented programming language to communicate with a processing system. Also, if desired, the program code may be implemented in assembly or machine language. Indeed, the mechanisms described herein are not limited in scope to any particular programming language. In any case, the language may be a compiled or interpreted language.

[0213] One or more aspects of at least one embodiment may be implemented by representative instructions stored on a machine-readable medium that represent various logic within a processor and that, when read by a machine, cause the machine to create logic for performing the techniques described herein. Such representations, known as "IP cores," may be stored on tangible machine-readable media and delivered to various customers or manufacturing facilities to be loaded into manufacturing machines that actually create the logic or processors.

[0214] Such machine-readable storage media may include, but are not limited to, non-transitory tangible configurations of articles manufactured or formed by a machine or apparatus, including storage media such as hard disks, floppy disks, optical disks, any other type of disk such as compact disk read-only memory (CD-ROM), compact disk re-writeable (CD-RW) and magneto-optical disks, read-only memory (ROM), random access memory (RAM) such as dynamic random access memory (DRAM), static random access memory (SRAM), semiconductor devices such as erasable programmable read-only memory (EPROM), flash memory, electrically erasable programmable read-only memory (EEPROM), phase change memory (PCM), magnetic or optical cards, or any other type of medium suitable for storing electronic instructions.

[0215] Accordingly, embodiments of the present disclosure also include non-transitory, tangible, machine-readable media that include instructions or design data, such as hardware description languages ​​(HDLs), that define the structures, circuits, devices, processors and / or system functions described herein. Such embodiments may also be referred to as program products. [Emulation (including binary conversion, code morphing, etc.)]

[0216] In some cases, an instruction converter may be used to convert instructions from a source instruction set to a target instruction set. For example, the instruction converter may translate (e.g., using static binary translation, dynamic binary translation including dynamic compilation), morph, emulate, or convert instructions into one or more other instructions to be processed by the core. The instruction converter may be implemented in software, hardware, firmware, or a combination thereof. The instruction converter may be on-processor, off-processor, or partially on-processor or partially off-processor.

[0217] Figure 15 is a block diagram contrasting the use of a software instruction converter to convert binary instructions in a source instruction set to binary instructions in a target instruction set according to an embodiment of the present disclosure. In the embodiment shown, the instruction converter is a software instruction converter, but alternatively, the instruction converter may be implemented in software, firmware, hardware, or various combinations thereof. Figure 15 illustrates that a program in a high-level language 1502 may be compiled using an x86 compiler 1504 to generate x86 binary code 1506 that is natively executable by a processor having at least one x86 instruction set core 1516. A processor with at least one x86 instruction set core 1516 represents any processor capable of performing substantially the same functions as an Intel processor with at least one x86 instruction set core by compatibly executing or processing (1) a substantial portion of the instruction set of the Intel x86 instruction set core, or (2) an object code version of an application or other software that is to be executed on an Intel processor with at least one x86 instruction set core, to achieve substantially the same results as an Intel processor with at least one x86 instruction set core. x86 compiler 1504 represents a compiler operable to generate x86 binary code 1506 (e.g., object code) executable on a processor with at least one x86 instruction set core 1516, with or without further linking operations.Similarly, FIG. 15 illustrates that a program in a high-level language 1502 may be compiled using an alternative instruction set compiler 1508 that generates alternative instruction set binary code 1510 that may be natively executed by a processor 1514 that does not have at least one x86 instruction set core (e.g., a processor that executes the MIPS instruction set from MIPS Technologies of Sunnyvale, Calif. and / or has a core that executes the ARM instruction set from ARM Holdings of Sunnyvale, Calif.). An instruction converter 1512 is used to convert the x86 binary code 1506 into code that is natively executable by a processor 1514 that does not have an x86 instruction set core. This converted code is unlikely to be the same as the alternative instruction set binary code 1510 because an instruction converter capable of this conversion would be difficult to manufacture. However, the converted code implements a common operation and is composed of multiple instructions from the alternative instruction set. Thus, the instruction converter 1512 represents software, firmware, hardware, or a combination thereof that enables a processor or other electronic device that does not have an x86 instruction set processor or core to execute the x86 binary code 1506, through emulation, simulation, or any other process. [Other possible claims] [Item 1] a decoder for decoding the instructions into decoded instructions; 1. A speculation manager circuit, comprising: Detecting a security check field in said instruction; determining a security check policy to be enforced for the potentially misspeculated execution from among a plurality of security check policies based on the security check field; performing one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling said instruction for execution if said one or more associated checks deem said instruction unsafe; a speculation manager circuit that omits the instruction if the one or more associated checks deem the instruction safe; and an execution unit for executing the instructions scheduled for execution. [Item 2] 2. The apparatus of claim 1, wherein the security check field is a hint provided by a compiler. [Item 3] 2. The apparatus of claim 1, wherein the speculation manager circuitry performs the one or more associated checks of the security checking policy on a set of associated memory accesses of the instruction. [Item 4] 2. The apparatus of claim 1, wherein the security check policy is a memory safety check policy. [Item 5] 2. The apparatus according to item 1, wherein the security check policy is a type safety check policy. [Item 6] 2. The apparatus of claim 1, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check. [Item 7] 2. The apparatus of claim 1, wherein the one or more associated checks are less than a full compliance check of an architecture specification of the apparatus. [Item 8] 2. The apparatus of claim 1, wherein the instruction is a security check instruction associated with a memory access instruction that follows in program order. [Item 9] decoding the instructions into decoded instructions using a decoder of a hardware processor; detecting, by said hardware processor, a security check field within said instruction; determining, by the hardware processor, a security check policy to be enforced for the potentially misspeculated execution from a plurality of security check policies based on the security check field; performing, by the hardware processor, one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling, by the hardware processor, the instruction for execution if the instruction is deemed unsafe by the one or more associated checks; omitting, by said hardware processor, said instruction if said one or more associated checks deem said instruction safe; and executing the instruction scheduled for execution using an execution unit of the hardware processor. [Item 10] 10. The method of claim 9, wherein the security check field is a hint provided by a compiler. [Item 11] 10. The method of claim 9, wherein the executing step includes performing the one or more associated checks of the security checking policy against the set of associated memory accesses of the instruction. [Item 12] 10. The method according to claim 9, wherein the security check policy is a memory safety check policy. [Item 13] 10. The method according to item 9, wherein the security check policy is a type safety check policy. [Item 14] 10. The method of claim 9, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check. [Item 15] 10. The method of claim 9, wherein the one or more associated checks are less than a full compliance check of an architectural specification of the hardware processor. [Item 16] 10. The method of claim 9, wherein the instruction is a security check instruction associated with a memory access instruction that follows it in program order. [Item 17] A non-transitory machine-readable medium storing code that, when executed by a machine, causes the machine to perform a method, the method comprising: decoding the instructions into decoded instructions using a decoder of a hardware processor; detecting, by said hardware processor, a security check field within said instruction; determining, by the hardware processor, a security check policy to be enforced for the potentially misspeculated execution from a plurality of security check policies based on the security check field; performing, by the hardware processor, one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling, by the hardware processor, the instruction for execution if the instruction is deemed unsafe by the one or more associated checks; omitting, by the hardware processor, the instruction if the one or more associated checks deem the instruction safe; and and executing, with an execution unit of the hardware processor, the instructions that are scheduled for execution. [Item 18] Item 18. The non-transitory machine-readable medium of item 17, wherein the security check field is a hint provided by a compiler. [Item 19] 20. The non-transitory machine-readable medium of claim 17, wherein the performing step includes performing the one or more associated checks of the security check policy against the associated set of memory accesses of the instructions. [Item 20] Item 18. The non-transitory machine-readable medium of item 17, wherein the security check policy is a memory safety check policy. [Item 21] Item 18. The non-transitory machine-readable medium of item 17, wherein the security check policy is a type safety check policy. [Item 22] Item 18. The non-transitory machine-readable medium of item 17, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check. [Item 23] 20. The non-transitory machine-readable medium of claim 17, wherein the one or more associated checks are less than a full compliance check of an architectural specification of the hardware processor. [Item 24] 20. The non-transitory machine-readable medium of claim 17, wherein the instructions are security check instructions associated with a memory access instruction that follows in program order.

Claims

1. a decoder for decoding the instructions into decoded instructions; 1. A speculation manager circuit, comprising: detecting a security check field in said instruction; determining a security check policy to be enforced for the potentially misspeculated execution from a plurality of security check policies based on the security check field; performing one or more associated checks of the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling the instruction for execution if the one or more associated checks deem the instruction unsafe; a speculation manager circuit that omits the instruction if the one or more associated checks deem the instruction safe; an execution unit for executing the instructions scheduled for execution.

2. The apparatus of claim 1 , wherein the security check field is a hint provided by a compiler.

3. 3. The apparatus of claim 1, wherein the speculation manager circuitry performs the one or more associated checks of the security checking policy on a set of associated memory accesses of the instruction.

4. The apparatus according to claim 1 , wherein the security checking policy is a memory safety checking policy.

5. The apparatus according to claim 1 , wherein the security checking policy is a type safety checking policy.

6. The apparatus of claim 1 , wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check.

7. The apparatus of claim 1 , wherein the one or more associated checks are less than a full compliance check of an architectural specification of the apparatus.

8. The apparatus of claim 1 , wherein the instruction is a security check instruction associated with a memory access instruction that follows in program order.

9. decoding the instructions into decoded instructions using a decoder of a hardware processor; detecting, by the hardware processor, a security check field within the instruction; determining, by the hardware processor, a security check policy to be enforced for the potentially misspeculated execution from a plurality of security check policies based on the security check field; performing, by the hardware processor, one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling, by the hardware processor, the instruction for execution if the instruction is deemed unsafe by the one or more associated checks; omitting, by the hardware processor, the instruction if the one or more associated checks deem the instruction safe; and and executing the instruction scheduled for execution using an execution unit of the hardware processor.

10. The method of claim 9 , wherein the security check field is a hint provided by a compiler.

11. 11. The method of claim 9 or 10, wherein the performing step comprises performing the one or more associated checks of the security checking policy against a set of associated memory accesses of the instruction.

12. The method of claim 9 , wherein the security checking policy is a memory safety checking policy.

13. The method according to claim 9 , wherein the security checking policy is a type safety checking policy.

14. The method of claim 9 , wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check.

15. 10. The method of claim 9, wherein the one or more associated checks are less than a full compliance check of an architectural specification of the hardware processor.

16. 16. A method as claimed in any one of claims 9 to 15, wherein the instruction is a security check instruction associated with a memory access instruction which follows in program order.

17. The hardware processor decoding, using a decoder of the hardware processor, the instructions into decoded instructions; detecting a security check field in the instruction; determining a security check policy to be enforced for a potentially misspeculated execution from a plurality of security check policies based on the security check field; performing one or more checks associated with the security checking policy on the instruction to determine whether the instruction is potentially misspeculated; scheduling execution of the instruction if the one or more associated checks deem the instruction unsafe; omitting the instruction if the one or more associated checks deem the instruction safe; and using an execution unit of the hardware processor to execute the instructions that have been scheduled for execution.

18. 20. The program of claim 17, wherein the security check field is a hint provided by a compiler.

19. 20. The program of claim 17 or 18, wherein the step of performing comprises performing the one or more associated checks of the security check policy on a set of associated memory accesses of the instruction.

20. The program according to claim 17 , wherein the security check policy is a memory safety check policy.

21. The program according to claim 17 , wherein the security check policy is a type safety check policy.

22. 20. The program of claim 17, wherein the one or more associated checks of the security check policy include a memory safety check and a type safety check.

23. 20. The program of claim 17, wherein the one or more associated checks are less than a full compliance check of an architectural specification of the hardware processor.

24. 24. The program of claim 17, wherein the instruction is a security check instruction associated with a memory access instruction that follows in program order.

25. A non-transitory machine-readable medium storing a program according to any one of claims 17 to 24.

Citation Information

Patent Citations

  • Speculative load instruction executing method for high performance processor

    JP1997223013A

  • Guess Barrier Command

    JP2021509743A

  • Defending against speculative execution exploits

    JP2021511571A

  • Electronic controller and program

    JP2022003582A

  • Efficient implementation of null reference check

    US20040268095A1