An Apple patent (number 20130021353) for a “virtual GPU” [graphics processing unit] has popped up at the U.S. Patent & Trademark Office. The idea is that, if your Mac has lots of memory, you could allocate some of that memory as a virtual graphics card (VGPU) and, for instance, run games that need substantial graphics cards.
The invention would use a part of your RAM as graphics card memory. For example, if you have 1GB of DDR2 RAM, it could use 128MB of it as a virtual graphics card with the remaining 896MB will be used as a regular RAM.
Here’s Apple’s background and summary of the invention: “GPUs can be used to execute a variety of computing tasks. A GPU can calculate pixels to be displayed on a screen, for example, and may also perform other intensive operations such as animation rendering and general vector math.
“A GPU may sometimes experience ‘down time’ (stall periods) in which one or more execution units do not perform any calculations. Down time can occur when accessing memory, for example, because an execution unit is waiting for new data to arrive. Thus, at times, one or more GPU execution units may be idle.
“Further, when a first program is being executed by a GPU, a second program may have to wait. The second program may have to wait even while the first program is stalled (such as during a memory access). Although it would be advantageous for the second program to use idle GPU execution units while the first program is stalled, the overhead cost of switching to the second program may be prohibitively expensive. That is, setting up the GPU to execute the second program while the first program is stalled may take so much time and effort (i.e., power consumption) that it is not worth the trouble.
“While the first program stalls, GPU execution units may thus remain idle. Accordingly, GPU execution may be inefficient, especially in environments where multiple computing tasks are being performed.
“This specification describes structures and techniques that allow a GPU to execute instructions more efficiently and with less down time, especially when handling multiple computing tasks (or commands). These advantages are provided in one embodiment by implementing multiple virtual GPUs in a single GPU structure. Virtual GPUs may share the same GPU hardware (e.g., execution units) while the results of computation are stored separately for each virtual GPU.
“Virtual GPUs may provide an advantage over context switching, which may have high costs. Context switching from a first program to a second program, for example, may involve clearing all results and all state information from the GPU before the second program executes. Context switching may therefore include copying all register values, program counters, and other values (such as working data from memory) to external storage. These copying operations take time and consume power (which may cause a particularly negative impact on battery powered mobile devices).
“The cost of GPU context switching can vary depending on when a context switch is performed. For example, context switching between frame boundaries or polygon boundaries may be less costly. This is because less intermediate state information may need to be transferred to external storage. But while context switching only on frame or polygon boundaries can be less costly, this may result in poor granularity control. For example, if frames are being drawn at 20 frames per second, it may take up to 50 milliseconds (or even longer) for the GPU to reach a frame boundary and perform a context switch to another task.
“Virtual GPUs may allow instructions for different programs to be executed without the cost of performing a full context switch. In one embodiment, this is accomplished by duplicating some portions of GPU hardware and adding additional control structures to handle those duplicated portions. Virtual GPUs may also provide finer granularity control for execution, and make more efficient use of GPU hardware by allowing GPU instructions for different programs to be executed within smaller ‘windows’ of time.
“For example, a GPU execution unit being used by a first program may have to stall while data is retrieved from memory. During this stall period, the execution unit is idle. The stall period may be short enough that a full context switch would be cost prohibitive. However, the lower cost of switching between virtual GPUs may allow different instructions (for a different virtual GPU) to be executed instead of having the execution unit sit idle. Accordingly, there may be less down time for GPU execution units when virtual GPUs are implemented.”
The inventors are Robert A. Drebin and James Wang.

