EFFICIENT STORAGE VIRTUALIZATION IN MULTI-LINE PROCESSING UNITS
By allowing simultaneous execution of thread programs with different virtual address spaces on GPUs, the method enhances GPU utilization and performance in HPC applications, addressing inefficiencies in conventional execution models.
Patent Information
- Application Number
- DE102013017511
- Authority / Receiving Office
- DE · DE
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2012-10-25
- Filing Date
- 2013-10-23
- Publication Date
- 2024-09-12
- Estimated Expiration
- 2033-10-23
AI Technical Summary
Conventional GPU execution models in high-performance computing (HPC) applications limit GPU utilization due to the sequential execution of thread programs requiring different virtual address spaces, leading to inefficient performance and poor resource allocation in multi-threaded environments.
A method and system enabling simultaneous execution of thread programs with different virtual address spaces on a GPU by utilizing address space identifiers (ASIDs) to manage multiple virtual address spaces concurrently, allowing for efficient task distribution and utilization across multiple GPUs.
Improves GPU utilization and performance by enabling concurrent execution of tasks with different virtual address spaces, enhancing reliability and reducing development efforts associated with debugging.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
BACKGROUND OF THE INVENTIONField of the invention
[0001] The present invention relates generally to multi-threaded computer architectures and, more particularly, to efficient memory virtualization in multi-threaded processing units. Description of the state of the art
[0002] In conventional computer systems with both a central processing unit (CPU) and a graphics processing unit (GPU), the CPU performs part of the application computations, allocates resources, and manages the overall execution of the application, while the GPU performs high-throughput computations specified by the CPU. In certain application domains, such as high-performance computing (HPC) applications, the GPU typically performs the majority of the computations associated with a given application. As a result, the overall performance of the application is directly dependent on GPU utilization. In such applications, high application performance is achieved with high GPU utilization, that is, a state characterized by a relatively large proportion of the GPU processing units performing useful work simultaneously.The work is divided into strand programs that are executed in parallel in processing units.
[0003] A typical thread program executes as a series of highly parallel, very similar operations across a parallel data set, such as an image or group of images residing in a single virtual address space. When an application needs to execute multiple different thread programs, the GPU conventionally executes the different thread programs sequentially, each within a corresponding virtual address space, until the different thread programs have completed their assigned work. Each thread program is loaded into a corresponding context for execution within the GPU. The context includes the state of the virtual address space, which is loaded into page tables residing in the GPU. Because each different thread program conventionally requires a private virtual address space, only a single thread program can be executing on the GPU at a given time.
[0004] HPC applications typically run in an HPC cluster, or aggregate, which conventionally includes a group of nodes, each comprising a CPU and a GPU. Each node is typically assigned to a group of tasks that can communicate with other tasks running on other nodes via a message-passing interface (MPI) task. A typical GPU computation task is executed efficiently with high GPU utilization as a group of parallel threaded program instances within a shared virtual memory space. However, in given conventional GPU execution models, only a single MPI task is executed per unit time on a given GPU. Each MPI task can span a range of workloads for the GPU, resulting in a corresponding range of GPU utilization.In one scenario, only a single thread or a small number of threads are executed on the GPU as an MPI task, resulting in poor GPU utilization and poor overall application performance. As a result, certain HPC applications run inefficiently on GPU-based HPC processing clusters. In general, applications that require the GPU to sequentially execute tasks containing a small number of thread instances, each requiring an independent virtual address space, have poor performance. US 2009 / 0 031 317 A1 discloses scheduling for a large number of threads. US 2001 / 0052 053 A1 discloses a cache structure with a bypass structure. US 2009 / 0187 915 A1 describes a group of processors arranged in a hierarchical structure.
[0005] As can be seen from the foregoing, a technique is needed in this field that enables simultaneous GPU execution of tasks with different virtual address spaces, and it is an object of the invention to make the distribution of computational tasks to the multiple GPUs more effective. OVERVIEW OF THE INVENTION
[0006] This object is achieved by the features of the independent claims. Preferred embodiments are described in the dependent claims. One embodiment of the present invention provides a method according to claim 1.
[0007] Other embodiments of the present invention include a computing device configured to perform the techniques described herein.
[0008] One advantage of the present invention is that a GPU can simultaneously execute different tasks with different virtual address spaces, thereby improving GPU utilization and performance in certain applications. Another advantage of the present invention is that GPU tasks can be executed with address space separation, thereby improving reliability and reducing the development effort associated with debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] To further illustrate how the above-mentioned features of the present invention may be understood, a more detailed description of the invention, briefly summarized above, will be given with reference to embodiments, some of which are illustrated in the accompanying drawings. It should be noted, however, that the accompanying drawings illustrate only typical embodiments of this invention and are not intended to limit 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 Fig. 1 according to an embodiment of the present invention; Fig. 3A is a block view of the front area from Fig. 2 according to an embodiment of the present invention; Fig. Figure 3B is a block diagram of a general processing cluster in 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 a data stream multiprocessor from Fig. 2 according to an embodiment of the present invention; Fig. 4A illustrates a parallel processing subsystem configured to implement multiple concurrent virtual address spaces according to an embodiment of the present invention; Fig. 4B shows a table entry of an address space identifier according to an embodiment of the present invention; Fig. 4C shows a page table entry according to an embodiment of the present invention; Fig. 4D shows an entry of a translation sideshow buffer according to an embodiment of the present invention; Fig. 5 shows the translation of an address space identifier and a virtual address into a physical address according to an embodiment of the present invention; Fig. 6 shows two concurrent virtual address spaces coexisting within a single physical address space, according to one embodiment of the present invention; Fig. 7 illustrates the configuration of a parallel processing subsystem to execute multiple thread programs with different virtual address spaces according to one embodiment of the present invention; Fig. 8 is a flowchart of method steps for concurrently executing two or more thread programs having different virtual address spaces in the parallel processing subsystem according to an embodiment of the present invention; Fig. 9 is a flowchart of method steps for performing a mapping of virtual addresses to physical addresses in one of a plurality of different virtual address spaces according to an embodiment of the present invention; and Fig. 10 is a flowchart of method steps for performing deep scheduling of tasks in the context of a graphics processing unit according to an embodiment of the present invention. DETAILED DESCRIPTION
[0010] In the following description, numerous specific details are set forth in order to provide a more thorough understanding of the present invention. However, one skilled in the art will recognize that the present invention may be practiced without one or more of these specific details. System overview
[0011] 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 that communicate via an interconnect path including 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 communications path 106 (e.g., a HyperTransport interconnect). 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 communications path 106 and memory bridge 105.A parallel processing subsystem 112 is connected to the memory bridge 105 via a bus or a second communication path 113 (e.g., a Peripheral Component Interconnect (PCI) Express connection, an accelerated graphics port, or a HyperTransport connection); in one embodiment, the parallel processing subsystem 112 is a graphics subsystem that provides pixels to a display device 110 (e.g., a monitor based on a conventional cathode ray tube or a liquid crystal display). A system disk 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 a universal serial bus (USB) or other port connections, compact disk (CD) drives, digital video disk (DVD) drives, movie recorders, and the like may also be connected to the I / O bridge 107. The various in . Fig. The communication paths shown in Figure 1, including the specifically designated communication paths 106 and 113, may be implemented using any suitable protocols, such as PCI Express, AGP (Accelerated Graphics Port), HyperTransport, or other bus or point-to-point connection protocol(s), and connections between different devices using different protocols are known in the art.
[0012] In one embodiment, parallel processing subsystem 112 includes circuitry optimized for graphics processing and video processing, including, for example, video output circuitry, and this circuitry forms a graphics processing unit (GPU). In another embodiment, parallel processing subsystem 112 includes circuitry optimized for general-purpose processing while maintaining the underlying computing architecture described in more detail herein. In yet another embodiment, parallel processing subsystem 112 may be integrated with one or more other system elements into a single subsystem, such as by combining memory bridge 105, CPU 102, and I / O bridge 107 to form a system on a chip (SoC).
[0013] It should be noted that the system shown herein is illustrative in nature 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, may be modified as needed. For example, in some embodiments, system memory 104 is connected to CPU 102 directly rather than via 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 rather than being provided as one or more discrete components.Larger 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-in cards or peripheral devices may be supported. In some embodiments, switch 116 is omitted, and network adapter 118 and add-in cards 120, 121 are connected directly to I / O bridge 107.
[0014] Fig. 2 shows 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 connected 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 representatives of like objects are given reference numerals to identify the object, and the numbers in parentheses indicate the representative where appropriate.) The PPUs 202 and the parallel processing memories 204 may be implemented using one or more integrated circuit devices, such as programmable processors, application-specific integrated circuits (ASICs), or memory devices, or may be implemented in another technically feasible manner.
[0015] It is back on Fig. 1 and Fig. 2; in some embodiments, some or all of the PPUs 202 in the parallel processing subsystem 112 are graphics processors with image generation pipelines that may be configured to perform various operations related to generating pixel data from graphics data provided by the CPU 102 and / or the system memory 104 via the memory bridge 105 and the second communication path 113, interacting with the local parallel processing memory 204 (which may be used as a graphics memory and may include, for example, a conventional block buffer) to store and update pixel data, provide the pixel data to the display device 110, etc. In some embodiments, the parallel processing subsystem 112 may include one or more PPUs 202 operating as graphics processors and may include one or more other PPUs 202 used for general-purpose computations.The PPUs may be identical or different, and each PPU may have one or more dedicated parallel processing memories or no dedicated parallel processing memories. One or more of the PPUs 202 in the parallel processing subsystem 112 may output data to the display device 110, or each PPU 202 in the parallel processing subsystem 112 may output data to one or more display devices 110.
[0016] During operation, the CPU 102 is the overarching processor of the computer system 100 and controls and coordinates the operation of other system components. In particular, the CPU 102 issues instructions that control the operation of the PPUs 202. In some embodiments, the CPU 102 writes a stream of instructions for each PPU 202 into a data structure (in Fig. 1 or Fig. 2 not explicitly shown), which may be located in system memory 104, parallel processing memory 204, or at another memory location accessible by both CPU 102 and PPU 202. A pointer to each data structure is written to a shift buffer to initiate processing of the stream of instructions in the data structure. PPU 202 reads instruction streams from one or more shift buffers and then executes instructions in an asynchronous manner relative to the operation of CPU 102. Execution priorities may be specified for each shift buffer by an application program via device driver 103 to control the scheduling of the various shift buffers.
[0017] Let us now return to Fig. 2 and Fig. 1; 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 is connected to memory bridge 105 (or, in an alternative embodiment, directly to CPU 102). The connection of PPU 202 to the rest of computer system 100 may also be different. In some embodiments, parallel processing subsystem 112 is implemented as an add-in card that can be inserted into an expansion slot connector of computer system 100. In other embodiments, a PPU 202 may be integrated into 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 may be integrated into a single chip along with CPU 102.
[0018] In one embodiment, communication path 113 is a PCI Express interconnect in which dedicated lanes are assigned 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 and forwards the incoming packets to appropriate components of PPU 202. For example, commands related to processing tasks may be directed to a master interface 206, whereas commands related to memory operations (e.g., reading from or writing to parallel processing memory 204) may be directed to a memory intersection unit 210.The main interface 206 reads each shift buffer and outputs the instruction stream stored in the shift buffer to a front end area 212.
[0019] Each PPU 202 advantageously implements a highly parallel processing architecture. As shown in detail, the PPU 202(0) includes a processing cluster array 230 containing 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 various applications, different GPCs 208 may be reserved for processing different types of programs or for performing different types of computations. The allocation of the GPCs 208 may depend on the workload associated with each type of program or computation.
[0020] The GPCs 208 receive processing tasks to be executed from a work distribution unit in a task / work unit 207. The work distribution unit receives pointers to the processing tasks, which are encoded as task metadata (TMD) and stored in memory. The data on the TMD is included in the instruction stream, which is stored as a sliding buffer and received by the front-end unit 212 from the main interface 206. Processing tasks, which may be encoded as TMDs, contain indices of data to be processed, as well as state parameters and instructions that specify how the data is to be processed (e.g., which program is to be executed). The task / work unit 207 receives tasks from the front-end unit 212 and ensures that the GPCs 208 are configured to a permissible state before initializing the processing specified by the respective TMDs.A priority may be specified for each TMD record, which is used to schedule the execution of the processing tasks. Processing tasks may also be received from the processing cluster array 230. Optionally, the TMD may include a parameter that controls whether the TMD should be added to the beginning or end of a list of processing tasks (or the list of pointers to the processing tasks), thereby providing another level of control above priority.
[0021] The memory interface 214 includes a number D of partition units 215, each directly connected to a portion of the parallel processing memory 204, where D ≥ 1. As shown, the number of partition units 215 is generally equal to the number of dynamic random access memories (DRAM) 220. In other embodiments, the number of partition units 215 is not equal to the number of memory devices. Those skilled in the art will recognize that the DRAM 220 may be replaced with other suitable memory devices and may generally be of conventional design. A detailed description is therefore omitted.Render targets, such as block buffers or texture maps, may be stored across DRAMs 220, allowing partition units 215 to write portions of each render target in parallel to efficiently utilize the available bandwidth of parallel processing memory 204.
[0022] Each of the GPCs 208 can process data to be written to one of the DRAMs 220 in the parallel processing memory 204. The intersection unit 210 is configured to route the output of each GPC 208 to the input of a partition unit 215 or another GPC 208 for further processing. The GPCs 208 communicate with the memory interface 214 via the intersection unit 210 to read from or write to various external memory devices. In one embodiment, the intersection unit 210 has a connection to the memory interface 214 to communicate with the I / O unit 205 and also has a connection to the local parallel processing memory 204, thereby enabling the processing cores in the various GPCs 208 to communicate with the 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 intersection unit 210 is directly connected to the I / O unit 205. The intersection unit 210 may use virtual channels to separate traffic flows between the GPCs 208 and the partition units 215.
[0023] The GPCs 208, in turn, may be programmed to perform processing tasks related to a wide variety of applications, including, but not limited to: linear and non-linear data transformations, filtering of video and / or audio data, modeling operations (e.g., applying physical laws to determine position, velocity, and other attributes of objects), image generation operations (e.g., tessellation shading, vertex shading, geometry shading, and / or pixel shading programs), etc.The PPUs 202 may transfer data from the system memory 104 and / or local parallel processing memories 204 to internal (on-chip) memory, process the data, and write the resulting data back to the system memory 104 and / or the local parallel processing memories 204, where such data may then be accessed by other system components, including the CPU 102 or another parallel processing subsystem 112.
[0024] 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 is provided, and the PPU 202 may use system memory exclusively or almost exclusively. In UMA embodiments, a PPU 202 may be integrated into a bridge chip or a processor chip, or may be provided as a discrete chip with a high-speed interconnect (e.g., PCI Express) connecting the PPU 202 to system memory via a bridge chip or other communication means.
[0025] As previously stated, a number of PPUs 202 may be included in a parallel processing subsystem 112. For example, multiple PPUs 202 may be provided in a single add-in card, or multiple add-in cards may be connected to the communication path 113, or one or more PPUs 202 may be integrated into a bridge chip. The PPUs 202 in a multi-PPU system may be identical or may be different from one another. For example, different PPUs 202 may have a different number of processing cores, a different amount of local parallel processing memory, etc. When multiple PPUs 202 are present, these PPUs may operate in parallel to process data at a higher throughput than would be possible with a single PPU 202.Systems containing one or more PPUs 202 may be implemented in a variety of configurations and form factors, including desktop computers, mobile or handheld personal computers, service provider computers, workstations, game consoles, embedded systems, etc. Multiple simultaneous task scheduling
[0026] Multiple processing tasks can be executed concurrently in 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.
[0027] Fig. Figure 3A is a block view of task / work unit 207 from Fig. 2 according to an 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 arranges for tasks to be scheduled based on execution priority levels. For each priority level, the task management unit 300 stores a list of pointers to the TMD 322 corresponding to the tasks in the scheduling table 321, which list may be implemented as a linked list. The TMD 322 may be stored in the PP memory 204 or in the system memory 104. The rate at which the task management unit 300 accepts tasks and stores the tasks in the scheduling table 321 is independent of the rate at which the task management unit 300 schedules tasks for execution. Therefore, the task management unit 300 may accumulate multiple tasks before scheduling the tasks.The collected tasks can then be scheduled based on priority information or using other techniques, such as round-robin scheduling.
[0028] The work distribution unit 340 includes a task table 345 with columns or windows occupied by the TMDs 322 for a task currently executing. The task management unit 300 can schedule tasks for execution when there is a free window in the task table 345. If no free window is available, a higher priority task that does not occupy a window preempts a lower priority task that does occupy a window. When a task is preempted, the task is suspended, and if the task's execution is not complete, a pointer to the task is added to a list of task pointers to be scheduled so that the task's execution can be resumed at a later time. If a child processing task is created during the execution of a task, a pointer to the child task is added to the list of task pointers to be executed.A child task may be generated by a set of TMDs 322 executing in the processing cluster array 230.
[0029] Unlike a task received in task / work unit 207 from front-end area 212, child tasks are received from processing cluster array 230. Child tasks are not inserted into sliding buffers or sent to the front-end area. CPU 102 is not notified when a child task is created or when data for the child task is stored in memory. Another difference between tasks delivered via sliding buffers and child tasks is that tasks delivered via sliding buffers are defined by the application program, whereas child tasks are dynamically generated during task execution. Overview of task processing
[0030] Fig. 3B is a block diagram of a GPC 208 in one of the PPUs 202 of Fig. 2 according to an 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 issue techniques are employed 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 employed to perform parallel execution of a large number of generally synchronized threads using a common instruction unit configured to issue instructions to a group of processing units in each of the GPCs 208.Unlike a SIMD execution regime, in which all processing units typically execute identical instructions, SIMT execution allows different threads to more easily follow divergent execution paths through a given thread program. Those skilled in the art will recognize that a SIMD processing regime represents a functional subset of a SIMT processing regime.
[0031] The operation of the GPC 208 is advantageously controlled by a pipeline manager 305, which distributes processing tasks to data stream multiprocessors (SMs) 310. The pipeline manager 305 may also be configured to control a work distribution intersection unit 330 by specifying destinations for processed data output from the SMs 310.
[0032] In one embodiment, each GPC 208 includes a number M of SMs 310, where M ≥ 1, each SM 310 configured to process one or more thread groups. Furthermore, each SM 310 advantageously includes an identical set of function execution units (e.g., execution units and load-store units—referred to as exec units 302 and LSUs 303 in Fig. 3C), which can be operated in parallel or as a pipeline, allowing a new instruction to be issued before a previous instruction completes, as is known in the art. Any combination of functional execution units may be provided. In one embodiment, the functional units support many operations, including integer and floating-point arithmetic (e.g., addition and multiplication), comparison operations, Boolean operations (AND, OR, XOR), bit shifting, and the computation of various algebraic functions (e.g., plane interpolation, trigonometric, exponential, and logarithmic functions, etc.); and the same hardware of the functional units can be more advantageously used to perform other operations.
[0033] The series of instructions sent by a particular GPC 208 forms a thread, as defined hereinbefore, and the accumulation of a certain number of concurrently executing threads across the parallel processing units (not shown) in an SM 310 is referred to as a "bulge" 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 each individual thread of the group being associated with a different processing unit within an SM 310. A thread group may contain fewer threads than the number of processing units within the SM 310, in which case processing units are idle during certain cycles when that thread group is being processed.A thread group may also contain more threads than the number of processing units within the SM 310, in which case processing will occur over consecutive clock cycles. Since each SM 310 can support up to G thread groups simultaneously, it follows that up to G*M thread groups can be executed in the GPC 208 at any one time.
[0034] Furthermore, multiple related thread groups may be active concurrently within an SM 310 (in different phases of execution). This collection of thread groups is referred to herein as a "cooperative thread array" ("CTA") or "thread array." The size of a particular CTA = 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 concurrently active within the SM 310. The size of a CTA is generally determined by the programmer and the amount of hardware resources, such as memory or registers, available to the CTA.
[0035] Each SM 310 contains a Level 1 (L1) cache memory (in Fig. 3C) or uses a region of space in a corresponding L1 cache memory external to the SM 310, which is used to load and store operations. Each SM 310 also has access to Level 2 (L2) cache memories shared by all GPCs 208, which may also be used to exchange data between threads. Finally, the SMs 310 also have access to off-chip "global" memory, which may include, for example, the parallel processing memory 204 and / or the system memory 104. Note that any memory external to the PPU 202 may be used as global memory. Furthermore, a one-point-five (L1.5) Cache memory 325 may be included in the GPC 208 and configured to receive and hold data fetched from memory via the memory interface 214 and requested by the SM 310, including instructions, uniform data, and constant data, and the requested data is passed to the SM 310. Embodiments with multiple SMs 310 in the GPC 208 share common instructions and data stored in the L1.5 cache memory 335.
[0036] Each GPC 208 may include a memory management unit (MMU) 328 configured to map virtual addresses to physical addresses. In other embodiments, the MMU(s) 328 may be located in the memory interface 214, the multiprocessor SM 310, or the L1 cache 320. The MMU 328 is configured to map virtual addresses to physical addresses using page tables 420. The MMU 328 may include address translation sidebar buffers (TLBs) or caches for storing portions of the page tables 420. The physical address is processed to distribute surface data access locality to enable efficient interleaving of requests between the partition units 215. The cache line index may be used to indicate 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 connected to a texture unit 315 for performing texture mapping operations, such as 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 in the SM 310 and fetched from an L2 cache shared by all GPCs 208, the parallel processing memory 204, or the system memory 104 as needed. Each SM 310 issues processed tasks to the work distribution intersection unit 330 to forward the processed task to another GPC 208 for further processing or to store the processed task in an L2 cache, in the parallel processing memory 204, or in the system memory 104 via the intersection unit 210.A pre-ROP (pre-raster operations) 325 is configured to receive data from the SM 310, route data to ROP units in the partition units 215, and perform optimizations for color blending, manage pixel color data, and perform address translations.
[0038] It should be noted that the core architecture described herein is illustrative and that variations and modifications are possible. Any number of processing units, such as SMs 310 or texture units 315, pre-ROPs 325, may be included in a GPC 208. As further described in Fig. As shown in Figure 2, a PPU 202 may include any number of GPCs 208, which are advantageously functionally similar to one another, so that performance does not depend on which GPC 208 receives a specific processing task. Further, each GPC 208 advantageously operates independently of other GPCs 208 using separate and distinct processing units and L1 caches to execute tasks for one or more application programs.
[0039] The expert in the field recognizes 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 in any suitably 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 general 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 another processor or processors 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 the thread can access during thread execution. The thread ID, which can be defined as a one-dimensional or multi-dimensional numeric value, controls various aspects of the processing behavior of the thread. For example, a thread ID can be used to determine which portion of the 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 instructions per thread 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 instructions per thread may include: an instruction to suspend execution of operations for the representative thread at a specific point in the sequence until one or more of the other threads have reached that specific 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 ID; or the like.The CTA program may further 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 given memory location in shared memory by a single thread of a CTA and read from that memory location by another thread of the same CTA in a predictable manner. Consequently, a desired pattern for data sharing among threads can be supported, and each thread in a CTA can share data with another thread in the same CTA.The extent, if any, of data sharing between threads of a CTA is determined by the CTA program; it will therefore be appreciated that in a particular application using CTAs, the threads of a CTA may or may not actually share data, depending on the CTA program, and the terms "CTA" and "thread array" are used synonymously herein.
[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 and constants from memory via the L1.5 cache 335. A bulge scheduling and instruction unit 312 receives instructions and constants from the instruction L1 cache 370 and controls a local register file 304 and functional units of the SM 310 according to the instructions and constants. The functional units of the SM 310 include N exec (execution or processing) units 302 and P load store units (LSU) 303.
[0043] The SM 310 provides on-chip (internal) data storage space with varying levels of accessibility. Special-purpose registers (not shown) are readable but not writable by the LS 303 and are used to store parameters that define a "position" of each thread. In one embodiment, the special-purpose registers include one register per thread (or per Exec unit 302 in the SM 310) that stores a thread ID; each thread ID register is accessible only by a respective one of the Exec units 302.Special registers may further include additional registers readable by all threads executing the same processing task represented by a set of TMDs 322 (or by all LSUs 303) that store a CTA identifier, the CTA dimensions, the dimensions of a grid to which the CTA belongs (or queue position if the TMDs 322 specify a queue task rather than a grid task), and an identifier of the TMDs 322 associated with the CTA.
[0044] When the TMD 322 represents TMDs in the form of a grid, the execution of the TMD 322 causes a specified number of CTAs to be started and the specified amount of data stored in the queue 525 to be executed. The number of CTAs is determined by the product of the grid width, height, and depth. The specified amount of data can be stored in the TMD 322, or the TMD 322 can store a pointer to the data being processed by the CTAs. The TMD 322 can also store a starting address of the program being executed by the CTAs.
[0045] When the TMD 322 represents queued TMDs, a queue property of the TMD 322 is used, meaning that the amount of data to be processed is not necessarily fixed. Queue entries store data for processing by the CTAs associated with the TMD 322. The queue entries may further represent a child task spawned by additional TMD 322 during the execution of a thread, thereby providing embedded parallelism. Typically, the execution of the thread or the CTA containing that thread is suspended until the execution of the child task is complete. The queue may be stored in the TMD 322 or separately from the TMD 322, in which case the TMD 322 stores a queue pointer to the queue.Advantageously, data generated by the child task can be written to the queue while the TMD 322 representing the child task is executing. The queue can be implemented as a circular queue, so that the total amount of data is not limited by the size of the queue.
[0046] CTAs belonging to a grid have implicit parameters for grid width, height, and depth, which specify the position of the respective CTA within the grid. Special registers are written during initialization in response to commands received from device driver 103 via front-end area 212, and the registers do not change during the execution of a processing task. Front-end area 212 schedules each processing task for execution. Each CTA is linked to special TMD 322 for the simultaneous execution of one or more tasks. Furthermore, a single GPC 208 can execute multiple tasks simultaneously.
[0047] A parameter memory (not shown) stores runtime parameters (constants) that can be read but not written by any thread within the same CTA (or an LSU 303). In one embodiment, the device driver 103 provides parameters to the parameter memory before instructing the SM 310 to begin executing a task that uses those parameters. Each thread in a CTA (or an Exec Unit 302 in the SM 310) can access the global memory via a memory interface 214. Portions of the global memory can be stored in the L1 cache 320.
[0048] The local register file 304 is used by each thread as a workspace; each register is reserved for the exclusive use of a single thread, and data in each local register file 304 is accessible only by the thread for which the register is reserved. The local register file 304 may be implemented as a register file physically or logically divided into P lanes, each having a certain number of entries (each entry capable of storing, for example, a 32-bit word). Each of the N exec units 302 and each of the P load-store units LSU 303 is assigned a single lane, and corresponding entries in different lanes may be enriched with data for different threads executing the same program to enable SIMD execution.Different portions of the lanes can be assigned to different groups of the G concurrent thread groups, so that a given entry in the local register file 304 is only accessible by a specific thread. In one embodiment, certain entries within the local register file 304 are reserved for storing thread identifiers, thereby implementing one of the special registers. Furthermore, a uniform L1 cache 375 stores uniform or constant values for each lane of the N exec units 302 and the P load / store units (LSUs) 303.
[0049] Shared memory 306 can be accessed by threads within a single CTA; in other words, any memory location in shared memory 306 can be accessed by any thread within the same CTA (or any processing unit within SM 310). Shared memory 306 can be implemented as a shared register file or a shared on-chip cache with an interconnect that allows a processing unit to read or write to any location in the shared memory. In other embodiments, a shared state space can be mapped to a per-CTA region of off-chip memory and can be cached in L1 cache 320.The parameter memory may be implemented as a special section within the same shared register file or shared cache that forms shared memory 306, or the parameter memory may be implemented 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 task ID, as well as the CTA dimensions and grid dimensions or queue position, thereby implementing areas of the special-purpose registers.Each LSU 303 in the SM 310 is connected to a unified address mapping unit 352, which converts an address provided for load and store instructions specified in a unified memory area into an address in each separate memory area. Thus, an instruction can be used to access the local, shared, or global memory area by specifying an address in the unified memory area.
[0050] The L1 cache 320 in each SM 310 can be used to cache private local data per thread as well as global data per application. In some embodiments, shared data per CTA can be cached in the L1 cache 320. The LSUs 303 are connected to the shared memory 306 and the L1 cache 320 via a memory and cache link 380. Independent virtual address spaces
[0051] Embodiments of the present invention enable a parallel processing subsystem, such as a GPU, to concurrently execute threaded programs with different, independent virtual address spaces. Each virtual address space can coexist with one or more other virtual address spaces, enabling the GPU to execute the threaded programs concurrently. Each threaded program can operate within a virtual address space associated with a corresponding application process, which can allocate memory and pass virtual address references to the threaded program. By enabling the parallel processing subsystem to simultaneously execute multiple threaded programs in different virtual address spaces, greater GPU utilization and improved performance for a wider range of applications can be achieved.
[0052] Fig. 4A shows the parallel processing subsystem 112 of Fig. 1, configured to implement multiple concurrent virtual address spaces according to an embodiment of the present invention. In certain embodiments, the parallel processing subsystem 112 includes a GPU. For embodiments implementing unified virtual memory (UVM), each application process 460 may include GPU compute tasks to be executed within a virtual address space that is uniform for the application process 460 and any associated GPU compute tasks. This unification allows the application process 460 and the GPU compute tasks to seamlessly exchange memory references. In general, each application process 460 operates in a different virtual address space relative to other application processes 460.Each application context includes an application context page table maintained by a parent operating system to map the virtual address space associated with the application into a physical address space typically shared by the application processes 460.
[0053] A given application process 460 may initiate the execution of a GPU compute task by submitting an execution request to the driver 103, which responds by adding execution information for the GPU compute task to a GPU context 450 and adding the GPU context 450 to a queue of work jobs for the GPU. The GPU context 450 includes task metadata (TMD) 452 containing information for executing one or more threaded programs that implement one or more GPU processing tasks that may be concurrently executed on the GPU. The one or more threaded programs may be associated with one or more different virtual address spaces defined in the same GPU context 450. A page table for a single virtual address space is defined for a single instance of the TMD 452.Each instance of the TMD 452 includes execution information for a single associated thread program within a single GPU context 450.
[0054] A page table within a given TMD 452 may be derived from a corresponding application context page table. Alternatively, a page table within a given TMD 452 may reference a corresponding application context page table. In one embodiment, the application contexts 450 reside within the system memory 104. A resource manager (RM) 454 in the driver 103 is configured to package the one or more threaded programs, each assigned to a set of TMDs 452, into a single GPU context 450 for concurrent execution within a single GPU context. In one embodiment, a delegate 456 comprises a user-space process configured to direct requests to the RM 454. For example, certain execution requests and allocation requests may be sent from the RM 454 via the delegate 456.
[0055] As previously in Fig. 2, the host unit 206 is configured to retrieve data located in a memory, such as the system memory 104. The data may include information related to one or more GPU contexts 450 queued for execution. The host unit 206 sequentially selects a GPU context 450 for execution at any time. The front end 212 reads the TMDs 452 within a GPU context 450 and configures the PPU 202 to execute one or more threaded programs based on the GPU context 450. A front end context switch (FECS) 407 configures the MMU 328 to provide an appropriate virtual address to physical address mapping. The execution of a given GPU context 450 must wait until all page tables belonging to the GPU context 450 are configured by the FECS 407.In one implementation, the FECS 407 generates a "done" signal to indicate that the page table and associated configuration steps are complete, thereby requesting the FE 212 to communicate the completion of the page table configuration to the task / work unit 207. This indication allows the task / work unit 207 to begin scheduling tasks associated with the page table.
[0056] Each page table within the TMD 452 is associated with an address space identifier (ASID) by the FECS 407 via a link command issued by the MMU 328. Each thread program is associated with an ASID that is appended to each virtual memory request generated by the thread program during execution. For example, if a given GPU context 450 contains execution information for two different thread programs, each associated with a different virtual address space, then one of the two thread programs may be associated with ASID = 0 and the other of the two thread programs may be associated with ASID = 1. In this example, the GPU context 450 also contains a single page table for a virtual address space zero (ASID = 0) and another page table for a virtual address space one (ASID = 1).During execution, each virtual memory access request generated by the first thread program contains a virtual address and an ASID of 0. Page table lookup requests from this thread program are directed to the page table for ASID = 0. Similarly, each virtual memory access request generated by the second thread program contains a virtual address and an ASID of 1. Page table lookup requests from this thread program are directed to the page table for ASID = 1.
[0057] Processing core 440 is configured to perform a certain set of predetermined tasks, such as copying a memory block from one address range to another address range. Processing core 440 receives work from FECS 407 and may operate in conjunction with SMs 310, but may not require general programming capability. In one embodiment, host unit 206 monitors the operation of processing core 440.
[0058] The MMU 328 contains the ASID table 410, the page tables 420, and the TLB 430. The ASID table 410 contains one or more ASID table entries that link an ASID to a corresponding page table 420. Generally, each memory request generated by a thread program executing within an SM 310 includes a virtual address and an ASID value to select a single page table 420 to perform a virtual address-to-physical address mapping. The ASID table 410 maps an ASID value to a corresponding page table 420. The page table 420 then provides a virtual address-to-physical address mapping. The page tables 420 are shown within the MMU 328, but may also reside in any technically feasible memory subsystem, such as system memory 104 or PP memory 204.
[0059] The TLBs 430 are configured to cache virtual address-to-physical address mappings, where each mapping is represented as a cache entry. Each cache entry tag includes an ASID and a virtual address. Each cache entry value includes a physical address. A TLB hit occurs when the TLB 430 contains a cache entry that matches both the ASID and the virtual address inputs for a memory access request. In the event of a TLB hit, the TLB provides a corresponding physical address for the memory access request. A TLB miss occurs when the TLB 430 does not contain a cache entry that matches both the ASID and the virtual address inputs. The TLB 430 may implement any technically feasible technique to determine whether the ASID input and the virtual address input together represent a TLB hit or a TLB miss.In one embodiment, a content-addressable memory circuit is configured to store an ASID and virtual address pair as a search tag for determining a hit or miss. A corresponding physical address stored in the TLB is selected to complete a virtual-to-physical address mapping when the content-addressable memory matches a given ASID and virtual address pair with a previously stored tag, thereby indicating a TLB hit. Such a technique is fully associative with respect to the search tag. In other techniques, a different degree of associativity may be implemented.In the event of a TLB miss, the MMU 328 selects a single page table 420 identified by an ASID that includes the memory access request and performs a virtual address-to-physical address translation using the identified page table 420 based on a memory access request for a virtual address. Any technically feasible technique may be used to perform the virtual address-to-physical address translation once a single page table 420 is identified to provide page table information for the translation operation. If the page table 420 fails to map the virtual address to the physical address, the memory access request generates an error indicating that the memory access request is not allowed.
[0060] A specific ASID used by a threaded program in an SM 310 may be linked to a specific page table 430 via a link command generated and sent from the FECS 407 to the MMU 328. The link command may also be used to invalidate virtual-to-physical address mapping data residing in the TLB 430. In this way, ASID values can be reused for sequentially executing GPU contexts 450.
[0061] Fig. 4B shows an ASID table entry 412 according to one embodiment of the present invention. The ASID table entry 412 includes an ASID field 414 and a corresponding page data link (PDBID) field 416 that points to a page table located in memory for the ASID value specified in the ASID field 414. In one embodiment, the PDBID 416 is a page directory base (PDB) that corresponds to a physical address reference for page tables 420 in memory. The page table may be located in the PPU memory 204 or in the system memory 104.
[0062] Fig. Figure 4C illustrates a page table entry 422 according to one embodiment of the present invention. Page table entry (PTE) 422 includes a virtual address field 424 and a corresponding physical address field 426. A given page table is associated with a specific ASID, which is implicitly linked to a virtual address specified in virtual address field 424.
[0063] Fig. 4D shows a TLB entry 432 according to an embodiment of the present invention. The TLB entry 432 includes an ASID field 434, a virtual address field 436, and a corresponding physical address field 438. The ASID field 434 and the virtual address field 436 include a lookup tag and a lookup tag, respectively, for locating the physical address field 438. A given TLB 430 may include multiple TLB entries 432 having a mix of ASID values within the ASID field 434. The TLB 430 is capable of caching virtual address-to-physical address mappings for independent virtual address spaces by including the ASID field 434 as part of the lookup tag in a virtual-to-physical address mapping operation specified by the TLB entry 432.
[0064] Fig. 5 illustrates a translation of an ASID and a virtual address (VA) to a physical address (PA) according to one embodiment of the present invention. This operation may be performed in response to a miss within a TLB 430. The ASID 510 and the VA 520 contain a lookup request. The ASID 510 is used to perform a lookup in the ASID table 410. In this example, the lookup or lookup matches the ASID stored in the ASID table entry 412(1), which references the page table 420(1). In this example, the lookup matches the VA field 424 of the PTE 422(e). A corresponding PA field 426 in the PTE 422(e) completes a mapping to the PA 530, which is set to the value of the PA field 426 in the PTE 422(e).Multiple page tables 420 may remain active at any time, and the TLBs 420 may retrieve virtual-to-physical address mappings from any of the multiple page tables 420 upon a TLB miss. Maintaining a different page table 420 per virtual address space, specified by the ASID, allows multiple virtual address spaces to coexist and map to a common physical address space, as described below. Fig. 6. In one embodiment, the ASID specifies both a GPU context and a special page table identifier associated with the GPU context.
[0065] Fig. 6 shows two concurrent virtual address spaces 610(0), 610(1) coexisting within a single physical address space 620 according to one embodiment of the present invention. A VA space 610(0) contains multiple virtual address pages mapped to corresponding physical address pages within the PA space 620 via a mapping function 630. Similarly, the VA space 610(1) contains multiple virtual address pages mapped to corresponding physical address pages in the PA space 620.
[0066] As shown, VA space 610(0) includes a VA page at 0x0..0000 that maps to PA page 0x0..0000, and a VA page at 0x0..0001 that maps to PA page 0x0..0001. VA space 610(1) also includes VA pages at 0x0..0000 and 0x0..0001, but these VA pages are mapped to PA pages 0x0..0002 and 0x0..0003, respectively. One application context 405 may include memory reserved in virtual address space 610(0), and another application context may include memory reserved in virtual address space 610(1). By maintaining distinct virtual address spaces identified by the ASID, resources can be managed and allocated consistently by application code executing in CPU 102 through threaded programs executing in parallel processing subsystem 112. In a usage model, a specific PA page is mapped to two or more VA spaces.In such a usage model, the PA page comprises a shared memory page with two or more different virtual address representations in corresponding execution contexts.
[0067] Fig. Figure 7 illustrates the initialization of the parallel processing subsystem 112 to execute multiple thread programs with different virtual address spaces containing a single context, according to one embodiment of the present invention. The FE 212 reads the TMDs 452. Fig. 4A, which include a GPU context 450 selected for execution by the parent unit 206. Each set of TMDs 452 includes an ASID 714. In one embodiment, the RM 454 assigns an ASID 714 to each different set of TMDs 452. A scheduling unit 710 determines that specific TMDs 452 should be scheduled for execution and sends an execution request to a computation work distribution unit (CWD) 720, which distributes the work for the TMDs 452 among one or more SMs 310 to establish a grid of one or more CTAs specified by the TMDs 452. As previously described in Fig. 3B, each CTA may contain one or more thread groups. Each thread group of a CTA is associated with a common ASID 714. In one embodiment, the scheduling unit 710 comprises the task management unit 300 of Fig. 3A and the CWD 720 includes the work distribution unit 340.
[0068] Different distribution strategies for mapping a grid of CTAs to available SMs 310 can be implemented. One approach, referred to herein as "deep allocation," preferably assigns CTAs belonging to the same grid to a minimum number of different SMs 310 to generally maximize cache affinity for both TLB caching and data caching. For example, if a single SM 310 is capable of handling a full grid, then the CWD 720 assigns all CTAs for the grid to a single SM 310. In this example, the grid 760 further includes the CTAs 750 associated with the SM 310(0). Similarly, grid 762 includes CTAs 752 assigned to SM 310(n), and grid 764 includes CTAs 754 assigned to SM 310(n).CTAs 750 are likely to have cache affinity for both TLB calls and data caching. Similarly, CTAs 752 are likely to have a similar cache affinity, generally improving overall performance.
[0069] Deep allocation is suitable for scenarios where multiple different virtual address spaces are needed to handle concurrent execution of different thread programs bundled into a common GPU context. Deep allocation generally maximizes GPU utilization by allowing multiple smaller grids to coexist. Deep allocation is enabled in embodiments of the present invention that allow multiple virtual address spaces required for the different grids to coexist in the TLBs 430 and the MMU 328. Wide allocation distributes CTAs associated with a particular grid among available SMs 310. Wide allocation is suitable for scenarios where a single grid is configured to require a large number of CTAs operating within the same virtual address space.A wide allocation generally maximizes the performance of a single task by generally maximizing parallelism between threads associated with the task. Detecting that a deep allocation should be used is enabled by the ASID 714 attribute of the set of TMDs 452. For example, if multiple different ASID values are represented among multiple TMDs 452 within a single GPU context 450 scheduled for execution, then a deep allocation may be preferred over a wide allocation.
[0070] Fig. 8 is a flowchart of a method 800 for concurrently executing two or more thread programs having different virtual address spaces in the parallel processing subsystem according to an embodiment of the present invention. Although the method 800 may be used in conjunction with the systems of Fig. 1, Fig. 2, Fig. 3A, Fig. 3B, Fig. 3C, Fig. 4A, Fig. 5, and Fig. 7, those skilled in the art will recognize that any system configured to perform the method steps in any order is within the scope of the invention. In one embodiment, method 800 is performed by a GPU, such as PPU 202 of Fig. 2 executed.
[0071] The method 800 begins in step 810, in which the PPU retrieves a set of TMD descriptions for tasks associated with a GPU context, such as the GPU context 450 of Fig. 4A. Each set of TMDs contains information for executing a task in the PPU. The information contains references to a thread program that implements the task and contains a corresponding page table for translating virtual addresses generated by the task into physical addresses. In step 820, a scheduling unit in the PPU schedules each task for execution in an available SM, such as an SM 310 from Fig. 3B. In step 830, a front-end context switch unit in the PPU connects each different page table and corresponding ASID within the GPU context to an SM and a TLB. The connection has the effect of associating a page table and an ASID for the page table with a thread program configured to utilize the virtual address space specified by the ASID and mapped by the page table. The connection may further have the effect of invalidating a TLB in preparation for execution of the GPU context, representing a new context unrelated to the previously cached mappings residing in the TLB.
[0072] In step 840, the PPU executes each scheduled task in a corresponding SM. During execution, each task may generate one or more memory access requests for an associated virtual address space. The virtual address space is identified by an ASID value associated with the task. A memory access request for a virtual address will initially cause a TLB miss. A first TLB miss occurs as a consequence of a first SM generating a first memory access request for a first virtual address for the first time. A second TLB miss will occur as a consequence of a second SM generating a second memory access request to a second virtual address for the first time. Each memory access request includes a virtual address and an ASID.Both the virtual address and ASID must match a TLB entry tag located in a target TLB for the TLB to generate a hit. A TLB hit indicates that the virtual address and ASID containing a memory access request has a cached mapping in a target TLB. A TLB miss indicates that the TLB does not currently contain a cached mapping for a requested virtual address and ASID. In step 850, an MMU in the PPU, such as MMU 328, executes. Fig. 3B, the MMU executes a first page table call or lookup in response to the first TLB miss from the first SM. This first page table call creates a first mapping from the combination of a first virtual address and a first ASID to a corresponding physical address. The first mapping is cached in the first target TLB. In step 852, the MMU executes a second page table call in response to the second TLB miss. The second memory access request includes a second ASID, requiring the MMU to execute the second page table call using a second page table specified by the second ASID. The second mapping is cached in the second target TLB. The first target TLB and the second target TLB comprise the same TLB unit, such as a TLB 430.In one embodiment, each page table call involves traversing the page table to find an appropriate mapping for each virtual address within the corresponding virtual address space. Any technically feasible page table search technique may be implemented without departing from the scope and spirit of the present invention.
[0073] The method ends in step 890.
[0074] Fig. 9 is a flowchart of method steps for performing a virtual-to-physical address mapping in one of a plurality of different virtual address spaces according to an embodiment of the present invention. Although method 900 may be used in conjunction with the systems of Fig. 1, Fig. 2, Fig. 3A, Fig. 3B, Fig. 3C, Fig. 4A, Fig. 5 and Fig. 7, those skilled in the art will recognize that any system configured to perform the method steps in any order is within the scope of the invention. In one embodiment, method 900 is performed by a PPU, such as PPU 202 of Fig. 2, executed.
[0075] The method 900 begins in step 910, in which an MMU in the PPU receives a request to map a virtual address to a physical address, the request including a virtual address and an ASID to indicate which of a plurality of different virtual address spaces should be used to perform the mapping. If, in step 920, the mapping request does not contain a TLB hit, then the method proceeds to step 930. In step 930, the MMU maps the ASID to a page table reference using an ASID table, such as ASID table 410. In step 940, the MMU maps the virtual address to a physical address using the page table specified by the page table reference. In step 950, the MMU sends the virtual address to physical address mapping to the destination TLB for caching and later use.In step 960, the MMU associates a physical address with the allocation request to enable continuation of a linked memory access request. The method ends in step 990.
[0076] Returning to step 920, if the allocation request has a TLB hit, then the method proceeds to step 960.
[0077] Fig. 10 is a flowchart of method steps for performing deep scheduling for tasks within a context of a graphics processing unit according to an embodiment of the present invention. Although the method 1000 may be used in conjunction with the systems of the Fig. 1, Fig. 2, Fig. 3A, Fig. 3B, Fig. 3C, Fig. 4A, Fig. 5 and Fig. 7, those skilled in the art will recognize that any system configured to perform the method steps in any order is within the scope of the invention. In one embodiment, the method 1000 is performed by a PPU, such as the PPU 202 of Fig. 2, executed.
[0078] The method 1000 begins in step 1010, where a compute work distribution unit (CWD) in the PPU receives a GPU context, such as GPU context 450, that includes a plurality of tasks to be executed concurrently in the PPU. In step 1020, the CWD selects a task from the plurality of tasks comprising the GPU context. In step 1030, the CWD selects one or more SMs from a plurality of SMs based on execution requirements for the selected task and for which resources are concurrently available in the plurality of SMs. In this step, the CWD attempts to minimize the number of different SMs within which the selected task is scheduled for execution. Any technically feasible technique may be implemented to allocate available resources to task requirements to thereby satisfy the task requirements.In step 1040, the CWD schedules the selected task for execution in the one or more SMs selected from the group of multiple SMs. If, in step 1050, the selected task is not the last task residing in the GPU context, the method proceeds to step 1020. Otherwise, the method ends in step 1060.
[0079] In one embodiment, the CWD is configured to schedule an entire GPU context according to deep scheduling or deep scheduling techniques based on explicit instructions. The explicit instructions may be programmatically transmitted or via one or more environment variables. In other embodiments, the CWD may schedule each task in a GPU context individually according to a deep scheduling or deep scheduling technique according to the explicit instructions. Alternatively, the CWD may infer which scheduling technique to implement for each task based on different ASID values associated with that task.
[0080] Although the above discussion is directed to managing different tasks for execution in a common GPU context, parallel co-processors configured to execute multiple concurrent contexts with different virtual address spaces are also within the scope and spirit of embodiments of the present invention.
[0081] In certain embodiments, data caches are tagged with respect to physical addresses. In alternative embodiments, data caches are tagged with respect to virtual addresses and require an ASID as part of each tag. Both masking schemes can be combined in a single GPU.
[0082] In summary, a technique is disclosed for concurrently executing different tasks with different virtual address spaces on the same GPU. The task is associated with a virtual address space via an address space identifier (ASID). A virtual memory request generated by a currently executing task contains the ASID, which is used to select a corresponding page table. The selected page table is then used to map the virtual address containing a virtual memory request to a physical address. The page tables are established from corresponding page tables maintained by an operating system for user application processes that invoke the tasks. A translation sidebar buffer (TLB) stores the requests for virtual memory mappings for future use.A TLB entry contains a tag containing the ASID and the virtual address, and contains a data field with the corresponding physical address. In one embodiment, the tasks are consolidated into a common context for execution. The tasks can be scheduled according to a deep scheduling scheme, allowing the tasks to execute with a shared virtual address space in a minimal number of different SMs.
[0083] An advantage of the present invention is that a GPU can simultaneously execute different tasks with different virtual address spaces, thereby improving GPU utilization and performance in certain applications.
[0084] Another advantage of embodiments of the present invention is that GPU tasks can be executed with address space separation, thereby improving reliability and reducing the development effort associated with debugging.
[0085] Although the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof. For example, aspects of the present invention may be implemented in hardware or software, or in a combination of hardware and software. An embodiment of the invention may be implemented as a program product for use in a computer system. The program(s) of the program product define functions of the embodiments (including the methods described herein) and may be embodied in 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 in a computer, such as CD-ROM disks readable by a CD-ROM drive, flash memory, ROM chips, or other types of non-volatile semiconductor electronic memory) on which information is permanently stored; and (ii) writable storage media (e.g., floppy disks in a floppy disk drive or a hard disk drive, or other type of random access semiconductor electronic memory) on which alterable information is stored. Such computer-readable storage media, when containing computer-readable instructions that direct the functions of the present invention, are embodiments of the present invention.
[0086] Therefore, the scope of the present invention is defined by the following claims.
Claims
[1] In a parallel processor comprising two or more stream multiprocessors, a method of scheduling tasks for execution, the method comprising: Receiving a group of tasks associated with a first processing context, the first processing context associated with a first page table of a plurality of page tables; Selecting a first task from the group of tasks associated with a first address space identifier, ASID, and the first processing context, wherein the plurality of page tables map different virtual memory addresses to physical memory addresses via the address space identifier ASID; Selecting a minimum number of data stream multiprocessors from the two or more data stream multiprocessors that perform the tasks in the group of tasks based on the number of tasks that each data stream multiprocessor can execute simultaneously, wherein the minimum number of data stream multiprocessors comprises a first data stream multiprocessor, Assigning the tasks contained in the group of tasks to the minimum number of data stream multiprocessors, selecting the first data stream multiprocessor from the two or more data stream multiprocessors to perform the first task; Scheduling the first task for execution in the first data stream multiprocessor, Selecting a second task associated with a second ASID from the group of tasks and with the first processing context, Scheduling the second task for execution in the first data stream multiprocessor, [2] The method of claim 1, wherein selecting the first data stream multiprocessor comprises: detecting that the first data stream multiprocessor has been previously assigned to a task associated with the first processing context, thereby determining that the first data stream multiprocessor has an affinity to the first processing context. [3] The method of claim 2, wherein tasks associated with the first processing context are scheduled for execution in the first stream multiprocessor until the first stream multiprocessor can no longer handle any further tasks. [4] The method of claim 2, wherein selecting the first stream multiprocessor minimizes a maximum present workload for all stream multiprocessors executing tasks associated with the first processing context. [5] The method of claim 1, wherein the first object comprises a strand grid. [6] The method of claim 1, wherein a translation sidebar buffer (TLB) associated with the first stream multiprocessor is configured to cache the mappings of virtual memory addresses to physical memory addresses associated with the first processing context. [7] The method of claim 6, wherein the TLB is configured to cache the mappings of virtual memory addresses to physical memory addresses associated with a second processing context, and wherein a first virtual address space associated with the first processing context is different from a second virtual address space associated with the second processing context. [8] A computing device with: a central processing unit configured to execute a process having a first processing context; and a parallel processing subunit connected to the central processing unit and comprising: a subsystem comprising a data stream multiprocessor configured to: receive a group of tasks associated with a first processing context, the first processing context being associated with a first page table of a plurality of page tables; selecting a first task from the group of tasks associated with a first address space identifier, ASID, and the first processing context, wherein the plurality of page tables map different virtual memory addresses to physical memory addresses via the address space identifier ASID; a minimum number of data stream multiprocessors that select the tasks in the group of tasks from the two or more data stream multiprocessors based on the number of tasks that each data stream multiprocessor can execute simultaneously, wherein the minimum number of data stream multiprocessors comprises a first data stream multiprocessor, to assign the tasks contained in the group of tasks to the minimum number of data stream multiprocessors, to select the first data stream multiprocessor from the two or more data stream multiprocessors for the first task, to schedule the first task for execution in the first data stream multiprocessor, to select a second task associated with a second ASID from the group of tasks and with the first processing context, to schedule the second task for execution in the first data stream multiprocessor. [9] The computing device of claim 8, wherein to select the first data stream multiprocessor, the subsystem is further configured to detect that the first data stream multiprocessor has previously been assigned to a task associated with the first processing context, thereby determining that the first data stream multiprocessor has an affinity to the first processing context. [10] The computing device of claim 8, further comprising a translation sidebar buffer (TLB) configured to cache the mappings of virtual memory addresses to physical memory addresses associated with the first processing context.
Citation Information
Patent Citations
Stream processing unit for a multi-streaming processor
US20010052053A1
Scheduling threads in multi-core systems
US20090031317A1
Scheduling threads on processors
US20090187915A1
