# US 2012/0075316 A1 · Method and apparatus for compiling and executing an application using virtualization in a heterogeneous system

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2012/0075316 A1
- Document ID: US20120075316A1
- Status: Published application
- Kind: A1
- Application number: 13/245,255
- Filed: 2011-09-26
- Published: 2012-03-29
- Earliest claimed: 2010-09-27
- Assignees: Samsung Electronics Co., Ltd.
- Inventors: Kyoung Hoon KIM; In Choon Yeo; Seung Wook Lee; Joong Baik Kim; Il Ho Lee; Jeong Ig Song
- Web page: https://patentgrep.com/patent/US20120075316A1

## CPC

- G06T 1/20: Processor architectures; Processor configuration, e.g. pipelining
- G06F 8/47: {Retargetable compilers}
- G06F 8/48: {Incremental compilation (software reuse G06F8/36)}
- G06F 9/30174: {for non-native instruction set, e.g. Javabyte, legacy code}
- G06F 9/45516: {Runtime code conversion or optimisation}
- G06T 15/005: {General purpose rendering architectures}
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and apparatus for compiling and executing an application including Central Processing Unit (CPU) source code and Graphic Processing Unit (GPU) source code. The apparatus includes a hardware device including a CPU and a GPU; a compiler that compiles the GPU source code into a GPU virtual instruction; and a hybrid virtualization block that executes an execution file by translating the GPU virtual instruction into GPU machine code.

## Claims

### Claim 1

A method for compiling and executing an application in a system including a Central Processing Unit (CPU) and a Graphic Processing Unit (GPU), the method comprising:
receiving a request for compiling the application, the application including CPU source code and GPU source code;
generating an execution file in response to the request for compiling by compiling the GPU source code into a GPU virtual instruction;
receiving a request for executing the execution file; and
executing the execution file by translating the GPU virtual instruction into GPU machine code, in response to the request for executing the execution file.

### Claim 2 (depends on 1)

The method of claim 1, wherein generating the execution file further comprises:
compiling the CPU source code into CPU machine code; and
creating the execution file including the CPU machine code and the GPU virtual instruction.

### Claim 3 (depends on 2)

The method of claim 2, wherein the execution file includes a virtual section including the CPU machine code and the GPU virtual instruction.

### Claim 4 (depends on 3)

The method of claim 3, wherein the virtual section further includes a virtual section header having a watermark for identifying the virtual section, the CPU machine code, and the GPU virtual instruction.

### Claim 5 (depends on 3)

The method of claim 3, wherein executing the execution file comprises:
detecting, by an Operating System (OS) of the system, an exception in the execution file;
handing over system control to a hybrid virtualization block;
identifying, by the hybrid virtualization block, the virtual section;
translating the GPU virtual instruction into the GPU machine code;
handing over the system control back to the OS; and
executing, by the OS, the GPU machine code using the GPU.

### Claim 6 (depends on 5)

The method of claim 5, wherein the hybrid virtualization block is located on a virtualization layer between an application layer and a hardware layer.

### Claim 7 (depends on 3)

The method of claim 3, wherein executing the execution file comprises:
detecting, by an Operating System (OS) of the system, an exception in the execution file;
identifying the virtual section;
translating the GPU virtual instruction into the GPU machine code; and
executing the GPU machine code using the GPU.

### Claim 8 (depends on 1)

The method of claim 1, further comprising:
placing the GPU machine code in the execution file;
receiving to a command for executing the GPU virtual instruction; and
executing the GPU machine code of the execution file, in response to the command.

### Claim 9 (depends on 1)

The method of claim 1, wherein the GPU virtual instruction and the GPU machine code are formatted at machine code level.

### Claim 10

An apparatus for compiling and executing an application including Central Processing Unit (CPU) source code and Graphic Processing Unit (GPU) source code, comprising:
a hardware device including a CPU and a GPU;
a compiler that compiles the GPU source code into a GPU virtual instruction; and
a hybrid virtualization block that executes an execution file by translating the GPU virtual instruction into GPU machine code.

### Claim 11 (depends on 10)

The apparatus of claim 10, wherein the hybrid virtualization block is interposed between an application layer and a hardware layer.

### Claim 12 (depends on 10)

The apparatus of claim 10, wherein the compiler compiles the CPU source code into CPU machine code, compiles the GPU source code into the GPU virtual instruction, and creates the execution file including the CPU machine code and the GPU virtual instruction.

### Claim 13 (depends on 12)

The apparatus of claim 12, wherein the execution file comprises a virtual section including the CPU machine code and the GPU virtual instruction.

### Claim 14 (depends on 13)

The apparatus of claim 13, wherein the virtual section comprises a virtual section header including a watermark for identifying the virtual section, the CPU machine code, and the GPU virtual instruction.

### Claim 15 (depends on 13)

The apparatus of claim 13, wherein the hardware device includes an Operating System (OS) that runs the execution file, and hands over system control to the hybrid virtualization block.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the hybrid virtualization block translates the GPU virtual instruction into the GPU machine code and hands over the system control to the OS.

### Claim 17 (depends on 15)

The apparatus of claim 15, wherein the OS places the GPU machine code in the execution file and executes the GPU machine code of the execution file in response to a command for executing the GPU virtual instruction.

### Claim 18 (depends on 10)

The apparatus of claim 10, wherein the GPU virtual instruction and the GPU machine code are formatted at machine code level.

### Claim 19

An apparatus for compiling and executing an application including Central Processing Unit (CPU) source code and Graphic Processing Unit (GPU) source code, comprising:
a hardware device including a CPU and a GPU;
a compiler that compiles the GPU source code into a GPU virtual instruction; and
an Operating System (OS) for executing an execution file by translating the GPU virtual instruction into GPU machine code.

### Claim 20 (depends on 19)

The apparatus of claim 19, wherein the compiler compiles the CPU source code into CPU machine code, compiles the GPU source code into the GPU virtual instruction, and creates the execution file including the CPU machine code and the GPU virtual instruction.

### Claim 21 (depends on 20)

The apparatus of claim 20, wherein the execution file comprises a virtual section including the CPU machine code and the GPU virtual instruction.

### Claim 22 (depends on 21)

The apparatus of claim 21, wherein the virtual section comprises a virtual section header including a watermark for identifying the virtual section, the CPU machine code, and the GPU virtual instruction.

### Claim 23 (depends on 22)

The apparatus of claim 22, wherein the OS translates the GPU virtual instruction into the GPU machine code.

### Claim 24 (depends on 23)

The apparatus of claim 23, wherein the OS places the GPU machine code in the execution file and executes the GPU machine code of the execution file in response to a command for executing the GPU virtual instruction.

### Claim 25 (depends on 19)

The apparatus of claim 19, wherein the GPU virtual instruction and the GPU machine code are formatted at machine code level.
