The present disclosure generally relates to the field of computing. More particularly, an embodiment of the invention generally relates to techniques for interfacing efficiently and safely with graphics processing units (GPUs).
When designing software, a software developer may utilize a graphics processing unit (GPU) to display a visual output. In doing so, the developer may make incremental state changes in the GPU which may result in errors in the visual output, e.g., because the overall state of the GPU may be incoherent. These types of errors may be even more likely to occur in multithreaded environments where more than one thread of execution may call upon the graphics processing unit, for example, by requesting GPU state changes that are incremental or piecemeal. Moreover, if multiple threads were to update only a portion of the GPU state, race condition bugs may be introduced into the software and errors may be seen in the resulting display due to a mismatch of GPU state data.
The detailed description is provided with reference to the accompanying figures. In the figures, the left-most digit(s) of a reference number identifies the figure in which the reference number first appears. The use of the same reference numbers in different figures indicates similar or identical items.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of various embodiments. However, various embodiments of the invention may be practiced without the specific details. In other instances, well-known methods, procedures, components, and circuits have not been described in detail so as not to obscure the particular embodiments of the invention. Further, various aspects of embodiments of the invention may be performed using various means, such as integrated semiconductor circuits (“hardware”), computer-readable instructions organized into one or more programs (“software”), or some combination of hardware and software. For the purposes of this disclosure reference to “logic” shall mean either hardware, software (including for example micro-code that controls the operations of a processor), or some combination thereof.
Some of the embodiments discussed herein may allow a user (also referred to herein interchangeably as a “software developer” and/or “developer”) to efficiently and/or safely (e.g., without introducing errors such as inconsistent or invalid state) interface with graphics processing units. For example, a GPU may interface with multithreaded runtime executive programs where the executive programs send commands to update the state of the GPU from more than one thread. In one embodiment, the entire GPU state may be updated with each command, e.g., to provide coherency between various requested state changes (for example, originating from different threads).
Moreover, in some embodiments, input to the GPU may be type-checked and/or cross validated at compile time. For example, the parameterized mappings discussed further herein may be of a specific data type thereby resulting in compile-time type checking and more efficient processing of data. In some embodiments, runtime parameters and compositions may be range checked at submission time. In various embodiments, the engine provider (also referred to herein as a “software developer,” “developer,” and/or “user”) may specify mappings in terms of application-space data structures. For example, type-checking, cross validating, range checking, and making the GPU interface thread-safe may reduce possible graphics bugs introduced by a user. This may also make development easier, in part, because all the state is visible at one point instead of being scattered in program flow-control (as in DirectX® or OpenGL® for example).
Additionally, some of the embodiments discussed herein may allow for efficient submission of graphics objects that have a complex structure because these structures are interpreted and optimized at compile-time. Moreover, further optimizations may be made in a run-time executive, e.g., when a mapping is parameterized with another mapping for example.
In an embodiment, hardware state mappings 106 may describe every hardware (software in the case where the mappings are targeting DirectX®, OpenGL®, or some other software-based graphics processor interface) state that may be set, along with the corresponding data type. In some embodiments, the hardware state mappings 106 may describe every software state that may be set, along with the corresponding data type. For example, the hardware state mappings may map state data to a hardware implemented processor based GPU or to a software interface to a GPU (such as DirectX® or OpenGL®). Additionally, the hardware state mappings may include the low-level code to execute to set the state (either GPU command streams or DirectX/OpenGL function calls). Additionally, the encoding of the execution of hardware state mappings may be platform dependent in some embodiments.
In some embodiments, coverage state mappings 104 may aggregate hardware state mappings 106 to provide a user's view of the hardware interface. Additionally, an aggregate that includes the entire GPU state is called a GPU State Mapping 108, according to an embodiment. For example, coverage state mappings 104 may express constraints between the hardware states they aggregate. Additionally, coverage mappings 104 may be used to simulate unimplemented GPU features or to mask hardware bugs at a driver level. Moreover, submission of a GPU State Mapping may guarantee that the GPU will be set to a consistent state.
User state mappings 102 may allow a user to use data structures 110 as inputs to a GPU state mapping 108 (or to aggregate user mappings that eventually map onto a GPU state mapping), according to an embodiment. For example, this may provide compile-time guarantees that the data structures provide the data elements with the correct types. This may also allow the user to expose a “virtual GPU” in terms of his application data. For example, when the user wants to set the GPU state (e.g., to perform drawing operations for instance), he may submit a state mapping that implements all of the GPU State Mapping, for example, by submitting some aggregate of user mappings and their parameters. The runtime executive may execute the compiled mapping, e.g., looking up and remapping parameters from the data structures as specified in the parameters and setting the hardware state appropriately. In an embodiment, this process may be more efficient, in part, because all type-checking is done at compile-time.
In some embodiments, one or more software applications may be used to provide (e.g., through emulation) a virtual GPU. As GPUs evolve from hardware based devices to software based applications in accordance with some embodiments, e.g., making state changes increasingly less expensive to perform while remaining as expensive to specify, the interaction between the software engine (user application) and the GPU interface may be made more efficient, in accordance with some embodiments discussed herein.
Referring to
More particularly, the computing system 500 may include one or more central processing unit(s) (CPUs) 502 or processors that communicate via an interconnection network (or bus) 504. Hence, various operations discussed herein may be performed by a CPU in some embodiments. Additionally, as discussed herein, the use of GPU may be interchangeable with a CPU in some embodiments. For example, the processors 502 may include logic to support graphics functions. Moreover, the processors 502 may include a general purpose processor, a network processor (that processes data communicated over a computer network 503), or other types of a processor (including a reduced instruction set computer (RISC) processor or a complex instruction set computer (CISC)). Moreover, the processors 502 may have a single or multiple core design. The processors 502 with a multiple core design may integrate different types of processor cores on the same integrated circuit (IC) die. Also, the processors 502 with a multiple core design may be implemented as symmetrical or asymmetrical multiprocessors. Moreover, the operations discussed with reference to
A chipset 506 may also communicate with the interconnection network 504. The chipset 506 may include a graphics and memory control hub (GMCH) 508. The GMCH 508 may include a memory controller 510 that communicates with a memory 512. The memory 512 may store data, including sequences of instructions that are executed by the CPU 502, or any other device included in the computing system 500 such as a GPU. In an embodiment, the memory 512 may be the same or similar to the main memory 412 of
The GMCH 508 may also include a graphics interface 514 that communicates with a display 516. In one embodiment of the invention, the graphics interface 514 may communicate with the display 516 via an accelerated graphics port (AGP) or a GPU. For example, one or more GPUs may be incorporated into the display 516 and/or graphics interface 514, or elsewhere in system 500 (e.g., within a device or card coupled to the bus 522 such as a graphics card, in the GMCH 508 or ICH 520, etc.). Alternatively, one or more of processors 502 may be used as a GPU. In an embodiment of the invention, the display 516 may be a flat panel display that communicates with the graphics interface 514 through, for example, a signal converter that translates a digital representation of an image stored in a storage device such as video memory or system memory into display signals that are interpreted and displayed by the display 516. The display signals produced by the interface 514 may pass through various control devices before being interpreted by and subsequently displayed on the display 516.
A hub interface 518 may allow the GMCH 508 and an input/output control hub (ICH) 520 to communicate. The ICH 520 may provide an interface to I/O devices that communicate with the computing system 500. The ICH 520 may communicate with a bus 522 through a peripheral bridge (or controller) 524, such as a peripheral component interconnect (PCI) bridge, a universal serial bus (USB) controller, or other types of peripheral bridges or controllers. The bridge 524 may provide a data path between the CPU 502 and peripheral devices. Other types of topologies may be utilized. Also, multiple buses may communicate with the ICH 520, e.g., through multiple bridges or controllers. Moreover, other peripherals in communication with the ICH 520 may include, in various embodiments of the invention, integrated drive electronics (IDE) or small computer system interface (SCSI) hard drive(s), USB port(s), a keyboard, a mouse, parallel port(s), serial port(s), floppy disk drive(s), digital output support (e.g., digital video interface (DVI)), or other devices.
The bus 522 may communicate with an audio device 526, one or more disk drive(s) 528, and a network interface device 530, which may be in communication with the computer network 503. In an embodiment, the device 530 may be a NIC capable of wireless communication. Other devices may communicate via the bus 522. Also, various components (such as the network interface device 530) may communicate with the GMCH 508 in some embodiments of the invention. In addition, the processor 502, the GMCH 508, and/or the graphics interface 514 may be combined to form a single chip.
Furthermore, the computing system 500 may include volatile and/or nonvolatile memory (or storage). For example, nonvolatile memory may include one or more of the following: read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), a disk drive (e.g., 528), a floppy disk, a compact disk ROM (CD-ROM), a digital versatile disk (DVD), flash memory, a magneto-optical disk, or other types of nonvolatile machine-readable media that are capable of storing electronic data (e.g., including instructions). In an embodiment, components of the system 500 may be arranged in a point-to-point (PtP) configuration such as discussed with reference to
More specifically,
As illustrated in
The processors 602 and 604 may be any suitable processor such as those discussed with reference to the processors 602 of
At least one embodiment of the invention may be provided by utilizing the processors 602 and 604. For example, the processors 602 and/or 604 may perform one or more of the operations of
The chipset 620 may be coupled to a bus 640 using a PtP interface circuit 641. The bus 640 may have one or more devices coupled to it, such as a bus bridge 642 and I/O devices 643. Via a bus 644, the bus bridge 643 may be coupled to other devices such as a keyboard/mouse 645, the network interface device 630 discussed with reference to
In various embodiments of the invention, the operations discussed herein, e.g., with reference to
Reference in the specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least an implementation. The appearances of the phrase “in one embodiment” in various places in the specification may or may not be all referring to the same embodiment.
Also, in the description and claims, the terms “coupled” and “connected,” along with their derivatives, may be used. In some embodiments of the invention, “connected” may be used to indicate that two or more elements are in direct physical or electrical contact with each other. “Coupled” may mean that two or more elements are in direct physical or electrical contact. However, “coupled” may also mean that two or more elements may not be in direct contact with each other, but may still cooperate or interact with each other.
Additionally, such computer-readable media may be downloaded as a computer program product, wherein the program may be transferred from a remote computer (e.g., a server) to a requesting computer (e.g., a client) by way of data signals, e.g., through a carrier wave or other propagation medium, via a communication link (e.g., a bus, a modem, or a network connection).
Thus, although embodiments of the invention have been described in language specific to structural features and/or methodological acts, it is to be understood that claimed subject matter may not be limited to the specific features or acts described. Rather, the specific features and acts are disclosed as sample forms of implementing the claimed subject matter.