IP Library › Granted Patent US 8,997,114
Granted Patent B2
US 8,997,114 · App. 14/173,071 · Granted Mar 31, 2015

Language level support for shared virtual memory

Inventors: Xiaocheng Zhou (Beijing, CN); Shoumeng Yan (Beijing, CN); Ying Gao (Beijing, CN); Hu Chen (Beijing, CN); Peinan Zhang (Beijing, CN); Mohan Rajagopalan (Mountain View, CA); Avi Mendelson (Haifa, IL); Bratin Saha (Santa Clara, CA)
Assignee: Intel Corporation
G06T1/60G06F9/544G06F12/1072G06F12/1081G06F12/109G06F2212/656G06F2212/657
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,997,114
App. No.
14/173,071
Granted
Mar 31, 2015
Kind
B2
Abstract

Embodiments of the invention provide language support for CPU-GPU platforms. In one embodiment, code can be flexibly executed on both the CPU and GPU. CPU code can offload a kernel to the GPU. That kernel may in turn call preexisting libraries on the CPU, or make other calls into CPU functions. This allows an application to be built without requiring the entire call chain to be recompiled. Additionally, in one embodiment data may be shared seamlessly between CPU and GPU. This includes sharing objects that may have virtual functions. Embodiments thus ensure the right virtual function gets invoked on the CPU or the GPU if a virtual function is called by either the CPU or GPU.

Claims (49)

1. A method providing:

shared memory semantics between a central processing unit (CPU) and a graphics processing unit (GPU);

sharing only a portion of virtual address space between the CPU and the GPU;

if a GPU function is being called on the GPU, performing the call as is;

if a GPU function is being called on the CPU, performing a remote call to the GPU;

if a CPU function is being called one the CPU, performing the call as is; and

if a CPU function is being called on the GPU, performing a remote call to the CPU.

2. The method claimed in claim 1 , wherein code can be flexibly executed on both the CPU and GPU.

3. The method claimed in claim 2 , further comprising:

offloading a kernel to the GPU using CPU code; and

using the kernel to call preexisting libraries on the CPU, or make other calls into CPU functions.

4. The method claimed in claim 1 , including sharing objects having virtual functions such that a correct virtual function is invoked on the CPU or the GPU in response to a virtual function being called on a shared object by either the CPU or GPU.

5. The method claimed in claim 1 , further comprising:

identifying data that is shared between the CPU and GPU with a shared keyword;

allocating global shared variables in a shared memory space; and

providing a function to allocate data in the shared memory.

6. The method claimed in claim 1 , further comprising using an attribute to indicate functions that should be executed on the CPU or GPU.

7. The method claimed in claim 1 , further comprising:

adding a call to a runtime application program interface (API) that registers function addresses dynamically;

creating an initialization function for each file that invokes different registration calls;

when a binary gets loaded, calling the initialization function in each file; and

populating dynamically a jump table in the shared address space to contain function addresses.

8. The method claimed in claim 1 , further comprising:

looking up a jump table with a function name and obtaining a function address associated with the function name;

packing in arguments into a buffer in a shared memory space; and

calling a dispatch routine on the GPU side passing in the function address and the argument buffer address.

9. The method claimed in claim 1 , further comprising:

when a function pointer with GPU annotation is assigned, looking up a jump table with a function name and assigning the function pointer with an obtained function address.

10. The method claimed in claim 9 , wherein if a GPU function pointer is being called within a GPU function, compiler generated code will perform the call as is.

11. The method claimed in claim 10 , wherein if a GPU function pointer is being called within a CPU function, the compiler generated code will do a remote call to GPU side.

12. A non-transitory computer readable medium storing instructions that, if executed, enable a processor-based system to:

share memory semantics between a CPU and a GPU;

add a call to a runtime API that registers function addresses dynamically;

create an initialization function for each file that invokes different registration calls;

when a binary gets loaded, call the initialization function in each file; and

populate dynamically a jump table in the shared address space to contain function addresses.

13. The computer readable medium claimed in claim 12 , further storing instructions to:

execute code on both the CPU and GPU.

14. The non-transitory computer readable medium claimed in claim 12 , further storing instructions to:

offload a kernel to the GPU using CPU code; and

use the kernel to call preexisting libraries on the CPU, or make other calls into CPU functions.

15. The non-transitory computer readable medium claimed in claim 12 , further storing instructions to:

share objects that have virtual functions such that the correct virtual function is invoked on the CPU or the GPU in response to a virtual function being called on a shared object by either the CPU or GPU.

16. The non-transitory computer readable medium claimed in claim 12 , further storing instructions to:

identify data that is shared between the CPU and GPU with a shared keyword;

allocate global shared variables in a shared memory space; and

provide a function to allocate data in the shared memory.

17. The non-transitory computer readable medium claimed in claim 12 , further storing instructions to:

use an attribute to indicate functions that should be executed on the CPU or GPU.

Continuity (4)
Continuation 13792427 · Mar 11, 2013
Continuation 12317854 · Dec 30, 2008
Provisional Application 61199095 · Nov 13, 2008
Related Publication 20140306972A1 · Oct 16, 2014