Task scheduling system, method and device and electronic equipment

By introducing the first engine and the second engine into the computer processor, and optimizing task scheduling using task node dependencies, the problem of low task scheduling efficiency and blocking is solved, and the parallelism and task execution efficiency of the processor are improved.

CN118939392APending Publication Date: 2024-11-12BEIJING T-HEAD INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410947454.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The task scheduling efficiency of existing computer processors is low, resulting in insufficient parallelism and easy mutual blockage between task commands, affecting the full use of computer computing power.

Method used

By introducing the first engine and the second engine in the task scheduling system, the dependency between the initial scheduling commands and the task nodes is utilized to improve the parallelism of a single cache unit, and avoid mutual blockage of task commands through the fence synchronization mechanism.

Benefits of technology

It improves task scheduling efficiency, avoids mutual blockage of task commands, and improves the parallelism and task execution efficiency of computer processors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939392A_ABST
    Figure CN118939392A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a task scheduling system, method and device and electronic device.The task scheduling system comprises at least one task scheduling module, and the task scheduling module comprises a first cache unit used for caching an initial scheduling command; the first engine is used for storing information of at least one task node corresponding to the initial scheduling command; and the second engine is used for caching executable task node information received from the first engine and sending the executable task node to the execution engine for processing. Wherein the initial scheduling command is used for triggering at least one task, and the information of the task nodes comprises the dependency relationship of the task nodes. Therefore, the task scheduling system provided by the embodiment of the invention can improve the degree of parallelism of the single first cache unit, and the task command can be scheduled and executed when being executed, so that mutual blockage of different task commands is avoided, and the task scheduling efficiency is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and more specifically, to a task scheduling system, method, device and electronic equipment. Background Art

[0002] Computer processors, such as GPU (Graphics Processing Unit), GPGPU (General Purpose Graphics Processing Unit), etc., contain a large number of computing cores. A large task will be broken down into multiple sub-tasks and assigned to different computing cores for processing. Multiple smaller tasks can also be submitted to the computer processor together and processed in parallel by different computing cores. Therefore, how to achieve efficient task scheduling of computer processors is the key to fully utilizing the computing power of computer processors. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a task scheduling system, method, device and electronic device, so as to improve the parallelism of a single first cache unit based on the dependency between the initial scheduling command and the task node through the first engine and the second engine, and enable the task command to be scheduled for execution when it can be executed, thereby avoiding mutual blocking of different task commands, thereby improving the task scheduling efficiency.

[0004] In a first aspect, an embodiment of the present invention provides a task scheduling system, wherein the task scheduling system includes at least one task scheduling module, and the task scheduling module includes:

[0005] A first cache unit, used for caching an initial scheduling command, where the initial scheduling command is used for triggering at least one task;

[0006] A first engine, connected to the first buffer area for communication, for storing information of at least one task node corresponding to the initial scheduling command, wherein the information of the task node includes a dependency relationship of the task node;

[0007] The second engine is connected to the first engine for communication, and is used for caching the executable task node information received from the first engine, and sending the executable task node to the execution engine for processing.

[0008] Optionally, the first cache unit includes:

[0009] A memory access module, which is in communication with a predetermined storage unit and is used to send a task scheduling request to the predetermined storage unit according to the configuration information, wherein the predetermined storage unit is used to store task node information corresponding to the task to be executed;

[0010] A command cache module, connected to the predetermined storage unit for caching at least one initial scheduling command fed back by the predetermined storage unit;

[0011] A command decoder is communicatively connected with the command cache module and the first engine, and is used for reading the initial scheduling command from the command cache module and sending it to the first engine.

[0012] Optionally, the first cache unit is a linear ring cache unit.

[0013] Optionally, the first engine includes a node cache module, and the node cache module is used to cache the initial scheduling command or task node information.

[0014] Optionally, the node cache module includes multiple cache partitions, and the cache partitions are used to cache at least one task node information in a corresponding task node tree, and the task node tree includes multiple task nodes with dependency relationships.

[0015] Optionally, the first engine further includes:

[0016] an information receiving module, which is in communication with the first cache unit, the second engine and the predetermined storage unit, and is used to receive the initial scheduling command sent by the first cache unit, the executed task node information fed back by the second engine, and read the unexecuted task node information from the predetermined storage unit;

[0017] The task parsing module is communicatively connected with the node cache module and the second engine, and is used to obtain unexecuted task node information from the node cache module, and send the task node information to the second engine when the task node information includes a currently executable task execution command.

[0018] Optionally, the task parsing module is further used to send a task read request to the predetermined storage unit, so that the predetermined storage unit feeds back the corresponding unexecuted task node information to the information receiving module.

[0019] Optionally, the task node information in the cache partition is updated according to the executed task node information fed back by the second engine and the task node tree.

[0020] Optionally, the node cache module includes:

[0021] The first storage area is used to store control information of the task node;

[0022] The second storage area is used to store information of task nodes.

[0023] Optionally, the second engine includes:

[0024] A first task cache module, which is in communication with the first engine and the execution engine, and is used to receive a task execution command corresponding to a task node sent by the first engine;

[0025] The second task cache module is connected to the first engine and the execution engine for caching and updating the received task node information.

[0026] Optionally, a fence synchronization mechanism is used between different task scheduling modules.

[0027] In a second aspect, an embodiment of the present invention provides a task scheduling method, the method comprising:

[0028] Reading at least one initial scheduling command from the first cache unit, where the initial scheduling command is used to trigger at least one task;

[0029] Traversing the corresponding task node tree according to the initial scheduling command, and caching at least one task node information in the task node tree in the corresponding cache partition, wherein the task node tree includes a plurality of task nodes having a dependency relationship;

[0030] Parsing the task node information to obtain executable task nodes;

[0031] The executable task node is dispatched to the execution engine for execution.

[0032] Optionally, the task node information cached by the cache partition includes root node information, leaf node information, and / or trunk node information, and the root node information is the node information corresponding to the initial scheduling command or the executed task node information.

[0033] Optionally, traversing the corresponding task node tree according to the initial scheduling command and caching at least one task node information in the task node tree in a corresponding cache partition includes:

[0034] In response to the initial scheduling command or the task node traversed from the task node tree applying for the corresponding cache partition, the initial scheduling command or the traversed task node is cached as a root node in the corresponding cache partition.

[0035] Optionally, traversing the corresponding task node tree according to the initial scheduling command and caching at least one task node information in the task node tree in a corresponding cache partition includes:

[0036] In response to the task node information in the cache partition indicating that the task has been executed, the corresponding task node tree is traversed according to the dependency relationship of the executed task nodes, the corresponding task node information is obtained from the task node tree and the cache partition is updated.

[0037] Optionally, parsing the task node information to obtain executable task nodes includes:

[0038] Determine the root node applied to the cache partition as the executable task node; and / or

[0039] Determine a leaf node that carries a task command and has a dependency value of 0 as the executable task node, wherein the dependency value is used to represent the number of unexecuted task nodes that the corresponding task node depends on; and / or

[0040] A trunk node whose branch number is less than or equal to an idle parameter in a cache partition is determined as the executable node, and the idle parameter is determined according to the idle position in the cache partition.

[0041] Optionally, parsing the task node information to obtain executable task nodes includes:

[0042] In response to the cache partition including a plurality of trunk nodes, and the number of branches of the trunk node being greater than the idle parameter, creating at least one empty task node corresponding to the trunk node, the empty task node pointing to the corresponding trunk node;

[0043] The empty task node is determined as the executable task node.

[0044] In a third aspect, an embodiment of the present invention provides a task scheduling device, the device comprising:

[0045] A first reading unit is configured to read at least one initial scheduling command from the first cache unit, where the initial scheduling command is used to trigger at least one task;

[0046] A traversal unit is configured to traverse the corresponding task node tree according to the initial scheduling command, and cache at least one task node information in the task node tree in a corresponding cache partition, wherein the task node tree includes a plurality of task nodes having a dependency relationship;

[0047] A parsing unit, configured to parse the task node information and obtain executable task nodes;

[0048] The dispatching unit is configured to dispatch the executable task node to the execution engine for execution.

[0049] In a fourth aspect, an embodiment of the present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor using the task scheduling system as described above.

[0050] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.

[0051] In a sixth aspect, an embodiment of the present invention provides a computer program product, which, when executed on a computer, enables the computer to execute the method described above.

[0052] The task scheduling system of the embodiment of the present invention includes at least one task scheduling module, which includes a first cache unit for caching an initial scheduling command, a first engine for storing information of at least one task node corresponding to the initial scheduling command, and a second engine for caching executable task node information received from the first engine and sending the executable task node to the execution engine for processing. The initial scheduling command is used to trigger at least one task, and the information of the task node includes the dependency relationship of the task node. Thus, the task scheduling system of the embodiment of the present invention can improve the parallelism of a single first cache unit based on the dependency relationship between the initial scheduling command and the task node through the first engine and the second engine, and when the task command can be executed, it is scheduled for execution to avoid mutual blocking of different task commands, thereby improving the task scheduling efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0054] Figure 1 This is a comparative task scheduling diagram;

[0055] Figure 2 This is a comparative diagram of the task scheduling hardware structure;

[0056] Figure 3 is a schematic diagram of forming a task node tree according to an embodiment of the present invention;

[0057] Figure 4 is a schematic diagram of a task scheduling system according to an embodiment of the present invention;

[0058] Figure 5 is a schematic diagram of the software and hardware interface of an embodiment of the present invention;

[0059] Figure 6is a schematic structural diagram of a first cache unit according to an embodiment of the present invention;

[0060] Figure 7 is a structural schematic diagram of a first engine according to an embodiment of the present invention;

[0061] Figure 8 is a schematic diagram of a working process of a first engine according to an embodiment of the present invention;

[0062] Fig. 9 is another schematic diagram of the working process of the first engine according to an embodiment of the present invention;

[0063] Fig.10 is a structural schematic diagram of another first engine according to an embodiment of the present invention;

[0064] Fig.11 is a structural schematic diagram of a second engine according to an embodiment of the present invention;

[0065] Fig.12 is a flowchart of a task scheduling method according to an embodiment of the present invention;

[0066] Fig.13 is a schematic diagram of a task scheduling device according to an embodiment of the present invention;

[0067] Fig.14 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0068] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.

[0069] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.

[0070] Unless the context clearly requires otherwise, the words "include", "comprising" and similar words throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, the meaning is "including but not limited to".

[0071] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.

[0072] In the relevant comparative examples, a linear ring buffer is usually used to implement the scheduling of computer processing. Taking the computer processor GPGPU as an example, the user end submits relevant tasks to the hardware device in the form of a data stream. Among them, a stream is a linear sequence of commands, that is, a data stream formed by the command sequence corresponding to the relevant tasks. It should be understood that in actual applications, the user end can configure a task to one or more streams, or multiple tasks to the same stream.

[0073] Figure 1 This is a comparative task scheduling diagram. Figure 1 As shown, the corresponding driver is used to read the stream, and the read command is written into the ring buffer 1. The ring buffer 1 has a baseline, and maintains a write pointer wptr and a read pointer rptr. The hardware device starts working by reading the command based on the read pointer rptr, and updates the read pointer rptr to indicate that the corresponding command has been executed and the corresponding space can be released. In addition, when the driver writes the command into the ring buffer 1, it updates the position pointed to by the write pointer wptr. Figure 1 As shown, the position between the write pointer wptr and the read pointer rptr of the circular buffer area 1 stores the commands to be executed, the area between the write pointer wptr and the cache start point is the unused cache area (Free Space), and the area between the cache start point and the read pointer rptr is the area released by the executed commands.

[0074] Since there may be dependencies between commands in the stream, the comparison also uses the fence-semaphore mechanism to handle the dependencies between commands. Specifically, the WAIT_FENCE and FENCE commands can be used. Among them, the WAIT_FENCE command means that the cache that executes the command will wait until the value in the specified memory meets a specific condition, and the FENCE command means writing a specific value to the specified memory.

[0075] Figure 2 This is a comparative diagram of the task scheduling hardware structure. Since each ring buffer requires a certain amount of physical resources, only a limited number of K HW ring buffers can be provided physically, and different ring buffers can be executed in parallel. The driver divides each task and writes the task into the selected ring buffer in a linear manner. The hardware device then retrieves and executes the corresponding task according to the address given by the driver. Figure 2As shown, taking the two circular buffers ring0 and ring1 as examples, in ring0, Task0 / Task1 / Task2 are written linearly, where Task1 depends on Task0. In ring1, Task3 and Task4 are written linearly, where Task4 depends on Task3. Therefore, the driver will write an additional fence-semaphore (that is, fence0 and wait_fence0 commands) between Task0 and Task1 to ensure the execution order of Task0 and Task1, and an additional fence-semaphore (that is, fence3 and wait_fence3 commands) between Task3 and Task4 to ensure the execution order of Task3 and Task4. Further, the processing engine obtains the executable tasks in ring0 or ring1 for corresponding processing. Among them, Task2 does not depend on Task0, but still needs to wait for the completion of Task0.

[0076] At the same time, Ring Buffer is a hardware resource, and due to cost constraints, the number is often only a few to dozens. Stream is a software resource, created by the user end. In a multi-process multi-stream scenario, the number of streams may be as many as hundreds or thousands. Therefore, the driver may map multiple streams to the same Ring Buffer. Since RingBuffer is a linear structure, WAIT_FENCE blocks the entire Ring Buffer, and it is possible to introduce false dependencies between independent streams. It can be seen that in this comparative example, due to the limitation of physical hardware resources, the parallelism of task processing is low, and the fence-semaphore mechanism brings additional memory access overhead, and tasks in the same Ring Buffer may be forced to form mutual blocking, thereby affecting task scheduling performance. Therefore, an embodiment of the present invention provides a task scheduling system, method, device and electronic device, so as to improve the parallelism of a single first cache unit based on the dependency relationship between the initial scheduling command and the task node through the first engine and the second engine, and to avoid mutual blocking of different task commands when the task command can be executed, thereby improving the task scheduling efficiency.

[0077] In an embodiment of the present invention, by processing the task data flow and the dependencies between tasks from an overall perspective, tasks with dependencies are combined into a tree or a graph, and a corresponding task scheduling system is designed to traverse the tree or the graph to improve the parallelism of task scheduling, thereby improving the efficiency of task scheduling.

[0078] Figure 3It is a schematic diagram of the task node tree formation of an embodiment of the present invention. After obtaining different tasks submitted by the user end through multiple SW streams (Software streams) created, this embodiment connects the tasks according to the dependencies to form a graph structure (or tree structure). It should be understood that the tasks submitted by the user end through the SW stream can be multiple subtasks divided from a large task (such as multiple subtasks corresponding to an AI model), or a combination of multiple small tasks, and this embodiment does not limit this.

[0079] like Figure 3 As shown, taking the task streams stream0, stream1 and stream2 as an example, the corresponding graph structure 3 (or tree structure) is constructed through the dependency relationship between the tasks in the task streams stream0, stream1 and stream2. The directed lines in the graph structure 3 represent the task dependency relationship. Among them, the task stream stream0 includes tasks 01-03, the task stream stream1 includes tasks 11-13, and the task stream stream2 includes tasks 21-23. The numbers in the node identifiers of each task represent the number of nodes on which the corresponding task depends. For example, the execution of task 02 in the task stream stream0 only needs to rely on the execution result of task 01 in the task stream stream0, and the number in the node identifier corresponding to task 02 is 1. The execution of task 12 in the task stream stream1 needs to rely on the execution results of tasks 01, tasks 11 and tasks 21, and the number in the node identifier corresponding to task 02 is 3.

[0080] Furthermore, in order to process the dependency flow, the embodiment of the present invention defines each node in the graph structure 3 as a scheduling command (sched cmd), and the information of each task node (sched cmd) includes dependency information and task information. Among them, the dependency information includes the dependency value depcnt (dependency counter) and the node pointer. The task information includes the task (task) carried by the task node. The dependency value depcnt is used to characterize the count value of the unexecuted predecessor task node on which the corresponding task node depends. When the dependency value depcnt=0, it indicates that the predecessor task node on which the corresponding task node depends has been completed. The task node can be changed to an executable state, and the task command (task) it carries can be executed at any time. For example, if the task 01 in the predecessor node task stream 0 on which it depends is not executed, the dependency value depcnt corresponding to the task 02 in the task stream 0 is 1. If the task 01 in the predecessor node task stream 0 on which it depends has been executed, the dependency value depcnt corresponding to the task 02 in the task stream 0 is 0.

[0081] In an optional implementation, the task node has a corresponding predetermined number of node pointers. The node pointer is used to point to the post-task node that depends on the task node. When the task node is executed, the dependency value depcnt corresponding to the post-task node pointed to by the task node is reduced by 1. Further optionally, when the number of other tasks that depend on a task exceeds a predetermined number, the task can be mapped to multiple task node cascades (i.e., multiple sched cmd cascades). It should be understood that the present embodiment does not limit the number of node pointers corresponding to the task node, which can be set based on actual hardware performance and efficiency requirements. The present embodiment is mainly described in detail below by taking the task node having two corresponding node pointers as an example. Taking task 02 in task stream Stream0 as an example, one of the node pointers corresponding to task 02 is used to point to task 03 in task stream Stream0. Taking task 12 in task stream Stream1 as an example, it requires 3 node pointers to point to task 03 in task stream Stream0, task 13 in task stream Stream1, and task 23 in task stream Stream2 respectively. Therefore, task 12 can be mapped to two task nodes cascaded, so that the two node pointers of one task node point to task 03 in task stream 0 and task 13 in task stream 1 respectively, and one node pointer of the other task node points to task 23 in task stream 2.

[0082] In an optional implementation, in the process of constructing the graph structure, a node that does not carry a task execution command but only serves as a processing dependency flow (which may be called an Aux-Sched cmd) may be inserted into the graph structure to further facilitate the expression of dependency flows between tasks and further facilitate subsequent task scheduling.

[0083] Furthermore, the embodiment of the present invention stores the above-mentioned graph structure (or tree structure) through a predetermined storage unit, and traverses the subtrees in the graph structure in parallel through the task scheduling system of the embodiment of the present invention. It should be understood that the subtrees in this embodiment are DAGs (directed acyclic graphs) divided from a large graph structure. Further optionally, the subtrees in this embodiment are divided when the task scheduling system is dynamically running.

[0084] Figure 4 FIG. 1 is a schematic diagram of a task scheduling system according to an embodiment of the present invention. Figure 4 As shown, the task scheduling system 40 of the embodiment of the present invention includes at least one task scheduling module 41. The task scheduling module 41 includes a first cache unit 411, a first engine 412 and a second engine 413. The first cache unit 411 is connected to the first engine 412 in communication, and the first engine 412 is connected to the second engine 413 in communication.

[0085] In an optional implementation, the first cache unit 411 is a linear cache unit. Further optionally, the first cache unit is a linear ring buffer. The first cache unit 411 is used to cache the initial scheduling command. The initial scheduling command is used to trigger at least one task.

[0086] Further, the present embodiment realizes the interaction between software and hardware through the software and hardware interface. Optionally, the present embodiment can write each initial scheduling command (rbsched) into the first cache unit 411 through the device driver. It should be understood that the present embodiment is not limited to the device driver, and the present embodiment can also be implemented using other software and hardware interfaces, such as register interfaces, bus interfaces, etc. Optionally, the initial scheduling command in the present embodiment can be determined based on the dependency relationship between tasks. Further optionally, there may be no dependency relationship or there may be a dependency relationship between the tasks triggered by different initial scheduling commands. Thus, the present embodiment can write at least one initial scheduling command into the first cache unit 411 through the software and hardware interface, so that the first engine 412 traverses the graph structure in the predetermined storage unit 50 by reading the initial scheduling command in the first cache unit 411.

[0087] Figure 5 Schematic diagram of the software and hardware interface of an embodiment of the present invention. Figure 5 As shown, taking task streams stream0, stream1, and stream2 as examples, this embodiment can write the initial scheduling commands rbsched1 and rbsched2 corresponding to tasks task1-5 in task streams stream0, stream1, and stream2 into the ringbuffer (ie, the first cache unit 411) through a device driver based on an API interface.

[0088] Figure 6 Schematic diagram of the structure of the first cache unit in an embodiment of the present invention. Figure 6 As shown, the first cache unit 411 includes a memory access module 61, a command cache module 62 and a command decoder 63. The memory access module 61 is connected to the predetermined storage unit 50, and the command cache module 62 is connected to the predetermined storage unit 50 and the command decoder 63. The command decoder 63 is connected to the command cache module 62 and the first engine 412.

[0089] The memory access module 61 is used to send a task scheduling request req1 to the predetermined storage unit 50 according to the configuration information. The configuration information may include the baseline (Base) of the first cache unit, the write pointer, the read pointer, and the access address of the predetermined storage unit 50 and other information.

[0090] In an optional implementation, the memory access module 61 can be implemented using DMA (Direct Memory Access). DMA is a technology that allows hardware devices to directly read and write system memory. Therefore, the memory access module 61 can send a task scheduling request req1 to the predetermined storage unit 50 based on the configuration information to directly read the initial scheduling command rbsched from the predetermined storage unit 50. It should be understood that the memory access module 61 of this embodiment is not limited to DMA, and other memory access modes that can be used to access the predetermined storage unit 50 can be applied to the memory access module 61, and no examples are given here.

[0091] After receiving the task scheduling request req1, the predetermined storage unit 50 obtains the corresponding at least one initial scheduling command rbsched, and sends feedback information rsq1 to the command cache module 62. The feedback information rsq1 includes one or more initial scheduling commands rbsched.

[0092] The command cache module 62 is used to cache at least one initial scheduling command fed back by the predetermined storage unit. In an optional implementation, the command cache module 62 can be implemented using a cmd fifo (command fifo, command queue). Cmdfifo is a first-in-first-out data structure for storing commands or instructions to be executed.

[0093] The command decoder 63 is used to read the initial scheduling command rbsched from the command cache module 62 and send it to the first engine 412. The command decoder 63 is used to read the original initial scheduling command rbsched from the command cache module 62 and convert it into a format that can be directly understood by the corresponding computer processor to ensure that the initial scheduling command rbsched can be correctly executed on the execution engine of the computer processor.

[0094] The first engine 412 is used to store information of at least one task node corresponding to the initial scheduling command. The information of the task node (sched cmd) includes the dependency relationship of the task node. In this embodiment, the first engine 412 can be a walk Engine, which is a hardware component for generating and managing complex memory access patterns.

[0095] Figure 7 is a schematic diagram of the structure of a first engine in an embodiment of the present invention. In an optional implementation, Figure 7As shown, the first engine 412 includes a node cache module 72. The node cache module 72 is used to cache the initial scheduling command rbsched or task node information (sched cmd). Optionally, the node cache module 72 includes multiple cache partitions (slots). The cache partition (slot) is used to cache at least one task node information in the corresponding task node tree (i.e., the above-mentioned subtree). Among them, the task node tree includes multiple task nodes with dependencies. It should be understood that in the present embodiment, the root node of the task node tree corresponding to each cache partition is updated with the dynamic execution process. The task node information in the cache partition is updated according to the executed task node information and the task node tree fed back by the second engine.

[0096] Furthermore, the first engine 412 further includes an information receiving module 71 and a task parsing module 73. The information receiving module 71 is in communication connection with the first cache unit 411, the second engine 413 and the predetermined storage unit 50. The task parsing module 73 is in communication connection with the node cache module 72 and the second engine 413.

[0097] The information receiving module 71 is used to receive the initial scheduling command rbsched sent by the first cache unit 411, the executed task node information fed back by the second engine 413, and read the unexecuted task node information from the predetermined storage unit 50. The task parsing module 73 is used to obtain the unexecuted task node information from the node cache module 72, and send the task node information to the second engine 413 when the task node information includes the currently executable task execution command.

[0098] Further, the task analysis module 73 is also used to send a task read request to the predetermined storage unit 50, so that the predetermined storage unit 50 feeds back the corresponding unexecuted task node information to the information receiving module 71. Specifically, the task analysis module 73 is also used to send a task read request req2 to the predetermined storage unit 50, so that the predetermined storage unit 50 generates response information rsq2 according to the task read request req2, and feeds back the response information rsq2 to the information receiving module 71. The response information rsq2 includes the corresponding unexecuted task node information.

[0099] Further, the task node information cached by the cache partition (slot) may include root node information, leaf node information, and / or trunk node information. Among them, the corresponding initial scheduling command rbsched or the executed task node information returned by the second engine 413 (that is, the sched cmd returned by the second engine 413 (the task it carries has been executed)) can be used as the root node (root node) of the task node tree. The task node sched cmd (currently not executable) whose dependency value (depcnt) is not 0, the task node sched cmd (currently executable) whose dependency value (depcnt) is 0 and carries a task, and the node that no longer needs to trigger the subsequent task node sched cmd can be used as the leaf node (leafnode) of the task node tree. The trunk node (trunk node) is also a node that is not a root node and a leaf node.

[0100] In an optional implementation, the update process of the cache partition in the node cache module 72 can be: when the initial scheduling command or the task node traversed from the task node tree applies for the corresponding new cache partition, the initial scheduling command or the traversed task node is cached as the root node to the new cache partition. It should be understood that if the task node traversed from the task node tree needs to apply for a new cache partition, a new task node tree representing the task node as the root node is created. Further, the update process of the cache partition in the node cache module 72 can also be: in response to the task node information in the cache partition representing that the task has been executed, the corresponding task node tree is traversed according to the dependency relationship of the executed task node, the corresponding task node information is obtained from the task node tree and the cache partition is updated.

[0101] The task parsing module 73 parses the task node information cached in the cache partition, obtains the executable task node, and sends the executable task node to the second engine 413. Further, the task parsing module 73 can determine the root node applied to the cache partition as an executable task node. The task parsing module 73 can also determine the leaf node carrying the task command (task) and the dependency value of 0 as an executable task node. Wherein, the dependency value is used to characterize the number of unexecuted task nodes on which the corresponding task node depends. Wherein, the task parsing module 73 sends the executable leaf node to the second engine 413 for distribution, so as to execute the corresponding task command through the execution engine. The task parsing module 73 can also determine the trunk node whose branch number is less than or equal to the idle parameter in the cache partition as an executable node. Wherein, the task parsing module 73 executes the executable trunk node to generate a task read request for accessing the predetermined storage unit 50. The predetermined storage unit 50 reads the corresponding task node through the received task read request and feeds it back to the information receiving module 71. Wherein, the cache partition includes multiple cache locations, and each cache location can cache a task node information. The idle parameter is determined according to the idle position (entry) in the cache partition. Optionally, the idle parameter = idle position + 1. It should be understood that the present embodiment does not limit the specific determination method of the idle parameter, and it can be applied to specific scenarios. Furthermore, the task parsing module 73 is used to discard unexecutable nodes, such as leaf nodes whose dependency values ​​are not 0 (depcnt! = 0) or nodes without subsequent nodes. The task parsing module 73 is also used to execute the trunk node to obtain the node pointer of the trunk node, generate a task read request req2 corresponding to the task node pointed to by the trunk node, and send the task read request req2 to the predetermined storage unit 50, so that the predetermined storage unit 50 generates a response message rsq2 according to the task read request req2, and feeds back the response message rsq2 to the information receiving module 71.

[0102] Figure 8 FIG. 1 is a schematic diagram of the workflow of the first engine of an embodiment of the present invention. The workflow of the first engine is described by way of example below. Figure 8As shown, the first engine 412 includes i (i is greater than or equal to 1) cache partitions slot0-sloti, and each cache partition includes 2 cache location entries. The first engine 412 reads the initial scheduling command rbsched0 from the first cache unit 411, and applies for a cache partition slot0 from the first engine 412, and caches the initial scheduling command rbsched0 to a cache location in the cache partition slot0. The first engine 412 traverses the corresponding task node tree tree1 in the predetermined storage unit 50 according to the initial scheduling command rbsched0. In this embodiment, the initial scheduling command rbsched0 is used as the root node of the task node tree tree1, that is, Figure 8 The task node schedcmd1 in the task node tree tree1 in the task node tree. The current trunk nodes of the task node tree tree1 include schedcmd2, schedcmd5 and schedcmd3. The current leaf nodes of the task node tree tree1 include schedcmd4, schedcmd6 and schedcmd7.

[0103] Further, the task parsing module 73 in the first engine 412 can determine the root node schedcmd1 applied to the cache partition as an executable task node, and send the root node schedcmd1 to the second engine 413 for dispatching. The second engine 413 dispatches the root node schedcmd1 to the execution engine 60 for execution, and updates the information of the root node schedcmd1 after receiving the message of task execution completion, and returns the updated information of the executed root node schedcmd1 to the first engine 412. The first engine 412 further traverses the task node tree tree1 according to the node pointer of the executed root node schedcmd1, reads the trunk nodes schedcmd2 and schedcmd3, and caches them in two cache locations in the cache partition slot0.

[0104] For the trunk node schedcmd2, the corresponding branch number is 1, and the free position in the cache partition slot0 is 0, that is, the branch number = the free position number + 1. As defined above, the trunk node does not carry the task command task. Since the trunk node schedcmd2 meets the execution condition (that is, the branch number = the free position number + 1), the first engine 412 executes the trunk node schedcmd2 to generate a task read request according to the node pointer of the trunk node schedcmd2, thereby reading the trunk node schedcmd5 pointed to by the trunk node schedcmd2 from the predetermined storage unit 50 based on the task read request, and caching the trunk node schedcmd5 to the first cache position in the cache partition slot0.

[0105] For the trunk node schedcmd3, the corresponding number of branches is 1, and the number of free positions in the cache partition slot0 is 0, that is, the number of branches = the number of free positions + 1. Therefore, the first engine 412 executes the trunk node schedcmd3 to generate a task read request according to the node pointer of the trunk node schedcmd3, and then reads the leaf node schedcmd4 pointed to by the trunk node schedcmd3 from the predetermined storage unit 50 based on the task read request, and caches the trunk node schedcmd4 to the second cache position in the cache partition slot0.

[0106] For the trunk node schedcmd5, the corresponding branch number is 2, and the free position in the cache partition slot0 is 0, that is, the branch number is greater than the free position number + 1. At this time, if the trunk node schedcmd5 is determined to be an executable node, the leaf nodes schedcmd6 and schedcmd7 pointed to by its node pointer cannot be cached to the cache partition slot0. In this regard, in an optional implementation, the trunk node schedcmd5 of this embodiment can wait for the second cache position in the cache partition slot0 to be released after the leaf node schedcmd4 is executed before executing.

[0107] like Figure 8 As shown, after the leaf node schedcmd4 is executed and the second cache position in the cache partition slot0 is released, the free position in the cache partition slot0 is 1, and the number of branches of the trunk node schedcmd5 = the number of free positions + 1. Therefore, the first engine 412 executes the trunk node schedcmd5 to generate a task read request according to the node pointer of the trunk node schedcmd5, thereby reading the leaf node schedcmd6 and the leaf node 7 pointed to by the trunk node schedcmd5 from the predetermined storage unit 50 based on the task read request, and caches the leaf node schedcmd6 and the leaf node 7 to the cache position in the cache partition slot0.

[0108] In another optional implementation, when the number of branches of a trunk node is greater than the corresponding idle parameter, an empty task node (nop node) corresponding to the trunk node can also be created, and after the empty task node is executed, a new cache partition is applied as the root node (root) to continue processing the original trunk node based on the new cache partition. Among them, the empty task node points to the corresponding trunk node. It should be understood that at this time, a new task node tree is formed with the empty task node as the root node.

[0109] Further optionally, if the cache partition includes multiple trunk nodes, and the number of branches of the trunk node is greater than the idle parameter, create at least one empty task node corresponding to the trunk node, and determine the empty task node as an executable task node. If the cache partition includes multiple trunk nodes, and the number of branches of the trunk nodes is greater than the idle parameter, it is impossible to continue the task execution by waiting for other branches to execute. This embodiment creates an empty task node corresponding to at least one trunk node, determines the empty task node as an executable task node, and uses the executed empty task node returned by the second engine as the root node to apply for a new cache partition, so as to continue processing the original trunk node based on the new cache partition.

[0110] In an optional implementation, the above-mentioned empty task node can be created when constructing the overall graph structure, or can be created when traversing to the corresponding trunk node. This embodiment does not limit the creation timing of the empty task node.

[0111] Fig. 9 FIG. 1 is another schematic diagram of the working process of the first engine according to an embodiment of the present invention. Fig. 9 As shown, when the first engine 412 traverses the task node tree tree2, if the trunk nodes schedcmd2' and schedcmd3' are read and cached in the cache partition slot0, the number of branches for the trunk nodes schedcmd2' and schedcmd3' is greater than the number of free positions + 1, and it is impossible to process by waiting for other nodes to complete execution and release the cache position. Therefore, this embodiment can create an empty task node corresponding to one or more trunk nodes, such as Fig. 9 The task node tree tree2' shown creates a preceding empty task node nop corresponding to the trunk node schedcmd3', so that one of the node pointers of the root node schedcmd1' points to the empty task node nop, and one of the node pointers of the empty task node nop points to schedcmd3'.

[0112] In this case, after the root node schedcmd1' is executed, the first engine 412 traverses the task node tree tree2', reads and caches the trunk node schedcmd2' and the empty task node nop in the cache partition slot0. For the trunk node schedcmd2', the number of branches is greater than the number of free positions + 1, and it is necessary to wait for the empty task node nop to be executed and release the cache position. For the empty task node nop, the number of branches is 1, so the number of branches = the number of free positions + 1. The task parsing module 73 can send the empty task node nop as an executable node to the second engine 413. The second engine 413 dispatches the empty task node nop to the execution engine 60 for execution, and updates the information of the empty task node nop after receiving the message that the task execution is completed, and returns the updated information of the executed empty task node nop to the first engine 412. At this time, after the empty task node nop is executed, the empty task node nop is controlled as the root node to apply for a new cache partition slot1 in the first engine 412, and the executed empty task node nop is cached in the cache partition slot1, and the corresponding cache position in the cache partition slot0 is released. At this time, for the trunk node schedcmd2', the number of branches = the number of free positions + 1, the trunk node schedcmd2' can be executed as an executable node to generate a corresponding task read request, and the leaf nodes schedcmd4' and schedcmd5' pointed to by the trunk node schedcmd2' are read from the predetermined storage unit 50 based on the task read request, and the leaf nodes schedcmd4' and schedcmd5' are cached in the cache partition slot0. In addition, after receiving the information that the empty task node nop is executed as fed back by the second engine, the first engine 412 obtains the task node schedcmd3' pointed to by the empty task node nop from the task node tree tree2' based on the node pointer of the empty task node nop, and caches the task node schedcmd3' to a cache position in the cache partition slot1.

[0113] Therefore, the first engine of the embodiment of the present invention can traverse the subgraph (ie, the task node tree) in the graph structure formed by multiple task streams in parallel, thereby improving the task scheduling efficiency.

[0114] Fig.10 FIG. 1 is a schematic diagram of another structure of the first engine in an embodiment of the present invention. In an optional implementation, Fig.10As shown, the first engine 412 includes an information receiving module 101, a node cache module 102 and a task parsing module 103. The information receiving module 101 is in communication connection with the first cache unit 411, the second engine 413 and the predetermined storage unit 50. The information receiving module 101 is used to receive the initial scheduling command rbsched sent by the first cache unit 411, the executed task node information fed back by the second engine 413, and read the unexecuted task node information from the predetermined storage unit 50.

[0115] The node cache module 102 is used to cache the initial scheduling command rbsched or task node information (sched cmd) received by the information receiving module 101. In this embodiment, the node cache module 102 includes a first storage area 1021 and a second storage area 1022. Among them, the first storage area 1021 is used to store the control information of the task node, and the second storage area 1022 is used to store the information of the task node. The control information of the task node may include information such as the identification and status information of the task node (for example, waiting for execution, execution, suspension of execution, completion, etc.). The information of the task node stored in the second storage area 1022 includes information such as the identification and pointer node of the task node.

[0116] In an optional implementation, the first storage area 1021 can be a table implemented based on at least one register. The second storage area 1022 can be implemented based on SRAM (static random access memory). SRAM is a fast memory type with low latency and high bandwidth, suitable for caching and high-speed data buffering. It should be understood that this embodiment does not limit the storage implementation form of the first storage area 1021 and the second storage area.

[0117] The task parsing module 103 is used to read the control information and task node information of the task node from the first storage area 1021 and the second storage area 1022 in the node cache module 102, determine whether the task node is the current executable node, and send it to the second engine 413 when the task node is the current executable node and carries the task command task. When the task node is an executable trunk node, a corresponding task read request is generated based on the node pointer of the trunk node to read the task node pointed to by the trunk node from the predetermined storage unit 50. The task parsing module 73 is also used to send a task read request req3 to the predetermined storage unit 50 based on the node pointer of the task node (the task node or trunk node that has completed the task command), so that the predetermined storage unit 50 generates a response message rsq3 according to the task read request req3, and feeds back the response message rsq3 to the information receiving module 101. The response message rsq3 includes the unexecuted task node information pointed to by the node pointer. The specific workflow and Figure 7-Figure 9 The embodiments shown are similar and will not be described again here.

[0118] The first engine of the embodiment of the present invention stores the control information and task node information of the task node in the first storage area and the second storage area respectively, thereby improving the information access efficiency and further improving the task scheduling efficiency of the task node.

[0119] Furthermore, if Figure 4 As shown, the second engine 413 is in communication connection with the first engine 412 and the execution engine 60. The second engine 413 is used to cache the executable task node information received from the first engine 412, and send the executable task node to the execution engine 60 for processing. Optionally, the second engine 413 is a track engine, which is used to track the task execution status of each task node in parallel.

[0120] In an optional implementation, the second engine 413 includes k (k ≥ 1) cache locations (entries), each of which caches one task node information. The number of cache locations of the second engine 413 can be determined according to the physical resources available in the specific application, and this embodiment does not limit this.

[0121] Further, when the second engine 413 receives the executable task node sent by the first engine 412, it caches the executable task node in a certain cache location, and sends the task command (task) carried by the executable task node to the execution engine 60 for execution. When the second engine 413 receives a task execution completion message returned by the execution engine 60, the second engine 413 updates the task node information in the corresponding cache location, and returns the updated task execution completion task node information to the first engine 412, so that the first engine 412 can continue to execute. The execution process of the first engine 412 after receiving the task execution completion task node information can be referred to. Figure 7-Figure 9 The embodiments shown will not be described in detail here.

[0122] Fig.11 is a schematic diagram of the structure of a second engine according to an embodiment of the present invention. Fig.11 As shown, the second engine 413 includes a first task cache module 111 and a second task cache module 112. The first task cache module 111 and the second task cache module 112 are both in communication connection with the first engine 412 and the execution engine 60.

[0123] The first task cache module 111 is used to receive the task execution command corresponding to the task node sent by the first engine 412. Optionally, the first task cache module 111 is implemented by a fifo queue, such as an issue fifo, etc. The first task cache module 111 is used to cache the task execution command in the form of a queue, and send the task execution command to the execution engine 60 for execution.

[0124] The second task cache module 112 is used to cache and update the received task node information. The second task cache module 112 is used to cache task node information, such as task dependency, task execution status, and other information. The second task cache module 112 receives the dependency information corresponding to the task node sent by the first engine 412, and receives the task execution completion message returned by the execution engine 60, updates the task execution status information of the task node, and feeds back the updated executed task node information to the first engine 412, so that the first engine 412 can continue to execute. The execution process of the first engine 412 after receiving the task node information of the task execution completion can be referred to. Figure 7-Figure 9 The embodiments shown will not be described in detail here.

[0125] In the embodiment of the present invention, the capacity of the second engine 413 is k, that is, it can track a maximum of k tasks at the same time, that is, the maximum parallelism of the first cache unit 411 (that is, the ring buffer) is k, that is, k HW streams. Further, the embodiment of the present invention maps the SW stream to these HW streams through a hardware and software interface (such as a device driver). As described above, when the number of SW streams does not exceed k, this embodiment can solve the task dependency during parallel scheduling by defining the task as a scheduling command (sched cmd) including task commands and dependencies.

[0126] Furthermore, when the number of SW streams exceeds k, the task scheduling system of the embodiment of the present invention may include multiple task scheduling modules. Therefore, this embodiment can map tasks in multiple SW streams to different ringbuffers. At the same time, the embodiment of the present invention processes the task dependency across ringbuffers (i.e., across task scheduling modules) through the fence-semaphore mechanism (fence synchronization mechanism), that is, when there is a dependency relationship between corresponding task nodes in different ring buffers, a specific value can be set, and after the execution of the corresponding predecessor task node task in one ring buffer is completed, the specific position is set to the specific value, and the task scheduling module corresponding to the other ring buffer scans the specific position until it finds that the specific position is set to the specific value, and determines that the task node that depends on the predecessor task node can be executed.

[0127] Furthermore, when all ring buffers are exhausted, this embodiment can introduce a false dependency to map different SW streams to the same HW stream. Figure 5 As shown, if all ringbuffers are exhausted, stream2 and stream1 can be mapped to the same HW stream. Specifically, a false dependency is created between task3 and task5, so that after task3 is executed, task5 is read based on the false dependency to implement task scheduling. It should be understood that in a false dependency, the execution of the subsequent task node does not depend on the execution result of the predecessor node, which is only convenient for task scheduling.

[0128] Therefore, the task scheduling system of this embodiment implements a multi-level task scheduling mechanism, which improves the task scheduling efficiency while ensuring the task scheduling reliability.

[0129] In an optional implementation, for known graph structures (such as cuda graph and other graph structures), there is no need to set the Aux-Sched cmd introduced to achieve dynamic submission (that is, only as a processing dependency flow to nodes that do not carry tasks). At the same time, for known graph structures, the command buffer of the entire graph structure can also be set directly on the device memory to shorten the memory access distance and further improve the task scheduling efficiency. Furthermore, for known graph structures, subsequent nodes can also be pre-fetched when reading the preceding node to further improve the access efficiency, thereby improving the task scheduling efficiency.

[0130] The task scheduling system of the embodiment of the present invention includes at least one task scheduling module, which includes a first cache unit for caching an initial scheduling command, a first engine for storing information of at least one task node corresponding to the initial scheduling command, and a second engine for caching executable task node information received from the first engine and sending the executable task node to the execution engine for processing. The initial scheduling command is used to trigger at least one task, and the information of the task node includes the dependency relationship of the task node. Thus, the task scheduling system of the embodiment of the present invention can improve the parallelism of a single first cache unit based on the dependency relationship between the initial scheduling command and the task node through the first engine and the second engine, and when the task command can be executed, it is scheduled for execution to avoid mutual blocking of different task commands, thereby improving the task scheduling efficiency.

[0131] Fig.12 FIG. 1 is a flowchart of a task scheduling method according to an embodiment of the present invention. Fig.12 As shown, the task scheduling method of the embodiment of the present invention includes the following steps:

[0132] Step S110, read at least one initial scheduling command from the first cache unit. The initial scheduling command is used to trigger at least one task. Optionally, in this embodiment, each initial scheduling command (rbsched) can be written into the first cache unit through a software and hardware interface (such as a device driver, etc.). Optionally, the initial scheduling command in this embodiment can be determined based on the dependency relationship between tasks. Further optionally, there may be no dependency relationship or there may be a dependency relationship between tasks triggered by different initial scheduling commands. Thus, in this embodiment, at least one initial scheduling command can be written into the first cache unit through a software and hardware interface, so that the first engine traverses the graph structure in the predetermined storage unit by reading the initial scheduling command in the first cache unit.

[0133] Step S120, traverse the corresponding task node tree according to the initial scheduling command, and cache at least one task node information in the task node tree in the corresponding cache partition. The task node tree includes a plurality of task nodes with dependency relationships.

[0134] In an optional implementation, the task node information cached by the cache partition includes root node information, leaf node information, and / or trunk node information, wherein the root node information is the node information corresponding to the initial scheduling command or the executed task node information.

[0135] In an optional implementation, this embodiment responds to the initial scheduling command or the task node traversed from the corresponding task node tree and applies for the corresponding cache partition, and caches the initial scheduling command or the traversed task node as the root node to the corresponding cache partition. In another optional implementation, this embodiment responds to the task node information in the cache partition indicating that the task has been executed, traverses the corresponding task node tree according to the dependency relationship of the executed task nodes, obtains the corresponding task node information from the task node tree and updates the cache partition.

[0136] Step S130, parse the task node information to obtain executable task nodes.

[0137] In an optional implementation, this embodiment can determine the root node applied to the cache partition as an executable task node. Further optionally, this embodiment can also determine the leaf node carrying the task command and the dependency value of 0 as an executable task node. Wherein, the dependency value is used to characterize the number of unexecuted task nodes on which the corresponding task node depends. Further optionally, this embodiment can also determine the trunk node whose branch number is less than or equal to the idle parameter in the cache partition as the executable node. Wherein, the idle parameter is determined according to the idle position in the cache partition. Further optionally, the idle parameter can be equal to the number of idle positions in the corresponding cache partition + 1. The trunk node is executed to generate a task read request for accessing the predetermined storage unit, thereby reading the corresponding task node from the predetermined storage unit.

[0138] In an optional implementation, in response to the number of branches of a trunk node being greater than the corresponding idle parameter, this embodiment creates an empty task node corresponding to the trunk node, and determines the empty task node as an executable task node. Further, in response to the cache partition including multiple trunk nodes and the number of branches of the trunk node being greater than the idle parameter, this embodiment creates an empty task node corresponding to at least one trunk node, and determines the empty task node as an executable task node. Among them, the empty task node points to the corresponding trunk node. Therefore, this embodiment can apply for a new cache partition as a root node (root) after the empty task node is executed, so as to continue processing the original trunk node based on the new cache partition. It should be understood that at this time, a new task node tree is formed with the empty task node as the root node.

[0139] In this embodiment, the first engine in the task scheduling system in the above embodiment executes the traversal of the task node tree and the determination of the executable task nodes in steps S120 and S130. The specific workflow can refer to the above Figure 7-10 The illustrated embodiment will not be described in detail here.

[0140] Step S140: dispatching the executable task node to the execution engine for execution.

[0141] In this embodiment, the second engine in the task scheduling system in the above embodiment executes step S140. The specific workflow can be referred to above. Fig.10 The illustrated embodiment will not be described in detail here.

[0142] The embodiment of the present invention reads at least one initial scheduling command from the first cache unit, and traverses the corresponding task node tree according to the initial scheduling command, caches at least one task node information in the task node tree in the corresponding cache partition, parses the task node information, obtains executable task nodes, and dispatches the executable task nodes to the execution engine for execution. Among them, the initial scheduling command is used to trigger at least one task, and the task node tree includes multiple task nodes with dependencies. Therefore, this embodiment can improve the parallelism of a single first cache unit based on the dependency between the initial scheduling command and the task node, and when the task command can be executed, it is scheduled for execution to avoid mutual blocking of different task commands, thereby improving the efficiency of task scheduling.

[0143] Fig.13 Schematic diagram of a task scheduling device according to an embodiment of the present invention. Fig.13 As shown, the task scheduling device 130 of the embodiment of the present invention includes a first reading unit 131 , a traversal unit 132 , a parsing unit 133 and a dispatching unit 134 .

[0144] The first reading unit 131 is configured to read at least one initial scheduling command from the first cache unit, and the initial scheduling command is used to trigger at least one task. The traversal unit 132 is configured to traverse the corresponding task node tree according to the initial scheduling command, and cache at least one task node information in the task node tree in the corresponding cache partition, and the task node tree includes multiple task nodes with dependencies. The parsing unit 133 is configured to parse the task node information and obtain executable task nodes. The dispatching unit 134 is configured to dispatch the executable task node to the execution engine for execution.

[0145] In an optional implementation, the task node information cached by the cache partition includes root node information, leaf node information, and / or trunk node information, and the root node information is the node information corresponding to the initial scheduling command or the executed task node information.

[0146] In an optional implementation, the traversal unit 132 is further configured to execute: in response to the initial scheduling command or the task node traversed from the task node tree applying for a corresponding cache partition, caching the initial scheduling command or the traversed task node as a root node to the corresponding cache partition.

[0147] In an optional implementation, the traversal unit 132 is further configured to perform: in response to the task node information in the cache partition representing that the task has been executed, traverse the corresponding task node tree according to the dependency relationship of the executed task nodes, obtain the corresponding task node information from the task node tree and update the cache partition.

[0148] In an optional implementation, the parsing unit 133 is further configured to execute: determining the root node applied to the cache partition as the executable task node; and / or determining the leaf node carrying the task command and the dependency value of 0 as the executable task node, the dependency value is used to characterize the number of unexecuted task nodes on which the corresponding task node depends; and / or determining the trunk node whose branch number is less than or equal to the idle parameter in the cache partition as the executable node, the idle parameter is determined according to the idle position in the cache partition.

[0149] In an optional implementation, the parsing unit 133 is further configured to execute: in response to the cache partition including multiple trunk nodes and the number of branches of the trunk node is greater than the idle parameter, create at least one empty task node corresponding to the trunk node, the empty task node points to the corresponding trunk node, and determine the empty task node as the executable task node.

[0150] The embodiment of the present invention reads at least one initial scheduling command from the first cache unit, and traverses the corresponding task node tree according to the initial scheduling command, caches at least one task node information in the task node tree in the corresponding cache partition, parses the task node information, obtains executable task nodes, and dispatches the executable task nodes to the execution engine for execution. Among them, the initial scheduling command is used to trigger at least one task, and the task node tree includes multiple task nodes with dependencies. Therefore, this embodiment can improve the parallelism of a single first cache unit based on the dependency between the initial scheduling command and the task node, and when the task command can be executed, it is scheduled for execution to avoid mutual blocking of different task commands, thereby improving the efficiency of task scheduling.

[0151] Fig.14 1 is a schematic diagram of an electronic device according to an embodiment of the present invention. In this embodiment, the electronic device 14 includes a server, a terminal, etc. Fig.14 As shown, the electronic device 14: includes at least one processor 141; and a memory 142 that is communicatively connected to at least one processor 141; and a communication component 143 that is communicatively connected to a scanning device, and the communication component 143 receives and sends data under the control of the processor 141; wherein the memory 142 stores instructions that can be executed by at least one processor 141, and the instructions are executed by at least one processor 141 using the task scheduling system in the above embodiment to implement the above task scheduling method.

[0152] Specifically, the electronic device includes: one or more processors 141 and a memory 142, Fig.14 A processor 141 is taken as an example. Optionally, the processor 141 may be a computing processor such as a GPU or a GPGPU. The processor 141 and the memory 142 may be connected via a bus or other means. Fig.14 In the example, the bus connection is used. The memory 142 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The processor 141 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions and modules stored in the memory 142, that is, realizing the above-mentioned task scheduling method.

[0153] The memory 142 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store a list of options, etc. In addition, the memory 142 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 142 may optionally include a memory remotely arranged relative to the processor 141, and these remote memories may be connected to an external device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0154] One or more modules are stored in the memory 142 , and when executed by one or more processors 141 , the task scheduling method in any of the above method embodiments is executed.

[0155] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.

[0156] The embodiment of the present invention reads at least one initial scheduling command from the first cache unit, and traverses the corresponding task node tree according to the initial scheduling command, caches at least one task node information in the task node tree in the corresponding cache partition, parses the task node information, obtains executable task nodes, and dispatches the executable task nodes to the execution engine for execution. Among them, the initial scheduling command is used to trigger at least one task, and the task node tree includes multiple task nodes with dependencies. Therefore, this embodiment can improve the parallelism of a single first cache unit based on the dependency between the initial scheduling command and the task node, and when the task command can be executed, it is scheduled for execution to avoid mutual blocking of different task commands, thereby improving the efficiency of task scheduling.

[0157] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.

[0158] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0159] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A task scheduling system, characterized in that: The task scheduling system includes at least one task scheduling module, and the task scheduling module includes: A first cache unit, used for caching an initial scheduling command, where the initial scheduling command is used for triggering at least one task; A first engine, connected to the first buffer area for communication, for storing information of at least one task node corresponding to the initial scheduling command, wherein the information of the task node includes a dependency relationship of the task node; The second engine is connected to the first engine for caching the executable task node information received from the first engine and sending the executable task node to the execution engine for processing.

2. The system according to claim 1, characterized in that The first cache unit includes: A memory access module, which is in communication with a predetermined storage unit and is used to send a task scheduling request to the predetermined storage unit according to the configuration information, wherein the predetermined storage unit is used to store task node information corresponding to the task to be executed; A command cache module, connected to the predetermined storage unit for caching at least one initial scheduling command fed back by the predetermined storage unit; A command decoder is communicatively connected with the command cache module and the first engine, and is used for reading the initial scheduling command from the command cache module and sending it to the first engine.

3. The system according to claim 1 or 2, characterized in that: The first cache unit is a linear ring cache unit.

4. The system according to claim 1, characterized in that The first engine also includes: an information receiving module, which is in communication with the first cache unit, the second engine and the predetermined storage unit, and is used to receive the initial scheduling command sent by the first cache unit, the executed task node information fed back by the second engine, and read the unexecuted task node information from the predetermined storage unit; A node cache module, used to cache the initial scheduling command or task node information; The task parsing module is communicatively connected with the node cache module and the second engine, and is used to obtain unexecuted task node information from the node cache module, and send the task node information to the second engine when the task node information includes a currently executable task execution command.

5. The system according to claim 4, characterized in that The node cache module includes multiple cache partitions, and the cache partitions are used to cache at least one task node information in a corresponding task node tree. The task node tree includes multiple task nodes with dependency relationships.

6. A task scheduling method, characterized in that: The method comprises: Reading at least one initial scheduling command from the first cache unit, where the initial scheduling command is used to trigger at least one task; Traversing the corresponding task node tree according to the initial scheduling command, and caching at least one task node information in the task node tree in a corresponding cache partition, wherein the task node tree includes a plurality of task nodes having a dependency relationship; Parsing the task node information to obtain executable task nodes; The executable task node is dispatched to the execution engine for execution.

7. The method according to claim 6, characterized in that The task node information cached by the cache partition includes root node information, leaf node information, and / or trunk node information, and the root node information is the node information corresponding to the initial scheduling command or the executed task node information.

8. The method according to claim 6, characterized in that The traversing the corresponding task node tree according to the initial scheduling command and caching at least one task node information in the task node tree in the corresponding cache partition comprises: In response to the initial scheduling command or the task node traversed from the task node tree applying for the corresponding cache partition, the initial scheduling command or the traversed task node is cached as a root node in the corresponding cache partition.

9. The method according to claim 8, characterized in that The traversing the corresponding task node tree according to the initial scheduling command and caching at least one task node information in the task node tree in the corresponding cache partition comprises: In response to the task node information in the cache partition indicating that the task has been executed, the corresponding task node tree is traversed according to the dependency relationship of the executed task nodes, the corresponding task node information is obtained from the task node tree and the cache partition is updated.

10. The method according to claim 7, characterized in that The parsing of the task node information to obtain executable task nodes includes: Determine the root node applied to the cache partition as the executable task node; and / or Determine a leaf node that carries a task command and has a dependency value of 0 as the executable task node, wherein the dependency value is used to represent the number of unexecuted task nodes that the corresponding task node depends on; and / or A trunk node whose branch number is less than or equal to an idle parameter in a cache partition is determined as the executable task node, and the idle parameter is determined according to the idle position in the cache partition.

11. A task scheduling device, characterized in that: The device comprises: A first reading unit is configured to read at least one initial scheduling command from the first cache unit, where the initial scheduling command is used to trigger at least one task; A traversal unit is configured to traverse the corresponding task node tree according to the initial scheduling command, and cache at least one task node information in the task node tree in a corresponding cache partition, wherein the task node tree includes a plurality of task nodes having a dependency relationship; A parsing unit, configured to parse the task node information and obtain executable task nodes; The dispatching unit is configured to dispatch the executable task node to the execution engine for execution.

12. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are used by the processor to perform task scheduling using the task scheduling system according to any one of claims 1 to 5.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 6 to 10 is implemented.

14. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to execute the method according to any one of claims 6 to 10.