# US 2025/0094218 A1 · Scheduling apparatus and method, and related device

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

- Number: US 2025/0094218 A1
- Document ID: US20250094218A1
- Status: Published application
- Kind: A1
- Application number: 18/963,706
- Filed: 2024-11-28
- Published: 2025-03-20
- Earliest claimed: 2022-05-30
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Bo Fang; Jiashu Lin; Hu Liu; Hou Fun Lam; Qiuyi Pan
- Web page: https://patentgrep.com/patent/US20250094218A1

## CPC

- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 8/45: {Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions}
- G06F 9/5066: {Algorithms for mapping a plurality of inter-dependent sub-tasks onto a plurality of physical CPUs (mappping at compile time, see G06F8/451)}
- G06F 9/544: {Buffers; Shared memory; Pipes}
- G06F 2209/486: Scheduler internals
- G06F 2209/5017: Task decomposition
- G06F 2209/543: Local
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

This disclosure provides a scheduling apparatus and method, and a related device. The scheduling apparatus includes a dispatcher coupled to an execution apparatus. The dispatcher includes a plurality of first buffers, each of the plurality of first buffers is configured to cache target tasks of one task type, the target tasks include a thread subtask and a cache management operation task, and the cache management operation task indicates to perform a cache management operation on input data or output data of the thread subtask. The dispatcher is configured to: receive a plurality of first target tasks, and cache the plurality of first target tasks in the plurality of first buffers based on task types; and dispatch a plurality of second target tasks to the execution apparatus.

## Claims

### Claim 1

A scheduling apparatus, comprising:
a dispatcher, coupled to an execution apparatus, the dispatcher comprises a plurality of first buffers, each of the plurality of first buffers is configured to cache target tasks of one task type, the target tasks comprise a thread subtask and a cache management operation task, the thread subtask is obtained by segmenting a node subtask, the node subtask is obtained by segmenting a subgraph task, the subgraph task is obtained by compiling a subgraph, and the cache management operation task indicates to perform a cache management operation on input data or output data of the thread subtask; and the dispatcher is configured to receive a plurality of first target tasks, and cache the plurality of first target tasks in the plurality of first buffers based on task types; and
dispatch a plurality of second target tasks to the execution apparatus, wherein any one of the plurality of second target tasks is a target task cached by the plurality of first buffers, and the plurality of second target tasks are separately cached by different first buffers.

### Claim 2 (depends on 1)

The scheduling apparatus according to claim 1, wherein the scheduling apparatus further comprises a scheduler, and the scheduler comprises a plurality of second buffers; and
the scheduler is configured to:
receive a plurality of third target tasks, and cache the plurality of third target tasks in the plurality of second buffers; and
send the plurality of first target tasks to the dispatcher, wherein any one of the plurality of first target tasks is a target task cached by the plurality of second buffers.

### Claim 3 (depends on 2)

The scheduling apparatus according to claim 2, wherein each of the plurality of second buffers is configured to cache target tasks of one category, and target tasks of a same category have a same one of the following: a task type, a priority, and an execution unit.

### Claim 4 (depends on 2)

The scheduling apparatus according to claim 2, wherein the scheduling apparatus further comprises a microcontroller unit (MCU) and a third buffer, the third buffer caches a descriptor of a fourth target task, and the fourth target task is any one of the plurality of third target tasks; and
the MCU is configured to:
read the descriptor of the fourth target task from the third buffer, wherein the descriptor of the fourth target task comprises a first target count, the first target count indicates a quantity of fifth target tasks whose execution is uncompleted, and the fourth target task depends on the fifth target task; and
if the first target count is zero, send the fourth target task to the scheduler.

### Claim 5 (depends on 4)

The scheduling apparatus according to claim 4, wherein the MCU is further configured to:
notify the third buffer to obtain and cache the descriptor of the fourth target task.

### Claim 6 (depends on 4)

The scheduling apparatus according to claim 4, wherein the execution apparatus comprises a plurality of execution units, the plurality of first target tasks comprise the fourth target task, and the plurality of second target tasks comprise the fourth target task; and
the dispatcher is specifically configured to:
read the descriptor of the fourth target task from the third buffer; and
if the descriptor of the fourth target task further comprises a first target quantity, segment the fourth target task into first block subtasks of the first target quantity, and dispatch the first block subtasks of the first target quantity to at least one of the plurality of execution units, wherein the first target quantity indicates a quantity of first block subtasks comprised in the fourth target task.

### Claim 7 (depends on 6)

The scheduling apparatus according to claim 6, wherein the dispatcher is further configured to:
after receiving, from the at least one execution unit, a notification indicating that execution of the first block subtasks of the first target quantity is completed, send, to the MCU, a notification indicating that execution of the fourth target task is completed.

### Claim 8 (depends on 4)

The scheduling apparatus according to claim 4, wherein the scheduler is further configured to:
read the descriptor of the fourth target task from the third buffer; and
if the descriptor of the fourth target task further comprises a first target index number, notify the third buffer to obtain and cache a descriptor of first target data, wherein the first target index number is used to identify the first target data, and input data of the fourth target task comprises the first target data.

### Claim 9 (depends on 8)

The scheduling apparatus according to claim 8, wherein the plurality of first target tasks comprise the fourth target task; and
the dispatcher is further configured to:
read the descriptor of the first target data from the third buffer; and
if the descriptor of the first target data comprises a second target index number, generate a first cache management operation task, and dispatch the first cache management operation task to the execution apparatus, wherein the second target index number is used to identify the fourth target task, and the first cache management operation task indicates to prefetch the first target data.

### Claim 10 (depends on 8, 9)

The scheduling apparatus according to claim 8 or 9, wherein the plurality of second target tasks comprise the fourth target task, the descriptor of the first target data further comprises a second target count, the second target count indicates a quantity of sixth target tasks whose execution is uncompleted, input data of the sixth target task comprises the first target data, and the sixth target task comprises the fourth target task; and
the MCU is further configured to:
after receiving, from the dispatcher, the notification indicating that execution of the fourth target task is completed, notify the third buffer to subtract one from the second target count.

### Claim 11 (depends on 10)

The scheduling apparatus according to claim 10, wherein the MCU is further configured to:
when the second target count is decreased to zero, send a second cache management operation task to the scheduler, wherein the second cache management operation task indicates to invalidate the first target data.

### Claim 12 (depends on 4)

The scheduling apparatus according to claim 4, wherein the plurality of first target tasks comprise the fourth target task; and
the dispatcher is further configured to:
read the descriptor of the fourth target task from the third buffer; and
if the descriptor of the fourth target task further comprises a third target index number, notify the third buffer to obtain and cache a descriptor of second target data, wherein the third target index number is used to identify the second target data, and the second target data comprises a part or all of output data of the fourth target task.

### Claim 13 (depends on 12)

The scheduling apparatus according to claim 12, wherein the plurality of second target tasks comprise the fourth target task, the descriptor of the second target data comprises a third target count, the third target count indicates a quantity of seventh target tasks whose execution is uncompleted, the second target data comprises a part or all of output data of the seventh target task, and the seventh target task comprises the fourth target task; and
the MCU is further configured to:
after receiving, from the dispatcher, the notification indicating that execution of the fourth target task is completed, notify the third buffer to subtract one from the third target count.

### Claim 14 (depends on 13)

The scheduling apparatus according to claim 13, wherein the MCU is further configured to:
when the third target count is decreased to zero, send a third cache management operation task to the scheduler, wherein the third cache management operation task indicates to write the second target data to a host, and the scheduling apparatus is coupled to the host.

### Claim 15 (depends on 4)

The scheduling apparatus according to claim 4, wherein the plurality of first target tasks comprise the fourth target task, and the plurality of second target tasks comprise the fourth target task; and
the dispatcher is further configured to:
read the descriptor of the fourth target task from the third buffer; and
if the descriptor of the fourth target task further comprises a fourth target index number, notify the third buffer to obtain and cache a descriptor of an eighth target task, wherein the fourth index number is used to identify the eighth target task, and the eighth target task depends on the fourth target task.

### Claim 16 (depends on 15)

The scheduling apparatus according to claim 15, wherein the descriptor of the eighth target task comprises a fourth target count, the fourth target count indicates a quantity of ninth target tasks whose execution is uncompleted, the eighth target task depends on the ninth target task, and the ninth target task comprises the fourth target task; and
the MCU is further configured to:
after receiving, from the dispatcher, the notification indicating that execution of the fourth target task is completed, notify the third buffer to subtract one from the fourth target count.

### Claim 17 (depends on 16)

The scheduling apparatus according to claim 16, wherein the MCU is further configured to:
when the fourth target count is decreased to zero, send the eighth target task to the scheduler.

### Claim 18

A scheduling method, applied to a scheduling apparatus, wherein the scheduling apparatus comprises a dispatcher, the dispatcher is coupled to an execution apparatus, the dispatcher comprises a plurality of first buffers, each of the plurality of first buffers is configured to cache target tasks of one task type, the target tasks comprise a thread subtask and a cache management operation task, the thread subtask is obtained by segmenting a node subtask, the node subtask is obtained by segmenting a subgraph task, the subgraph task is obtained by compiling a subgraph, and the cache management operation task indicates to perform a cache management operation on input data or output data of the thread subtask; and
the method comprises:
receiving, by the dispatcher, a plurality of first target tasks, and caching the plurality of first target tasks in the plurality of first buffers based on task types; and
dispatching, by the dispatcher, a plurality of second target tasks to the execution apparatus, wherein any one of the plurality of second target tasks is a target task cached by the plurality of first buffers, and the plurality of second target tasks are separately cached by different first buffers.

### Claim 19 (depends on 18)

The method according to claim 18, wherein the scheduling apparatus further comprises a scheduler, and the scheduler comprises a plurality of second buffers; and
the method further comprises:
receiving, by the scheduler, a plurality of third target tasks, and caching the plurality of third target tasks in the plurality of second buffers; and
sending, by the scheduler, the plurality of first target tasks to the dispatcher, wherein any one of the plurality of first target tasks is a target task cached by the plurality of second buffers.

### Claim 20 (depends on 19)

The method according to claim 19, wherein each of the plurality of second buffers is configured to cache target tasks of one category, and target tasks of a same category have a same one of the following: a task type, a priority, and an execution unit.
