Methods and systems for speculative execution and resetting

The system enables continuous pipeline processing during speculative instruction execution by issuing instructions without decoding and predicting branches, addressing inefficiencies in conventional processors by maintaining throughput through conditional rollback and reissuance of instructions.

DE102012220029B4Active Publication Date: 2024-12-05NVIDIA CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
DE102012220029
Authority / Receiving Office
DE · DE
Patent Type
Patents
Current Assignee / Owner
Priority Date
2011-11-04
Filing Date
2012-11-02
Publication Date
2024-12-05
Estimated Expiration
2032-11-02

AI Technical Summary

Technical Problem

Conventional pipelined processors face inefficiencies during speculative execution of conditional branch instructions, as they require idle pipeline stages when predictions are incorrect, limiting the processing pipeline's ability to continue executing other instructions.

Method used

A system and method for speculatively issuing instructions that allow the processing pipeline to continue processing some instructions while rolling back others, using a scheduler circuit to dispatch instructions without decoding and predicting branch outcomes, ensuring dependencies and operand availability before execution, and reissuing instructions when reset conditions are resolved.

Benefits of technology

This approach maintains pipeline efficiency by allowing continuous processing during instruction rollbacks, enhancing throughput by executing instructions that do not encounter reset conditions while efficiently handling and reissuing those that do.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

Method for performing a reset of speculatively issued instructions, wherein the method comprises: Issue an initial set of instructions to an initial thread group (405); Issue a second set of instructions to a second thread group (405); Detecting a reset condition for at least one thread in the first thread group during pre-execution processing of an instruction in the first set of instructions (415); Stop issuing additional instructions for the first thread group (425); Discarding in-flight instructions that have been issued and not carried out in the first set of instructions (430); and Executing the second set of instructions for the second thread group (445), wherein, once the reset condition has been removed or corrected, a program counter for the first thread group is updated and reset instructions for the first thread group are fetched and issued, starting at the updated program counter.
Need to check novelty before this filing date? Find Prior Art

Description

BACKGROUND OF THE INVENTIONField of the invention

[0001] The present invention relates generally to the execution of computational tasks, and more particularly to speculative instruction execution and rollback.

[0002] US 2009 / 0217020 A1 discloses a system in which software is processed in parallel threads by organizing instructions of the threads into commit groups. In the event of an incorrect prediction, a rollback of the corresponding commit group of the corresponding thread is performed, leaving other threads unaffected.

[0003] The basic knowledge relevant to the invention can also be found in the lecture “Branch Prediction and Speculative Execution”, ARVIND: Computer System Architecture, Computer Science and Artificial Intelligence Laboratory (MIT), 2005. URL: https: / / ocw.mit.edu / courses / electrical-engineering-and - computer-science / 6-823-computer-system-architecture-fall-2005 / (accessed on January 12, 2017). Description of the technology in question

[0004] Conventional pipelined processors performed speculative execution of conditional branch instructions by predicting which side of the conditional branch would be executed. If the prediction is incorrect, the instructions are rolled back so that the other side of the conditional branch can be executed. When instructions are rolled back, pipeline stages are idle until the instructions for the other side of the conditional branch reach those pipeline stages.

[0005] Accordingly, what is needed in the art is a system and method for speculatively issuing instructions, allowing the processing pipeline to continue processing some instructions while rolling back other instructions. Importantly, speculative execution should not be limited to conditional branch instructions. SUMMARY OF THE INVENTION

[0006] A system and method for speculatively issuing instructions allows a processing pipeline to continue processing some instructions while rolling back other instructions. A scheduler circuit dispatches instructions for execution by multithreaded execution units under the assumption that several cycles later, when the instructions reach the multithreaded execution units, dependencies between the instructions will be resolved, resources will be available, operand data will be available, and other conditions will not prevent execution of the instructions. If a rollback condition exists at the point of execution for an instruction for a particular thread group, then the instruction is not dispatched to the multithreaded execution units.However, other instructions issued by the scheduler circuit for execution by different thread groups, and for which a rollback condition does not exist, are executed by the multi-threaded execution units. The instruction that suffered the rollback condition is reissued after the rollback condition no longer exists.

[0007] Various embodiments of a method of the invention for performing a rollback of speculatively issued instructions correspond to independent claims 1 and 2.

[0008] Various embodiments of a system of the invention for performing a rollback of speculatively issued or issued instructions are as set forth in independent claims 3 and 4.

[0009] Importantly, speculative instruction dispatch is not limited to conditional branch instructions. The scheduler circuit does not decode the instructions and therefore does not perform any predictive operations. If any instruction for a particular thread group encounters a rollback condition (incurs), as late as the point of execution, the instruction is not executed, and rollback is performed for the instruction and other instructions already issued for the particular thread group. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] So that the above-cited features of the present invention may be understood in detail, a particular description of the invention, briefly summarized above, may be taken by reference to embodiments, some of which are illustrated in the accompanying drawings. It is to be noted, however, that the accompanying drawings illustrate only typical embodiments of this invention and are therefore not to be construed as limiting its scope, for the invention may admit to other equally effective embodiments. Fig. 1 is a block diagram illustrating a computer system configured to implement one or more aspects of the present invention; Fig. 2 is a block diagram of a parallel processing subsystem for the computer system of the Fig. 1, according to an embodiment of the present invention; Fig. 3A is a block diagram of the frontend of Fig. 2 according to an embodiment of the present invention; Fig. Figure 3B is a block diagram of a general processing cluster within one of the parallel processing units of Fig. 2 according to an embodiment of the present invention; Fig. Figure 3C is a block diagram of a portion of the Streaming Multiprocessor (SM) of Fig. 3B according to an embodiment of the present invention; Fig. 4A illustrates a speculative instruction issuance and instruction reset method according to an embodiment of the present invention; and Fig. 4B illustrates a speculative instruction execution and partial instruction rollback method according to an embodiment of the invention. DETAILED DESCRIPTION

[0011] In the following description, numerous specific details are set forth in order to provide a more thorough understanding of the present invention. However, it will be apparent to one skilled in the art that the present invention may be practiced without one or more of these specific details. In other instances, well-known features have not been described to avoid obscuring the present invention. System overview

[0012] Fig. 1 is a block diagram illustrating a computer system 100 configured to implement one or more aspects of the present invention. Computer system 100 includes a central processing unit (CPU) 102 and system memory 104 communicating via an interconnection path, which may include a memory bridge 105. Memory bridge 105, which may be, for example, a northbridge chip, is connected to an I / O (input / output) bridge 107 via a bus or other communication path 106 (e.g., HyperTransport link). I / O bridge 107, which may be, for example, a southbridge chip, receives user input from one or more user input devices 108 (e.g., keyboard, mouse) and forwards the input to CPU 102 via path 106 and memory bridge 105. A parallel processing subsystem 112 is connected to the memory bridge 105 via a bus or other communication path 113 (e.g.a PCI Express Accelerated Graphics Port, or HyperTransport link); in one embodiment, the parallel processing subsystem 112 is a graphics subsystem that provides pixels to a display device 110 (e.g., a conventional CRT or LCD-based monitor). A system board 114 is also connected to the I / O bridge 107. A switch 116 provides connections between the I / O bridge 107 and other components, such as a network adapter 118 and various add-in cards 120 and 121. Other components (not explicitly shown), including USB or other port connections, CD drives, DVD drives, movie capture devices, and the like, may also be connected to the I / O bridge 107. Communication paths connecting the various components in . Fig. 1 interconnect may be implemented using any suitable protocols, such as PCI (Peripheral Component Interconnect), PCI-Express, AGP (Accelerated Graphics Port), HyperTransport, or any bus or point-to-point communication protocol(s), and connections between different devices may use different protocols, as is known in the art.

[0013] In one embodiment, the parallel processing subsystem 112 incorporates circuitry optimized for graphics and video processing, including, for example, video output circuitry, and constitutes a graphics processing unit (GPU). In another embodiment, the parallel processing subsystem 112 includes circuitry optimized for general-purpose processing while maintaining the underlying computer architecture described in greater detail herein. In yet another embodiment, the parallel processing subsystem 102 may be integrated with one or more other system elements, such as the memory bridge 105, CPU 102, and I / O bridge 107, to form a system-on-chip (SoC).

[0014] It will be appreciated that the system shown herein is illustrative and that variations and modifications are possible. The interconnect topology, including the number and arrangement of bridges, the number of CPUs 102, and the number of parallel processing subsystems 112, can be modified as desired. For example, in some embodiments, system memory 104 is directly coupled to CPU 102 rather than through a bridge, and other devices communicate with system memory 104 via memory bridge 105 and CPU 102. In other alternative topologies, parallel processing subsystem 112 is connected to I / O bridge 107 or directly to CPU 102 rather than to memory bridge 105. In still other embodiments, I / O bridge 107 and memory bridge 105 may be integrated into a single chip. Large embodiments may include two or more CPUs 102 and two or more parallel processing subsystems 112.The specific components shown herein are optional; for example, any number of add-on cards or peripheral devices could be supported. In some embodiments, switch 116 is eliminated, and network adapter 116 and add-on cards 120, 121 connect directly to I / O bridge 107.

[0015] Fig. Figure 2 illustrates a parallel processing subsystem 112 according to an embodiment of the present invention. As shown, the parallel processing subsystem 112 includes one or more parallel processing units (PPUs) 202, each of which is coupled to a local parallel processing (PP) memory 204. In general, a parallel processing subsystem includes a number U of PPUs, where U ≥ 1 (herein, multiple instances of similar objects are denoted by reference numbers identifying the object, and numbers in parentheses identify the instance, if needed). PPUs 202 and parallel processing memory 204 may be implemented using one or more integrated circuit devices, such as programmable processors, application-specific integrated circuits (ASICs), or memory devices, or in any other technically feasible manner.

[0016] With reference again to Fig. 1, in some embodiments, some or all of the PPUs 202 in the parallel processing subsystem 112 are graphics processors with render pipelines that may be configured to perform various tasks including generating pixel data from graphics data supplied by the CPU 102 and / or system memory 104 via memory bridge 105 and communication path 113, interacting with local parallel processing memory 204 (which may be used as graphics memory, including, for example, a conventional frame buffer) to store and update pixel data, delivering pixel data to the display device 110, and the like. In some embodiments, the parallel processing subsystem 112 may include one or more PPUs 202 that operate as graphics processors and one or more other PPUs 202 that may be used for general-purpose computations.The PPUs may be identical or different, and each PPU may have its own dedicated parallel processing memory device(s) or may not have dedicated parallel processing memory device(s). One or more PPUs 202 may output data to the display device 110, or each PPU 202 may output data to one or more display devices 110.

[0017] In operation, CPU 102 is the master processor of computer system 100, which controls and coordinates operations of other system components. In particular, CPU 102 issues instructions that control the operation of PPUs 202. In some embodiments, CPU 102 writes a stream of instructions for each PPU 202 to a data structure (not explicitly described in either Fig. 1 more Fig. 2), which may be located in system memory 104, parallel processing memory 204, or any other memory location accessible to both CPU 102 and PPU 202. A pointer to each data structure is written to a push buffer to initiate processing of the stream of instructions in the data structure. PPU 202 reads instruction streams from one or more push buffers and then executes instructions asynchronously relative to the operation of CPU 102. Execution priorities may be specified for each push buffer to control scheduling of the various push buffers.

[0018] With reference now back to Fig. 2B, each PPU 202 includes an I / O (input / output) unit 205 that communicates with the rest of computer system 100 via communication path 113, which connects to memory bridge 105 (or, in another embodiment, directly to CPU 102). The connection of PPU 202 to the rest of computer system 100 can also be varied. In some embodiments, parallel processing subsystem 112 is implemented as an add-on card that can be inserted into an expansion slot of computer system 100. In other embodiments, a PPU 202 can be integrated on a single chip with a bus bridge, such as memory bridge 105 or I / O bridge 107. In still other embodiments, some or all elements of PPU 202 can be integrated on a single chip with CPU 102.

[0019] In one embodiment, communication path 113 is a PCI Express link in which dedicated lanes are allocated to each PPU 202, as is known in the art. Other communication paths may also be used. An I / O unit 205 generates packets (or other signals) for transmission on communication path 113 and also receives any incoming packets (or other signals) from communication path 113, directing the incoming packets to the appropriate components of PPU 202. For example, commands relating to processing tasks may be directed to a host interface 206, while commands relating to memory operations (e.g., reading from or writing to parallel processing memory 204) may be directed to a memory crossbar unit 202.Host interface 206 reads each push buffer and outputs the work specified by the push buffer to a frontend 212.

[0020] Each PPU 202 advantageously implements a highly parallel processing architecture. As shown in detail, PPU 202(0) includes a processing cluster array 230 comprising a number C of general purpose processing clusters (GPCs) 208, where C ≥ 1. Each GPC 208 is capable of executing a large number (e.g., hundreds or thousands) of threads concurrently, where each thread is an instance of a program. In different applications, different GPCs 208 may be allocated to process different types of programs or to perform different types of computations. The allocation of GPCs 208 may vary depending on the workload encountered for each type of program or computation.

[0021] GPCs 208 receive processing tasks to be executed from a work distribution unit within a task / work unit 207. The work distribution unit receives pointers to computational processing tasks (task pointers) encoded as queue metadata (QMD) and stored in memory. The task pointers to QMDs are included in the instruction stream, which is stored in a shift buffer and received from the host interface 206 via the front-end unit 212. Processing tasks, which may be encoded as QMDs, include indices of data to be processed, as well as status or state parameters and commands that define how the data is to be processed (e.g., which program is to be executed).The task / work unit 207 receives tasks from the frontend 212 and ensures that the GPCs 208 are configured in a valid state before initiating the processing specified by each of the QMDs. A priority can be specified for each QMD, which is used to schedule the execution of the processing tasks.

[0022] Memory interface 214 includes a number D of partition units 215, each directly coupled to a portion of parallel processing memory 204, where D ≥ 1. As shown, the number of partition units 215 is generally equal to the number of DRAM 220. In other embodiments, the number of partition units 215 need not be equal to the number of memory devices. Those skilled in the art will appreciate that DRAM 220 may be replaced by any other suitable memory devices and may be of a generally conventional design. A detailed description is therefore omitted. Render targets, such as frame buffers or texture maps, may be stored via DRAMs 220, allowing partition units 215 to write portions of each render target in parallel to effectively utilize the available bandwidth of parallel processing memory 204.

[0023] Any one of the GPCs 208 can process data to be written to any of the DRAMs 220 within the parallel processing memory 204. Crossbar unit 210 is configured to route the output of each GPC 208 to the input of any partition unit 215 or to any GPC 208 for further processing. GPCs 208 communicate with the memory interface 214 through the crossbar 210 to write to or read from various external storage devices. In one embodiment, the crossbar unit 210 has a connection to memory interface 214 to communicate with I / O unit 205, as well as a connection to local parallel processing memory 204, thereby enabling the processing cores within the various GPCs 208 to communicate with system memory 104 or other memory that is not local to the PPU 202. In the Fig. In the embodiment shown in Figure 2, the crossbar unit 210 is directly connected to the I / O unit 205. The crossbar unit 210 can use virtual channels to separate traffic flows between the GPCs 208 and the partition units 215.

[0024] In turn, GPCs 208 may be programmed to perform processing tasks relating to a wide variety of applications, including, but not limited to, linear or non-linear data transformations, filtering of video and / or audio data, modeling operations (e.g., applying the laws of physics to determine position, velocity, and other attributes of objects), image rendering operations (e.g., tessellation shading, vertex shading, geometry shading, and / or pixel shading programs), etc.PPUs 202 may transfer data from system memory 104 and / or local parallel processing memory 204 to internal (on-chip) memory, process the data, and write result data back to system memory 104 and / or local parallel processing memory 204, where such data may be accessed by other system components, including CPU 102 or another parallel processing subsystem 112.

[0025] A PPU 202 may be provided with any amount of local parallel processing memory 204, including no local memory, and may use local memory and system memory in any combination. For example, a PPU 202 may be a graphics processor in a unified memory architecture (UMA) embodiment. In such embodiments, little or no dedicated graphics (parallel processing) memory would be provided, and PPU 202 would exclusively or almost exclusively use system memory. In UMA embodiments, a PPU 202 may be integrated into a bridge chip or processor chip, or provided as a discrete chip with a high-speed link (e.g., PCI Express) connecting the PPU 202 to system memory via a bridge chip or other communication means.

[0026] As noted above, any number of PPUs 202 may be included in a parallel processing subsystem 112. For example, multiple PPUs 202 may be provided on a single add-on card, or multiple add-on cards may be connected to the communication path 113, or one or more of the PPUs 202 may be integrated into a bridge chip. PPUs 202 in a multi-PPU system may be identical or different from one another. For example, different PPUs 202 could have different numbers of processing cores, different amounts or sizes of local parallel processing memory, etc. Where multiple PPUs 202 are present, these PPUs may be operated in parallel to process data at a higher throughput than is possible with a single PPU 202.Systems incorporating one or more PPUs 202 may be implemented in a variety of configurations and form factors, including desktop computers, laptop computers, or handheld personal computers, servers, workstations, game consoles, embedded systems, and the like. Multiple concurrent task scheduling

[0027] Multiple processing tasks can be executed concurrently on the GPCs 208, and a processing task can spawn one or more child processing tasks during execution. The task / work unit 207 receives the tasks and dynamically schedules the processing tasks and child processing tasks for execution by the GPCs 208.

[0028] Fig. Figure 3A is a block diagram of the task / work unit 207 of the Fig. 2, according to one embodiment of the present invention. The task / work unit 207 includes a task management unit 300 and the work distribution unit 340. The task management unit 300 organizes tasks to be scheduled based on execution priority levels. For each priority level, the task management unit 300 stores a list of task pointers to the QMDs 322 corresponding to the tasks in the scheduler table 321. The QMDs 322 can be stored in the PP memory 204 or system memory 104. The rate at which the task management unit 300 accepts tasks and stores the tasks in the scheduler table 321 is decoupled from the rate at which the task management unit 300 schedules tasks for execution, allowing the task management unit 300 to schedule tasks based on priority information or using other techniques.

[0029] The work distribution unit 340 includes a task table 345 with slots, each of which may be occupied by the QMD 322 for a task being executed. The task management unit 300 may schedule tasks for execution if there is a free slot in the task table 345. If there is no free slot, a higher-priority task that does not occupy a slot may displace or evict a lower-priority task that does occupy a slot. When a task is displaced or evicted, the task is stopped, and if the task's execution is not complete, the task is added to a linked list in the scheduler table 321. When a child processing task is created, the child task is added to the linked list in the scheduler table 321. A task is removed from a slot when the task is evicted. Task processing overview

[0030] Fig. 3B is a block diagram of a GPC 208 within one of the PPUs 202 of the Fig. 2, according to one embodiment of the present invention. Each GPC 208 may be configured to execute a large number of threads in parallel, where the term "thread" refers to an instance of a particular program executing on a particular set of input data. In some embodiments, single-instruction, multiple-data (SIMD) instruction issuing techniques are used to support parallel execution of a large number of threads without providing multiple independent instruction units. In other embodiments, single-instruction, multiple-thread (SIMT) techniques are used to support parallel execution of a large number of generally synchronized threads using a common instruction unit configured to issue instructions to a set of processing engines within each of the GPCs 208.Unlike a SIMD execution regime, where all processing engines typically execute identical instructions, SIMT execution allows different threads to more easily follow divergent execution paths through a given threaded program. Those skilled in the art will understand that a SIMD processing regime represents a functional subset of a SIMT processing regime.

[0031] Operation of GPC 208 is advantageously controlled via a pipeline manager 305, which distributes processing tasks to streaming multiprocessors (SMs) 310. Pipeline manager 305 may also be configured to control a work distribution crossbar 330 by specifying destinations for processed data outputs via SMs 310.

[0032] In one embodiment, each GPC 208 comprises a number M of SMs 310, where M ≥ 1, with each SM 310 configured to process one or more thread groups. Also, each SM 310 advantageously comprises an identical set of functional execution units (shown as Exec units 302 in Fig. 3C), which may be pipelined, allowing a new instruction to be issued before a previous instruction has completed, as is known in the art. Any combination of functional execution units may be provided. In one embodiment, the functional units support a variety of operations, including integer and floating-point arithmetic (e.g., addition and multiplication), comparison operations, Boolean operations (AND, OR, XOR), bit shifting, and computing various algebraic functions (e.g., planar interpolation, trigonometric, exponential, and logarithmic functions); and the same functional unit hardware may be employed to perform various operations.

[0033] The series of instructions submitted to a particular GPC 208 constitutes a thread, as previously defined herein, and the collection of a certain number of simultaneously executing threads across the parallel processing engines (not shown) within an SM 310 is referred to herein as a "warp" or "thread group." As used herein, a "thread group" refers to a group of threads that simultaneously execute the same program on different input data, with one thread of the group being assigned to a different processing engine within an SM 310. A thread group may include fewer threads than the number of processing units within the SM 310, in which case some processing engines will be idle during cycles when that thread group is being processed.A thread group may also include more threads than the number of processing engines within SM 310, in which case processing will occur over subsequent clock cycles. Since each SM 310 can support up to G thread groups simultaneously, it follows that up to G*M thread groups can execute at a given time in GPC 208.

[0034] Additionally, a plurality of related thread groups may be active (in different phases of execution) at the same time within an SM 310. This collection of thread groups is referred to herein as a "cooperative thread array" ("CTA") or "thread array." The size of a particular CTA is m*k, where k is the number of concurrently executing threads in a thread group and is typically an integer multiple of the number of parallel processing units within the SM 310, and where m is the number of thread groups that are simultaneously active within the SM 310. The size of a CTA is generally determined by the programmer and by the amount of hardware resources, such as memory or registers, available to the CTA.

[0035] Each SM 310 contains an (L1) cache (in Fig. 3C) or uses space in a corresponding L1 cache external to SM 310, which is used to perform load and store operations. Each SM 310 also has access to level two (L2) caches, which are shared among all GPCs 208 and can be used to transfer data between threads. Finally, SMs 310 have access to off-chip "global" memory, which may include, for example, parallel processing memory 204 or system memory 104. It is understood that any memory external to PPU 202 may be used as global memory. Additionally, a level one point five (L1.5) cache 335 may be included within GPC 208, which is configured to receive and hold data fetched from memory via memory interface 214, requested by SM 310, including instructions, uniform data, and constant data, and provide the requested data to SM 310.Embodiments having multiple SMs 310 in GPC 208 advantageously share common instructions and data cached in L1.5 cache 335.

[0036] Each GPC 208 may include a memory management unit (MMU) 328 configured to map virtual addresses to physical addresses. In other embodiments, MMU(s) 328 may reside within the memory interface 214. The MMU 328 includes a set of page table entries (PTEs) used to map a virtual address to a physical address of a tile and, optionally, a cache line index. The MMU 328 may include address translation lookaside buffers (TLBs) or caches, which may reside within the multiprocessor SM 310 or the L1 cache or GPC 208. The physical address is processed to distribute surface data access locality to allow efficient query interleaving among partition units.The cache line index can be used to determine whether a request for a cache line is a hit or a miss.

[0037] In graphics and computing applications, a GPC 208 may be configured such that each SM 310 is coupled to a texture unit 315 for performing texture mapping operations, e.g., determining texture sample positions, reading texture data, and filtering the texture data. Texture data is read from an internal texture L1 cache (not shown) or, in some embodiments, from the L1 cache within SM 310, and is fetched from an L2 cache, parallel processing memory 204, or system memory 104 as needed. Each SM 310 issues processed tasks to the work distribution crossbar 330 to provide the processed task to another GPC 208 for further processing or to store the processed task in an L2 cache, parallel processing memory 204, or system memory 104 via crossbar unit 210.A preROP (preraster operations) 325 is configured to receive data from SM 310, direct data to ROP units within the partition units 215, and perform optimizations for color mixing, organize pixel color data, and perform address translations.

[0038] It will be appreciated that the core architecture described herein is illustrative and that variations and modifications are possible. Any number of processing units, e.g., SMs 310 or texture units 315, preROPs 325, may be included within a GPC 208. While only one GPC 208 is shown, a PPU 202 may include any number of GPCs 208, which are advantageously functionally similar to one another so that execution behavior does not depend on which GPC 208 receives a particular processing task. Further, each GPC 208 advantageously operates independently of other GPCs 208 using separate and distinct processing units, L1 caches, etc.

[0039] Those in the technical field will understand that the Fig. 1, Fig. 2, Fig. 3A and Fig. 3B in no way limits the scope of the present invention and that the techniques taught herein may be implemented on any properly configured processing unit, including without limitation one or more CPUs, one or more multi-core CPUs, one or more PPUs 202, one or more GPCs 208, one or more graphics or special-purpose processing units, or the like, without departing from the scope of the present invention.

[0040] In embodiments of the present invention, it is desirable to use the PPU 202 or other processor(s) of a computer system to perform general-purpose computations using thread arrays. Each thread in the thread array is assigned a unique thread identifier ("thread ID") that is accessible to the thread during its execution. The thread ID, which can be defined as a one-dimensional or multi-dimensional numeric value, controls various aspects of the thread's processing behavior. For example, a thread ID can be used to determine which portion of an input data set a thread should process and / or to determine which portion of an output data set a thread should generate or write.

[0041] A sequence of per-thread instructions may include at least one instruction that defines cooperative behavior between the representative thread and one or more other threads of the thread array. For example, the sequence of per-thread instructions might include an instruction to suspend execution of operations for the representative thread at a particular point in the sequence until one or more of the other threads reach that particular point, an instruction for the representative thread to store data in a shared memory accessible to one or more of the other threads, an instruction for the representative thread to atomically read and update data stored in a shared memory accessible to one or more of the other threads based on their thread IDs, or the like.The CTA program may also include an instruction to calculate an address in the shared memory from which data is to be read, where the address is a function of the thread ID. By defining appropriate functions and providing synchronization techniques, data can be written to a specific location in the shared memory by one thread of a CTA and read from that location by a different thread of the same CTA in a predictable manner. Thus, any desired pattern of data sharing among threads can be supported, and any thread in a CTA can share data with any other thread in the same CTA.The extent, if any, of data sharing among threads of a CTA is determined by the CTA program; thus, it is understood that in a particular application using CTAs, the threads of a CTA may or may not actually share data with each other, depending on the CTA program, and the terms "CTA" and "thread field" are used interchangeably herein. Speculative instruction issuing and resetting

[0042] Fig. 3C is a block diagram of the SM 310 from Fig. 3B according to one embodiment of the present invention. The SM 310 includes an instruction L1 cache 370 configured to receive instructions from memory via L1.5 cache 335. A warp scheduler and instruction unit 312 receives instructions from the instruction L1 cache 370 and issues instructions to the instruction pipeline 324. The instruction issuing process is speculative because the warp scheduler and instruction unit 312 is not configured to perform any decoding of the instructions. Therefore, the instructions are issued speculatively without determining anything about the instructions, e.g., the instruction type, number of source or destination operations, and the like.

[0043] The instruction pipeline 324 performs pre-execution instruction operations, such as instruction decoding and data verification. The instruction pipeline 324 gathers operands for the instructions, accesses the local register file 304, the memory and cache interconnect 380, shared memory 306, and L1 cache 320 according to the instructions to read and write operands. During the pre-execution instruction operations, the instruction pipeline 324 may determine that a rollback condition has occurred. The instruction pipeline 324 indicates whether a rollback condition has occurred by setting a rollback flag and provides rollback code that identifies the reason for the rollback condition. The instruction pipeline 324 outputs the processed instructions, the reset flag, and the reset code to the dispatch unit 326.

[0044] The dispatch unit 326 maintains a resource scoreboard and status information for the threads and thread groups executing in the N exec (execute or process) units 302. The dispatch unit 326 receives the processed instructions, the rollback flag, and rollback code from the instruction pipeline 324 and, if a rollback condition has not yet been identified by the instruction pipeline 324, the dispatch unit 326 can determine that a rollback condition has occurred based on the resource scoreboard and status information. The rollback status includes the address of the instructions that resulted in the rollback. When a rollback condition occurs, the dispatch unit 326 outputs the rollback flag and rollback code to the warp scheduler and instruction unit 312.Otherwise, dispatch unit 326 dispatches the processed instructions for execution by exec units 302. In one embodiment, when multiple rollback conditions occur, the rollback condition reported to scheduler 312 indicates that two or more rollback conditions have occurred. In another embodiment, priority levels for the various rollback conditions are specified, and the rollback condition having the highest priority is reported to scheduler 312.

[0045] Rollback can be used to handle various error conditions, while also allowing speculative instruction issuing. When a rollback condition is identified, all in-flight instructions for the thread group that initiated the rollback should be invalidated. In-flight instructions include any instructions for the thread group that have been issued but have not yet been dispatched (committed or submitted) for execution via the exec units 302. In a first phase of the rollback operation, issuing instructions for the thread group stops, and fetching new instructions for the thread group also stops. When in-flight instructions for the thread group reach the dispatch unit 326, the in-flight instructions are discarded.In an alternative embodiment, the in-flight instructions are discarded by the warp scheduler and instruction unit 312, the instruction pipeline 324, and the dispatch unit 326, so that in-flight instructions are not passed through or passed to the dispatch unit 326. Once the rollback condition is removed or corrected, the second phase of the rollback operation begins with the warp scheduler and instruction unit 312 updating the program counter for the thread group. The warp scheduler and instruction unit 312 then fetches the rolled-back instructions from the instruction L1 cache 370, starting at the program counter, and issues the rolled-back instructions.

[0046] SM 310 provides an on-chip (internal) data memory with various access levels. Special registers (not shown) are readable but not writable by dispatch unit 326 and are used to store parameters that define the "position" of each CTA thread. In one embodiment, special registers include one register per CTA thread (or per exec unit 302 within SM 310) that stores a thread ID; each thread ID register is only accessible by a corresponding one of exec unit 302. Special registers may also include additional registers readable by all threads in the same grid or queue, which store a CTA identifier, the CTA dimensions, the dimensions of the grid to which the CTA belongs (or queue position, if a queue), and an identifier of a grid or queen to which the CTA belongs.CTAs belonging to a grid have implicit x, y, z parameters that indicate the position of the respective CTA within the grid. Special registers are written during initialization in response to commands received via frontend 212 from device driver 103 and do not change during CTA execution. Frontend 212 schedules each processing task for execution as either a grid or a queue. Each CTA is associated with a specific grid or queue for concurrent execution of one or more tasks. Additionally, a GPC 208 can execute multiple tasks concurrently.

[0047] A parameter memory (not shown) stores runtime parameters (constants) that can be read but not written by any CTA thread (or any LSU 303). In one embodiment, device driver 103 provides parameters to the parameter memory before SM 310 is directed to begin execution of a CTA that uses those parameters. Any thread within any CTA (or any exec unit 302 within SM 310) can access global memory through a memory interface 214. Portions of global memory may be stored in L1 cache 320.

[0048] The local register file 304 is used by each thread as a scratch space; each register is allocated for the exclusive use of one thread, and data in any register file 304 is accessible only by the thread to which it is allocated. The local register file 304 may be implemented as a register file physically or logically divided into P lanes, each having any number of entries (each entry could store, for example, a 32-bit word). One lane is assigned to each of the N exec units 302, and corresponding entries in different lanes may be filled with data for different threads executing the same program to enable SIMD execution.Different portions of the lanes may be allocated to different ones of the G concurrent thread groups, so that a given entry in the local register file 304 is accessible only to a particular thread. In one embodiment, certain entries within the local register file 304 are reserved for storing thread identifiers that implement one of the special registers. Additionally, a uniform L1 cache may be included within SM 310 to store uniform and constant values ​​for each lane of the N exec units.

[0049] Shared memory 306 is accessible to all threads within a single CTA; any location in shared memory 306 is accessible to any thread within the same CTA (or to any processing engine within SM 310). Shared memory 306 may be implemented as a shared register file or a shared on-chip cache with an interconnect that allows any processing engine to read from or write to any location in shared memory. In other embodiments, the shared state space may map to a per-CTA region of off-chip memory and may be cached in L1 cache 320.The parameter memory may be implemented as a designated section within the same shared register file or shared cache that implements shared memory 306, or as a separate shared register file or on-chip cache to which LSUs 303 have read-only access. In one embodiment, the area implementing the parameter memory is also used to store the CTA ID and grid ID, as well as CTA and grid dimensions or queue position, implementing portions of the special registers. SM 310 may also include a unified address mapping unit 352 that converts an address provided for load and store instructions specified in a unified memory space into an address in each distinct memory space.Consequently, an instruction can be used to access any of the local, shared, or global memory spaces by specifying an address in the unified memory space.

[0050] The L1 cache 320 in each SM 310 can be used to cache private per-thread local data as well as per-application global data. In some embodiments, the per-CTA shared data can be cached in the L1 cache 320. The instruction pipeline 324 is coupled to the shared memory 306 and the L1 cache 320 via a memory and cache interconnect 380. The instruction pipeline 324 is configured to detect a variety of reset conditions, including operands that are unavailable either due to a cache miss or because an operand has not yet been stored. For example, if a constant is not available in a constant cache, ie, a cache miss occurs, the instruction pipeline 324 indicates that a reset condition exists.A compiler typically organizes instructions so that dependent instructions are executed without delay by ensuring that any operands required by the dependent instructions are computed (as needed) and stored by previous instructions in the same or a different or different thread group. However, a rollback condition may cause instructions to be delayed for one or more thread groups. Consequently, instruction pipeline 324 may be configured to determine that a rollback condition exists when a source or destination operand is not available in memory and is required for a dependent instruction.

[0051] The instruction pipeline 324 may also be configured to detect an invalid super-scalar pair when an instruction specifies two operations that cannot be performed in parallel. When an invalid super-scalar pair is detected, a rollback condition exists, and the warp scheduler and instruction unit 312 will issue each operation as a separate instruction, i.e., the original instruction will be serialized. The instruction pipeline 324 may also be configured to detect when a source operand value is corrupted using an error-correcting code (ECC). In one embodiment, the instruction pipeline 324 is configured to correct the source operand value using ECC. In other embodiments, the instruction pipeline 324 indicates that a reset condition exists by setting the reset flag and the reset code accordingly.

[0052] Dispatch unit 326 is configured to detect a variety of rollback conditions, including scoreboard interlocks for instructions due to resource contention and due to an instruction being blocked by a synchronization barrier used to synchronize different thread groups. The synchronization barrier may not be able to complete until instructions that have not yet been issued are executed. Therefore, it is important to allow these unissued instructions to execute when needed, which involves bypassing the instruction that encountered the rollback conditions.

[0053] If an entry in the display panel or for storing status information for a thread or thread group is unavailable, the dispatch unit 326 may also determine that a rollback condition exists. In addition, if the display panel indicates that a memory or processing resource dispute exists between an instruction that has not been dispatched and an instruction that is currently executing, the dispatch unit 326 indicates that a rollback condition exists by setting the rollback flag and the rollback code accordingly. The compiler may be configured to organize the instructions for each thread group under the assumption that predetermined latencies exist for some operations. If the predetermined latencies are exceeded due to a variety of circumstances, e.g.For cache misses and reset operations, dispatch unit 326 determines that a reset condition exists based on the scoreboard contents. Instead of stalling the incoming or incoming processed instructions while waiting for the condition to resolve, dispatch unit 326 determines that a reset condition exists, and the incoming processed instructions are processed without stalling.

[0054] Because the warp scheduler and instruction unit 312 does not decode instructions before issuing the instructions to the instruction pipeline 324, the instructions are issued under the assumption that branches are not taken, that is, instructions for the fall-through path ( „Fall-through path instructions through the program are issued speculatively. If the fall-through path is not taken, a rollback condition exists. However, whenever a fall-through path is valid for a branch or jump instruction, meaning the thread group must execute the instructions in the fall-through path at one time, then no rollback occurs until after the instructions in the fall-through path have been executed. In other words, the rollback is deferred, and priority is given to the fall-through path. The dispatch unit 326 postpones the rollback by pushing a divergence token onto the execution stack for any thread in the thread group that will not take the fall-through path and will execute the branch or jump instruction.The divergence token includes the program counter for the branch or jump instruction and an active mask indicating the threads in the thread group that will execute the branch or jump path.

[0055] The active mask for each executing path group is maintained by dispatch unit 326 and is issued by warp scheduler and instruction unit 312 with each issued instruction. The active mask is initialized when a thread group begins execution of a compute task and when a divergence token is popped. Dispatch unit 326 may be configured to resolve branch operations in addition to pushing and popping entries from the execution stack.

[0056] In one embodiment, execution of fall-through paths is optimized to avoid backing out in order to take the non-fall-through path for certain circumstances. For example, if the non-fall-through path instruction is a "popper" instruction, which causes the thread executing the non-fall-through path to resume execution at the same instruction as the threads taking the fall-through path (following execution of the fall-through path), then no backing out occurs. A divergence token is not pushed onto the execution stack when the branch or jump instruction that triggered the backing out condition is detected. Examples of "popper" instructions include Exit, Return, Break, Continue, Longjump, and an instruction with an .S option, which indicates that all active threads for the thread group must synchronize before execution continues.In contrast, unconditional branch instructions including a relative call (CAL), an absolute call (JCAL), a breakpoint (BPT) or interrupt, a return-from-trap (RTT) or return from interrupt, a branch-indirect (BRX), and a jump-indirect (JMX) result in a reset condition requiring the reset operation.

[0057] If the execution stack is configured to store some entries in a cache or other entries further down the stack in graphics memory, the dispatch unit 326 may be configured to indicate that a reset condition has occurred when the execution stack is unavailable. The execution stack may be unavailable when entries are transferred from the cache to graphics memory or from graphics memory to the cache.

[0058] Fig. 4A illustrates a speculative instruction issuance and instruction reset method 400 according to an embodiment of the invention. Although the method steps are described in connection with the systems of Fig. 1, Fig. 2, Fig. 3A, Fig. 3B and Fig. 3C, those skilled in the art will understand that any system configured to perform the method steps, in any order, is within the scope of the inventions.

[0059] At step 405, the warp scheduler and instruction unit 312 issues at least one instruction each clock cycle, interleaving instructions for one or more thread groups. At step 410, the instruction pipeline 324 and the dispatch unit 326 perform pre-execution instruction processing on the instructions and identify a rollback condition for the instructions. At step 415, just before committing a processed instruction for execution, the dispatch unit 326 examines the rollback flag for the processed instruction to determine if a rollback condition occurred for the processed instruction. If a rollback condition did not occur, then at step 445, the dispatch unit 326 dispatches the processed instruction for execution by one or more exec units 302.Otherwise, at step 425, dispatch unit 326 signals warp scheduler and instruction unit 312 to stop issuing instructions for the thread group associated with the processed instruction associated with the set reset flag. Dispatch unit 326 also provides warp scheduler and instruction unit 312 with the reset code specifying the type of reset condition.

[0060] At step 430, the dispatch unit 326 removes processed instructions for the thread group that were in-flight when the rollback condition was detected. The dispatch unit 326 also continues to dispatch processed instructions for other thread groups for which a rollback condition has not occurred, so that execution of instructions for other thread groups halts while the rollback operation completes. At step 435, the warp scheduler and instruction unit 312 determines whether the rollback operation is complete, and instructions that were rolled back may be reissued for the thread group. The rollback operation is complete when the rollback condition is removed or corrected. All of the in-flight instructions for the rollback thread group do not need to be removed for the instructions to be reissued.After the rollback operation is completed, the rolled-back instructions for the thread group are reissued by the warp scheduler and instruction unit 312.

[0061] Some reset conditions do not require a reset operation for all of the threads in a thread group. Instead, a partial reset operation may be performed. Threads in a thread group that do not require a reset are committed via the dispatch unit 326 and executed via the exec unit 302, while a (partial) reset operation is performed for other threads in the thread group. The dispatch unit 326 computes and stores a reset-active mask for the thread group, indicating the threads for which the partial reset operation is performed. The reset-active mask is output via the warp scheduler and instruction unit 312 when the instructions for the thread group are reissued.While a partial rollback is pending for a thread group, trap operations are not allowed for the thread group, and the instructions and reissued instructions must complete one execution before any trap is taken.

[0062] Instructions for which a partial reset operation can be performed include a pixel attribute interpolation instruction and an indexed constant load instruction. If a portion of the threads in a thread group diverge for these instructions, a partial reset is performed for the diverged threads. If the instruction that caused the reset is again issued, only the diverged threads execute the instructions (according to the reset active mask).

[0063] Fig. 4B illustrates a speculative instruction issuance and partial instruction rollback method 450 according to an embodiment of the present invention. Although the method steps are described in connection with the systems of Fig. 1, Fig. 2, Fig. 3A, Fig. 3B and Fig. 3C, those skilled in the art will understand that any system configured to perform the method steps in any order is within the scope of the inventions.

[0064] At step 405, the warp scheduler and instruction unit 312 issues at least one instruction each clock cycle, interleaving instructions for one or more thread groups. At step 410, the instruction pipeline 324 and the dispatch unit 326 perform pre-execution instruction processing on the instructions and identify any rollback conditions for the instructions. At step 415, just before committing a processed instruction for execution, the dispatch unit 326 examines the rollback flag for the processed instruction to determine if a rollback condition occurred for the processed instruction. If a rollback condition did not occur, then at step 445, the dispatch unit 326 dispatches the processed instruction for execution by one or more exec units 302.

[0065] Otherwise, at step 420, dispatch unit 326 determines whether a partial rollback operation can be performed for the instruction, and if not, at step 425, dispatch unit 326 signals warp scheduler and instruction unit 312 to stop issuing instructions for the thread group associated with the processed instruction associated with the set rollback flag. Dispatch unit 326 also provides rollback code to warp scheduler and instruction unit 312, specifying the type of rollback condition.

[0066] At step 430, the dispatch unit 326 removes processed instructions for the thread group that were in flight when the rollback condition was detected. The dispatch unit 326 also continues to dispatch processed instructions for other thread groups for which a rollback condition has not occurred, so that instruction execution for other thread groups continues while the rollback operation completes. At step 435, the warp scheduler and instruction unit 312 determines whether the rollback operation is complete, and instructions that were rolled back can be reissued for the thread group.

[0067] If the dispatch unit 326 determines at step 324 that a partial rollback operation can be performed for the instruction, then at step 455 the dispatch unit 326 calculates and stores the partial rollback active mask and flags the thread group as performing a partial rollback operation. At step 460, the dispatch unit 326 dispatches the instruction and any in-flight instructions for execution by the non-divergent threads in the thread group. At step 465, the dispatch unit 326 updates the active mask for the thread group to the partial rollback active mask and proceeds to step 440 to reissue the rolled-back instructions. After the reset instructions are executed at step 445, the dispatch unit 326 clears the partial reset flag, thereby enabling execution of trap operations for the thread group.

[0068] Instructions for one or more thread groups are speculatively issued for pre-execution processing, and any instructions that cannot be committed for execution are discarded and reissued for a thread group after a rollback condition that prevented execution is resolved. Discarding instructions that cannot be committed due to a rollback condition allows other instructions for other thread groups to be issued and executed instead of stalling while the rollback condition is resolved. Therefore, instruction processing throughput is maintained for thread groups that do not encounter a rollback condition.

[0069] An embodiment of the invention may be implemented as a program product for use with a computer system. The program or programs of the program product define functions of the embodiments (including the methods described herein) and may be embodied on a variety of computer-readable storage media. Illustrative computer-readable storage media include, but are not limited to: (i) non-writable storage media, e.g., read-only memory devices within a computer (such as CD-ROM disks readable by a CD-ROM drive, flash memory, ROM chips, or any other type of solid-state non-volatile semiconductor memory) on which information is permanently stored; and (ii) writable storage media (e.g.,Floppy disks within a floppy disk drive or a hard disk drive, or any other type of solid-state semiconductor random access memory (SSM) on which changeable information is stored.

[0070] The invention has been described above with reference to specific embodiments. However, those skilled in the art will understand that various modifications and changes may be made therein without departing from the broader spirit and scope as set forth in the appended claims. The foregoing description and drawings are accordingly to be regarded in an illustrative rather than a restrictive sense.

Claims

[1] A method for performing a reset of speculatively issued instructions, the method comprising: issuing a first set of instructions for a first thread group (405); issuing a second set of instructions for a second thread group (405); detecting a rollback condition for at least one thread in the first thread group during pre-execution processing of an instruction in the first set of instructions (415); stopping issuing additional instructions for the first thread group (425); Discarding in-flight instructions which have been issued and not executed in the first set of instructions (430); and Executing the second set of instructions for the second thread group (445), wherein, once the reset condition has been removed or corrected, a program counter for the first thread group is updated and reset instructions for the first thread group are fetched and issued, starting at the updated program counter. [2] A method for performing a reset of speculatively issued instructions, the method comprising: issuing a first set of instructions for a first thread group (405); issuing a second set of instructions for a second thread group (405); detecting a rollback condition for at least one thread in the first thread group during pre-execution processing of an instruction in the first set of instructions (415); stopping issuing additional instructions for the first thread group (425); Discarding in-flight instructions which have been issued and not executed in the first set of instructions (430); and Executing the second set of instructions for the second thread group (445), wherein a variety of reset conditions are detected, including operands not being available, either due to a cache miss or because an operand has not yet been stored, and wherein a rollback condition determined to exist when a source or destination operand is not available in memory (104, 204) and is required for a dependent instruction results in instructions being delayed for one or more thread groups. [3] A system for scheduling computing tasks for execution, the system (100) comprising: a memory (104, 204) configured to store a first set of instructions for a first thread group and a second set of instructions for a second thread group; a planner unit (312) configured to: issue the first set of instructions for the first thread group; issue the second set of instructions for the second thread group; and stop issuing additional instructions for the first thread group when a rollback condition is detected; a settling unit (326) configured to: detect the reset condition for at least one thread in the first thread group during pre-execution processing of an instruction in the first set of instructions; and to discard in-flight instructions which are issued and not executed in the first set of instructions; and a plurality of execution units (302(0) - 302(N-1)) configured to execute the second set of instructions for the second thread group, wherein, once the rollback condition has been removed or corrected, the scheduler unit (312) updates a program counter for the first thread group and fetches and issues rolled-back instructions for the first thread group from an instruction L1 cache (370) of the system (100), starting at the updated program counter. [4] A system for scheduling computing tasks for execution, the system (100) comprising: a memory (104, 204) configured to store a first set of instructions for a first thread group and a second set of instructions for a second thread group; a planner unit (312) configured to: issue the first set of instructions for the first thread group; issue the second set of instructions for the second thread group; and stop issuing additional instructions for the first thread group when a rollback condition is detected; a settling unit (326) configured to: detect the reset condition for at least one thread in the first thread group during pre-execution processing of an instruction in the first set of instructions; and to discard in-flight instructions which are issued and not executed in the first set of instructions; and a plurality of execution units (302(0) - 302(N-1)) configured to execute the second set of instructions for the second thread group, wherein an instruction pipeline (324) is configured to detect a variety of rollback conditions including operands not being available either due to a cache miss or because an operand has not yet been stored, and wherein the instruction pipeline (324) is configured to determine that a rollback condition exists when a source or destination operand is not available in memory (104, 204) and is required for a dependent instruction, resulting in instructions for one or more thread groups being delayed. [5] The system of claim 3 or 4, wherein the scheduler unit (312) is further configured to: to issue a third set of instructions for a third thread group, wherein the settling unit (326) is further configured to: detect a partial rollback condition for at least one thread in the third thread group during pre-execution processing of a first instruction in the third set of instructions; and store a partial-reset-active mask indicating a first portion of threads in the third thread group that diverge for the first instruction, and wherein the plurality of execution units (302(0) - 302(N-1)) are further configured to: to execute the first instruction for a second portion of the threads in the third thread group that do not diverge for the first instruction. [6] The system of claim 3 or 4, wherein the scheduler unit (312) is further configured to reissue the first instruction for the third thread group, and wherein the plurality of execution units (302(0) - 302(N-1)) are further configured to execute the first instruction for the first portion of threads based on the partial rollback active mask. [7] The system of claim 3 or 4, wherein the instruction in the first set of instructions specifies an invalid super-scalar pair of two operations that cannot be performed in parallel. [8] The system of claim 7, wherein the scheduler unit (312) is further configured to: issue a first operation of the invalid super-scalar pair as a first instruction for the first thread group; and to issue a first operation of the invalid super-scalar pair as a second instruction for the first thread group. [9] The system of claim 3 or 4, wherein the instruction in the first set of instructions is a barrier synchronization instruction configured to synchronize the first thread group with the second thread group. [10] The system of claim 3 or 4, wherein the instruction in the first set of instructions specifies an operand that is corrupted. [11] The system of claim 3 or 4, wherein the scheduler unit (312) is further configured to reissue the first set of instructions for the first thread group after the reset condition is removed. [12] The system of claim 3 or 4, wherein the dispatch unit (312) is further configured to discard the in-flight instructions after the pre-execution processing of the in-flight instructions is completed.

Citation Information

Patent Citations

  • Commit Groups for Strand-Based Computing

    US20090217020A1