Event memory assisted synchronization in multi-GPU graphics subsystem

Information

  • Patent Application
  • 20070091099
  • Publication Number
    20070091099
  • Date Filed
    October 17, 2006
    17 years ago
  • Date Published
    April 26, 2007
    17 years ago
Abstract
A method and system are disclosed for synchronizing graphics processing events in a multi-GPU computer system. A master GPU renders a first image into a first portion of a master buffer associated with a display interface, and then writes a first predetermined value corresponding to the first image in a first memory unit. A slave GPU renders a second image into a slave buffer, and then transfers the second image to a second portion of the master buffer, and writes a second predetermined value corresponding to the second image in the first memory unit. The first and second predetermined values represent a queuing sequence of the rendered images. The master GPU flips the first image to display only after examining the first predetermined value in the first memory unit, and flips the second image to display only after examining the second predetermined value in the first memory unit.
Description
BACKGROUND

The present invention relates generally to the synchronization of graphics processing in a computer system with multiple graphics processing units (GPUs), and, more particularly, to the timing of image rendering and flipping.


Modern computer systems often employ multiple graphics processing units (GPUs) to render images simultaneously, and these images are stored in multiple buffers. A particular GPU, often called master GPU, connects to a display driver. All the images are displayed from one or more buffers associated with the master GPU through a flip operation by a graphics driver. A flip is to turn a previously front buffer into a back one, and a previously back one into a front one. The so called ‘front buffer’ is a buffer currently supplying an image to the display driver, and the back buffer is one that is ready to receive an image either from rendering or from bit-block-transferring.


Bit-block-transfer (BLT) is to combine two image (e.g., bitmap) patterns from two buffers into one. Since only one master GPU do the flip, all other GPU are slaves. The images rendered by slave GPUs are eventually bit-block-transferred from their own buffers to the master buffers associated with the master GPU. The graphics driver also manages BLT timing and storage locations in the source as well as target buffers for the rendered and subsequently transferred images. The graphics driver can flip among any number of buffers, yet traditional double buffers remains to be the simplest for the driver to handle and hence most desirable. But in any case, the driver has to synchronize the flip, rendering and BLT, and for that, the traditional way of continuously checking the status of each and every component, i.e., GPUs, buffers, etc., is less efficient.


It is therefore desirable for a computer system to have a unified, and efficient way to synchronize these events.


SUMMARY

In view of the foregoing, this invention provides a method and system for monitoring the status of graphics processing events, such as rendering, flip, and BLT, and hence synchronizing the same.


To achieve the above objective, a method and system are disclosed for synchronizing graphics processing events in a computer system with multiple graphics processing units (GPUs). For example, a master GPU renders a first image into a first portion of a master buffer or a primary buffer associated with a display driver or display interface, and then writes a first predetermined value corresponding to the first image in a first memory unit. A slave GPU renders a second image into a slave buffer or a secondary buffer, and then transfers the second image to a second portion of the master buffer, and writes a second predetermined value corresponding to the second image in the first memory unit. The first and second predetermined value represent rendering over events of the images. The master GPU flips the first image to display after examining the first predetermined value in the first memory unit, and flips the second image to display only after examining the second predetermined value in the first memory unit.


The construction and method of operation of the invention, however, together with additional objects and advantages thereof will be best understood from the following description of specific embodiments when read in connection with the accompanying drawings.




BRIEF DESCRIPTION OF THE DRAWINGS


FIG. 1 is a block diagram of a part of a computer system with two graphics processing units (GPUs) and two event-memories according to one embodiment of the present invention.



FIG. 2 is a timing diagram of the computer system according to one embodiment of the present invention.




DESCRIPTION

The operation of a computer system with multiple GPUs and their associated buffers are described in more detail in the U.S. Patent Application Ser. No. 60/727,635, which is filed with the present application and incorporated herein in its entirety. Detailed information with regard to the operation of the GPU in the computer system is further described in U.S. patent application entitled “METHOD AND SYSTEM FOR DEFERRED COMMAND ISSUING IN A COMPUTER SYSTEM”, and U.S. patent application entitled “TRANSPARENT MULTI-BUFFERING IN MULTI-GPU GRAPHICS SUBSYSTEM”, and U.S. patent application entitled “METHOD AND SYSTEM FOR SYNCHRONIZING PARALLEL ENGINES IN A GRAPHICS PROCESSING UNIT”, all of which are commonly filed on the same day, and which are incorporated by reference in their entirety.



FIG. 1 is a block diagram of a part of a computer system according to one embodiment of the present invention. The computer system 100 has two graphics processing units (GPUs) 110 and 140. The master GPU 110 renders images to a master buffer or a primary buffer 120, which is connected with a display interface 130. Images stored, or queued in the master buffer 120 are flipped to the display interface 130 sequentially. The slave GPU 140 independently renders images to a slave buffer or secondary buffer 150. It is understood that the buffers can be buffer arrays or any other forms of memory unit arrangements. The master and slave GPUs render images alternatively, i.e., if the master GPU renders a frame[i], then the slave GPU 140 renders a frame[i+1], and next the master GPU renders a frame[i+2], and so on and so forth. To transfer images in the slave buffer 150 to the master buffer 120, Master GPU 110 or Slave GPU 140 initiates bit-block-transfers (BLT) through a bus 190 at certain time, so that all the rendered images are queued in the master buffer 120 in the same sequence as they are rendered.


According to one embodiment of the present invention, the flip operation is carried out by memory-mapped I/O, or MMIO. That is, the display device displays the image in a specified buffer immediately after CPU writes the related registers in the GPU, which are memory mapped.


To facilitate the synchronization of the events of rendering, flip and BLT by various components of the computer system, two event memories, W event memory 160 and S event memory 170, are allocated according to one embodiment of the present invention.


In one embodiment of the present invention, GPUs updates W event memory 160. Whenever finishing a rendering job, the master GPU 110 increments the value of W event memory 160. Similarly, whenever the slave GPU 140 completes a BLT, it also writes an incremental value into the W event memory 160. By checking on the value of W event memory 160 during every command cycle, the CPU 180 can determine whether or not a certain image is completely rendered and ready to be flipped. Note that the W memory has different portions for different GPUs. Following is an exemplary subroutine of pseudo codes, named “queued-flip”, for CPU 180 to check and flip the queued images in the master buffer 120.

While (queued-flip){get the first flipif (tracked W event value not back)  break;do FLIP through MMIOwrite an incremental S event value to the S event memoryRemove current flip}


Note that following a flip in the above queued-flip subroutine, the CPU 180 writes an incremental S event value to the S event memory 170, which means a queued image has been flipped and the master buffer 120 can accept a new image. So by checking on the value of the S event memory, the CPU can determine whether or not it can let GPUs render or BLT a new image into the master buffer 120 for queuing.


However, if the master-buffer 120 is so large that a new rendering is guaranteed not to overwrite an un-flipped queued image, then checking or even allocating the S event memory becomes unnecessary.



FIG. 2 is a timing diagram detailing how event-memories assist the synchronization of rendering, flip and BLT events in a duo GPU system. Refer to both FIGS. 1 and 2, and it is assumed that the master 110 and slave 140 GPUs both have N number of elements. Every time before issuing a rendering command to the master GPU 110, the CPU 180 checks S event memory 170, and a new rendering command is only issued in a time slot 240, when the value of the S event memory 170 reached i+1-N, which means N number of buffered images prior to the current one have been flipped and the buffer is ready to accept a new rendering without overwriting a previously rendered and queued image. Here “i” is an index representing a current command cycle. A frame of image is rendered in every command cycle.


Upon receiving a rendering command from the CPU 180, the master GPU 110 starts to render frame[i] in a time slot 260. When the rendering is done, the master GPU 110 writes the value i into a W event memory also in the time slot 260.


The slave GPU 140 operates differently. Its rendering is rather independent, and it can render a subsequent frame[i+1] in a time slot 270, which overlaps the time slot 260 when the master GPU 110 is rendering the frame[i]. But bit-block-transferring (BLT) the slave-GPU-rendered image, frame[i+1], to the master buffer 120 in a time slot 275 needs to make sure that the value of S event memory passes i+2-N, i.e., more than N number of frames prior to the frame[i+1] have been flipped, and the master buffer is ready to accept a new rendering. As shown in FIG. 2, the time slot 275 is after a time slot 230. In the time slot 230, the CPU 180 issues a BLT command to the slave GPU 140 after the value of S event memory passes i+2-N. Upon the completion of the BLT command, the slave GPU 140 also writes an incremental value i+1 to the W event memory in the time slot 275.


When executing the subroutine, queued-flip (i+1), in a time slot 244, the CPU 180 first checks the value of W event memory 160. If the value, i+1, is already in the W event memory 160, which means that the frame[i+1] is already queued in the master buffer 120, then it flips the frame[i+1], and writes a value i+1 to S event memory. These steps are also stated in the above queued-flip subroutine.


In essence, the CPU 180 flips a queued image in the master buffer 120 after a value corresponding to the queued image is in the W event memory 160, and writes an incremental value in S event memory at the end of the flip. Meanwhile, the GPUs render or BLT images to be queued in the master buffer 120, and writes an incremental value in the W event memory 160 upon a completion of rendering by the master GPU 110 or transferring by the slave GPU 140. In this way, the synchronization of the flip, rendering and bit-block-transfer in a computer graphics subsystem is simplified.


This invention provides many different embodiments, or examples, for implementing different features of the invention. Specific examples of components and methods are described to help clarify the disclosure. These are, of course, merely examples and are not intended to limit the disclosure from that described in the claims.

Claims
  • 1. A method for synchronizing graphics processing events in a computer system with a master and at least one slave graphics processing units (GPUs), the method comprising: rendering a first image by the master GPU to be stored in a first portion of a master buffer; rendering a second image by the slave GPU to be stored in a slave buffer; writing a first predetermined value corresponding to the first image into a first memory unit; transferring the second image to a second portion of the master buffer; writing a second predetermined value corresponding to the second image into the first memory unit upon the completion of the transfer; and issuing a first and second flip command to flip the first and second image in the master buffer to display after examining the values corresponding to the images in the first memory unit, wherein the first and second predetermined values represent a sequence of the first and second images to be queued for display.
  • 2. The method of claim 1, wherein the issuing further includes withholding from issuing the flip command if the value corresponding to the image is not in the first memory unit.
  • 3. The method of claim 1 further comprising issuing one or more rendering commands to the master and slave GPUs in a predetermined sequence.
  • 4. The method of claim 1, wherein the transferring further includes issuing a bit-block-transfer (BLT) command for transferring the second image.
  • 5. The method of claim 1, wherein the issuing further includes issuing a memory-mapped I/O (MMIO) flip command.
  • 6. The method of claim 1 further comprising: writing a predetermined value corresponding to a third portion of the master buffer from where an image is flipped into a second memory unit upon the completion of the image flipping; and examining the value in the second memory unit prior to rendering or transferring an image into the third portion of the master buffer.
  • 7. A method for synchronizing graphics processing events in a computer system with at least a first and second graphics processing units (GPUs), the method comprising: rendering a first image by the first GPU to be stored in a primary buffer; rendering a second image by the second GPU to be stored in a secondary buffer; transferring the second image to the primary buffer to be queued after the first image; writing a predetermined value corresponding to the second image into a first event memory unit upon the completion of the transfer; and issuing a flip command to flip the second image queued in the primary buffer after the first image is displayed upon confirming the predetermined value is in the first event memory unit.
  • 8. The method of claim 7 further comprising writing a predetermined value corresponding to the first image into the first event memory unit.
  • 9. The method of claim 7, wherein issuing a flip command further includes issuing a memory-mapped I/O (MMIO) flip command.
  • 10. The method of claim 7 further comprises: writing a predetermined value corresponding to a first location in the primary buffer from where an image is flipped into a second event memory unit upon the completion of the image flipping; and examining the value in the second event memory unit prior to rendering or transferring an image into the first location in the primary buffer.
  • 11. A computer system with graphics processing event synchronization, the system comprising: one or more graphics processing units; an image buffer for every GPU to store rendered images with a master buffer coupled to a display interface; one or more designated memories to record values representing graphics processing events; and at least one central processing unit (CPU) for checking values in the designated memories and issuing commands corresponding to the values.
  • 12. The system of claim 11, wherein the designated memories further include a first memory to record values representing flip events.
  • 13. The system of claim 12, wherein the designated memories further includes a second memory to record values representing image buffering events in the master buffer.
  • 14. The system of claim 11 further comprising a main memory.
  • 15. The system of claim 11 further comprising a bus for transporting images from one image buffer to another.
  • 16. The system of claim 15, wherein the bus transports image to the master buffer from other buffers.
PRIORITY DATA

This application claims the benefits of U.S. Patent Application Ser. No. 60/727,668, which was filed on Oct. 18, 2005 and entitled “Smart CPU Sync Technology for MultiGPU Solution.” This application also relates to U.S. Patent Application Ser. No. 60/727,635, which is commonly owned and filed with the present application and the content of which is incorporated by reference here in its entirety. This application also relates to U.S. patent application entitled “METHOD AND SYSTEM FOR DEFERRED COMMAND ISSUING IN A COMPUTER SYSTEM”, and U.S. patent application entitled “TRANSPARENT MULTI-BUFFERING IN MULTI-GPU GRAPHICS SUBSYSTEM”, and U.S. patent application entitled “METHOD AND SYSTEM FOR SYNCHRONIZING PARALLEL ENGINES IN A GRAPHICS PROCESSING UNIT”, all of which are commonly filed on the same day, and which are incorporated by reference in their entirety.

Provisional Applications (1)
Number Date Country
60727668 Oct 2005 US