Apparatus and method for throttling a ray tracing pipeline - Patents.com
By designing the valve ray tracing method, optimizing the architecture and algorithm of the ray tracing engine, the problem of excessive consumption of ray tracing resources in the existing technology is solved, and efficient and real-time ray tracing performance is achieved.
Patent Information
- Application Number
- JP2020212140
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-03-16
- Filing Date
- 2020-12-22
- Publication Date
- 2025-04-14
- Estimated Expiration
- 2040-12-22
AI Technical Summary
While real-time performance is achieved, it is difficult to efficiently handle visibility query and cross-operation of ray tracing in ray tracing, resulting in excessive resource consumption.
A valve ray tracing method is designed to reduce unnecessary computing and storage operations by optimizing the architecture and algorithms of the ray tracing engine, and improve the efficiency and performance of ray tracing.
It realizes the ability to maintain efficient ray tracing performance while reducing resource consumption and improving real-time performance, and is suitable for ray tracing applications in complex scenarios.
Smart Images

Figure 0007661038000002 
Figure 0007661038000003 
Figure 0007661038000004
Abstract
Description
[Technical Field]
[0001] The present invention relates generally to the field of graphics processors, and more particularly to an apparatus and method for throttling ray tracing. [Background technology]
[0002] Ray tracing is a technique in which light propagation is simulated through physically based rendering. It is widely used in movie rendering and, until just a few years ago, was considered too resource intensive for real-time performance. One of the key operations in ray tracing is processing visibility queries for ray-scene intersections, known as "ray traversal", which computes ray-scene intersections by traversing and intersecting nodes in a bounding volume hierarchy (BVH). [Brief explanation of the drawings]
[0003] A better understanding of the present invention can be obtained from the following detailed description taken in conjunction with the following drawings. [Figure 1] FIG. 1 is a block diagram of an embodiment of a computer system having a processor with one or more processor cores and a graphics processor. [Figure 2A] 1 is a block diagram of an embodiment of a processor having one or more processor cores, an integrated memory controller, and an integrated graphics processor. [Figure 2B] 1 is a block diagram of an embodiment of a processor having one or more processor cores, an integrated memory controller, and an integrated graphics processor. [Figure 2C]1 is a block diagram of an embodiment of a processor having one or more processor cores, an integrated memory controller, and an integrated graphics processor. [Figure 2D] 1 is a block diagram of an embodiment of a processor having one or more processor cores, an integrated memory controller, and an integrated graphics processor. [Figure 3A] FIG. 1 is a block diagram of an embodiment of a graphics processor, which may be a discrete graphics processing unit or a graphics processor integrated with multiple processing cores. [Figure 3B] FIG. 1 is a block diagram of an embodiment of a graphics processor, which may be a discrete graphics processing unit or a graphics processor integrated with multiple processing cores. [Figure 3C] FIG. 1 is a block diagram of an embodiment of a graphics processor, which may be a discrete graphics processing unit or a graphics processor integrated with multiple processing cores. [Figure 4] FIG. 1 is a block diagram of an embodiment of a graphics processing engine for a graphics processor. [Figure 5A] FIG. 1 is a block diagram of another embodiment of a graphics processor. [Figure 5B] FIG. 1 is a block diagram of another embodiment of a graphics processor. [Figure 6] 1 shows an example of implementation circuitry and logic. [Figure 7] 1 illustrates a graphics processor execution unit instruction format according to an embodiment. [Figure 8] FIG. 1 is a block diagram of another embodiment of a graphics processor including a graphics pipeline, a media pipeline, a display engine, thread execution logic, and a rendering output pipeline. [Figure 9A] FIG. 2 is a block diagram illustrating a graphics processor command format according to an embodiment. [Figure 9B]FIG. 2 is a block diagram illustrating a graphics processor command sequence according to an embodiment. [Figure 10] 1 illustrates an exemplary graphics software architecture for a data processing system according to an embodiment. [Figure 11A] 1 illustrates an exemplary IP core development system that can be used to manufacture an integrated circuit and an exemplary package assembly. [Figure 11B] 1 illustrates an exemplary IP core development system that can be used to manufacture an integrated circuit and an exemplary package assembly. [Figure 11C] 1 illustrates an exemplary IP core development system that can be used to manufacture an integrated circuit and an exemplary package assembly. [Figure 11D] 1 illustrates an exemplary IP core development system that can be used to manufacture an integrated circuit and an exemplary package assembly. [Figure 12] 1 illustrates an exemplary system of a system-on-chip integrated circuit that may be fabricated using one or more IP cores according to an embodiment. [Figure 13] 1 illustrates an exemplary graphics processor of a system-on-chip integrated circuit that can be manufactured using one or more IP cores. [Figure 14] 1 illustrates an exemplary graphics processor architecture. [Figure 15] 1 illustrates an architecture for performing initial training of a machine learning architecture. [Figure 16] We show how machine learning engines are continuously trained and updated during runtime. [Figure 17] We show how machine learning engines are continuously trained and updated during runtime. [Figure 18A] Shows how machine learning data is shared across networks. [Figure 18B] Shows how machine learning data is shared across networks. [Figure 19] We present a method for training a machine learning engine. [Figure 20] 10 shows how nodes exchange ghost region data to perform distributed denoising operations. [Figure 21] 1 illustrates an architecture in which image rendering and denoising operations are distributed among multiple nodes. [Figure 22] We present further details of the architecture for distributed rendering and denoising. [Figure 23] A method for performing distributed rendering and denoising is presented. [Figure 24] Demonstrate machine learning methods. [Figure 25] 1 shows multiple interconnected general-purpose graphics processors. [Figure 26] A set of convolutional and fully connected layers for machine learning implementation is shown. [Figure 27] Here is an example of a convolutional layer. [Figure 28] 1 illustrates an example of a set of interconnected nodes in a machine learning implementation. [Figure 29] We present a training framework in which a neural network learns using a training dataset. [Figure 30A] An example of model parallelism and data parallelism will be given. [Figure 30B] Refers to a system on a chip (SoC). [Figure 31] 1 shows a processing architecture including a ray tracing core and a tensor core. [Figure 32] An example of a beam is shown. [Figure 33] 1 shows an apparatus for performing beam tracing. [Figure 34] 1 shows an example of a beam hierarchy. [Figure 35] 1 illustrates a method for performing beam tracing. [Figure 36] An example of a distributed ray tracing engine is shown. [Figure 37] This shows the compression performed by the ray tracing system. [Figure 38] This shows the compression performed by the ray tracing system. [Figure 39] We show how it can be implemented on a ray tracing architecture. [Figure 40] 1 illustrates an exemplary hybrid ray tracing apparatus. [Figure 41] 1 shows the stack used for ray tracing operations. [Figure 42] Further details are given for the hybrid ray tracing device. [Figure 43] 1 shows the bounding volume hierarchy. [Figure 44] Shows the call stack and traversal state storage. [Figure 45] Methods for traversal and intersection are presented. [Figure 46A] Shows how multiple dispatch cycles are required to execute a particular shader. [Figure 46B] Shows how multiple dispatch cycles are required to execute a particular shader. [Figure 47] Shows how a single dispatch cycle can execute multiple shaders. [Figure 48] Shows how a single dispatch cycle can execute multiple shaders. [Figure 49] 1 illustrates an architecture for executing ray tracing instructions. [Figure 50] 1 illustrates a method for executing ray tracing instructions within a thread. [Figure 51] 1 illustrates one embodiment of an architecture for asynchronous ray tracing. [Figure 52] 1 illustrates an embodiment of a ray traversal circuit. [Figure 53] 1 illustrates memory-backed stack management according to one embodiment of the present invention. [Figure 54]1 illustrates synchronous and asynchronous message processing according to one embodiment. [Figure 55] 1 illustrates a method according to one embodiment of the present invention. [Figure 56] 1 illustrates an embodiment of the present invention operating on a sub-slice of execution resources. DETAILED DESCRIPTION OF THE INVENTION
[0004] In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present invention described below. However, it will be apparent to those skilled in the art that embodiments of the present invention may be practiced without some of these specific details. In other instances, well-known structures and devices are shown in block diagram form to avoid obscuring the underlying principles of the embodiments of the present invention.
[0005] Exemplary Graphics Processor Architecture and Data Types (System Overview) 1 is a block diagram of a processing system 100 according to an embodiment. System 100 may be used in a single processor desktop system, a multiprocessor workstation system, or a server system having multiple processors 102 or processor cores 107. In one embodiment, system 100 is a processing platform embedded in a system-on-a-chip (SoC) integrated circuit for use in mobile, handheld, or embedded devices, such as in Internet-of-things (IoT) devices with wired or wireless connectivity to local or wide area networks.
[0006] In one embodiment, system 100 can include, be coupled to, or be integrated within a server-based gaming platform, a gaming console, including a game and media console, a mobile gaming console, a handheld gaming console, or an online gaming console. In some embodiments, system 100 is part of a mobile internet-connected device such as a mobile phone, a smartphone, a tablet computing device, or a laptop with small internal storage capacity. Processing system 100 can also include, be coupled to, or be integrated within a wearable device, such as a smartwatch wearable device; smart eyewear or clothing enhanced with augmented reality (AR) or virtual reality (VR) functionality to provide visual, audio, or haptic output to supplement a real-world visual, audio, or haptic experience, or to provide text, audio, graphics, video, holographic images or video, or haptic feedback; other augmented reality (AR) devices; or other virtual reality (VR) devices. In some embodiments, processing system 100 includes or is part of a television or set-top box device. In one embodiment, system 100 may include, be coupled to, or be integrated within an autonomous vehicle, such as a bus, a tractor-trailer, an automobile, a motor or power cycle, an airplane, or a glider (or any combination thereof). The autonomous vehicle may use system 100 to process the sensed environment around the vehicle.
[0007] In some embodiments, one or more processors 102 each include one or more processor cores 107 for processing instructions that, when executed, perform operations for system or user software. In some embodiments, at least one of the one or more processor cores 107 is configured to process a particular instruction set 109. In some embodiments, the instruction set 109 may implement Complex Instruction Set Computing (CISC), Reduced Instruction Set Computing (RISC), or computation via a Very Long Instruction Word (VLIW). One or more processor cores 107 may process different instruction sets 109, and the different instruction sets 109 may include instructions for implementing emulation of other instruction sets. The processor cores 107 may also include other processing devices, such as a Digital Signal Processor (DSP).
[0008] In some embodiments, processor 102 includes cache memory 104. Depending on the architecture, processor 102 may have a single internal cache or multiple levels of internal cache. In some embodiments, cache memory is shared among various components of processor 102. In some embodiments, processor 102 also uses an external cache (e.g., a Level-3 (L3) cache or a Last Level Cache (LLC)) (not shown), which may be shared among processor cores 107 using known cache coherency techniques. A register file 106 may also be included in processor 102 and may include different types of registers for storing different types of data (e.g., integer registers, floating-point registers, status registers, and instruction pointer registers). Some registers may be general-purpose registers, while other registers may be specific to the design of processor 102.
[0009] In some embodiments, one or more processors 102 are coupled to one or more interface buses 110 for transmitting communication signals, such as address, data, or control signals, between the processors 102 and other components in the system 100. In one embodiment, the interface bus 110 may be a processor bus such as a version of a Direct Media Interface (DMI) bus. However, the processor bus is not limited to a DMI bus and may include one or more peripheral component interconnect buses (e.g., PCI, PCI express), memory buses, or other types of interface buses. In one embodiment, the processor 102 includes an integrated memory controller 116 and a platform controller hub 130. The memory controller 116 facilitates communication between memory devices and other components of the system 100, and the platform controller hub (PCH) 130 provides connectivity to I / O devices via a local I / O bus.
[0010] Memory device 120 may be a dynamic random access memory (DRAM) device, a static random access memory (SRAM) device, a flash memory device, a phase-change memory device, or other memory device with performance suitable for serving as process memory. In one embodiment, memory device 120 may operate as system memory for system 100 for storing data 122 and instructions 121 for use by one or more processors 102 when executing applications or processes. Memory controller 116 also couples to an optional external graphics processor 118, which may communicate with one or more graphics processors 108 within processor 102 to perform graphics and media operations. In some embodiments, graphics, media, or compute operations may be assisted by accelerator 112, which is a co-processor that can be configured to perform a specialized set of graphics, media, or compute operations. For example, in one embodiment, accelerator 112 is a matrix multiplication accelerator used to optimize machine learning or compute operations. In one embodiment, accelerator 112 is a ray tracing accelerator that can be used to perform ray tracing operations in cooperation with graphics processor 108. In one embodiment, an external accelerator 119 may be used instead of or in cooperation with accelerator 112.
[0011] In some embodiments, a display device 111 can be connected to the processor 102. The display device 111 can be one or more internal display devices, such as those of a mobile electronic device or laptop device, or one or more external display devices attached via a display interface (e.g., DisplayPort, etc.). In one embodiment, the display device 111 can be a head-mounted display (HMD), such as a stereoscopic display device for use in virtual reality (VR) or augmented reality (AR) applications.
[0012] In some embodiments, the platform controller hub 130 allows peripherals to connect to the memory device 120 and the processor 102 via a high-speed I / O bus. The I / O peripherals include, but are not limited to, an audio controller 146, a network controller 134, a firmware interface 128, a wireless transceiver 126, a touch sensor 125, and a data storage device 124 (e.g., non-volatile memory, volatile memory, hard disk drive, flash memory, NAND, 3D NAND, 3D XPoint, etc.). The data storage device 124 can be connected via a peripheral bus such as a storage interface (e.g., SATA) or a peripheral component interconnect bus (e.g., PCI, PCI express). The touch sensor 125 can include a touchscreen sensor, a pressure sensor, or a fingerprint sensor. The wireless transceiver 126 can be a Wi-Fi transceiver, a Bluetooth transceiver, or a mobile network transceiver such as a 3G, 4G, 5G, or Long-Term Evolution (LTE) transceiver. Firmware interface 128 enables communication with system firmware and may be, for example, a unified extensible firmware interface (UEFI). Network controller 134 may enable network connectivity to a wired network. In some embodiments, a high-performance network controller (not shown) couples to interface bus 110. In one embodiment, audio controller 146 is a multi-channel high-definition audio controller. In one embodiment, system 100 includes an optional legacy I / O controller 140 for coupling legacy (e.g., Personal System 2 (PS / 2)) devices to the system.Platform controller hub 130 may also connect to one or more Universal Serial Bus (USB) controllers 142 to which input devices such as a keyboard and mouse combination 143, a camera 144, or other USB input devices may be connected.
[0013] It is recognized that the illustrated system 100 is exemplary and not limiting, as other types of data processing systems configured differently may also be used. For example, instances of memory controller 116 and platform controller hub 130 may be integrated into a separate external graphics processor, such as external graphics processor 118. In one embodiment, platform controller hub 130 and / or memory controller 116 may be external to one or more processors 102. For example, system 100 may include external memory controller 116 and platform controller hub 130, which may be configured as a memory controller hub and a peripheral controller hub within a system chipset that communicates with processor 102.
[0014] For example, a circuit board ("sled") on which components such as CPUs, memory, and other components are placed can be used, designed for increased thermal performance. In some examples, processing components such as processors are placed on the top surface of the sled, and near memory such as DIMMs are placed on the bottom surface of the sled. As a result of the increased airflow provided by this design, components may operate at higher frequencies and power levels than in typical systems, thereby increasing performance. Furthermore, the sled is configured to blind-mate with power and data communication cables in the rack, thereby enhancing the ability to quickly remove, upgrade, reinstall, and / or replace them. Similarly, individual components placed on the sled, such as processors, accelerators, memory, and data storage drives, are configured to be easily upgraded due to the increased spacing between them. In an exemplary embodiment, the components further include hardware authentication features to prove their authenticity.
[0015] Data centers can utilize a single network architecture ("fabric") that supports multiple other network architectures, including Ethernet and Omni-Path. SLEDs can be coupled to switches via optical fiber, which provides higher bandwidth and lower latency than typical twisted-pair cabling (e.g., Category 5, Category 5e, Category 6, etc.). Because of the high-bandwidth, low-latency interconnect and network architecture, data centers can pool resources such as physically disaggregated memory, accelerators (e.g., GPUs, graphics accelerators, FPGAs, ASICs, neural network and / or artificial intelligence accelerators, etc.), and data storage drives, and provide them to computational resources (e.g., processors) as needed, allowing the computational resources to access the pooled resources as if they were local.
[0016] A power supply or power source can provide voltage and / or current to system 100 or any component or system described herein. In one example, the power supply includes an AC-DC (alternating current to direct current) adapter for plugging into an electrical outlet. Such AC power can be a renewable energy (e.g., solar power) source. In one example, the power source includes a DC power source, such as an external AC-DC converter. In one example, the power source or power supply includes wireless charging hardware for charging via proximity of a charging field. In one example, the power source can include an internal battery, an AC power source, a motion-based power source, a solar power source, or a fuel cell power source.
[0017] 2A-2D illustrate a computing system and graphics processor provided in accordance with embodiments described herein. Elements in FIG. 2A-2D having the same reference number (or name) as elements in any other figure herein can operate or function in a manner similar to that described elsewhere herein, but are not limited to such.
[0018] FIG. 2A is a block diagram of an embodiment of a processor 200 having one or more processor cores 202A-202N, an integrated memory controller 214, and an integrated graphics processor 208. The processor 200 may include additional cores, including an additional core 202N, represented by a dashed box. Each of the processor cores 202A-202N includes one or more internal cache units 204A-204N. In some embodiments, each processor core also has access to one or more shared cache units 206. The internal cache units 204A-204N and the shared cache unit 206 represent a cache memory hierarchy within the processor 200. The cache memory hierarchy may include at least one level of instruction and data cache within each processor core and one or more levels of shared mid-level cache, such as a level 2 (L2), level 3 (L3), level 4 (L4), or other level cache, with the highest level of cache before external memory being classified as an LLC. In some embodiments, cache coherency logic maintains coherency between the various cache units 206 and 204A-204N.
[0019] In some embodiments, processor 200 may include a set of one or more bus controller units 216 and a system agent core 210. The one or more bus controller units 216 manage a set of peripheral buses, such as one or more PCI or PCI Express buses. The system agent core 210 provides management functions for various processor components. In some embodiments, system agent core 210 includes one or more integrated memory controllers 214 to manage access to various external memory devices (not shown).
[0020] In some embodiments, one or more of processor cores 202A-202N include support for simultaneous multithreading. In such embodiments, system agent core 210 includes components for coordinating the operation of cores 202A-202N during multithreaded processing. System agent core 210 may also include a power control unit (PCU), which includes logic and components for coordinating the power state of processor cores 202A-202N and graphics processor 208.
[0021] In some embodiments, processor 200 further includes a graphics processor 208 for performing graphics processing operations. In some embodiments, graphics processor 208 couples to a set of shared cache unit 206 and system agent core 210, which includes one or more integrated memory controllers 214. In some embodiments, system agent core 210 also includes a display controller 211 for driving graphics processor output to one or more coupled displays. In some embodiments, display controller 211 may also be a separate module coupled to the graphics processor via at least one interconnect, or may be integrated within graphics processor 208.
[0022] In some embodiments, a ring-based interconnect unit 212 is used to couple the internal components of processor 200. However, alternative interconnect units, such as a point-to-point interconnect, a switched interconnect, or other technologies, including technologies known in the art, may be used. In some embodiments, graphics processor 208 couples to ring interconnect 212 via I / O link 213.
[0023] The exemplary I / O link 213 represents at least one of several types of I / O interconnects, including an on-package I / O interconnect that provides communication between various processor components and a high-performance embedded memory module 218, such as an eDRAM module. In some embodiments, each of the processor cores 202A-202N and the graphics processor 208 can use the embedded memory module 218 as a shared last-level cache.
[0024] In some embodiments, processor cores 202A-202N are homogenous cores that execute the same instruction set architecture. In other embodiments, processor cores 202A-202N are heterogeneous with respect to instruction set architecture (ISA), where one or more of processor cores 202A-202N execute a first instruction set while at least one of the other cores executes a subset of the first instruction set or a different instruction set. In one embodiment, processor cores 202A-202N are heterogeneous with respect to microarchitecture, where one or more cores with relatively high power consumption are combined with one or more cores with lower power consumption. In one embodiment, processor cores 202A-202N are heterogeneous with respect to computational capability. Furthermore, processor 200 can be implemented on one or more chips or as an SoC integrated circuit having the illustrated components, in addition to other components.
[0025] FIG. 2B is a block diagram of hardware logic for a graphics processor core 219 according to some embodiments described herein. Elements of FIG. 2B having the same reference number (or name) as elements of any other figure herein can operate or function in a manner similar to that described elsewhere herein, but are not limited to such. The graphics processor core 219, sometimes referred to as a core slice, can be one or more graphics cores within a modular graphics processor. The graphics processor core 219 is an example of one graphics core slice; the graphics processors described herein may include multiple graphics core slices based on target power and performance envelopes. Each graphics processor core 219 can include a fixed-function block 230 coupled to multiple sub-cores 221A-221F, also referred to as sub-slices, which include modular blocks of general-purpose and fixed-function logic.
[0026] In some embodiments, fixed function block 230 includes a geometry / fixed function pipeline 231 that can be shared by all sub-cores within graphics processor core 219, for example, in a low-performance and / or low-power graphics processor implementation. In various embodiments, geometry / fixed function pipeline 231 includes a 3D fixed function pipeline (e.g., 3D pipeline 312 as in Figures 3 and 4 described below), a video front-end unit, a thread generator and thread dispatcher, and a unified return buffer manager that manages a unified return buffer (e.g., unified return buffer 418 in Figure 4 described below).
[0027] In one embodiment, fixed function block 230 also includes a graphics SoC interface 232, a graphics microcontroller 233, and a media pipeline 234. Graphics SoC interface 232 provides an interface between graphics processor core 219 and other processor cores within the system-on-chip integrated circuit. Graphics microcontroller 233 is a programmable sub-processor that can be configured to manage various functions of graphics processor core 219, including thread dispatch, scheduling, and preemption. Media pipeline 234 (e.g., media pipeline 316 in FIGS. 3 and 4) includes logic for decoding, encoding, pre-processing, and / or post-processing multimedia data, including image and video data. Media pipeline 234 performs media operations via requests to compute or sample logic within sub-cores 221-221F.
[0028] In one embodiment, SoC interface 232 enables graphics processor core 219 to communicate with a general-purpose application processor core (e.g., a CPU) and / or other components within the SoC, including memory hierarchy elements such as shared last-level cache memory, system RAM, and / or embedded on-chip or on-package DRAM. SoC interface 232 can also enable communication with fixed-function devices within the SoC, such as a camera image processing pipeline, and enable and / or implement the use of global memory atomics that may be shared between graphics processor core 219 and a CPU within the SoC. SoC interface 232 can also implement power management controls for graphics processor core 219 and enable an interface between the clock domain of graphics core 219 and other clock domains within the SoC. In one embodiment, SoC interface 232 enables receipt of command buffers from a command streamer and global thread dispatcher configured to provide commands and instructions to each of one or more graphics cores within the graphics processor. Commands and instructions can be dispatched to the media pipeline 234 when media operations are performed, and to the geometry and fixed function pipelines (e.g., geometry and fixed function pipeline 231, geometry and fixed function pipeline 237) when graphics processing operations are performed.
[0029] Graphics microcontroller 233 can be configured to perform various scheduling and management tasks for graphics processor core 219. In one embodiment, graphics microcontroller 233 can perform graphics and / or compute workload scheduling on various graphics parallel engines within execution unit (EU) arrays 222A-222F, 224A-224F within sub-cores 221A-221F. In this scheduling model, host software executing on a CPU core of an SoC including graphics processor core 219 can submit a workload to one of multiple graphics processor doorbells, which invokes scheduling operations on the appropriate graphics engine. The scheduling operations include determining which workload to run next, submitting the workload to a command streamer, pre-empting existing workloads running on the engines, monitoring the progress of the workload, and notifying host software when the workload is complete. In one embodiment, graphics microcontroller 233 can also implement low power or idle states for graphics processor core 219, providing graphics processor core 219 with the ability to save and restore registers within graphics processor core 219 between low power state transitions independent of the operating system and / or graphics driver software on the system.
[0030] Graphics processor core 219 may have more or less than the illustrated sub-cores 221A-221F and may have up to N modular sub-cores. For each set of N sub-cores, graphics processor core 219 may also include shared function logic 235, shared and / or cache memory 236, geometry / fixed function pipeline 237, and additional fixed function logic 238 for accelerating various graphics and compute operations. Shared function logic 235 may include logical units associated with shared function logic 420 of FIG. 4 (e.g., samplers, math operations, and / or inter-thread communication logic) that may be shared by each of the N sub-cores in graphics processor core 219. Shared and / or cache memory 236 may be a last-level cache for the set of N sub-cores 221A-221F in graphics processor core 219 and may also function as a shared memory accessible by multiple sub-cores. Geometry / fixed function pipeline 237 may be included in place of geometry / fixed function pipeline 231 in fixed function block 230 and may include the same or similar logical units.
[0031] In one embodiment, graphics processor core 219 includes further fixed function logic 238, which may include various fixed-function acceleration logic used by graphics processor core 219. In one embodiment, further fixed function logic 238 includes an additional geometry pipeline for use with position-only shading. In position-only shading, there are two geometry pipelines: geometry / fixed function pipeline 238, the full geometry pipeline in 231, and a further geometry pipeline, the cull pipeline, which may be included in further fixed function logic 238. In one embodiment, the cull pipeline is a trimmed version of the full geometry pipeline. The full pipeline and the cull pipeline may run different instances of the same application, with each instance having a separate context. Position-only shading can hide lengthy culling runs of discarded triangles, allowing shading to complete sooner in some cases. For example, in one embodiment, the culling pipeline logic in the additional fixed-function logic 238 can execute a position shader in parallel with the main application and generally generate critical results faster than the full pipeline because the culling pipeline fetches and shades only the position attributes of vertices without performing pixel rasterization and rendering to the frame buffer. The culling pipeline can use the generated critical results to calculate visibility information for all triangles, regardless of whether they are culled or not. The full pipeline (which in this case may be called a reproduction pipeline) can consume the visibility information to skip culled triangles to shade only visible triangles that are ultimately passed to the rasterization stage.
[0032] In one embodiment, the additional fixed function logic 238 may also include machine learning acceleration logic, such as fixed function matrix multiplication logic, for implementations that include optimizations for machine learning training or inference.
[0033] Within each graphics subcore 221A-221F is a set of execution resources that can be used to perform graphics, media, and compute operations as requested by the graphics pipeline, media pipeline, or shader programs. The graphics subcores 221A-221F include a plurality of EU arrays 222A-222F, 224A-224F, thread dispatch and inter-thread communication (TD / IC) logic 223A-223F, 3D (e.g., texture) samplers 225A-225F, media samplers 226A-226F, shader processors 227A-227F, and shared local memory (SLM) 228A-228F. The EU arrays 222A-222F, 224A-224F each include multiple execution units, which are general-purpose graphics processing units capable of performing floating-point and integer / fixed-point logical operations in service of graphics, media, or compute operations, including graphics, media, and compute shader programs. The TD / IC logic 223A-223F performs local thread dispatch and thread control operations for the execution units within a sub-core and facilitates communication between threads executing on the execution units of a sub-core. The 3D samplers 225A-225F can load textures or other 3D graphics-related data into memory. The 3D samplers can read texture data differently based on the configured sample state and the texture format associated with a given texture. The media samplers 226A-226F can perform similar read operations based on the type and format associated with the media data. In one embodiment, each graphics sub-core 221A-221F can alternately include a unified 3D and media sampler. Threads executing on execution units within each of the sub-cores 221A-221F can utilize shared local memory 228A-228F within each sub-core to enable threads executing within a thread group to execute using a common pool of on-chip memory.
[0034] 2C illustrates a graphics processing unit (GPU) 239 that includes a dedicated set of graphics processing resources arranged into multi-core groups 240A-240N. Details of only a single multi-core group 240A are provided, but it will be appreciated that other multi-core groups 240B-240N may include the same or similar sets of graphics processing resources.
[0035] As shown, multicore group 240A may include a set of graphics cores 243, a set of tensor cores 244, and a set of ray tracing cores 245. Scheduler / dispatcher 241 schedules and dispatches graphics threads for execution on the various cores 243, 244, and 245. Set of register files 242 store operand values used by cores 243, 244, and 245 when executing the graphics threads. These may include, for example, integer registers for storing integer values, floating-point registers for storing floating-point values, vector registers for storing packed data elements (integer and / or floating-point data elements), and tile registers for storing tensor / matrix values. In one embodiment, the tile registers are implemented as a combined set of vector registers.
[0036] One or more combined level 1 (L1) cache and shared memory units 247 store graphics data, such as texture data, vertex data, pixel data, ray data, bounding volume data, etc., locally within each multicore group 240A. One or more texture units 247 can also be used to perform texture operations, such as texture mapping and sampling. A level 2 (L2) cache 253 is shared by all or a subset of the multicore groups 240A-240N and stores graphics data and / or instructions for multiple simultaneous graphics threads. As shown, the L2 cache 253 may be shared among multiple multicore groups 240A-240N. One or more memory controllers 248 couple the GPU 239 to memory 249, which may be system memory (e.g., DRAM) and / or dedicated graphics memory (e.g., GDDR6 memory).
[0037] Input / output (I / O) circuitry 250 couples GPU 239 to one or more I / O devices 252, such as a digital signal processor (DSP), a network controller, or a user input device. On-chip interconnects may be used to couple I / O device 252 to GPU 239 and memory 249. One or more I / O memory management units (IOMMUs) 251 of I / O circuitry 250 directly couple I / O device 252 to system memory 249. In one embodiment, IOMMU 251 manages multiple sets of page tables to map virtual addresses to physical addresses in system memory 249. In this embodiment, I / O device 252, CPU 246, and GPU 239 may share the same virtual address space.
[0038] In one implementation, IOMMU 251 supports virtualization. In this case, IOMMU 251 may manage (e.g., within system memory 249) a first set of page tables for mapping guest / graphics virtual addresses to guest / graphics physical addresses and a second set of page tables for mapping guest / graphics physical addresses to system / host physical addresses. The respective base addresses of the first and second sets of page tables may be stored in control registers and swapped upon context switch (e.g., so that a new context is provided access to the associated set of page tables). Although not shown in FIG. 2C , each of cores 243, 244, 245 and / or multicore groups 240A-240N may include a translation lookaside buffer (TLB) for caching guest-virtual-to-guest-physical translations, guest-physical-to-host-physical translations, and guest-virtual-to-host-physical translations.
[0039] In one embodiment, CPU 246, GPU 239, and I / O devices 252 are integrated into a single semiconductor chip and / or chip package. The illustrated memory 249 may be integrated on the same chip or may be coupled to memory controller 248 via an off-chip interface. In one implementation, memory 249 includes GDDR6 memory that shares the same virtual address space as other physical system-level memory, although the underlying principles of the present invention are not limited to this particular implementation.
[0040] In one embodiment, tensor cores 244 include multiple execution units specifically designed to perform matrix operations, which are fundamental computational operations used to perform deep learning operations. For example, simultaneous matrix multiplication operations may be used for neural network training and inference. Tensor cores 244 may perform matrix processing using a variety of operand precisions, including single-precision floating-point (e.g., 32 bits), half-precision floating-point (e.g., 16 bits), integer word (16 bits), byte (8 bits), and half-byte (4 bits). In one embodiment, neural network implementations extract features from each rendered scene, potentially combining details from multiple frames to construct a high-quality final image.
[0041] In deep learning implementations, parallel matrix multiplication operations may be scheduled to run on tensor cores 244. Neural network training, in particular, requires a significant number of matrix dot product operations. To process the inner product of an N×N×N matrix multiplication, tensor cores 244 may include at least N dot product processing elements. Before the matrix multiplication begins, one entire matrix is loaded into a tile register, and at least one column of a second matrix is loaded every N cycles. There are N dot products to be processed every cycle.
[0042] Matrix elements may be stored with different precisions depending on the particular implementation, including 16-bit words, 8-bit bytes (e.g., INT8), and 4-bit half-bytes (e.g., INT4). Different precision modes may be specified for tensor core 244 to ensure that the most efficient precision is used for different workloads (e.g., inference workloads that can tolerate quantization to bytes and half-bytes).
[0043] In one embodiment, ray tracing core 245 accelerates ray tracing computations for both real-time ray tracing and non-real-time ray tracing implementations. In particular, ray tracing core 245 includes ray traversal / intersection circuitry for performing ray traversals using a bounding volume hierarchy (BVH) and identifying intersections between rays and primitives enclosed within the BVH volume. Ray tracing core 245 may also include circuitry for performing depth testing and culling (e.g., using a Z-buffer or similar construct). In one embodiment, ray tracing core 245 performs traversal and intersection operations in coordination with the image denoising techniques described herein, at least some of which may be executed on tensor core 244. For example, in one embodiment, tensor core 244 implements a deep learning neural network to perform denoising of frames produced by ray tracing core 245. However, the CPU 246, graphics core 243 and / or ray tracing core 245 may also implement all or part of the denoising and / or deep learning algorithms.
[0044] Additionally, as noted above, a distributed approach to denoising may be used, where the GPU 239 resides in a computing device coupled to other computing devices over a network or high-speed interconnect. In this embodiment, the interconnected computing devices share neural network learning / training data to improve the speed at which the overall system learns to perform denoising for different types of image frames and / or different graphics applications.
[0045] In one embodiment, ray tracing core 245 handles all BVH traversal and ray-primitive intersections, preventing graphics core 243 from becoming overloaded with thousands of instructions per ray. In one embodiment, each ray tracing core 245 includes a first set of specialized circuitry for performing bounding box tests (e.g., for traversal operations) and a second set of specialized circuitry for performing ray-triangle intersection tests (e.g., for traversed intersecting rays). Thus, in one embodiment, multi-core group 240A can simply launch ray probes, and ray tracing core 245 independently performs ray traversal and intersections and returns hit data (e.g., hit, no hit, multiple hits, etc.) to the thread context. The other cores 243, 244 are freed to perform other graphics or compute work while ray tracing core 245 performs traversal and intersection operations.
[0046] In one embodiment, each ray tracing core 245 includes a traversal unit for performing BVH test operations and an intersection unit for performing ray-primitive intersection tests. The intersection unit generates a "hit," "no hit," or "multi-hit" response and provides it to the appropriate thread. Between traversal and intersection operations, the execution resources of other cores (e.g., graphics core 243 and tensor core 244) are freed to perform other forms of graphics work.
[0047] In one particular embodiment described below, a hybrid rasterization / ray tracing approach is used in which work is distributed between the graphics core 243 and the ray tracing core 245.
[0048] In one embodiment, ray tracing core 245 (and / or other cores 243, 244) includes a ray tracing instruction set such as Microsoft's DXR (DirectX Ray Tracing), including the DispatchRays command, and hardware support for ray generation shaders, closest-hit shaders, any-hit shaders, and miss shaders, allowing for the allocation of a unique set of shaders and textures for each object. Another ray tracing platform that may be supported by ray tracing core 245, graphics core 243, and tensor core 244 is Vulkan 1.1.85. However, it should be noted that the underlying principles of the present invention are not limited to any particular ray tracing ISA.
[0049] In general, the various cores 245, 244, 243 may support a ray tracing instruction set that includes ray generation, closest hit, any hit, ray-primitive intersection, per-primitive and hierarchical bounding box construction, miss, visit, and exception instructions / functions. More specifically, one embodiment includes ray tracing instructions for performing the following functions:
[0050] Ray Generation - Ray generation instructions may be executed for each pixel, sample, or other user-defined allocation of work.
[0051] Closest-Hit - The closest-hit command may be executed to find the closest intersection of a ray with a primitive in the scene.
[0052] Any-Hit - The Any-Hit command identifies multiple intersections between rays and primitives in the scene to potentially identify new nearest intersection points.
[0053] Intersection - The intersection command performs a ray-primitive intersection test and outputs the result.
[0054] Per-primitive Bounding Box Construction - This instruction constructs a bounding box around a given primitive or group of primitives (e.g., when constructing a new BVH or other acceleration data structure).
[0055] Miss - Indicates that the ray misses all geometry in the scene or a specified region of the scene.
[0056] Visit - Indicates the child volume the ray travels through.
[0057] Exceptions - Contains various types of exception handlers (e.g., invoked for various error conditions).
[0058] 2D is a block diagram of a general purpose graphics processing unit (GPGPU) 270 that can be configured as a graphics processor and / or computer accelerator according to embodiments described herein. The GPGPU 270 can be interconnected with a host processor (e.g., one or more CPUs 246) and memories 271, 272 via one or more system and / or memory buses. In one embodiment, memory 271 is system memory that may be shared with one or more CPUs 246, and memory 272 is device memory dedicated to the GPGPU 270. In one embodiment, components within the GPGPU 270 and device memory 272 may be mapped to memory addresses accessible to one or more CPUs 246. Access to memories 271, 272 may be achieved via a memory controller 268. In one embodiment, the memory controller 268 includes an internal direct memory access (DMA) controller 269 or may include logic for performing operations otherwise performed by a DMA controller.
[0059] GPGPU 270 includes multiple cache memories, including L2 cache 253, L1 cache 254, instruction cache 255, and shared memory 256, at least some of which may be partitioned as cache memories. GPGPU 270 also includes multiple compute units 260A-260N. Each compute unit 260A-260N includes a set of vector registers 261, scalar registers 262, a vector logic unit 263, and a scalar logic unit 264. Compute units 260A-260N may also include local shared memory 265 and a program counter 266. Compute units 260A-260N may be coupled to constant cache 267, which may be used to store constant data, i.e., data that does not change during execution of a kernel or shader program running on GPGPU 270. In one embodiment, constant cache 267 is a scalar data cache, and cached data may be fetched directly from scalar registers 262.
[0060] During operation, one or more CPUs 246 can write commands to registers or memory within GPGPU 270 that are mapped into the accessible address space. Command processor 257 can read commands from registers or memory and determine how these commands are processed within GPGPU 270. Thread dispatcher 258 can then dispatch threads to compute units 260A-260N to execute these commands. Each compute unit 260A-260N can execute threads independently of the other compute units. Additionally, each compute unit 260A-260N can be independently configured for conditional computation and can conditionally output the results of the computation to memory. Command processor 257 can interrupt one or more CPUs 246 when a submitted command completes.
[0061] 3A-3C show block diagrams of further graphics processor and computation accelerator architectures provided in accordance with embodiments described herein. Elements in FIG. 3A-3C having the same reference numbers (or names) as elements in any other figures herein can operate or function in a manner similar to that described elsewhere herein, but are not limited to such.
[0062] 3A is a block diagram of a graphics processor 300, which may be a discrete graphics processing unit or may be a graphics processor integrated with multiple processing cores or other semiconductor devices such as, but not limited to, a memory device or a network interface. In some embodiments, the graphics processor communicates with commands located in processor memory via a memory-mapped I / O interface to registers on the graphics processor. In some embodiments, graphics processor 300 includes a memory interface 314 for accessing memory. Memory interface 314 may be an interface to local memory, one or more internal caches, one or more shared external caches, and / or system memory.
[0063] In some embodiments, graphics processor 300 also includes a display controller 302 for driving display output data to a display device 318. Display controller 302 includes hardware for one or more overlay surfaces for displaying and composing multiple layers of video or user interface elements. Display device 318 can be an internal or external display device. In one embodiment, display device 318 is a head-mounted display device, such as a virtual reality (VR) display device or an augmented reality (AR) display device. In some embodiments, graphics processor 300 includes a video codec engine 306 for encoding, decoding, or transcoding media to, from, or between, one or more media coding formats, including, but not limited to, Moving Picture Experts Group (MPEG) formats such as MPEG-2, Advanced Video Coding (AVC) formats such as H.264 / MPEG-4 AVC, H.265 / HEVC, Alliance for Open Media (AOMedia) VP8, VP9, and Joint Photographic Experts Group (JPEG) formats such as Society of Motion Picture & Television Engineers (SMPTE) 421 M / VC-1 and JPEG and Motion JPEG (MJPEG) formats.
[0064] In some embodiments, graphics processor 300 includes a block image transfer (BLIT) engine 304 for performing two-dimensional (2D) rasterization operations, including, for example, bit-boundary block transfer. However, in one embodiment, 2D graphics operations are performed using one or more components of a graphics processing engine (GPE) 310. In some embodiments, GPE 310 is a computation engine for performing graphics operations, including three-dimensional (3D) graphics operations and media operations.
[0065] In some embodiments, GPE 310 includes a 3D pipeline 312 for performing 3D operations such as rendering three-dimensional images and scenes using processing functions that operate on 3D primitive shapes (e.g., rectangles, triangles, etc.). 3D pipeline 312 includes programmable and fixed-function elements that perform various tasks within the elements and / or generate execution threads to 3D / media subsystem 315. While 3D pipeline 312 can be used to perform media operations, embodiments of GPE 310 also include a media pipeline 316 that is specifically used to perform media operations such as video post-processing and image enhancement.
[0066] In some embodiments, the media pipeline 316 includes a fixed function or programmable logic unit for performing one or more specialized media operations, such as video decode acceleration, video de-interlacing, and video encode acceleration, instead of or for the video codec engine 306. In some embodiments, the media pipeline 316 further includes a thread generation unit that generates threads for execution on the 3D / media subsystem 315. The generated threads perform computations for the media operations on one or more graphics execution units included in the 3D / media subsystem 315.
[0067] In some embodiments, the 3D / media subsystem 315 includes logic for executing threads created by the 3D pipeline 312 and the media pipeline 316. In one embodiment, the pipelines send thread execution requests to the 3D / media subsystem 315, which includes thread dispatch logic for arbitrating and dispatching the various requests to available thread execution resources. The execution resources include an array of graphics execution units for processing the 3D and media threads. In some embodiments, the 3D / media subsystem 315 includes one or more internal caches for thread instructions and data. In some embodiments, the subsystem also includes shared memory, including registers and addressable memory, for sharing data between threads and storing output data.
[0068] FIG. 3B illustrates a graphics processor 320 having a tiled architecture according to embodiments described herein. In one embodiment, the graphics processor 320 includes a graphics processing engine cluster 322 having multiple instances of the graphics processing engine 310 of FIG. 3A within graphics engine tiles 310A-310D. Each graphics engine tile 310A-310D can be interconnected via a set of tile interconnects 323A-323F. Each graphics engine tile 310A-310D can also be connected to a memory module or memory device 326A-326D via memory interconnects 325A-325D. The memory devices 326A-326D can use any graphics memory technology. For example, the memory devices 326A-326D can be graphics double data rate (GDDR) memory. In one embodiment, memory devices 326A-326D are high-bandwidth memory modules (HBM) that may be on-die with their respective graphics engine tiles 310A-310D. In one embodiment, memory devices 326A-326D are stacked memory devices that may be stacked on top of their respective graphics engine tiles 310A-310D. In one embodiment, each graphics engine tile 310A-310D and associated memory 326A-326D resides on a separate chiplet coupled to a base die or base substrate, as described in further detail in Figures 11B-11D.
[0069] The graphics processing engine cluster 322 can be connected to an on-chip or on-package fabric interconnect 324. The fabric interconnect 324 can enable communication between the graphics engine tiles 310A-310D and components such as the video codec 306 and one or more copy engines 304. The copy engine 304 can be used to move data to, from, or between the memory devices 326A-326D and memory external to the graphics processor 320 (e.g., system memory). The fabric interconnect 324 can also be used to interconnect the graphics engine tiles 310A-310D. The graphics processor 320 may optionally include a display controller 302 to enable connection to an external display device 318. The graphics processor may also be configured as a graphics or computation accelerator. In an accelerator configuration, the display controller 302 and display device 318 may be omitted.
[0070] Graphics processor 320 may connect to a host system via host interface 328. Host interface 328 may enable communication between graphics processor 320, system memory, and / or other system components. Host interface 328 may be, for example, a PCI Express bus or other type of host system interface.
[0071] FIG. 3C illustrates a computation accelerator 330 according to an embodiment described herein. The computation accelerator 330 may include architecture similar to the graphics processor 320 of FIG. 3B and is optimized for computation acceleration. The computation engine cluster 332 may include a set of computation engine tiles 340A-340D that include execution logic optimized for parallel or vector-based general-purpose computation operations. In some embodiments, the computation engine tiles 340A-340D do not include fixed-function graphics processing logic, but in one embodiment, one or more of the computation engine tiles 340A-340D may include logic for performing media acceleration. The computation engine tiles 340A-340D may be connected to memories 326A-326D via memory interconnects 325A-325D. The memories 326A-326D and memory interconnects 325A-325D may be of similar technology to the graphics processor 320 or may be different. Graphics compute engine tiles 340A-340D may also be interconnected via sets of tile interconnects 323A-323F, which may be connected to and / or interconnected by fabric interconnect 324. In one embodiment, compute accelerator 330 includes a large L3 cache 336 that may be configured as a device-wide cache. Compute accelerator 330 may also be connected to a host processor and memory via host interface 328, similar to graphics processor 320 of FIG. 3B.
[0072] (Graphics Processing Engine) FIG. 4 is a block diagram of a graphics processing engine 410 of a graphics processor according to some embodiments. In one embodiment, the graphics processing engine (GPE) 410 is a version of the GPE 310 shown in FIG. 3A and may also represent the graphics engine tiles 310A-310D of FIG. 3B. Elements of FIG. 4 having the same reference numbers (or names) as elements of any other figure herein can operate or function in a manner similar to that described elsewhere herein, but are not limited to such. For example, the 3D pipeline 312 and media pipeline 316 of FIG. 3A are shown. The media pipeline 316 is optional in some embodiments of the GPE 410 and may not be explicitly included within the GPE 410. For example, in at least one embodiment, a separate media and / or image processor is coupled to the GPE 410.
[0073] In some embodiments, the GPE 410 is coupled to or includes a command streamer 403 that provides a command stream to the 3D pipeline 312 and / or the media pipeline 316. In some embodiments, the command streamer 403 is coupled to memory, which may be system memory or one or more of an internal cache memory and a shared cache memory. In some embodiments, the command streamer 403 receives commands from memory and sends the commands to the 3D pipeline 312 and / or the media pipeline 316. The commands are instructions fetched from a ring buffer that stores commands for the 3D pipeline 312 and the media pipeline 316. In one embodiment, the ring buffer may further include a batch command buffer that stores batches of multiple commands. Commands for the 3D pipeline 312 may also include references to data stored in memory, such as, but not limited to, vertex and geometry data for the 3D pipeline 312 and / or image data and memory objects for the media pipeline 316. 3D pipeline 312 and media pipeline 316 process commands and data by executing operations through logic within the respective pipelines or by dispatching one or more execution threads to graphics core array 414. In one embodiment, graphics core array 414 includes one or more blocks of graphics cores (e.g., graphics core 415A, graphics core 415B), each block including one or more graphics cores. Each graphics core includes a set of graphics execution resources including general-purpose and graphics-specific execution logic for performing graphics and computational operations, as well as fixed-function texture processing and / or machine learning and artificial intelligence acceleration logic.
[0074] In various embodiments, the 3D pipeline 312 may include fixed-function and programmable logic for processing one or more shader programs, such as vertex shaders, geometry shaders, pixel shaders, fragment shaders, compute shaders, or other shader programs, by processing instructions and dispatching execution threads to the graphics core array 414. The graphics core array 414 provides a unified block of execution resources for use in processing these shader programs. The multipurpose execution logic (e.g., execution units) within the graphics cores 415A-414B of the graphics core array 414 includes support for various 3D API shader languages and can execute multiple concurrent threads of execution associated with multiple shaders.
[0075] In some embodiments, graphics core array 414 includes execution logic for performing media functions such as video and / or image processing. In one embodiment, the execution unit includes general-purpose logic that is programmable to perform parallel general-purpose computing operations in addition to graphics processing operations. The general-purpose logic can perform processing operations in parallel with or in conjunction with the general-purpose logic in processor core 107 of FIG. 1 or cores 202A-202N, such as in FIG. 2A.
[0076] Output data generated by threads executing on graphics core array 414 can output data to memory in unified return buffer (URB) 418. URB 418 can store data for multiple threads. In some embodiments, URB 418 may be used to send data between different threads executing on graphics core array 414. In some embodiments, URB 418 may also be used for synchronization between threads on the graphics core array and fixed function logic in shared function logic 420.
[0077] In some embodiments, graphics core array 414 is scalable such that the array includes a variable number of graphics cores, each with a variable number of execution units based on the target power and performance level of GPE 410. In one embodiment, the execution resources are dynamically scalable such that they may be enabled or disabled as needed.
[0078] Graphics core array 414 couples to shared function logic 420, which includes multiple resources shared among the graphics cores in the graphics core array. Shared functions within shared function logic 420 are hardware logic units that provide specialized supplemental functionality to graphics core array 414. In various embodiments, shared function logic 420 includes, but is not limited to, sampler 421, math arithmetic 422, and inter-thread communication (ITC) 423 logic. Additionally, some embodiments implement one or more caches 425 within shared function logic 420.
[0079] Shared functionality is implemented at least when demand for a given specialized function is insufficient to be included within the graphics core array 414. Instead, a single instantiation of that specialized function is implemented as a standalone entity within the shared functionality logic 420 and shared among the execution resources within the graphics core array 414. The exact set of functionality shared among and included within the graphics core array 414 varies by embodiment. In some embodiments, certain shared functionality within the shared functionality logic 420 that is used more extensively by the graphics core array 414 may be included within the shared functionality logic 416 within the graphics core array 414. In various embodiments, the shared functionality logic 416 within the graphics core array 414 may include some or all of the logic within the shared functionality logic 420. In one embodiment, all of the logic elements within the shared functionality logic 420 may be duplicated within the shared functionality logic 416 of the graphics core array 414. In one embodiment, the shared functionality logic 420 is omitted in favor of the shared functionality logic 416 within the graphics core array 414.
[0080] (execution unit) 5A-5B illustrate thread execution logic 500 including an array of processing elements used in a graphics processor core in accordance with embodiments described herein. Elements in FIGS. 5A-5B having the same reference numerals (or names) as elements in any other figures herein can operate or function in a manner similar to that described elsewhere herein, but are not limited to such. FIGS. 5A-5B illustrate an overview of thread execution logic 600, which may represent the hardware logic shown in each of sub-cores 221A-221F in FIG. 2B. FIG. 5A illustrates an execution unit in a general-purpose graphics processor, while FIG. 5B illustrates an execution unit that may be used in a computational accelerator.
[0081] As shown in FIG. 5A , in some embodiments, thread execution logic 500 includes a shader processor 502, a thread dispatcher 504, an instruction cache 506, a scalable execution unit array including multiple execution units 508A-508N, a sampler 510, a shared local memory 511, a data cache 512, and a data port 514. In one embodiment, the scalable execution unit array can be dynamically scaled by enabling or disabling one or more execution units (e.g., any of execution units 508A, 508B, 508C, 508D-508N-1, and 508N) based on the computational requirements of a workload. In one embodiment, the included components are interconnected via an interconnect fabric that couples each of the components. In some embodiments, thread execution logic 500 includes one or more connections to memory, such as system memory or cache memory, through one or more of the instruction cache 506, the data port 514, the sampler 510, and the execution units 508A-508N. In some embodiments, each execution unit (e.g., 508A) is a standalone programmable general-purpose computational unit capable of executing multiple simultaneous hardware threads while processing multiple data elements in parallel for each thread. In various embodiments, the array of execution units 508A-508N is scalable to include any number of individual execution units.
[0082] In some embodiments, execution units 508A-508N are primarily used to execute shader programs. Shader processor 502 processes various shader programs and can dispatch execution threads associated with the shader programs via thread dispatcher 504. In one embodiment, the thread dispatcher includes logic for arbitrating thread initiation requests from the graphics and media pipelines and instantiating the requested threads on one or more execution units within execution units 508A-508N. For example, the geometry pipeline can dispatch vertex, tessellation, or geometry shaders to thread execution logic for processing. In some embodiments, thread dispatcher 504 can also handle runtime thread creation requests from executing shader programs.
[0083] In some embodiments, the execution units 508A-508N support an instruction set that includes native support for many standard 3D graphics shader instructions, allowing shader programs from graphics libraries (e.g., Direct3D and OpenGL) to execute with minimal translation. The execution units support vertex and geometry processing (e.g., vertex programs, geometry programs, vertex shaders), pixel processing (e.g., pixel shaders, fragment shaders), and general-purpose processing (e.g., compute and media shaders). Each of the execution units 508A-508N is capable of multi-issue single instruction multiple data (SIMD) execution, and multithreaded operation enables an efficient execution environment when faced with higher latency memory accesses. Each hardware thread within each execution unit has a dedicated high-bandwidth register file and associated independent thread state. Execution is multiple issue per clock to a pipeline capable of integer, single- and double-precision floating-point operations, SIMD branching capability, logical operations, transcendental operations, and a variety of other operations. While waiting for data from memory or one of the shared functions, dependent logic within the execution units 508A-508N causes the waiting thread to sleep until the requested data is returned. While the waiting thread sleeps, hardware resources may be allocated to process other threads. For example, during the delay associated with a vertex shader operation, the execution unit may execute operations for a pixel shader, fragment shader, or other type of shader program (including a different vertex shader). Various embodiments may be applicable to using execution through the use of Single Instruction Multiple Threads (SIMT) as an alternative to or in addition to the use of SIMD. References to SIMD cores or operations may also apply to SIMT or to SIMD in combination with SIMT.
[0084] Each execution unit in execution units 508A-508N operates on an array of data elements. The number of data elements is the "execution size" or number of channels of the instruction. An execution channel is a logical unit of execution for data element access, masking, and flow control within an instruction. The number of channels may be independent of the number of physical arithmetic logic units (ALUs) or floating point units (FPUs) for a particular graphics processor. In some embodiments, execution units 508A-508N support integer and floating point data types.
[0085] The execution unit instruction set includes SIMD instructions. Various data elements can be stored as packed data types in registers, and the execution unit processes the various elements based on the data size of the elements. For example, when operating on a 256-bit wide vector, the 256 bits of the vector are stored in a register, and the execution unit operates on the vector as four separate 54-bit packed data elements (quad-word (QW) sized data elements), eight separate 32-bit packed data elements (double-word (DW) sized data elements), sixteen separate 16-bit packed data elements (word (W) sized data elements), or thirty-two separate 8-bit data elements (byte (B) sized data elements). However, different vector widths and register sizes are possible.
[0086] In one embodiment, one or more execution units can be coupled to fused execution units 509A-509N, which have thread control logic (507A-507N) common to the fused EUs. Multiple EUs can be fused into EU groups. Each EU in a fused EU group can be configured to execute a separate SIMD hardware thread. The number of EUs in a fused EU group can vary depending on the embodiment. Additionally, various SIMD widths can be implemented per EU, including, but not limited to, SIMD8, SIMD16, and SIMD32. Each fused graphics execution unit 509A-509N includes at least two execution units. For example, fused execution unit 509A includes a first EU 508A, a second EU 508B, and thread control logic 507A that is common to the first EU 508A and the second EU 508B. Thread control logic 507A controls the threads executing on fused graphics execution unit 509A, allowing each EU in fused execution units 509A-509N to execute using a common instruction pointer register.
[0087] One or more internal instruction caches (e.g., 506) are included in the thread execution logic 500 for caching thread instructions for the execution units. In some embodiments, one or more data caches (e.g., 512) are included for caching thread data during thread execution. Threads executing on the execution logic 500 can also store explicitly managed data in shared local memory 511. In some embodiments, a sampler 510 is included to provide texture sampling for 3D operations and media sampling for media operations. In some embodiments, the sampler 510 includes specialized texture or media sampling functions for processing texture or media data during the sampling process before providing the sampled data to the execution units.
[0088] During execution, the graphics and media pipeline sends thread start requests to the thread execution logic 500 via thread creation and dispatch logic. As groups of geometric objects are processed and rasterized into pixel data, pixel processor logic (e.g., pixel shader logic, fragment shader logic, etc.) within the shader processor 502 is invoked to further compute output information and write the results to an output surface (e.g., a color buffer, a depth buffer, a stencil buffer, etc.). In some embodiments, the pixel shader or fragment shader computes values for various vertex attributes to be interpolated between the rasterized objects. In some embodiments, the pixel processor logic within the shader processor 502 then executes pixel or fragment shader programs supplied by an application programming interface (API). To execute the shader programs, the shader processor 502 dispatches threads to execution units (e.g., 508A) via the thread dispatcher 504. In some embodiments, the shader processor 502 uses texture sampling logic within the sampler 510 to access texture data within texture maps stored in memory. Arithmetic operations on the texture data and input geometry data compute pixel color data for each geometric fragment or discard one or more pixels from further processing.
[0089] In some embodiments, data port 514 provides a memory access mechanism for thread execution logic 500 to output processed data to memory for further processing on the graphics processor output pipeline. In some embodiments, data port 514 includes or couples to one or more cache memories (e.g., data cache 512) for caching data for memory access via the data port.
[0090] In one embodiment, the execution logic 500 may also include a ray tracer 505 that may provide ray tracing acceleration functionality. The ray tracer 505 may support a ray tracing instruction set that includes instructions / functions for ray generation. The ray tracing instruction set may be similar to or different from the ray tracing instruction set supported by the ray tracing core 245 in FIG. 2C.
[0091] 5B illustrates exemplary internal details of execution unit 508 according to an embodiment. GSU 508 may include an instruction fetch unit 537, a general register file array (GRF) 524, an architectural register file array (ARF) 526, a thread arbiter 522, a send unit 530, a branch unit 532, a set of SIMD floating-point units 534, and, in one embodiment, a set of dedicated integer SIMD ALUs 535. GRF 524 and ARF 526 include a set of general register files and architectural register files associated with each concurrent hardware thread that may be active in GSU 508. In one embodiment, per-thread architectural state is maintained in ARF 526, while data used during thread execution is stored in GRF 524. Execution state for each thread, including an instruction pointer for each thread, may be held in thread-specific registers within ARF 526.
[0092] In one embodiment, the graphics execution unit 508 has an architecture that combines simultaneous multi-threading (SMT) and fine-grained interleaved multi-threading (IMT). The architecture has a modular configuration that can be tuned at design time based on the target number of simultaneous threads and the number of registers per execution unit, and execution unit resources are divided among the logic used to execute multiple simultaneous threads. The number of logical threads that can be executed by the graphics execution unit 508 is not limited to the number of hardware threads, and multiple logical threads can be assigned to each hardware thread.
[0093] In one embodiment, the graphics execution unit 508 can simultaneously issue multiple instructions, each of which may be a different instruction. The thread arbiter 522 of a graphics execution unit thread 508 can dispatch instructions to one of the send unit 530, branch unit 532, or SIMD FPU 534 for execution. Each execution thread can access 128 general-purpose registers in the GRF 524, each of which can store 32 bytes and be accessed as a SIMD 8-element vector of 32-bit data elements. In one embodiment, each execution unit thread has access to 4K bytes in the GRF 524, although embodiments are not limited in this respect and other embodiments may provide greater or lesser register resources. In one embodiment, the graphics processing unit 508 is divided into seven hardware threads that can independently perform computational operations, although the number of threads per execution unit can also vary depending on the embodiment. For example, in one embodiment, up to 16 hardware threads are supported. In an embodiment in which seven threads can access 4K bytes, the GRF 524 can store a total of 28K bytes. If 16 threads can access 4K bytes, then the GRF524 can store a total of 64K bytes. Flexible addressing modes can allow registers to be addressed together to effectively build wider registers or represent strided rectangular block data structures.
[0094] In one embodiment, memory operations, sampler operations, and other longer latency system communications are dispatched via "send" instructions performed by messages passing through send unit 530. In one embodiment, branch instructions are dispatched to a dedicated branch unit 532 to achieve SIMD divergence and eventual convergence.
[0095] In one embodiment, the graphics execution unit 508 includes one or more SIMD floating point units (FPUs) 534 for performing floating point operations. In one embodiment, the FPUs 534 also support integer calculations. In one embodiment, the FPUs 534 can SIMD execute up to M 32-bit floating point (or integer) operations, or SIMD execute up to 2M 16-bit integer or 16-bit floating point operations. In one embodiment, at least one of the FPUs provides extended math capabilities supporting high-throughput transcendental math functions and double-precision 54-bit floating point. In some embodiments, a set of 8-bit integer SIMD ALUs 535 is also present and may be specifically optimized for performing operations related to machine learning calculations.
[0096] In one embodiment, an array of multiple instances of a graphics execution unit 508 can be instantiated in graphics sub-core groupings (e.g., sub-slices). For scalability, a product architect can select the exact number of execution units per sub-core group. In one embodiment, an execution unit 508 can execute instructions across multiple execution channels. In a further embodiment, each thread executing on a graphics execution unit 508 executes on a different channel.
[0097] FIG. 6 illustrates a further execution unit 600 according to one embodiment. The execution unit 600 may be, for example, but not limited to, a compute-optimized execution unit for use in the compute engine tiles 340A-340D of FIG. 3C . A variation of the execution unit 600 may also be used in the graphics engine tiles 310A-310D of FIG. 3B . In one embodiment, the execution unit 600 includes a thread control unit 601, a thread state unit 602, an instruction fetch / prefetch unit 603, and an instruction decode unit 604. The execution unit 600 further includes a register file 606 that stores registers that can be allocated to hardware threads within the execution unit. The execution unit 600 further includes a send unit 607 and a branch unit 608. In one embodiment, the send unit 607 and the branch unit 608 can operate similarly to the send unit 530 and the branch unit 532 of the graphics execution unit 508 of FIG. 5B .
[0098] The execution unit 600 also includes a compute unit 610 that includes multiple different types of functional units. In one embodiment, the compute unit 610 includes an ALU unit 611 that includes an array of arithmetic logic units. The ALU unit 611 can be configured to perform 64-bit, 32-bit, and 16-bit integer and floating-point operations. The integer and floating-point operations may be performed simultaneously. The compute unit 610 can also include a systolic array 612 and a numeric operation unit 613. The systolic array 612 includes a W-wide and D-deep network of data processing units that can be used to systolicly perform vector or other data-parallel operations. In one embodiment, the systolic array 612 can be configured to perform matrix operations, such as a matrix dot product operation. In one embodiment, the systolic array 612 supports 16-bit floating-point operations and 8-bit and 4-bit integer operations. In one embodiment, the systolic array 612 can be configured to accelerate machine learning operations. In such an embodiment, systolic array 612 may be configured to support the bfloat 16-bit floating-point format. In one embodiment, numeric arithmetic unit 613 may be included to perform a specific subset of numeric operations in a more efficient and lower power manner than ALU unit 611. Numeric arithmetic unit 613 may include a variation of numeric arithmetic logic that may be found within the shared function logic of a graphics processing engine provided in other embodiments (e.g., numeric arithmetic logic 422 of shared function logic 420 of FIG. 4). In one embodiment, numeric arithmetic unit 613 may be configured to perform 32-bit and 64-bit floating-point operations.
[0099] The thread control unit 601 includes logic for controlling the execution of threads within the execution units. The thread control unit 601 may include thread arbitration logic for starting, stopping, and preempting the execution of threads within the execution units 600. The thread state unit 602 may be used to store thread state for threads assigned to execute on the execution units 600. Storing thread state within the execution units 600 allows for rapid preemption of threads when they become blocked or idle. The instruction fetch / prefetch unit 603 may fetch instructions from an instruction cache of a higher level of execution logic (e.g., instruction cache 506 as in FIG. 5A) based on an analysis of currently executing threads. The instruction decode unit 604 may be used to decode instructions to be loaded into the instruction cache. In one embodiment, the instruction decode unit 604 may be used as a secondary decoder for decoding complex instructions into constituent micro-operations.
[0100] Execution unit 600 further includes a register file 606 that can be used by hardware threads executing on execution unit 600. The registers in register file 606 can be divided among logic used to execute multiple simultaneous threads within compute units 610 of execution unit 600. The number of logical threads that can be executed by graphics execution unit 600 is not limited to the number of hardware threads, and multiple logical threads can be assigned to each hardware thread. The size of register file 606 can vary between embodiments based on the number of hardware threads supported. In one embodiment, register renaming may be used to dynamically allocate registers to hardware threads.
[0101] Figure 7 is a block diagram illustrating a graphics processor instruction format 700 according to some embodiments. In one or more embodiments, a graphics processor execution unit supports an instruction set having instructions in multiple formats. Solid boxes indicate components typically included in execution unit instructions, while dashed lines include components that are optional or included in only a subset of the instructions. In some embodiments, the instruction format 700 described and illustrated is a macro-instruction, in that it is an instruction supplied to an execution unit as the instruction is processed, as opposed to a micro-operation resulting from instruction decoding.
[0102] In some embodiments, the graphics processor execution units natively support instructions in 128-bit instruction format 710. A 64-bit compact instruction format 730 is available for some instructions based on the selected instruction, instruction options, and number of operands. While the native 128-bit instruction format 710 provides access to all instruction options, some options and operations are restricted in 64-bit format 730. The native instructions available in 64-bit format 730 vary depending on the embodiment. In some embodiments, instructions are compacted in part using a set of index values in index field 713. The execution unit hardware references a set of compaction tables based on the index values and uses the output of the compaction tables to reconstruct native instructions in 128-bit instruction format 710. Instructions of other sizes and formats may also be used.
[0103] For each format, the instruction opcode 712 defines the operation to be performed by the execution unit. The execution unit executes each instruction in parallel among multiple data elements of each operand. For example, in response to an add instruction, the execution unit performs a simultaneous add operation among each color channel representing a texture or picture element. By default, the execution unit executes each instruction among all data channels of the operand. In some embodiments, the instruction control field 714 allows control of certain execution options such as channel selection (e.g., prediction) and data channel order (e.g., swizzle). For instructions in the 128-bit instruction format 710, the exec size field 716 limits the number of data channels that are executed in parallel. In some embodiments, the exec size field 716 is not available for use with the 64-bit compact instruction format 730.
[0104] Some execution unit instructions have up to three operands, including two source operands, src0 720 and src1 722, and one destination 718. In some embodiments, the execution units support dual-destination instructions, where one of the destinations is implicit. Data manipulation instructions may have a third source operand (e.g., SRC2 724), and the instruction opcode 712 determines the number of source operands. The last source operand of an instruction may be an immediate (e.g., hard-coded) value passed with the instruction.
[0105] In some embodiments, the 128-bit instruction format 710 includes an access / address mode field 726 that specifies, for example, whether direct or indirect register addressing mode is used. When direct register addressing mode is used, the register addresses of one or more operands are provided directly by bits in the instruction.
[0106] In some embodiments, the 128-bit instruction format 710 includes an access / address mode field 726 that specifies the address mode and / or access mode of the instruction. In one embodiment, the access mode is used to define the data access alignment for the instruction. Some embodiments support access modes including a 16-byte aligned access mode and a 1-byte aligned access mode, where the byte alignment of the access mode determines the access alignment of the instruction operands. For example, in a first mode, the instruction may use byte-aligned addressing for source and destination operands, and in a second mode, the instruction may use 16-byte aligned addressing for all source and destination operands.
[0107] In one embodiment, the address mode portion of the access / address mode field 726 determines whether the instruction uses direct or indirect addressing. When direct register addressing mode is used, bits in the instruction directly provide the register addresses of one or more operands. When indirect register addressing mode is used, the register addresses of one or more operands may be calculated based on an address register value and an address immediate field in the instruction.
[0108] In some embodiments, instructions are grouped based on a bit field in the opcode 712 to simplify opcode decode 740. In an 8-bit opcode, bits 4, 5, and 6 allow the execution unit to determine the type of opcode. The exact opcode grouping shown is merely an example. In some embodiments, the move and logic opcode group 742 includes data movement and logic instructions (e.g., move (mov), compare (cmp)). In some embodiments, the move and logic group 742 share five most significant bits (MSBs), with move (mov) instructions being of the form 0000xxxxb and logic instructions being of the form 0001xxxb. The flow control instruction group 744 (e.g., call, jump (jmp)) includes instructions of the form 0010xxxxb (e.g., 0x20). The miscellaneous instruction group 746 includes a mix of instructions, including synchronization instructions (e.g., wait, send) in the format of 0011xxxxb (e.g., 0x30). The parallel math instruction group 748 includes component-specific arithmetic instructions (e.g., add, multiply (mul)) in the format of 0100xxxxb (e.g., 0x40). The parallel math group 748 performs arithmetic operations in parallel across data channels. The vector math group 750 includes arithmetic instructions (e.g., dp4) in the format of 0101xxxxb (e.g., 0x50). The vector math group performs arithmetic such as dot product calculations on vector operands. In one embodiment, the illustrated opcode decode 740 can be used to determine which portion of the execution unit will be used to execute the decoded instruction. For example, some instructions may be designated as systolic instructions to be executed by a systolic array. Other instructions, such as ray tracing instructions (not shown), can be routed to a ray tracing core or ray tracing logic within a slice or partition of the execution logic.
[0109] (Graphics Pipeline) Figure 8 is a block diagram of another embodiment of a graphics processor 800. Elements in Figure 8 having the same reference number (or name) as elements in any other figure may operate or function in a manner similar to, but not limited to, that described elsewhere herein.
[0110] In some embodiments, graphics processor 800 includes a geometry pipeline 820, a media pipeline 830, a display engine 840, thread execution logic 850, and a rendering output pipeline 870. In some embodiments, graphics processor 800 is a graphics processor within a multi-core processing system that includes one or more general-purpose processing cores. The graphics processor is controlled by register writes to one or more control registers (not shown) or via commands issued to graphics processor 800 via a ring interconnect 802. In some embodiments, ring interconnect 802 couples graphics processor 800 to other processing components, such as other graphics processors or general-purpose processors. Commands from ring interconnect 802 are interpreted by a command streamer 803, which provides instructions to individual components of geometry pipeline 820 or media pipeline 830.
[0111] In some embodiments, command streamer 803 reads vertex data from memory and directs the operation of vertex fetcher 805, which executes the vertex processing commands provided by command streamer 803. In some embodiments, vertex fetcher 805 provides the vertex data to vertex shader 807, which performs coordinate space transformation and lighting operations on each vertex. In some embodiments, vertex fetcher 805 and vertex shader 807 execute the vertex processing instructions by dispatching execution threads to execution units 852A-852B via thread dispatcher 831.
[0112] In some embodiments, the execution units 852A-852B are arrays of vector processors with instruction sets for performing graphics and media operations. In some embodiments, the execution units 852A-852B have an attached L1 cache 851 that is either specific to each array or shared between the arrays. The cache can be configured as a data cache, an instruction cache, or a single cache partitioned to contain data and instructions in different partitions.
[0113] In some embodiments, geometry pipeline 820 includes a tessellation component for performing hardware-accelerated tessellation of 3D objects. In some embodiments, programmable hull shader 811 configures the tessellation operations. Programmable domain shader 817 provides back-end evaluation of the tessellation output. Tessellator 813 operates in the direction of hull shader 811 and includes special-purpose logic for generating a set of detailed geometric objects based on a coarse geometric model provided as input to geometry pipeline 820. In some embodiments, the tessellation components (e.g., hull shader 811, tessellator 813, and domain shader 817) can be bypassed if tessellation is not used.
[0114] In some embodiments, a complete geometric object can be processed by the geometry shader 819 via one or more threads dispatched to execution units 852A-852B, or can proceed directly to the clipper 829. In some embodiments, the geometry shader operates on entire geometric objects, rather than vertices or patches of vertices like earlier stages in the graphics pipeline. If tessellation is disabled, the geometry shader 819 receives input from the vertex shader 807. In some embodiments, the geometry shader 819 is programmable by a geometry shader program to perform geometry tessellation if the tessellation units are disabled.
[0115] Prior to rasterization, clipper 829 processes the vertex data. Clipper 829 may be a fixed-function clipper or a programmable clipper with clipping and geometry shader functionality. In some embodiments, a rasterizer and depth test component 873 in render output pipeline 870 dispatches pixel shaders to convert geometric objects into per-pixel representations. In some embodiments, pixel shader logic is included in thread execution logic 850. In some embodiments, an application can bypass rasterizer and depth test component 873 and access un-rasterized vertex data via stream output unit 823.
[0116] Graphics processor 800 includes an interconnect bus, interconnect fabric, or other interconnect mechanism for passing data and messages between the major components of the processor. In some embodiments, execution units 852A-852B and associated logic units (e.g., L1 cache 851, sampler 854, texture cache 858, etc.) interconnect via data port 856 for performing memory accesses and communicating with the processor's rendering output pipeline components. In some embodiments, sampler 854, caches 851, 858, and execution units 852A-852B each have a separate memory access path. In one embodiment, texture cache 858 can also be configured as a sampler cache.
[0117] In some embodiments, the render output pipeline 870 includes a rasterizer and depth test component 873 that converts vertex-based objects into an associated pixel-based representation. In some embodiments, the rasterizer logic includes a window / mask unit for performing fixed-function triangle and rectilinear rasterization. An associated render cache 878 and depth cache 879 are also available in some embodiments. A pixel operations component 877 performs pixel-based operations on the data, although in some instances pixel operations related to 2D operations (e.g., bit-block image transfer with blending) are performed by the 2D engine 841 or are replaced by the display controller 843 using an overlay display surface at display time. In some embodiments, a shared L3 cache 875 is available to all graphics components, allowing data sharing without using main system memory.
[0118] In some embodiments, graphics processor media pipeline 830 includes a media engine 837 and a video front end 834. In some embodiments, video front end 834 receives pipeline commands from command streamer 803. In some embodiments, media pipeline 830 includes a separate command streamer. In some embodiments, video front end 834 processes media commands before sending the commands to media engine 837. In some embodiments, media engine 837 includes a thread generation function for generating threads that dispatch to thread execution logic 850 via thread dispatcher 831.
[0119] In some embodiments, graphics processor 800 includes a display engine 840. In some embodiments, display engine 840 is external to processor 800 and couples to the graphics processor via ring interconnect 802 or other interconnect bus or fabric. In some embodiments, display engine 840 includes a 2D engine 841 and a display controller 843. In some embodiments, display engine 840 includes special-purpose logic that can operate independently of the 3D pipeline. In some embodiments, display controller 843 couples to a display device (not shown), which may be a system-integrated display device, such as one in a laptop computer, or an external display device attached via a display device connector.
[0120] In some embodiments, geometry pipeline 820 and media pipeline 830 are configurable to perform operations based on multiple graphics and media programming interfaces and are not specific to any one application programming interface (API). In some embodiments, driver software for the graphics processor translates API calls specific to a particular graphics or media library into commands that can be processed by the graphics processor. In some embodiments, support is provided for OpenGL (Open Graphics Library), OpenCL (Open Computing Language), and / or Vulkan graphics and compute APIs, all from the Khronos Group. In some embodiments, support may also be provided for the Direct3D library from Microsoft Corporation. In some embodiments, a combination of these libraries may be supported. Support may also be provided for OpenCV (Open Source Computer Vision Library). Future APIs with compatible 3D pipelines may also be supported if a mapping from the future API's pipeline to the graphics processor's pipeline is possible.
[0121] (Graphics Pipeline Programming) Figure 9A is a block diagram illustrating a graphics processor command format 900 according to some embodiments. Figure 9B is a block diagram illustrating a graphics processor command sequence 910 according to an embodiment. The solid-lined boxes in Figure 9A indicate components typically included in graphics commands, while the dashed lines include components that are optional or included in only a subset of graphics commands. The example graphics processor command format 900 of Figure 9A includes data fields for identifying a client 902, a command operation code (opcode) 904, and data 906 for the command. A sub-opcode 905 and a command size 908 are also included in some commands.
[0122] In some embodiments, client 902 specifies a client unit of the graphics device that will process the command data. In some embodiments, a graphics processor command parser examines the client field of each command to condition further processing of the command and route the command data to the appropriate client unit. In some embodiments, the graphics processor client unit includes a memory interface unit, a rendering unit, a 2D unit, a 3D unit, and a media unit. Each client unit has a corresponding processing pipeline that processes the command. When a command is received by a client unit, the client unit reads the opcode 904 and, if present, the sub-opcode 905 to determine the operation to perform. The client unit executes the command using the information in data field 906. Some commands assume an explicit command size 908 to specify the size of the command. In some embodiments, the command parser automatically determines the size of at least some of the commands based on the command opcode. In some embodiments, commands are aligned on multiples of doublewords. Other command formats may also be used.
[0123] The flow diagram in Figure 9B illustrates an exemplary graphics processor command sequence 910. In some embodiments, software or firmware for a data processing system featuring an embodiment of a graphics processor uses a version of the command sequence shown to set up, execute, and complete a set of graphics operations. A sample command sequence is shown and described for purposes of example only, and embodiments are not limited to these particular commands or this command sequence. Furthermore, commands may be issued as a batch of commands within a command sequence such that the graphics processor processes the sequence of commands at least partially concurrently.
[0124] In some embodiments, a graphics processor command sequence 910 may begin with a pipeline flush command 912, causing any active graphics pipeline to complete commands currently pending for that pipeline. In some embodiments, the 3D pipeline 922 and the media pipeline 924 do not operate simultaneously. A pipeline flush is performed to cause the active graphics pipeline to complete pending commands. In response to a pipeline flush, the graphics processor's command parser pauses command processing until the active drawing engine completes pending operations and invalidates the associated read cache. Optionally, any data in the rendering cache that is marked as "dirty" can be flushed to memory. In some embodiments, the pipeline flush command 912 can be used for pipeline synchronization or before placing the graphics processor in a low-power state.
[0125] In some embodiments, the pipeline select command 913 is used when a command sequence requires the graphics processor to explicitly switch between pipelines. In some embodiments, the pipeline select command 913 is only needed once within an execution context before issuing a pipeline command, unless the context issues commands to both pipelines. In some embodiments, a pipeline flush command 912 is needed immediately before switching pipelines via the pipeline select command 913.
[0126] In some embodiments, pipeline control commands 914 are used to configure the graphics pipeline for operations and to program the 3D pipeline 922 and the media pipeline 924. In some embodiments, pipeline control commands 914 configure the pipeline state for the active pipeline. In one embodiment, pipeline control commands 914 are used for pipeline synchronization and to clear data from one or more cache memories in the active pipeline before processing a batch of commands.
[0127] In some embodiments, the return buffer state command 916 is used to configure a set of return buffers for each pipeline to write data to. Some pipeline operations require the allocation, selection, or configuration of one or more return buffers to which the operation writes intermediate data during processing. In some embodiments, the graphics processor also uses one or more return buffers to store output data and perform inter-thread communication. In some embodiments, the return buffer state 916 includes selecting the size and number of return buffers to use for a set of pipeline operations.
[0128] The remaining commands in the command sequence differ based on the active pipeline for the operation. Based on the pipeline determination 920, the command sequence is adjusted to either the 3D pipeline 922, which starts at the 3D pipeline state 930, or the media pipeline 924, which starts at the media pipeline state 940.
[0129] Commands for configuring the 3D pipeline state 930 include 3D state setting commands for vertex buffer state, vertex element state, steady color state, depth buffer state, and other state variables that should be configured before 3D primitive commands are processed. The values of these commands are determined at least in part based on the particular 3D API in use. In some embodiments, the 3D pipeline state 930 commands can also selectively disable or bypass particular pipeline elements if they are not used.
[0130] In some embodiments, the 3D primitive 932 command is used to submit a 3D primitive to be processed by the 3D pipeline. The command and associated parameters passed to the graphics processor via the 3D primitive 932 command are forwarded to a vertex fetch function in the graphics pipeline. The vertex fetch function uses the 3D primitive 932 command data to generate a vertex data structure. The vertex data structure is stored in one or more return buffers. In some embodiments, the 3D primitive 932 command is used to perform vertex operations on the 3D primitive via a vertex shader. To process the vertex shader, the 3D pipeline 922 dispatches shader execution threads to the graphics processor execution units.
[0131] In some embodiments, the 3D pipeline 922 is triggered via an execute 934 command or event. In some embodiments, a register write triggers command execution. In some embodiments, execution is triggered via a "go" or "kick" command in a command sequence. In one embodiment, command execution is triggered using a pipeline synchronization command to flush the command sequence through the graphics pipeline. The 3D pipeline performs geometry processing on 3D primitives. Once the operations are complete, the resulting geometric objects are rasterized and the pixel engine colors the resulting pixels. Additional commands to control pixel shading and pixel backend operations may also be included for these operations.
[0132] In some embodiments, the graphics processor command sequence 910 follows the media pipeline 924 path when performing media operations. In general, the specific use and manner of programming for the media pipeline 924 depends on the media or compute operations being performed. Certain media decode operations may be offloaded to the media pipeline during media decoding. In some embodiments, the media pipeline can also be bypassed, and media decode can be performed in whole or in part using resources provided by one or more general-purpose processing cores. In one embodiment, the media pipeline also includes elements for general-purpose graphics processor unit (GPGPU) operations, where the graphics processor is used to perform SIMD vector operations using compute shader programs not explicitly related to rendering graphics primitives.
[0133] In some embodiments, the media pipeline 924 is configured in a similar manner to the 3D pipeline 922. A set of commands for configuring the media pipeline state 940 is dispatched or placed in a command queue before the media object commands 942. In some embodiments, the commands for the media pipeline state 940 include data for configuring the media pipeline elements used to process the media objects. This includes data for configuring the video decoding and video encoding logic in the media pipeline, such as encoding or decoding formats. In some embodiments, the commands for the media pipeline state 940 also support the use of one or more pointers to "indirect" state elements that contain a batch of state settings.
[0134] In some embodiments, the media object command 942 provides a pointer to a media object for processing by the media pipeline. The media object includes a memory buffer containing the video data to be processed. In some embodiments, all media pipeline state must be valid before issuing the media object command 942. Once the pipeline state is configured and the media object command 942 is queued, the media pipeline 924 is triggered via an execute command 944 or equivalent execution event (e.g., a register write). The output from the media pipeline 924 may then be post-processed by operations provided by the 3D pipeline 922 or the media pipeline 924. In some embodiments, GPGPU operations are configured and executed in a similar manner to media operations.
[0135] (Graphics Software Architecture) 10 illustrates an exemplary graphics software architecture for a data processing system 1000 according to some embodiments. In some embodiments, the software architecture includes a 3D graphics application 1010, an operating system 1020, and at least one processor 1030. In some embodiments, the processor 1030 includes a graphics processor 1032 and one or more general-purpose processor cores 1034. The graphics application 1010 and the operating system 1020 each execute within the system memory 1050 of the data processing system.
[0136] In some embodiments, the 3D graphics application 1010 includes one or more shader programs that include shader instructions 1012. The shader language instructions may be in a high-level shader language such as Direct3D High-Level Shader Language (HLSL), OpenGL Shader Language (GLSL), etc. The application also includes executable instructions 1014 in a machine language suitable for execution by the general-purpose processor core 1034. The application also includes graphics objects 1016 defined by vertex data.
[0137] In some embodiments, the operating system 1020 is a Microsoft® Windows® operating system from Microsoft Corporation, a proprietary UNIX®-like operating system, or an open-source UNIX®-like operating system using a variant of the Linux® kernel. The operating system 1020 can support a graphics API 1022, such as the Direct3D API, the OpenGL API, or the Vulkan API. When the Direct3D API is used, the operating system 1020 uses a front-end shader compiler 1024 to compile the HLSL shader instructions 1012 into a low-level shader language. The compilation can be just-in-time (JIT) compilation, or the application can perform shader pre-compilation. In some embodiments, high-level shaders are compiled into low-level shaders during compilation of the 3D graphics application 1010. In some embodiments, the shader instructions 1012 are provided in an intermediate format, such as a version of Standard Portable Intermediate Representation (SPIR), used by the Vulkan API.
[0138] In some embodiments, user mode graphics driver 1026 includes a back-end shader compiler 1027 for converting shader instructions 1012 into a hardware-specific representation. When the OpenGL API is used, shader instructions 1012 in the GLSL high-level language are passed to user mode graphics driver 1026 for compilation. In some embodiments, user mode graphics driver 1026 uses operating system kernel mode functions 1028 to communicate with kernel mode graphics driver 1029. In some embodiments, kernel mode graphics driver 1029 communicates with graphics processor 1032 to dispatch commands and instructions.
[0139] (IP core implementation) One or more aspects of at least one embodiment may be implemented by expressive code stored on a machine-readable medium that represents and / or defines logic within an integrated circuit, such as a processor. For example, the machine-readable medium may include instructions that represent various logic within a processor. When read by a machine, the instructions may cause the machine to manufacture logic for performing the techniques described herein. Such expressions, known as "IP cores," are reusable units of logic for integrated circuits that may be stored on tangible machine-readable media as hardware models that describe the structure of the integrated circuit. The hardware models may be provided to various customers or manufacturing facilities, which then load the hardware models into manufacturing machines that produce the integrated circuits. The integrated circuits may be manufactured to perform the operations described in connection with any of the embodiments described herein.
[0140] FIG. 11A is a block diagram illustrating an IP core development system 1100 that can be used to fabricate an integrated circuit to perform operations according to an embodiment. The IP core development system 1100 may be used to generate modular, reusable designs that can be incorporated into a larger design or used to build an entire integrated circuit (e.g., a SOC integrated circuit). A design facility 1130 can generate a software simulation 1110 of the IP core design in a high-level programming language (e.g., C / C++). The software simulation 1110 can be used to design, test, and verify the behavior of the IP core using a simulation model 1112. The simulation model 1112 may include functional, behavioral, and / or timing simulation. A register transfer level (RTL) design 1115 can then be created or synthesized from the simulation model 1112. The RTL design 1115 is an abstraction of the integrated circuit's behavior that models the flow of digital signals between hardware registers and includes associated logic that is executed using the modeled digital signals. In addition to the RTL design 1115, a lower level design at the logic or transistor level may also be created, designed, or synthesized. Thus, the specific details of the initial design and simulation may vary.
[0141] The RTL design 1115 or equivalent may be further synthesized by a design function into a hardware model 1120, which may be in a hardware description language (HDL) or other representation of physical design data. The HDL may be further simulated or tested to verify the IP core design. The IP core design may be stored using non-volatile memory 1140 (e.g., a hard disk, flash memory, or any non-volatile storage medium) for delivery to a third-party fabrication facility 1165. Alternatively, the IP core design may be transmitted over a wired connection 1150 or a wireless connection 1160 (e.g., via the Internet). The fabrication facility 165 may then fabricate an integrated circuit based at least in part on the IP core design. The fabricated integrated circuit may be configured to perform operations in accordance with at least one embodiment described herein.
[0142] FIG. 11B illustrates a cross-sectional side view of an integrated circuit package assembly 1170 according to some embodiments described herein. The integrated circuit package assembly 1170 illustrates the implementation of one or more processor or accelerator devices described herein. The package assembly 1170 includes multiple units of hardware logic 1172, 1174 coupled to a substrate 1180. The logic 1172, 1174 may be at least partially implemented in hardware using configurable logic or fixed-function logic and may include one or more portions of any of the processor cores, graphics processors, or other accelerator devices described herein. Each unit of logic 1172, 1174 may be implemented within a semiconductor die and coupled to the substrate 1180 via an interconnect structure 1173. The interconnect structure 1173 may be configured to route electrical signals between the logic 1172, 1174 and the substrate 1180 and may include, but is not limited to, interconnects such as bumps or pillars. In some embodiments, the interconnect structure 1173 may be configured to route electrical signals, such as input / output (I / O) signals and / or power or ground signals associated with the operation of the logic 1172, 1174. In some embodiments, the substrate 1180 is an epoxy-based laminate substrate. In other embodiments, the package substrate 1180 may include other suitable types of substrates. The package assembly 1170 can be connected to other electrical devices via the package interconnect 1183. The package interconnect 1183 may be coupled to a surface of the substrate 1180 to route electrical signals to other electrical devices, such as a motherboard, another chipset, or a multi-chip module.
[0143] In some embodiments, the units of logic 1172, 1174 are electrically coupled to a bridge 1182 configured to route electrical signals between the logic 1172, 1174. The bridge 1182 may be a high-density interconnect structure that provides a path for the electrical signals. The bridge 1182 may include a bridge substrate comprised of glass or a suitable semiconductor material. Electrical routing features can be formed on the bridge substrate to provide chip-to-chip connections between the logic 1172, 1174.
[0144] Although two units of logic 1172, 1174 and bridge 1182 are shown, embodiments described herein may include more or fewer logic units on one or more dies. Bridge 1182 may be omitted when logic is contained on a single die, and one or more dies may be connected by zero or more bridges. Alternatively, multiple dies or logic units may be connected by one or more bridges. Furthermore, multiple logic units, dies, and bridges may be connected to each other in other possible configurations, including three-dimensional configurations.
[0145] FIG. 11C illustrates a package assembly 1190 including multiple units of hardware logic chiplets connected to a substrate 1180 (e.g., a base die). The graphics processing units, parallel processors, and / or computational accelerators described herein can be composed of multiple silicon chiplets fabricated separately. In this context, a chiplet is an at least partially packaged integrated circuit containing discrete units of logic that can be assembled with other chiplets into a larger package. Multiple sets of chiplets with different IP core logic can be assembled into a single device. Furthermore, chiplets can be integrated into a base die or base chiplet using active interposer technology. The concepts described herein enable interconnection and communication between different types of IP within a GPU. IP cores can be fabricated using different process technologies and configured during manufacturing. This avoids the complexity of converging multiple IPs onto the same manufacturing process, especially on large SoCs with multiple flavors of IP. Enabling the use of multiple process technologies improves time to market and provides a cost-effective way to create multiple product SKUs. Additionally, the decomposed IP is susceptible to being independently power-gated, allowing components not in use in a given workload to be powered off, reducing overall power consumption.
[0146] The hardware logic chiplets can include special purpose hardware logic chiplets 1172, logic or I / O chiplets 1174, and / or memory chiplets 1175. The hardware logic chiplets 1172 and logic or I / O chiplets 1174 may be implemented at least in part in configurable logic or fixed function logic hardware and can include one or more portions of any of the processor cores, graphics processors, parallel processors, or other accelerator devices described herein. The memory chiplets 1175 can be DRAM (e.g., GDDR, HBM) memory or cache (SRAM) memory.
[0147] Each chiplet can be fabricated as a separate semiconductor die and coupled to substrate 1180 via interconnect structures 1173. Interconnect structures 1173 can be configured to route electrical signals between the various chiplets and logic within substrate 1180. Interconnect structures 1173 can include, but are not limited to, interconnects such as bumps or pillars. In some embodiments, interconnect structures 1173 can be configured to route electrical signals, such as, for example, input / output (I / O) signals and / or power or ground signals associated with the operation of the logic, I / O, and memory chiplets.
[0148] In some embodiments, substrate 1180 is an epoxy-based laminate substrate. In other embodiments, substrate 1180 may include other suitable types of substrate. Package assembly 1190 can be connected to other electrical devices via package interconnect 1183. Package interconnect 1183 may be coupled to a surface of substrate 1180 to route electrical signals to other electrical devices, such as a motherboard, another chipset, or a multi-chip module.
[0149] In some embodiments, logic or I / O chiplets 1174 and memory chiplets 1175 can be electrically coupled via bridges 1187 configured to route electrical signals between the logic or I / O chiplets 1174 and the memory chiplets 1175. Bridges 1187 can be high-density interconnect structures that provide paths for electrical signals. Bridges 1187 can include a bridge substrate made of glass or a suitable semiconductor material. Electrical routing features can be formed on the bridge substrate to provide chip-to-chip connections between the logic or I / O chiplets 1174 and the memory chiplets 1175. Bridges 1187 can also be referred to as silicon bridges or interconnect bridges. For example, in some embodiments, bridges 1187 are embedded multi-die interconnect bridges (EMIBs). In some embodiments, bridges 1187 can simply be direct connections from one chiplet to another.
[0150] Substrate 1180 can include hardware components for I / O 1191, cache memory 1192, and other hardware logic 1193. Fabric 1185 can be embedded within substrate 1180 to enable communication between various logic chiplets and logic 1191, 1193 within substrate 1180. In one embodiment, I / O 1191, fabric 1185, cache, bridges, and other hardware logic 1193 can be integrated into a base die that is stacked on top of substrate 1180.
[0151] In various embodiments, package assembly 1190 can include fewer or more components and chiplets interconnected by fabric 1185 or one or more bridges 1187. Chiplets within package assembly 1190 may be arranged in a 3D or 2.5D configuration. In general, bridge structure 1187 may be used to provide point-to-point interconnections between, for example, logic or I / O chiplets and memory chiplets. Fabric 1185 can be used to interconnect various logic and / or I / O chiplets (e.g., chiplets 1172, 1174, 1191, 1193) with other logic and / or I / O chiplets. In one embodiment, cache memory 1192 within the substrate can function as a global cache for package assembly 1190, part of a distributed global cache, or a dedicated cache for fabric 1185.
[0152] FIG. 11D illustrates a package assembly 1194 including a replaceable chiplet 1195 according to an embodiment. The replaceable chiplet 1195 can be assembled into a standardized slot on one or more base chiplets 1196, 1198. The base chiplets 1196, 1198 can be coupled via a bridge interconnect 1197, which can be similar to other bridge interconnects described herein, such as an EMIB. Memory chiplets can also be connected to logic or I / O chiplets via the bridge interconnect. I / O and logic chiplets can communicate via an interconnect fabric. The base chiplet can support one or more slots in a standardized format for one of logic, I / O, or memory / cache.
[0153] In one embodiment, the SRAM and power delivery circuitry can be fabricated in one or more of the base chiplets 1196, 1198, which can be fabricated using a different process technology than the replaceable chiplets 1195 stacked on top of the base chiplets. For example, the base chiplets 1196, 1198 can be fabricated using a larger process technology, and the replaceable chiplets can be fabricated using a smaller process technology. One or more of the replaceable chiplets 1195 can be memory (e.g., DRAM) chiplets. Different memory densities can be selected for the package assembly 1194 based on the power and / or performance targeted for the product using the package assembly 1194. Furthermore, logic chiplets having different numbers and types of functional units can be selected during assembly based on the power and / or performance targeted for the product. Furthermore, chiplets containing different types of IP logic cores can be inserted into the slots of the replaceable chiplets, enabling hybrid processor designs in which IP blocks of different technologies can be mixed and matched.
[0154] (Exemplary System-on-Chip Integrated Circuit) 12-14 illustrate exemplary integrated circuits and associated graphics processors that may be fabricated using one or more IP cores in accordance with various embodiments described herein. Other logic and circuitry may be included in addition to those shown, including additional graphics processors / cores, peripheral interface controllers, or general-purpose processor cores.
[0155] 12 is a block diagram illustrating an exemplary system-on-chip integrated circuit 1200 that may be fabricated using one or more IP cores in accordance with an embodiment. The exemplary integrated circuit 1200 includes one or more application processors 1205 (e.g., CPUs) and at least one graphics processor 1210, and may further include an image processor 1215 and / or a video processor 1220, any of which may be modular IP cores from the same or multiple different design facilities. The integrated circuit 1200 also includes a USB controller 1225, a UART controller 1230, an SPI / SDIO controller 1235, and an I / O controller 1240. 2 S / I 2 The integrated circuit may include peripheral or bus logic including a C controller 1240. Additionally, the integrated circuit may include a display device 1245 coupled to one or more of an HDMI (high-definition multimedia interface) controller 1250 and a MIPI (mobile industry processor interface) display interface 1255. Storage may be provided by a flash memory subsystem 1260 including a flash memory and a flash memory controller. A memory interface may be provided through a memory controller 1265 for access to an SDRAM or SRAM memory device. Some integrated circuits further include an embedded security engine 1270.
[0156] 13-14 are block diagrams illustrating exemplary graphics processors for use within an SoC in accordance with embodiments described herein. FIG. 13A illustrates an exemplary graphics processor 1310 of a system-on-chip integrated circuit that may be fabricated using one or more IP cores in accordance with embodiments. FIG. 13B illustrates a further exemplary graphics processor 1340 of a system-on-chip integrated circuit that may be fabricated using one or more IP cores in accordance with embodiments. The graphics processor 1310 of FIG. 13A is an example of a low-power graphics processor core. The graphics processor 1340 of FIG. 13B is an example of a high-performance graphics processor core. Each of the graphics processors 1310, 1340 may be a variation of the graphics processor 1210 of FIG. 12.
[0157] As shown in FIG. 13 , graphics processor 1310 includes vertex processor 1305 and one or more fragment processors 1315A-1315N (e.g., 1315A, 1315B, 1315C, 1315D-1315N-1, and 1315N). Graphics processor 1310 can execute different shader programs through separate logic, such that vertex processor 1305 is optimized to perform operations for vertex shader programs, while one or more fragment processors 1315A-1315N perform fragment (e.g., pixel) shader operations for fragment or pixel shader programs. Vertex processor 1305 performs the vertex processing stage of the 3D graphics pipeline, generating primitive and vertex data. Fragment processors 1315A-1315N use the primitive and vertex data generated by vertex processor 1305 to generate a frame buffer that is displayed on a display device. In one embodiment, fragment processors 1315A-1315N are optimized to execute fragment shader programs such as those provided in the OpenGL API, which may be used to perform operations similar to pixel shader programs such as those provided in the Direct 3D API.
[0158] Graphics processor 1310 further includes one or more memory management units (MMUs) 1320A-1320B, caches 1325A-1325B, and circuit interconnects 1330A-1330B. The one or more MMUs 1320A-1320B provide virtual-to-physical address mapping for graphics processor 1310, including vertex processor 1305 and / or fragment processors 1315A-1315N, which may reference vertex or image / texture data stored in memory in addition to vertex or image / texture data stored in one or more caches 1325A-1325B. In one embodiment, one or more MMUs 1320A-1320B may synchronize with other MMUs in the system, including one or more MMUs associated with one or more application processors 1205, image processor 1215, and / or video processor 1220 of Figure 12, so that each processor 1205-1220 can participate in a shared or unified virtual memory system. One or more circuit interconnects 1330A-1330B enable graphics processor 1310 to interface with other IP cores in the SoC via the SoC's internal bus or via direct connections, according to an embodiment.
[0159] As shown in Figure 14, graphics processor 1340 includes one or more MMUs 1320A-1320B, caches 1325A-1325B, and circuit interconnects 1330A-1330B of graphics processor 1310 of Figure 13. Graphics processor 1340 includes one or more shader cores 1355A-1355N (e.g., 1355A, 1355B, 1355C, 1355D, 1355E, 1355F-1355N-1, and 1355N), which provides a unified shader core architecture in which a single core or type of core can execute all types of programmable shader code, including shader program code for implementing vertex shaders, fragment shaders, and / or compute shaders. The exact number of shader cores present may vary between embodiments and implementations. Additionally, graphics processor 1340 includes an inter-core task manager 1345 that acts as a thread dispatcher for dispatching execution threads to one or more shader cores 1355A-1355N, and a tile unit 1358 that accelerates tile operations for tile-based rendering, where rendering operations for a scene are subdivided in image space, for example, to exploit local spatial coherence within the scene or to optimize internal cache usage.
[0160] [Ray tracing with machine learning] As mentioned above, ray tracing is a graphics processing technique in which light propagation is simulated through physically based rendering. One of the key operations in ray tracing is processing visibility queries, which require traversal and intersection testing of nodes in a bounding volume hierarchy (BVH).
[0161] Ray tracing and path tracing based techniques calculate images by tracing rays and paths through each pixel and using random sampling to calculate advanced effects such as shadows, glossiness, indirect lighting, etc. Using only a few samples is fast but produces a noisy image, while using many samples produces a high quality image but at a very high cost.
[0162] Machine learning includes any circuitry, program code, or combination thereof that can dramatically improve performance of a specified task or make dramatically more accurate predictions or decisions. Some machine learning engines can perform tasks or make predictions / decisions without being explicitly programmed to perform these tasks or make these predictions / decisions. There are a variety of machine learning techniques, including, but not limited to, supervised and semi-supervised learning, unsupervised learning, and reinforcement learning.
[0163] Over the past few years, a breakthrough solution to ray tracing / path tracing for real-time use has emerged in the form of "denoising," a process that uses image processing techniques to generate high-quality filtered / denoised images from noisy, low-sample-count inputs. The most effective denoising techniques rely on machine learning techniques, where the machine learning engine learns what the noisy image would look like if it were computed with more samples. In one particular embodiment, the machine learning is performed by a convolutional neural network (CNN), although the underlying principles of the present invention are not limited to CNN implementations. In such implementations, training data is generated from low-sample-count inputs and ground-truth solutions. The CNN is trained to predict a convergence pixel from a neighborhood of noisy pixel inputs surrounding the pixel in question.
[0164] While not perfect, this AI-based denoising technique has proven surprisingly effective. However, it is important to note that good training data is required, as otherwise the network may predict incorrect results. For example, if an animation film studio trained a denoising CNN on past films with land scenes and then attempted to use the trained CNN to denoise frames from a new film set on water, the denoising operation would perform suboptimally.
[0165] To address this issue, training data can be dynamically collected during rendering, and a machine learning engine such as a CNN may be continuously trained based on the currently running data, thus continuously improving the machine learning engine for the task at hand. Thus, the training phase may still be performed before runtime, but continue to adjust the machine learning weights as needed during runtime. The high cost of computing the reference data required for training is thereby avoided by limiting the generation of training data to a subregion of the image every frame or every N frames. In particular, a noisy input of a frame is generated to denoise the entire frame with the current network. Furthermore, as described below, a small region of reference pixels is generated and used for continuous training.
[0166] Although a CNN implementation is described herein, any form of machine learning engine may be used, including, but not limited to, systems that perform supervised learning (e.g., building a mathematical model of a set of data that includes both input and desired output), unsupervised learning (e.g., evaluating input data for a particular type of structure), and / or a combination of supervised and unsupervised learning.
[0167] Existing denoising implementations operate in a training phase and a runtime phase. During the training phase, a network topology is defined that receives an NxN pixel region with various per-pixel data channels, such as pixel color, depth, normal, normal deviation, primitive ID, and albedo, and generates the final pixel color. A set of "representative" training data is generated using a single frame's worth of low-sample inputs, referencing a "desired" pixel color calculated with a very high sample count. The network is trained toward these inputs, generating an "ideal" set of weights for the network. In these implementations, the reference data is used to train the network weights, causing the network's output to most closely match the desired result.
[0168] At runtime, pre-computed ideal network weights are loaded and the network is initialized. For each frame, a low-sample image of the denoised input (i.e., the same one used for training) is generated. For each pixel, a given neighborhood of the pixel's input is run through the network to predict the "denoised" pixel color, producing the denoised frame.
[0169] Figure 15 shows an initial training implementation. A machine learning engine 1500 (e.g., a CNN) receives high-sample count image data 1702, an NxN pixel region with various per-pixel data channels such as pixel color, depth, normal, normal deviation, primitive ID, and albedo, and generates the final pixel color. Representative training data is generated using one frame's worth of low-sample count input 1501. The network is trained on these inputs to generate an "ideal" set of weights 1505, which the machine learning engine 1500 then uses at runtime to denoise the low-sample count image.
[0170] To improve upon the above technique, the denoising stage is enhanced to generate new training data for every frame or subset of frames (e.g., every N frames, where N=2, 3, 4, 10, 25, etc.). In particular, as shown in Figure 16, this involves selecting one or more regions within each frame, referred to herein as "new reference regions" 1602, which are rendered at a high sample count into a separate high sample count buffer 1604. A low sample count buffer 1603 stores a low sample count input frame 1601 (including a low sample region 1604 corresponding to the new reference region 1602).
[0171] The position of the new reference region 1602 may be selected randomly, or alternatively, the position of the new reference region 1602 may be adjusted in a pre-specified manner for each new frame (e.g., using a pre-defined movement of the region between frames, being constrained to a specified region in the center of the frame, etc.).
[0172] Regardless of how the new reference region is selected, it is used by the machine learning engine 1600 to continuously refine and update the trained weights 1605 used for denoising. In particular, the reference pixel color from each new reference region 1602 is rendered with the noisy reference pixel input from the corresponding low sample count region 1607. Supplemental training is then performed on the machine learning engine 1600 using the high sample count reference region 1602 and the corresponding low sample count region 1607. In contrast to the initial training, this training is performed continuously during runtime for each new reference region 1602, thereby ensuring that the machine learning engine 1600 is accurately trained. For example, per-pixel data channels (e.g., pixel color, depth, normal, normal deviation, etc.) may be evaluated, and the machine learning engine 1600 uses the per-pixel data channels to adjust the trained weights 1605. As in the training case (FIG. 15), the machine learning engine 1600 is trained towards an ideal set of weights 1605 to remove noise from low-sample-count input frames 1601 and generate denoised frames 1620. However, the trained weights 1605 are continually updated based on new image characteristics of new types of low-sample-count input frames 1601.
[0173] The retraining operations performed by the machine learning engine 1600 may be executed concurrently in a background process on a graphics processor unit (GPU) or host processor. A rendering loop, which may be implemented as a driver component and / or a GPU hardware component, may continuously generate new training data (e.g., in the form of new reference regions 1602) to place in a queue. A background training process running on the GPU or host processor may continuously read new training data from this queue and retrain the machine learning engine 1600, updating it with new weights 1605 at appropriate intervals.
[0174] 17 shows an example of such an implementation in which a background training process 1700 is implemented by a host CPU 1710. In particular, the background training process 1700 uses new reference regions 1602 with high sample counts and corresponding low sample regions 1604 to continually update trained weights 1605, thereby updating the machine learning engine 1600.
[0175] As shown in FIG. 18A for the non-limiting example of a multiplayer online game, different host machines 1820-1822 individually generate reference regions that background training processes 1700A-C send to a server 1800 (e.g., a game server, etc.). The server 1800 then runs training on the machine learning engine 1810 using the new reference regions received from each of the hosts 1821-1822 and updates the weights 1805 as described above. The server 1800 then sends these weights 1805 to the host machine 1820, which stores the weights 1605A-C and updates each individual machine learning engine (not shown) accordingly. Because the server 1800 may be provided with a large number of reference regions in a short period of time, it can efficiently and accurately update the weights for any given application (e.g., an online game) run by a user.
[0176] As shown in FIG. 18B, different host machines may generate new trained weights (e.g., based on the training / reference domain 1602 described above) and share the new trained weights with a server 1800 (e.g., a game server, etc.), or alternatively, a peer-to-peer sharing protocol may be used. A machine learning management component 1810 on the server uses the new weights received from each of the host machines to generate a set of connection weights 1805. The connection weights 1805 may be, for example, averages generated from the new weights and continuously updated as described herein. Once generated, copies of the connection weights 1605A-C may be sent to and stored on each of the host machines 1820-1821, which may then use the connection weights to perform denoising operations as described herein.
[0177] A semi-closed loop update mechanism can also be used by hardware manufacturers. For example, a reference network may be included as part of a driver distributed by the hardware manufacturer. The driver generates new training data using the techniques described herein and continually sends it back to the hardware manufacturer, who then uses this information to continue improving the machine learning implementation for the next driver update.
[0178] In an exemplary implementation (e.g., batch movie rendering on a render farm), renderers send newly generated training regions to a dedicated server or database (within the studio's render farm), which aggregates this data from multiple rendering nodes over time. A separate process on a separate machine continuously improves the studio's dedicated denoising network, so that new rendering jobs always use the most recently trained network.
[0179] The machine learning method is illustrated in Figure 19. The method may be implemented in the architectures described herein, but is not limited to any particular system or graphics processing architecture.
[0180] At 1901, as part of an initial training stage, low-sample count image data and high-sample count image data are generated for multiple image frames. At 1902, a machine learning denoising engine is trained using the high / low-sample count image data. For example, a set of convolutional neural network weights associated with pixel features may be updated following training. However, any machine learning architecture may be used.
[0181] At runtime, low sample count image frames are generated at 1903 along with at least one reference region having a high sample count. At 1904, the high sample count reference regions are used by the machine learning engine and / or separate training logic (e.g., background training module 1700) to continually refine the training of the machine learning engine. For example, the high sample count reference regions may be used in combination with corresponding portions of the low sample count image to continue teaching the machine learning engine 1904 how to most effectively perform denoising. For example, in a CNN implementation, this may include updating weights associated with the CNN.
[0182] Many variations of the above may be implemented, such as the manner in which the feedback loop to the machine learning engine is configured, the entity that generates the training data, how the training data is fed back to the training engine, and how the improved network is provided to the rendering engine. Furthermore, while the above example performs continuous training using a single reference region, any number of reference regions may be used. Furthermore, as noted above, the reference regions may be different sizes, may be used on different numbers of image frames, and may be positioned at different locations within the image frames using different techniques (e.g., randomly, according to a predetermined pattern, etc.).
[0183] Furthermore, although a convolutional neural network (CNN) is described as an example of machine learning engine 1600, the underlying principles of the present invention may be implemented using any type of machine learning engine that can continually refine its results using new training data. By way of example and not limitation, other machine learning implementations include group method of data handling (GMDH), long short-term memory, deep reservoir computing, deep belief networks, tensor deep stacking networks, and deep predictive coding networks, to name a few.
[0184] [Apparatus and method for efficient dispersion noise removal] As mentioned above, denoising is a key feature for real-time ray tracing with smooth, noise-free images. Rendering can occur across a distributed system on multiple devices, but to date, all existing denoising frameworks operate on a single instance on a single machine. When rendering occurs across multiple devices, they may not have all the rendered pixels accessible to compute the denoised portion of the image.
[0185] A distributed denoising algorithm is presented that works with both artificial intelligence (AI) and non-AI-based denoising techniques. Regions of the image are either already distributed among nodes from distributed rendering operations or split from a single frame buffer and distributed. If necessary, ghost regions of nearby regions needed to compute sufficient denoising are collected from nearby nodes, and the resulting tiles are composited into the final image.
[0186] (Distributed processing) Figure 20 shows multiple nodes 2021-2023 performing rendering. While only three nodes are shown for simplicity, the underlying principles of the present invention are not limited to any particular number of nodes. In fact, a single node may be used to implement a particular embodiment of the present invention.
[0187] Nodes 2021-2023 each render a portion of the image, resulting in regions 2011-2013 in this example. While rectangular regions 2011-2013 are shown in FIG. 20, regions of any shape may be used, and any device may process any number of regions. The regions required by a node to perform a sufficiently smooth denoising operation are called ghost regions 2011-2013. In other words, ghost regions 2001-2003 represent the totality of data required to perform denoising at a specified level of quality. Reducing the quality level reduces the size of the ghost regions, and therefore the amount of data required, while increasing the quality level increases the ghost regions and the corresponding data required.
[0188] If a node, such as node 2021, has a local copy of the portion of ghost region 2001 needed to denoise its region 2011 at a specified level of quality, the node obtains the necessary data from one or more "neighboring" nodes, such as node 2022, which owns a portion of ghost region 2001 as shown. Similarly, if node 2022 has a local copy of the portion of ghost region 2002 needed to denoise its region 2012 at a specified level of quality, node 2022 obtains the necessary ghost region data 2032 from node 2021. The obtaining may be performed over a bus, an interconnect, a high-speed memory fabric, a network (e.g., fast Ethernet), or even an on-chip interconnect in a multi-core chip that can distribute rendering work among multiple cores (e.g., used to render large images with either extreme resolution or time variation). Each node 2021-2023 may include a separate execution unit or a designated set of execution units within a graphics processor.
[0189] The specific amount of data transmitted depends on the denoising technique being used. Additionally, the data from the ghost regions may include any data necessary to improve the denoising of the respective regions. For example, the ghost region data may include image color / wavelength, intensity / alpha data, and / or normals. However, the underlying principles of the present invention are not limited to any particular set of ghost region data.
[0190] (More details) For slower networks or interconnects, existing general-purpose lossless or lossy compression can be used to compress this data. Examples include, but are not limited to, zlib, gzip, and LZMA (Lempel-Ziv-Markov chain algorithm). Furthermore, content-specific compression may be used by noting that deltas in ray hit information between frames may be very sparse, and when a node already has a delta collected from a previous frame, only samples that contribute to that delta need to be sent. These can be selectively pushed to node i, which collects these samples, or node i can request samples from other nodes. Lossless compression is used for certain types of data and program code, while lossy compression is used for other types of data.
[0191] FIG. 21 shows further details of the interactions between the nodes 2021-2022. Each node 2021-2022 includes ray tracing rendering circuitry 2081-2082 for rendering its respective image region 2011-2012 and ghost region 2001-2002. The denoisers 2100-2111 perform denoising operations on the regions 2011-2012 for which the respective nodes 2021-2022 are responsible for rendering and denoising. For example, the denoisers 2021-2022 may include circuitry, software, or any combination thereof for generating the denoised regions 2121-2122, respectively. As noted above, when generating their denoised regions, the denoisers 2021-2022 may need to rely on data in ghost regions owned by different nodes (e.g., the denoiser 2100 may need data from the ghost region 2002 owned by the node 2022).
[0192] Thus, the denoisers 2100-2111 may use data from the regions 2011-2012 and the ghost regions 2001-2002, respectively, to generate the denoised regions 2121-2122, at least some of which may be received from other nodes. The region data managers 2101-2102 may manage data transfers from the ghost regions 2001-2002, as described herein. The compressor / decompressor units 2131-2132 may perform compression and decompression of ghost region data exchanged between the nodes 2021-2022, respectively.
[0193] For example, in response to a request from node 2022, region data manager 2101 of node 2021 may send data from ghost region 2001 to compressor / decompressor 2131, which compresses the data to generate compressed data 2106 that is sent to node 2022, thereby reducing bandwidth on the interconnect, network, bus, or other data communication link. Compressor / decompressor 2132 of node 2022 then decompresses compressed data 2106, and denoiser 2111 uses the decompressed ghost data to generate a higher quality denoised region 2012 than would be possible with data from region 2012 alone. Region data manager 2102 may store the decompressed data from ghost region 2001 in a cache, memory, register file, or other storage to make it available to denoiser 2111 when generating denoised region 2122. A similar set of operations may be performed to provide data from ghost region 2002 to denoiser 2100 on node 2021, which uses the data in combination with data from region 2011 to generate a higher quality denoised region 2121.
[0194] (data capture or rendering) If the connections between devices such as nodes 2021-2022 are slow (i.e., below a threshold latency and / or threshold bandwidth), it may be faster to render the ghost region locally than to request results from other devices. This can be determined at runtime by tracking the network transaction rate and tracking the rendering time linearly extrapolated with respect to the ghost region size. If it is faster to render out the entire ghost region, multiple devices may end up rendering the same portion of the image. The resolution of the rendered portion of the ghost region may be adjusted based on the variance of the base region and the determined degree of blurriness.
[0195] (load balancing) Static and / or dynamic load balancing schemes may be used to distribute the processing load among the various nodes 2021-2023. For dynamic load balancing, the variance determined by the denoising filter drives the amount of samples used to render particular regions of the scene, such that low-variance blurry regions of the image require fewer samples, while requiring more time for denoising. The particular regions assigned to particular nodes may be dynamically adjusted based on data from previous frames, or may be dynamically communicated between devices as they are rendering, so that all devices have the same amount of work.
[0196] FIG. 22 shows how monitors 2201-2202 running on respective nodes 2021-2022 collect performance metric data, including, but not limited to, the time consumed to transmit data over the network interfaces 2211-2212, the time consumed when denoising regions (with or without ghost region data), and the time consumed to render each region / ghost region. The monitors 2201-2202 report these performance metrics to a manager or load balancing node 2201, which analyzes the data to identify the current workload on each node 2021-2022 and potentially determine more efficient modes of processing the various denoising regions 2121-2122. The manager node 2201 then distributes new workloads for new regions to the nodes 2021-2022 according to the detected load. For example, the manager node 2201 may send more work to nodes that are not overloaded and / or reallocate work from overloaded nodes. Additionally, the load balancing node 2201 may send reconfiguration commands to adjust the particular way in which rendering and / or denoising is performed by each of the nodes (some examples of which are described above).
[0197] (Ghost area determination) The size and shape of the ghost regions 2001-2002 may be determined based on a denoising algorithm implemented by the denoisers 2100-2111. These respective sizes can then be dynamically modified based on the detected variance of the samples being denoised. The learning algorithm used for the AI denoising itself may be used to determine the appropriate region size, or in other cases, such as bilateral blur, a pre-defined filter width determines the size of the ghost regions 2001-2002. In an exemplary implementation using a learning algorithm, the machine learning engine may run on the manager node 2201, and / or portions of the machine learning may run on each of the individual nodes 2021-2023 (see, e.g., Figures 18A-18B above and related text).
[0198] (Collecting the final image) The final image may be generated by collecting the rendered and denoised regions from each of the nodes 2021-2023 without the need for ghost regions or normals. In FIG. 22 , for example, the denoised regions 2121-2122 are sent to a region processor 2280 of the manager node 2201, which combines the regions to generate a final denoised image 2290, which is then displayed on the display 2290. The region processor 2280 may combine the regions using various 2D compositing techniques. Although shown as separate components, the region processor 2280 and the denoised image 2290 may be integrated into the display 2290. The various nodes 2021-2022 may use direct transmission techniques to transmit the denoised regions 2121-2122, potentially using various lossy or lossless compression of the region data.
[0199] AI denoising remains a costly operation as games move to the cloud. Therefore, distributed processing of denoising across multiple nodes 2021-2022 may be necessary to achieve real-time frame rates for traditional games or virtual reality (VR) that require higher frame rates. Movie studios also often render on large render farms that can be utilized for faster denoising.
[0200] An exemplary method for performing distributed rendering and denoising is shown in Figure 23. The method may be implemented in relation to the system architectures described above, but is not limited to any particular system architecture.
[0201] At 2301, graphics work is dispatched to multiple nodes that perform ray tracing operations to render regions of an image frame. Each node may already have the data necessary to perform the operations in memory. For example, two or more nodes may share a common memory, or the local memory of a node may already store data from a previous ray tracing operation. Alternatively, or in addition, specific data may be sent to each node.
[0202] At 2302, the "ghost region" required for a specified level of denoising (i.e., an acceptable level of performance) is determined. The ghost region includes any data required to perform the specified level of denoising, including data owned by one or more other nodes.
[0203] Data relating to the ghost regions (or portions thereof) is exchanged between the nodes at 2303. At 2304, each node performs denoising on its respective region (e.g., using the exchanged data), and at 2305 the results are combined to produce a final denoised image frame.
[0204] A manager node or primary node, such as that shown in Figure 22, may dispatch work to the nodes and then combine the work performed by the nodes to produce the final image frame. A peer-based architecture may be used, where the nodes are peers that exchange data to render and denoise the final image frame.
[0205] The nodes described herein (e.g., nodes 2021-2023) may be graphics processing computing systems interconnected via a high-speed network. Alternatively, the nodes may be individual processing elements coupled to a high-speed memory fabric. All of the nodes may share a common virtual memory space and / or a common physical memory. Alternatively, the nodes may be a combination of CPUs and GPUs. For example, the manager node 2201 described above may be a CPU and / or software running on a CPU, and the nodes 2021-2022 may be GPUs and / or software running on a GPU. A variety of different types of nodes may be used and still adhere to the underlying principles of the present invention.
[0206] (Example Neural Network Implementation) Many types of neural networks exist, and a simple type of neural network is a feedforward network. A feedforward network may be implemented as an acyclic graph in which nodes are arranged in a hierarchy. Typically, a feedforward network topology includes an input layer and an output layer separated by at least one hidden layer. The hidden layer converts inputs received by the input layer into a representation useful for generating outputs at the output layer. Network nodes are fully connected to nodes in adjacent layers via edges, but there are no edges between nodes within each layer. Data received at nodes in the input layer of a feedforward network is propagated (i.e., "feedforward") to nodes in the output layer via an activation function that calculates the state of the nodes in each successive layer in the network based on the coefficients ("weights") associated with each of the edges connecting the layers. Depending on the particular model represented by the algorithm being executed, output from a neural network algorithm can take a variety of forms.
[0207] Before a machine learning algorithm can be used to model a particular problem, the algorithm is trained using a training dataset. Training a neural network involves selecting a network topology, using a set of training data representative of the problem being modeled by the network, and adjusting weights until the network model performs with minimal error for all instances in the training dataset. For example, during the supervised learning training process of a neural network, outputs generated by the network in response to inputs representing instances in the training dataset are compared with the "correct" labeled outputs for those instances, an error signal representing the difference between the outputs and the labeled outputs is calculated, and weights associated with the connections are adjusted to minimize that error as the error signal is propagated backward through the layers of the network. The network is considered "trained" when the error for each output generated from an instance in the training dataset is minimized.
[0208] The accuracy of machine learning algorithms can be significantly affected by the quality of the datasets used to train the algorithms. The training process can be computationally intensive and can require a significant amount of time on conventional general-purpose processors. Therefore, parallel processing hardware is used to train many types of machine learning algorithms. This is particularly useful for optimizing the training of neural networks, as the calculations performed in adjusting the coefficients in neural networks naturally lend themselves to parallel implementation. In particular, many machine learning algorithms and software applications are adapted to use parallel processing hardware within general-purpose graphics processing devices.
[0209] 24 is a generalized diagram of a machine learning software stack 2400. The machine learning application 2402 can be configured to train a neural network using a training dataset or to use a trained deep neural network to implement machine intelligence. The machine learning application 2402 can include training and inference functions for the neural network and / or specialized software that can be used to train the neural network before deployment. The machine learning application 2402 can implement any type of machine intelligence, including, but not limited to, image recognition, mapping and location, automated navigation, speech synthesis, medical imaging, or language translation.
[0210] Hardware acceleration for machine learning applications 2402 can be enabled through machine learning framework 2404. Machine learning framework 2404 may be implemented on hardware described herein, such as processing system 100, including the processors and components described herein. Elements described with respect to FIG. 24 that have the same or similar names as elements in any other figure herein describe the same element in that other figure, may operate or function in a similar manner as described elsewhere herein, may include the same components, and may link to other entities, including, but not limited to, the following: Machine learning framework 2404 can provide a library of machine learning primitives. Machine learning primitives are basic operations typically performed by machine learning algorithms. Without machine learning framework 2404, machine learning algorithm developers would be required to create and optimize the main computational logic associated with their machine learning algorithms and then re-optimize the computational logic as new parallel processors are developed. Instead, machine learning applications can be configured to perform the necessary computations using primitives provided by machine learning framework 2404. Typical primitives include tensor convolution, activation functions, and pooling, which are computational operations performed while training a convolutional neural network (CNN). The machine learning framework 2404 can also provide primitives that implement basic linear algebra subprograms performed by many machine learning algorithms, such as matrix and vector operations.
[0211] The machine learning framework 2404 can process input data received from the machine learning application 2402 and generate appropriate inputs to the computation framework 2406. The computation framework 2406 can abstract basic instructions provided to the GPGPU driver 2408 to allow the machine learning framework 2404 to utilize hardware acceleration via the GPGPU hardware 2410 without requiring the machine learning framework 2404 to have detailed knowledge of the architecture of the GPGPU hardware 2410. Furthermore, the computation framework 2406 can enable hardware acceleration for the machine learning framework 2404 across different types and generations of GPGPU hardware 2410.
[0212] (GPGPU machine learning acceleration) FIG. 25 illustrates a multi-GPU computing system 2500, which may be a variation of processing system 100. Accordingly, the disclosure of any feature herein in combination with processing system 100 also discloses the corresponding combination with multi-GPU computing system 2500, but is not limited to such. Elements in FIG. 25 having the same or similar names as elements in any other figures herein describe the same elements in the other figures, may operate or function in a similar manner as described elsewhere herein, may include the same components, and may link to other entities, but are not limited to such. Multi-GPU computing system 2500 may include a processor 2502 coupled to multiple GPGPUs 2506A-D via a host interface switch 2504. Host interface switch 2504 may be, for example, a PCI Express switch device that couples processor 2502 to a PCI Express bus through which processor 2502 can communicate with the set of GPGPUs 2506A-D. Each of the multiple GPGPUs 2506A-D may be an instance of a GPGPU as described above. The GPGPUs 2506A-D can be interconnected via a set of high-speed point-to-point inter-GPU links 2516. The high-speed inter-GPU links can connect to each of the GPGPUs 2506A-D via dedicated GPU links. The P2P GPU links 2516 enable direct communication between each of the GPGPUs 2506A-D without requiring communication over the host interface bus to which the processor 2502 is connected. With inter-GPU traffic directed to the P2P GPU links, the host interface bus remains available for system memory access or for communicating with other instances of the multi-GPU computing system 2500, for example, via one or more network devices. Instead of connecting the GPGPUs 2506A-D to the processor 2502 via the host interface switch 2504, the processor 2502 can include direct support for the P2P GPU links 2516 and thus be directly connected to the GPGPUs 2506A-D.
[0213] (Implementation of machine learning neural networks) The computational architecture described herein can be configured to perform a type of parallel processing that is particularly suitable for training and deploying neural networks for machine learning. A neural network can be generalized as a network of functions with graph relationships. As is well known in the art, there are various types of neural network implementations used in machine learning. One exemplary type of neural network is a feedforward network, as described above.
[0214] A second exemplary type of neural network is the convolutional neural network (CNN). CNNs are specialized feedforward neural networks for processing data with a known grid-like topology, such as image data. CNNs are therefore commonly used in computer vision and image recognition applications, but may also be used for other types of pattern recognition, such as speech and language processing. Nodes in a CNN input layer are organized into sets of "filters" (feature detectors excited by receptive fields in the retina), and the output of each set of filters is propagated to nodes in successive layers of the network. CNN computation involves applying a convolutional mathematical operation to each filter to generate the filter's output. Convolution is a special type of mathematical operation performed by two functions to generate a third function that is a modified version of one of the two original functions. In convolutional network terminology, the first function for a convolution may be called the input, and the second function may be called the convolution kernel. The output may be called a feature map. For example, the input to a convolutional layer may be a multidimensional array of data defining the various color components of the input image. The convolution kernel can be a multidimensional array of parameters, which are adapted by a training process for the neural network.
[0215] Recurrent neural networks (RNNs) are a family of feedforward neural networks that contain feedback connections between layers. RNNs allow for the modeling of sequential data by sharing parameter data between different parts of the neural network. The architecture of RNNs contains cycles. Because at least a portion of the output data from the RNN is used as feedback to process subsequent inputs in the sequence, the cycles represent the influence of a variable's current value on its value at a future time. This feature makes RNNs particularly useful for language processing due to the variability that language data can comprise.
[0216] The figures described below show exemplary feedforward, CNN, and RNN networks and explain the general process for training and deploying each of these types of networks, respectively. It is understood that these descriptions are exemplary and non-limiting, and that the concepts illustrated are applicable to deep neural networks and machine learning techniques generally.
[0217] The exemplary neural network described above can be used to perform deep learning. Deep learning is machine learning using deep neural networks. The deep neural networks used in deep learning are artificial neural networks that are composed of multiple hidden layers, as opposed to shallow neural networks that contain only a single hidden layer. Deeper neural networks are generally more computationally intensive to train. However, the additional hidden layers of the network enable multi-stage pattern recognition, which results in reduced output error compared to shallow machine learning techniques.
[0218] Deep neural networks used in deep learning typically include a front-end network for performing feature recognition coupled to a back-end network, which represents a computational model that can perform operations (e.g., object classification, speech recognition, etc.) based on feature representations provided to the model. Deep learning enables machine learning to be performed without the need for hand-crafted feature engineering to be performed on the model. Instead, deep neural networks can learn features based on statistical structures or correlations in input data. The learned features can be provided to a computational model that can map the detected features to an output. The computational model used by the network is generally specialized for the particular task being performed, with different models being used to perform different tasks.
[0219] Once a neural network is constructed, a learning model can be applied to the network to train it to perform a specific task. The learning model describes how to adjust the weights in the model to reduce the network's output error. Backpropagation of errors is a common method used to train neural networks. Input vectors are presented to the network for processing. The network's output is compared to the desired output using a loss function, and an error value is calculated for each neuron in the output layer. The error values are then propagated backward until each neuron has an associated error value that roughly represents its contribution to the original output. The network can then learn from these errors using an algorithm such as stochastic gradient descent to update the neural network's weights.
[0220] 26-27 illustrate an exemplary convolutional neural network. FIG. 26 illustrates various layers within a CNN. As shown in FIG. 26, an exemplary CNN used to model image processing can receive input 2602 describing the red, green, and blue (RGB) components of an input image. Input 2602 can be processed by multiple convolutional layers (e.g., convolutional layer 2604, convolutional layer 2606). Output from the multiple convolutional layers can optionally be processed by a set of fully connected layers 2608. As described above for feedforward networks, neurons in a fully connected layer have full connections to all activations of previous layers. Output from fully connected layer 2608 can be used to generate output results from the network. Activations in fully connected layer 2608 can be calculated using matrix multiplication instead of convolution. Not all CNN implementations utilize fully connected layers. For example, in some implementations, convolutional layer 2606 can generate output for the CNN.
[0221] Convolutional layers are sparsely connected, which differs from traditional neural network configurations found in the fully connected layer 2608. Traditional neural network layers are fully connected, such that every output unit interacts with every input unit. However, convolutional layers are sparsely connected because the outputs of the convolutions of a field are input to the nodes of subsequent layers (instead of each state value of each of the nodes in the field), as shown. The kernels associated with a convolutional layer perform the convolution operation, and the outputs are sent to the next layer. The dimensionality reduction performed within the convolutional layers is one aspect that allows CNNs to scale to process large images.
[0222] 27 illustrates exemplary computational stages within a convolutional layer of a CNN. Input to convolutional layer 2712 of a CNN can be processed in three stages in convolutional layer 2714. The three stages can include a convolution stage 2716, a detection stage 2718, and a pooling stage 2720. Convolutional layer 2714 can then output data to a successive convolutional layer. The final convolutional layer of the network can generate output feature map data or provide input to a fully connected layer, e.g., to generate a classification value for input to the CNN.
[0223] The convolution stage 2716 performs several convolutions in parallel to generate a set of linear activations. The convolution stage 2716 may include an affine transformation, which is any transformation that can be specified as a linear transformation plus a translation. Affine transformations include rotation, translation, scaling, and combinations of these transformations. The convolution stage calculates the output of a function (e.g., a neuron) connected to a particular region in its input, which can be determined as a local region associated with the neuron. The neuron calculates the dot product between the neuron's weight and the region in the local input to which the neuron is connected. The output from the convolution stage 2716 defines a set of linear activations that are processed by successive stages of the convolution layer 2714.
[0224] The linear activations can be processed by a detection stage 2718. In the detection stage 2718, each linear activation is processed by a nonlinear activation function. The nonlinear activation function increases the nonlinear characteristics of the entire network without affecting the receptive fields of the convolutional layers. Several types of nonlinear activation functions may be used. One particular type is the rectified linear unit (ReLU), which uses an activation function defined as f(x)=max(0,x), such that activations are thresholded at zero.
[0225] The pooling step 2720 uses a pooling function that replaces the output of the convolutional layer 2706 with a summary statistic of neighboring outputs. Pooling functions can be used to introduce translation invariance into the neural network so that small translations to the input do not change the pooled output. Local translation invariance can be useful in scenarios where the presence of a feature in the input data is more important than the exact location of the feature. Various types of pooling functions can be used during the pooling step 2720, including max pooling, average pooling, and l2-norm pooling. Furthermore, some CNN implementations do not include a pooling step. Instead, such implementations substitute an additional convolutional stage with an increased stride relative to the previous convolutional stage.
[0226] The output from the convolutional layer 2714 can then be processed by the next layer 2722, which can be a further convolutional layer or one of the fully connected layers 2708. For example, the first convolutional layer 2704 in FIG. 27 can output to the second convolutional layer 2706, which can output to the first layer of fully connected layers 2708.
[0227] FIG. 28 illustrates an exemplary recurrent neural network 2800. In a recurrent neural network (RNN), the previous state of the network influences the output of the current state of the network. RNNs can be constructed in a variety of ways using a variety of functions. The use of RNNs generally revolves around using mathematical models to predict the future based on a series of prior inputs. For example, an RNN may be used to perform statistical language modeling to predict the next word given a previous word sequence. The illustrated RNN 2800 can be described as having an input layer 2802 that receives input vectors, a hidden layer 2804 that implements a recurrent function, a feedback mechanism 2805 that allows for a "memory" of previous states, and an output layer 2806 that outputs the results. The RNN 2800 operates on a time-step basis. The state of the RNN at a given time step is influenced based on the previous time step via the feedback mechanism 2805. For a given time step, the state of the hidden layer 2804 is defined by the previous state and the input at the current time step. An initial input (x1) at a first time step can be processed by the hidden layer 2804. A second input (x2) can be processed by the hidden layer 2804 using state information determined during the processing of the initial input (x1). A given state can be calculated as s_t=f(Ux_t+Ws_(t-1)), where U and W are parameter matrices. The function f is typically nonlinear, such as a variant of the hyperbolic tangent function (Tanh) or the normalization function f(x)=max(0,x). However, the particular mathematical function used in the hidden layer 2804 can vary depending on the details of the particular implementation of the RNN 2800.
[0228] In addition to the basic CNN and RNN networks described above, variations of these networks may be possible. One example of a variation of an RNN is the long short-term memory (LSTM) RNN. LSTM RNNs can learn long-term dependencies that may be necessary to process longer sequences of language. A variation of a CNN is the convolutional deep belief network, which has a similar structure to a CNN and is trained in a similar manner to a deep belief network. A deep belief network (DBN) is a generative neural network composed of multiple layers of random (random) variables. DBNs can be trained layer-by-layer using greedy unsupervised learning. The learned weights of a DBN can then be used to provide a pre-trained neural network by determining an optimal initial set of neural network weights.
[0229] Figure 29 illustrates the training and deployment of a deep neural network. Once a given network is structured for a task, the neural network is trained using a training dataset 2902. Various training frameworks 2904 have been developed to enable hardware acceleration of the training process. For example, the machine learning frameworks described above may be configured as training frameworks. The training framework 2904 can be fed into an untrained neural network 2906, allowing the untrained neural network to be trained using parallel processing resources as described herein to generate a trained neural network 2908.
[0230] To begin the training process, initial weights may be selected randomly or by pre-training using a deep belief network. Training cycles are then performed in either a supervised or unsupervised manner.
[0231] Supervised learning is a learning method in which training is performed as an intermediary operation, such as when a training dataset 2902 contains inputs paired with desired outputs for the inputs, or when a training dataset contains inputs with known outputs and the neural network's output is manually scored. The network processes the inputs and compares the resulting outputs against the expected or desired outputs. Errors are then back-propagated through the system. The training framework 2904 can be adjusted to adjust the weights controlling the untrained neural network 2906. The training framework 2904 can provide tools to monitor how the untrained neural network 2906 is converging toward a model suitable for generating correct answers based on known input data. The training process occurs iteratively as the network weights are adjusted to refine the outputs produced by the neural network. The training process can continue until the neural network reaches a desired statistical accuracy associated with the trained neural network 2908. The trained neural network 2908 can then be deployed to implement any number of machine learning operations.
[0232] Unsupervised learning is a learning method in which a network attempts to train itself using unlabeled data. Thus, for unsupervised learning, a training dataset 2902 includes input data without associated output data. An untrained neural network 2906 can learn groupings within the unlabeled inputs and determine how individual inputs relate to the overall dataset. Unsupervised training can be used to generate self-organizing maps, which are a type of trained neural network 2907 that can perform operations useful for reducing the dimensionality of data. Unsupervised training can also be used to perform anomaly detection, which allows for the identification of data points in an input dataset that deviate from normal patterns of data.
[0233] Variations on supervised and unsupervised training may also be used. Semi-supervised learning is a technique that includes a mixture of labeled and unlabeled data of the same distribution in the training data set 2902. Incremental learning is a variation of supervised learning, in which input data is continually used to further train the model. Incremental learning allows the trained neural network 2908 to adapt to new data 2912 without forgetting the knowledge instilled in the network during initial training.
[0234] The training process, whether supervised or unsupervised, especially for deep neural networks, can be too computationally intensive for a single computing node. Instead of using a single computing node, a distributed network of computing nodes can be used to accelerate the training process.
[0235] Figure 30A is a block diagram illustrating distributed training. Distributed training is a training model that uses multiple distributed computing nodes, such as those described above, to perform supervised or unsupervised training of a neural network. The distributed computing nodes may each include one or more host processors and one or more general-purpose processing nodes, such as massively parallel general-purpose graphics processing units. As shown, distributed training can be performed using model parallelism 3002, data parallelism 3004, or a combination of model and data parallelism.
[0236] In model parallelism 3002, different computational nodes in a distributed system can perform training calculations for different portions of a single network. For example, each layer of a neural network can be trained by a different processing node of the distributed system. Advantages of model parallelism include the ability to scale, especially to large models. Separating the computations associated with different layers of a neural network enables the training of very large neural networks where all the layer weights do not fit into the memory of a single computational node. In some examples, model parallelism can be particularly useful in performing unsupervised training of large neural networks.
[0237] In data parallelism 3004, different nodes in the distributed network have a complete instance of the model, and each node receives a different portion of the data. The results from the different nodes are then combined. While different approaches to data parallelism are possible, all data parallel training approaches require a technique for combining results and synchronizing model parameters between each node. Exemplary approaches for combining data include parameter averaging and update-based data parallelism. Parameter averaging trains each node on a subset of the training data and sets global parameters (e.g., weights, biases) to the average of the parameters from each node. Parameter averaging uses a central parameter server that maintains parameter data. Update-based data parallelism is similar to parameter averaging, except that instead of transferring parameters from nodes to a parameter server, updates to the model are transferred. Furthermore, update-based data parallelism can be performed in a distributed manner, with updates being compressed and transferred between nodes.
[0238] Combined model and data parallelism 3006 can be implemented, for example, in a distributed system where each compute node contains multiple GPUs. Each node can have a complete instance of the model, and different GPUs within each node are used to train different parts of the model.
[0239] Distributed training has increased overhead relative to training on a single machine, but the parallel processors and GPGPUs described herein can each implement various techniques to reduce the overhead of distributed training, including techniques to enable high-bandwidth inter-GPU data transfers and accelerated remote data synchronization.
[0240] (Example machine learning application) Machine learning can be applied to solve a variety of technical problems, including, but not limited to, computer vision, autonomous driving and navigation, speech recognition, and language processing. Traditionally, computer vision has been one of the most active research areas for machine learning applications. Computer vision applications range from replicating human visual capabilities, such as facial recognition, to creating new categories of visual capabilities. For example, computer vision applications can be configured to recognize sound waves from vibrations induced in objects seen in a video. Parallel processor-accelerated machine learning allows computer vision applications to be trained using significantly larger training datasets than previously feasible, enabling inference systems to be deployed using low-power parallel processors.
[0241] Parallel processor-accelerated machine learning has autonomous driving applications including lane and road sign recognition, obstacle avoidance, navigation, and driving control. Accelerated machine learning techniques can be used to train driving models based on datasets that define appropriate responses to specific training inputs. The parallel processors described herein enable rapid training of increasingly complex neural networks used in autonomous driving solutions and enable deployment of low-power inference processors on mobile platforms suitable for integration into autonomous vehicles.
[0242] Parallel processor-accelerated deep neural networks have enabled machine learning approaches to automatic speech recognition (ASR). ASR involves generating a function that calculates the most likely language sequence given an input acoustic sequence. Accelerated machine learning using deep neural networks has enabled the replacement of hidden Markov models (HMMs) and Gaussian mixture models (GMMs), previously used for ASR.
[0243] Parallel processor-accelerated machine learning can also be used to accelerate natural language processing. Automated learning procedures can utilize statistical inference algorithms to generate models that are robust to erroneous or unusual inputs. Exemplary natural language processor applications include automatic machine translation between human languages.
[0244] Parallel processing platforms used for machine learning can be divided into training platforms and deployment platforms. Training platforms are typically massively parallel, including optimizations for accelerating multi-GPU single-node training and multi-node multi-GPU training. Exemplary parallel processors suitable for training include the massively parallel general-purpose graphics processing units and / or multi-GPU computing systems described herein. In contrast, deployed machine learning platforms typically include low-power parallel processors suitable for use in products such as cameras, autonomous robots, and self-driving vehicles.
[0245] FIG. 30B illustrates an exemplary inference system-on-a-chip (SOC) 3100 suitable for performing inference using a trained model. Elements in FIG. 30B having the same or similar names as elements in any other figure herein describe the same element in the other figure, may operate or function in a similar manner as described elsewhere herein, may include the same components, and may be linked to other entities, including, but not limited to, the SOC 3100. The SOC 3100 may integrate processing components including a media processor 3102, a vision processor 3104, a GPGPU 3106, and a multi-core processor 3108. The SOC 3100 may further include on-chip memory 3105, which may enable a shared on-chip data pool accessible by each of the processing components. The processing components may be optimized for low-power operation to enable deployment in various machine learning platforms, including autonomous vehicles and autonomous robots. For example, one implementation of the SOC 3100 may be used as part of a master control system for an autonomous vehicle. When the SOC3100 is configured for use in an autonomous vehicle, the SOC will be designed and configured to comply with the relevant functional safety references of the deployment jurisdiction.
[0246] During operation, the media processor 3102 and vision processor 3104 can work cooperatively to accelerate computer vision operations. The media processor 3102 can enable low-latency decoding of multiple high-resolution (e.g., 4K, 8K) video streams. The decoded video streams can be written to a buffer in the on-chip memory 3105. The vision processor 3104 can then analyze the decoded video and perform pre-processing operations on frames of the decoded video in preparation for processing the frames using a trained image recognition model. For example, the vision processor 3104 can accelerate the convolution operations of a CNN used to perform image recognition on high-resolution video data, while back-end model calculations are performed by the GPGPU 3106.
[0247] The multi-core processor 3108 may include control logic to assist in ordering and synchronizing data transfers and shared memory operations performed by the media processor 3102 and the vision processor 3104. The multi-core processor 3108 may also function as an application processor for executing software applications that can utilize the inference computational power of the GPGPU 3106. For example, at least a portion of the navigation and driving logic may be implemented in software running on the multi-core processor 3108. Such software may issue computational workloads directly to the GPGPU 3106, or the computational workloads may be issued to the multi-core processor 3108, which may offload at least a portion of these operations to the GPGPU 3106.
[0248] The GPGPU3106 can include processing clusters within the massively parallel general-purpose graphics processing unit DPLAB00, such as low-power configurations of processing clusters DPLAB06A-DPLAB06H. The processing clusters within the GPGPU3106 can support instructions specifically optimized for performing inference calculations on trained neural networks. For example, the GPGPU3106 can support instructions for performing low-precision calculations, such as 8-bit and 4-bit integer vector operations.
[0249] [Ray Tracing Architecture] In one implementation, a graphics processor includes circuitry and / or program code for performing real-time ray tracing. A dedicated set of ray tracing cores may be included in the graphics processor to perform various ray tracing operations described herein, including ray traversal and / or ray intersection operations. In addition to the ray tracing cores, multiple sets of graphics processing cores for performing programmable shading operations and multiple sets of tensor cores for performing matrix operations on tensor data may also be included.
[0250] FIG. 31 illustrates an exemplary portion of one such graphics processing unit (GPU) 3105, including a dedicated set of graphics processing resources arranged in multi-core groups 3100A-3100N. The graphics processing unit (GPU) 3105 may be a variation of graphics processor 300, GPGPU 1340, and / or any other graphics processor described herein. Accordingly, disclosure of any feature of a graphics processor also discloses the corresponding combination with GPU 3105, but is not limited to such. Furthermore, elements in FIG. 31 having the same or similar names as elements in any other figures herein describe the same elements in the other figures, may operate or function in a similar manner as described elsewhere herein, may include the same components, and may be linked to other entities, but are not limited to such. While details of only a single multi-core group 3100A are provided, it will be appreciated that other multi-core groups 3100B-N may comprise the same or similar sets of graphics processing resources.
[0251] As shown, multicore group 2100A may include a set of graphics cores 3130, a set of tensor cores 3140, and a set of ray tracing cores 3150. Scheduler / dispatcher 241 schedules and dispatches graphics threads for execution on the various cores 3130, 3140, and 3150. A set of register files 3120 stores operand values used by cores 3130, 3140, and 3150 when executing the graphics threads. These may include, for example, integer registers for storing integer values, floating-point registers for storing floating-point values, vector registers for storing packed data elements (integer and / or floating-point data elements), and tile registers for storing tensor / matrix values. The tile registers may be implemented as a combined set of vector registers.
[0252] One or more level 1 (L1) caches and texture units 3160 store graphics data such as texture data, vertex data, pixel data, ray data, bounding volume data, etc. locally within each multicore group 3100A. A level 2 (L2) cache 3180 is shared by all or a subset of the multicore groups 3100A-3100N and stores graphics data and / or instructions for multiple simultaneous graphics threads. As shown, the L2 cache 3180 may be shared among multiple multicore groups 3100A-3100N. One or more memory controllers 3170 couple the GPU 3105 to memory 3198, which may be system memory (e.g., DRAM) and / or dedicated graphics memory (e.g., GDDR6 memory).
[0253] Input / output (IO) circuitry 3195 couples GPU 3105 to one or more I / O devices 3190, such as a digital signal processor (DSP), a network controller, or a user input device. On-chip interconnects may be used to couple I / O device 3190 to GPU 3105 and memory 3198. One or more IO memory management units (IOMMUs) 3170 in IO circuitry 3195 directly couple IO device 3190 to system memory 3198. IOMMU 3170 manages multiple sets of page tables to map virtual addresses to physical addresses in system memory 3198. Furthermore, IO device 3190, CPU 3199, and GPU 3105 may share the same virtual address space.
[0254] IOMMU 3170 also supports virtualization. In this case, IOMMU 3170 may manage (e.g., within system memory 3198) a first set of page tables for mapping guest / graphics virtual addresses to guest / graphics physical addresses and a second set of page tables for mapping guest / graphics physical addresses to system / host physical addresses. The respective base addresses of the first and second sets of page tables may be stored in control registers and swapped upon context switching (e.g., so that a new context is provided access to the associated set of page tables). Although not shown in FIG. 31 , each of cores 3130, 3140, 3145 and / or multicore groups 3100A-3100N may include a translation lookaside buffer (TLB) for caching guest virtual-to-guest physical translations, guest physical-to-host physical translations, and guest virtual-to-host physical translations.
[0255] The CPU 3199, GPU 3105, and IO devices 3190 may be integrated on a single semiconductor chip and / or chip package. The illustrated memory 3198 may be integrated on the same chip or may be coupled to memory controller 3170 via an off-chip interface. In one implementation, memory 3198 includes GDDR6 memory that shares the same virtual address space as other physical system-level memory, although the underlying principles of the present invention are not limited to this particular implementation.
[0256] The tensor cores 3140 include multiple execution units specifically designed to perform matrix operations, which are fundamental computational operations used to perform deep learning operations. For example, simultaneous matrix multiplication operations may be used for neural network training and inference. The tensor cores 3140 may perform matrix processing using a variety of operand precisions, including single-precision floating-point (e.g., 32 bits), half-precision floating-point (e.g., 16 bits), integer word (16 bits), byte (8 bits), and half-byte (4 bits). Neural network implementations may also extract features from each rendered scene, potentially combining details from multiple frames to construct a high-quality final image.
[0257] In deep learning implementations, parallel matrix multiplication operations may be scheduled to run on the tensor cores 3140. Neural network training, in particular, requires a significant number of matrix dot product operations. To process the inner product of an N x N x N matrix multiplication, the tensor cores 3140 may include at least N dot product processing elements. Before the matrix multiplication begins, one entire matrix is loaded into a tile register, and at least one column of a second matrix is loaded every N cycles. There are N dot products to be processed every cycle.
[0258] Matrix elements may be stored with different precisions depending on the particular implementation, including 16-bit words, 8-bit bytes (e.g., INT8), and 4-bit half-bytes (e.g., INT4). Different precision modes may be specified for tensor cores 3140 to ensure that the most efficient precision is used for different workloads (e.g., inference workloads that can tolerate quantization to bytes and half-bytes).
[0259] The ray tracing core 3150 may be used to accelerate ray tracing computations for both real-time ray tracing and non-real-time ray tracing implementations. In particular, the ray tracing core 3150 may include ray traversal / intersection circuitry for performing ray traversals using a bounding volume hierarchy (BVH) and identifying intersections between rays and primitives enclosed within the BVH volume. The ray tracing core 3150 may also include circuitry for performing depth testing and culling (e.g., using a Z-buffer or similar construct). In one embodiment, the ray tracing core 3150 performs traversal and intersection operations in coordination with the image denoising techniques described herein, at least some of which may be executed on the tensor core 3140. For example, the tensor core 3140 may implement a deep learning neural network to perform denoising of frames produced by the ray tracing core 3150. However, the CPU 3199, graphics core 3130 and / or ray tracing core 3150 may also implement all or part of the denoising and / or deep learning algorithms.
[0260] Additionally, as noted above, a distributed approach to denoising may be used, with GPU 3150 in a computing device coupled to other computing devices over a network or high-speed interconnect. The interconnected computing devices may further share neural network learning / training data to improve the speed at which the overall system learns to perform denoising for different types of image frames and / or different graphics applications.
[0261] The ray tracing core 3150 may handle all BVH traversal and ray-primitive intersections, preventing the graphics core 3130 from becoming overloaded with thousands of instructions per ray. Each ray tracing core 3150 may include a first set of specialized circuitry for performing bounding box tests (e.g., for traversal operations) and a second set of specialized circuitry for performing ray-triangle intersection tests (e.g., for traversed intersecting rays). Thus, multi-core group 3100A can simply launch a ray probe, and the ray tracing core 3150 independently performs ray traversal and intersections and returns hit data (e.g., hit, no hit, multiple hits, etc.) to the thread context. The other cores 3130, 3140 may be freed to perform other graphics or compute work while the ray tracing core 3150 performs traversal and intersection operations.
[0262] Each ray tracing core 3150 may include a traversal unit for performing BVH test operations and an intersection unit for performing ray-primitive intersection tests. The intersection unit may then generate a "hit," "no hit," or "multi-hit" response and provide it to the appropriate thread. Between traversal and intersection operations, the execution resources of other cores (e.g., graphics core 3130 and tensor core 3140) may be freed up to perform other forms of graphics work.
[0263] A hybrid rasterization / ray tracing approach may also be used, in which work is distributed between the graphics core 3130 and the ray tracing core 3150.
[0264] The ray tracing core 3150 (and / or other cores 3130, 3140) may include a ray tracing instruction set such as Microsoft's DXR (DirectX Ray Tracing), including the DispatchRays command, as well as hardware support for ray generation shaders, closest-hit shaders, any-hit shaders, and miss shaders, allowing for the allocation of a unique set of shaders and textures for each object. Another ray tracing platform that may be supported by the ray tracing core 3150, graphics core 3130, and tensor core 3140 is Vulkan 1.1.85. However, it should be noted that the underlying principles of the present invention are not limited to any particular ray tracing ISA.
[0265] Generally, the various cores 3150, 3140, 3130 may support a ray tracing instruction set that includes ray generation, closest hit, any hit, ray-primitive intersection, per-primitive and hierarchical bounding box construction, miss, visit, and exception instructions / functions. More specifically, ray tracing instructions for performing the following functions may be included:
[0266] Ray Generation - Ray generation instructions may be executed for each pixel, sample, or other user-defined allocation of work.
[0267] Closest-Hit - The closest-hit command may be executed to find the closest intersection of a ray with a primitive in the scene.
[0268] Any-Hit - The Any-Hit command identifies multiple intersections between rays and primitives in the scene to potentially identify new nearest intersection points.
[0269] Intersection - The intersection command performs a ray-primitive intersection test and outputs the result.
[0270] Per-primitive Bounding Box Construction - This instruction constructs a bounding box around a given primitive or group of primitives (e.g., when constructing a new BVH or other acceleration data structure).
[0271] Miss - Indicates that the ray misses all geometry in the scene or a specified region of the scene.
[0272] Visit - Indicates the child volume the ray travels through.
[0273] Exceptions - Contains various types of exception handlers (e.g., invoked for various error conditions).
[0274] [Hierarchical beam tracing] Bounding volume hierarchies are commonly used to improve the efficiency with which operations are performed on graphics primitives and other graphics objects. A BVH is a hierarchical tree structure built on a set of geometric objects. At the top of the tree structure is a root node that encloses all of the geometric objects in a given scene. Individual geometric objects are enclosed in bounding volumes that form the leaf nodes of the tree. These nodes are then grouped into smaller sets and enclosed within larger bounding volumes. These are then recursively grouped and enclosed within other larger bounding volumes, ultimately resulting in a tree structure with a single bounding volume represented by the root node at the top of the tree. Bounding volume hierarchies are used to efficiently support various operations on sets of geometric objects, such as collision detection, primitive culling, and ray traversal / intersection operations used in ray tracing.
[0275] In a ray tracing architecture, rays are traversed through the BVH to determine ray-primitive intersections. For example, if a ray does not pass through the root node of the BVH, the ray does not intersect with any of the primitives enclosed by the BVH, and no further processing for the ray is required for this set of primitives. If a ray passes through the first child node of a BVH but not the second child node, the ray does not need to be tested against the primitives enclosed by the second child node. In this way, the BVH provides an efficient mechanism for testing ray-primitive intersections.
[0276] A group of consecutive rays, called a "beam," may be tested against a BVH rather than individual rays. FIG. 32 shows an example beam 3201, represented schematically by four distinct rays. Any rays that intersect with a patch 3200 defined by the four rays are considered to be in the same beam. While the beam 3201 in FIG. 32 is defined by a rectangular arrangement of rays, beams may be defined in a variety of other ways (e.g., circular, elliptical, etc.) while still adhering to the underlying principles of the present invention.
[0277] FIG. 33 illustrates how the ray tracing engine 3310 of the GPU 3320 implements the beam tracing techniques described herein. In particular, the ray generation circuit 3304 generates multiple rays on which traversal and intersection operations are performed. However, rather than performing the traversal and intersection operations on individual rays, the traversal and intersection operations are performed using a hierarchy of beams 3307 generated by the beam hierarchy construction circuit 3305. A beam hierarchy is similar to a bounding volume hierarchy (BVH). For example, FIG. 34 provides an example of a primary beam 3400 that may be subdivided into multiple different components. In particular, the primary beam 3400 may be divided into quadrants 3401-3404, and each quadrant may itself be divided into sub-quadrant(s), such as sub-quadrant(s) A-D within the quadrant 3404. The primary beam may be subdivided in various ways. For example, the primary beam may be divided into halves (rather than quarters), each half may be divided into halves, etc. Regardless of how the subdivision is performed, a hierarchical structure is created similar to a BVH, e.g., a root node representing the primary beam 3400, first level child nodes (each represented by a quadrant 3401-3404), second level child nodes for each sub-quadrant A-D, etc.
[0278] Once the beam hierarchy 3307 is constructed, the traversal / intersection circuit 3306 may perform traversal / intersection operations using the beam hierarchy 3307 and the BVH 3308. In particular, the beam may be tested against the BVH and portions of the beam that do not intersect with any portion of the BVH may be culled. Using the data shown in Figure 34, for example, if the sub-beams associated with sub-regions 3402 and 3403 do not intersect with the BVH or a particular branch of the BVH, they may be culled with respect to the BVH or branch. The remaining portions 3401, 3404 may be tested against the BVH by performing a depth-first search or other search algorithm.
[0279] A method for ray tracing is shown in Figure 35. The method may be implemented within the context of the graphics processing architectures listed above, but is not limited to any particular architecture.
[0280] In 3500, a primary beam containing multiple rays is constructed, and in 3501, the beam is subdivided and a hierarchical data structure is generated to create the beam hierarchy. Operations 3500-3501 may be performed as a single, integrated operation to construct a beam hierarchy from multiple rays. In 3502, the beam hierarchy is used with the BVH to cull rays (from the beam hierarchy) and / or nodes / primitives from the BVH. In 3503, ray-primitive intersections are determined for the remaining rays and primitives.
[0281] [Lossy and lossless packet compression in distributed ray tracing systems] Ray tracing computations may be distributed among multiple computing nodes coupled together over a network. For example, Figure 36 shows a ray tracing cluster 3600 including multiple ray tracing nodes 3610-3613 performing ray tracing computations in parallel and potentially combining the results at one of the nodes. In the illustrated architecture, the ray tracing nodes 3610-3613 are communicatively coupled to a client-side ray tracing application 3630 via a gateway.
[0282] One of the challenges of a distributed architecture is the large amount of packetized data that must be transmitted between each of the ray tracing nodes 3610-3613. Both lossless and lossy compression techniques may be used to reduce the data transmitted between the ray tracing nodes 3610-3613.
[0283] To implement lossless compression, rather than sending packets filled with the results of a particular type of operation, data or commands are sent that allow the receiving node to reconstruct the results. For example, stochastically sampled area lights and ambient occlusion (AO) operations do not necessarily require direction. Thus, the sending node can simply send a random seed, which is then used by the receiving node to perform random sampling. For example, if a scene is distributed among nodes 3610-3612, to sample light 1 at points p1-p3, only the light ID and origin need to be sent to nodes 3610-3612. Each node may then independently stochastically sample the light. The random seed may be generated by the receiving node. Similarly, for primary ray hit points, ambient occlusion (AO) and soft shadow sampling can be calculated on nodes 3610-3612 without waiting for the original point for successive frames. Additionally, if a set of rays is known to go to a light source at the same point, a command identifying the light source may be sent to the receiving node, which applies it to the set of rays.As another example, if there are N ambient occlusion rays passing through a single point, a command may be sent to generate N samples from this point.
[0284] Various additional techniques may be applied for lossy compression. For example, a quantization factor may be used to quantize all coordinate values associated with BVH, primitives, and rays. Furthermore, 32-bit floating-point values used for data such as BVH nodes and primitives may be converted to 8-bit integer values. In an exemplary implementation, the bounds of a ray packet are stored with full precision, but individual ray points P1-P3 are transmitted as indexed offsets into the bounds. Similarly, multiple local coordinate systems may be created that use 8-bit integer values as local coordinates. The location of the start point of each of these local coordinate systems may be encoded using full-precision (e.g., 32-bit floating-point) values, effectively connecting the global and local coordinate systems.
[0285] Below is an example of lossless compression: Below is an example of a ray data format used internally in a ray tracing program: struct Ray { uint32 pixId; uint32 materialID; uint32 instanceID; uint64 primitiveID; uint32 geometryID; uint32 lightID; float origin[3]; float direction[3]; float t0; float t; float time; float normal[3]; / / used for geometry intersections float u; float v; float wavelength; float phase; / / Interferometry float refractedOffset; / / Schlieren-esque float amplitude; float weight; }; Instead of sending the raw data for each node generated, this data can be compressed by grouping values and creating implicit rays with applicable metadata where possible.
[0286] (ray data bundling and grouping) Flags may be used to mask or common data with modifiers. struct RayPacket { uint32 size; uint32 flags; list <ray>rays; } for example, RayPacket.rays=ray_1~ray_256 (All starting points are shared) All ray data is packed except that only a single start point is stored across all rays if RayPacket.flags is set for RAYPACKET_COMMON_ORIGIN. If the RayPacket is unpacked upon receipt, the start point is filled in from the single start point value.
[0287] (The origin is only shared among some rays) All ray data is packed, except for rays that share a start point. For each unique shared start point in each group, an operator is packed that identifies the operation (shared start point), remembers the start point, and masks which rays share information. Such operations can be performed on any shared value between nodes, such as material ID, primitive ID, start point, direction, normal, etc. struct RayOperation { uint8 operationID; void* value; uint64 mask; } (Implicit Ray Transmission) Often, ray data can be derived at the receiving end with minimal meta-information used to generate it. A very common example is generating multiple secondary rays to stochastically sample an area. Instead of the sender generating secondary rays and sending them for the receiver to act on, the sender can send a command that a ray needs to be generated along with any dependent information, and the ray is generated at the receiving end. When a ray is initially generated by the sender, and it needs to decide which receiver to send it to, a random seed can be sent to generate the ray and regenerate the exact same ray.
[0288] For example, to sample hit points with 64 shadow rays sampling an area light source, all 64 rays intersect the same area from calculation N4. A RayPacket is created with a common origin and normal. More data may be sent if the receiver wants to contribute shade to the resulting pixel, but for this example we assume we only want to return whether the ray hits other node data. A RayOperation is created for the generated shadow ray operation and assigned a sampled light ID value and a random seed. When N4 receives the ray packet, it generates fully embedded ray data by embedding the shared origin data into all rays and setting the direction based on the ray ID probabilistically sampled with the random seed to generate rays identical to those generated by the original sender. When the results are returned, only binary results for all rays need to be returned; this can be handled by a mask on the rays.
[0289] Sending the original 64 rays in this example would have used 104 bytes x 64 rays = 6656 bytes. If the returning rays were also sent in raw form, this would again double to 13312 bytes. Using lossless compression by sending only the ray generation operations with the common ray origin, normal, seed, and ID, only 29 bytes are sent, along with the 8 bytes returned for the intersected mask. This results in a compression rate of ~360:1 for the data that needs to be sent over the network. This does not include the overhead for processing the messages themselves, which must be identified in some way, which is implementation-dependent. Other operations may be performed to recalculate the ray origin and direction from the pixel ID for primary rays, to recalculate the pixel ID based on the range in the ray packet, and many other possible implementations for recalculating values. Similar operations can be used for any single ray or group of rays sent, including shadows, reflections, refractions, ambient occlusion, intersections, volume intersections, shadowing, bounced reflections, etc. in path tracing.
[0290] FIG. 37 shows further details of two ray tracing nodes 3710-3711, which perform ray tracing packet compression and decompression. In particular, when the first ray tracing engine 3730 is ready to send data to the second ray tracing engine 3731, the ray compression circuit 3720 performs lossy and / or lossless compression of the ray tracing data as described herein (e.g., converting 32-bit values to 8-bit values, substituting raw data for instructions to reconstruct the data, etc.). The compressed ray packet 3701 is transmitted from network interface 3725 to network interface 3726 over a local network (e.g., a 10 Gb / s, 100 Gb / s Ethernet network). The ray decompression circuit then decompresses the ray packet, if necessary. For example, it may execute commands to reconstruct the ray tracing data (e.g., using a random seed to perform random sampling for lighting calculations). The ray tracing engine 3731 then uses the received data to perform ray tracing calculations.
[0291] In the reverse direction, ray compression circuitry 3741 compresses ray data, network interface 3726 transmits the compressed ray data over the network (e.g., using techniques described herein), ray decompression circuitry 3740 decompresses the ray data as needed, and ray tracing engine 3730 uses the data in ray tracing calculations. Although shown as separate units in Figure 37, ray decompression circuits 3740-3741 may be integrated within ray tracing engines 3730-3731, respectively. For example, to the extent that the compressed ray data includes commands to reconstruct the ray data, these commands may be executed by the respective ray tracing engines 3730-3731.
[0292] 38, the beam compression circuit 3720 may include a lossy compression circuit 3801 for performing the lossy compression techniques described herein (e.g., converting 32-bit floating point coordinates to 8-bit integer coordinates) and a lossless compression circuit 3803 for performing the lossless compression techniques (e.g., sending commands and data to enable the beam recompression circuit 3821 to reconstruct the data). The beam decompression circuit 3721 includes a lossy decompression circuit 3802 and a lossless decompression circuit 3804 for performing lossless decompression.
[0293] Another exemplary method is shown in Figure 39. The method may be implemented on a ray tracing architecture or other architectures described herein, but is not limited to any particular architecture.
[0294] At 3900, ray data to be transmitted from a first ray tracing node to a second ray tracing node is received. At 3901, a lossy compression circuit performs lossy compression on the first ray tracing data, and at 3902, a lossless compression circuit performs lossless compression on the second ray tracing data. At 3903, the compressed ray tracing data is transmitted to the second ray tracing node. At 3904, a lossy / lossless decompression circuit performs lossy / lossless decompression of the ray tracing data, and at 3905, the second ray tracing node performs a ray tracing operation using the decompressed data.
[0295] [Hardware-accelerated hybrid ray tracing graphics processor] Next, a hybrid rendering pipeline is presented that performs rasterization on the graphics core 3130 and ray tracing operations on the ray tracing core 3150, the graphics core 3130, and / or the CPU 3199 core. For example, the rasterizer and depth test may be performed on the graphics core 3130 instead of the primary ray casting stage. The ray tracing core 3150 may then generate secondary rays for ray reflection, refraction, and shadows. Furthermore, certain areas of the scene are selected where the ray tracing core 3150 performs ray tracing operations (e.g., based on material property thresholds such as high reflectivity levels), while other areas of the scene are rendered with rasterization on the graphics core 3130. This hybrid implementation may be used for real-time ray tracing applications where latency is a critical issue.
[0296] The ray traversal architecture described below may, for example, use existing single instruction multiple data (SIMD) and / or single instruction multiple thread (SIMT) graphics processors to perform programmable shading and control of ray traversal, while accelerating critical functions such as BVH traversal and / or intersection using dedicated hardware. SIMD occupancy for incoherent paths can be improved by regrouping generated shaders at specific points during traversal and before shading. This is achieved using dedicated hardware that dynamically sorts shaders on-chip. Recursion is managed by splitting functions into continuations that execute upon returning and regrouping continuations before execution for improved SIMD occupancy.
[0297] Programmable control of ray traversal / intersection is achieved by decomposing traversal functionality into inner traversals, which can be implemented as fixed-function hardware, and outer traversals, which run on the GPU processor and allow programmable control through user-defined traversal shaders. The cost of transferring traversal contexts between hardware and software is reduced by conservatively truncating the inner traversal state during the transition between inner and outer traversals.
[0298] Programmable control of ray tracing can be expressed through different shader types, listed below in Table A. There can be multiple shaders per type, for example each material can have a different hit shader.
[0299] [Table 1] Recursive ray tracing may begin with an API function that instructs the graphics processor to initiate a set of primary shaders or intersection circuits that can generate ray-scene intersections for primary rays. This then generates other shaders, such as traversal shaders, hit shaders, or miss shaders. Shaders that generate child shaders can also receive return values from the child shaders. Callable shaders are generic functions that can be directly generated by other shaders and can also return values to the calling shader.
[0300] Figure 40 shows a graphics processing architecture including shader execution circuitry 4000 and fixed function circuitry 4010. The general-purpose execution hardware subsystem includes multiple single instruction multiple data (SIMD) and / or single instructions multiple threads (SIMT) cores / execution units (EUs) 4001 (i.e., each core may include multiple execution units), one or more samplers 4002, and a level 1 (L1) cache 4003 or other form of local memory. The fixed function hardware subsystem 4010 includes a message unit 4004, a scheduler 4007, a ray BVH traversal / intersection circuitry 4005, a sorting circuitry 4008, and a local L1 cache 4006.
[0301] During operation, the primary dispatcher 4009 dispatches a set of primary rays to the scheduler 4007, which schedules the work to shaders executing on the SIMD / SIMT cores / EUs 4001. The SIMD cores / EUs 4001 may be the ray tracing cores 3150 and / or graphics cores 3130 described above. Execution of the primary shaders generates further work to be performed (e.g., one or more child shaders and / or further work to be performed by fixed-function hardware). The message unit 4004 distributes the work generated by the SIMD cores / EUs 4001 to the scheduler 4007, accessing the free stack pool, the sorting circuitry 4008, or the ray-BVH intersection circuitry 4005 as needed. If further work is sent to the scheduler 4007, it is scheduled for processing on the SIMD / SIMT cores / EUs 4001. Prior to scheduling, sorting circuitry 4008 may sort rays into groups or bins (e.g., grouping rays with similar characteristics) as described herein. Ray-BVH intersection circuitry 4005 performs ray intersection tests with BVH volumes. For example, ray-BVH intersection circuitry 4005 may compare ray coordinates with the BVHs at each level to identify volumes the ray intersects.
[0302] Shaders can be referenced using a shader record, a user-allocated structure containing a pointer to an entry function, vendor-specific metadata, and global arguments to the shader executed by the SIMD core / EU4001. Each execution instance of a shader is associated with a call stack that may be used to store arguments passed between parent and child shaders. The call stack may also store references to continuation functions that are executed when the call returns.
[0303] Figure 41 shows an example set of allocated stacks 4101, including a primary shader stack, a hit shader stack, a traversal shader stack, a continuation function stack, and a ray-BVH intersection stack (which may be implemented by fixed function hardware 4010, as described). A new shader invocation may implement a new stack from the free stack pool 4102. Call stacks, e.g., stacks made up of the set of allocated stacks, may be cached in local L1 caches 4003, 4006 to reduce access latency.
[0304] There may be a limited number of call stacks, each with a fixed maximum size "Sstack" allocated in a contiguous region of memory. Therefore, the base address of the stack can be calculated directly from the stack index (stack index, SID) as base address = SID * Sstack. Stack IDs may be allocated and deallocated by the scheduler 4007 when scheduling work to a SIMD core / EU 4001.
[0305] The primary dispatcher 4009 may include a graphics processor command processor that dispatches primary shaders in response to dispatch commands from the host (e.g., CPU). The scheduler 4007 may receive these dispatch requests and, if it can allocate a stack ID per SIMD lane, launch the primary shader on the SIMD processor thread. The stack ID may be allocated from a free stack pool 4102 that is initialized at the start of the dispatch command.
[0306] An executing shader can spawn child shaders by sending a spawn message to message unit 4004. This command contains the stack ID associated with the shader and also contains a pointer to the child shader record for each active SIMD lane. A parent shader can issue this message only once per active lane. After sending spawn messages for all relevant lanes, the parent shader may exit.
[0307] Shaders executing on the SIMD core / EU 4001 can also generate fixed-function tasks, such as ray-BVH intersection, using generate messages with shader record pointers reserved for fixed-function hardware. As described above, the message unit 4004 sends generated ray-BVH intersection work to the fixed-function ray-BVH intersection circuit 4005 and callable shaders directly to the sort circuit 4008. The sort circuit may group shaders by shader record pointer to derive SIMD batches with similar characteristics. Thus, stack IDs from different parent shaders can be grouped into the same batch by the sort circuit 4008. The sort circuit 4008 sends the grouped batches to the scheduler 4007, which accesses shader records from the graphics memory 2511 or the last level cache (LLC) 4020 and starts the shaders on the processor threads.
[0308] Continuations may be treated as callable shaders and may be referenced through shader records. When a child shader is created and returns a value to a parent shader, a pointer to the continuation shader record may be pushed onto the call stack 4101. When the child shader returns, the continuation shader record may be popped from the call stack 4101 and the continuation shader may be created. Optionally, the created continuation may pass through a sort unit, just like a callable shader, and be started on a processor thread.
[0309] As shown in FIG. 42, the sorting circuit 4008 groups tasks generated by shader record pointers 4201A, 4201B, 4201n to create SIMD batches for shading. Stack IDs or context IDs within the sorted batches can be grouped from different dispatches and different input SIMD lanes. The grouping circuit 4210 may perform the sorting using a content addressable memory (CAM) structure 4201 that includes multiple entries, with each entry identified by a tag 4201. As described above, the tag 4201 may be the corresponding shader record pointer 4201A, 4201B, 4201n. The CAM structure 4201 may store a limited number of tags (e.g., 32, 64, 128, etc.), each associated with an incomplete SIMD batch corresponding to a shader record pointer.
[0310] For an incoming generate command, each SIMD lane has a corresponding stack ID (shown as one of 16 context IDs 0-15 in each CAM entry) and a shader record pointer 4201A-B,...n (which serves as a tag value). The grouping circuit 4210 may compare each lane's shader record pointer with the tag 4201 in the CAM structure 4201 to find a matching batch. If a matching batch is found, the stack ID / context ID may be added to the batch. Otherwise, a new entry with a new shader record pointer tag may be created, possibly removing an old entry for an incomplete batch.
[0311] A running shader can deallocate its call stack when it is empty by sending a deallocate message to the message unit, which relays the deallocate message to the scheduler, which returns the stack ID / context ID of the active SIMD lane to the free pool.
[0312] A hybrid approach for ray traversal computation is presented, using a combination of fixed-function and software ray traversal. It thus provides the flexibility of software traversal while maintaining the efficiency of fixed-function traversal. Figure 43 shows an acceleration structure that can be used for hybrid traversal, which is a two-level tree with a single top-level BVH 4300 and several lower-level BVHs 4301 and 4302. Graph elements are shown on the right to indicate an inner traversal path 4303, an outer traversal path 4304, a traversal node 4305, a leaf node with a triangle 4306, and a leaf node with a custom primitive 4307.
[0313] A leaf node 4306 containing a triangle in the top-level BVH 4300 can reference a triangle, a custom primitive intersection shader record, or a traversal shader record. A leaf node 4306 containing a triangle in a lower-level BVH 4301-4302 can only reference triangle and custom primitive intersection shader records. The type of reference is encoded within the leaf node 4306. An internal traversal 4303 indicates traversal within each BVH 4300-4302. Internal traversal operations involve computing ray-BVH intersections, while traversal between BVH structures 4300-4302 is known as external traversal. Internal traversal operations can be implemented efficiently in fixed-function hardware, while external traversal operations can be performed with acceptable performance by programmable shaders. Thus, internal traversal operations may be performed using fixed function circuitry 4010, and external traversal operations may be performed using shader execution circuitry 4000, which includes SIMD / SIMT cores / EUs 4001 for executing programmable shaders.
[0314] It should be noted that SIMD / SIMT cores / EUs 4001 may sometimes be referred to herein simply as "cores," "SIMD cores," "EUs," or "SIMD processors" for brevity. Similarly, ray-BVH traversal / intersection circuitry 4005 may sometimes be referred to simply as "traversal units," "traversal / intersection units," or "traversal / intersection circuits." When alternative terminology is used, the particular names used to designate the respective circuits / logic do not change the underlying function that the circuits / logic perform, as described herein.
[0315] Additionally, although shown as a single component in FIG. 40 for purposes of illustration, the traversal / intersection unit 4005 may include a separate traversal unit and a separate intersection unit, each of which may be implemented in circuitry and / or logic as described herein.
[0316] When a ray intersects a traversal node during an internal traversal, a traversal shader may be generated. The sorting circuit 4008 may group these shaders by shader record pointers 4201A-4201B, n to create SIMD batches, which are initiated by the scheduler 4007 for SIMD execution on the graphics SIMD core / EU 4001. The traversal shader can modify the traversal in several ways, enabling a wide range of applications. For example, the traversal shader can select a BVH at a coarser level of detail (LOD) or transform the ray to enable rigid body transformations. The traversal shader may then generate an internal traversal for the selected BVH.
[0317] Internal traversals compute ray-BVH intersections by traversing the BVH and computing ray-box and ray-triangle intersections. Internal traversals are generated in the same way as shaders by sending messages to the messaging circuit 4004, which relays corresponding generated messages to the ray-BVH intersection circuit 4005, which computes the ray-BVH intersections.
[0318] The stack for the inner traversal may be stored locally within the fixed function circuitry 4010 (e.g., within the L1 cache 4006). When a ray intersects with a leaf node corresponding to a traversal or intersection shader, the inner traversal may terminate and the inner stack may be truncated. The truncated stack, along with pointers to the ray and BVH, may be written to memory at a location specified by the calling shader, and the corresponding traversal or intersection shader may then be generated. If the ray intersects with any triangles during the inner traversal, the corresponding hit information may be provided as an input argument to these shaders, as shown in the following code: These generated shaders may be grouped by the sorting circuitry 4008 to create SIMD batches for execution. struct HitInfo { float barycentrics[2]; float tmax; bool innerTravComplete; uint primID; uint geomID; ShaderRecord* leafShaderRecord; } Truncating the internal traversal stack reduces the cost of spilling it to memory. This technique is described in "Restart Trail for Stackless BVH Traversal," High Performance Graphics (2010), pp. 107-111, where a 42-bit restart trail and a 6-bit depth value may be applied at the top of the stack to truncate the stack to a small number of entries. The restart trail indicates branches already taken in the BVH, and the depth value indicates the depth of the traversal corresponding to the last stack entry. This is enough information to restart the internal traversal later.
[0319] The inner traversal is complete when the inner stack is empty and there are no BVH nodes to test. In this case, an outer stack handler is spawned which pops the top of the outer stack and resumes the traversal if the outer stack is not empty.
[0320] The external traversal may execute a main traversal state machine or may be implemented in program code executed by the shader execution circuitry 4000. Under the following conditions, (1) when a new ray is generated by a hit shader or a primary shader, (2) when a traversal shader selects a BVH for traversal, and (3) when an external stack handler resumes internal traversal for a BVH, it may generate an internal traversal query.
[0321] As shown in Figure 44, before an internal traversal is created, space is allocated on the call stack 4405 for the fixed function circuit 4010 to store a truncated internal stack 4410. The offsets 4403-4404 to the top of the call stack and internal stack are maintained in a traversal state 4400 that is also stored in memory 2511. The traversal state 4400 also includes hit information for rays in world space 4401 and object space 4402 and for the nearest intersecting primitive.
[0322] The traversal shaders, intersection shaders, and external stack handlers are all generated by the ray-BVH intersection circuit 4005. The traversal shaders are allocated on the call stack 4405 before starting a new internal traversal for the second level BVH. The external stack handler is the shader responsible for updating the hit information and resuming any pending internal traversal tasks. The external stack handler is also responsible for generating hit or miss shaders when the traversal is complete. A traversal is complete when there are no pending internal traversal queries to be generated. When the traversal is complete and an intersection is found, a hit shader is generated; otherwise, a miss shader is generated.
[0323] The hybrid traversal scheme described above uses a two-level BVH hierarchy, but any number of BVH levels may also be implemented with corresponding changes in the outer traversal implementation.
[0324] Additionally, while a fixed-function circuit 4010 for performing ray-BVH intersection is described above, other system components may also be implemented within the fixed-function circuit. For example, the outer stack handler described above may be an internal (user-invisible) shader that could potentially be implemented within the fixed-function BVH traversal / intersection circuit 4005. This implementation may be used to reduce the number of dispatched shader stages and round trips between the fixed-function intersection hardware 4005 and the processor.
[0325] The examples described herein enable programmable shading and ray traversal control using user-defined functions that can run with greater SIMD efficiency on existing and future GPU processors. Programmable control of ray traversal enables several important features such as procedural instancing, probabilistic level-of-detail selection, custom primitive intersections, and lazy BVH updates.
[0326] A programmable multiple instruction multiple data (MIMD) ray tracing architecture that supports speculative execution of hit and intersection shaders is also provided. In particular, the architecture focuses on reducing scheduling and communication overhead between the programmable SIMD / SIMT core / execution units 4001 and the fixed-function MIMD traversal / intersection units 4005 described above with respect to FIG. 40 in a hybrid ray tracing architecture. Described below is a multiple speculative execution scheme for hit and intersection shaders that can be dispatched in a single batch from the traversal hardware, avoiding several traversal and shading roundtrips. Dedicated circuitry may be used to implement these techniques.
[0327] Embodiments of the present invention are particularly beneficial in use cases where the execution of multiple hit or intersection shaders from a ray traversal query is desired, which imposes significant overhead when implemented without dedicated hardware support. These include, but are not limited to, nearest k-hit queries (which initiate hit shaders for the nearest k intersections) and multiple programmable intersection shaders.
[0328] The techniques described herein may be implemented as extensions to the architecture shown in Figure 40 (and described with respect to Figures 40-44). In particular, this embodiment of the invention builds on this architecture with extensions to improve performance for the use cases described above.
[0329] The performance limitations of hybrid ray tracing's ray traversal architecture are the overhead of initiating traversal queries from the execution unit and the overhead of invoking programmable shaders from the ray tracing hardware. When multiple hit or intersection shaders are invoked during the traversal of the same ray, this overhead generates "execution roundtrips" between the programmable cores 4001 and the traversal / intersection unit 4005. This also puts additional pressure on the sort unit 4008, which must extract SIMD / SIMT coherence from the individual shader invocations.
[0330] Several aspects of ray tracing require programmable control that can be expressed through different shader types (i.e., primary, hit, any-hit, miss, intersection, traversal, callable), which are listed in Table A above. There can be multiple shaders per type; for example, each material can have a different hit shader. Several of these shader types are defined in the current Microsoft Ray Tracing API.
[0331] As a simple observation, recursive ray tracing begins with an API function that instructs the GPU to initiate a set of primary shaders that can generate ray-scene intersections (implemented in hardware and / or software) for primary rays. This then generates other shaders, such as traversal shaders, hit shaders, or miss shaders. Shaders that generate child shaders can also receive return values from their child shaders. Callable shaders are generic functions that can be directly generated by other shaders and can also return values to the calling shader.
[0332] Ray traversal computes ray-scene intersections by traversing and intersecting nodes in a bounding volume hierarchy (BVH). Recent research has shown that the efficiency of ray-scene intersection computation can be improved by an order of magnitude or more by using techniques more suitable for fixed-function hardware, such as reduced-precision arithmetic, BVH compression, per-ray state machines, dedicated intersection pipelines, and custom caches.
[0333] The architecture shown in Figure 40 includes a system in which an array of SIMD / SIMT cores / execution units 4001 interacts with a fixed-function ray tracing / intersection unit 4005 to perform programmable ray tracing. Programmable shaders are mapped to SIMD / SIMT threads on the execution units / cores 4001, and SIMD / SIMT utilization, execution, and data coherence are important for optimal performance. Ray queries often destroy coherence for a variety of reasons, including: Traversal variance: BVH traversal durations vary significantly between rays, favoring asynchronous ray processing. Execution divergence: Rays generated from different lanes of the same SIMD / SIMT thread may result in different shader invocations. Data access differences: For example, rays hitting different faces sample different BVH nodes, primitives and shaders access different textures, and various other scenarios can cause data access differences.
[0334] SIMD / SIMT core / execution unit 4001 may be a variation of a core / execution unit described herein, including graphics cores 415A-415B, shader cores 1355A-N, graphics core 3130, graphics execution unit 608, execution units 852A-852B, or any other core / execution unit described herein. SIMD / SIMT core / execution unit 4001 may be used in place of graphics cores 415A-415B, shader cores 1355A-1355N, graphics core 3130, graphics execution unit 608, execution units 852A-852B, or any other core / execution unit described herein. Thus, disclosure of any feature in combination with graphics cores 415A-415B, shader cores 1355A-1355N, graphics core 3130, graphics execution unit 608, execution units 852A-852B, or any other core / execution unit described herein also discloses the corresponding combination with SIMD / SIMT core / execution unit 4001 of FIG. 40, but is not limited to such.
[0335] The fixed-function ray tracing / intersection unit 4005 can overcome the first two challenges by processing each ray individually and out of order. However, this splits the SIMD / SIMT groups. Therefore, the sort unit 4008 is responsible for forming new coherent SIMD / SIMT groups of shader invocations that are again dispatched to the execution units.
[0336] It is easy to recognize the advantages of such an architecture compared to a purely software-based ray tracing implementation directly on a SIMD / SIMT processor. However, there is overhead associated with message transmission between the SIMD / SIMT core / execution unit 4001 (sometimes referred to herein as the SIMD / SIMT processor or simply the core / EU) and the MIMD traversal / intersection unit 4005. Furthermore, the sort unit 4008 may not extract full SIMD / SIMT utilization from non-coherent shader invocations.
[0337] Use cases can be identified in which shader invocations may be particularly frequent during traversal. Extensions are described for hybrid MIMD ray tracing processors to significantly reduce communication overhead between the cores / EUs 4001 and the traversal / intersection unit 4005. This can be particularly advantageous when finding the k-nearest intersections and programmable intersection shader implementations. However, it should be noted that the techniques described herein are not limited to any particular processing scenario.
[0338] A summary of the high-level cost of ray tracing context switching between the Core / EU 4001 and the Fixed Function Traversal / Intersection Unit 4005 is provided below. Most of the performance overhead is caused by these two context switches every time a shader invocation is required during a single ray traversal.
[0339] Each SIMD / SIMT lane that initiates a ray generates a create message to the traversal / intersection unit 4005 associated with the BVH to be traversed. Data (the ray traversal context) is relayed to the traversal / intersection unit 4005 via the create message and (cached) memory. When the traversal / intersection unit 4005 is ready to assign a new hardware thread to the create message, it loads the traversal state and performs the traversal on the BVH. There is also setup cost that needs to be performed before the first traversal step of the BVH.
[0340] Figure 45 shows the operational flow of the programmable ray tracing pipeline. The shaded elements, including traversal 4502 and intersection 4503, may be implemented in fixed function circuitry, while the remaining elements may be implemented in programmable cores / execution units.
[0341] The primary ray shader 4501 submits work to a traversal circuit that traverses the current ray through the BVH (or other acceleration structure) at 4502. When a leaf node is reached, the traversal circuit calls the intersection circuit at 4503, which, if it identifies a ray-triangle intersection, calls the any-hit shader at 4504 (which may return a result to the traversal circuit as shown).
[0342] Alternatively, the traversal may terminate before reaching a leaf node and either the closest hit shader is called at 407 (if a hit is recorded) or the miss shader is called at 4506 (if a miss).
[0343] If the traversal circuit reaches a custom primitive leaf node, an intersection shader may be invoked, as shown at 4505. The custom primitive may be any non-triangular primitive such as a polygon or polyhedron (e.g., a tetrahedron, voxel, hexahedron, wedge, pyramid, or other "unstructured" volume). Intersection shader 4505 identifies any intersections between the ray and the custom primitive to anyhit shader 4504, which implements anyhit processing.
[0344] When hardware traversal 4502 reaches a programmable stage, traversal / intersection unit 4005 may generate shader dispatch messages to associated shaders 4505-4507, corresponding to a single SIMD lane of the execution unit used to execute the shader. Because dispatches can occur on rays of any order and diverge in the invoked programs, sort unit 4008 may accumulate multiple dispatch calls to extract a coherent SIMD batch. The updated traversal state and optional shader arguments may be written to memory 2511 by traversal / intersection unit 4005.
[0345] In the k-nearest intersection problem, the closest hit shader 4507 is run for the first k intersections. Traditionally, this means terminating the ray traversal when it finds the closest intersection, invoking the hit shader, and generating a new ray from the hit shader to find the next closest intersection (the offset of the ray's start point ensures that the same intersection does not occur again). It is easy to recognize that this implementation requires the generation of k rays for a single ray. Other implementations use an insertion sort operation to work with an any hit shader 4504 that is invoked for every intersection and maintains a global list of closest intersections. The main problem with this approach is that there is no upper bound on any hit shader invocations.
[0346] As mentioned above, intersection shader 4505 may be invoked for non-triangle (custom) primitives. Depending on the outcome of the intersection test and the traversal state (pending node and primitive intersections), traversal of the same ray may continue after execution of intersection shader 4505. Therefore, finding the closest hit may require several round trips to the execution unit.
[0347] We can also focus on reducing SIMD-MIMD context switches for intersection shaders 4505 and hit shaders 4504, 4507 through modifications to the traversal hardware and shader scheduling model. First, the ray traversal circuitry 4005 delays shader invocations by accumulating multiple potential invocations and dispatching them in larger batches. Additionally, certain invocations that are found to be unnecessary may be removed at this stage. Furthermore, the shader scheduler 4007 may aggregate multiple shader invocations from the same traversal context into a single SIMD batch, which results in a single ray generation message. In one exemplary implementation, the traversal hardware 4005 suspends the traversal thread and waits for the results of multiple shader invocations. This mode of operation is referred to herein as "speculative" shader execution because it allows for the dispatch of multiple shaders, some of which may not be invoked when using sequential invocations.
[0348] Figure 46A shows an example where a traversal operation encounters multiple custom primitives 4650 in a subtree, and Figure 46B shows how this can be resolved in three intersection dispatch cycles C1-C3. In particular, the scheduler 4007 may require three cycles to submit work to the SIMD processor 4001, and the traversal circuitry 4005 requires three cycles to provide the results to the sort unit 4008. The traversal state 4601 required by the traversal circuitry 4005 may be stored in memory, such as a local cache (e.g., an L1 cache and / or an L2 cache).
[0349] A. Deferred ray tracing shader invocation The manner in which the hardware traversal state 4601 is managed can also be modified to allow for the accumulation of multiple potential intersections or hit invocations in the list. At a given time during the traversal, each entry in the list may be used to generate a shader invocation. For example, the k nearest intersections can be accumulated in the traversal hardware 4005 and / or in the traversal state 4601 in memory, and a hit shader can be invoked for each element when the traversal is complete. For a hit shader, multiple potential intersections may be accumulated for a subtree within the BVH.
[0350] For the k-nearest neighbor use case, an advantage of this approach is that all hit shaders are invoked from the same traversal thread during a single traversal operation on traversal circuitry 4005, instead of k-1 round trips to SIMD core / EU 4001 and k-1 new ray generation messages. A potential implementation challenge is that it is not easy to guarantee the execution order of hit shaders (the standard "round trip" approach guarantees that the hit shader for the closest intersection is executed first, etc.). This may be addressed by either synchronization of hit shaders or relaxing the ordering.
[0351] For intersection shader use cases, the traversal circuit 4005 does not know in advance whether a given shader will return a positive intersection test. However, multiple intersection shaders can be speculatively executed, and if at least one returns a positive hit result, it is merged into a global closest hit. A particular implementation must find the optimal number of delayed intersection tests to reduce the number of dispatch calls, but avoid invoking too many redundant intersection shaders.
[0352] B. Aggregation of shader calls from the traversal circuit When dispatching multiple shaders from the same ray generated by the traversal circuit 4005, branches in the flow of the ray traversal algorithm can be created. This can be problematic for intersection shaders because the rest of the BVH traversal depends on the results of all dispatched intersection tests. This means that synchronization operations are required to wait for the results of the shader invocations, which can be a challenge on asynchronous hardware.
[0353] The two points for merging the results of shader invocations are the SIMD processor 4001 and the traversal circuitry 4005. With the SIMD processor 4001, multiple shaders can synchronize and aggregate their results using a standard programming model. One relatively simple way to do this is to use global atomics to aggregate the results in a shared data structure in memory where the intersection results of multiple shaders can be stored. The last shader can then resolve the data structure and call back to the traversal circuitry 4005 to continue the traversal.
[0354] A more efficient approach may also be implemented that restricts execution of multiple shader invocations to lanes of the same SIMD thread on SIMD processor 4001. Intersection tests are then reduced locally using SIMD / SIMT reduction operations (without relying on global atomics). This implementation may rely on new circuitry in sort unit 4008 to keep small batches of shader invocations in the same SIMD batch.
[0355] Execution of the traversal thread may further be paused on the traversal circuitry 4005. Using a traditional execution model, when a shader is dispatched during traversal, the shader thread terminates and the ray traversal state is saved to memory to allow other ray generation commands to execute while the execution unit 4001 processes the shader. If the traversal thread is simply paused, the traversal state does not need to be stored and the result of each shader can be awaited separately. This implementation may include circuitry to avoid deadlocks and provide sufficient hardware utilization.
[0356] 47-48 show an example of a latency model for invoking a single shader invocation on a SIMD core / execution unit 4001 with three shaders 4701. When reserved, all intersection tests are evaluated within the same SIMD / SIMT group. Therefore, the closest intersection can also be calculated on the programmable core / execution unit 4001.
[0357] As described above, all or part of the shader aggregation and / or deferral may be performed by the traversal / intersection circuit 4005 and / or the core / EU scheduler 4007. Figure 47 shows how the shader deferral / aggregation circuit 4706 within the scheduler 4007 delays the scheduling of shaders associated with a particular SIMD / SIMT thread / lane until a specified trigger event occurs. Upon detecting the trigger event, the scheduler 4007 dispatches the multiple aggregated shaders in a single SIMD / SIMT batch to the core / EU 4001.
[0358] Figure 48 shows how shader delay / aggregation circuitry 4805 within traversal / intersection circuitry 4005 can delay scheduling of shaders associated with a particular SIMD thread / lane until a specified trigger event occurs. Upon detecting the trigger event, traversal / intersection circuitry 4005 presents shaders aggregated within a single SIMD / SIMT batch to sort unit 4008.
[0359] However, it should be noted that shader delay and aggregation techniques may be implemented in various other components, such as sort unit 4008, or may be distributed among multiple components. For example, traversal / intersection circuit 4005 may perform a first set of shader-intensive operations, and scheduler 4007 may perform a second set of shader-intensive operations to ensure that shaders of SIMD threads are efficiently scheduled on cores / EUs 4001.
[0360] The "triggering event" that causes the aggregated shaders to be dispatched to a core / EU may be a processing event, such as a specific number of accumulated shaders or a minimum latency associated with a specific thread. Alternatively or additionally, the triggering event may be a time event, such as a specific duration or a specific number of processor cycles since the first shader delay. Other variables, such as the current workload on the core / EU 4001 and traversal / intersection unit 4005, may also be evaluated by the scheduler 4007 to determine when to dispatch a SIMD / SIMT batch of shaders.
[0361] Different embodiments of the present invention may be implemented using different combinations of the above techniques, based on the requirements of the particular system architecture and application being used.
[0362] [Raytracing Instructions] The ray tracing instructions described below are included in the instruction set architecture (ISA) supporting the CPU 3199 and / or GPU 3105. When executed by the CPU, single instruction multiple data (SIMD) instructions may utilize vector / packed source and destination registers to perform the described operations and may be decoded and executed by a CPU core. When executed by the GPU 3105, the instructions may be executed by the graphics core 3130. For example, any of the execution units (EUs) 4001 described above may execute the instructions. Alternatively or additionally, the instructions may be executed by execution circuitry on the ray tracing core 3150 and / or tensor core 3140.
[0363] Figure 49 shows an architecture for executing the ray tracing instructions described below. The architecture shown may be integrated into one or more of the cores 3130, 3140, 3150 described above (see, e.g., Figure 31 and associated text), or may be included in a different processor architecture.
[0364] During operation, the instruction fetch unit 4903 fetches ray tracing instructions 4900 from memory 3198, and the decoder 4995 decodes the instructions. In one implementation, the decoder 4995 decodes the instructions to generate executable operations (e.g., uops or micro-ops in a micro-coding core). Alternatively, some or all of the ray tracing instructions 4900 may be executed without decoding, and thus such a decoder 4904 is not required.
[0365] In either implementation, scheduler / dispatcher 4905 schedules and dispatches instructions (or operations) among functional units (FUs) 4910-4912. The illustrated implementation includes a vector FU 4910 for executing single instruction multiple data (SIMD) instructions that operate simultaneously on multiple packed data elements stored in vector registers 4915, and a scalar FU 4911 for operating on scalar values stored in one or more scalar registers 4916. An optional ray tracing FU 4912 may operate based on packed data values stored in vector registers 4915 and / or scalar values stored in scalar registers 4916. In implementations without dedicated FUs 4912, vector FU 4910 and possibly scalar FU 4911 may execute ray tracing instructions, described below.
[0366] The various FUs 4910-4912 access the ray tracing data 4902 (e.g., traversal / intersection data) needed to execute the ray tracing instructions 4900 from vector registers 4915, scalar registers 4916, and / or a local cache subsystem 4908 (e.g., an L1 cache). The FUs 4910-4912 may also perform accesses to memory 3198 via load and store operations, and the cache subsystem 4908 may operate independently to cache data locally.
[0367] Ray tracing instructions may be used to increase performance for ray traversal / intersection and BVH construction, but they may also be applicable to other areas such as high performance computing (HPC) and general purpose GPU (GPGPU) implementations.
[0368] In the following description, doubleword is sometimes abbreviated as dw, and unsigned byte is abbreviated as ub. Additionally, the source and destination registers (e.g., src0, src1, dest, etc.) shown below may refer to vector registers 4915, or in some cases, a combination of vector registers 4915 and scalar registers 4916. Typically, vector registers 4915 are used when the source or destination value used by an instruction contains packed data elements (e.g., when the source or destination stores N data elements). Other values may use either scalar registers 4916 or vector registers 4915.
[0369] (inverse quantization) An example of a dequantize instruction "dequantizes" a previously quantized value. As an example, in a ray tracing implementation, a particular BVH subtree may be quantized to reduce storage and bandwidth requirements. A dequantize instruction may be of the form dequantize dest src0 src1 src2, where source register src0 stores N unsigned bytes, source register src1 stores one unsigned byte, source register src2 stores one floating-point value, and destination register dest stores N floating-point values. All of these registers may be vector registers 4915. Alternatively, src0 and dest may be vector registers 4915, and src1 and src2 may be scalar registers 4916.
[0370] The following code sequence defines a specific implementation of the inverse quantization instruction. for (int i=0; i <SIMD_WIDTH) { if (execMask[i]) { dst[i]=src2[i]+ldexp(convert_to_float(src0[i]),src1); } } In this example, ldexp multiplies a double-precision floating-point value by the specified integer power of 2 (i.e., ldexp(x,exp)=x*2 exp In the above code, if the execution mask value associated with the current SIMD data element (execMask[i]) is set to 1, the SIMD data element at position i in src0 is converted to a floating-point value and raised to an integer power (2 src1 value) and this value is added to the corresponding SIMD data element in src2.
[0371] (select min or max) A selective min or max instruction may perform either a min or max operation per lane (i.e., return the minimum or maximum value of a set of values), as indicated by the bits of a bit mask. The bit mask may utilize vector registers 4915, scalar registers 4916, or a separate set of mask registers (not shown). The following code sequence: sel_min_max dest src0 src1 src2 defines one specific implementation of a min / max instruction, where src0 stores N doublewords, src1 stores N doublewords, src2 stores one doubleword, and the destination register stores N doublewords.
[0372] The following code sequence defines one particular implementation of the selective min / max command: for (int i=0;i <SIMD_WIDTH) { if (execMask[i]) { dst[i]=(1< <i)&src2 ? min(src0[i],src1[i]) : max(src0[i],src1[i]); } } In this example, the value of (1<<i)&src2 (1 left-shifted by i and ANDed with src2) is used to select the minimum or maximum of the i-th data elements of src0 and src1. The operation on the i-th data element is only executed if the execution mask value (execMask[i]) associated with the current SIMD data element is set to 1.
[0373] (Shuffle index instruction) The shuffle index instruction can copy any set of input lanes to the output lanes. For a SIMD width of 32, this instruction can be executed with a lower throughput. This instruction has the form shuffle_index dest src0 src1 <optional flag>, where src0 stores N double words, src1 stores N unsigned bytes (i.e., index values), and dest stores N double words.
[0374] The following code sequence defines one specific implementation of the shuffle index instruction. for (int i = 0; i < SIMD_WIDTH) { uint8_t srcLane = src1.index[i]; if (execMask[i]) { bool invalidLane = srcLane < 0 || srcLane >= SIMD_WIDTH ||!execMask[srcLaneMod]; if (FLAG) { invalidLane |= flag[srcLaneMod]; } if (invalidLane) { dst[i] = src0[i]; } else { dst[i] = src0[srcLane]; } } } In the code above, the index of src1 identifies the current lane. If the i-th value in the execution mask is set to 1, a check is performed to ensure the source lane is within the range of 0 to the SIMD width. If so, a flag is set (srcLaneMod) and data element i of the destination is set equal to data element i of src0. If the lane is within range (i.e., valid), the index value of src1 (srcLane0) is used as an index into src0 (dst[i] = src0[srcLane]).
[0375] (Immediate shuffle Up / Dn / XOR instructions) The immediate shuffle instruction may shuffle input data elements / lanes based on an immediate value in the instruction. The immediate value may specify to shift the input lanes by 1, 2, 4, 8, or 16 positions, based on the value of the immediate value. Optionally, an additional scalar input register can be specified as a fill value. When the source lane index is invalid, the fill value (if provided) is stored in the destination data element location. If no fill value is provided, the data element location is set to all zeros.
[0376] The flags register may be used as a source mask: if the flag bit for a source lane is set to 1, the source lane is marked as invalid and the instruction may proceed.
[0377] Below are examples of different implementations of the immediate shuffle instruction: shuffle_ <up dn xor>_<1 / 2 / 4 / 8 / 16> dest src0 <optional src1> <optional flag> shuffle_ <up dn xor>_<1 / 2 / 4 / 8 / 16> dest src0<optional src1><optional flag> In this implementation, src0 stores N double words, src1 stores one double word for the fill value (if any), and dest stores N double words containing the result.
[0378] The following code sequence defines one particular implementation of the immediate shuffle instruction: for (int i=0;i <SIMD_WIDTH) { int8_t srcLane; switch(SHUFFLE_TYPE) { case UP: srcLane=i-SHIFT; case DN: srcLane=i+SHIFT; case XOR: srcLane=i^SHIFT; } if (execMask[i]) { bool invalidLane=srcLane<0||srcLane>=SIMD_WIDTH||!execMask[srcLane]; if (FLAG) { invalidLane|=flag[srcLane]; } if (invalidLane) { if (SRC1) dst[i]=src1; else dst[i]=0; } else { dst[i]=src0[srcLane]; } } } Here, the input data element / lane is shifted by 1, 2, 4, 8 or 16 positions based on the value of the immediate. Register src1 is an additional scalar source register and is used as a fill value to be stored in the destination data element location when the source lane index is invalid. If no fill value is provided and the source lane index is invalid, the destination data element location is set to 0. The flag register (FLAG) is used as a source mask. If the flag bit for a source lane is set to 1, the source lane is marked as invalid and the instruction proceeds as above.
[0379] (Indirect shuffle Up / Dn / XOR instructions) An indirect shuffle instruction has a source operand (src1) that controls the mapping from the source lane to the destination lane. An indirect shuffle instruction may be of the form: shuffle_ <up dn xor>dest src0 src1<optional flag> src0 stores N double words, src1 stores 1 double word, and dest stores N double words.
[0380] The following code sequence defines one particular implementation of the immediate shuffle instruction: for (int i=0;i <SIMD_WIDTH) { int8_t srcLane; switch(SHUFFLE_TYPE) { case UP: srcLane=i-src1; case DN: srcLane=i+src1; case XOR: srcLane=i^src1; } if (execMask[i]) { bool invalidLane=srcLane<0||srcLane>=SIMD_WIDTH||!execMask[srcLane]; if (FLAG) { invalidLane|=flag[srcLane]; } if (invalidLane) { dst[i]=0; } else { dst[i]=src0[srcLane]; } } } Thus, the indirect shuffle instruction operates in a similar manner to the immediate shuffle instruction described above, except that the mapping of source lanes to destination lanes is controlled by the source register src1 rather than an immediate value.
[0381] (Cross Lane min / max command) Cross lane min / max instructions may be supported for floating point and integer data types. A cross lane min instruction may be of the form lane_min dest src0, and a cross lane max instruction may be of the form lane_max dest src0, where src0 stores N double words and dest stores 1 double word.
[0382] As an example, the following code sequence defines one specific implementation of the crosslane minimum: dst=src[0]; for (int i=1;i <SIMD_WIDTH) { if (execMask[i]) { dst=min(dst,src[i]); } } In this example, the doubleword value in data element position i of the source register is compared to the data element in the destination register, and the minimum of the two values is copied to the destination register. The cross-lane maximum instruction operates in essentially the same manner, the only difference being that the maximum of the data element at position i and the destination value is selected.
[0383] (Cross Lane min / max index command) A cross lane minimum index instruction may be of the form lane_min_index dest src0, and a cross lane maximum index instruction may be of the form lane_max_index dest src0, where src0 stores N double words and dest stores 1 double word.
[0384] As an example, the following code sequence defines one specific implementation of a cross lane minimum index instruction: dst_index=0; tmp=src[0] for (int i=1;i <SIMD_WIDTH) { if (src[i] <tmp&&execMask[i]) { tmp=src[i]; dst_index=i; } } In this example, the destination index spans the destination register and increments from 0 to the SIMD width. If the execution mask bit is set, the data element at location i of the source register is copied to a temporary storage location (tmp), and the destination index is set to data element location i.
[0385] (Cross Lane Sorting Network Instruction) A cross-lane sorting network instruction may sort all N input elements using an N-wide (stable) sorting network in either ascending (sortnet_min) or descending (sortnet_max) order. Min / max versions of the instruction may be of the form sortnet_min dest src0 and sortnet_max dest src0, respectively. In one implementation, src0 and dest store N double words. The min / max sort is performed on the N double words in src0, and the ascending elements (for min) or descending elements (for max) are stored in dest in the respective sorted order. An example of a code sequence defining an instruction is dst = apply_N_wide_sorting_network_min / max(src0).
[0386] (Cross Lane Sorting Network Index Instruction) The cross-lane sorting network index instruction may sort all N input elements using an N-wide (stable) sorting network, but returns a permutation index in either ascending (sortnet_min) or descending (sortnet_max) order. Min / max versions of the instruction may be of the form sortnet_min_index dest src0 and sortnet_max_index dest src0, where src0 and dest store N double words each. An example code sequence defining the instruction is dst = apply_N_wide_sorting_network_min / max_index(src0).
[0387] A method for executing any of the above instructions is shown in Figure 50. The method may be implemented in the specific processor architectures listed above, but is not limited to any particular processor or system architecture.
[0388] In 5001, instructions of a primary graphics thread are executed on a processor core, which may include, for example, any of the cores described above (e.g., graphics core 3130). Upon reaching ray tracing work within the primary graphics thread, as determined in 5002, the ray tracing instructions are offloaded to a ray tracing execution circuit, which may be in the form of a functional unit (FU) as described above with respect to FIG. 49, or may be a dedicated ray tracing core 3150 as described with respect to FIG. 31.
[0389] In 5003, the ray tracing instructions are decoded and fetched from memory, and in 5005, the instructions are decoded into executable operations (e.g., in embodiments requiring a decoder). In 5004, the ray tracing instructions are scheduled and dispatched for execution by the ray tracing circuitry. In 5005, the ray tracing instructions are executed by the ray tracing circuitry. For example, the instructions may be dispatched and executed on the above-mentioned FUs (e.g., vector FU 4910, ray tracing FU 4912, etc.) and / or the graphics core 3130 or ray tracing core 3150.
[0390] Upon completion of execution of the ray tracing instructions, the results are stored (e.g., stored in memory 3198) at 5006 and the primary graphics thread is notified at 5007. At 5008, the ray tracing results are processed within the context of the primary thread (e.g., read from memory and integrated into the graphics rendering results).
[0391] In embodiments, the terms "engine" or "module" or "logic" may refer to, be a part of, or include an application specific integrated circuit (ASIC), electronic circuitry, processor (shared, dedicated, or group), and / or memory (shared, dedicated, or group) executing one or more software or firmware programs, combinatorial logic, and / or other suitable components that provide the functionality described above. In embodiments, the engine, module, or logic may be implemented in firmware, hardware, software, or any combination of firmware, hardware, and software.
[0392] Apparatus and method for throttling in a ray tracing pipeline An embodiment of the present invention includes a combination of fixed-function acceleration circuitry and general-purpose processing circuitry to perform ray tracing. For example, certain operations related to ray traversal of a bounding volume hierarchy (BVH) and intersection testing may be performed by the fixed-function acceleration circuitry, while multiple execution circuits execute various types of ray tracing shaders (e.g., any-hit shaders, intersection shaders, miss shaders, etc.). One embodiment includes dual high-bandwidth storage banks containing multiple entries for storing rays and corresponding dual stacks for storing BVH nodes. In this embodiment, the traversal circuitry alternates between the dual ray banks and stacks to process rays at each clock cycle. Furthermore, one embodiment includes priority selection circuitry / logic that distinguishes between interior nodes, non-internal nodes, and primitives and uses this information to intelligently prioritize processing of BVH nodes and primitives bounded by BVH nodes.
[0393] One particular embodiment reduces the high-speed memory required for traversal by using a short stack to store a limited number of BVH nodes during a traversal operation. This embodiment includes stack management circuitry / logic for efficiently pushing and popping entries to and from the short stack to ensure that required BVH nodes are available. Furthermore, traversal operations are tracked by performing updates to a tracking data structure. When the traversal circuitry / logic is paused, it can reference the tracking data structure to begin the traversal operation at the same location within the BVH where it left off. Maintaining the tracking data in the tracking data structure is performed so that the traversal circuitry / logic can resume.
[0394] FIG. 51 illustrates one embodiment including a shader execution circuit 4000 for executing shader program code and processing associated ray tracing data 4902 (e.g., BVH node data and ray data), a ray tracing acceleration circuit 5110 for performing traversal and intersection operations, and a memory 3198 for storing program code and associated data processed by the RT acceleration circuit 5110 and the shader execution circuit 4000.
[0395] In one embodiment, the shader execution circuitry 4000 includes multiple cores / execution units 4001 that execute shader program code to perform various forms of data-parallel operations. For example, in one embodiment, the cores / execution units 4001 can execute a single instruction across multiple lanes, with each instance of the instruction operating on data stored in a different lane. In a SIMT implementation, for example, each instance of the instruction is associated with a different thread. During execution, the L1 cache stores specific ray tracing data (e.g., recently or frequently accessed data) for efficient access.
[0396] The set of primary rays may be dispatched to a scheduler 4007, which schedules work for shaders executed by a core / EU 4001. The core / EU 4001 may be a ray tracing core 3150, a graphics core 3130, a CPU core 3199, or any other type of circuitry capable of executing shader program code. One or more primary ray shaders 5101 process the primary rays and generate further work (e.g., performed by one or more child shaders) to be executed by the ray tracing acceleration circuitry 5110 and / or the core / EU 4001. New work generated by the primary ray shader 5101 or other shaders executed by the core / EU 4001 may be distributed to a sorting circuit 4008, which sorts rays into groups or bins (e.g., grouping rays with similar characteristics) as described herein. The scheduler 4007 then schedules the new work for the core / EU 4001.
[0397] Other shaders that may be executed include any hit shader 4514 and closest hit shader 4507, which process hit results as described above (e.g., identify any hit or the closest hit, respectively, for a given ray). Miss shader 4506 processes ray misses (e.g., when a ray does not intersect with a node / primitive). As described above, various shaders can be referenced using shader records, which may contain one or more pointers, vendor-specific metadata, and global arguments. In one embodiment, a shader record is identified by a shader record identifier (SRI). In one embodiment, each execution instance of a shader is associated with a call stack 5203, which stores arguments passed between parent and child shaders. The call stack 5203 may also store references to continuation functions that are executed when the call returns.
[0398] The ray traversal circuit 5102 traverses each ray through the nodes of the BVH, down the hierarchy of the BVH (e.g., through parent, child, and leaf nodes) to identify nodes / primitives traversed by the ray. The ray-BVH intersection circuit 5103 performs intersection tests for the ray, determines hit points on primitives, and generates results according to the hits. The traversal circuit 5102 and intersection circuit 5103 may obtain work from one or more call stacks 5121. Within the ray tracing acceleration circuit 5110, the call stacks 5121 and associated ray tracing data 4902 may be stored in a local ray tracing cache (RTC) 5107 or other local storage device for efficient access by the traversal circuit 5102 and intersection circuit 5103. One particular embodiment, described below, includes a high-bandwidth ray bank (see, e.g., FIG. 52).
[0399] The ray tracing acceleration circuit 5110 may be a variation of the various traversal / intersection circuits described herein, including the ray-BVH traversal / intersection circuit 4005, the traversal circuit 4502 and intersection circuit 4503, and the ray tracing core 3150. The ray tracing acceleration circuit 5110 may be used in place of the ray-BVH traversal / intersection circuit 4005, the traversal circuit 4502 and intersection circuit 4503, and the ray tracing core 3150, or any other circuitry / logic for processing BVH stacks and / or performing traversal / intersection. Accordingly, disclosure of any feature described herein in combination with the ray-BVH traversal / intersection circuit 4005, the traversal circuit 4502 and intersection circuit 4503, and the ray tracing core 3150 also discloses the corresponding combination with the ray tracing acceleration circuit 5110, but is not limited to such.
[0400] Referring to FIG. 52, one embodiment of the ray traversal circuit 5102 includes first and second storage banks (5201 and 5202, respectively), each containing multiple entries for storing a corresponding number of incident rays 5206 loaded from memory. Corresponding first and second stacks (5203 and 5204, respectively) contain selected BVH node data 5290-5291 read from memory and stored locally for processing. As described herein, in one embodiment, the stacks 5203-5204 are "short" stacks containing a limited number of entries (e.g., six entries in one embodiment) for storing BVH node data. Although illustrated separately from the ray banks 5201-5202, the stacks 5203-5204 may also be maintained within the corresponding ray banks 5201-5202. Alternatively, the stacks 5203-5204 may be stored in separate local memories or caches.
[0401] One embodiment of traversal processing circuitry 5210 alternates between the two banks 5201-5202 and the stacks 5203-5204 when selecting the next ray or box and node to process (e.g., in a ping-pong fashion). For example, traversal processing circuitry 5210 may select a new ray / BVH node from alternate ray banks / stacks on each clock cycle, thereby ensuring highly efficient operation. However, it should be noted that this particular configuration is not required to comply with the underlying principles of the present invention.
[0402] In one embodiment, the ray allocator 5205 balances the entries of incident rays / boxes 6106 in the first and second memory banks (5201-5202, respectively) based on the current relative values of a set of bank allocation counters 5220. In one embodiment, the bank allocation counters 5220 maintain a count of the number of untraversed rays in each of the first and second memory banks 5201-5202. For example, the first bank allocation counter may be incremented when the ray allocator 5205 adds a new ray to the first bank 5201 and decremented when a ray is processed from the first bank 5201. Similarly, the second bank allocation counter may be incremented when the ray allocator 5205 adds a new ray to the second bank 6101 and decremented when a ray is processed from the second bank 5201.
[0403] In one embodiment, ray allocator 5205 assigns the current ray to the bank associated with the smaller counter value. If the two counters are equal, ray allocator 5205 may select either bank, or may select a bank different from the one selected the last time the counters were equal. In one embodiment, each ray is stored in one entry in one of banks 5201-5202, with each bank containing 32 entries for storing up to 32 rays. However, the underlying principles of the invention are not limited to these details.
[0404] When the shader execution rate is faster than the ray throughput of the traversal hardware, a large number of outstanding ray messages and associated rays can queue, increasing the working set size and reducing the cache hit rate. For example, in some situations, core / EU 4001 may execute primary ray shader 5101 and generate rays 5206 faster than traversal / intersection circuitry 5102-5103 can traverse the rays and intersect them with nodes / primitives. In one embodiment, core / EU 4001 stores the rays in L1 cache 4003 and sends corresponding ray messages (sometimes referred to herein as "RayTrace" messages) to be processed by traversal circuitry 5102. The ray messages include an address pointer to the ray and other associated data used by the traversal circuitry to read and process the ray. If there is a significant delay between the time a ray is generated and the time the ray message is processed by the traversal circuit 5102, the ray may be evicted from the L1 cache 4003, requiring access to system memory 3198 or a slower cache level.
[0405] Embodiments of the present invention implement one or more of the following techniques to address this limitation. For example, in one embodiment, the accumulation of ray messages in a ray message queue or stack is monitored. If a high threshold is reached (e.g., 80%-90% of the entries are filled), a feedback message / signal is generated to throttle the EU4001 and reduce the frequency of ray generation. Alternatively or additionally, the ray queue / stack may be managed as a last-in-first-out (LIFO) queue / stack, meaning that each new ray is added to the top of the stack and is the next to be processed by the RT circuitry 5110. This increases the likelihood that the next ray to be processed will be found in the L1 cache, but reduces the "fairness" associated with processing rays, because older rays are less likely to be processed next. As a result, a significant amount of time may pass before a particular ray reaches the top of the stack for processing.
[0406] 53 illustrates memory-backed stack management logic 5380 according to one embodiment of the present invention that manages the flow of ray messages generated by shader execution circuitry 4000 and consumed by ray tracing circuitry 5110. In one embodiment, memory-backed stack management circuitry 5380 stores ray messages in memory-backed stack 5330 or spills ray messages into memory subsystem 5490.
[0407] During operation, the dispatcher 5305 dispatches work, such as primary ray shaders 5101, to the execution units 4001, which in turn execute the shaders and generate primary rays. Rays are initially stored in the L1 cache 4003 of the EU 4001 (or in any part of the memory subsystem 5490, such as the LLC 4020 or system memory 2511). Ray messages corresponding to primary rays are sent to the arbitration logic 5312, which implements an arbitration policy (e.g., round-robin, priority-based, etc.) and forwards the ray messages to the ray compressor 5420. As the EU 4001 executes primary ray shaders, certain SIMD lanes may become idle or unused, resulting in empty or invalid slots. Ray compressor 5320 eliminates empty / invalid slots in the pipeline, compresses and packs ray messages as efficiently as possible within message slots, and sends the compressed ray messages through ray message FIFO 5322 (other buffer types may be used). In one embodiment, ray compressor 5320 forms fixed-size chunks of ray data that fit within a cache line.
[0408] Each compressed ray message is passed to memory-backed stack 5430 via stack arbitration logic 5325, which, depending on signals from stack control / feedback circuit 5331 and / or ray message FIFO feedback circuit 5321, either queues the ray message in a message entry of memory-backed stack 5330 or stores the message in memory subsystem 5490. As noted above, in certain applications, memory-backed stack 5330 may be implemented as a last-in first-out (LIFO) queue. In such an implementation, arbitration logic 5325 places the ray message at the top of memory-backed stack 5330 for immediate consumption by RT circuit 5110. In this embodiment, when memory-backed stack 5330 becomes full, older ray tracing messages are stored in memory subsystem 5390.
[0409] Memory-backed counting and addressing circuitry 5335 tracks light ray messages stored in memory subsystem 5390 (e.g., counts the number of light ray messages in memory subsystem 5390 and / or maintains addresses associated with the light ray messages). Memory backend fetch circuitry 5340 uses the stored counts and addresses to fetch light ray messages from memory subsystem 5390 in response to requests from control circuitry 5331 and pushes them onto stack 5330.
[0410] Alternatively, or in addition, dispatcher 5405 may receive a feedback signal from control circuitry 5331 of memory-backed stack 5430 and / or control circuitry 5321 of ray message FIFO 5322 when the number of entries stored in the respective storage elements reaches a specified high threshold. In response, dispatcher 5405 may responsively throttle the dispatching of new work to EU4001 to reduce pressure (e.g., by limiting the number of stacks, as described below). When the number of ray tracing messages in memory-backed stack 5430 reaches a low threshold, dispatcher 5405 resumes dispatching work at normal throughput (e.g., as efficiently as possible). One embodiment of memory-backed stack 5430 has 64-byte entries, each capable of storing 29 rays.
[0411] In one embodiment, a ray trace message includes a pointer, stack ID, and supplemental control data used by the RT circuitry 5110 to read and process ray data from the memory subsystem 5490. In implementations where the EU includes SIMD circuitry, a ray trace message references one ray per SIMD lane.
[0412] FIG. 54 illustrates an example of a write to local chip storage 5404, which may include an entry in memory-backed stack 5330. As shown, the write may include a synchronous compressed message 5420 or an asynchronous compressed message 5421. As used herein, synchronous compressed messages 5420 are written to local chip storage 5404 and processed synchronously, i.e., as they are received. In contrast, asynchronous compressed messages 5421 may be processed out of order. For example, some ray messages may be bypassed in favor of other messages, spilled to memory subsystem 5390, and then returned to memory-backed stack 5330 when entries such as 5404 and / or other processing resources are available. When a ray message is asynchronously spilled to memory at 5413, it may be asynchronously placed in local chip storage 5404 from memory 2511 when data and execution resources are available.
[0413] Current working message 5405 comprises the message currently being processed by the ray tracing circuitry. In one embodiment, if certain resources and data required to execute the current working message are unavailable, partially processed message 5406 may be written back to local chip storage 5404 and / or returned to memory 5413. For example, if, after initial message decoding and evaluation, it is determined that a ray referenced by current working message 5405 must be requested from system memory 2511, a ray request may be sent to memory subsystem 5390 and the (partially processed) ray message 5406 may be written back to local chip storage 5404. Subsequently, when the ray is retrieved from system memory 2511 and stored in local memory (e.g., local cache, ray bank 5201-5202, etc.), partially processed message 5406 may be read from local chip storage 5404 and processing may be completed.
[0414] Some implementations may use a combination of asynchronous and synchronous processing. For example, if ray messages are being generated at a rate equal to or less than the rate at which they can be consumed by the RT circuitry 5110, the pipeline may operate in a synchronous manner. However, when ray messages are being generated faster than they can be processed by the RT circuitry 5110, the memory-backed stack 5330 fills up and messages spill to the memory subsystem 5390, resulting in asynchronous operation.
[0415] In one embodiment, when memory-backed stack 5330 reaches a high threshold (e.g., a specified number of queued ray messages), control / feedback circuitry 5331 may send a control / feedback signal to dispatcher 5305. In this implementation, dispatch control circuitry 5333 interprets the signal and causes dispatcher 5305 to reduce the load on execution unit 4001 (e.g., reduce the frequency at which new primary ray shaders are dispatched), thereby indirectly reducing the load on memory-backed stack 5330. One embodiment of dispatch control circuitry 5333 detects the high-threshold condition by sampling the size of memory-backed stack 5330 or other buffer / queue coupling the EU to RT circuitry 5110.
[0416] In one particular implementation, light messages are throttled according to the operations of Figure 55. The illustrated method may be implemented on the architectures described herein, but is not limited to any particular processor or system architecture.
[0417] In 5501, the live stack threshold is set to a specific configurable value N stack (e.g., 2K). stack When a primary shader stack is scheduled, a FIFO buffer / queue for storing ray messages between the EU (which executes the shaders) and the ray tracing circuitry is sampled (e.g., to determine the number of entries currently in use) at 5503. In one embodiment, the FIFO buffer / queue includes a ray message FIFO 5322, although the underlying principles of the present invention are not limited to this particular implementation.
[0418] At 5504, based on the current state of the FIFO buffer / queue (e.g., number of consumed entries), the number of stacks is adjusted according to the following: N stack =N stack -α*(FIFO.size-Size Threshold) In 5504, N stack Minimum and maximum values (MinStacks and MaxStacks, respectively, or MinDSSStacks and MaxDSSStacks in a dual sub-slice (DSS) implementation described below) are set for the FIFO. The process then returns to 5502 in a continuous loop, sampling the FIFO and adjusting the number of live stacks accordingly. As a result, the EU output is throttled by detecting the maximum number of entries in the FIFO, allowing the ray tracing hardware time to catch up. Once the ray tracing hardware has caught up, as determined by reaching a low threshold, the number of stacks may be set to the maximum value.
[0419] In the above operation, the value of α can be configured to a value ranging from 0 to 1 in increments of 0.25 by setting control bits to enable / disable portions of the EU. A value of 0 disables auto-throttling. In one embodiment, the FIFO size threshold is set to half the size of the FIFO stored in the local register (e.g., 8 for 16 stack entries stored in the register). The values of MinStacks and MaxStacks are also configurable using control bits.
[0420] As mentioned above, if a pure last-in-first-out (LIFO) scheduling scheme is used when processing ray messages, stack throttling as described above is not required. This embodiment uses an EU message LIFO stack instead of an EU message FIFO 5322. However, this scheme does not guarantee forward progress when multiple dispatch commands are on the stack. Therefore, it may not be the optimal configuration for a particular application.
[0421] An embodiment of the present invention is configurable based on application requirements. If an application requires fairness in ray processing scheduling, stack throttling may be selected to reduce the ray dispatch frequency until the number of rays in the FIFO reaches a certain low threshold. Alternatively, if fairness is not required, LIFO message processing may be used.
[0422] In addition to dynamic stack throttling, one embodiment of the present invention implements techniques for static stack throttling. Figure 56 shows further details regarding an embodiment in which the execution resources of an execution unit 4001 generate rays distributed between dual "sub-slices" 5501-5502. In one embodiment, a sub-slice comprises a designated portion of the EU execution resources. An arbiter 5612 applies its arbitration policy to select the next ray from either the first sub-slice 5501 or the second sub-slice 5502. The slot processor submits rays in the designated slot to a ray compressor, which removes invalid ray references from the ray data provided by the sub-slices 5501-5502 and forms fixed-size chunks of ray data that fit within a cache line. In one embodiment, each sub-slice 5501-5502 is limited to a maximum of 2K stacks, although the underlying principles of the present invention are not limited to this implementation.
[0423] In one embodiment of the invention, compiler 5690 generates data-parallel program code 5691, such as single-instruction multiple-thread (SIMT) program code or single-instruction multiple data (SIMD) program code, to run on EUs 4001. For example, in one embodiment, each EU 4001 executes different instances of the same instruction in parallel on a group of functional units (FUs), with each instance of the instruction operating on a different portion of the input ray data (which may be packed into vector registers).
[0424] In one embodiment, the compiler 5690 organizes threads into thread groups that are executed by one EU, a portion of an EU, or a set of EUs. For example, each subslice 5501-5502 may represent a specified portion of an EU, multiple EUs, or an individual EU. Thread groups may be selected by the compiler 5690 based on the parallel processing capabilities of the EUs (e.g., the number of functional units capable of executing instructions in parallel) and the manner in which the EU execution resources are subdivided into subslices. The compiler 5690 may generate kernels that include a set of thread groups for performing specified functions, such as generating rays, handling nearest ray hits, handling ray misses, etc. For example, the shaders described herein may each be an instance of a particular kernel.
[0425] In one implementation, each EU is assigned a local data store accessible only to that functional unit (FU). A global data store accessible to all or a portion (e.g., sub-slice) of the EU may also be provided to allow the EUs to exchange data. The global and / or local data stores may be implemented in dedicated on-chip memory and / or via designated memory areas in system memory. In one implementation, the various stacks described herein, including the BVH node stack and ray stack, are stored in the global and / or local memory stores.
[0426] As described above, each subslice 5501-5502 may dynamically allocate up to N stacks (e.g., 2K). In one embodiment, the compiler 5690 can limit stack storage to less than this maximum by programming a specified value in a memory mapped IO (MMIO) register before submitting the kernel for execution. The compiler 5690 evaluates the code to ensure that the programmed maximum value is selected based on the stack sizes of all threads in the thread group (to avoid hardware hangs). For example, assuming SIMD16 threads and a thread group containing 16 threads (e.g., NUM_THREADS_IN_THREADGROUP=16), the compiler 5690 may set the stack value to at least 16 x 16 = 256 stacks.
[0427] Because this is a statically programmed value, in one embodiment, the entire dual subslice (DSS) pipeline is idled before changing the value, i.e., no threads are running and all data in the DSS is pushed to global memory. In one embodiment, compiler 5690 accomplishes this by performing a pipe-control flush before changing the value.
[0428] [example] Below are exemplary implementations of different embodiments of the present invention.
[0429] Example 1. An apparatus including an execution circuit including a plurality of functional units that execute a plurality of ray shaders to generate a plurality of primary rays and a corresponding plurality of ray messages; a first-in, first-out (FIFO) buffer that queues the ray messages generated by the EU; a cache that stores one or more of the plurality of primary rays; a memory-backed stack that stores a first subset of the plurality of ray messages in a corresponding plurality of entries; a memory-backed stack management circuit that stores a second subset of the plurality of ray messages in the memory-backed stack or temporarily stores one or more of the second subset of the plurality of ray messages in a memory subsystem based at least in part on a number of entries currently occupied by the ray messages in the memory-backed stack; and a ray traversal circuit that reads a next ray message from the memory-backed stack, obtains a next primary ray identified by the ray message from the cache or the memory subsystem, and performs a traversal operation on the next primary ray.
[0430] Example 2. The apparatus of Example 1, further comprising a light message first-in, first-out (FIFO) buffer for temporarily queuing each of the plurality of light messages prior to storage in the memory-backed stack and / or memory subsystem.
[0431] Example 3. The apparatus of Example 2, further including a dispatcher that dispatches the plurality of ray shaders to the execution circuitry, the dispatcher including a throttling circuit that throttles dispatching of the plurality of ray shaders based at least in part on the number of entries currently occupied by ray messages in the memory-backed stack and / or the occupancy of the ray messages in the ray message FIFO buffer.
[0432] Example 4. The apparatus of Example 2, wherein the throttling circuit adjusts one or more stack thresholds based at least in part on the number of entries currently occupied by light ray messages in the memory-backed stack and / or the occupancy rate of light ray messages in the light ray message FIFO buffer.
[0433] Example 5. The apparatus of example 4, wherein the stack threshold includes a first maximum stack value indicating a maximum number of live stacks accessible to the functional unit for executing multiple ray shaders.
[0434] Example 6. The apparatus of example 5, wherein the stack threshold further comprises a first minimum stack value indicating a minimum number of live stacks accessible to the functional unit for executing multiple ray shaders.
[0435] Example 7. The apparatus of example 6, wherein the dispatcher dispatches the plurality of ray shaders to the execution circuitry based on a minimum stack value and / or a maximum stack value.
[0436] Example 8. The apparatus of Example 7, wherein the execution circuitry is subdivided into two or more sub-slices, a first sub-slice including a first subset of the functional units being associated with a first minimum and / or maximum stack value, and a second sub-slice including a second subset of the functional units being associated with a second minimum and / or maximum stack value.
[0437] Example 9. The apparatus of Example 1, further comprising a compressor coupled between the execution circuitry and the memory-backed stack, the compressor removing empty and / or invalid slots associated with single instruction multiple data (SIMD) lanes.
[0438] Example 10. The apparatus of example 9, wherein the compressor generates fixed-size chunks of ray data that fit within cache lanes of the cache.
[0439] Example 11. The apparatus of Example 1, wherein the memory-backed stack management circuitry further includes a memory back-end fetch...
Claims
1. an execution circuit (EU) including a plurality of functional units for executing a plurality of ray shaders to generate a plurality of primary rays and a corresponding plurality of ray messages; a first-in, first-out (FIFO) buffer for queuing the light messages generated by the EU; a cache for storing one or more of the plurality of primary rays; a memory-backed stack for storing a first subset of the plurality of light ray messages in a corresponding plurality of entries; a memory-backed stack management circuit that stores a second subset of the plurality of light ray messages in the memory-backed stack or temporarily stores one or more of the second subset of the plurality of light ray messages in a memory subsystem based at least in part on a number of entries currently occupied by light ray messages in the memory-backed stack; a ray traversal circuit that reads a next ray message from the memory-backed stack, obtains a next primary ray identified by the ray message from the cache or memory subsystem, and performs a traversal operation on the next primary ray; An apparatus comprising:
2. 2. The apparatus of claim 1, further comprising a light ray message first-in, first-out (FIFO) buffer for temporarily queuing each of the plurality of light ray messages prior to storage in the memory-backed stack and / or the memory subsystem.
3. 3. The apparatus of claim 2, further comprising: a dispatcher that dispatches the plurality of ray shaders to the execution circuitry, the dispatcher comprising a throttling circuit that throttles dispatching of the plurality of ray shaders based at least in part on a number of entries currently occupied by ray messages in the memory-backed stack and / or an occupancy rate of ray messages in the ray message FIFO buffer.
4. 4. The apparatus of claim 3, wherein the throttling circuitry adjusts one or more stack thresholds based at least in part on a number of entries currently occupied by light ray messages in the memory-backed stack and / or an occupancy rate of light ray messages in the light message FIFO buffer.
5. The apparatus of claim 4 , wherein the stack thresholds include a first maximum stack value indicating a maximum number of live stacks accessible to the functional unit for executing multiple ray shaders.
6. The apparatus of claim 5 , wherein the stack threshold further comprises a first minimum stack value indicating a minimum number of live stacks accessible to the functional unit for executing multiple ray shaders.
7. The apparatus of claim 6 , wherein the dispatcher dispatches the plurality of ray shaders to the execution circuitry based on the minimum stack value and / or the maximum stack value.
8. 8. The apparatus of claim 7, wherein the execution circuitry is subdivided into two or more sub-slices, a first sub-slice including a first subset of the functional units being associated with the first minimum and / or maximum stack value, and a second sub-slice including a second subset of the functional units being associated with a second minimum and / or maximum stack value.
9. 9. The apparatus of claim 1, further comprising a compressor coupled between the execution circuitry and the memory-backed stack, the compressor removing empty and / or invalid slots associated with single instruction multiple data (SIMD) lanes.
10. 10. The apparatus of claim 9, wherein the compressor generates fixed-size chunks of ray data that fit within a cache lane of the cache.
11. 11. The apparatus of claim 1, wherein the memory-backed stack management circuitry further comprises a memory back-end fetch circuitry that fetches from the memory subsystem one or more of the second subset of the plurality of light ray messages to be pushed onto the memory-backed stack.
12. generating a plurality of primary rays and a corresponding plurality of ray messages by a plurality of ray shaders; queuing the light messages in a first-in, first-out (FIFO) buffer; storing one or more of the plurality of primary rays in a cache; storing a first subset of the plurality of light ray messages in a corresponding plurality of entries of a memory-backed stack; storing a second subset of the plurality of light ray messages in the memory-backed stack or temporarily storing one or more of the second subset of the plurality of light ray messages in a memory subsystem based at least in part on a number of entries currently occupied by light ray messages in the memory-backed stack; reading a next light ray message from the memory-backed stack; obtaining from the cache or memory subsystem a next primary ray identified by the ray message; performing a traversal operation on the next primary ray; The method includes:
13. 13. The method of claim 12, further comprising temporarily queuing each of the plurality of light ray messages in a light ray message first-in-first-out (FIFO) buffer prior to storage in the memory-backed stack and / or the memory subsystem.
14. dispatching the plurality of ray shaders to an execution circuit; throttling dispatches of the plurality of ray shaders based at least in part on a number of entries currently occupied by ray messages in the memory-backed stack and / or an occupancy rate of ray messages in the ray message FIFO buffer; The method of claim 13 further comprising:
15. 14. The method of claim 13, wherein one or more stack thresholds are adjusted based at least in part on a number of entries currently occupied by light ray messages in the memory-backed stack and / or an occupancy rate of light ray messages in the light ray message FIFO buffer.
16. The method of claim 15 , wherein the stack threshold comprises a first maximum stack value indicating a maximum number of live stacks accessible to a functional unit for executing multiple ray shaders.
17. The method of claim 16 , wherein the stack threshold further comprises a first minimum stack value indicating a minimum number of live stacks accessible to the functional unit for executing multiple ray shaders.
18. The method of claim 17 , further comprising dispatching the plurality of ray shaders to an execution circuit based on the minimum stack value and / or the maximum stack value.
19. 20. The method of claim 18, further comprising subdividing the execution circuitry into two or more sub-slices, wherein a first sub-slice including a first subset of the functional units is associated with the first minimum and / or maximum stack value and a second sub-slice including a second subset of the functional units is associated with a second minimum and / or maximum stack value.
20. 20. The method of claim 12, further comprising removing empty and / or invalid slots associated with single instruction multiple data (SIMD) lanes.
21. 21. The method of claim 20, further comprising creating fixed-size chunks of ray data that fit within cache lanes of the cache.
22. 22. The method of claim 12, further comprising the step of fetching from the memory subsystem one or more of the second subset of the plurality of light ray messages pushed onto the memory-backed stack.
23. When executed by a machine, the program causes the machine to: generating a plurality of primary rays and a corresponding plurality of ray messages using a plurality of ray shaders; queuing said light message in a first-in, first-out (FIFO) buffer; caching one or more of the plurality of primary rays; storing a first subset of the plurality of light ray messages in a corresponding plurality of entries of a memory-backed stack; storing a second subset of the plurality of light ray messages in the memory-backed stack or temporarily storing one or more of the second subset of the plurality of light ray messages in a memory subsystem based at least in part on a number of entries currently occupied by light ray messages in the memory-backed stack; reading a next light ray message from the memory-backed stack; retrieving from said cache or memory subsystem a next primary ray identified by said ray message; performing a traversal operation on the next primary ray; A program that executes the following.
24. 24. The program of claim 23, further causing the machine to perform an operation of temporarily queuing each of the plurality of light ray messages in a light ray message first-in, first-out (FIFO) buffer prior to storage in the memory-backed stack and / or the memory subsystem.
25. For said machine, dispatching the plurality of ray shaders to an execution circuit; throttling dispatches of the plurality of ray shaders based at least in part on a number of entries currently occupied by ray messages in the memory-backed stack and / or an occupancy rate of ray messages in the ray message FIFO buffer. The program according to claim 24, further comprising:
26. A machine-readable storage medium storing the program according to any one of claims 23 to 25.
Citation Information
Patent Citations
Parallelized cross-testing and shading architecture for ray-traced rendering
JP2011515766A
Method and apparatus for graphic processing using parallel pipeline
JP2014038623A
Graphics processing circuit having second vertex shader configured to reuse output of first vertex shader and / or process repacked vertex thread group and related graphics processing method thereof
US20160042560A1
Systems and methods for distributed scalable ray processing
US20160260193A1
Thread scheduling over compute blocks for power optimization
US20180286005A1