# US 10,956,218 B2 · Enqueuing kernels from kernels on GPU/CPU

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

- Number: US 10,956,218 B2
- Document ID: US10956218B2
- Status: Granted
- Kind: B2
- Application number: 16/694,128
- Filed: 2019-11-25
- Published: 2020-05-28
- Granted: 2021-03-23
- Earliest claimed: 2013-07-19
- Assignees: Apple Inc.
- Applicants: Apple Inc.
- Inventors: Aaftab A. Munshi
- Web page: https://patentgrep.com/patent/US10956218B2

## CPC

- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 9/5044: {considering hardware capabilities}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Graphics processing units (GPUs) and other compute units are allowed to enqueue tasks for themselves by themselves, without needing a host processor to queue the work for the GPU. Built-in functions enable kernels to enqueue kernels for execution on a device. In some embodiments, ndrange kernels execute over an N-dimensional range to provide data-parallel operations. Task kernels provide task-parallel operations. In some embodiments, kernels may be defined using clang block syntax. The order of execution of commands on a compute unit may be constrained or allow execution of commands out-of-order. Compute units may control when kernels enqueued by the compute unit begins execution.

## Claims

### Claim 1

A program storage device, on which are stored instructions, comprising instructions that when executed cause one or more compute units to:
enqueue a first kernel by a first compute unit for execution on a second compute unit, wherein the first and second compute units have different capabilities;
determine, based on the execution of the first kernel, that a condition is met; and
in response to the condition being met based on the execution of the first kernel, enqueue a second kernel for execution on the second compute unit.

### Claim 2 (depends on 1)

The program storage device of claim 1, wherein the first compute unit is a central processing unit (CPU) and the second compute unit is a graphic processing unit (GPU).

### Claim 3 (depends on 1)

The program storage device of claim 1, wherein the second kernel is enqueued after execution of the first kernel is complete.

### Claim 4 (depends on 1)

The program storage device of claim 1, wherein the second kernel is enqueued during execution of the first kernel.

### Claim 5 (depends on 1)

The program storage device of claim 1, wherein the first kernel is a data-parallel kernel, and wherein the second kernel is a data-parallel kernel with a different range than the first kernel.

### Claim 6 (depends on 1)

The program storage device of claim 1, wherein the first kernel is a task-parallel kernel, and wherein the second kernel is a task-parallel kernel.

### Claim 7 (depends on 1)

The program storage device of claim 1, wherein the first kernel is a task-parallel kernel, and wherein the second kernel is a data-parallel kernel.

### Claim 8 (depends on 1)

The program storage device of claim 1, wherein the first kernel is a data-parallel kernel, and wherein the second kernel is a task-parallel kernel.

### Claim 9 (depends on 1)

The program storage device of claim 1, wherein the second compute unit enqueues a barrier on a queue of commands to blocks execution of commands enqueued on the queue of commands after the barrier until the barrier completes.

### Claim 10 (depends on 1)

The program storage device of claim 1, wherein the second compute unit enqueues a marker on a queue of commands that does not complete until one or more other commands completes.

### Claim 11

A computing device, comprising:
one or more compute units; and
a global memory, coupled to the one or more compute units, on which are stored instructions that when executed cause the one or more compute units to:
enqueue a first kernel by a first compute unit for execution on a second compute unit, wherein the first and second compute units have different capabilities;
determine, based on the execution of the first kernel, that a condition is met; and
in response to the condition being met based on the execution of the first kernel, enqueue a second kernel for execution on the second compute unit.

### Claim 12 (depends on 11)

The computing device of claim 11, wherein the first compute unit is a central processing unit (CPU) and the second compute unit is a graphic processing unit (GPU).

### Claim 13 (depends on 11)

The computing device of claim 11, wherein the second kernel is enqueued after execution of the first kernel is complete.

### Claim 14 (depends on 11)

The computing device of claim 11, wherein the second kernel is enqueued during execution of the first kernel.

### Claim 15 (depends on 11)

The computing device of claim 11, wherein the first kernel is a data-parallel kernel, and wherein the second kernel is a data-parallel kernel with a different range than the first kernel.

### Claim 16 (depends on 11)

The computing device of claim 11, wherein the first kernel is a task-parallel kernel, and wherein the second kernel is a task-parallel kernel.

### Claim 17 (depends on 11)

The computing device of claim 11, wherein the first kernel is a task-parallel kernel, and wherein the second kernel is a data-parallel kernel.

### Claim 18 (depends on 11)

The computing device of claim 11, wherein the first kernel is a data-parallel kernel, and wherein the second kernel is a task-parallel kernel.

### Claim 19 (depends on 11)

The computing device of claim 11, wherein the second compute unit enqueues a barrier on a queue of commands to blocks execution of commands enqueued on the queue of commands after the barrier until the barrier completes.

### Claim 20 (depends on 11)

The computing device of claim 11, wherein the second compute unit enqueues a marker on a queue of commands that does not complete until one or more other commands completes.
