Systems, methods, and apparatuses for heterogeneous computing

A heterogeneous scheduler optimizes thread migration and power management in heterogeneous computing environments by dynamically allocating tasks to processing elements and opportunistically using accelerators, addressing the complexity and inefficiency of existing accelerator deployment methods.

JP2024133635AActive Publication Date: 2024-10-02INTEL CORP
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
JP2024108777
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-02
Estimated Expiration
2036-12-31

AI Technical Summary

Technical Problem

The complexity and inefficiency of deploying accelerator solutions in heterogeneous computing environments, where a wide range of stock units and platforms require specialized management and power optimization, are hindered by the need for device driver models and strict performance requirements across various operating systems.

Method used

A heterogeneous scheduler dynamically migrates threads between different processing elements based on workload characteristics, using a multi-protocol link to facilitate communication and power management, and opportunistically offloads tasks to accelerators through ABEGIN/AEND instructions or pattern matching, transforming code to match the selected processing element.

Benefits of technology

This approach provides efficient power management and performance optimization in heterogeneous systems by allowing seamless thread migration and opportunistic use of accelerators, reducing energy consumption and enhancing computing efficiency without requiring changes to existing software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024133635000001_ABST
    Figure 2024133635000001_ABST
Patent Text Reader

Abstract

To provide systems, methods, and apparatuses for heterogeneous computing.SOLUTION: In some embodiments, a hardware heterogeneous scheduler dispatches instructions for execution on one or more of a plurality of heterogeneous processing elements, the instructions corresponding to a code fragment to be processed by the one or more of the plurality of heterogeneous processing elements, where the instructions are native instructions to at least one of the one or more of the plurality of heterogeneous processing elements.SELECTED DRAWING: Figure 1
Need to check novelty before this filing date? Find Prior Art

Description

[Technical Field]

[0001] The present disclosure relates generally to the field of computing devices, and more particularly to heterogeneous computing methods, devices and systems. [Background technology]

[0002] In modern computers, the CPU performs general-purpose computing tasks, such as running application software and operating systems. Specialized computing tasks, such as graphics and image processing, are handled by graphics processors, image processors, digital signal processors, and fixed-function accelerators. In modern heterogeneous machines, each type of processor is programmed in a different way.

[0003] The era of big data processing demands higher performance at lower energy consumption compared to today's general-purpose processors. Accelerators (e.g., either custom fixed-function units or bespoke programmable units) help meet these demands. This field is experiencing rapid evolution in both algorithms and workloads, and the set of available accelerators is difficult to predict in advance and will most likely evolve with product types, branching out across stock units within product types. [Brief explanation of the drawings]

[0004]

[0013] The embodiments will be readily understood from the following detailed description taken in conjunction with the accompanying drawings, in which:

[0014] To facilitate this description, like reference numerals designate like structural elements;

[0015] The embodiments are illustrated by way of example and not by way of limitation to the figures of the accompanying drawings.

[0005] [Figure 1] It represents a heterogeneous multiprocessing execution environment.

[0006] [Figure 2] It represents a heterogeneous multiprocessing execution environment.

[0007] [Figure 3] 1 illustrates an exemplary implementation of a heterogeneous scheduler.

[0008] [Figure 4] 1 illustrates an embodiment of system boot and device discovery for a computer system.

[0009] [Figure 5] We present examples of thread migration based on the mapping of program phases to three types of processing elements.

[0010] [Figure 6] 1 illustrates an exemplary implementation flow performed by a heterogeneous scheduler.

[0011] [Figure 7] 10 illustrates an example of a method for thread destination selection by a heterogeneous scheduler.

[0012] [Figure 8] 1 illustrates the concept of using stripe mapping for logical IDs.

[0013] [Figure 9] An example of the use of stripe mapping for logical IDs is shown.

[0014] [Figure 10] An example of a core group is shown below.

[0015] [Figure 11] An example of a method for thread execution in a system that utilizes a binary translator switching mechanism is given below.

[0016] [Figure 12] 1 illustrates an exemplary method for core allocation of hot code to an accelerator.

[0017] [Figure 13] 10 illustrates an exemplary method for potential core allocation for wake-up or write to page directory base register events.

[0018] [Figure 14] An example of a serial phase thread is shown below.

[0019] [Figure 15] 1 illustrates an exemplary method for potential core allocation for thread response to a sleep command event.

[0020] [Figure 16] 1 illustrates an exemplary method for potential core allocation for threads in response to phase change events.

[0021] [Figure 17] Here is an example of code that describes the acceleration region.

[0022] [Figure 18] 1 illustrates an embodiment of a method for execution using ABEGIN on a hardware processor core.

[0023] [Figure 19] 1 illustrates an embodiment of a method for execution with an AEND in a hardware processor core.

[0024] [Figure 20] We present a system that uses pattern matching to provide ABEGIN / AEND equivalence.

[0025] [Figure 21] 1 illustrates an embodiment of a method for non-accelerated description threads subjected to pattern recognition.

[0026] [Figure 22] 1 illustrates an embodiment of a method for non-accelerated description threads subjected to pattern recognition.

[0027] [Figure 23] It presents the different types of memory dependencies, their semantics, ordering requirements and use cases.

[0028] [Figure 24] An example of a memory data block pointed to by an ABEGIN instruction is shown below.

[0029] [Figure 25] 2 shows an example of a memory 2503 configured to use ABEGIN / AEND semantics.

[0030] [Figure 26] Here are some examples of how to operate in different modes of execution using ABEGIN / AEND.

[0031] [Figure 27] Here are some examples of how to operate in different modes of execution using ABEGIN / AEND.

[0032] [Figure 28] 10 provides additional details regarding one embodiment.

[0033] [Figure 29] 1 illustrates an embodiment of an accelerator.

[0034] [Figure 30] 1 illustrates a computer system including an accelerator and one or more computer processor chips coupled to a processor via a multi-protocol link.

[0035] [Figure 31]1 illustrates a device bias flow according to an embodiment.

[0036] [Figure 32] 1 illustrates an exemplary process according to one embodiment.

[0037] [Figure 33] This shows the process when an operand is released from one or more I / O devices.

[0038] [Figure 34] An example using two different types of work queues is shown.

[0039] [Figure 35] 1 illustrates an embodiment of a Data Streaming Accelerator (DSA) device having multiple work queues that receive descriptors submitted via an I / O fabric interface.

[0040] [Figure 36] Two work queues are shown.

[0041] [Figure 37] 10 shows another configuration using engines and grouping.

[0042] [Figure 38] An example of a descriptor is shown below.

[0043] [Figure 39] An example of a completion record is shown below.

[0044] [Figure 40] 1 illustrates an exemplary no-op descriptor and no-op completion record.

[0045] [Figure 41] 10 illustrates an exemplary batch descriptor and no-op completion record.

[0046] [Figure 42] 10 illustrates an exemplary drain descriptor and drain completion record.

[0047] [Figure 43] 10 illustrates an exemplary memory migration descriptor and memory migration completion record.

[0048] [Figure 44] 1 illustrates an exemplary fill descriptor.

[0049] [Figure 45] 10 shows an exemplary comparison descriptor and comparison completion record.

[0050] [Figure 46] 10 illustrates an exemplary comparison intermediate descriptor.

[0051] [Figure 47] 10 shows an exemplary production data record descriptor and production delta record completion record.

[0052] [Figure 48] This shows the format of the differential recording.

[0053] [Figure 49] 10 illustrates an exemplary adaptive differential record descriptor.

[0054] [Figure 50] An example of the use of the create difference record and adapt difference record operations is shown.

[0055] [Figure 51] 10 illustrates an exemplary memory copy descriptor using dual cast and a memory copy completion record using dual cast.

[0056] [Figure 52] 1 illustrates an exemplary CRC generation descriptor and CRC generation.

[0057] [Figure 53]10 shows an example copy using a CRC generation descriptor.

[0058] [Figure 54] 10 shows an exemplary DIF insertion descriptor and DIF insertion completion record.

[0059] [Figure 55] 10 shows an exemplary DIF strip descriptor and DIF strip completion record.

[0060] [Figure 56] 10 illustrates an exemplary DIF update descriptor and DIF update completion record.

[0061] [Figure 57] 1 illustrates an exemplary cache flush descriptor.

[0062] [Figure 58] This shows the 64 bytes of enqueue data generated by ENQCMD.

[0063] [Figure 59] 1 illustrates an embodiment of a method performed by a processor to process a MOVDIRI instruction.

[0064] [Figure 60] 1 illustrates an embodiment of a method performed by a processor to process a MOVDIRI64B instruction.

[0065] [Figure 61] 1 illustrates an embodiment of a method performed by a processor to process an ENCQMD instruction.

[0066] [Figure 62] The format for the ENQCMDS command is shown below.

[0067] [Figure 63]1 illustrates an embodiment of a method performed by a processor to process an ENCQMD instruction.

[0068] [Figure 64] 1 illustrates an embodiment of a processor-executed method for processing a UMONITOR instruction.

[0069] [Figure 65] 1 illustrates an embodiment of a method performed by a processor to process a UMWAIT instruction.

[0070] [Figure 66] 1 illustrates an embodiment of a method performed by a processor to process a TPAUSE instruction.

[0071] [Figure 67] An example of execution using the UMWAIT and UMONITOR instructions is shown below.

[0072] [Figure 68] An example of execution using the TPAUSE and UMONITOR instructions is shown below.

[0073] [Figure 69] 1 illustrates an exemplary implementation in which an accelerator is communicatively coupled to multiple cores through a cache coherent interface.

[0074] [Figure 70] 1 shows another diagram of an accelerator including a data management unit, multiple processing elements, and high-speed on-chip storage, as well as other components previously mentioned.

[0075] [Figure 71] 1 illustrates an exemplary set of operations performed by a processing element.

[0076] [Figure 72a] Illustrates an example of sparse matrix multiplication on vector x to produce vector y.

[0077] [Figure 72b] Denote the CSR representation of a matrix A where each value is stored as a (value, row index) pair.

[0078] [Figure 72c] We show the CSC representation of matrix A using (value, column index) pairs.

[0079] [Figure 73a] The pseudocode for the calculation pattern is shown below. [Figure 73b] The pseudocode for the calculation pattern is shown below. [Figure 73c] The pseudocode for the calculation pattern is shown below.

[0080] [Figure 74] 1 illustrates a process flow for one embodiment of a data management unit and processing elements.

[0081] [Figure 75a] The paths for the spMspV_csc and scale_update operations are highlighted (using dotted lines).

[0082] [Figure 75b] The path for the spMdV_csr operation is shown.

[0083] [Figure 76a] Here is an example of representing a graph as an adjacency matrix: [Figure 76b] Here is an example of representing a graph as an adjacency matrix:

[0084] [Figure 76c] The vertex program is shown below.

[0085] [Figure 76d] 10 shows exemplary program code for executing a vertex program.

[0086] [Figure 76e] The formulation of GSPMV is shown below.

[0087] [Figure 77] The framework is shown.

[0088] [Figure 78] It is shown that a customizable logic block is provided within each PE.

[0089] [Figure 79] The processing of each accelerator tile is shown below.

[0090] [Figure 80a] 10 summarizes the customizable parameters for one embodiment of a template.

[0091] [Figure 80b] Tuning considerations are presented.

[0092] [Figure 81] Here is one of the most common sparse matrix formats:

[0093] [Figure 82] 10 shows steps for an example of sparse matrix-dense vector multiplication using the CRS data format.

[0094] [Figure 83] An embodiment is shown for an accelerator that includes an accelerator logic die and one or more stacks of DRAM.

[0095] [Figure 84a] 1 illustrates one embodiment of an accelerator logic chip from a top view facing the stack of DRAM dies. [Figure 84b] 1 illustrates one embodiment of an accelerator logic chip from a top view facing the stack of DRAM dies.

[0096] [Figure 85] Provides a high-level overview of the DPE.

[0097] [Figure 86] An example of a blocking scheme is shown.

[0098] [Figure 87] Indicates the block descriptor.

[0099] [Figure 88] Shows a two-row matrix that fits into a single dot product engine's buffer.

[0100] [Figure 89] An example of hardware within a dot product engine using this format is shown below.

[0101] [Figure 90] Indicates the contents of the match logical unit to capture.

[0102] [Figure 91] 10 provides details of a dot product engine design supporting sparse matrix-sparse vector multiplication according to an embodiment.

[0103] [Figure 92] Here is an example using specific values:

[0104] [Figure 93] We show how sparse-dense and sparse-sparse dot product engines can be combined to yield a dot product engine that can handle both types of calculations.

[0105] [Figure 94a] We demonstrate the implementation of socket swapping using 12 accelerator stacks.

[0106] [Figure 94b]A multi-chip package (MCP) implementation using a set of processors / cores and eight stacks is shown.

[0107] [Figure 95] Shows the accelerator stack.

[0108] [Figure 96] This shows a potential layout of an accelerator intended to sit below a WIO3 DRAM stack, including 64 dot-product engines, eight vector caches, and an integrated memory controller.

[0109] [Figure 97] It compares seven DRAM technologies.

[0110] [Figure 98a] This shows a stacked DRAM. [Figure 98b] This shows a stacked DRAM.

[0111] [Figure 99] Here is a breadth-first search (BFS) listing:

[0112] [Figure 100] 1 illustrates the format of a descriptor used to define a lambda function according to one embodiment.

[0113] [Figure 101] 1 shows the lower 6 bytes of the header word in the embodiment.

[0114] [Figure 102] A matrix value buffer, a matrix index buffer, and a vector value buffer are shown.

[0115] [Figure 103] 10 illustrates details of one embodiment of a lambda data path.

[0116] [Figure 104] 10 shows an example of instruction encoding.

[0117] [Figure 105] Indicates the encoding for a particular set of instructions.

[0118] [Figure 106] 10 illustrates an encoding of an exemplary comparison predicate.

[0119] [Figure 107] 10 shows an embodiment using a bias.

[0120] [Figure 108a] 1 shows the memory-mapped I / O (MMIO) space registers used with a work queue-based implementation. [Figure 108b] 1 shows the memory-mapped I / O (MMIO) space registers used with a work queue-based implementation.

[0121] [Figure 109] Here is an example of matrix multiplication:

[0122] [Figure 110] We demonstrate octoMADD instruction processing using a binary tree reduction network.

[0123] [Figure 111] 1 illustrates an embodiment of a method performed by a processor to process a multiply-accumulate instruction.

[0124] [Figure 112] 1 illustrates an embodiment of a method performed by a processor to process a multiply-accumulate instruction.

[0125] [Figure 113(A)] 1 illustrates exemplary hardware for executing the MADD instruction. [Fig. 113(B)]1 illustrates exemplary hardware for executing the MADD instruction. [Fig. 113(C)] 1 illustrates exemplary hardware for executing the MADD instruction.

[0126] [Figure 114] 1 illustrates an example of a hardware heterogeneous scheduler circuit and its interaction with memory.

[0127] [Figure 115] 1 illustrates an example of a software heterogeneous scheduler.

[0128] [Figure 116] 1 illustrates an embodiment of a method for post-system boot device discovery.

[0129] [Figure 117] An example of movement for threads in shared memory is shown.

[0130] [Figure 118] 1 illustrates an exemplary method for thread migration that may be performed by a heterogeneous scheduler.

[0131] [Figure 119] 1 is a block diagram of a processor presenting an abstract execution environment as described in detail above.

[0132] [Figure 120] FIG. 1 is a simplified block diagram illustrating an exemplary multi-chip configuration.

[0133] [Figure 121] 1 shows a block diagram representing at least a portion of a system including an example implementation of a multi-chip link (MCL).

[0134] [Figure 122] 1 illustrates a block diagram of an exemplary logical PHY of an exemplary MCL.

[0135] [Figure 123] FIG. 10 illustrates a simplified block diagram showing another representation of the logic used to implement MCL.

[0136] [Figure 124] Here is an example of execution when ABEGIN / AEND is not supported:

[0137] [Figure 125] FIG. 2 is a block diagram of a register architecture according to one embodiment of the present invention.

[0138] [Figure 126A] 1A-1C are block diagrams illustrating both an exemplary in-order pipeline and an exemplary register renaming, out-of-order issue / execution pipeline, according to embodiments of the present invention.

[0139] [Figure 126B] 1 is a block diagram illustrating both an exemplary embodiment of an 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 invention. FIG.

[0140] [Figure 127A] A block diagram of a more specific exemplary in-order core architecture is shown, where a core may be one of several logic blocks (including other cores of the same type and / or different types) within a chip. [Figure 127B] A block diagram of a more specific exemplary in-order core architecture is shown, where a core may be one of several logic blocks (including other cores of the same type and / or different types) within a chip.

[0141] [Figure 128]1 is a block diagram of a processor that may have more than one core, may have an integrated memory controller, and may have integrated graphics according to an embodiment of the present invention.

[0142] [Figure 129] 1 shows a block diagram of a system according to an embodiment of the present invention;

[0143] [Figure 130] FIG. 1 is a block diagram of a first more specific exemplary system according to an embodiment of the present invention.

[0144] [Figure 131] FIG. 2 is a block diagram of a second, more specific exemplary system according to an embodiment of the present invention.

[0145] [Figure 132] FIG. 1 is a block diagram of an SoC according to an embodiment of the present invention.

[0146] [Figure 133] 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 invention; DETAILED DESCRIPTION OF THE INVENTION

[0147] In the following detailed description, reference is made to the accompanying drawings that form a part hereof, wherein like numerals refer to like parts throughout and illustrate exemplary embodiments that may be practiced. It is to be understood that other embodiments may be utilized and structural or logical changes may be made without departing from the scope of the present disclosure. Therefore, the following detailed description is not to be taken in a limiting sense, and the scope of the embodiments is defined by the appended claims and their equivalents.

[0148] Various operations may be described sequentially as multiple separate actions or processes in a manner that is most helpful in understanding the claimed subject matter. However, the order of description should not be construed as implying that these processes are necessarily order dependent. In particular, these processes may not be performed in the order presented. The processes described may be performed in a different order than in the described embodiment. In additional embodiments, various additional processes may be performed and / or the described processes may be omitted.

[0149] For purposes of this disclosure, the term "A and / or B" means (A), (B), or (A and B). For purposes of this disclosure, the term "A, B, and / or C" means (A), (B), (C), (A and B), (A and C), (B and C), or (A, B, and C).

[0150] The description may use the terms "in one embodiment" or "in embodiments," which may refer to one or more of the same or different embodiments, respectively. Furthermore, terms such as "comprising," "including," and "having" are synonymous when used in reference to embodiments of the present disclosure.

[0151] As described in the background, with a wide range of stock units and platforms implementing various mixes of accelerators, managing the complexity of deploying accelerator solutions and utilizing them portably can be challenging. Furthermore, given the vast number of operating systems (and versions, patches, etc.), deploying accelerators using a device driver model has limitations, including hurdles to adoption due to developer efforts, non-portability, and strict performance requirements for big data processing. Accelerators are typically hardware devices (circuitry) that perform functions more efficiently than software running on a general-purpose processor. For example, hardware accelerators may be used to improve the performance of a specific algorithm / task (e.g., video encoding or decoding, a specific hash function, etc.) or a class of algorithms / tasks (e.g., machine learning, sparse data manipulation, cryptography, graphics, physics, regular expressions, packet processing, artificial intelligence, digital signal processing, etc.). Examples of accelerators include, but are not limited to, graphics processing units ("GPUs"), fixed-function field programmable gate array ("FPGA") accelerators, and fixed-function application-specific integrated circuits ("ASICs"). Note that in some embodiments, the accelerator may be a general-purpose central processing unit ("CPU") where the CPU is more efficient than other processors in the system.

[0152] The power budget of a given system (e.g., a system-on-chip ("SoC"), processor stock unit, rack, etc.) may be consumed by processing elements on only a fraction of the available silicon area. This makes it advantageous to build various specialized hardware blocks that reduce energy consumption for specific processes, even though not all of the hardware blocks may be active at the same time.

[0153] Embodiments of systems, methods, and apparatuses for selecting a processing element (e.g., a core or accelerator) to process a thread, interfacing with a processing element, and / or managing power consumption within a heterogeneous multiprocessor environment are described in detail. For example, in various embodiments, the heterogeneous multiprocessor is configured (e.g., by design or by software) to dynamically migrate threads between different types of processing elements of the heterogeneous multiprocessor based on characteristics of the threads and / or the corresponding workloads of the processing elements, provide programmatic interfaces to one or more of the processing elements, translate code for execution on particular processing elements, and select communication protocols to use with selected processing elements based on characteristics of the workload and the selected processing elements, or a combination thereof.

[0154] In a first aspect, the workload dispatch interface, i.e., the heterogeneous scheduler, presents a homogeneous multiprocessor programming model to the system programmer. In particular, this aspect may enable a programmer to develop software or equivalent abstractions that target a specific architecture, while facilitating continuous improvements to the underlying hardware without requiring corresponding changes to the software being developed.

[0155] In a second aspect, a multi-protocol link enables a first entity (such as a heterogeneous scheduler) to communicate with multiple devices using a protocol associated with the communication. This replaces the need for separate links for device communication. In particular, the link has three or more protocols dynamically multiplexed over the link. For example, a common link supports the following protocols: 1) a Producer / Consumer, Discovery, Configuration, Interrupt (PDCI) protocol that enables device discovery, device configuration, error reporting, interrupts, DMA-style data transfers, and various services, as may be defined in one or more proprietary or industry standards (e.g., PCI Express specifications or equivalent alternatives); 2) a Caching Agent Coherence (CAC) protocol that enables devices to issue coherent read and write requests to processing elements; and 3) a Memory Access (MA) protocol that enables a processing element to access the local memory of another processing element.

[0156] In a third aspect, thread scheduling, migration, or emulation, or portions thereof, is performed based on the phase of the thread. For example, a data-parallel phase of a thread is typically scheduled or migrated to a SIMD core, a thread-parallel phase of a thread is typically scheduled or migrated to one or more scalar cores, and a serial phase is typically scheduled or migrated to an out-of-order core. Each core type minimizes either energy or latency, both of which are considerations for thread scheduling, migration, or emulation. Emulation may be used when scheduling or migration is not possible or advantageous.

[0157] In a fourth aspect, threads or portions thereof are opportunistically offloaded to an accelerator. In particular, the thread's accelerator begin (ABEGIN) and accelerator end (AEND) instructions, or portions thereof, the bookend instructions, may be executable on the accelerator. If an accelerator is not available, then the instructions between the ABEGIN and AEND instructions are executed normally. However, if an accelerator is available, it is preferable to use the accelerator (e.g., use less power), then the instructions between the ABEGIN and AEND instructions are converted to execute on that accelerator and scheduled for execution on that accelerator. As a result, accelerator usage is opportunistic.

[0158] In a fifth aspect, a thread or a portion thereof is analyzed for (opportunistic) offload to an accelerator without using ABEGIN or AEND. A software or hardware pattern match is performed against the thread or portion thereof for code that may be executable on an accelerator. If an accelerator is not available, or if the thread or portion thereof does not itself lend itself to accelerator execution, the thread's instructions are executed normally. However, if an accelerator is available, it is preferable to use the accelerator (e.g., use less power), and then the instructions are translated to run on that accelerator and scheduled for execution on that accelerator. As a result, accelerator usage is opportunistic.

[0159] In a sixth aspect, transformations of the code fragment (part of a thread) are performed to better suit the selected destination processing element. For example, the code fragment may be 1) transformed to utilize a different instruction set, 2) made more parallel, 3) made less parallel (serialized), 4) made data parallel (e.g., vectorized), and / or 5) made less data parallel (e.g., non-vectorized).

[0160] In a seventh aspect, a work queue (either shared or dedicated) receives descriptors that define the scope of work to be performed by the device. A dedicated work queue stores descriptors for a single application, while a shared work queue stores descriptors submitted by multiple applications. A hardware interface / arbiter dispatches the descriptors from the work queue to the accelerator processing engines according to a specific arbitration policy (e.g., based on the processing requirements of each application and QoS / fairness policies).

[0161] In an eighth aspect, an improvement to dense matrix multiplication considers multiplication of two-dimensional matrices with a single instruction execution. Multiple packed data (SIMD, vector) sources are multiplied against a single packed data source. In some examples, a binary tree is used for the multiplication.

[0162] 1 is a representation of a heterogeneous multiprocessing execution environment. In this example, a first type of code fragment (e.g., one or more instructions associated with a software thread) is received by a heterogeneous scheduler 101. The code fragment may be in any number of source code representation formats, including, for example, machine code, intermediate representation, bytecode, text-based code (assembly code in a high-level language, e.g., C++, source code), etc. The heterogeneous scheduler 101 presents a homogeneous multiprocessor programming model (e.g., so that all threads appear to the user and / or operating system as if they were executing on scalar cores), determines the workload type (program phase) for a received code fragment, selects a processing element type (scalar, out-of-order (OOO), single instruction multiple data (SIMD), or accelerator) corresponding to the determined workload type to process the workload (e.g., scalar for thread-parallel code, OOO for serial code, SIMD for data parallel, and accelerator for data parallel), and schedules the code fragment for processing by the corresponding processing element. In the particular embodiment shown in FIG. 1, the processing element type is The heterogeneous processor includes a scalar core 103 (e.g., an in-order core), a single instruction, multiple data (SIMD) core 105 that operates on packed data operands, in which registers have multiple data elements stored contiguously, a low-latency out-of-order core 107, and an accelerator 109. In some embodiments, the scalar core 103, the single instruction, multiple data (SIMD) core 105, and the low-latency out-of-order core 107 are within the heterogeneous processor, and the accelerator 109 is external to the heterogeneous processor. However, it should be noted that various different configurations of processing elements may be utilized. In some embodiments, the heterogeneous scheduler 101 converts or interprets the received code fragment, or portions thereof, into a format corresponding to a selected type of processing element.

[0163] The processing elements 103-109 may support different instruction set architectures (ISAs). For example, an out-of-order core may support a first ISA, and an in-order core may support a second ISA. This second ISA may be a (sub- or super)set of the first ISA, or may be different. Furthermore, the processing elements may have different microarchitectures. For example, a first out-of-order core may support a first microarchitecture, and an in-order core may support a different second microarchitecture. Note that even within a particular type of processing element, the ISAs and microarchitectures may be different. For example, a first out-of-order core may support a first microarchitecture, and a second out-of-order core may support a different microarchitecture. Instructions are "native" to a particular ISA in that they are part of the ISA. Native instructions execute in a particular microarchitecture without requiring external modification (e.g., translation).

[0164] In some embodiments, one or more of the processing elements are integrated onto a single die, e.g., as a system-on-chip (SoC). Such embodiments may benefit from, e.g., improved communication latency, manufacturing / cost, reduced pin count, platform compactness, etc. In other embodiments, the processing elements are packaged together, thereby achieving one or more of the above-referenced SoC benefits without necessarily being on a single die. These embodiments may further benefit from, e.g., different processing technologies optimized for each processing element type, smaller die size for improved yield, consolidation of proprietary intellectual property blocks, etc. With some traditional multi-package limitations, it may be difficult to communicate with different devices as they are added. The multi-protocol link described herein minimizes or mitigates this challenge by presenting a common interface to different types of devices to the user, operating system (“OS”), etc.

[0165] In some embodiments, the heterogeneous scheduler 101 is implemented in software stored on a computer-readable medium (e.g., memory) for execution on a processor core (e.g., the OOO core 107). In these embodiments, the heterogeneous scheduler 101 is referred to as a software heterogeneous scheduler. This software may implement a binary translator, a just-in-time ("JIT") compiler, an OS 117 that schedules the execution of threads containing code fragments, a pattern matcher, an internal module component, or a combination thereof.

[0166] In some embodiments, heterogeneous scheduler 101 is implemented in hardware as a circuit and / or a finite state machine executed by a circuit, and in these embodiments, heterogeneous scheduler 101 is referred to as a hardware heterogeneous scheduler.

[0167] From the perspective of a program (e.g., OS 117, emulation layer, hypervisor, secure monitor, etc.), each type of processing element 103-109 utilizes a shared memory address space 115. In some embodiments, shared memory address space 115 optionally includes two types of memory, memory 211 and memory 213, as shown in FIG. 2. In such embodiments, the types of memory may be distinguished in various ways, including, but not limited to, differences in memory location (e.g., located on different sockets), differences in corresponding interface standards (e.g., DDR4, DDR5, etc.), differences in power requirements, and / or differences in the underlying memory technology used (e.g., high bandwidth memory (HBM), synchronous DRAM, etc.).

[0168] The shared memory address space 115 is accessible by each type of processing element. However, in some embodiments, different types of memory may be preferentially allocated to different processing elements, for example, based on workload needs. For example, in some implementations, the platform's firmware interface (e.g., BIOS or UEFI) or memory storage includes fields that indicate the types of memory resources available in the platform and / or the commonality of processing elements with respect to particular address ranges or memory types.

[0169] The heterogeneous scheduler 101 utilizes this information when analyzing threads to determine where they will execute at a given time. Typically, a thread management mechanism examines the ensemble of information available to it to inform informed decisions depending on how to manage existing threads. This can manifest itself in a number of ways. For example, threads executing on particular processing elements that share a common address range that is physically close to the processing element may be given priority over threads under normal circumstances that would execute on the processing element.

[0170] Another example is that a thread that would benefit from a particular memory type (e.g., a faster version of DRAM) may have its data physically moved to the memory type and have memory references in the code adjusted to point to a portion of the shared address space. For example, while a thread on SIMD core 105 may utilize second memory type 213, it may be moved away from this usage if accelerator 109 is active and requires that memory type 213 (or at least the portion allocated to the thread on SIMD core 105).

[0171] An example scenario is when memory is physically closer to one processing element than to the other. A common example is when an accelerator is directly connected to a different memory type than the core.

[0172] In these examples, it is typically the OS that initiates the data movement. However, nothing prevents a lower level (e.g., a heterogeneous scheduler) from performing this function on its own or with assistance from another component (e.g., the OS). Whether the data from the previous processing element is flushed and the page table entry is invalidated depends on the implementation and the penalties for performing the data movement. If the data is not likely to be used immediately, it may be more feasible to simply copy it from storage rather than moving it from one memory type to another.

[0173] Figures 117(A)-(B) show an example of movement for threads within shared memory. In this example, two types of memory share an address space, each with its own range of addresses within that space. In Figure 117(A), shared memory 11715 includes a first type of memory 11701 and a second type of memory 11707. First type memory 11701 has a first address range 11703, within which are addresses dedicated to thread 1 11705. Second type memory 11707 has a second address range 11709.

[0174] At some point during the execution of thread 1 11705, the heterogeneous scheduler makes a decision to move thread 1 11705 so that it uses addresses in the first type of memory 11701 before the second thread 11711 is assigned to thread 1 11705. This is shown in FIG. 117B. In this example, thread 1 11705 is reassigned to the second type of memory 11707 and given a new set of addresses to use. However, this need not be the case. Note that the difference in memory type may be physical or spatial (e.g., based on distance to the PE).

[0175]

[00118] Figure 118 illustrates an exemplary method for thread migration that may be performed by a heterogeneous scheduler. At 11801, a first thread is directed to run on a first processing element ("PE"), such as a core or accelerator, using a first type of memory in a shared memory space. For example, in Figure 117(A), this is thread 1.

[0176] At some later point in time, a request to execute a second thread is received at 11803. For example, an application, an OS, etc. requests a hardware thread to be executed.

[0177] At 11805, a determination is made that the second thread should be executed on a second PE that uses a first type of memory in a shared address space, for example, the second thread executes on an accelerator that is directly coupled to the first type of memory, and such execution (including freeing the memory used by the first thread) is more efficient than having the second thread use the second type of memory.

[0178] In some embodiments, data of the first thread is moved from the first type of memory to the second type of memory at 11807. This does not necessarily occur if it would be more efficient to simply stop execution of the first thread execution and start another thread in its place.

[0179] At 11809, the translation lookaside buffer (TLB) entry associated with the first thread is invalidated. Additionally, in most embodiments, a data flush is performed.

[0180] At 11811, the second thread is directed to a second PE and assigned to the range of addresses in the first type of memory previously assigned to the first thread.

[0181] 3 illustrates an exemplary embodiment of a heterogeneous scheduler 301. In some examples, scheduler 301 is part of a runtime system. As shown, program phase detector 313 receives a code fragment and identifies one or more characteristics of the code fragment to determine whether the execution of the corresponding program phase is best characterized as serial, data parallel, or thread parallel. Examples of how this is determined are described in detail below. As described in detail with respect to FIG. 1, the code fragment may be in the form of any number of source code representations.

[0182] For repetitive code fragments, pattern matcher 311 identifies this "hot" code and, in some instances, also identifies corresponding characteristics that indicate that the workload associated with the code fragment may be better suited for processing on a different processing element. Further details regarding pattern matcher 311 and its operation are described below, for example, in the context of FIG. 20.

[0183] Selector 309 selects a target processing element to execute the native representation of the received code fragment based at least in part on the characteristics of the processing element and the thermal and / or power information provided by power manager 307. The selection of the target processing element may be as simple as selecting the best match for the code fragment (i.e., the match between workload characteristics and processing element functionality), but may also take into account the current power consumption level of the system (e.g., if provided by power manager 307), the availability of processing elements, the amount of data to be moved from one type of memory to another (and the penalty associated with doing so), etc. In some embodiments, selector 309 is a finite state machine implemented in or executed by hardware circuitry.

[0184] In some embodiments, selector 309 also selects a corresponding link protocol for communicating with the target processing element. For example, in some implementations, the processing element utilizes a corresponding common link interface that can dynamically multiplex or encapsulate multiple protocols over a system fabric or point-to-point interconnect. For example, in particular implementations, supported protocols include: 1) a Producer / Consumer, Discover, Configure, Interrupt (PDCI) protocol that enables device discovery, device configuration, error reporting, interrupts, DMA-style data transfers, and various services, as may be defined in one or more proprietary or industry standards (e.g., PCI Express specifications or equivalent alternatives); 2) a Caching Agent Coherence (CAC) protocol that enables devices to issue coherent read and write requests to processing elements; and 3) a Memory Access (MA) protocol that enables processing elements to access the local memory of another processing element. Selector 309 selects between these protocols based on the type of request communicated to the processing element. For example, producer / consumer, discovery, configuration or interrupt requests use the PDCI protocol, cache coherence requests use the CAC protocol, and local memory access requests use the MA protocol.

[0185] In some embodiments, the thread includes a marker indicating the phase type, and therefore a phase detector is not utilized. In some embodiments, the thread includes implicit or explicit requirements regarding processing element type, link protocol, and / or memory type. In these embodiments, selector 309 utilizes this information in its selection process. For example, the selection by selector 309 may be overridden by the thread and / or the user.

[0186] Depending on the implementation, the heterogeneous scheduler may include one or more converters that process received code fragments and generate corresponding native encodings for the target processing elements. For example, the heterogeneous scheduler may include a converter that converts a first type of machine code to a second type of machine code and / or a JIT compiler that converts the intermediate representation into a format native to the target processing elements. Alternatively or additionally, the heterogeneous scheduler may include a pattern matcher that identifies repetitive code fragments (i.e., "hot" code) and caches one or more native encodings of the code fragments or corresponding micro-operations. Each of these optional components is illustrated in FIG. 3. In particular, the heterogeneous scheduler 301 includes a converter 303 and a JIT compiler 305. When the heterogeneous scheduler 301 operates on object code or an intermediate representation, the JIT compiler 305 is invoked to convert the received code fragment into a format native to one or more of the target processing elements 103, 105, 107, and 109. When heterogeneous scheduler 301 operates on machine code (binary) (e.g., translating from one instruction set to another), binary translator 303 translates the received code fragment into machine code native to one or more of the target processing elements. In alternative embodiments, heterogeneous scheduler 301 may omit one or more of these components.

[0187] For example, in some embodiments, a binary translator is not included. This can result in increased programming complexity, as the program must consider potentially available accelerators, cores, etc., instead of letting the scheduler handle this. For example, the program may need to include code for routines in different formats. However, in some embodiments, if there is no binary translator, there is a JIT compiler that accepts code at a higher level, and the JIT compiler performs the necessary translations. If a pattern matcher is present, hot code may also be detected to find code that should be executed on a particular processing element.

[0188] For example, in some embodiments, a JIT compiler is not included. This may also result in increased programming complexity, as the program must first be compiled into machine code for a specific ISA, instead of having the scheduler handle this. However, in some embodiments, if a binary translator is present and a JIT compiler is not present, the scheduler may translate between ISAs, as described in more detail below. If a pattern matcher is present, hot code may also be detected to find code that should be executed on a particular processing element.

[0189] For example, in some embodiments, a pattern matcher is not included, which can also result in less efficiency, as code that may have been moved is likely to remain in a core that is less efficient for the particular task being performed.

[0190] In some embodiments, there is no binary translator, JIT compiler, or pattern matcher. In these embodiments, only phase detection or explicit requests to move threads are used for thread / processing element allocation / migration.

[0191] Referring again to FIGS. 1-3, the heterogeneous scheduler 101 may be implemented in hardware (e.g., a circuit), software (e.g., executable program code), or any combination thereof. FIG. 114 illustrates an example of a hardware heterogeneous scheduler circuit and its interaction with memory. The heterogeneous scheduler may be implemented in many different ways, including, but not limited to, as a field programmable gate array (FPGA)- or application specific integrated circuit (ASIC)-based state machine, an embedded microcontroller coupled to memory storing software therein that provides the functionality described in detail herein, a logic circuit having other subcomponents (e.g., data hazard detection circuitry, etc.), and / or as software (e.g., a state machine) executed by an out-of-order core, as software (e.g., a state machine) executed by a scalar core, as software (e.g., a state machine) executed by a SIMD core, or a combination thereof. In the illustrated example, the heterogeneous scheduler is a circuit 11401 that includes one or more components that perform various functions. In some embodiments, this circuitry 11401 is part of the processor core 11419, but may also be part of a chipset.

[0192] Thread / Processing Element (PE) Tracker 11403 maintains status for the system and for each thread executing on each PE (e.g., the availability of the PE, its current power consumption, etc.) For example, Tracker 11403 maintains an active, idle, or inactive status in a data structure such as a table.

[0193] In some embodiments, pattern matcher 11405 identifies "hot" code, accelerator code, and / or code requiring PE allocation. More details regarding this matching are provided below.

[0194] PE information 11411 stores information about what PEs (and their types) are in the system and what can be scheduled by the OS or the like.

[0195] While described above in detail as separate components within the heterogeneous scheduler circuit 11401, the components may be combined and / or moved outside of the heterogeneous scheduler circuit 11401.

[0196] The memory 11413 coupled to the heterogeneous scheduler circuit 11401 may include software executed (by the cores and / or the heterogeneous scheduler circuit 11401) that provides additional functionality. For example, a software pattern matcher 11417 may be used to identify “hot” code, accelerator code, and / or code requiring PE allocation. For example, the software pattern matcher 11417 compares code sequences to a predetermined set of patterns stored in memory. The memory may also store converters that convert code from one instruction set to another (e.g., from one instruction set to accelerator-based instructions or primitives).

[0197] These components provide information to a selector 11411 that selects the PE on which to execute a thread, such as what link protocol to use and what transitions should occur if there is already a thread running on that PE. In some embodiments, selector 11411 is a finite state machine implemented in or executed by a hardware circuit.

[0198] The memory 11413 may include, for example, in some embodiments, one or more converters 11415 (e.g., binary, JIT compiler, etc.) stored in the memory to convert thread code into a different format for a selected PE.

[0199] FIG. 115 illustrates an example of a software heterogeneous scheduler. The software heterogeneous scheduler may be implemented in many different ways, including, but not limited to, as a field programmable gate array (FPGA)- or application specific integrated circuit (ASIC)-based state machine, an embedded microcontroller coupled to memory storing software therein that provides the functionality described in detail herein, a logic circuit having other subcomponents (e.g., data hazard detection circuitry, etc.), and / or as software (e.g., a state machine) executed by an out-of-order core, as software (e.g., a state machine) executed by a scalar core, as software (e.g., a state machine) executed by a SIMD core, or a combination thereof. In the illustrated example, the software heterogeneous scheduler is stored in memory 11413. As a result, memory 11413 coupled to processor core 11419 includes software executed by the core to schedule threads. In some embodiments, the software heterogeneous scheduler is part of the OS.

[0200] Depending on the implementation, a thread / processing element (PE) tracker 11403 within the core maintains status for each thread executing in the system and each PE (e.g., the availability of the PE, its current power consumption, etc.), or this is done in software using thread / PE tracker 11521. For example, the tracker maintains the active, idle, or inactive status in a data structure such as a table.

[0201] In some embodiments, pattern matcher 11417 identifies "hot" code and / or code that requires PE allocation. More details regarding this matching are provided below.

[0202] The PE information 11409 and / or 11509 stores information about what PEs are in the system and what can be scheduled by the OS or the like.

[0203] The software pattern matcher 11417 may be used to identify "hot" code, accelerator code, and / or code requiring PE allocation.

[0204] The thread / PE tracker, processing element information, and / or pattern matches are fed to a selector 11411 that selects the PE on which to run the thread, if there is already a thread running on the PE, what link protocol to use, and what transition should occur. In some embodiments, selector 11411 is a finite state machine implemented and executed by processor core 11419.

[0205] The memory 11413 may include, for example, in some embodiments, one or more converters 11415 (e.g., binary, JIT compiler, etc.) stored in the memory to convert thread code into a different format for a selected PE.

[0206] During operation, the OS utilizes a heterogeneous scheduler (eg, heterogeneous scheduler 101, 301) that presents an abstraction of the execution environment to schedule and execute threads for processing.

[0207] The following table summarizes potential abstraction features (i.e., what a program sees), potential design freedoms and architectural optimizations (i.e., what is hidden from the programmer), and potential benefits or reasons for providing particular features in the abstraction. [Table 1]

[0208] In some exemplary implementations, the heterogeneous scheduler, in combination with other hardware and software resources, offers a complete programming model that runs everything and supports all programming techniques (e.g., compilers, intrinsics, assembly, libraries, JIT, offload, device). Other exemplary implementations offer alternative execution environments that match those offered by other processor developers, such as ARM Holdings, Inc., MIPS, IBM, or their licensees or adopters.

[0209] Figure 119 is a block diagram of a processor presenting an abstract execution environment, as described in detail above. In this example, the processor 11901 includes several different core types, such as those described in detail in Figure 1. Each (wide) SIMD core 11903 includes fused multiply-add (FMA) circuitry supporting dense arithmetic primitives, its own caches (e.g., L1 and L2), special-purpose execution circuitry, and storage for thread state.

[0210] Each latency optimized (OOO) core 11913 includes a fused multiply-accumulate (FMA) circuit, its own cache (eg, L1 and L2) and out-of-order execution circuit.

[0211] Each scalar core 11905 includes fused multiply-accumulate (FMA) circuitry, its own caches (e.g., L1 and L2), and special-purpose execution and thread state storage. Typically, a scalar core 11905 supports enough threads to cover memory latency. In some embodiments, the number of SIMD cores 11903 and latency-optimized cores 11913 is small compared to the number of scalar cores 11905.

[0212] In some embodiments, one or more accelerators 11917 are included. These accelerators 11917 may be fixed function or FPGA-based. Alternatively or in addition to these accelerators 11917, in some embodiments, the accelerators 11917 are external to the processor.

[0213] The processor 11901 also includes a last level cache (LLC) 11907 that is shared by the cores within the processor and potentially any accelerators. In some embodiments, the LLC 11907 includes circuitry for high-speed atomics.

[0214] One or more interconnects 11915 couple the cores and accelerators to each other and to external interfaces, for example, in some embodiments a mesh-type interconnect couples the various cores.

[0215] The memory controller 11909 couples the cores and / or accelerators to memory.

[0216] A number of input / output interfaces (eg, PCIe, a common link, described in more detail below) 11911 connect the processor 11901 to external devices, such as other processors and accelerators.

[0217] 4 illustrates an embodiment of system boot and device discovery for a computer system. Knowledge about the system includes, for example, what cores are available, how much memory is available, and memory locations associated with the cores to be utilized by the heterogeneous scheduler. In some embodiments, this knowledge is established using the Advanced Configuration and Power Interface (ACPI).

[0218] At 401, the computer system is booted.

[0219] Configuration settings are queried at 403. For example, in some BIOS-based systems, when booted, the BIOS performs system checks and prepares the computer for operation by querying its own memory banks for drives and other configuration settings.

[0220] At 405, a search for plug-in components occurs. For example, the BIOS searches for any plug-in components in the computer and sets up pointers (interrupt vectors) in memory to access their routines. The BIOS accepts requests from device drivers and application programs for interfacing with hardware and other peripheral devices.

[0221] At 407, data structures for system components (e.g., cores, memory, etc.) are created. For example, the BIOS typically generates hardware and peripheral device configuration information through which the OS interfaces with attached devices. Additionally, ACPI defines a flexible and scalable hardware interface to a system board, allowing a computer to turn its peripheral devices on and off for improved power management, especially in portable devices such as notebook computers. The ACPI specification includes hardware interfaces, software interfaces (APIs), and data structures that, when implemented, support OS-directed configuration and power management. Software designers can use ACPI to integrate power management functions across an entire computer system, including hardware, the operating system, and application software. This integration allows the OS to determine which devices are active and handle all of the power management resources for computer subsystems and peripheral devices.

[0222] At 409, the operating system (OS) loads and gains control. For example, once the BIOS has completed its boot routine, the BIOS hands control over to the OS. In the case of ACPI, the BIOS hands control over the computer to the OS, and the BIOS exports a data structure to the OS that includes an ACPI namespace, which can be graphically represented as a tree. The namespace acts as a directory of ACPI devices connected to the computer and contains objects that further define and provide status information for each ACPI device. Each node in the tree is associated with a device, while nodes, subnodes, and leaves represent objects that, when evaluated by the OS, control the device and return specific information to the OS as defined in the ACPI specification. The OS, or a driver accessed by the OS, may include a set of functions to enumerate and evaluate namespace objects. When the OS calls a function and returns the value of an object in the ACPI namespace, the OS is said to have evaluated that object.

[0223] In some examples, available devices change. For example, accelerators, memory, etc. are added. An embodiment of a method for post-system boot device discovery is shown in FIG. 116. For example, this method embodiment may be used to discover accelerators added to a system after boot. At 11601, an indication of a connected device being powered on or reset is received. For example, an endpoint device is plugged into a PCIe slot or reset, for example, by the OS.

[0224] At 11603, link training is performed with the connected device to initialize the connected device. For example, PCIe link training is performed to establish link configuration parameters such as link width, lane polarity, and / or maximum supported data rate. In some embodiments, the capabilities of the connected device are stored (e.g., in an ACPI table).

[0225] At 11605, when the initialization of the connected device is complete, a ready message is sent from the connected device to the system.

[0226] At 11607, the connected device's ready status bit is set to indicate that the device is ready for configuration.

[0227] At 11609, the initialized, connected device is configured. In some embodiments, the device and OS agree on an address for the device (e.g., a memory-mapped I / O (MMIO) address). The device provides a device descriptor that includes one or more of a vendor identification number (ID), a device ID, a model number, a serial number, characteristics, resource requirements, etc. The OS may determine additional operational and configuration parameters for the device based on the descriptor data and system resources. The OS may generate a configuration query. The device may respond with the device descriptor. The OS then generates configuration data and sends this data to the device (e.g., through PCI hardware). This may include setting a base address register that defines the address space associated with the device.

[0228] After system knowledge is built, the OS utilizes a heterogeneous scheduler (e.g., heterogeneous scheduler 101, 301, etc.) to schedule threads for processing and execute the threads. The heterogeneous scheduler then dynamically and transparently (e.g., to the user and / or the OS) maps each thread's code fragment to the most appropriate type of processing element, thereby potentially avoiding the need to build hardware for legacy architectural features and potentially exposing microarchitecture details to the system programmer or OS.

[0229] In some examples, the most suitable type of processing element is determined based on the performance of the processing element and the execution characteristics of the code fragment. In general, a program and associated threads may have different execution characteristics depending on the workload being processed at a given time. Exemplary execution characteristics, or phases of execution, include, for example, a data-parallel phase, a thread-parallel phase, and a serial phase. The following table identifies these phases and summarizes their characteristics. The table also includes exemplary workloads / operations, exemplary hardware useful in processing each phase type, and the typical purpose of the phase and hardware used. [Table 2]

[0230] In some embodiments, the heterogeneous scheduler is configured to select between thread migration and emulation. In configurations where each type of processing element can process any type of workload (if it requires emulation to do so), the most suitable processing element is selected for each program phase based on one or more criteria including, for example, the latency requirements of the workload, the increased execution latency associated with emulation, the power and thermal characteristics and constraints of the processing element, etc. As will be described in more detail below, the selection of a suitable processing element is achieved in some embodiments by detecting the presence of SIMD instructions or vectorizable code in a code fragment, taking into account the number of threads being executed.

[0231] Moving threads between processing elements is not without disadvantages. For example, data may need to be moved from a shared cache to a lower-level cache, causing both the originating and recipient processing elements to flush their pipelines to accommodate the move. Optionally, in some embodiments, the heterogeneous scheduler implements hysteresis to avoid very frequent migrations (e.g., by setting a threshold for one or more of the criteria referenced above, or a subset of the same). In some embodiments, hysteresis is implemented by limiting thread migrations to not exceed a predefined rate (e.g., one migration per millisecond). Thus, the rate of such migrations is limited to avoid excessive overload due to code generation, synchronization, and data migration.

[0232] In some embodiments, for example, if migration is not selected by the heterogeneous scheduler as being the preferred approach for a particular thread, the heterogeneous scheduler emulates missing functionality for the thread on the assigned processing element. For example, in embodiments that maintain a constant total number of threads available to the operating system, the heterogeneous scheduler may emulate multithreading when the number of available hardware threads is oversubscribed (e.g., in a wide simultaneous multithreading core). On a scalar or latency core, one or more SIMD instructions of the thread are converted to scalar instructions, or on a SIMD core, more threads are spawned and / or instructions are converted to utilize packed data.

[0233] 5 shows an example of thread migration based on a mapping of program phases to three types of processing elements. As shown, the three types of processing elements include latency-optimized (e.g., out-of-order cores, accelerators, etc.), scalar (processing one data item per instruction time), and SIMD (processing multiple data elements per instruction). Typically, this mapping is performed by a heterogeneous scheduler on a per-thread or per-code-fragment basis in a manner that is transparent to the programmer and the operating system.

[0234] In one embodiment, a heterogeneous scheduler is used to map each phase of a workload to the most appropriate type of processing element. Ideally, this alleviates the need to build hardware for legacy functions and avoids exposing microarchitecture details. The heterogeneous scheduler presents a complete programming model that supports multiple code types, such as compiled code (machine code), intrinsics (programming language logical constructs that map directly to processor or accelerator instructions), assembly code, libraries, intermediate (JIT-based), offload (movement from one machine type to another), and device-specific.

[0235] In a particular configuration, the default selection for the target processing element is the latency optimized processing element.

[0236] Referring again to FIG. 5 , in the execution 501 of a serial phase for a workload, it is first processed on one or more latency-optimized processing elements. Upon detecting a phase shift (e.g., before execution, either dynamically as the code becomes more data parallel, e.g., as seen by the type of instructions available in the code before or during execution), the workload is migrated to one or more SIMD processing elements to complete the execution 503 of the data-parallel phase. Additionally, execution scheduling and / or transformations are typically cached. The workload is then migrated back to one or more latency-optimized processing elements, or a second set of one or more latency-optimized processing elements, to complete the execution 505 of the next serial phase. Next, the workload is migrated to one or more scalar cores to process the execution 507 of the thread-parallel phase. Next, the workload is migrated back to one or more latency-optimized processing elements for completion of the execution 509 of the next serial phase.

[0237] While this illustrated example shows a return to a latency-optimized core, the heterogeneous scheduler may continue execution of any subsequent phases of execution on one or more corresponding types of processing elements until the thread is terminated. In some embodiments, the processing elements utilize work queues to store incomplete tasks. As a result, tasks may not start immediately, but will be executed as their spot in the queue appears.

[0238] 6 is an exemplary implementation flow performed by a heterogeneous scheduler, such as heterogeneous scheduler 101. The flow illustrates the selection of a processing element (e.g., core). As shown, a code fragment is received by the heterogeneous scheduler. In some embodiments, an event occurs, including, but not limited to, a thread wake-up command, a write to a page directory base register, a sleep command, a thread phase change, and one or more instructions indicating a desired reallocation.

[0239] In 601, the heterogeneous scheduler determines whether a code fragment (e.g., a code fragment in a serial or parallel phase) has parallelism, for example, based on detected data dependencies, instruction types, and / or control flow instructions. For example, a thread full of SIMD code would be considered parallel. If the code fragment is not suitable for parallel processing, the heterogeneous scheduler selects one or more latency-sensitive operation elements (e.g., OOO cores) to process the code fragment in the serial phase of execution 603. Typically, OOO cores have (deep) speculation and dynamic scheduling and usually have lower performance / watt compared to simpler alternatives.

[0240] In some embodiments, there are no latency-sensitive operational elements available because they typically consume more power and die space than scalar cores, and in these embodiments, only scalar, SIMD, and accelerator cores are available.

[0241] At 605, for parallel code fragments, parallelizable code fragments, and / or vectorizable code fragments, the heterogeneous scheduler determines the type of parallelism of the code. At 607, for thread-parallel code fragments, the heterogeneous scheduler selects thread-parallel processing elements (e.g., multiprocessor scalar cores). Thread-parallel code fragments include independent instruction sequences that can be executed simultaneously on separate scalar cores.

[0242] Data parallel code occurs when each processing element performs the same task on a different amount of data. Data parallel code can come in different data layout forms: packed and random. At 609, a data layout is determined. Random data may be assigned to SIMD processing elements, but this requires the use of gather instructions 613 that pull data from different memory locations, spatial computation arrays 615 (which spatially map computations onto an array of small programmable processing elements, e.g., an FPGA array), or arrays of scalar processing elements 617. Packed data is assigned at 611 to SIMD processing elements or processing elements that use dense arithmetic primitives.

[0243] In some embodiments, transformations are performed on the code fragment to better suit the selected destination processing element. For example, the code fragment may be 1) transformed to utilize a different instruction set, 2) made more parallel, 3) made less parallel (serialized), 4) made data parallel (e.g., vectorized), and / or 5) made less data parallel (e.g., non-vectorized).

[0244] After a processing element is selected, the code fragment is sent to one of the determined processing elements for execution.

[0245] 7 illustrates an example method for thread destination selection by a heterogeneous scheduler. In some embodiments, the method is performed by a binary translator. At 701, a thread to be evaluated or a code fragment thereof is received. In some embodiments, an event occurs, including, but not limited to, a thread wakeup command, a write to a page directory base register, a sleep command, a phase change of a thread, and one or more instructions indicating a desired reallocation.

[0246] At 703, a determination is made whether the code fragment is to be offloaded to an accelerator. For example, a code fragment to be sent to an accelerator. The heterogeneous scheduler may know this is a corrective action if the code includes code that identifies a desire to use an accelerator. This desire may be an identifier indicating that the region of code may be executed on an accelerator or may be executed natively (e.g., ABEGIN / AEND as described herein), or an explicit command to use a particular accelerator.

[0247] In some embodiments, at 705, a transformation of the code fragment is performed to better suit the selected destination processing element. For example, the code fragment may be 1) transformed to utilize a different instruction set, 2) made more parallel, 3) made less parallel (serialized), 4) made data parallel (e.g., vectorized), and / or 5) made less data parallel (e.g., non-vectorized).

[0248] Typically, the translated threads are cached for later use at 707. In some embodiments, the binary translator caches the translated threads locally so that they are available for future use by the binary translator. For example, if code becomes "hot" (is executed repeatedly), caching provides a mechanism for future use without the penalty of translation (although there may be a transmission cost).

[0249] At 709, the (translated) thread is sent (e.g., offloaded) to the destination processing element for processing. In some embodiments, the translated thread is cached by the recipient so that it is locally available for future use. Furthermore, if the recipient or binary translator determines that the code is "hot," this caching allows for faster execution while using less energy.

[0250] In 711, the heterogeneous scheduler determines whether a code fragment (e.g., a code fragment in a serial or parallel phase) has parallelism, for example, based on detected data dependencies, instruction types, and / or control flow instructions. For example, a thread full of SIMD code would be considered parallel. If the code fragment is not suitable for parallel processing, the heterogeneous scheduler selects one or more latency-sensitive operation elements (e.g., OOO cores) to process the code fragment in the serial phase of execution 713. Typically, OOO cores have (deep) speculation and dynamic scheduling, and therefore may have better performance / watt compared to scalar alternatives.

[0251] In some embodiments, there are no latency-sensitive operational elements available because they typically consume more power and die space than scalar cores, and in these embodiments, only scalar, SIMD, and accelerator cores are available.

[0252] At 715, for parallel code fragments, parallelizable code fragments, and / or vectorizable code fragments, the heterogeneous scheduler determines the type of parallelism of the code. At 717, for thread-parallel code fragments, the heterogeneous scheduler selects thread-parallel processing elements (e.g., multiprocessor scalar cores). Thread-parallel code fragments include independent instruction sequences that can be executed simultaneously on separate scalar cores.

[0253] Data parallel code occurs when each processing element performs the same task on a different amount of data. Data parallel code can come in different data layout forms: packed and random. At 719, the data layout is determined. Random data may be assigned to SIMD processing elements, but requires the use of gather instructions 723, spatial computation arrays 725, or arrays of scalar processing elements 727. Packed data is assigned to SIMD processing elements or processing elements that use dense arithmetic primitives at 721.

[0254] In some embodiments, transformations are performed on non-offloaded code fragments to better suit the determined destination processing element. For example, the code fragments may be 1) transformed to utilize a different instruction set, 2) made more parallel, 3) made less parallel (serialized), 4) made data parallel (e.g., vectorized), and / or 5) made less data parallel (e.g., non-vectorized).

[0255] After a processing element is selected, the code fragment is sent to one of the determined processing elements for execution.

[0256] The OS refers to the total number of potentially available threads, regardless of which cores and accelerators are accessible. In the following description, each thread is enumerated by a thread identifier (ID), referred to as a logical ID. In some embodiments, the operating system and / or heterogeneous scheduler uses the logical ID to map threads to a particular processing element type (e.g., core type), processing element ID, and thread ID on that processing element (e.g., a tuple of core type, core ID, thread ID). For example, a scalar core has a core ID and one or more thread IDs, a SIMD core has a core ID and one or more thread IDs, an OOO core has a core ID and one or more thread IDs, and / or an accelerator has a core ID and one or more thread IDs.

[0257] FIG. 8 illustrates the concept of using stripe mapping for logical IDs. Stripe mapping may be used by a heterogeneous scheduler. In this example, there are eight logical IDs and three core types, each with one or more threads. Typically, the logical ID to (core ID, thread ID) mapping is calculated using division and modulo and may be fixed to preserve commonality of software threads. The logical ID to (core type) mapping is performed flexibly by the heterogeneous scheduler to accommodate future new core types that become available to the OS.

[0258] Figure 9 shows an example of the use of striped mapping for logical IDs. In the example, logical IDs 1, 4, and 5 are mapped to a first core type, and all other logical IDs are mapped to a second core type. A third core type is not utilized.

[0259] In some embodiments, groupings of core types are created. For example, a "core group" tuple may consist of one OOO tuple and all scalar, SIMD, and accelerator core tuples whose logical IDs map to the same OOO tuple. Figure 10 shows an example of a core group. Typically, serial phase detection and thread migration are performed within the same core group.

[0260] 11 illustrates an example method for thread execution in a system utilizing a binary translator switching mechanism. At 1101, a thread executes on a core. The core may be any of the types described in detail herein, including an accelerator.

[0261] At some point during the execution of the thread, a potential core reassignment event occurs at 1103. Exemplary core reassignment events include, but are not limited to, a thread wake-up command, a write to the page directory base register, a sleep command, a phase change of the thread, and one or more instructions indicating a desired reassignment to a different core.

[0262] The event is processed and a determination is made as to whether there has been a change in the core allocation at 1105. An exemplary method for processing a particular core allocation is described in detail below.

[0263] In some embodiments, core (re)allocation is subject to one or more limiting factors, such as migration rate limits and power consumption limits. Migration rate limits are tracked per core type, core ID, and thread ID. Once a thread is assigned to a target (core type, core ID, thread ID), a timer is started and maintained by the binary translator. No other threads are migrated to the same target until the timer expires. As a result, a thread may migrate away from its current core before the timer expires, while the reverse is not true.

[0264] As will be described in more detail, as more core types (including accelerators) are added to a computing system (either on- or off-die), limiting power consumption is likely to become an increasing focus. In some embodiments, the instantaneous power consumed by all execution threads on all cores is calculated. If the calculated power consumption exceeds a threshold, new threads are only assigned to lower power cores, e.g., SIMD, scalar, and dedicated accelerator cores, and one or more threads are forced to migrate from an OOO core to a lower power core. Note that in some embodiments, limiting power consumption takes precedence over limiting migration rate.

[0265] FIG. 12 illustrates an exemplary method for core allocation of hot code to an accelerator. At 1201, a determination is made that code is “hot.” ​​A hot portion of code may refer to a portion of code that is more suitable for execution on one core over other cores based on considerations such as power, performance, thermal, other known processor criteria, or a combination thereof. This determination may be made using any number of techniques. For example, a dynamic binary optimizer may be utilized to monitor thread execution. Hot code may be detected based on counter values ​​that record the dynamic execution frequency of static code, such as during program execution. In an embodiment where a core is an OOO core and another core is an in-order core, then a hot portion of code may refer to a hot spot in the program code that is more suitable for execution on a serial core, potentially having more available resources for execution of highly repetitive sections. Often, sections of code with highly repetitive patterns can be optimized to run more efficiently on an in-order core. Essentially, in this example, cold code (low iteration) is distributed to native OOO cores, while hot code (high iteration) is distributed to software-managed in-order cores. Hot portions of code may be identified statically, dynamically, or a combination thereof. In the first case, a compiler or user may determine that a section of program code is hot code. In one embodiment, decoding logic within the core is adapted to decode hot code identifier instructions from the program code, which instructions identify hot portions of the program code. Fetching or decoding such instructions may trigger translation and / or execution of the hot section of code on the core. In another example, the code execution is profiled, and based on characteristics of the profile—power and / or performance metrics associated with the execution—regions of program code may be identified as hot code. Monitoring code may be executed on one core to perform monitoring / profiling of program code executing on other cores, as well as hardware operations.Note that such monitoring code may be code maintained in a storage structure within the core or maintained in a system including the processor. For example, the monitoring code may be microcode or other code maintained in a storage structure of the core. As yet another example, static identification of hot code is performed implicitly. However, dynamic profiling of program code execution may ignore the static identification of a region of code as hot; this type of static identification is often referred to as compiler or user suggestion, which dynamic profiling may consider when determining which cores are suitable for code distribution. Furthermore, similar to a characteristic of dynamic profiling, the identification of a region of code as hot is not limited to that section of code always being identified as hot. After transformation and / or optimization, a transformed version of the code section is executed.

[0266] An appropriate accelerator is selected at 1203. The binary translator, virtual machine monitor, or operating system makes this selection based on available accelerators and desired performance. In many instances, accelerators are better suited to run hot code at improved performance per watt than larger, more conventional cores.

[0267] At 1205, the hot code is transmitted to the selected accelerator, utilizing the appropriate connection type, as described in detail herein.

[0268] Finally, the hot code is received and executed by the selected accelerator at 1207. During execution, the hot code may be evaluated for allocation to different cores.

[0269] FIG. 13 illustrates an exemplary method for allocating cores for potential wake-up or write to page directory base register events. For example, this may refer to determining the phase of a code fragment. At 1301, either a wake-up event or a page directory base register (e.g., task switch) event is detected. For example, a wake-up event occurs due to an interrupt received by a stopped thread or a wait state exit. A write to the page directory base register may indicate the start or stop of a serial phase. Typically, this detection occurs on a core running a binary translator.

[0270] At 1303, the number of cores that share the same page table base pointer as the thread that woke up or experienced a task switch is counted. In some embodiments, a table is used to map logical IDs to specific heterogeneous cores. The table is indexed by the logical ID. Each entry in the table includes a flag indicating whether the logical ID is currently enabled or disabled, a flag indicating whether a SIMD or scalar core is preferred, a page table base address (e.g., CR3), a value indicating the type of core the logical ID is currently mapped to, and a counter that limits the migration rate.

[0271] Threads belonging to the same process share the same address space, page table and page directory base register value.

[0272] At 1305, a determination is made as to whether the number of counted cores is greater than one. This count determines whether the thread is in serial or parallel phase. If the count is one, then the thread experiencing the event is in serial phase 1307. As a result, a serial phase thread is a thread that has a unique page directory base register value among all threads in the same core group. Figure 14 shows an example of a serial phase thread. As shown, a process may have one or more threads, each with its own assigned address.

[0273] In 1313 or 1315, if the thread experiencing the event is not assigned to an OOO core, it is migrated to an OOO core, and existing threads on the OOO core are migrated to a SIMD or scalar core. If the thread experiencing the event is assigned to an OOO core, it will remain there in most circumstances.

[0274] If the count is greater than one, then the thread experiencing the event is in a parallel phase and a determination of the type of parallel phase is made at 1309. When the thread experiencing the event is in a data parallel phase, if the thread is not assigned to a SIMD core, the thread is assigned to a SIMD core; otherwise, at 1313, the thread is kept on a SIMD core if it is already there.

[0275] When the thread experiencing the event is in the data parallel phase, if the thread is not assigned to a SIMD core, the thread is assigned to a SIMD core; otherwise, in 1313, the thread is kept on the SIMD core if it is already there.

[0276] When the thread experiencing the event is in the thread parallel phase, if the thread is not assigned to a scalar core, the thread is assigned to a scalar core; otherwise, if it is already there at 1315, the thread is kept on the scalar core.

[0277] Additionally, in some embodiments, a flag is set on the logical ID of the thread to indicate that the thread is running.

[0278] 15 illustrates an exemplary method for potential core allocation for thread response to a sleep command event. For example, this may refer to determining the phase of a code fragment. At 1501, a sleep event affecting a thread is detected. For example, a stop, wait entry, and timeout or pause command occurs. Typically, this detection occurs on a core running a binary translator.

[0279] In some embodiments, at 1503, a flag indicating that the thread is running is cleared for the logical ID of the thread.

[0280] At 1505, the number of threads of the core that share the same page table base pointer as the sleeping thread is counted. In some embodiments, a table is used to map logical IDs to specific heterogeneous cores. The table is indexed by the logical ID. Each entry in the table includes a flag indicating whether the logical ID is currently enabled or disabled, a flag indicating whether a SIMD or scalar core is preferred, a page table base address (e.g., CR3), a value indicating the type of core to which the logical ID is currently mapped, and a counter to limit the migration rate. The first executing thread (with a given page table base pointer) from the group is mentioned.

[0281] At 1507, a determination is made as to whether OOO cores in the system are idle. Idle OOO cores have no OS threads actively running.

[0282] If the page table base pointer is shared by exactly one thread in the core group, then the shared thread is migrated from a SIMD or scalar core to an OOO core at 1509. If the page table base pointer is shared by more than one thread, then at 1511 the first executing thread of the aforementioned group is the thread that was migrated from a SIMD or scalar core to an OOO core to make room for the released thread (which executes in the place of the first executing thread).

[0283] 16 illustrates an exemplary method for potential core allocation for threads in response to a phase change event. For example, this illustrates determining the phase of a code fragment. At 1601, a potential phase change event is detected. Typically, this detection occurs on a core running a binary translator.

[0284] At 1603, a determination is made as to whether the logical ID of the thread is valid on the scalar core and a SIMD instruction is present. If there is no such SIMD instruction, then the thread continues execution as normal. However, if there is a SIMD instruction present in the thread executing on the scalar core, then the thread is migrated to the SIMD core at 1605.

[0285] At 1607, a determination is made as to whether the logical ID of the thread is valid on the SIMD core and no SIMD instructions are present. If there are SIMD instructions, then the thread continues to execute normally. However, if there are no SIMD instructions present for the thread executing on the SIMD core, then the thread is migrated to the scalar core at 1609.

[0286] As noted throughout this description, accelerators accessible to a binary translator may provide more efficient execution (including more energy-efficient execution). However, being able to write programs for each potentially available accelerator may be a difficult, if not impossible, task.

[0287] Described in detail herein are embodiments that use descriptive instructions to explicitly indicate the beginning and end of potential accelerator-based execution for a portion of a thread. If no accessors are available, the code between the descriptive instructions executes without the use of an accelerator. In some implementations, the code between these instructions may relax some semantics of the executing core.

[0288] FIG. 17 shows example code describing an acceleration region. The first instruction in this region is an acceleration begin (ABEGIN) instruction 1701. In some embodiments, the ABEGIN instruction provides permission to enter a relaxed (sub)mode of execution for a non-accelerator core. For example, the ABEGIN instruction in some embodiments allows a programmer or compiler to indicate in a field of the instruction which characteristics of the submode differ from standard mode. Example characteristics include, but are not limited to, one or more of: ignoring self-modifying code (SMC), relaxing memory consistency model restrictions (e.g., relaxing store ordering requirements), changing floating-point semantics, changing performance monitoring (perfmon), changing architectural flag usage, etc. In some embodiments, an SMC is a write to a memory location within a code segment currently cached in the processor that causes the associated cache line (or lines) to be invalidated. If the write affects a prefetch instruction, the prefetch queue is invalidated. This latter check is based on the linear address of the instruction. A write or snoop of an instruction in a code segment where the target instruction has already been decoded and is present in the trace cache invalidates the entire trace cache. SMC may be ignored by adjusting the SMC detection circuitry in the translation lookaside buffer. For example, memory consistency model restrictions may be changed by modifying settings in one or more registers or tables (e.g., memory type range registers or page attribute tables). For example, when modifying floating-point semantics, the way in which floating-point execution circuits perform floating-point calculations is changed through the use of one or more control registers that control the operation of these circuits (e.g., setting a floating-point unit (FPU) control word register). Floating-point semantics that may be modified include, but are not limited to, rounding modes, how exception masks and status flags are handled, flush-to-zero, denormalization settings, and precision (e.g., single, double, extended) control.Additionally, in some embodiments, the ABEGIN instruction takes explicit accelerator type preferences into account, so that an accelerator of the preferred type is selected if it is available.

[0289] Non-accelerator code 1703 follows the ABEGIN instruction 1701. This code is native to the processor cores of the system. In the worst case, if no accessor is available or ABEGIN is not supported, this code will simply execute on the core. However, in some embodiments, a submode is used for its execution.

[0290] By having an accelerated end (AEND) instruction 1705, execution is gated on the processor core until the accelerator appears to have completed execution. Effectively, the use of ABEGIN and AEND allows the programmer to opt in / out with the accelerator and / or relaxed mode of execution.

[0291] 18 illustrates an embodiment of a method for execution using ABEGIN in a hardware processor core. At 1801, an ABEGIN instruction for a thread is fetched. As previously mentioned, an ABEGIN instruction typically includes one or more fields that are used to define different (sub)modes of execution.

[0292] The fetched ABEGIN instruction is decoded using the decode circuitry at 1803. In some embodiments, the ABEGIN instruction is decoded into micro-ops.

[0293] At 1805, the decoded ABEGIN instruction is executed by the execution circuitry such that the thread enters a different mode (which may be explicitly specified by one or more fields of the ABEGIN instruction) for instructions that follow the ABEGIN instruction but before the AEND instruction. This different mode of execution may be on an accelerator or on an existing core, depending on accelerator availability and selection. In some embodiments, accelerator selection is performed by a heterogeneous scheduler.

[0294] At 1807, a subsequent non-AEND instruction is executed in a different mode of execution. If an accelerator is used for execution, the instruction may first be converted to a different instruction set by a binary translator.

[0295] 19 illustrates an embodiment of a method for execution with an AEND in a hardware processor core. At 1901, an AEND instruction is fetched.

[0296] At 1903, the fetched AEND instruction is decoded using the decode circuitry. In some embodiments, the AEND is decoded into micro-ops.

[0297] At 1905, the decoded AEND instruction is executed by the execution circuitry to return from a different mode of execution previously established by the ABEGIN instruction, which may be on an accelerator or on an existing core, depending on accelerator availability and selection.

[0298] Subsequent non-AEND instructions are executed in the original mode of execution at 1807. If an accelerator is used for execution, the instructions may first be translated to a different instruction set by a binary translator.

[0299] Figure 124 shows an example of execution when ABEGIN / AEND is not supported. At 12401, an ABEGIN instruction is fetched. At 12403, a determination is made that ABEGIN is not supported. For example, CPUID indicates that there is no support.

[0300] If support is not present, then typically an operation (nop) that does not change the context associated with the thread is executed at 12405. Since there is no change in execution mode at 12407, the instruction following the unsupported ABEGIN executes normally.

[0301] In some embodiments, the equivalent usage of ABEGIN / AEND is achieved using at least pattern matching. This pattern matching may be based on hardware, software, and / or both. FIG. 20 illustrates a system that provides ABEGIN / AEND equivalence using pattern matching. The illustrated system includes a scheduler 2015 (e.g., a heterogeneous scheduler as described in detail above) that includes a translator 2001 (e.g., a binary translator, a JIT, etc.) stored in memory 2005. Core circuitry 2007 executes scheduler 2015. Scheduler 2015 receives threads 2019 that may or may not have explicit ABEGIN / AEND instructions.

[0302] The scheduler 2015 manages the software-based pattern matcher 2003, performs traps and context switches during offloading, manages the user space save area (described in more detail below), and generates or converts to accelerator code 2011. The pattern matcher 2003 recognizes memory-stored (predefined) code sequences available in the received thread 2019 that may benefit from accelerator utilization and / or relaxed execution states, but that are not described with ABEGIN / AEND. Typically, the respective patterns are stored in the translator 2001, but are at least accessible to the pattern matcher 2003. The selector 2019 functions as previously described in more detail.

[0303] The scheduler 2015 may also provide performance monitoring features. For example, if the code does not have a perfect pattern match, the scheduler 2015 recognizes that the code may need further relaxation of requirements to be more efficient, and adjusts the operating mode associated with the thread accordingly. The relationship of operating modes is described in detail above.

[0304] The scheduler 2015 also performs one or more of the following: cycling cores within ABEGIN / AEND regions, cycling activated or stalled accelerators, counting ABEGIN calls, delaying accelerator queuing (synchronization), and monitoring memory / cache statistics. In some embodiments, the binary translator 2001 includes accelerator-specific code that is used to interpret accelerator code that may be useful in identifying bottlenecks. The accelerator executes this translated code.

[0305] In some embodiments, core circuitry 2007 includes a hardware pattern matcher 2009 that uses stored patterns 2017 to recognize (predefined) code sequences within received threads 2019. Typically, this pattern matcher 2009 is lightweight compared to software pattern matcher 2003 and looks for regions that are easy to express (e.g., rep movs). The recognized code sequences may be translated for accelerator use by scheduler 2015 and / or may result in a relaxed operating mode for the thread.

[0306] Coupled to the system are one or more accelerators 2013 that receive and execute accelerator code 2011.

[0307] 21 illustrates an embodiment of a method for non-accelerated description threads subjected to pattern recognition, the method being performed by a system including at least one type of pattern matcher.

[0308] In some embodiments, a thread is executed at 2101. Typically, this thread is executed on a non-accelerator core. The instructions of the executing thread are provided to a pattern matcher. However, the instructions of the thread may be provided to the pattern matcher before any execution.

[0309] Patterns within the threads are recognized (detected) at 2103. For example, a software-based pattern matcher or hardware pattern matcher circuit finds patterns typically associated with available accelerators.

[0310] At 2105, the recognized patterns are translated for the available accelerators, for example, a binary translator converts the patterns into accelerator code.

[0311] The translated code is transferred to an available accelerator at 2107 for execution.

[0312] 22 illustrates an embodiment of a method for non-accelerated description threads subjected to pattern recognition, performed by a system including at least one type of pattern matcher, such as the system of FIG.

[0313] In some embodiments, a thread is executed in 2201. Typically, this thread is executed on a non-accelerator core. The instructions of the executing thread are provided to a pattern matcher. However, the instructions of the thread may be provided to the pattern matcher prior to any execution.

[0314] Patterns within the threads are recognized (detected) at 2203. For example, a software-based pattern matcher or hardware pattern matcher circuit finds patterns typically associated with available accelerators.

[0315] At 2205, the binary translator adjusts the operating mode associated with the thread to use the relaxation request based on the recognized pattern. For example, the binary translator utilizes a setting associated with the recognized pattern.

[0316] As described in detail, in some embodiments, parallel regions of code are delimited by ABEGIN and AEND instructions. Within an ABEGIN / AEND block, isolation of certain memory load and store operations is guaranteed. Other loads and stores consider potential dependencies. This allows an implementation to parallelize a block with little or no memory dependency checking. In any case, serial execution of the block is permitted because the serial case is among the possible ways to execute the block. The binary translator performs static dependency analysis to create instances of parallel execution and maps these instances to hardware. The static dependency analysis may parallelize outer, middle, or inner loop iterations. Slicing is implementation dependent. The ABEGIN / AEND implementation extracts parallelism in the size most appropriate for the implementation.

[0317] ABEGIN / AEND blocks may contain multiple levels of nested loops. Implementations are free to choose the amount of parallelism they support or fall back to serial execution. ABEGIN / AEND provides parallelism over a much larger domain than SIMD instructions. For certain types of code, ABEGIN / AEND allows for more efficient hardware implementations than multithreading.

[0318] Through the use of ABEGIN / AEND, the programmer and / or compiler can fall back to traditional serial execution by CPU cores if the parallelism criteria are not met. When running on traditional out-of-order CPU cores, ABEGIN / AEND reduces the area and power requirements of the Memory Ordering Buffer (MOB) as a result of relaxed memory ordering.

[0319] Within an ABEGIN / AEND block, the programmer specifies memory dependencies. Figure 23 shows various types of memory dependencies 2301, their semantics 2303, ordering requirements 2305, and use cases 2307. Additionally, several semantics apply to instructions within an ABEGIN / AEND block, depending on the implementation. For example, in some embodiments, register dependencies are allowed, but modifications to registers do not persist beyond the AEND. Furthermore, in some embodiments, an ABEGIN / AEND block must be entered with an ABEGIN and exited with an AEND (or a similar state entered based on pattern recognition), with no branches into or out of the ABEGIN / AEND block. Finally, the instruction stream typically cannot be modified.

[0320] In some embodiments, the ABEGIN instruction includes a source operand that includes a pointer to a memory data block. This data memory block contains much of the information used by the runtime and core circuitry to process the code within the ABEGIN / AEND block.

[0321] 24 shows an example of a memory data block pointed to by an ABEGIN instruction. As shown, depending on the implementation, the memory data block may include fields for a sequence number 2401, a block class 2403, an implementation identifier 2405, a saved state area size 2407, and a local storage area size 2409.

[0322] Sequence number 2401 indicates how much (parallel) computation the processor has gone through before an interrupt. Software initializes sequence number 2401 to zero before execution of ABEGIN. Execution of ABEGIN writes a non-zero value to sequence number 2401 to track its progress. Upon completion, execution of AEND writes zero to reinitialize sequence number 2401 for its next use.

[0323] The predefined block class identifier 2403 (i.e., GUID) specifies a predefined ABEGIN / AEND block class. For example, DMULADD and DGEMM may be predefined as block classes. With predefined classes, the binary translator does not need to analyze the binary to perform mapping analysis to heterogeneous hardware. Instead, the translator (e.g., binary translator) simply takes the input value and performs a pre-generated translation for this ABEGIN / AEND class. The code enclosed with ABEGIN / AEND simply serves as the code used to implement this class in the non-specialized core.

[0324] The implementation ID field 2405 indicates the type of execution hardware used. Execution of ABEGIN updates this field 2405 to indicate the type of heterogeneous hardware used. This helps implementations migrate ABEGIN / AEND code to machines with different acceleration hardware types or no accelerators at all. This field allows for possible translation of saved context to adapt the target implementation. That is, if ABEGIN / AEND code is interrupted and migrated to a machine that does not have the same accelerator type, an emulator is used to execute the code after the migration until it exits the AEND. This field 2405 may also allow the system to dynamically reassign ABEGIN / AEND blocks to different heterogeneous hardware within the same machine, even if the block is interrupted in the middle of its execution.

[0325] The state save area field 2407 indicates the size and format of the state save area, which is implementation specific. The implementation guarantees that the implementation-specific portion of the state save area does not exceed some maximum value specified in CPUID. Typically, execution of an ABEGIN instruction causes a write to the state save area of ​​general-purpose and packed data registers that are modified within the ABEGIN / AEND block, associated flags, and additional implementation-specific state. Multiple instances of registers may be written to facilitate parallel execution.

[0326] Local storage area 2409 is allocated as the local storage area. The amount of storage to reserve is typically specified as an immediate operand to ABEGIN. When the ABEGIN instruction is executed, a specific register (e.g., R9) is written with an address in local storage 2409. In the event of a fault, this register points to a sequence number.

[0327] Each instance of parallel execution receives a unique local storage area 2409. The address is different for each instance of parallel execution. Serial execution is allocated one storage area. The local storage area 2409 provides temporary storage beyond the general purpose and packed data registers of the architecture. The local storage area 2409 should not be accessed outside of the ABEGIN / AEND block.

[0328] 25 illustrates an example of a memory 2503 configured to use ABEGIN / AEND semantics. Not shown is the hardware (e.g., various processing elements described herein) that supports ABEGIN / AEND and utilizes this memory 2503. As will be described in detail, memory 2503 includes a saved state area 2507 that contains indications of used registers 2501, flags 2505, and implementation-specific information 2511. Additionally, local storage 2509 is stored in memory 2503 for each parallel execution instance.

[0329] Figure 26 shows an example of a method of operation in different modes of execution using ABEGIN / AEND. Typically, this method is performed by a combination of entities, such as a transformer and execution circuitry. In some embodiments, threads are transformed before entering this mode.

[0330] At 2601, a different mode of execution is entered, such as a relaxed mode of execution (with or without an accelerator). This mode is typically entered through execution of an ABEGIN instruction. However, as described in detail above, this mode may also be entered through a pattern match. Entering this mode includes resetting the sequence number.

[0331] At 2603, a saved state area is written, such as general and packed data registers that are modified, associated flags, and additional implementation-specific information. This area allows execution to be resumed or rolled back if something goes wrong within the block (e.g., an interrupt).

[0332] A local storage area is reserved for each parallel execution instance at 2605. As described in detail above, the size of this area is indicated by the state save area field.

[0333] During execution of the block, the progress of the block is tracked at 2607. For example, when an instruction is retired after successful execution, the sequence number of the block is updated.

[0334] At 2609, a determination is made (e.g., to determine whether the block is complete) depending on whether the AEND instruction has been reached. If the AEND instruction has not been reached, then at 2613, the local storage area is updated with the intermediate results. Execution extracts from these results, if possible. However, in some examples, a rollback to before the ABEGIN / AEND occurs at 2615. For example, if an exception or interrupt occurs during execution of the ABEGIN / AEND block, the instruction pointer points to the ABEGIN instruction and the R9 register points to a memory data block that is updated with the intermediate results. Upon resuming, the state saved in the memory data block is used to resume at the correction point. Furthermore, if the initial portion of the memory data block containing the state save area does not exist or is not accessible, a page fault is triggered. For loads and stores to the local storage area, a page fault is reported in the normal manner, i.e., on the first access to a page that does not exist or is not accessible. In some examples, a non-accelerator processing element is used upon resuming.

[0335] If the block completes successfully, then the discarded registers are returned to their original state along with the flags in 2611. Only the memory state is different after the block.

[0336] 27 shows an example of a method of operation in different modes of execution using ABEGIN / AEND. Typically, this method is performed by a combination of entities, such as a binary converter and an execution circuit.

[0337] At 2701, a different mode of execution is entered, such as a relaxed mode of execution (with or without an accelerator). This mode is typically entered through execution of an ABEGIN instruction. However, as described in detail above, this mode may also be entered through a pattern match. Entering this mode includes resetting the sequence number.

[0338] At 2703, a saved state area is written, such as modified general and packed data registers, associated flags, and additional implementation-specific information. This area allows execution to be resumed or rolled back if something goes wrong within the block (e.g., an interrupt).

[0339] A local storage area is reserved for each parallel execution instance at 2705. As described in detail above, the size of this area is indicated by the state save area field.

[0340] At 2706, the code within the block is translated for execution.

[0341] During execution of the transformed block, the progress of the block is tracked at 2707. For example, when an instruction is retired after successful execution, the sequence number of the block is updated.

[0342] At 2709, a determination is made (e.g., to determine whether the block is complete) depending on whether the AEND instruction has been reached. If the AEND instruction has not been reached, then at 2713, the local storage area is updated with the intermediate results. Execution extracts from these results, if possible. However, in some instances, a rollback to before the ABEGIN / AEND occurs at 2715. For example, if an exception or interrupt occurs during execution of the ABEGIN / AEND block, the instruction pointer points to the ABEGIN instruction and the R9 register points to a memory data block that is updated with the intermediate results. Upon resuming, the state saved in the memory data block is used to resume at the correction point. Furthermore, if the initial portion of the memory data block containing the state save area does not exist or is not accessible, a page fault is triggered. For loads and stores to the local storage area, a page fault is reported in the normal manner, i.e., on the first access to a page that does not exist or is not accessible. In some instances, a non-accelerator processing element is used upon resuming.

[0343] If the block completes successfully, then the discarded registers are returned to their original state along with the flags at 2711. Only the memory state is different after the block.

[0344] As mentioned above, in some embodiments, a common link (called a Multi-Protocol Common Link (MCL)) is used to reach devices (e.g., the processing elements described in FIGS. 1 and 2). In some embodiments, these devices are seen as PCI Express (PCIe) devices. This link has three or more protocols dynamically multiplexed over the link. For example, the common link may support the following protocols: 1) a Producer / Consumer, Discover, Configure, Interrupt (PDCI) protocol that enables device discovery, device configuration, error reporting, interrupts, DMA-style data transfers, and various services, as may be defined in one or more proprietary or industry standards (e.g., PCI Express specifications or equivalent alternatives); 2) a Caching Agent Coherence (CAC) protocol that enables devices to issue coherent read and write requests to processing elements; and 3) a Memory Access (MA) protocol that enables a processing element to access the local memory of another processing element. While specific examples of these protocols are provided (e.g., Intel® On-Chip System Fabric (IOSF), In-Die Interconnect (IDI), Scalable Memory Interconnect 3+ (SMI3+)), the underlying principles of the present invention are not limited to any particular set of protocols.

[0345] Fig. 120 is a simplified block diagram 12000 illustrating an exemplary multi-chip configuration 12005 including two or more chips or dies (e.g., 12010, 12015) communicatively connected using an exemplary multi-chip link (MCL) 12020. While Fig. 120 illustrates an example of two (or more) dies interconnected using an exemplary MCL 12020, it should be understood that the principles and features described herein with respect to MCL implementations may apply to any interconnect or link connecting a die (e.g., 12010) and other components, including connecting two or more dies (e.g., 12010, 12015), connecting a die (or chip) to another component off-die, connecting a die to another device or die off-package (e.g., 12005), a die to a BGA package, or mounting a patch on an interposer (POINT), among other potential examples.

[0346] In some examples, larger components (e.g., die 12010, 12015) may themselves be IC systems, such as a system-on-chip (SoC), multiprocessor chip, or other component that includes multiple components (12026-12030 and 12040-12045) such as cores, accelerators, etc., on a device, e.g., on a single die (e.g., 12010, 12015). MCL 12020 provides flexibility for building complex and diverse systems from potentially multiple separate components and systems. By way of example, each of die 12010, 12015 may be manufactured or otherwise provided by two different entities. Additionally, the die and other components may themselves include interconnects or other communication fabrics (e.g., 12031, 12050) that provide an infrastructure for communication between components (e.g., 12026-12030 and 12040-12045) within a device (e.g., 12010, 12015, respectively). The various components and interconnects (e.g., 12031, 12050) support or use multiple different protocols. Furthermore, communication between die (e.g., 12010, 12015) can potentially include transactions between various components on the die via multiple different protocols.

[0347] Embodiments of the multi-chip link (MCL) support multiple package options, multiple I / O protocols, and reliability, availability, and serviceability (RAS) features. Additionally, the physical layer (PHY) can include physical electrical and logical layers and can support longer channel lengths, including channel lengths greater than about 45 mm in some cases. In some embodiments, exemplary MCLs can operate at high data rates, including data rates greater than 8-10 Gb / s.

[0348] In one exemplary embodiment of MCL, the PHY electrical layer improves upon conventional multi-channel interconnect solutions (e.g., multi-channel DRAM I / O) to extend data rates and channel configurations, for example, with numerous features including, for example, tuned mid-rail termination, low-power active crosstalk cancellation, circuit redundancy, per-bit duty cycle correction and deskew, line coding, and transmitter equalization, among other potential examples.

[0349] In one exemplary embodiment of MCL, the PHY logical layer is implemented to further support cases where data rates and channel configurations are extended while also allowing interconnection across the electrical layer to transport multiple protocols (e.g., electrical layer functionality). Such an embodiment provides and defines a modular common physical layer that is protocol independent and potentially designed to work with any existing or future interconnection protocol.

[0350] Referring to Figure 121, a simplified block diagram 12100 is shown representing at least a portion of a system including an example implementation of a multi-chip link (MCL). The MCL may be implemented using physical electrical connections (e.g., wires implemented as lanes) connecting a first device 12105 (e.g., a first die including one or more subcomponents) with a second device 12110 (e.g., a second die including one or more other subcomponents). In the example shown in the high-level representation of Figure 12100, all signals (within channels 12115, 12120) may be unidirectional, and the lanes may provide data signals having both upstream and downstream data transfer. While the block diagram 12100 of Figure 121 refers to the first component 12105 as the upstream component, the second component 12110 as the downstream component, the physical lanes of the MCL used when transmitting data as the downstream channel 12115, and the lanes used to receive data (from component 12110) as the upstream channel 12120, it should be understood that the MCL between devices 12105, 12110 can be used by each device to both transmit and receive data between the devices.

[0351] In one exemplary embodiment, the MCL can provide a physical layer including electrical MCL physical layers (PHYs) 12125a, b (or collectively 12125) and executable logic implementations MCL logical PHYs 12130a, b (or collectively 12130). The electrical or physical PHY 12125 provides the physical connection over which data is communicated between devices 12105, 12110. Signal conditioning components and logic can be implemented in association with the physical PHY 12125 to establish the high data rate and channel configuration capabilities of the link, with some applications relating to closely clustered physical connections with lengths of approximately 45 mm or longer. The logical PHY 12130 includes circuitry for clocking, link state management (e.g., link layers 12135a, 12135b), and facilitating protocol multiplexing among potentially multiple different protocols used for communication over the MCL.

[0352] In one exemplary embodiment, the physical PHY 12125 includes, for each channel (e.g., 12115, 12120), a set of data lanes over which in-band data is transmitted. In this example, 50 data lanes are provided for each of the upstream and downstream channels 12115, 12120, although other numbers of lanes may be used as permitted by layout and power constraints, desired application, device constraints, etc. Each channel may further include one or more dedicated lanes for strobe or clock signals for the channel, one or more dedicated lanes for enable signals for the channel, one or more dedicated lanes for stream signals, and one or more dedicated lanes for link state machine management or sideband signals. The physical PHY may further include a sideband link 12140, which in some examples may be a bidirectional low-frequency control signal link used to coordinate state transitions and other attributes for the MCLs connecting the devices 12105, 12110, among other examples.

[0353] As described above, multiple protocols are supported using an MCL implementation. In fact, multiple independent transaction layers 12150a, 12150b may be provided in each device 12105, 12110. By way of example, each device 12105, 12110 may support and utilize two or more protocols, such as PCI, PCIe, and CAC, among others. CAC is a coherent protocol used on-die to communicate between cores, last-level caches (LLCs), memory, graphics, and I / O controllers. Other protocols may also be supported, including Ethernet protocols, InfiniBand protocols, and other PCIe fabric-based protocols. A combination of logical and physical PHYs may also be used as an inter-die interconnect, connecting a SerDes PHY (PCIe, Ethernet, InfiniBand, or other high-speed SerDes) on one die to its upper layer implemented on another die, among other examples.

[0354] The logical PHY 12130 supports multiplexing between these multiple protocols in the MCL. By way of example, a dedicated stream lane may be used to assert an encoded stream signal that identifies which protocol applies to data transmitted substantially simultaneously on the data lanes of a channel. Additionally, the logical PHY 12130 negotiates various types of link state transitions that various protocols may support or require. In some examples, the LSM_SB signal transmitted over a dedicated LSM_SB lane of a channel may be used in conjunction with the sideband link 12140 to communicate and negotiate link state transitions between the devices 12105, 12110. Additionally, link training, error detection, skew detection, deskew, and other functions of conventional interconnects may be replaced or governed, in part, using the logical PHY 12130. By way of example, valid signals transmitted over one or more dedicated valid signal lanes in each channel may be used to signal link activity, detect skew and link errors, and implement other features, among other examples. In the example of Figure 121, multiple valid lanes are provided per channel. By way of example, data lanes within a channel may be bundled or clustered (physically and / or logically), and valid lanes may be provided per cluster. Additionally, multiple strobe lanes may be provided in some cases to provide dedicated strobe signals for each cluster within multiple data lane clusters in a channel, among other examples.

[0355] As described above, the logical PHY 12130 negotiates and manages link control signals transmitted between devices connected by the MCL. In some embodiments, the logical PHY 12130 includes a link layer packet (LLP) generation circuit 12160 that transmits link layer control messages (i.e., in-band) over the MCL. Such messages may be transmitted over the data lanes of the channel, with the stream lane identifying the data as link layer-to-link layer messaging, such as link layer control data, among other examples. Link layer messages enabled using the LLP module 12160 support the negotiation and operation of link layer state transitions, power management, loopback, disable, recentering, and scrambling, among other link layer features, between the link layers 12135a, 12135b of the devices 12105, 12110, respectively.

[0356] Referring to FIG. 122, a simplified block diagram 12200 illustrating an example logical PHY of an example MCL is shown. Physical PHY 12205 can be connected to a die that includes logical PHY 12210 and additional logic supporting the link layer of the MCL. The die, in this example, can further include logic to support multiple different protocols over the MCL. By way of example, in the example of FIG. 122, PCIe logic 12215 is provided along with CAC logic 12220, so that the dies can communicate using either PCIe or CAC over the same MCL connecting the two dies, among many other potentially different examples, including examples where more than two protocols, or protocols other than PCIe and CAC, are supported over the MCL. The various protocols supported between the dies can provide varying levels of service and features.

[0357] The logical PHY 12210 may include link state machine management logic 12225 for negotiating link state transitions in conjunction with requests from the die's upper layer logic (e.g., received via PCIe or CAC). In some embodiments, the logical PHY 12210 may further include link test and debug logic (e.g., 12230). As described above, the exemplary MCL may support control signals transmitted between dies via the MCL to facilitate protocol-agnostic, high-performance, and power-efficient functionality of the MCL (among other exemplary functions). By way of example, the logical PHY 12210 may support the generation and transmission, as well as the reception and processing of enable signals, stream signals, and LSM sideband signals in conjunction with the transmission and reception of data over dedicated data lanes, as described in the examples above.

[0358] In some embodiments, multiplexing (e.g., 12235) and demultiplexing (e.g., 12240) logic may be included in or otherwise accessible to logical PHY 12210. By way of example, multiplexing logic (e.g., 12235) may be used to identify data (e.g., embodied as packets, messages, etc.) to be transmitted on the MCL. Multiplexing logic 12235 may identify the protocol governing the data and generate a stream signal encoded to identify the protocol. By way of example, in one exemplary embodiment, the stream signal may be encoded as two hexadecimal symbols of one byte (e.g., CAC:FFh; PCIe:F0h; LLP:AAh; Sideband:55h, etc.) and transmitted during the same window (e.g., one-byte time period window) as the data governed by the identified protocol. Similarly, the demultiplexing logic 12240 may be used to interpret the arriving stream signal to decode the stream signal and identify the protocol that applies to data received simultaneously with the stream signal on the data lanes. The demultiplexing logic 12240 may then apply (or ensure) protocol-specific link layer processing and have the data processed by the corresponding protocol logic (e.g., PCIe logic 12215 or CAC logic 12220).

[0359] Logical PHY 12210 may further include link layer packet logic 12250, which may be used to handle various link control functions, including power management tasks, loopback, disabling, recentering, scrambling, etc. The LLP logic 12250 may facilitate link layer-to-link layer messages via the MCLP, among other functions. Data corresponding to LLP signaling may also be identified by stream signals transmitted on dedicated stream signal lanes encoded to identify that data lane as LLP data. Multiplexing and demultiplexing logic (e.g., 12235, 12240) may also be used to generate and interpret stream signals corresponding to LLP traffic and to direct such traffic to the appropriate die logic (e.g., LLP logic 12250). Similarly, some embodiments of the MCLP may include dedicated sidebands (e.g., sideband 12255 and supporting logic), such as asynchronous and / or low frequency sideband channels, among other examples.

[0360] The logical PHY logic 12210 may further include link state machine management logic that can generate and receive (and use) link state management messaging via a dedicated LSM sideband lane. By way of example, the LSM sideband lane may be used to perform handshaking to advance to a link training state and exit a power management state (e.g., an L1 state), among other potential examples. The LSM sideband signals may be asynchronous signals in that they are not aligned with the data, valid, and stream signals of the link, but instead correspond to signaling state transitions and coordinate link state machines between two dies or chips connected by the link, among other examples. Providing a dedicated LSM sideband lane may, in some examples, allow traditional squelch and receive detection circuitry in an analog front end (AFE) to be eliminated, among other exemplary benefits.

[0361] Referring to FIG. 123, a simplified block diagram 12300 is shown illustrating another representation of logic used to implement an MCL. By way of example, a logical PHY 12210 is provided with a defined logical PHY interface (LPIF) 12305 through which any one of several different protocols (e.g., PCIe, CAC, PDCI, MA, etc.) 12315, 12320, 12325 and signaling modes (e.g., sideband) can interface with the physical layer of the exemplary MCL. In some embodiments, multiplexing and arbitration logic 12330 can also be provided as a separate layer from the logical PHY 12210. In one example, an LPIF 12305 can be provided as an interface on both sides of this MuxArb layer 1230. The logical PHY 12210 can interface with a physical PHY (e.g., an analog front end (AFE) 12205 of the MCL PHY) through another interface.

[0362] The LPIF can abstract away PHYs (logical and electrical / analog) from higher layers (e.g., 12315, 12320, 12325) so that an entirely different PHY can be implemented underneath the LPIF transparent to the higher layers. This helps promote modularity and reuse in designs, allowing the higher layers to remain intact when the underlying signaling technology PHY is updated, among other examples. Additionally, the LPIF can define numerous signals that enable multiplexing / demultiplexing, LSM management, error detection and handling, and other functions of the logical PHY. By way of example, the following table summarizes at least some of the signals that may be defined for an exemplary LPIF: [Table 3]

[0363] As noted in the table, in some embodiments, an alignment mechanism can be provided through the AlignReq / AlignAck handshake. For example, some protocols may lose packet framing when the physical layer enters recovery. Packet alignment can be corrected, for example, to ensure correct framing identification by the link layer. The physical layer can assert the StallReq signal when it enters recovery, which causes the link layer to assert the stall signal when it is ready to forward the newly aligned packet. The physical layer logic can sample both stall and valid to determine whether the packet is aligned. For example, the physical layer can continue to drive trdy and emit link layer packets until stall and valid are sampled and asserted, among other potential implementations, including other alternative implementations that use valid to assist in packet alignment.

[0364] Various fault tolerances may be defined for signals on the MCL. By way of example, fault tolerances may be defined for valid, stream, LSM sideband, low frequency sideband, link layer packets, and other types of signals. Fault tolerance for packets, messages, and other data transmitted over the dedicated data lanes of the MCL may be based on the particular protocol governing the data. In some embodiments, error detection and handling mechanisms may be provided, such as cyclic redundancy checks (CRCs), retry buffers, etc., among other potential examples. By way of example, with respect to PCIe packets transmitted over the MCL, a 32-bit CRC may be used for PCIe transaction layer packets (TLPs) (with guaranteed delivery (e.g., through a replay mechanism)) and a 16-bit CRC may be used for PCIe link layer packets (which may be designed to be lossy (e.g., no replay is applied)). Additionally, for PCIe framing tokens, a specific Hamming distance (e.g., a Hamming distance of four (4)), among other examples, may be defined for the token identifier, and parity and a 4-bit CRC may also be utilized, while for CAC packets, a 16-bit CRC may be utilized.

[0365] In some embodiments, fault tolerance is defined for link layer packets (LLPs) that utilize a valid signal to transition from low to high (i.e., from 0 to 1) (e.g., to aid in guarantee bit and symbol lock). Furthermore, in one example, a specific number of consecutive identical LLPs may be defined to be transmitted, among other defined characteristics that may be used as the basis for determining a fault in the LLP data on the MCL, and a response may be expected for each request, with the requester retrying after a response times out. In a further example, fault tolerance may be provided for valid signals, e.g., spanning an entire time period window or symbol through the valid signal (e.g., by holding the valid signal high for 8 UI). Furthermore, errors or faults in the stream signal may be prevented by, among other examples, maintaining a Hamming distance for the encoding values ​​of the stream signal.

[0366] The logical PHY implementation includes error detection, error reporting, and error handling logic. In some embodiments, the logical PHY of an exemplary MCL may include logic to detect PHY layer deframing errors (e.g., on valid and stream lanes), sideband errors (e.g., related to LSM state transitions), errors within the LLP (e.g., critical to LSM state transitions), among other examples. Some error detection / resolution may be delegated to higher layer logic, such as PCIe logic adapted to detect PCIe-specific errors, among other examples.

[0367] In the case of a deframing error, in some embodiments, one or more mechanisms may be provided through the error handling logic. The deframing error may be handled based on the associated protocol. For example, in some embodiments, the link layer may signal the error to trigger a retry. Deframing may also cause a re-alignment of the logical PHY deframing. Additionally, among other techniques, recentering of the logical PHY may be performed to reacquire symbol / window lock. Centering, in some examples, may include the PHY moving the receiver clock phase to a point that is optimal for detecting arriving data. "Optimal" in this context may refer to the most tolerance to noise and clock jitter. Among other examples, recentering may include a simple centering function, performed, for example, when the PHY wakes up from a low-power state.

[0368] Other types of errors may be associated with other error handling techniques. As an example, an error detected in the sideband may be caught through a timeout mechanism of the corresponding state (e.g., in the LSM). The error may be logged, and then the link state machine may transition to reset. The LSM may be kept in the reset state until a resume command is received from software. In another example, an LLP error, e.g., a link control packet error, may be handled using a timeout mechanism that can resume the LLP sequence if an acknowledgement for the LLP sequence is not received.

[0369] In some embodiments, each of the above protocols is a variant of PCIe. PCIe devices communicate using a common address space associated with the bus. This address space is the bus address space or the PCIe address space. In some embodiments, PCIe devices use addresses in an internal address space that may differ from the PCIe address space.

[0370] The PCIe specification defines a mechanism by which a PCIe device can expose its local memory (or a portion of it) to the bus, thus enabling a CPU or other devices attached to the bus to directly access that memory. Typically, each PCIe device is assigned a dedicated region in the PCIe address space called a PCI Base Address Register (BAR). Furthermore, the addresses that the device exposes are mapped to respective addresses in the PCI BAR.

[0371] In some embodiments, a PCIe device (e.g., an HCA) uses an Input / Output Memory Mapping Unit (IOMMU) to translate between its internal addresses and PCIe bus addresses. In other embodiments, a PCIe device may use a PCI Address Translation Service (ATS) to perform address translation and resolution. In some embodiments, a tag, such as a Process Address Space ID (PASID) tag, is used to define addresses that are translated to belong to a particular process's virtual address space.

[0372] 28 provides additional details regarding one embodiment. As with the embodiments described above, this embodiment includes an accelerator 2801 having accelerator memory 2850 coupled via a multi-protocol link 2800 to a host processor 2802 having host memory 2860. As previously mentioned, accelerator memory 2850 may utilize a different memory technology than host memory 2860 (e.g., accelerator memory may be HBM or stacked DRAM, while host memory may be SDRAM).

[0373] Multiplexers 2811 and 2812 are shown to highlight the fact that multi-protocol link 2800 is a dynamically multiplexed bus supporting PCDI, CAC, and MA protocol (e.g., SMI3+) traffic, each of which may be routed to different functional components within accelerator 2801 and host processor 2802. By way of example, and not limitation, these protocols may include IOSF, IDI, and SMI3+. In one embodiment, PCIe logic 2820 of accelerator 2801 includes a local TLB 2822 for caching virtual-to-physical address translations for use by one or more accelerator cores 2830 when executing commands. As previously mentioned, virtual memory space is distributed between accelerator memory 2850 and host memory 2860. Similarly, the PCIe logic on the host processor 2802 includes an I / O memory management unit (IOMMU) 2810 for managing memory accesses for PCIe I / O devices 2806 and, in one embodiment, accelerator 2801. As shown, the PCIe logic on the accelerator 2820 and the PCIe logic on the host processor 2808 communicate using the PCDI protocol to perform functions such as device discovery, register access, device configuration and initialization, interrupt handling, DMA handling, and address translation services (ATS). As previously mentioned, the IOMMU 2810 on the host processor 2802 may operate primarily to control and coordinate these functions.

[0374] In one embodiment, accelerator core 2830 includes processing engines (elements) that perform the functions required by the accelerator. Additionally, accelerator core 2830 may include a host memory cache 2834 for locally caching pages stored in host memory 2860 and an accelerator memory cache 2832 for caching pages stored in accelerator memory 2850. In one embodiment, accelerator core 2830 communicates with coherence and cache logic 2807 of host processor 2802 via a CAC protocol to ensure that cache lines shared between accelerator 2801 and host processor 2802 remain coherent.

[0375] The bias / coherence logic 2840 of the accelerator 2801 implements the various device / host bias techniques (e.g., page-level granularity) described herein to ensure data coherency while reducing unnecessary communication over the multi-protocol link 2800. As shown, the bias / coherence logic 2840 communicates with the coherence and cache logic 2807 of the host processor 2802 using MA memory transactions (e.g., SMI3+). The coherence and cache logic 2807 is responsible for maintaining coherency of data stored in its LLC 2809, host memory 2860, accelerator memory 2850 and caches 2832, 2834, and each of the individual caches of the core 2805.

[0376] In summary, one embodiment of the accelerator 2801 appears as a PCIe device to software running on the host processor 2802 and is accessed via the PDCI protocol (which effectively reformats the PCIe protocol for a multiplexed bus). The accelerator 2801 may participate in shared virtual memory using the accelerator device TLB and standard PCIe address translation services (ATS). The accelerator may also be treated as a coherence / memory agent. Certain functions (e.g., ENQCMD, MOVDIR, described below) are available on the PDCI (e.g., for work submission), while the accelerator may cache host data at the accelerator and in certain bias transition flows using the CAC. Accesses from the host to accelerator memory (or host bias accesses from the accelerator) may use the MA protocol, as described.

[0377] 29, in one embodiment, the accelerator includes PCI configuration registers 2902 and MMIO registers 2906 that can be programmed to provide access to device back-end resources 2905. In one embodiment, the base addresses for the MMIO registers 2906 are specified by a set of base address registers (BARs) 2901 in the PCI configuration space. Unlike previous implementations, one embodiment of the data streaming accelerator (DSA) described herein does not implement multiple channels or PCI functions, and therefore the device has only one instance of each register. However, there may be more than one DSA device on a single platform.

[0378] Embodiments may provide additional performance or debug registers not described herein, and any such registers should be considered implementation specific.

[0379] PCI configuration space accesses are performed as aligned 1-byte, 2-byte, or 4-byte accesses. See the PCI Express Base specification for rules on accessing unimplemented registers and reserved bits in PCI configuration space.

[0380] MMIO space accesses to the BAR0 region (Capability, Configuration, and Status Registers) are performed as aligned 1-byte, 2-byte, 4-byte, or 8-byte accesses. 8-byte accesses should only be used for 8-byte registers. Software should not read or write unimplemented registers. MMIO space accesses to the BAR2 and BAR4 regions should be performed as 64-byte accesses using the ENQCMD, ENQCMDS, or MOVDIR64B instructions (described in detail below). ENQCMD or ENQCMDS should be used to access work queues (SWQ) that are configured as shared, and MOVDIR64B should be used to access work queues (DWQ) that are configured as dedicated.

[0381] One embodiment of the DSA PCI configuration space implements three 64-bit BARs 2901. The Device Control Register (BAR0) is a 64-bit BAR that contains the physical base address of the device control registers. These registers provide information about device capabilities, controls to configure and enable the device, and device status. The size of the BAR0 area depends on the size of the interrupt message storage 2904. The size is calculated by adding 16 times the number of interrupt message storage entries 2904 to 32KB, rounded up to the next power of two. For example, if a device supports 1024 interrupt message storage entries 2904, the interrupt message storage is 16KB and the size of BAR0 is 64KB.

[0382] BAR2 is a 64-bit BAR that contains the physical base addresses of privileged and non-privileged portals. Each portal is 64 bytes in size and located on a separate 4KB page. This allows portals to be independently mapped to different address spaces using the CPU page table. Portals are used to submit descriptors to devices. Privileged portals are used by kernel-mode software, and non-privileged portals are used by user-mode software. The number of non-privileged portals is equal to the number of supported work queues. The number of privileged portals is the number of work queues (WQs) multiplied by (the size of the MSI-X table minus 1). The address of the portal used to submit a descriptor allows the device to determine which WQ to place the descriptor in, whether the portal is privileged or non-privileged, and which MSI-X table entry can be used for completion interrupts. For example, if a device supports eight WQs, the WQ for a given descriptor is (portal address >> 12) and 0x7. If portal address >> 15 is 0, the portal is non-privileged. Otherwise, the portal is privileged and the MSI-X2903 table index used for the completion interrupt is the portal address >> 15. Bits 5:0 must be 0. Bits 11:6 are ignored. Therefore, any 64-byte aligned address on the page can be used with the same effect.

[0383] Descriptor submissions using a non-privileged portal are subject to the WQ occupancy threshold if configured using the Work Queue Configuration (WQCFG) register. Descriptor submissions using a privileged portal are not subject to that threshold. Descriptor submissions to the SWQ must be submitted using ENQCMD or ENQCMDS. Other write operations to the SWQ portal are ignored. Descriptor submissions to the DWQ must be submitted using 64-byte write operations. Software uses MOVDIR64B to ensure a contiguous 64-byte write. ENQCMD or ENQCMDS to a disabled or dedicated WQ portal returns a retry. Other write operations to the DWQ portal are ignored. Any read operation to the BAR2 address space returns all 1s. Kernel mode descriptors should be submitted using a privileged portal to receive a completion interrupt. If a kernel mode descriptor is submitted using a non-privileged portal, no completion interrupt can be requested. A user mode descriptor may be submitted using either a privileged or non-privileged portal.

[0384] The number of portals in the BAR2 area is the number of WQs supported by the device times the size of the MSI-X2903 table. The size of the MSI-X table is typically the number of WQs plus one. So, for example, if a device supports 8 WQs, the useful size of BAR2 would be 8 x 9 x 4KB = 288KB. The total size of BAR2 would be rounded up to the next power of 2, or 512KB.

[0385] BAR4 is a 64-bit BAR that contains the physical base address of the guest portal. Each guest portal is 64 bytes in size and located on a separate 4KB page. This allows portals to be independently mapped to different address spaces using the CPU Extended Page Table (EPT). If the Interrupt Message Storage Support field in GENCAP is 0, this BAR is not implemented.

[0386] A guest portal may be used by guest kernel mode software to submit descriptors to the device. The number of guest portals is the number of entries in the interrupt message storage times the number of WQs supported. The address of the guest portal used to submit the descriptor allows the device to determine the WQ for the descriptor, and the interrupt message storage entry can be used to generate a completion interrupt for descriptor completion (if it is a kernel mode descriptor and the request completion interrupt flag is set in the descriptor). For example, if a device supports 8 WQs, the WQs for a given descriptor are (guest portal address >> 12) and 0x7, and the interrupt table entry index used for the completion interrupt is guest portal address >> 15.

[0387] In one embodiment, MSI-X is the only PCIe interrupt functionality that the DSA provides and where the DSA does not implement legacy PCI interrupts or MSI. Details of this register structure are in accordance with the PCI Express specification.

[0388] In one embodiment, three PCI Express functions control address translation. Only certain combinations of values ​​for these functions can be supported, as shown in Table A. The values ​​are checked when the enable bit in the general control register (GENCTRL) is set to 1. [Table 4]

[0389] If any of these functions are changed by software while the device is enabled, the device may be halted and an error reported to a software error register.

[0390] In one embodiment, software configures the PASID function to control whether the device performs address translation using PASID. If PASID is disabled, only physical addresses may be used. If PASID is enabled, virtual or physical addresses may be used depending on the IOMMU configuration. If PASID is enabled, both address translation services (ATS) and page request services (PRS) should be enabled.

[0391] In one embodiment, software configures the ATS function to control whether the device should translate addresses before performing a memory access. If address translation is enabled in the IOMMU 2810, ATS must be enabled in the device to obtain acceptable system performance. If address translation is not enabled in the IOMMU 2810, ATS must be disabled. If ATS is disabled, only physical addresses may be used and all memory accesses are performed using untranslated addresses. If PASID is enabled, ATS must be enabled.

[0392] In one embodiment, software configures the PRS function to control whether a device can request a page if address translation fails. If PASID is enabled, the PRS must be enabled, and if PASID is disabled, the PRS must be disabled.

[0393] Some embodiments utilize a virtual memory space that is seamlessly shared among one or more processor cores, accelerator devices, and / or other types of processing devices (e.g., I / O devices). In particular, one embodiment utilizes a shared virtual memory (SVM) architecture in which the same virtual memory space is shared among cores, accelerator devices, and / or other processing devices. Additionally, some embodiments include a heterogeneous physical system memory that is addressed using a common virtual memory space. The heterogeneous physical system memory may use different physical interfaces to interface with the DSA architecture. For example, an accelerator device may be directly coupled to local accelerator memory, such as high-bandwidth memory (HBM), and each core may be directly coupled to host physical memory, such as dynamic random access memory (DRAM). In this example, the shared virtual memory (SVM) is mapped to the combined physical memory of HBM and DRAM such that the accelerator, processor cores, and / or other processing devices can access the HBM and DRAM using a consistent set of virtual memory addresses.

[0394] These and other features of the accelerator are described in detail below. By way of overview, different implementations may include one or more of the following infrastructure functions.

[0395] Shared Virtual Memory (SVM): Some embodiments support SVM, which allows user-level applications to submit commands directly to the DSA using virtual addresses in descriptors. The DSA may support translating virtual addresses to physical addresses using an Input / Output Memory Management Unit (IOMMU), including handling page faults. The virtual address range referenced by a descriptor may span multiple pages distributed across multiple heterogeneous memory types. Additionally, one embodiment also supports the use of physical addresses, as long as the data buffer is contiguous in physical memory.

[0396] Partial Descriptor Completion: With SVM support, an operation may encounter a page fault during address translation. In some cases, the device may terminate processing of the corresponding descriptor upon encountering the fault and provide a completion record to software indicating partial completion and fault information, allowing the software to take remedial action and retry the operation after the fault is resolved.

[0397] Batch Processing: Some embodiments support submitting descriptors in "batches." A batch descriptor points to a set of substantially contiguous work descriptors (i.e., descriptors that contain the actual data processing). When processing a batch descriptor, the DSA fetches work descriptors from a specified memory location and processes them.

[0398] Stateless Devices: In one embodiment, the descriptors are designed so that all the information needed to process the descriptor is contained in the descriptor payload itself. This allows the device to store little client-specific state, which improves its scalability. One exception, if used, that is configured by trusted software is the completion interrupt message.

[0399] Cache Allocation Control: This allows applications to specify whether to write to the cache or to bypass the cache and write directly to memory. In one embodiment, completion records are always written to the cache.

[0400] Shared Work Queue (SWQ) Support: As described in more detail below, some embodiments support scalable work submission through a shared work queue (SWQ) using the Enqueue Command (ENQCMD) and Enqueue Command (ENQCMDS) instructions. In this embodiment, the SWQ is shared by multiple applications.

[0401] Dedicated Work Queue (DWQ) Support: In some embodiments, there is support for high-throughput work submission through a dedicated work queue (DWQ) using the MOVDIR64B instruction. In this embodiment, the DWQ is dedicated to a particular application.

[0402] QoS Support: Some embodiments allow a quality of service (QoS) level to be specified per work queue (e.g., by a kernel driver). Different work queues may then be assigned to different applications, allowing work from different applications to be dispatched from the work queue with different priorities. Work queues can be programmed to use specific channels for fabric QoS.

[0403] Biased Cache Coherence Mechanism

[0404] In one embodiment, direct-attached memory, such as stacked DRAM or HBM, is used to improve accelerator performance and simplify application development for applications that use accelerators with direct-attached memory. In this embodiment, accessor-attached memory is mapped as part of system memory, allowing it to be accessed using shared virtual memory (SVM) techniques (e.g., as used in current IOMMU implementations), but without incurring the typical performance drawbacks associated with full system cache coherence.

[0405] The ability to access accessor-attached memory as part of system memory without cumbersome cache coherence overhead provides a beneficial operating environment for accelerator offload. The ability to access memory as part of the system address mapping allows host software to set up operands and access computation results without the overhead of traditional I / O DMA data copies. Such traditional copies involve driver calls, interrupts, and memory-mapped I / O (MMIO) accesses, which are all inefficient compared to simple memory accesses. At the same time, the ability to access accessor-attached memory without cache coherence overhead can be critical to the execution time of offloaded computations. In cases involving substantial streaming write memory traffic, for example, cache coherence overhead can cut the effective write bandwidth seen by the accelerator in half. The efficiency of operand setup, the efficiency of the resulting accesses, and the efficiency of the accelerator computation all play a role in determining how well an accelerator offload works. The cost of the offload function (e.g., setting up operands and getting results) may be so high that offloading may not be effective at all, or may limit the accelerator to only very large jobs. The efficiency with which the accelerator performs the computation may have the same effect.

[0406] In one embodiment, different memory access and coherence techniques are applied depending on the entity initiating the memory access (e.g., accelerator, core, etc.) and the memory being accessed (e.g., host memory or accelerator memory). These techniques are generally referred to as "coherence bias" mechanisms that provide accessor-attached memory with two sets of cache coherence flows: one that optimizes efficient accelerator accesses to its attached memory, and a second that optimizes host accesses to accessor-attached memory and shared accelerator / host accesses to accessor-attached memory. Furthermore, two techniques for switching between these flows are included: one driven by application software and the other driven by independent hardware hints. In both sets of coherence flows, the hardware maintains full cache coherence.

[0407] As generally shown in FIG. 30 , one embodiment employs a computer system including an accelerator 3001 and one or more computer processor chips having processor cores and I / O circuitry 3003, where the accelerator 3001 is coupled to the processor via a multi-protocol link 2800. In one embodiment, the multi-protocol link 3010 is a dynamically multiplexed link supporting multiple different protocols, including but not limited to those described in detail above. However, it should be noted that the principles underlying the present invention are not limited to any particular set of protocols. Furthermore, it should be noted that the accelerator 3001 and core I / O 3003 may be integrated on the same semiconductor chip or different semiconductor chips, depending on the implementation.

[0408] In the illustrated embodiment, accelerator memory bus 3012 couples accelerator 3001 to accelerator memory 3005, and a separate host memory bus 3011 couples core I / O 3003 to host memory 3007. As previously mentioned, accelerator memory 3005 may comprise high bandwidth memory (HBM) or stacked DRAM (some examples of which are described herein), and host memory 3007 may comprise DRAM, such as double data rate synchronous dynamic random access memory (e.g., DDR3 SDRAM, DDR4 SDRAM, etc.). However, the principles underlying the present invention are not limited to any particular type of memory or memory protocol.

[0409] In one embodiment, both the accelerator 3001 and the "host" software executing on the processing cores within the processor chip 3003 access the accelerator memory 3005 using two separate sets of protocol flows, referred to as "host-biased" flows and "device-biased" flows. As described below, one embodiment supports multiple options for modulating and / or selecting the protocol flow for a particular memory access.

[0410] The coherence bias flow is implemented in part on two protocol layers of the multi-protocol link 3010 between accelerator 3001 and one of the processor chips 3003: the CAC protocol layer and the MA protocol layer. In one embodiment, the coherence bias flow is enabled by (a) using existing opcodes in the CAC protocol in a new way, (b) adding new opcodes to the existing MA standard, and (c) adding support for the MA protocol to the multi-protocol link 3001 (before the link included only CAC and PCDI). Note that the multi-protocol link is not limited to supporting just CAC and MA. In one embodiment, it is simply required to support at least those protocols.

[0411] As used herein, the "host-biased" flows shown in Figure 30 are a set of flows that funnel all requests, including requests from the accelerator 3001 itself, to the accelerator memory 3005 through the standard coherence controller 3009 in the processor chip 3003 on which the accelerator 3001 is attached. This forces the accelerator 3001 to take a detour to access its own memory, but allows accesses from both the accelerator 3001 and the processor core I / O 3003 to be kept coherent using the processor's standard coherence controller 3009. In one embodiment, the flows issue requests to the processor's coherence controller 3009 over the multi-protocol link using a CAC opcode in the same or similar manner that the processor core 3009 issues requests to the coherence controller 3009. For example, the processor chip's coherence controller 3009 may issue UPI and CAC coherence messages (e.g., snoops) resulting from requests from accelerator 3001 to all peer processor core chips (e.g., 3003) and internal processor agents on behalf of the accelerator, to the same extent as would be the case for requests from processor core 3003. In this manner, coherency is maintained between data accessed by accelerator 3001 and processor core I / O 3003.

[0412] In one embodiment, the coherence controller 3009 also conditionally issues memory access messages to the accelerator's memory controller 3006 over the multi-protocol link 2800. These messages also force the data to be returned to the processor's coherence controller 3009 over the multi-protocol link 2800, as well as messages containing a new opcode that the coherence controller 3009 sends to the memory controller local to these processor dies, allowing the data to be returned directly to an agent internal to the accelerator 3001, instead of being returned to the accelerator 3001 as a CAC response over the multi-protocol link 2800.

[0413] 30 , all requests from processor core 3003 targeting accessor attached memory 3005 are sent directly to processor coherency controller 3009, just as if they were targeting normal host memory 3007. Coherence controller 3009 may apply these standard cache coherence algorithms and send these standard cache coherence messages just as they do for accesses from accelerator 3001 and just as they do for accesses to normal host memory 3007. Coherence controller 3009 also conditionally sends MA commands over multi-protocol link 2800 for this class of request, but in this case the MA flow returns data across multi-protocol link 2800.

[0414] 31 are flows that allow accelerator 3001 to access its local attached memory 3005 without consulting the host processor's cache coherence controller 3007. More specifically, these flows allow accelerator 3001 to access its local attached memory through memory controller 3006 without sending a request over multiprotocol link 2800.

[0415] In "device bias" mode, requests from the processor core I / O 3003 are issued as described above for "host bias," but are completed differently during the MA portion of these flows. With "device bias," processor requests to accessor-attached memory 3005 are completed as if they had been issued as "uncached" requests. This "uncached" convention is employed so that data that is the subject of a device bias flow is never cached in the processor's cache hierarchy. This allows the accelerator 3001 to access device biased data in its memory 3005 without consulting the cache coherence controller 3009 on the processor.

[0416] In one embodiment, support for "uncached" processor core 3003 access flows is implemented with a globally monitored use-once ("GO-UO") response on the processor's CAC bus. This response returns a portion of the data to the processor core 3003 and instructs the processor to use only the value of the data once. This prevents caching of the data and satisfies the requirements of the "uncached" flow. In systems with cores that do not support GO-UO responses, the "uncached" flow may be implemented using a multi-message response sequence on the MA layer of the multiprotocol link 2800 and on the processor core's 3003 CAC bus.

[0417] Specifically, when a processor core is obtained to target a "device bias" page in accelerator 3001, the accelerator sets up some state to block future requests for the target cache line from the accelerator and sends a special "device bias hit" response over the MA layer of multi-protocol link 2800. In response to this MA message, the processor's cache coherence controller 3009 returns data to the requesting processor core 3003, followed immediately by a snoop invalidate message. When processor core 3003 acknowledges the snoop invalidate as complete, cache coherence controller 3009 sends another special MA "device bias back complete" message back to accelerator 3001 over the MA layer of multi-protocol link 2800. This complete message causes accelerator 3001 to clear the aforementioned blocked state.

[0418] FIG. 107 illustrates an embodiment using bias. In one example, the selection of device and host bias flows is driven by a bias tracker data structure that may be maintained as a bias table 10707 in the accelerator memory 3005. This bias table 10707 may be a page-granular structure (i.e., controlled at the granularity of a memory page) that includes one or two bits per accelerator-attached memory page. The bias table 10707 may be implemented in a stolen memory range of the accessor-attached memory 3005, with or without a bias cache 10703 in the accelerator (e.g., that caches frequently / recently used entries of the bias table 10707). Alternatively, the bias table 10707 may be maintained entirely within the accelerator 3001.

[0419] In one embodiment, the bias table entry associated with each access to the accessor attached memory 3005 is accessed before the actual access to the accelerator memory to perform the following operations: Local requests from the accelerator 3001 to find these pages within the device buffer are forwarded directly to the accelerator memory 3005. · Local requests from the accelerator 3001 to find these pages within the host base are forwarded to the processor 3003 as CAC requests on the multi-protocol link 2800. · MA requests from the processor 3003 that find these pages in the device base will complete the request using the "not cached" flow described above. · MA requests from the processor 3003 that find these pages in the host base complete the request like a normal memory read.

[0420] The bias state of a page can be changed by either software-based mechanisms, hardware-assisted software-based mechanisms, or in a limited set of cases, purely hardware-based mechanisms.

[0421] One mechanism for changing the bias state employs API calls (e.g., OpenCL) that in turn invoke the accelerator's device driver, which in turn sends a message (or enqueues a command descriptor) to the accelerator 3001 instructing it to change the bias state, and for some transitions, performs a cache flush operation in the host, which is required for transitions from host bias to device bias, but is not required for the reverse transition.

[0422] In some cases, it is difficult for software to determine when to make a bias transition API call and when to identify a page request bias transition. In such cases, the accelerator may implement a bias transition (implied) mechanism to detect the need for a bias transition and send a message indicating this to its driver. The implied mechanism can be as simple as a mechanism that responds to a bias table lookup that triggers an accelerator access to the host bias page or a host access to the device bias page and signals the event to the accelerator's driver via an interrupt.

[0423] Note that some embodiments may require a second bias state bit to enable a bias transition state value, which allows the system to continue accessing memory pages while those pages are in the process of a bias change (i.e., the cache must be partially flushed and incremental cache pollution due to subsequent requests must be suppressed).

[0424] An exemplary process according to one embodiment is shown in Figure 32. The process may be implemented on the system and processor architectures described herein, but is not limited to any particular system or processor architecture.

[0425] In 3201, a particular set of pages are placed in the device bias. As previously mentioned, this may be accomplished by updating the entries for these pages in the bias table to indicate that the pages are in the device bias (e.g., by setting a bit associated with each page). In one embodiment, once placed in the device bias, the pages are guaranteed not to be cached in the host cache memory. In 3202, pages are allocated from device memory (e.g., software allocates the pages by initiating a driver / API call).

[0426] At 3203, the operands are pushed from the processor core into the allocated page. In one embodiment, this is accomplished in software using an API call to flip the host biased n-operand page (e.g., via an OpenCL API call). There are no data copies or cache flushes required, and the operand data may end up at this stage in some arbitrary location within the host cache hierarchy.

[0427] In 3204, the accelerator device uses the operands to generate a result. For example, it may execute a command to process data directly from its local memory (e.g., 3005, described above). In one embodiment, software flips the operand pages back to the device bias (e.g., updates the bias table) using an OpenCL API. As a result of the API call, a work descriptor is submitted to the device (e.g., via sharing on a dedicated work queue, as described below). The work descriptor may instruct the device to flush the operand pages from the host cache, resulting in a cache flush (e.g., performed using CLFLUSH in the CAC protocol). In one embodiment, the accelerator executes without host-related coherence overhead and dumps the data into the result page.

[0428] At 3205, the results are pulled from the allocated page. For example, in one embodiment, software makes one or more API calls (e.g., via an OpenCL API) to flip the result page to the host bias. This operation may change some bias state, but does not cause any coherence or cache flush operations. The host processor core can then access, cache, and share the result data as needed. Finally, at 3206, the allocated page is freed (e.g., via software).

[0429] A similar process in which operands are released from one or more I / O devices is shown in Figure 33. In 3301, a particular set of pages are placed in the device bias. As previously mentioned, this may be accomplished by updating the entries for those pages in the bias table to indicate that the pages are in the device bias (e.g., by setting a bit associated with each page). In one embodiment, once placed in the device bias, the pages are guaranteed not to be cached in the host cache memory. In 3302, pages are allocated from device memory (e.g., software allocates pages by initiating a driver / API call).

[0430] In 3303, the operand is pushed from the I / O agent to the allocated page. In one embodiment, this is accomplished by software using a non-allocated store to the I / O agent and posting a DMA request to the I / O agent to write the data. In one embodiment, the data is never allocated in the host cache hierarchy and the target page remains in the device cache.

[0431] In 3304, the accelerator device uses the operands to generate a result. For example, software may submit work to the accelerator device, and no page transition is required (i.e., the page remains within the device bias). In one embodiment, the accelerator device executes without host-related coherence overhead, and the accelerator dumps data into a result page.

[0432] In 3305, the I / O agent (e.g., under direction from software) pulls the result from the allocated page. For example, software may post a DMA request to the I / O agent. If the source page remains in the device bias, no page transition is required. In one embodiment, the I / O bridge grabs a non-cacheable copy of the data from the result page using a RdCurr (read current) request.

[0433] In some embodiments, a work queue (WQ) holds "descriptors" submitted by software, an arbiter used to implement quality of service (QoS) and fairness policies, processing engines for processing the descriptors, an address translation and caching interface, and a memory read / write interface. Descriptors define the scope of work to be performed. As shown in FIG. 34, in one embodiment, there are two different types of work queues: dedicated work queue 3400 and shared work queue 3401. Dedicated work queue 3400 stores descriptors for a single application 3413, while shared work queue 3401 stores descriptors submitted by multiple applications 3410-3412. Hardware interface / arbiter 3402 dispatches descriptors from work queues 3400-3401 to accelerator processing engines 3405 according to a specific arbitration policy (e.g., based on the processing requirements of each application 3410-3413 and QoS / fairness policies).

[0434] Figures 108a-108b show memory mapped I / O (MMIO) space registers used with a work queue based implementation. Version register 10807 reports the version of this architecture specification supported by the device.

[0435] General Capabilities Register (GENCAP) 10808 defines the general capabilities of the device, e.g., maximum transfer size, maximum batch size, etc. Table B lists the various parameters and values ​​that may be specified in the GENCAP register. [Table 5]

[0436] In one embodiment, Work Queue Capabilities Register (WQCAP) 10810 defines the capabilities of the Work Queue, such as support for dedicated and / or shared modes of operation, number of engines, number of Work Queues, etc. Table C below lists various parameters and values ​​that may be configured. [Table 6]

[0437] In one embodiment, Operation Capabilities Register (OPCAP) 10811 is a bitmask that defines the operation types supported by the device. Each bit corresponds to an operation type with the same code as the bit position. For example, bit 0 of this register corresponds to the No-op operation (code 0). The bit is set if the operation is supported and cleared if the operation is not supported. [Table 7]

[0438] In one embodiment, General Configuration Register (GENCFG) 10812 defines the Virtual Channel (VC) Steering Tags. See Table E below. [Table 8]

[0439] In one embodiment, General Control Register (GENCTRL) 10813 indicates whether an interrupt was generated for a hardware or software error. See Table F below. [Table 9]

[0440] In one embodiment, the device enable register (ENABLE) stores an error code, an indicator of whether the device is enabled, and a device reset value. See Table G below for further details. [Table 10]

[0441] In one embodiment, the interrupt cause register (INTCAUSE) stores a value indicating the cause of the interrupt, see Table H below. [Table 11]

[0442] In one embodiment, Command Register (CMD) 10814 is used to submit drain WQ, drain PASID, and drain all commands. The abort field indicates whether the requested operation is drain or abort. Before writing to this register, software may ensure that any command has completed before being submitted via this register. Before writing to this register, software may also configure the Command Configuration Register and, if completion recording is requested, the Command Completion Record Address Register.

[0443] The DRAIN ALL command drains or aborts all outstanding descriptors in all WQs and all engines. The DRAIN PASID command drains or aborts descriptors with a specific PASID in all WQs and all engines. The DRAIN WQ command drains or aborts all descriptors in a specific WQ. Depending on the implementation, any DRAIN command may wait for the completion of other descriptors in addition to the descriptor it must wait for.

[0444] If the abort field is 1, software is requesting that the affected descriptors be discarded. However, the hardware may still complete some or all of them. If a descriptor is discarded, no completion record is written and no completion interrupt is generated for that descriptor. Some or all of the other memory accesses may occur.

[0445] Command completion is indicated by generating a completion interrupt (if requested) and by clearing the status field in this register. When completion is signaled, all affected descriptors are either completed or discarded, and no further address translations, memory reads, memory writes, or interrupts are generated due to any affected descriptors. See Table I below. [Table 12]

[0446] In one embodiment, software error status register (SWERROR) 10815 stores several different types of errors, such as an error when submitting a descriptor, an error when translating the completion record address in the descriptor, an error when validating the descriptor if the completion record address valid flag in the descriptor is 0, and an error while processing a descriptor, such as a page fault if the completion record address valid flag in the descriptor is 0. See Table J below. [Table 13] JPEG2024133635000015.jpg124170

[0447] In one embodiment, Hardware Error Status Register (HWERROR) 10816 is similar in format to the Software Error Status Register (see above).

[0448] In one embodiment, the Group Configuration Register (GRPCFG) 10817 stores configuration data for each Work Queue / Engine group (see Figures 36-37). In particular, the Group Configuration Table is an array of registers in BAR0 that controls the mapping of Work Queues to engines. There are as many groups as there are engines, but software may configure the number of groups needed. Each active group contains one or more Work Queues and one or more Engines. Any unused group must have both the WQ and Engine fields equal to 0. Descriptors submitted to any WQ in a group may be processed by any engine in the group. Each active Work Queue must be in a single group. An active Work Queue is one whose WQ Size field in the corresponding WQCFG register is non-zero. Any engine not in a group is inactive.

[0449] Each GRPCFG register 10817 may be divided into three sub-registers, each of which is one or more 32-bit words (see Tables K-M). These registers may be read-only while the device is enabled. They are also read-only if the Work Queue Configuration Supported field in WQCAP is 0.

[0450] The offsets of the sub-registers in BAR0, for each group G, 0≦G<number of engines, are as follows in one embodiment: [Table 14] [Table 15] [Table 16]

[0451] In one embodiment, Work Queue Configuration Register (WQCFG) 10818 stores data that defines the operation of each Work Queue. The WQ Configuration Table is an array of 16-byte registers in BAR0. The number of WQ Configuration Registers matches the number of WQ fields in the WQCAP.

[0452] Each 16-byte WQCFG register is divided into four 32-bit sub-registers and may be read or written using aligned 64-bit read or write operations.

[0453] While the device is enabled or if the Work Queue Configuration Supported field in WQCAP is 0, each WQCFG-A sub-register is read-only.

[0454] Each WQCFG-B can be written at any time unless the Work Queue Configuration Supported field of the WQCAP is 0. If the WQ Threshold field contains a value greater than the WQ size when WQ is enabled, WQ is not enabled and the WQ Error Code is set to 4. If the WQ Threshold field is written with a value greater than the WQ size while WQ is enabled, WQ is disabled and the WQ Error Code is set to 4.

[0455] While WQ is enabled, each WQCFG-C subregister is read-only. It may be written before or at the same time as setting WQ Enable to 1. If the Work Queue Configuration Support field of WQCAP is 0, the following fields, WQ Mode, WQ Fault on Block Enable, and WQ Priority, are always read-only. Even if the Work Queue Configuration Support field of WQCAP is 0, the following fields of WQCFG-C, WQ PASID, and WQ U / S, are writable if WQ is not enabled.

[0456] Each WQCFG-D subregister is writable at any time. However, if the device is not enabled, it is an error to set WQ Enable to 1.

[0457] Both the WQ Enable and WQ Error Code fields are cleared if WQ Enable is set to 1. Then, either WQ Enable or WQ Error Code is set to a non-zero value that indicates whether the WQ was successfully enabled or not.

[0458] The sum of the WQ size fields of all WQCFG registers cannot be greater than the sum of the WQ size fields in GENCAP. This constraint is checked when the device is enabled. WQs with a WQ size field of 0 cannot be enabled, and all other fields in such WQCFG registers are ignored. The WQ size field is read-only while the device is enabled. See Table N for data related to each of the subregisters. [Table 17] JPEG2024133635000020.jpg191170

[0459] In one embodiment, the Work Queue Occupancy Interrupt Control registers 10819 (one per Work Queue (WQ)) allow software to request an interrupt if the occupancy of a Work Queue drops to a certain threshold. If the WQ Occupancy Interrupt Enable for a WQ is 1 and the current WQ occupancy is at or below the WQ occupancy limit, the following actions may be performed: 1. The WQ Occupancy Interrupt Enable field is cleared. 2. Bit 3 of the Interrupt Reason Register is set to 1. 3. If bit 3 of the Interrupt Reason Register was 0 before stage 2, an interrupt is generated using MSI-X table entry 0. 4. If the register is written with Enable = 1 and Limit >= current WQ occupancy, an interrupt is generated immediately. As a result, an interrupt is always generated immediately if the register is written with Enable = 1 and Limit >= WQ Size. [Table 18]

[0460] In one embodiment, the Work Queue Status Registers (one per WQ) 10820 define the current number of entries in each WQ. This number can change any time descriptors are submitted to or dispatched from the queue, so it cannot be relied upon to determine whether a WQ has room.

[0461] In one embodiment, MSI-X Entry 10821 stores MSI-X table data. The offset and number of entries are in the MSI-X function. The suggested number of entries is the number of WQs plus two.

[0462] In one embodiment, the MSI-X raw bit array 10822 stores the offset and number of entries in the MSI-X function.

[0463] In one embodiment, the interrupt message storage entry 10823 stores interrupt messages in a table structure. The format of this table is similar to the format of the MSI-X table specified in PCIe, but the size is not limited to 2048 entries. However, in some embodiments, the size of this table may vary between different DSA implementations and may be less than 2048 entries. In one embodiment, the number of entries is in the interrupt message storage size field of the general capabilities register. If the interrupt message storage support capability is 0, this table is not present. For a DSA to support a large number of virtual machines or containers, the size of the supported table needs to be quite large.

[0464] In one embodiment, the format of each entry in the IMS is described in Table P below. [Table 19]

[0465] Figure 35 shows one embodiment of a data streaming accelerator (DSA) device having multiple work queues 3511-3512 that receive descriptors submitted via an I / O fabric interface 3501 (e.g., such as the multi-protocol link 2800 described above). The DSA uses the I / O fabric interface 3501 to receive downstream work requests from clients (such as processor cores, peer input / output (IO) agents (such as network interface controllers (NICs)) and / or software chain offload requests) and for upstream read, write, and address translation operations. The illustrated embodiment includes an arbiter 3513 that arbitrates between the work queues and dispatches work descriptors to one of multiple engines 3550. The operation of the arbiter 3513 and the work queues 3511-3512 may be configured through work queue configuration registers 3500. For example, the arbiter 3513 may be configured to implement various QoS and / or fairness policies for dispatching descriptors from each of the work queues 3511-1012 to each of the engines 3550.

[0466] In one embodiment, some of the descriptors queued in work queues 3511-3512 are batch descriptors 3515 that contain / identify a batch of work descriptors. Arbiter 3513 forwards the batch descriptors to batch processing unit 3516, which processes the batch descriptors by reading an array of descriptors 3518 from memory using addresses translated through translation cache 3520 (and potentially other address translation services on the processor). Once the physical addresses are identified, data read / write circuitry 3540 reads the batch of descriptors from memory.

[0467] The second arbiter 3519 arbitrates between batches of work descriptors 3518 provided by the batch processing unit 3516 and individual work descriptors 3514 obtained from the work queues 3511-3512, and outputs the work descriptors to the work descriptor processing unit 3530. In one embodiment, the work descriptor processing unit 3530 has stages that read memory (via data R / W unit 3540), perform requested operations on the data, generate output data, and write (via data R / W unit 3540) the output data, completion records, and interrupt messages.

[0468] In one embodiment, work queue configuration allows software to configure each WQ (via WQ configuration registers 3500) as either a shared work queue (SWQ) that receives descriptors using the non-posted ENQCMD / S instruction, or a dedicated work queue (DWQ) that receives descriptors using the posted MOVDIR64B instruction. As already discussed above with respect to FIG. 34, a DWQ may handle work descriptors and batch descriptors submitted from a single application, while an SWQ may be shared among multiple applications. WQ configuration registers 3500 also allow software to control which WQs 3511-3512 feed which accelerator engines 3550, and the priority associated with the WQs 3511-3512 feeding each engine. For example, an ordered set of priorities may be defined (e.g., high, medium, low: 1, 2, 3, etc.), and descriptors may generally be dispatched from a higher priority work queue before, or more frequently than, a lower priority work queue. For example, with two work queues identified as high and low priority, for every 10 descriptors dispatched, 8 of the 10 descriptors may be dispatched from the high priority work queue, while 2 of the 10 descriptors are dispatched from the low priority work queue. Various other techniques may be used to achieve different priority levels among work queues 3511-3512.

[0469] In one embodiment, the Data Streaming Accelerator (DSA) is software compatible with PCI Express configuration mechanisms and implements PCI header and expansion space within its configuration mapping register set. The configuration registers can be programmed through CFC / CF8 or MMCFG from the root complex. Similarly, all internal registers may also be accessible through the JTAG or SM bus interface.

[0470] In one embodiment, the DSA device uses memory-mapped registers to control its operation. Capability, configuration, and work submission registers (portals) are accessible through the MMIO region defined by the BAR0, BAR2, and BAR4 registers (described below). Each portal may reside on a separate 4K page so that they can be independently mapped to different address spaces (clients) using the processor page tables.

[0471] As mentioned above, software specifies work to a DSA through descriptors. Descriptors identify the type of operation to the DSA to perform, such as addresses of data and status buffers, immediate operands, and completion attributes (additional details and details regarding the format of descriptors are provided below). Completion attributes specify the address to write the completion record to and the information needed to generate an optional completion interrupt.

[0472] In one embodiment, the DSA avoids maintaining client-specific state on the device. All information for processing a descriptor is contained in the descriptor itself. This improves its sharing capabilities between user-mode applications, as well as between different virtual machines (machine containers) within a virtualized system.

[0473] A descriptor may contain an operation and associated parameters (called a work descriptor), or a descriptor may contain the address of an array of work descriptors (called a batch descriptor). Software prepares descriptors in memory and submits them to the device's work queue (WQ) 3511-3512. Descriptors are submitted to the device using the MOVDIR64B, ENQCMD, or ENQCMDS instructions, depending on the mode of the WQ and the privilege level of the client.

[0474] Each WQ 3511-3512 has a fixed number of slots, so that under heavy loads it can fill up. In one embodiment, the device provides the necessary feedback to help software implement flow control. The device dispatches descriptors from the work queues 3511-3512 and submits them to the engine for further processing. If the engine 3550 completes a descriptor and encounters a specific fault or error that results in an abort, it notifies the host software by either writing a completion record in host memory or issuing an interrupt, or both.

[0475] In one embodiment, each work queue is accessible through multiple registers, each in a separate 4KB page in the device MMIO space. For each WQ, one work submission register is called the "non-privileged portal" and is mapped into user space for use by user-mode clients. Another work submission register is called the "privileged portal" and is used by kernel-mode drivers. The remaining one is the guest portal and is used by kernel-mode clients within the virtual machine.

[0476] As previously mentioned, each Work Queue 3511-3512 can be configured to run in one of two modes: dedicated or shared. The DSA exposes a capability bit in the Work Queue Capability Register to indicate support for dedicated and shared modes. The DSA also exposes control to the Work Queue Configuration Register 3500 to configure each WQ to operate in one of the modes. The mode of a WQ can only be changed while the WQ is disabled, i.e., (WQCFG Enable=0). Additional details of the WQ Capability Register and WQ Configuration Register are provided below.

[0477] In one embodiment, in shared mode, DSA clients submit descriptors to a work queue using the ENQCMD or ENQCMDS command. ENQCMD and ENQCMDS use 64-byte non-posted writes and wait for a response from the device before completing. The DSA returns (e.g., to the requesting client / application) "success" if there is space in the work queue, or "retry" if the work queue is full. The ENQCMD and ENQCMDS commands may return the status of the command submission with a zero flag (0 indicates success, 1 indicates retry). Using the ENQCMD and ENQCMDS commands, multiple clients can directly and simultaneously submit descriptors to the same work queue. The device provides this feedback so clients can tell whether their descriptors were received or not.

[0478] In shared mode, the DSA may reserve some SWQ capacity for submissions through privileged portals for kernel-mode clients. Work submissions through non-privileged portals are accepted until the number of descriptors in the SWQ reaches the threshold configured for the SWQ. Work submissions through privileged portals are accepted until the SWQ is full. Work submissions through guest portals are limited by the threshold in the same way as non-privileged portals.

[0479] If the ENQCMD or ENQCMDS command returns "success," the descriptor is received by the device and queued for processing. If the command returns "retry," the software can either attempt to resubmit the descriptor to the SWQ, or, if it is a user-mode client using a non-privileged portal, can request the kernel-mode driver to submit the descriptor on behalf of the user-mode client using the privileged portal. This helps avoid denial of service and provides forward progress assurance. Alternatively, software may use other methods (e.g., using the CPU to perform work) if the SWQ becomes full.

[0480] Clients / applications are identified by the device using a 20-bit ID called the Process Address Space ID (PASID). The PASID is used by the device to look up addresses in the device TLB 1722 and to send address translation or page requests to the IOMMU 1710 (e.g., over the multi-protocol link 2800). In shared mode, the PASID to be used with each descriptor is contained in the descriptor's PASID field. In one embodiment, ENQCMD copies the current thread's PASID from a specific register (e.g., the PASID MSR) into the descriptor, while ENQCMDS allows supervisor mode software to copy the PASID into a descriptor.

[0481] In "dedicated" mode, a DSA client may submit descriptors to the device's work queue using the MOVDIR64B instruction. MOVDIR64B uses a 64-byte posted write, and the instruction completes faster due to the posted nature of the write operation. For dedicated work queues, the DSA may expose the total number of slots in the work queue and rely on software to provide flow control. Software is responsible for tracking the number of descriptors submitted and completed to detect work queue full conditions. If software erroneously submits a descriptor to a dedicated WQ when there is no room in the work queue, the descriptor may be dropped and an error may be logged (e.g., in a software error register).

[0482] The MOVDIR64B instruction does not write the PASID like the ENQCMD or ENQCMDS instructions do, so the PASID field in a descriptor cannot be used in dedicated mode. The DSA may ignore the PASID field in descriptors submitted to a dedicated work queue and instead use the WQ PASID field in WQ configuration register 3500 for address translation. In one embodiment, the WQ PASID field is set by the DSA driver when configuring a work queue in dedicated mode.

[0483] While dedicated mode does not share a single DWQ by multiple clients / applications, a DSA device can be configured with multiple DWQs, each of which can be independently assigned to a client. Additionally, DWQs can be configured to have the same or different QoS levels for different performance levels provided for different clients / applications.

[0484] In one embodiment, the Data Streaming Accelerator (DSA) includes two or more engines 3550 that process descriptors submitted to work queues 3511-1012. One embodiment of the DSA architecture includes four engines, numbered 0 through 3. Engines 0 and 1 can each utilize up to the full bandwidth of the device (e.g., 30 GB / s for reads and 30 GB / s for writes). Of course, the combined bandwidth for all engines is also limited to the maximum bandwidth available to the device.

[0485] In one embodiment, software configures WQs 3511-3512 and engines 3550 into groups using group configuration registers. Each group contains one or more WQs and one or more engines. The DSA may use any engine in a group to process descriptors posted to any WQ in the group, and each WQ and each engine may be in only one group. The number of groups may be the same as the number of engines, so each engine can be in a separate group, but if any group contains more than one engine, not all groups need to be used.

[0486] While the DSA architecture allows for great flexibility when configuring work queues, groups, and engines, the hardware may be narrowly designed for use with a particular configuration. Engines 0 and 1 may be configured in one of two different ways, depending on the software requirements. One recommended configuration is to place both Engines 0 and 1 in the same group. The hardware will use either engine to process descriptors from any work queue in the group. In this configuration, if one engine has a stall due to high-latency memory address translation or a page fault, the other engine can continue operating, maximizing overall device throughput.

[0487] Figure 36 shows two work queues 3621-3622 and 3623-3624 in each group 3611 and 3612, respectively, although there may be any number up to the maximum number of WQs supported. The WQs within a group may be shared WQs with different priorities, one shared WQ and another dedicated WQ, or multiple dedicated WQs with the same or different priorities. In the example shown, group 3611 is served by engines 0 and 1 3601, and group 3612 is served by engines 2 and 3 3602.

[0488] As shown in Figure 37, another configuration using Engine 0 3700 and Engine 1 3701 places them in separate groups 3710 and 3711, respectively. Similarly, Group 2 3712 is assigned to Engine 2 3702 and Group 3 is assigned to Engine 3 3703. Furthermore, Group 0 3710 is comprised of two Work Queues 3721 and 3722, Group 1 3711 is comprised of Work Queue 3723, Work Queue 2 3712 is comprised of Work Queue 3724, and Group 3 3713 is comprised of Work Queue 3725.

[0489] Software may select this configuration when it wants to reduce the chance of latency-sensitive operations becoming blocked behind other operations. In this configuration, the software submits latency-sensitive operations to work queue 3723 connected to engine 1 3702 and other operations to work queues 3721-3722 connected to engine 0 3700.

[0490] Engine 2 3702 and Engine 3 3703 may be used to write to high-bandwidth non-volatile memory, such as phase-change memory. The bandwidth capabilities of these engines may be sized to match the expected write bandwidth of this type of memory. For this use, bits 2 and 3 of the Engine Configuration Register should be set to 1, indicating that Virtual Channel 1 (VC1) should be used for traffic from these engines.

[0491] In platforms without high-bandwidth non-volatile memory (e.g., phase-change memory), or if DSA devices are not used to write to this type of memory, engines 2 and 3 may be unused. However, software can make use of them as an additional low-latency path, provided the submitted operations can tolerate the limited bandwidth.

[0492] As each descriptor arrives at the head of the work queue, it may be removed by scheduler / arbiter 3513 and forwarded to one of the engines in the group. For batch descriptors 3515 that point to work descriptors 3518 in memory, the engine fetches an array of work descriptors from memory (i.e., using batch processing unit 3516).

[0493] In one embodiment, for each work descriptor 3514, the engine 3550 prefetches the translation for the completion record address and passes the operation to the work descriptor processing unit 3530. The work descriptor processing unit 3530 uses the device TLB 1722 and IOMMU 1710 for source and destination address translation, reads the source data, performs the specified operation, and writes the destination data back to memory. When the operation completes, the engine writes a completion record to the pre-translated completion address, if requested by the work descriptor, and generates an interrupt.

[0494] In one embodiment, multiple work queues in a DSA may be used to provide multiple levels of quality of service (QoS). The priority of each WQ may be specified in WQ configuration registers 3500. The priority of a WQ is relative to other WQs in the same group (e.g., priority levels for WQs that exist alone in a group are meaningless). Work queues within a group may have the same or different priorities. However, since a single SWQ will service the same application, there is no point in configuring multiple shared WQs with the same priority in the same group. Scheduler / arbiter 3513 dispatches work descriptors from work queues 3511-3512 to engines 3550 according to these priorities.

[0495] 38 illustrates one embodiment of a descriptor 1300 that includes an operation field 3801 that specifies the operation to be performed, a number of flags 3802, a processing address space identifier (PASID) field 3803, a completion record address field 3804, a source address field 3805, a destination address field 3806, a completion interrupt field 3807, a transfer size field 3808, and (potentially) one or more operation-specific fields 3809. In one embodiment, there are three flags: completion record address valid, requested completion record, and requested completion interrupt.

[0496] Common fields include both trusted and non-trusted fields. Trusted fields are always trusted by the DSA device because they are entered by the CPU on the host or by privileged (ring 0 or VMM) software. Non-trusted fields are supplied directly by the DSA client.

[0497] In one embodiment, the trusted field includes a PASID field 3803, a reserved field 3811, and a U / S (user / supervisor) field 3810 (i.e., 4 bytes starting at an offset of 0). If the descriptor is submitted using an ENQCMD instruction, these fields in the source descriptor may be ignored. The value contained in the MSR (e.g., PASID MSR) may be placed in these fields before the descriptor is sent to the device.

[0498] In one embodiment, these fields in the source descriptor are initialized by software when the descriptor is submitted using the ENQCMDS instruction: If the PCI Express PASID feature is not enabled, U / S field 3810 is set to 1 and PASID field 3803 is set to 0.

[0499] If the descriptor is submitted using the MOVDIR64B instruction, these fields in the descriptor may be ignored; the device uses the WQ U / S and WQ PASID fields of the WQ Config register 3500 instead.

[0500] These fields may be ignored for any descriptor in the batch. The corresponding fields in the batch descriptor 3515 are used for each descriptor 3518 in the batch. Table Q provides a description and bit position for each of these trusted fields. [Table 20]

[0501] Table R below lists the operations performed in one embodiment according to the operation field 3801 of the descriptor. [Table 21]

[0502] Table S below lists the flags used in one embodiment of the descriptor. [Table 22] JPEG2024133635000026.jpg159170

[0503] In one embodiment, completion record address 3804 specifies the address of the completion record. A completion record may be 32 bytes, and the completion record address is aligned on a 32-byte boundary. If the completion record address valid flag is 0, this field is reserved. If the requested completion record flag is 1, the completion record is written to this address upon completion of the operation. If the requested completion record is 0, the completion record is written to this address only if there is a page fault or error.

[0504] For any operation that produces a result such as a compare, the completion record address valid and request completion record flags should both be 1 and the completion record address should be valid.

[0505] For any transaction using a virtual address, the completion record address should be valid whether the requested completion record flag is set or not, so that the completion record can be written in the event of a page fault or error.

[0506] For best results, this field should be valid in all descriptors, as it allows the device to report errors to the software that submitted the descriptor. If this flag is 0 and an unexpected error occurs, the error is reported in the SWERROR register and the software that submitted the request may not be notified of the error.

[0507] The completion record address field 3804 ignores the descriptor in the batch if the completion queue enable flag is set in the batch descriptor, and the completion queue address in the batch descriptor is used instead.

[0508] In one embodiment, for operations that read data from memory, the source address field 3805 specifies the address of the source data. There are no alignment requirements for the source address. For operations that write data to memory, the destination address field 3806 specifies the address of the destination buffer. There are no alignment requirements for the destination address. For some operation types, this field is used as the address of a second source buffer.

[0509] In one embodiment, the transfer size field 3808 indicates the number of bytes to be read from the source address to perform the operation. The maximum value of this field may be 2-1, but the maximum possible transfer size may be smaller and must be determined from the maximum transfer size field in the general capability register. The transfer size should not be zero. For many operation types, there are no alignment requirements for the transfer size; exceptions are noted in the operation descriptions.

[0510] In one embodiment, if the use interrupt message storage flag is 1, the completion interrupt handling field 3807 specifies the interrupt message storage entry used to generate a completion interrupt. The value of this field should be less than the value of the interrupt message storage size field in GENCAP. In one embodiment, the completion interrupt handling field 3807 is reserved under any of the following conditions: the use interrupt message storage flag is 0, the request completion interrupt flag is 0, the U / S bit is 0, the interrupt message storage supported field of the general capabilities register is 0, or the descriptor is being submitted through a guest portal.

[0511] As shown in Figure 39, one embodiment of a completion record 3900 is a 32-byte structure in memory that the DSA writes to when an operation completes or encounters an error. The completion record address should be 32-byte aligned.

[0512] This section describes the fields in the completion record that are common to many operation types. Each operation type description includes a completion record diagram if the format differs from this. Additional operation-specific fields are described further below. Completion record 3900 will always be 32 bytes, even if none of the fields are required. Completion record 3900 contains enough information to continue the operation if it partially completes due to a page fault.

[0513] A completion record may be implemented as a 32-byte aligned structure in memory (identified by completion record address 3804 of descriptor 3800). Completion record 3900 includes a completion status field 3904 that indicates whether the operation completed. If the operation completed successfully, the completion record may include the results of the operation, if any, depending on the type of operation. If the operation did not complete successfully, the completion record includes failure or error information.

[0514] In one embodiment, status field 3904 reports the completion status of the descriptor. Software should initialize this field to 0 so that it can detect when the completion record has been written. [Table 23]

[0515] Table T above provides various status codes and is relevant to the description of one embodiment.

[0516] Table U below shows the fault codes 3903 available in one embodiment, which include a first bit indicating whether the faulting address was read or written, and a second bit indicating whether the faulting access was a user mode or supervisor mode access. [Table 24]

[0517] In one embodiment, if this completion record 3900 was for a descriptor submitted as part of a batch, then index field 3902 contains the index within the batch of the descriptor that generated this completion record. For batch descriptors, this field may be 0xff. For other descriptors that are not part of a batch, this field may be reserved.

[0518] In one embodiment, if an operation partially completes due to a page fault, the bytes completed field 3901 contains the number of source bytes processed before the fault occurred. All of the source bytes represented by this count have been completely processed, and the results are written to the destination address as needed according to the operation type. For some operation types, this field may be used if the operation stopped before completion for some reason other than a fault. If the operation completed completely, this field may be set to 0.

[0519] For operation types where the output size is not readily determinable from this value, the completion record also includes the number of bytes written to the destination address.

[0520] If the operation partially completed due to a page fault, this field contains the address that caused the fault. As a general rule, all descriptors should have a valid recorded completion address 3804, and the recorded completion address valid flag should be 1. Some exceptions to this rule are described below.

[0521] In one embodiment, the first byte of the completion record is the status byte. All status values ​​written by the device are non-zero. Software should initialize the status field of the completion record to 0 before submitting the descriptor to allow the device to indicate when it has written to the completion record. Initializing the completion record also ensures that it is mapped, so the device will not encounter a page fault when accessing it.

[0522] The Request Completion Record flag indicates to the device that it should write a completion record even if the operation completed successfully. If this flag is not set, the device will only write a completion record if there is an error.

[0523] Descriptor completion can be detected by software using any of the following methods.

[0524] 1. Poll the completion record and wait for the status field to be non-zero.

[0525] 2. Use the UMONITOR / UMWAIT instruction (as described herein) to the completion record address to block until written or until timeout. Software should then check if the status field is non-zero to determine if the operation is complete.

[0526] 3. For kernel mode descriptors, request an interrupt when the operation is complete.

[0527] 4. If the descriptor is in a batch, set the fence flag in subsequent descriptors in the same batch. Completion of a descriptor with a fence or any subsequent descriptor in the same batch indicates completion of all descriptors preceding the fence.

[0528] 5. If the descriptor is in a batch, completion of the batch descriptor that initialized the batch indicates completion of all descriptors in the batch.

[0529] 6. Issue a drain descriptor or drain command and wait for it to complete.

[0530] If the completion status indicates partial completion due to a page fault, the completion record indicates how much of the processing was completed (if any) before the fault was triggered and the virtual address at which the fault was triggered. Software may choose to revert the fault (by touching the faulting address from the processor) and resubmit the remainder of the work in a new descriptor, or complete the remainder of the work in software. Faults on descriptor lists and completion record addresses are handled differently and are described in more detail below.

[0531] In one embodiment of the DSA, only message signaling interrupts are supported. The DSA provides two types of interrupt message storage: (a) MSI-X tables, enumerated through MSI-X functions, that store interrupt messages used by host drivers, and (b) device-specific Interrupt Message Storage (IMS) tables that store interrupt messages used by guest drivers.

[0532] In one embodiment, interrupts can be generated for three types of events: (1) completion of a kernel mode descriptor, (2) completion of a drain or abort command, and (3) an error posted in a software or hardware error register. There is a separate interrupt enable for each type of event. Interrupts due to error and abort / drain command completion are generated using entry 0 in the MSI-X table. The interrupt reason register may be read by software to determine the reason for the interrupt.

[0533] For kernel mode descriptor completions (e.g., descriptors with a U / S field of 1), the interrupt message used depends on how the descriptor was submitted and the use interrupt message storage flag in the descriptor.

[0534] The completion interrupt message for a kernel-mode descriptor submitted through a privileged portal is typically an entry in an MSI-X table, determined by the portal address. However, if the interrupt message storage supported field in GENCAP is 1, a descriptor submitted through a privileged portal may override this behavior by setting the use interrupt message storage flag in the descriptor. In this case, the completion interrupt handling field in the descriptor is used as an index into the interrupt message storage.

[0535] The completion interrupt message for a kernel mode descriptor submitted through a guest portal is an entry in the interrupt message storage, determined by the portal address.

[0536] Interrupts generated by the DSA are handled through interrupt remapping and posting hardware, as configured by the kernel or VMM software. [Table 25]

[0537] As mentioned above, DSA supports submitting multiple descriptors at a time. A batch descriptor contains the address of an array of work descriptors in host memory and the number of elements in that array. The array of work descriptors is called a "batch." The use of batch descriptors allows a DSA client to submit multiple work descriptors with a single ENQCMD, ENQCMDS, or MOVDIR64B instruction, potentially improving overall throughput. DSA enforces a limit on the number of work descriptors in a batch. The limit is indicated in the maximum batch size field in the general capabilities register.

[0538] Batch descriptors are submitted to a work queue in the same way as other work descriptors. When a batch descriptor is processed by a device, the device reads the array of work descriptors from memory and then processes each of the work descriptors. The work descriptors are not necessarily processed in order.

[0539] The PASID 3803 and U / S flag in the batch descriptor are used for all descriptors in the batch. The PASID and U / S fields 3810 in descriptors within the batch are ignored. Each work descriptor in the batch can specify a completion record address 3804, just like a directly submitted work descriptor. Alternatively, the batch descriptor can specify a "completion queue" address where completion records for all work descriptors from the batch are written by the device. In this case, the completion record address field 3804 in descriptors within the batch is ignored. The completion queue should be one entry larger than the total number of descriptors, so there is room for completion records and batch descriptors for all descriptors in the batch. Completion records are generated in the order the descriptors are completed, which does not have to be the same order they appear in the descriptor array. Each completion record contains the index of the descriptor within the batch that generated it. An index of 0xff is used for the batch descriptor itself. An index of 0 is used for directly submitted descriptors other than batch descriptors. Some descriptors in a batch may not generate completion records if they did not request them and they complete successfully. In this case, the number of completion records written to the completion queue may be less than the number of descriptors in the batch. The completion record for the batch descriptor (if requested) is written to the completion queue after the completion records for all descriptors in the batch.

[0540] A batch descriptor does not specify a completion queue; the completion record for a batch descriptor (if requested) is written to its own completion record address after all descriptors in the batch have completed. The completion record for a batch descriptor includes an indication of whether any of the descriptors in the batch completed with a status other than successful. This allows software to examine only the completion record for a batch descriptor in the normal case when all descriptors in the batch have completed successfully.

[0541] Completion interrupts may be requested by one or more work descriptors in a batch, as needed. The completion record for a batch descriptor (if requested) is written after the completion records and completion interrupts for all descriptors in the batch. The completion interrupt for a batch descriptor (if requested) is generated after the completion record for the batch descriptor, just like for any other descriptor.

[0542] A batch descriptor does not have to be contained in a batch. Nested or chained descriptor arrays are not supported.

[0543] By default, DSA does not guarantee any ordering while executing work descriptors. Descriptors can be dispatched and completed in any order the device sees fit to maximize throughput. Therefore, if ordering is required, software must explicitly order them. For example, software can submit a descriptor, wait for a completion record or interrupt from the descriptor to ensure completion, and then submit the next descriptor.

[0544] Software can also specify an ordering for descriptors within a batch defined by a batch descriptor. Each work descriptor has a fence flag. When set, the fence ensures that processing of a descriptor does not begin until the previous descriptor in the same batch has completed. This allows a descriptor with a fence to consume data produced by a previous descriptor in the same batch.

[0545] A descriptor completes after all writes generated by the operation have become globally observable, after the destination has read back if requested, after the write to the completion record has become globally observable if required, and after the generation of a completion interrupt if requested.

[0546] If any descriptor in the batch completes with a status other than successful, for example, if it partially completed due to a page fault, the subsequent descriptor with a fence flag equal to 1 and any subsequent descriptors in the batch are discarded. The completion record for the batch descriptor used to submit the batch indicates how many descriptors completed. Any descriptors that partially completed and generated a completion record are counted as completed. Only discarded descriptors are considered not completed.

[0547] Fences also ensure ordering for completion records and interrupts. For example, a No-op descriptor with a set fence and a requesting completion interrupt will cause the interrupt generated after all preceding descriptors in the batch have completed (and their completion records written, if required). Completion record writes are always ordered behind data writes generated by the same work descriptor, and completion interrupts (if requested) are always ordered behind completion record writes for the same work descriptor.

[0548] A drain is a descriptor that allows a client to wait for all descriptors belonging to its own PASID to complete. It can be used as a fence operation for an entire PASID. A drain operation completes when all previous descriptors with that PASID have completed. Drain descriptors can be used by software to request a single completion record or interrupt for the completion of all its descriptors. Drains are normal descriptors submitted to the normal work queue. Drain descriptors may be included in a batch. (A fence flag may be used within a batch to wait for previous descriptors in the batch to complete.)

[0549] Software must ensure that no descriptors with a particular PASID are submitted to the device after the drain descriptor is submitted and before it completes. If additional descriptors are submitted, it is unspecified whether the drain operation also waits for the additional descriptors to complete. This could result in the drain operation taking a long time. Even if the device does not wait for the additional descriptors to complete, some of the additional descriptors may complete before the drain operation completes. Thus, draining differs from fencing because a fence ensures that no subsequent operations start until all previous operations have completed.

[0550] In one embodiment, abort / drain commands are submitted by privileged software (OS kernel or VMM) by writing to the abort / drain register. Upon receiving one of these commands, the DSA waits for the completion of a particular descriptor (described below). When the command completes, the software can be sure that there are no more descriptors of a particular category outstanding on the device.

[0551] In one embodiment, there are three types of drain commands: drain all, drain PASID, and drain WQ. Each command has an abort flag that indicates the device may discard any outstanding descriptors rather than processing them to completion.

[0552] The drain all command waits for all descriptors submitted before the drain all command to complete. Descriptors submitted after the drain all command may be in progress when the drain all command completes. The device may start work on a new descriptor while the drain all command is waiting for previous descriptors to complete.

[0553] The drain PASID command waits for all descriptors associated with a particular PASID. When the drain PASID command completes, there are no more descriptors for the PASID in the device. Software may ensure that no descriptors with a particular PASID are submitted to the device after the drain PASID command is submitted and before it completes; otherwise, behavior is undefined.

[0554] The drain WQ command waits for all descriptors submitted to a particular work queue, and software can ensure that no descriptors are submitted to the WQ after the drain WQ command is submitted and before it completes.

[0555] When an application or VM using a DSA is suspended, it may have outstanding descriptors submitted to the DSA. This work must be completed so the client is in a coherent state that can be resumed later. The drain PASID and drain all commands are used by the OS or VMM to queue any outstanding descriptors. The drain PASID command is used for applications or VMs that were using a single PASID. The drain all command is used for VMs that use multiple PASIDs.

[0556] When an application using a DSA exits or is terminated by the operating system (OS), the OS must ensure that there are no outstanding descriptors before it can free or reclaim the address space, allocated memory, and PASID. To dispose of any outstanding descriptors, the OS uses the DRAIN PASID command with the PASID of the client being terminated, and the abort flag set to 1. Upon receiving this command, the DSA discards all descriptors belonging to the particular PASID without further processing.

[0557] One embodiment of DSA provides a mechanism for specifying quality of service for dispatching work from multiple WQs. DSA allows software to divide the total WQ space into multiple WQs. Each WQ can be assigned a different priority for dispatching work. In one embodiment, DSA scheduler / arbiter 3513 dispatches work from WQs such that higher priority WQs are serviced more than lower priority WQs. However, DSA ensures that higher priority WQs do not starve lower priority WQs. As previously mentioned, various prioritization schemes may be adopted based on implementation requirements.

[0558] In one embodiment, a WQ configuration register table is used to configure WQs. Software can configure the number of active WQs to match the number of desired QoS levels. Software configures each WQ by programming the WQ size and some additional parameters into the WQ configuration register table. This effectively divides the overall WQ space into the desired number of WQs. Unused WQs have a size of 0.

[0559] Errors are broadly divided into two categories: 1) related errors that occur when processing a descriptor for a particular PASID, and 2) unrelated errors that are broad in nature and not specific to a PASID. DSA attempts to prevent errors from one PASID from stalling or affecting other PASIDs whenever possible. PASID-specific errors are reported in the completion record for each descriptor, except when the error is in the completion record itself (e.g., a page fault on the completion record address).

[0560] Errors in the descriptor submission or on recording the completion of the descriptor may be reported to the host driver through the software error register (SWERROR). Hardware errors may be reported through the hardware error register (HWERROR).

[0561] In one embodiment of the DSA, when the enable bit in the device enable register is set to 1, the following checks are performed: Bus master enable is 1. · A combination of PASID, ATS and PRS functions is valid (see Table 6-3, Section 6.1.3). The sum of the WQ size fields of all WQCFG registers is not greater than the total WQ size. For each GRPCFG register, the WQ and engine fields are either both 0 or both non-zero. · Each WQ with a non-zero size field in the WQCFG register is in one group. · Each WQ whose size field in the WQCFG register is zero is not in any group. Each engine can only be in one group.

[0562] If any of these checks fail, the device is not enabled and an error code is recorded in the error code field of the device enable register. These checks may be performed in any order; therefore, an indication of one type of error does not imply the presence of other errors. The same configuration error may result in different error codes at different times or in different versions of the device. If none of the checks fail, the device is enabled and the enable field is set to 1.

[0563] The device performs the following checks when the WQ enable bit in the WQCFG register is set to 1: The device is enabled (i.e., the enable field in the Device Enable register is 1). The WQ size field is non-zero. · The WQ threshold is not larger than the WQ size field. The WQMode field selects the supported mode, i.e. if the SharedModeSupported field in the WQCAP is 0 then WQMode is 1, or if the DedicatedModeSupported field in the WQCAP is 0 then WQMode is 0. If both the SharedModeSupported and DedicatedModeSupported fields are 1 then either one of the WQMode values ​​is allowed. ·If the Block Support for Fault bit in GENCAP is 0, the Block Enable for WQ Fault field is 0.

[0564] If any of these checks fail, the WQ is not enabled and an error code is recorded in the WQ error code field of WQ config register 3500. These checks may be performed in any order; therefore, an indication of one type of error does not imply that other errors exist. The same configuration error may result in different error codes at different times or in different versions of the device. If none of the checks fail, the device is enabled and the WQ enable field is set to 1.

[0565] In one embodiment, the DSA performs the following checks when a descriptor is received: The WQ identified by the register address used to submit the descriptor is an active WQ (the size field in the WQCFG register is non-zero). If this check fails, an error is logged in the software error register (SWERROR). If the descriptor was submitted to a shared WQ, It was submitted with ENQCMD or ENQCMDS. If this check fails, an error is logged in SWERROR. If the descriptor was submitted via a non-privileged or guest portal, the current queue occupancy is not greater than the WQ threshold. If this check fails, a retry response is returned. If the descriptor was submitted through a privileged portal, the current queue occupancy is less than the WQ size. If this check fails, a retry response is returned. If the descriptor was submitted to a dedicated WQ, It was submitted using MOVDIR64B. - The queue occupancy is smaller than the WQ size.

[0566] If any of these checks fail, an error is logged in SWERROR.

[0567] In one embodiment, the device performs the following checks on each descriptor as it is processed: The value in the operation code field corresponds to a supported operation. This includes checking that the operation is valid in the context in which it was submitted. For example, a batch descriptor in a batch would be treated as an invalid operation code. No reserved flags are set. This includes flags whose corresponding feature bits in the GENCAP register are 0. No unsupported flags are set. This includes flags that are reserved for use with specific operations, for example, fence bits that are reserved in descriptors that are enqueued directly rather than as part of a batch. It also includes flags that are disabled in the configuration, for example, the fault blocking flag, which is reserved if the fault blocking enable field in the WQCFG register is 0. The requested flags are set. For example, the request completed record flag must be 1 in the descriptor for the compare operation. Reserved fields are 0. This includes any fields that are not defined to mean a specific action. In some embodiments, it is not necessary to check all reserved fields, but software should take care to clear all unused fields for maximum compatibility. In a batch descriptor, the total number of descriptors field is not larger than the maximum batch size field in the GENCAP register. · The transfer size, source size, maximum delta record size, delta record size, and maximum destination size (as applicable to the descriptor type) are not larger than the maximum transfer size field in the GENCAP register. In a memory copy descriptor using dual cast, bits 11:0 of ​​the two destination addresses are the same. · If the Used Interrupt Message Storage flag is set, the completed interrupt processing is less than the interrupt message storage size.

[0568] In one embodiment, if the completion record address 3804 cannot be translated, the descriptor 3800 is discarded and an error is logged in a software error register. Otherwise, if any of these checks fail, a completion record is written with a status field indicating the type of check that failed, and byte complete is set to 0. If requested, a completion interrupt is generated.

[0569] These checks may be performed in any order. Therefore, an indication of one type of error in a completion record does not imply that other errors exist. The same invalid descriptor may report different error codes at different times or on different versions of the device.

[0570] The reserved fields 3811 in a descriptor may be divided into three categories: fields that are always reserved, fields that are reserved under some conditions (e.g., based on the function, configuration fields, how the descriptor was submitted, or the values ​​of other fields in the descriptor itself), and fields that are reserved based on the operation type. The following table lists the conditions under which fields are reserved. [Table 26] [Table 27] JPEG2024133635000032.jpg251170

[0571] As mentioned above, DSA supports the use of either physical or virtual addresses. The use of virtual addresses that are shared with processes running on a processor core is called shared virtual memory (SVM). To support SVM, the device provides a PASID when performing address translation, which handles page faults that occur when no translation exists for an address. However, the device itself does not distinguish between virtual and physical addresses. This distinction is controlled by programming the IOMMU 1710.

[0572] In one embodiment, the DSA supports the Address Translation Services (ATS) and Page Request Services (PRS) PCI Express functions as shown in FIG. 28, which shows PCIe logic 2820 communicating with PCIe logic 2808 using PCDI to utilize the ATS. The ATS describes the device's behavior during address translation. When a descriptor enters the descriptor processing unit, device 2801 may request a translation for the address in the descriptor. If there is a hit in device TLB 2822, the device uses the corresponding host physical address (HPA). If there is a failure or permission failure, one embodiment of DSA 2801 sends an address translation request to IOMMU 2810 (i.e., across multi-protocol link 2800) for translation. IOMMU 2810 may then look up the translation by walking its respective page table and return an address translation response that includes the translated address and valid permissions. Device 2801 then stores the translation in device TLB 2822 and uses the corresponding HPA for the operation. If the IOMMU 2810 is unable to find a translation in the page tables, it may return an address translation response indicating that no translation is available. If the IOMMU 2810 response indicates that no translation is available, or indicates valid permissions that do not include the permissions requested by the operation, it is considered a page fault.

[0573] DSA device 2801 may encounter a page fault at one of 1) the recorded completion address 3804, 2) the descriptor list address within the batch descriptor, or 3) the source buffer or destination buffer address. DSA device 2801 can block until the page fault is resolved, or it can complete the descriptor early and return a partial completion to the client. In one embodiment, DSA device 2801 always blocks on page faults on the recorded completion address 3804 and the descriptor list address.

[0574] If the DSA blocks a page fault, it reports the page fault as a Page Request Service (PRS) request to the IOMMU 2810 for servicing by the OS page fault handler. The IOMMU 2810 may notify the OS through an interrupt. The OS validates the address and, if the check is successful, creates a mapping in the page table and returns the PRS response through the IOMMU 2810.

[0575] In one embodiment, each descriptor 3800 has a fault blocking flag that indicates whether the DSA 2801 should return a partial completion or block if a page fault occurs on the source or destination buffer address. If the fault blocking flag is 1 and a fault is encountered, the faulted descriptor is blocked until a PRS response is received. Other operations behind the faulting descriptor may also be blocked.

[0576] If the fault's blocks is 0 and a page fault occurs on the source or destination buffer address, the device stops the operation and writes a partial completion status to the completion record along with the fault address and progress information. When client software receives a completion record indicating partial completion, it has the option to revert the fault on the processor (e.g., by touching the page) and submit a new work descriptor with the remaining work.

[0577] Alternatively, software can complete the remaining work on the processor. The Block on Fault Support field in the General Capabilities Register (GENCAP) may indicate device support for this feature, and the Block on Fault Enable field in the Work Queue Configuration Register allows the VMM or kernel driver to control whether applications are allowed to use the feature.

[0578] Device page faults can be relatively expensive. In fact, the cost of performing work due to a device page fault may be higher than the cost of performing work due to a processor page fault. Even if the device performs partial work completion at the time of the fault instead of blocking the fault, additional overhead is incurred because software intervention is required to perform work due to the page fault and resubmit the work. Thus, for best performance, it is preferable for software to minimize device page faults without incurring the overhead of pinning and unpinning.

[0579] Batch descriptor lists and source data buffers are typically created by software just before submitting them to the device. Therefore, their addresses are unlikely to cause a fault due to temporal locality. Completion descriptors and destination data buffers, however, are likely to cause a fault if they are not touched by software before submitting them to the device. Such faults can be minimized by software explicitly "write touching" these pages before submission.

[0580] During a device TLB invalidation request, if the address being invalidated is in use in a descriptor processing unit, the device waits for the engine to be done with the address before completing the invalidation request.

[0581] Additional Descriptor Types

[0582] In some embodiments, one or more of the following additional descriptor types may be utilized:

[0583] No-op

[0584] Figure 40 shows an example no-op descriptor 4000 and no-op completion record 4001. A no-op operation 4005 does not perform a DMA operation. It may require a completion record and / or a completion interrupt. If it is in a batch, a fence flag may be specified that ensures that the completion of the no-op descriptor occurs after the completion of all previous descriptors in the batch.

[0585] batch

[0586] Figure 41 shows an example batch descriptor 4100 and no-op completion record 4101. Batch operation 4108 queues multiple descriptors at a time. Descriptor list address 4102 is the address for a contiguous array of work descriptors to process. In one embodiment, each descriptor in the array is 64 bytes. Descriptor list address 4102 is 64-byte aligned. Total descriptors 4103 is the number of descriptors in the array. The set of descriptors in the array is called a "batch." The maximum number of descriptors allowed in a batch is given in the max batch size field in GENCAP.

[0587] The PASID 4104 and U / S flag 4105 in the batch descriptor are used for all descriptors in the batch. The PASID 4104 and U / S flag fields 4105 in descriptors in the batch are ignored. If the Completion Queue Enable flag in the batch descriptor 4100 is set, the Completion Record Address Valid flag must be 1, and the Completion Queue Address field 4106 contains the address of the completion queue used for all descriptors in the batch. In this case, the Completion Record Address field 4106 in descriptors in the batch is ignored. If the Completion Queue Support field in the General Capabilities Register is 0, the Completion Queue Enable flag is reserved.

[0588] If the Completion Queue Enable flag in the batch descriptor is 0, the completion records for each descriptor in the batch are written to the Completion Record Address 4106 in each descriptor. In this case, if the Request Completion Record flag in the batch descriptor is 1, the Completion Queue Address field is used exclusively as the Completion Record Address 4106 for the batch descriptor.

[0589] The status field 4110 of the batch completion record 4101 indicates success if all of the descriptors in the batch completed, otherwise it indicates that one or more descriptors completed with a status other than success. The descriptors completed field 4111 of the completion record contains the total number of descriptors in the batch that were being processed, whether they were successful or not. The descriptors completed 4111 may be less than the total descriptors 4103 if there is a fence in the batch or if a page fault occurred while reading the batch.

[0590] drain

[0591] Figure 42 shows an exemplary drain descriptor 4200 and drain completion record 4201. Drain operation 4208 waits for the completion of all outstanding descriptors associated with PASID 4202 in the work queue to which drain descriptor 4200 was submitted. This descriptor may be used during normal shutdown by processes using the device. To wait for all descriptors associated with PASID 4202, software should submit a separate drain operation for each work queue in which PASID 4202 was used. Software should ensure that no descriptors with a particular PASID 4202 are submitted to a work queue after drain descriptor 4201 is submitted and before it completes.

[0592] The drain descriptor 4201 may not be included in the batch and is treated as an unsupported operation type. The drain should specify a request completion record or a request completion interrupt. The completion notification occurs after other descriptors have completed.

[0593] Memory Movement

[0594] Figure 43 shows an exemplary memory move descriptor 4300 and memory move completion record 4301. A memory move operation 4308 copies memory from a source address 4302 to a destination address 4303. The number of bytes copied is given by the transfer size 4304. There are no alignment requirements for the memory addresses or transfer size. If the source and destination regions overlap, the memory copy is performed as if the entire source buffer was copied to a temporary space and then to the destination buffer. This can be accomplished by reversing the direction of the copy if the start of the destination buffer overlaps the end of the source buffer.

[0595] If the operation is partially completed due to a page fault, the direction field 4310 of the completion record is 0 if a copy was performed starting from the beginning of the source and destination buffers, and the direction field is 1 if the direction of the copy was reversed.

[0596] To resume an operation after a partial completion, if the direction is 0, the source and destination address fields 4302-4303 in successive descriptors should be increased by byte completions and the transfer size should be decreased by byte completions 4311. If the direction is 1, the transfer size 4304 should be decreased by byte completions 4311, but the source and destination address fields 4302-4303 should be the same as in the original descriptor. Note that when subsequent partial completions occur, the direction field 4310 need not be the same as for the first partial completion.

[0597] Fill

[0598] Figure 44 shows an example fill descriptor 4400. A memory fill operation 4408 fills memory at destination address 4406 with the value in pattern field 4405. The pattern size may be 8 bytes. To use a smaller pattern, software must replicate the pattern in the descriptor. The number of bytes written is given by transfer size 4407. The transfer size does not need to be a multiple of the pattern size. There are no alignment requirements for the destination address or transfer size. If the operation partially completes due to a page fault, the bytes completed field of the completion record contains the number of bytes written to the destination before the fault occurred.

[0599] comparison

[0600] Figure 45 shows an exemplary compare descriptor 4500 and compare completion record 4501. A compare operation 4508 compares memory at address 4504 of source 1 with memory at address 4505 of source 2. The number of bytes compared is given by the transfer size 4506. There are no alignment requirements for the memory address or transfer size 4506. The completion record address valid and requested completion record flags must be 1, and the completion record address must be valid. The result of the comparison is written to the result field 4510 of the completion record 4501. A value of 0 indicates that the two memory regions match, and a value of 1 indicates that they do not match. If result 4510 is 1, the bytes completed 4511 field of the completion record indicates the byte offset of the first difference. If the operation partially completed due to a page fault, the result is 0. If a difference was detected, the difference will be reported instead of the page fault.

[0601] If the operation is successful and the check result flag is 1, the status field 4512 of the completion record is set according to the result and expected result, as shown in the table below. This allows the fence flag and subsequent descriptors in the same batch to continue or stop execution of the batch based on the outcome of the comparison. [Table 28]

[0602] Comparative Intermediate

[0603] Figure 46 shows an exemplary compare intermediate descriptor 4600. The compare intermediate process 4608 compares the memory at source address 4601 with the value in pattern field 4602. The pattern size is 8 bytes. To use a smaller pattern, software must replicate the pattern in the descriptor. The number of bytes compared is given by transfer size 4603. The transfer size does not need to be a multiple of the pattern size. The completion record address valid and requested completion record flags must be 1. The completion record address 4604 must be valid. The result of the comparison is written to the result field of the completion record. A value of 0 indicates that the memory region matches the pattern, and a value of 1 indicates that it does not match. If the result is 1, the byte completion field of the completion record indicates the location of the first difference. It may not be the exact byte location, but it is guaranteed to be no greater than the first difference. If the operation partially completed due to a page fault, the result is 0. If a difference was detected, the difference will be reported instead of the page fault. In one embodiment, the completion record format for comparison intermediates and the behavior of check results and predicted results are the same as comparison.

[0604] Creation difference record

[0605] Figure 47 shows an exemplary create delta record descriptor 4700 and create delta record completion record 4701. A create delta record operation 4708 compares memory at address 4705 in source 1 with memory at address 4702 in source 2 to generate a delta record containing the information needed to update source 1 to match source 2. The number of bytes compared is given by transfer size 4703. As explained below, the transfer size is limited by the maximum offset that can be stored in the delta record. There are no alignment requirements for the memory address or transfer size. The completion record address valid and requested completion record flags must be 1, and the completion record address 4704 must be valid.

[0606] The maximum size of a differential record is given by the maximum differential record size 4709. The maximum differential record size 4709 should be a multiple of the differential size (10 bytes) and must not be larger than the maximum transfer size in GENCAP. The actual size of the differential record depends on the number of differences found between source 1 and source 2, and is written to the differential record size field 4710 of the completed record. If the space required for the differential record exceeds the maximum differential record size 4709 specified in the descriptor, the operation will complete with a partial differential record.

[0607] The result of the comparison is written to result field 4711 of completion record 4701. If the two regions match exactly, result is 0, differential record size is 0, and bytes done is 0. If the two regions do not match, the complete set of differences is written to the differential record, result is 1, differential record size contains the total size of all differences obtained, and bytes done is 0. If the two regions do not match and the space required to record all differences exceeds maximum differential record size, result is 2, differential record size 4710 contains the size of the set of differences written to the differential record (typically equal to or approximately equal to the differential record size specified in the descriptor), and bytes done 4712 contains the number of bytes compared before the space in the differential record was exceeded.

[0608] If the operation is partially completed due to a page fault, then result 4711 will be either 0 or 1, bytes completed 4712 will contain the number of bytes compared before the page fault occurred, and differential record size will contain the space used in the differential record before the page fault occurred, as described in the previous paragraph.

[0609] The format of a delta record is shown in Figure 48. A delta record contains an array of deltas. Each delta contains a 2-byte offset 4801 and an 8-byte block of data 4802 from source 2 that differs from the corresponding 8 bytes in source 1. The total size of a delta record is a multiple of 10. Because offset 4801 is a 16-bit field that represents a multiple of 8 bytes, the maximum offset that can be represented is 0x7FFF8, and therefore the maximum transfer size is 0x80000 bytes (512KB).

[0610] If the operation is successful and the check result flag is 1, the status field of the completion record is set according to the result and expected result, as shown in the table below. This allows the fence flag and subsequent descriptors in the same batch to continue or stop execution of the batch based on the result of the delta record creation. Bits 7:2 of the expected result are ignored. [Table 29]

[0611] Matching differential recording

[0612] Figure 49 shows an exemplary adaptive delta record descriptor 4901. Adaptive delta record operation 4902 applies a delta record to the contents of memory at destination address 4903. Delta record address 4904 is the address of the delta record created by create delta record operation 4902 that completed with result equal to 1. Delta record size 4905 is the size of the delta record as reported in the completion record of create delta record operation 4902. Destination address 4903 is the address of a buffer that contains the same contents as the memory at source 1's address when the delta record was created. Transfer size 4906 is the same as the transfer size used when the delta record was created. After adaptive delta record operation 4902 completes, the memory at destination address 4903 will match the contents that were in the memory at source 2's address when the delta record was created. There are no alignment requirements for the memory address or transfer size.

[0613] If a page fault occurs during the conforming delta record operation 4902, the bytes completed field of the completion record contains the number of bytes of the delta record that were successfully applied to the destination. If software chooses to submit another descriptor to resume the operation, the successive descriptor will contain the same destination address 4903 as the original. The delta record address 4904 should be incremented by the byte completed (thus pointing to the first unapplied delta), and the delta record size 4905 should be reduced by the byte completed.

[0614] Figure 50 shows one example of the use of create difference record and adaptive difference record operations. First, create difference record operation 5001 is performed. Create difference record operation 5001 reads two source buffers - Source 1 and Source 2 - and writes a difference record 5010 in its completion record 5003, recording the actual difference record size 5004. Adaptive difference record operation 5005 takes the contents of the difference record written by create difference record operation 5001, along with its size and a copy of the Source 1 data, and updates destination buffer 5015 to be a duplicate of the original Source 2 buffer. The create difference record operation includes a maximum difference record size 5002.

[0615] Memory copy using dual cast

[0616] Figure 51 shows an exemplary memory copy using dual cast descriptor 5100 and a memory copy using dual cast completion record 5102. A memory copy using dual cast operation 5104 copies memory from a source address 5105 to both a destination 1 address 5106 and a destination 2 address 5107. The number of bytes copied is given by the transfer size 5108. There are no alignment requirements for the source address or transfer size. Bits 11:0 of ​​the two destination addresses 5106-5107 should be the same.

[0617] If the source region overlaps with either of the destination regions, the memory copy is performed as if the entire source buffer was copied to a temporary space and then copied to the destination buffer. This can be done by reversing the direction of the copy if the beginning of the destination buffer overlaps the end of the source buffer. It is an error if the source region overlaps both destination regions, or if two destination regions overlap. If the operation is partially completed due to a page fault, the copy operation stops after writing the same number of bytes to both destination regions, and the direction field 5110 of the completion record is 0 if a copy is performed starting from the beginning of the source and destination buffers, and the direction field is 1 if the direction of the copy is reversed.

[0618] To resume an operation after a partial completion, if direction 5110 is 0, the source 5105 and both destination address fields 5106-5107 in successive descriptors should be increased by byte completion 5111, and the transfer size 5108 should be decreased by byte completion 5111. If direction is 1, the transfer size 5108 should be decreased by byte completion 5111, but the source 5105 and destination 5106-5107 address fields should be the same as in the original descriptor. Note that when subsequent partial completions occur, the direction field 5110 need not be the same as for the first partial completion.

[0619] Cyclic Redundancy Check (CRC) generation

[0620] Figure 52 shows an exemplary CRC generation descriptor 5200 and CRC generation 5201. The CRC generation process 5204 calculates the CRC on memory at the source address. The number of bytes used for the CRC calculation is given by the transfer size 5205. There are no alignment requirements for the memory address or transfer size 5205. The completion record address valid and requested completion record flags must be 1, and the completion record address 5206 must be valid. The calculated CRC value is written to the completion record.

[0621] If an operation is partially completed due to a page fault, the partial CRC result is written to the completion record along with the page fault information. When software corrects the fault and resumes the operation, it must copy this partial result into the CRC seed field of the successive descriptor. Otherwise, the CRC seed field should be 0.

[0622] Copying with CRC generation

[0623] Figure 53 shows an exemplary copy using CRC generation descriptor 5300. The copy using CRC generation process 5305 copies memory from source address 5302 to destination address 5303 and calculates a CRC for the copied data. The number of bytes copied is given by transfer size 5304. There are no alignment requirements for memory addresses or transfer sizes. It is an error if the source and destination areas overlap. The completion record address valid and requested completion record flags must be 1 and the completion record address must be valid. The calculated CRC value is written to the completion record.

[0624] If an operation is partially completed due to a page fault, the partial CRC result is written to the completion record along with the page fault information. When software corrects the fault and resumes the operation, it must copy this partial result into the CRC seed field of the successive descriptor. Otherwise, the CRC seed field should be 0. In one embodiment, the completion record format for copying with CRC generation is the same as the format for CRC generation.

[0625] Data Integrity Field (DIF) Insertion

[0626] Figure 54 shows an example DIF insertion descriptor 5400 and DIF insertion completion record 5401. A DIF insertion operation 5405 copies memory from a source address 5402 to a destination address 5403, calculates a data integrity field (DIF) on the source data, and inserts the DIF into the output data. The number of source bytes copied is given by the transfer size 5406. The DIF calculation is performed on each block of source data, e.g., 512, 520, 4096, or 4104 bytes. The transfer size should be a multiple of the source block size. The number of bytes written to the destination is the transfer size plus 8 bytes per source block. There are no alignment requirements for memory addresses. It is an error if the source and destination regions overlap. If the operation partially completes due to a page fault, the updated values ​​of the reference tag and application tag are written to the completion record along with the page fault information. When software corrects the fault and resumes the operation, it may copy these fields to contiguous descriptors.

[0627] DIF Strip

[0628] Figure 55 shows an exemplary DIF strip descriptor 5500 and DIF strip completion record 5501. A DIF strip operation 5505 copies memory from a source address 5502 to a destination address 5503, calculates a data integrity field (DIF) on the source data, and compares the calculated DIF with the DIF contained in the data. The number of source bytes read is given by the transfer size 5506. The DIF calculation is performed on each block of source data, which can be 512, 520, 4096, or 4104 bytes. The transfer size should be a multiple of the source block size plus 8 bytes per source block. The number of bytes written to the destination is the transfer size minus 8 bytes per source block. There are no alignment requirements for memory addresses. It is an error if the source and destination regions overlap. If the operation is partially completed due to a page fault, the updated values ​​of the reference tag and application tag are written to the completion record along with the page fault information. When the software corrects the fault and resumes operation, it may copy these fields into the contiguous descriptor.

[0629] DIF update

[0630] Figure 56 shows an exemplary DIF update descriptor 5600 and DIF update completion record 5601. A memory move using a DIF update operation 5605 copies memory from a source address 5602 to a destination address 5603, calculates a data integrity field (DIF) on the source data, and compares the calculated DIF with the DIF contained in the data. The DIF on the source data is simultaneously calculated using the destination DIF field in the descriptor, and the calculated DIF is inserted into the output data. The number of source bytes read is given by the transfer size 5606. The DIF calculation is performed on each block of source data, which can be 512, 520, 4096, or 4104 bytes. The transfer size 5606 should be a multiple of the source block size plus 8 bytes per source block. The number of bytes written to the destination is equal to the transfer size 5606. There are no alignment requirements for memory addresses. It is an error if the source and destination regions overlap. If an operation is partially completed due to a page fault, the updated values ​​of the source and destination reference tags and the application tag are written to the completion record along with the page fault information. When software corrects the fault and resumes the operation, it may copy these fields to the contiguous descriptor.

[0631] Table AA below shows the DIF flags used in one embodiment, Table BB shows the source DIF flags used in one embodiment, and Table CC shows the destination DIF flags in one embodiment. [Table 30]

[0632] Source DIF Flag [Table 31]

[0633] Destination DIF Flag [Table 32]

[0634] In one embodiment, the DIF result field reports the status of the DIF operation. This field may be defined only for DIF strip and update operations, and only if the status field of the completion record is success or success with an incorrect predicate. Table DD below shows exemplary DIF result field codes. [Table 33]

[0635] The F detection condition is detected when one of the following in Table EE is true: [Table 34]

[0636] If the operation is successful and the check result flag is 1, the status field of the completion record is set according to the DIF result, as shown in Table FF below. This allows the fence flag and subsequent descriptors in the same batch to continue or stop execution of the batch based on the outcome of the operation. [Table 35]

[0637] Cache Flush

[0638] Figure 57 shows an exemplary cache flush descriptor 5700. A cache flush operation 5705 flushes the processor cache at a destination address. The number of bytes flushed is given by the transfer size 5702. The transfer size does not need to be a multiple of the cache line size. There are no alignment requirements for the destination address or transfer size. Any cache lines that are partially covered by the destination region are flushed.

[0639] If the destination cache filter tag is 0, the affected cache line may be invalidated from each level of the cache hierarchy. If the cache line contains data that has been modified at any level of the cache hierarchy, the data is written back to memory. This is similar to the behavior of the CLFLUSH instruction implemented in some processors.

[0640] If the destination cache filter tag is 1, the modified cache line is written to main memory but is not evicted from the cache. This is similar to the behavior of the CLWB instruction on some processors.

[0641] The term accelerator is sometimes used herein to refer to a loosely coupled agent that can be used by software running on a host processor to offload or perform any kind of computational or I / O task. Depending on the type of accelerator and usage model, these can be tasks that perform data movement to or from memory or storage, computation, communication, or any combination of these.

[0642] "Loosely coupled" refers to how these accelerators are exposed and accessed by host software. Specifically, they are not exposed as processor ISA extensions, but instead as PCI Express countable endpoint devices on the platform. Loose coupling allows these agents to accept work requests from the host software and operate asynchronously with respect to the host processor.

[0643] An "accelerator" can be a programmable agent (e.g., GPU / GPGPU), a fixed-function agent (e.g., compression or encryption engine), or a reconfigurable agent such as a field-programmable gate array (FPGA). Some of these may be used for computation offload, while others (e.g., RDMA or host fabric interfaces) may be used for packet processing, communication, storage, or message passing operations.

[0644] Accelerator devices may be physically integrated at different levels, including on-die (i.e., on the same die as the processor), on-package, chipset, motherboard, or may be separate PCIe-attached devices. For integrated accelerators, even if enumerated as PCI Express endpoint devices, some of these accelerators may be coherently attached (to the on-die coherent fabric or to an external coherent interface), while others may be attached to an internal non-coherent interface or to an external PCI Express interface.

[0645] At a conceptual level, "accelerators" and high-performance I / O device controllers are similar. What distinguishes them are features such as unified / shared virtual memory, the ability to operate on pageable memory, support for user-mode work submission, task scheduling / preemption, and low-latency synchronization. As a result, accelerators can be considered a new and improved category of high-performance I / O devices.

[0646] Off-road Operation Model

[0647] Accelerator offload operation models can be broadly categorized into three usage categories.

[0648] 1. Streaming: In the streaming offload model, small units of work are streamed to the accelerator at a high rate. A typical example of this use case is a network data plane that performs various types of packet processing at a high rate.

[0649] 2. Low Latency: For some offload use cases, the latency of the offload operation (both the dispatch of the task to the accelerator and the accelerator executing it) is important. An example of this use case is a low-latency message-passing composition model involving remote get, put, and atomic operations over the host fabric.

[0650] 3. Scalable: Scalable offloading refers to a use in which the services of a computational accelerator are directly accessible (e.g., from the highest ring in a hierarchical protection domain, such as ring 3) to a large number (unlimited number) of client applications (within and through virtual machines) without constraints imposed by accelerator devices such as multiple work queues or multiple doorbells supported on the device. Some of the accelerator devices and processor interconnects described herein fall into this category. Such scalability applies to computational offload devices that support time-sharing / scheduling of work, such as GPUs, GPGPUs, FPGAs, or compression accelerators, or message passing, and uses such as enterprise databases that have large scalability requirements for lock-free operations.

[0651] Work dispatch across off-road models

[0652] Each of the above offload operation models presents unique work dispatch challenges, as described below.

[0653] 1. Work Dispatch for Streaming Offload Usage

[0654] For streaming usage, the typical work dispatch model is to use a work queue that resides in memory. Specifically, the device configures the location and size of the work queue in memory. The hardware implements a doorbell (tail pointer) register that is updated by software when new work elements are added to the work queue. The hardware reports the current head pointer to software to enforce producer-consumer flow control on the work queue elements. For streaming usage, the typical model is for software to check whether there is space in the work queue by looking at software-cached head and tail pointers (often maintained in host memory by hardware to avoid the overhead of UC MMIO reads by software), add new work elements to the work queue that resides in memory, and update the tail pointer using a doorbell register write to the device.

[0655] Doorbell writes are typically 4-byte or 8-byte writes to uncacheable (UC) MMIO. On some processors, UC writes ensure that older stores are globally monitored before issuing the UC write (required for producer-consumer usage), but are serialized operations that block all younger stores in the processor pipeline from being issued until the UC write is posted by the platform. Typical latencies for UC write operations on Xeon server processors are on the order of 80-100 nanoseconds, limiting streaming offload performance during the time that all younger store operations are blocked by the core.

[0656] One approach to addressing the serialization of younger stores following UC doorbell writes is to use write combining (WC) store operations for doorbell writes (due to the weak ordering of WC), but using WC stores for doorbell writes poses several challenges. Doorbell write sizes (typically DWORD or QWORD) are smaller than the cache line size. These partial writes incur additional latency due to the processor maintaining the partial writes in its write combining buffer (WCB) for potential write combining opportunities, incurring latency relative to doorbell writes issued by the processor. Software can issue these through explicit store fences, which incur the same serialization for younger stores as UC doorbells.

[0657] Another issue with WC-mapped MMIO is that mispredictions (using MOVNTDQA) and speculative reads are exposed to WC-mapped MMIO (which has registers that can affect the read side). This is cumbersome for devices to deal with, as they must host the WC-mapped doorbell registers in a separate page than the rest of the UC-mapped MMIO registers. This also poses challenges for virtualization usage, as VMM software can no longer ignore the guest memory type and enforce UC mapping for any device MMIO exposed to a guest using EPT page tables.

[0658] The MOVDIRI instruction described herein addresses the above limitations of using UC or WC storage for doorbell writes in these streaming offload applications.

[0659] 2. Work dispatch for low latency offload utilization

[0660] Some types of accelerator devices are highly optimized to complete requested operations with minimal latency. Unlike (throughput-optimized) streaming accelerators, these accelerators typically implement device-hosted work queues (exposed through device MMIO) to avoid DMA read latencies to fetch work elements (and, in some cases, the same data buffer) from a memory-hosted work queue. Instead, host software submits work to device-hosted work queues exposed through device MMIO by directly writing work descriptors (and, in some cases, data). Examples of such devices include host fabric controllers, remote DMA (RDMA) devices, and emerging storage controllers such as non-volatile memory (NVM) express. The use of device-hosted work queues poses few challenges with existing ISAs.

[0661] To avoid the serialization overhead of UC writes, the MMIO address of a device-hosted work queue is typically mapped as a WC, which presents the same challenges as a doorbell mapped to a WC for streaming accelerators.

[0662] Furthermore, using WC stores to a device-hosted work queue requires the device to observe the write atomicity behavior of some processors. For example, the atomicity of write operations up to 8 bytes in size only guarantees that some processors write within cache line boundaries (and due to locking operations), but does not define any guaranteed atomicity of write completion. The atomicity of the write operation is the granularity at which processor store operations are monitored by other agents and is a property of the processor instruction set architecture and coherency protocol. The atomicity of write completion is the granularity at which non-cacheable store operations are monitored by the receiver (the memory controller in the case of memory, or the device in the case of MMIO). The atomicity of write completion is stronger than the atomicity of the write operation and is a function of the platform as well as the processor instruction set architecture. Without the atomicity of write completion, a processor instruction that performs an N-byte non-cacheable store operation could be received as multiple (tone) write transactions by the device-hosted work queue. Currently, device hardware must observe such tonal writes by tracking each word or data in a work descriptor written to the device-hosted work queue.

[0663] The MOVDIR64B instruction described herein addresses the above limitations by supporting 64-byte writes with guaranteed atomicity of 64-byte write completion. MOVDIR64B is also useful for other uses, such as writing to persistent memory (NVM attached to a memory controller) and replicating data through a system via a non-transparent bridge (NTB).

[0664] 3. Work Dispatch for Scalable Offloading

[0665] The traditional approach for submitting work from an application to an I / O device involves making a system call to the kernel I / O stack, which forwards the request through a kernel device driver to the device I / O controller. While this approach is scalable (any number of applications can share the services of the device), it introduces the latency and overhead of a serialized kernel I / O stack, which often becomes a performance bottleneck for high-performance devices and accelerators.

[0666] To support low-overhead work dispatch, some high-performance devices support direct Ring 3 access, which allows work dispatch directly to the device and checks for work completion. In this model, the device allocates and maps some resources (such as a doorbell, work queue, and completion queue) to the application's virtual address space. Once mapped, Ring 3 software (user-mode drivers or libraries) can dispatch work directly to the accelerator. For devices that support shared virtual memory (SVM) functionality, the doorbell and work queue are set up by the kernel-mode driver to identify the process address space identifier (PASID) of the application process to which they are mapped. When processing work items dispatched through a particular work queue, the device uses the respective PASID configured for that work queue for virtual to physical address translation through the I / O memory management unit (IOMMU).

[0667] One challenge with Direct Ring 3 work submission is scalability. The number of application clients that can submit work directly to an accelerator device depends on the number of queues / doorbells (or device-hosted work queues) supported by the accelerator device. This is because doorbells or device-hosted work queues are statically assigned / mapped to application clients, and the number of these resources supported by the accelerator device design is fixed. Some accelerator devices attempt to "address" this scalability challenge by over-provisioning their doorbell resources (by dynamically detaching and re-attaching doorbells on demand for applications), but this is often cumbersome and difficult to scale. For devices that support I / O virtualization (e.g., single root I / O virtualization (SR-IOV)), the limited doorbell / work queue resources are further constrained because they need to be partitioned across various virtual functions (VFs) that are assigned to different virtual machines.

[0668] Scaling issues are most important for high-performance message-passing accelerators used by enterprise applications such as databases for lock-free operations (with some RDMA devices supporting 64K to 1M queue pairs), and for compute accelerators that support sharing of accelerator resources across tasks submitted by multiple clients.

[0669] The ENQCMD / S instruction described herein addresses the scaling limitations described above to enable an unlimited number of clients to subscribe and share the resources of a work queue on an accelerator.

[0670] One embodiment includes new types of store operations by the processor core, including direct stores and enqueue stores.

[0671] In one embodiment, direct stores are generated by the MOVDIRI and MOVDIR64B instructions described herein.

[0672] Cacheability: Like UC and WC stores, direct stores are not cacheable. When a direct store is issued to a cached address, the line is written back (if modified) and invalidated from the cache before the direct store.

[0673] Memory Ordering: Like WC stores, direct stores are weakly ordered. Specifically, they are not ordered with respect to older WB / WC / NT stores, CLFLUSHOPT, and CLWB to a different address. A younger WB / WC / NT store, CLFLUSHOPT, or CLWB to a different address can pass an older direct store. Direct stores to the same address are always ordered with older stores (including direct stores) to the same address. Direct stores are fenced by any operations that enforce store fencing (e.g., SFENCE, MFENCE, UC / WP / WT stores, locks, IN / OUT instructions, etc.).

[0674] Write Combining: Direct stores have different write combining behavior than regular WC stores. Specifically, direct stores are subject to immediate eviction from the write combining buffer and therefore cannot be combined with younger stores (including direct stores) to the same address. Older WC / NT stores held in the write combining buffer may be combined with younger direct stores to the same address, and applications that need to avoid such combinations must explicitly store a fence WC / NT store before performing a direct store to the same address.

[0675] Atomicity: Direct stores support atomicity of write completion with respect to the write size of the instruction issuing the direct store. In the case of MOVDIRI, if the destination is 4-byte aligned (or 8-byte aligned), the atomicity of write completion is 4 bytes (or 8 bytes). For MOVDIR64B, the destination is forced to be 64-byte aligned, and the atomicity of write completion is 64 bytes. The atomicity of write completion ensures that direct stores are not torn into multiple write transactions as processed by the memory controller or root complex. The root complex implementation on processors that support direct stores ensures that direct stores are forwarded on the external PCI Express fabric (and the internal I / O fabric within the SoC, which follows PCI Express ordering) as a single, non-torn posted write transaction. A read operation to a memory location from any agent (processor or non-processor agent) sees either all or none of the data written by the instruction issuing the direct store operation.

[0676] Ignoring destination memory type: Direct stores ignore the destination address memory type (including UC / WP type) and always follow weak ordering. This allows software to map device MMIO as UCs ​​and access certain registers (e.g., doorbell or device-hosted work queue registers) using direct store instructions (MOVDIRI or MOVDIR64B) while continuing to access other registers that may have strict serialization requirements using regular MOV operations that follow the UC ordering per the memory type of the mapped UC. This also allows direct store instructions to work from within guest software, while virtual machine monitor (VMM) software (which has no device-specific knowledge) maps guest-exposed MMIO as UCs ​​in the processor extended page table (EPT) and ignores the guest memory type.

[0677] An SoC that supports direct stores must ensure atomicity of write completion for direct stores as follows:

[0678] Direct Stores to Main Memory: For direct stores to main memory, the coherent fabric and system agents ensure that all data bytes in a direct store are issued to the home agent or other global observability (GO) point for requests to memory as a single (non-torn) write transaction. For platforms that support persistent memory, the home agent, memory controller, memory-side cache, inline memory encryption engine, memory bus (e.g., DDR-T) that attaches persistent memory, and persistent memory controller must each support the same or higher granularity of write completion atomicity for direct stores. Thus, software can perform a 64-byte direct store to memory (volatile or persistent) using MOVDIR64B and be guaranteed that all 64-byte writes are processed atomically by all agents. As with regular writes to persistent memory, if software needs to explicitly commit to persistence, the software performs the direct store in a fence / commit / fence sequence.

[0679] Direct Stores to Memory-Mapped I / O: For direct stores to memory-mapped I / O (MMIO), the coherent fabric and system agents must ensure that all data bytes in a direct store are issued to the root complex (the global observability point for requests to MMIO) as a single (non-torn) write transaction. The root complex implementation must ensure that each direct store is processed and forwarded as a single (non-torn) posted write transaction on the internal I / O fabric that attaches the PCI Express Root Complex Integrated Endpoint (RCIEP) and Root Port (RP). PCI Express Root Ports and Switch Ports must forward each direct store as a single posted write transaction. Atomicity of write completion is not specified or guaranteed for direct stores targeting devices on or behind secondary bridges (e.g., legacy PCI, PCI-X bridges) or secondary buses (e.g., USB, LPC, etc.).

[0680] Note that some SoC implementations already guarantee atomicity of write completion for WC write requests. Specifically, partial line WC writes (WCiL) and full line WC writes (WCiLF) are already handled with atomicity of write completion by the system agent, memory controller, root complex, and I / O fabric. For such embodiments, there is no need for the processor to distinguish direct writes from WC writes; the behavioral difference between direct and WC stores is internal to the processor core. Therefore, no changes are proposed to the internal or external fabric specifications for direct writes.

[0681] The handling of direct writes received by a PCI Express endpoint or RCIEP is device implementation specific. Depending on the device's programming interface, the device and its drivers may require some of its registers (e.g., doorbell registers or device-hosted work queue registers) to always be written with direct store instructions (e.g., MOVDIR64B) and handle these atomically within the device. Writes to other registers on the device may be handled by the device without any consideration or expectation of atomicity. With respect to the RCIEP, if registers with write atomicity requirements are implemented for access through a sideband or private wire interface, such embodiments must ensure the write atomicity property through implementation-specific means.

[0682] In one embodiment, enqueue stores are generated by the ENQCMD and ENQCMDS instructions described herein. The specified target of the enqueue store is a shared work queue (SWQ) on the accelerator device. In one embodiment, the enqueue store has the following characteristics:

[0683] Non-Posted: The enqueue store generates a 64-byte non-posted write transaction to the target address and receives a completion response indicating success or retry status. The success / retry status returned in the completion response may be returned to software by the ENQCMD / S instruction (e.g., in a zero flag).

[0684] Cacheability: In one embodiment, enqueue stores are not cacheable. Platforms that support enqueue stores enforce that enqueue non-posted writes are only forwarded to address (MMIO) ranges that are explicitly enabled to accept these stores.

[0685] Memory Ordering: Enqueue stores may update architectural state (e.g., the zero flag) with non-posted write completion status. Thus, at most one enqueue store can be outstanding from a given logical processor. In that sense, an enqueue store from a logical processor cannot pass another enqueue store issued from the same logical processor. Enqueue stores do not order to a different address relative to older WB / WC / NT stores, CLFLUSHOPT, or CLWB. Software that needs to enforce such ordering may use explicit store fencing after such stores and before the enqueue store. Enqueue stores are always ordered to the same address with older stores.

[0686] Alignment: The ENQCMD / S instruction forces the enqueue store destination address to be 64-byte aligned.

[0687] Atomicity: Enqueue stores generated by the ENQCMD / S instruction support atomicity of 64-byte write completion. Atomicity of write completion ensures that enqueue stores are not torn into multiple transactions as processed by the root complex. The root complex implementation on processors that support enqueue stores ensures that each enqueue store is transferred to the endpoint device as a single (non-torn) 64-byte non-posted write transaction.

[0688] Ignores destination memory type: Like direct stores, enqueue stores ignore the destination address memory type (including UC / WP type) and always follow the ordering as described above. This allows software to map device MMIO as UC and continue to access shared work queue (SWQ) registers using the ENQCMD / S instruction, while continuing to access other registers using regular MOV instructions or through direct store (MOVDIRI or MOVDIR64B) instructions. This also allows enqueue store instructions to work from within guest software, while the VMM software (which has no device-specific knowledge) maps guest-exposed MMIO as UC in the processor extended page table (EPT) and ignores the guest memory type.

[0689] Platform Considerations for Enqueue Storage

[0690] For some embodiments, a specific set of platform integration devices support shared work queue (SWQ) functionality. These devices may be attached to the root complex through the internal I / O fabric. These devices may be exposed to host software as either PCI Express root complex integrated endpoints (RCIEPs) or PCI Express endpoint devices behind a virtual root port (VRP).

[0691] Platforms that support integrated devices with SWQs should restrict the forwarding of enqueue non-posted write requests on the internal I / O fabric to only such devices to ensure that the new transaction type (enqueue non-posted write) is not treated as a malformed transaction layer packet (TLP) by endpoint devices that do not understand enqueue.

[0692] Enqueues to all other addresses (including the main memory address range and all other memory-mapped address ranges) are terminated by the platform, and a normal (non-error) response is returned to the issuing processor along with a retry completion status. Because unprivileged software (ring 3 software in VMX non-root mode, or ring 0 software) can generate enqueue non-posted write transactions by executing the ENQCMD / S instruction, no platform error is generated on the termination of such an enqueue.

[0693] The root complex implementation should ensure that enqueue stores are processed and transferred as a single (non-torn), non-posted write transaction on the internal I / O fabric for integrated devices that support SWQ.

[0694] Platform performance considerations

[0695] This section describes some performance considerations in the handling of system agents and enqueue storage by system agents.

[0696] Relaxed ordering for System Agent Tracker (TOR) entry allocation for enqueue storage.

[0697] To maintain memory consistency, system agent implementations typically enforce strict ordering on requests to cache line addresses (when allocating TOR entries) for coherent memory and MMIO. While this is required to support overall ordering for coherent memory accesses, this strict ordering for enqueue stores incurs performance issues because enqueue stores target a shared work queue (SWQ) on the device, thereby commonly causing enqueue store requests to be issued from multiple logical processors with the same destination SWQ address. Also, unlike regular stores posted to the system agent, enqueue stores are non-posted and incur similar latency to reads. To negate the requirement to allow only one outstanding enqueue store to the shared work queue, a system agent implementation is required to relax the strict ordering for enqueue store requests to the same address and instead allow TOR allocation for multiple in-flight enqueue stores to the same address. A logical processor can only issue at most one enqueue store at a time, allowing the system agent / platform to process each enqueue store independently without worrying about ordering.

[0698] Support for multiple outstanding enqueue non-posted writes in the I / O Bridge agent.

[0699] I / O bridge implementations typically limit the number of non-posted (read) requests supported in the downstream path to a small number (often to a single request). This is because reads from the processor to the MMIO (usually UC reads) are not performance-critical for most uses, and supporting a large queue depth due to the buffering required to read the returned data increases the hardware cost. Since it is expected that enqueue stores will typically be used for work dispatch to accelerator devices, applying this limited queuing for enqueue non-posted writes could be detrimental to performance. I / O bridge implementations are encouraged to support increased queue depths (some actual percentage of the number of logical processors, since a logical processor can only have one outstanding enqueue store request at a time) for improved enqueue non-posted write bandwidth. Unlike read requests, enqueue stores do not incur the hardware cost of data buffers, since enqueue non-posted write completion simply returns a completion status (success vs. retry) and does not return the data.

[0700] Virtual channel support for enqueue non-posted writes

[0701] Unlike typical memory read and write requests on the I / O bus, which have producer-consumer ordering requirements (e.g., as specified by PCI Express transaction ordering), Enqueue Non-Posted Writes do not impose ordering requirements on the I / O bus. This allows the use of non-VC0 virtual channels to issue Enqueue Non-Posted Writes and return their respective completions. The benefit of using non-VC0 channels is that Enqueue Non-Posted Write completions can have better latency (fewer cycles delaying the core) by avoiding being ordered behind upstream posted writes on VC0 from the device to the host. Implementations are encouraged to carefully consider their integrated device utilization to minimize Enqueue Non-Posted completion latency.

[0702] Intermediate stop of enqueue non-posted light

[0703] To handle certain flow control situations in high latency situations (e.g., waking up an internal link or power management on a locked flow), an intermediate agent (system agent, I / O bridge, etc.) may drop the regular enqueue store request and return completion to the issuing core with a retry response. The software issuing the enqueue store does not have direct visibility into whether the retry response is from the intermediate agent or target, or if the software will retry normally (potentially with some backoff).

[0704] Implementations that perform such intermediate stops must be very careful to ensure that such behavior cannot expose any denial of service attacks across software clients that share the SWQ.

[0705] Support for shared work queues on endpoint devices

[0706] FIG. 34 illustrates the concept of a shared work queue (SWQ), allowing multiple non-cooperative software agents (applications 3410-3412) to submit work through a shared work queue 3401 using the ENQCMD / S command described herein.

[0707] The following considerations are applicable to endpoint devices that implement a shared work queue (SWQ).

[0708] SWQ and its enumeration: A device physical function (PF) may support one or more SWQs. Each SWQ is 64-byte aligned within the device MMIO address range and accessible for enqueued non-posted writes through a size register (referred to here as SWQ_REG). It is recommended that each such SWQ_REG on a device be located in a unique system page-sized (4KB) region. The device driver for the device is responsible for reporting / enumerating the SWQ capabilities, number of supported SWQs, and corresponding SWQ_REG addresses to software through an appropriate software interface. The driver may selectively report the depth of the supported SWQs for software tuning or informational purposes (although this is not required for functional accuracy). For devices that support multiple physical functions, it is recommended that each physical function support an independent SWQ.

[0709] SWQ support on single root I / O virtualization (SR-IOV) devices: Devices that support SR-IOV may support an independent SWQ for each virtual function (VF), exposed through an SWQ_REG in each VF base address register (BAR). This design allows for maximum performance isolation for work submission across VFs and may be appropriate for a small to moderate number of VFs. For devices that support a large number of VFs (where a separate SWQ per VF is impractical), a single SWQ may be shared across multiple VFs. Even in this case, each VF has its own private SWQ_REG in its VF BAR, but is backed by a common SWQ across VFs that share the SWQ. For such device designs, the VFs that share the SWQ may be statically determined by the hardware design, or the mapping between a given VF's SWQ_REG to an SWQ instance may be dynamically set up / toned down through the physical function and its driver. Device designs that share an SWQ across VFs must pay special attention to QoS and protection against denial-of-service attacks, as described later in this section. When sharing an SWQ across VFs, care must be taken in the device design to identify which VF received an enqueue request that was accepted into the SWQ. When dispatching work requests from the SWQ, devices should ensure that upstream requests are properly tagged with the requestor ID (bus / device / function #) of each VF (in addition to the PASID carried in the enqueue request payload).

[0710] Enqueue Non-Posted Write Addresses: Endpoint devices that support SWQ are required to accept enqueue non-posted writes to any addresses routed through these PF or VF memory BARs. For any enqueue non-posted write request received by an endpoint device to an address that is not an SWQ_REG address, the device may be required not to treat this as an error (e.g., a malformed TLP) but instead return a completion with a retry completion status (MRS). This may be done to ensure that unprivileged (ring 3 or ring 0 VMX guest) software use of the ENQCMD / S instruction to mistakenly or maliciously issue an enqueue store to a non-SWQ_REG address on an SWQ-capable device cannot result in reporting a non-fatal or fatal error with platform-specific error handling consequences.

[0711] Non-enqueue request handling for SWQ_REG: Endpoint devices that support SWQ may silently drop non-enqueue requests (normal memory writes and reads) to the SWQ_REG address without treating them as fatal or non-fatal errors. Read requests to the SWQ_REG address may return a successful completion response (as opposed to UR or CA) with all-ones values ​​for the requested data bytes. Normal memory (posted) write requests to the SWQ_REG address are simply dropped without action by the endpoint device. This may be done to ensure that unprivileged software cannot generate normal read and write requests to the SWQ_REG address in a way that causes non-fatal or fatal errors to be reported erroneously or maliciously, with platform-specific error handling consequences.

[0712] SWQ Queue Depth and Storage: SWQ queue depth and storage are specific to the device implementation. The device design should ensure that sufficient queue depth is supported for the SWQ to achieve maximum device utilization. Storage for the SWQ may be implemented on the device. Integrated devices on an SoC may use stolen main memory (non-OS-visible private memory reserved for device use) as the SWQ buffer overflow, allowing for larger SWQ queue depths than can be achieved with on-device storage. For such designs, the use of buffer overflow is transparent to software because the device hardware decides when to overflow (versus dropping the enqueue request and sending a retry completion status), fetch from the buffer overflow for command execution, and maintain any command-specific ordering requirements. For all purposes, such buffer overflow usage is equivalent to a separate device using local device-attached DRAM for SWQ storage. Device designs involving buffer overflow in stolen memory must be very careful to ensure that such stolen memory is protected from any access other than reading and writing the buffer overflow by the device to which it is allocated.

[0713] Non-Blocking SWQ Behavior: For performance reasons, device implementations should respond quickly to enqueue non-posted write requests with success or retry completion status and should not block enqueue completion of SWQ capacity to be freed up to accept the request. The decision to accept or reject an enqueue request to an SWQ may be based on capacity, QoS / occupancy, or other policies. Some exemplary QoS considerations are described next.

[0714] SWQ QoS Considerations: For enqueue non-posted writes targeted to an SWQ_REG address, an endpoint device may apply admission control to decide whether to accept the request for the respective SWQ (and send a successful completion status) or drop it (and send a retry completion status). Admission control may be device- and usage-specific, and the specific policies supported / enforced by the hardware may be exposed to software through the Physical Function (PF) driver interface. Because the SWQ is a shared resource with multiple producer clients, the device implementation must ensure appropriate protection against denial-of-service attacks across producers. QoS for an SWQ refers solely to the acceptance of work requests (through enqueue requests) for the SWQ and is orthogonal to any QoS applied by the device hardware regarding how QoS is applied to share the device's execution resources when processing work requests submitted by different producers. Several exemplary approaches for configuring endpoint devices to enforce admission policies for accepting enqueue requests for an SWQ are described below. These are listed for illustrative purposes only; the exact implementation choice is device-specific.

[0715] In one embodiment, the MOVDIRI instruction moves a doubleword integer in a source operand (second operand) to a destination operand (first operand) using a direct store operation. The source operand may be a general-purpose register. The destination operand may be a 32-bit memory location. In 64-bit mode, the default operation size of the instruction is 32 bits. MOVDIRI defines the destination to be doubleword or quadword aligned.

[0716] Direct stores may be implemented by using the write combining (WC) memory type protocol for writing data. Using this protocol, the processor neither writes the data to the cache hierarchy nor fetches the corresponding cache line from memory to the cache hierarchy. If the destination address is cached, the line is written back (if modified) and invalidated from the cache before the direct store. Unlike stores with non-transient implications, which allow uncached (UC) and write-protected (WP) memory types for the destination to override the non-transient implications, direct stores always follow the WC memory type protocol regardless of the destination address memory type (including UC and WP types).

[0717] Unlike WC stores and stores with non-transient impliedness, direct stores are subject to immediate eviction from the write combining buffer and therefore cannot be combined with younger stores (including direct stores) to the same address. Older WC and non-transient stores held in the write combining buffer may be combined with younger direct stores to the same address.

[0718] Since the WC protocol used by direct stores follows a weakly ordered memory consistency model, the fencing process should follow the MOVDIRI instruction to enforce ordering when necessary.

[0719] Direct stores issued by MOVDIRI to a destination are aligned on a 4-byte boundary to guarantee atomicity of 4-byte write completion. This means that the data arrives at the destination in a single, non-tone 4-byte (or 8-byte) write transaction. If the destination is not aligned to the write size, a direct store issued by MOVDIRI arrives at the destination split into two parts. The parts of such a split direct store do not merge with the younger store, but can arrive at the destination in any order.

[0720] Figure 59 illustrates an embodiment of a method performed by a processor to process a MOVDIRI instruction, for example, where hardware details are used.

[0721] An instruction is fetched at 5901. For example, MOVDIRI is fetched. The MOVDIRI instruction includes an opcode (and, in some embodiments, a prefix), a destination field representing a destination operand, and a source field representing a source register operand.

[0722] The fetched instruction is decoded at 5903. For example, the MOVDIRI instruction is decoded by a decode circuit as described in detail herein.

[0723] Data values ​​associated with source operands of the decoded instruction are obtained at 5905. Additionally, in some embodiments, the instruction is scheduled.

[0724] At 5907, the decoded instruction is executed by execution circuitry (hardware) as described in detail herein, which moves double-word sized data from source register operands to destination register operands without caching the data.

[0725] In some embodiments, at 5909, the instruction is committed or retired.

[0726] Moves 64 bytes from a source memory address to a destination memory address as a direct store with 64-byte write atomicity. The source operand is a regular memory operand. The destination operand is a memory location specified in a general-purpose register. The register contents are interpreted as an offset into the ES segment without any segment overrides. In 64-bit mode, the register operand width is 64 bits (or 32 bits). Outside 64-bit mode, the register width is 32 bits or 16 bits. MOVDIR64B requires that the destination address is 64-byte aligned. There are no alignment restrictions enforced on the source operand.

[0727] MOVDIR64B reads 64 bytes from the source memory address and performs a 64-byte direct store operation to the destination address. The load operation follows normal read ordering based on the memory type of the source address. The direct store is implemented by using the write combining (WC) memory type protocol for writing data. Using this protocol, the processor does not need to write the data to the cache hierarchy and does not need to fetch the corresponding cache line from memory to the cache hierarchy. If the destination address is cached, the line is written back (if modified) and invalidated from the cache before the direct store.

[0728] Unlike stores with non-transient implications, which allow the UC / WP memory type for the destination to override the non-transient implications, direct stores may follow the WC memory type protocol regardless of the destination address memory type (including UC / WP types).

[0729] Unlike WC stores and stores with non-transient impliedness, direct stores are subject to immediate eviction from the write combining buffer and therefore cannot be combined with younger stores (including direct stores) to the same address. Older WC and non-transient stores held in the write combining buffer may be combined with younger direct stores to the same address.

[0730] The WC protocol used by direct stores follows a weakly ordered memory consistency model, so the fencing process should follow the MOVDIR64B instruction to enforce ordering when necessary.

[0731] There are no atomicity guarantees provided for 64-byte load operations from a source address; processor implementations may use multiple load operations to read the 64 bytes. The 64-byte direct store issued by MOVDIR64B guarantees atomicity of the 64-byte write completion, meaning that the data arrives at the destination in a single, non-tone 64-byte write transaction.

[0732] Figure 60 illustrates an embodiment of a method performed by a processor to process the MOVDIRI64B instruction, for example,...

Claims

1. a first plurality of cores having a first microarchitecture; a second plurality of cores having a second microarchitecture different from the first microarchitecture; an interconnect coupled to the first and second plurality of cores; an accelerator coupled to the interconnect for performing matrix processing operations; Equipped with The accelerator comprises: an array of multiply-and-accumulate units operable in response to a multiply-and-accumulate instruction to perform a multiply-and-accumulate operation on a first plurality of data elements of a first matrix and a second plurality of data elements of a second matrix; a plurality of memories associated with the array of multiply-accumulate units for storing the first plurality of data elements and the second plurality of data elements; having Each multiply-accumulate unit in the array of multiply-accumulate units comprises: a multiplication circuit for multiplying each data element of the subset of the first plurality of data elements by a corresponding data element of the subset of the second plurality of data elements to generate a corresponding plurality of products; a summation circuit for summing the products to generate a corresponding one of a plurality of result data elements; having An integrated circuit, wherein at least one core of the first plurality of cores or the second plurality of cores is configured to execute program code for scheduling operations of the matrix processing.

2. a first multiply-accumulate unit in the array of multiply-accumulate units for generating a first plurality of result data elements using a first plurality of product data elements; the first plurality of result data elements become a second plurality of multiply-accumulate data elements for a second multiply-accumulate unit in the array of multiply-accumulate units; 2. The integrated circuit of claim 1, wherein the second multiply-accumulate unit generates a second plurality of result data elements using the second plurality of product data elements.

3. The integrated circuit of claim 1 or 2, further comprising at least one scalar core coupled to the interconnect for performing scalar operations.

4. the first plurality of data elements comprises a first block of data elements of a first block size; 4. An integrated circuit as claimed in claim 1, wherein the second plurality of data elements comprises a second block of data elements of the first block size.

5. each core of the first plurality of cores comprises a single instruction multiple data (SIMD) core; The integrated circuit of claim 1 , wherein each core of the second plurality of cores comprises an out-of-order execution core.

6. 6. The integrated circuit of claim 1, wherein the plurality of memories comprises a plurality of different types of on-chip memories, including one or more cache memories.

7. 7. The integrated circuit of claim 6, further comprising a coherency circuit for maintaining coherency of data stored in at least a portion of said plurality of different types of on-chip memories.

8. a subset of the on-chip memory is associated with the accelerator; 8. An integrated circuit as claimed in claim 6 or 7, wherein each on-chip memory in the subset of on-chip memories is associated with one of the multiply-accumulate units.

9. 9. The integrated circuit of claim 8, further comprising a controller that loads the first and second plurality of data elements from an external memory into one or more on-chip memories of the subset of on-chip memories.

10. 10. The integrated circuit of claim 9, wherein the controller stores the result data elements from the one or more on-chip memories of the subset of the on-chip memories in the external memory.

11. The integrated circuit of claim 1 , further comprising an FPGA-based accelerator coupled to the interconnect.

Citation Information

Patent Citations

  • Parallel processing method for matrix operation

    JP1994175986A

  • High speed and efficient matrix multiplication hardware module

    JP2009026308A

  • Method for booting heterogeneous system and presenting symmetric core view

    JP2014225242A

  • Automatic load balancing for heterogeneous cores

    JP2014513373A

  • Power-efficient processor architecture

    JP2014528115A