Task execution method and device, electronic equipment and storage medium
By managing the communication tasks and synchronization values of the task queue in heterogeneous computing devices, the problems of low computing resource utilization and confusing task execution sequence are solved, and more efficient and precise task execution is achieved.
Patent Information
- Application Number
- CN202510405691.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-07-11
AI Technical Summary
In heterogeneous computing devices, it is difficult for the prior art to effectively utilize the computing resources of artificial intelligence processors, which makes it difficult to fully utilize the computing resources, and the task execution sequence is chaotic, affecting the calculation accuracy and efficiency.
By performing communication tasks and synchronization value management in the target task queue, ensure that the host tasks and device tasks are executed in the correct order, including writing synchronization values after the target device tasks are completed, and through the interrupt signal and data reading mechanism, ensure that the host tasks are executed according to the latest data.
The computing resource utilization and accuracy of heterogeneous computing devices are improved, ensuring that tasks are executed in the correct order, and improving the efficiency and accuracy of task execution.
Smart Images

Figure CN120295813A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and more particularly to the fields of chip technology and heterogeneous computing technology. More specifically, the present disclosure provides a task execution method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of artificial intelligence technology, the application of heterogeneous computing devices is increasing continuously. Heterogeneous computing devices include a host side and a device side. The first processor on the device side can be an artificial intelligence processor. The second processor on the host side can be a central processing unit. Summary of the Invention
[0003] The present disclosure provides a task execution method, apparatus, device, and storage medium.
[0004] According to one aspect of the present disclosure, there is provided a task execution method, the method including: when a first target device task in a target task queue is completed, performing a first communication task for a target host task, where the target host task is a host task after the first target device task in the target task queue, and the first communication task is used to write a first synchronization value for the target host task to a first target storage space for the target task queue; performing a second communication task for the target host task, where the second communication task is used to instruct a first task execution device to read first data from the first target storage space for the target task queue, and the host task execution device is used to execute the target host task according to the first data and the first synchronization value.
[0005] According to another aspect of the present disclosure, there is provided a task execution method, the method including: in response to receiving a target interrupt signal, reading first data from a first target storage space corresponding to the target interrupt signal, where the first target storage space corresponding to the target interrupt signal is the first target storage space for the target task queue, and the first data is written when the first target device task is completed; and executing the target host task according to the first data, where the target host task is a host task after the first target device task in the target task queue.
[0006] According to another aspect of the present disclosure, there is provided a task execution device, which includes: a first scheduling unit configured to provide at least one device task and a plurality of communication tasks in a target task queue to a first execution unit, the at least one device task including a first target device task, and the plurality of communication tasks including a first communication task for the first target device task and a second communication task for the first target device task; the first execution unit is configured to: when the first target device task in the target task queue is completed, execute the first communication task for the target host task, where the target host task is the host task after the first target device task in the target task queue, and the first communication task is used to write a first synchronization value for the target host task to a first target storage space for the target task queue; execute the second communication task for the target host task, where the second communication task is used to instruct the first task execution device to read first data in the first target storage space for the target task queue, and the host task execution device is used to execute the target host task according to the first data and the first synchronization value.
[0007] According to another aspect of the present disclosure, there is provided a task execution device, which includes: a second scheduling unit configured to provide at least one host task in a target task queue to a second execution unit; the second execution unit is configured to: in response to receiving a target interrupt signal, read first data in a first target storage space corresponding to the target interrupt signal, where the first target storage space corresponding to the target interrupt signal is the first target storage space for the target task queue, and the first data is written when the first target device task is completed; execute the target host task according to the first data, where the target host task is the host task after the first target device task in the target task queue.
[0008] According to another aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method provided according to the present disclosure.
[0009] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method provided according to the present disclosure.
[0010] According to another aspect of the present disclosure, there is provided a computer program product, including a computer program which, when executed by a processor, implements the method provided according to the present disclosure.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0013] Figure 1 is a schematic diagram of an exemplary system architecture to which the task execution method according to an embodiment of the present disclosure can be applied;
[0014] Figure 2 is a flowchart of the task execution method according to an embodiment of the present disclosure;
[0015] Figure 3A is a schematic diagram of an initial task queue according to an embodiment of the present disclosure;
[0016] Figure 3B is a schematic flowchart of obtaining a target task queue according to an embodiment of the present disclosure;
[0017] Figure 3C is an execution schematic diagram of a target task queue according to an embodiment of the present disclosure;
[0018] Figure 4 is a schematic flowchart of the execution process of multiple device tasks according to an embodiment of the present disclosure;
[0019] Figure 5 is a flowchart of the task execution method according to another embodiment of the present disclosure;
[0020] Figure 6 is a schematic flowchart of the execution process of a host task according to an embodiment of the present disclosure;
[0021] Figure 7 is a block diagram of a task execution device according to an embodiment of the present disclosure;
[0022] Figure 8 is a block diagram of a task execution device according to an embodiment of the present disclosure;
[0023] Figure 9 is a block diagram of a task execution device according to an embodiment of the present disclosure; and
[0024] Figure 10 is a block diagram of an electronic device to which the task execution method according to an embodiment of the present disclosure can be applied. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0025] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.
[0026] The artificial intelligence processor can be various processors such as a general-purpose graphics processing unit (GPGPU), a tensor processing unit (TPU), and a neural network processing unit (NPU). The artificial intelligence processor includes one or more parallel processing units, which are suitable for performing large-scale tensor operations and can accelerate the execution of tasks such as high-performance computing (HPC) tasks, model training tasks, and model inference tasks. The artificial intelligence processor can efficiently process multiple tasks based on the streaming task submission and processing technology.
[0027] Based on the streaming task submission and processing technology, multiple tasks can form a task flow. The user calls the submission function to submit a task to the task flow. After receiving the task, the submission function can return information indicating successful submission instead of immediately returning information indicating completion of execution. The scheduling unit of the artificial intelligence processor can sequentially obtain the task descriptions of the tasks from the task flow and distribute the tasks to the execution units. The user calls the synchronization function to wait for the completion of the execution of the tasks in the task flow and obtain the task execution results.
[0028] The multiple tasks in the task flow can include one or more device tasks. A device task is a task executed by the device side. However, in scenarios such as high-performance computing, model training, and model inference, there are some host tasks that can only be executed by the host side, and there are also some tasks that need to be jointly executed by the host side and the device side. Thus, the multiple tasks of the task flow can also include one or more host tasks.
[0029] Executing device tasks and host tasks in the correct order can obtain the correct task execution results. Thus, when inserting a new device task into the task flow, if there are no inserted and unexecuted host tasks, the device task can be directly added to the task flow; if there are inserted and unexecuted host tasks, the new device task can be temporarily stored in the device task temporary linked list corresponding to the task flow. After the host task is executed, the device tasks in the linked list are added to the task flow. This device function can then start executing after the host function is completed, meeting the requirements of the task sequence. When inserting a new host task into the task flow, it can wait for all the submitted device functions and host functions to be completed before executing the new host task. If a device task needs to be added after the new host task, the device task can be temporarily stored in the device task temporary linked list. After the new host task is executed, the device tasks temporarily stored in the device task temporary linked list can be submitted to the task flow. If there are multiple host tasks to be submitted, a host task temporary linked list can be maintained for each host task to ensure the correct execution sequence between multiple host tasks and device tasks. However, submitting a new host task to the task flow will cause one or more device tasks to be blocked, increasing the latency for subsequent device tasks to be submitted to the task flow, making it difficult to fully utilize the characteristics of large-capacity and asynchronous submission of the task flow, resulting in "bubbles" between multiple tasks of the task flow and making it difficult to fully utilize the computing resources of the artificial intelligence processor.
[0030] Thus, to improve the computing resource utilization rate and accuracy of the artificial intelligence processor, the present disclosure provides a task execution method, which will be described below.
[0031] Figure 1 It is a schematic diagram of an exemplary system architecture to which the task execution method according to an embodiment of the present disclosure can be applied. It should be noted that Figure 1 The figure shown is only an example of the system architecture to which the embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0032] As Figure 1 shown, the system architecture 10 according to this embodiment may include a device side 110 and a host side 120. Via an interface 130, data and signals can be transmitted between the device side 110 and the host side 120. The system architecture 10 may be, for example, the system architecture of the above heterogeneous computing device.
[0033] The device side 110 may include a first processor 111. The host side 120 may include a second processor 122. The instruction set of the second processor 122 may be different from that of the first processor 111. The first processor 111 may be an artificial intelligence processor. The second processor 122 may be a central processing unit.
[0034] Data and signals can be transmitted between the first processor and the second processor through a high-speed serial computer expansion bus. As Figure 1 shown, interface 130 can be a Peripheral Component Interconnect Express (PCIe) interface. Via interface 130, data and signals can be transmitted between the first processor 111 and the second processor 122 through a high-speed serial computer expansion bus.
[0035] It should be noted that the task execution method provided by the embodiments of the present disclosure can generally be executed by at least one of the host side 110 and the device side 120.
[0036] Figure 2 is a flowchart of a task execution method according to an embodiment of the present disclosure.
[0037] As Figure 2 shown, the method 210 may include operation S211 to operation S212.
[0038] In operation S211, when the first target device task in the target task queue is completed, a first communication task for the target host task is executed.
[0039] In the embodiments of the present disclosure, the target task queue may include one or more device tasks, one or more host tasks, and multiple communication tasks. One or more host tasks may include the target host task. The multiple communication tasks may include a first communication task and a second communication task for the target host task.
[0040] In the embodiments of the present disclosure, the target host task is the host task after the first target device task in the target task queue. For example, except for communication tasks, if the next task of the device task in the target task queue is a host task, the device task may be the first target device task, and the host task may be the target host task.
[0041] In the embodiments of the present disclosure, the first communication task may write a first synchronization value for the target host task to a first target storage space for the target task queue. Each target host task may correspond to a first synchronization value. The first target storage space may store the first synchronization value for the target host task in the target task queue.
[0042] In operation S212, a second communication task for the target host task is executed.
[0043] In an embodiment of the present disclosure, the second communication task may instruct the host task execution device to read the first data in the first target storage space for the target task queue. The host task execution device may execute the target host task according to the first data and the first synchronization value for the target host task. For example, if the first data is consistent with the first synchronization value, the target host task corresponding to the first synchronization value may be executed.
[0044] It can be understood that the method 200 may be executed by the device side 110 described above, and the host task execution device may be the host side 120 described above.
[0045] Through the embodiment of the present disclosure, after the first target device task is completed, the first communication task and the second communication task may be executed, so that the host task execution device obtains the execution progress of the target task queue, and may execute the target host task according to the relationship between the first data and the first synchronization value, which may enable the device tasks and host tasks in the target task queue to be executed in the correct order, and can effectively improve the accuracy and efficiency of the heterogeneous computing device.
[0046] It can be understood that the method of the present disclosure has been described above, and the method of the present disclosure will be further described below.
[0047] In some embodiments, the above method may further include: executing the second target device task according to the execution result of the third communication task for the second target device task. The second target device task is the device task after the target host task in the target task queue. For example, if there is still a device task after the target host task in the target task queue, the device task after the target host task may be used as the second target device task.
[0048] In some embodiments, the third communication task is used to: read at least one second data from the second target storage space for the target task queue in at least one execution period, and determine whether the second data is greater than or equal to the second synchronization value for the second target device task in the execution period. For example, the execution period may be one or more clock cycles, or a preset time period. Taking the execution period as 1 microsecond (μs) as an example, in each execution period, the second data in the second target storage space is read, and it is determined in each execution period whether the second data is greater than or equal to the second synchronization value for the second target device task.
[0049] In some embodiments, the execution result of the third communication task includes at least one execution sub-result, and the at least one execution sub-result includes a first execution sub-result and a second execution sub-result. The first execution sub-result may indicate that the second data is greater than or equal to the second synchronization value, and the second execution sub-result may indicate that the second data is less than the second synchronization value. Next, it may be determined whether to execute the second target device task according to the execution result of the third communication task.
[0050] In some embodiments, performing a second target device task according to the execution result of a third communication task for the second target device task may include: in response to determining that the execution result of the third communication task includes a first execution sub-result in the current execution cycle, performing the second target device task. For example, performing a target host task may require one or more execution cycles. After the target host task is completed, a first synchronization value for the target host task may be written to a second target storage space. When there is 1 target host task between the first target device task and the second target device task, the first synchronization value for the target host task may be the same as the second synchronization value for the second target device task. If the second data read from the second target storage space is the same as the second synchronization value for the second target device task, it may be determined that the execution result of the third communication task includes the first execution sub-result. Thereby, it can be determined that the target host task is completed, and the second target device task can be performed.
[0051] Through the embodiments of the present disclosure, based on the third communication task, the device side can continue to perform subsequent device tasks, the execution order of the tasks in the target task queue can be ensured, and the accuracy of the artificial intelligence processor can be improved.
[0052] It can be understood that the first communication task to the third communication task of the present disclosure have been described above, and the first communication task to the third communication task will be further described below.
[0053] In some embodiments, the first communication task may be a first communication primitive release(ha_1, sv_1). The first communication primitive release(ha_1, sv_1) may be one of the primitives in the above task flow. ha_1 may be a first target storage space. sv_1 may be a first synchronization value. The first communication primitive release(ha_1, sv_1) may represent writing the first synchronization value to the first target storage space. After the writing is completed, information indicating the completion of the writing may be returned to execute subsequent tasks in the target task queue. For example, the first communication primitive release(ha_1, sv_1) may include a memory write operation (memwr) in the Peripheral Component Interconnect Express (PCIe) protocol and may be a posted request.
[0054] In some embodiments, the second communication task may send a target interrupt signal for a target task queue to the host task execution device. The target interrupt signal may instruct the host task execution device to read the first data in the first target storage space for the target task queue. The second communication task may be the second communication primitive notify(stream_index). The second communication primitive release notify(stream_index) may be one of the primitives in the above task flow. stream_index may be the identifier of the target task queue. The target interrupt signal may include the identifier of the target task queue so that the host task execution device receiving the target interrupt signal can read the first target storage space for the target task queue. After the target interrupt signal is sent, the second communication primitive may return information indicating successful transmission so as to execute the subsequent tasks in the target task queue. For example, the second communication primitive notify(stream_index) may include the message mechanism in the Peripheral Component Interconnect Express (PCIe) protocol and may be a posted request.
[0055] It can be understood that the above device side may be a Peripheral Component Interconnect Express (PCIe) EndPoint device. As described above, both the first communication primitive and the second communication primitive are posted requests. According to the PCIe Ordering Rules, different posted requests sent from the same device side to the host side will not be out of order. Thus, when determining whether to execute the target host task after receiving the target interrupt signal, the host side can obtain the latest written value in the first target storage space for the target task queue. That is, the execution results of the first communication task (such as the first synchronization value) and the second communication task (the target interrupt signal) will not be lost. Thus, the accuracy of the heterogeneous computing device can be effectively improved.
[0056] In some embodiments, the third communication task may be the third communication primitive acquire(ha_2, sv_2). The third communication primitive acquire(ha_2, sv_2) may be one of the primitives in the above task flow. ha_2 may be the second target storage space. sv_2 may be the second synchronization value. The third communication primitive acquire(ha_2, sv_2) may indicate reading at least one second data from the second target storage space for the target task queue in at least one execution cycle, or may indicate determining whether the second data is greater than or equal to the second synchronization value for the second target device task in the execution cycle. For example, in an execution cycle, if it is determined that the second data is less than the second synchronization value, the third communication primitive acquire(ha_2, sv_2) may continue to be executed. For another example, in another execution cycle, if it is determined that the second data is greater than or equal to the second synchronization value, the execution of the third communication task may be stopped and the second target device task may be executed.
[0057] It can be understood that the above describes multiple communication tasks of the present disclosure, and the target task queue will be described below.
[0058] Figure 3A is a schematic diagram of an initial task queue according to an embodiment of the present disclosure.
[0059] As Figure 3A shown, the initial task queue tq30 may include device task D31, device task D32, device task D33, host task C34, and device task D35. Device task D31, device task D32, and device task D33 may be sequentially executed by the device side. Host task C34 may be executed after device task D33. Device task D35 may be executed after host task C34. It can be understood that as described above, if the initial task queue is directly executed, it may be difficult to fully utilize the computing resources of the artificial intelligence processor. Thus, in order to effectively and accurately utilize the computing resources of the artificial intelligence processor to execute device task D31, device task D32, device task D33, and device task D35, a target task queue may be obtained based on the initial task queue, which will be described below.
[0060] In some embodiments, the target task queue is obtained based on at least one of device tasks, host tasks, first communication tasks, second communication tasks, and third communication tasks. The following will be described in conjunction with Figure 3B for illustration.
[0061] Figure 3B is a schematic flowchart of obtaining a target task queue according to an embodiment of the present disclosure.
[0062] As Figure 3BAs shown, by performing operation S3001 to operation S3012, a target task queue can be obtained.
[0063] In operation S3001, determine whether the task to be added to the current task queue is a host task.
[0064] In some embodiments, in response to determining that the task to be added to the current task queue is a device task, perform operation S3002. For example, a user can submit a device task D31. The heterogeneous computing device can determine that the task to be added to the current task queue is a device task and can perform operation S3002. It can also be understood that when the user submits the device task D31, a new task queue can be created as the current task queue, and there may be no tasks in this current task queue.
[0065] In operation S3002, determine whether the current task queue has a pending mark.
[0066] In some embodiments, the pending mark can indicate adding a third communication task for the device task when adding a device task to the current task queue. It can be understood that in the case where the current task queue is a newly created task queue, the current task queue does not have a pending mark.
[0067] In some embodiments, in response to determining that the current task queue does not have a pending mark, operation S3006 can be performed.
[0068] In operation S3006, add the device task to the current task queue. For example, the device task D31 can be added to the newly created task queue.
[0069] Next, operation S3011 can be performed to determine whether an end indication message is received.
[0070] In some embodiments, in response to not receiving an end indication message, return to operation S3001. For example, after adding the device task D31 to the current task queue, the user continues to submit the device task D32 without providing an end indication message, and it can return to operation S3001.
[0071] In some embodiments, in response to receiving an end indication message, operation S3012 can be performed to end the process.
[0072] It can be understood that if after submitting device task D31, the user submits device tasks D32 and D33, device tasks D32 and D33 can be added to the current task queue to obtain the first current task queue. The manner of adding device tasks D32 and D33 to the task queue is the same as or similar to the manner of adding device task D31 to the task queue, and the present disclosure will not elaborate herein. Next, it will be described in conjunction with host task C34. For example, after receiving the host task C34 submitted by the user, operation S3001 can be executed.
[0073] In some embodiments, in response to determining that the task to be added to the current task queue is a host task, operation S3007 is executed. For example, in response to determining that the task to be added to the first current task queue is host task C34, operation S3007 can be executed.
[0074] In operation S3007, obtain a first synchronization value for the host task, a first target storage space and a second target storage space for the current task queue.
[0075] In some embodiments, when creating a task queue, a preset initial synchronization value can be used as the current value for the current task queue. In the case where no host task is added to the current task queue, the current value for the current task queue can be kept unchanged. The first synchronization value for the host task can be determined based on the current value for the current task queue. For example, the first synchronization value for host task C34 can be the preset initial synchronization value, which can be 1. Based on the first synchronization value for the host task, the first target storage space and the second target storage space for the current task queue, a first communication task and a second communication task for the host task can be generated.
[0076] In operation S3008, add the host task, the first communication task for the host task, and the second communication task for the host task to the current task queue to obtain a subsequent task queue.
[0077] For example, the first communication task for host task C34 can be the first communication primitive release(ha_1, sv_c34), and the second communication task for host task C34 can be the second communication primitive notify(stream_index’). stream_index’ can be the identifier of the first current task queue. sv_c34 can be, for example, the first synchronization value (1) for host task C34. Adding host task C34, the first communication task for host task C34, and the second communication task for host task C34 to the first current task queue can obtain a first subsequent task queue.
[0078] In operation S3009, a to-be-processed flag is set for the subsequent task queue.
[0079] In some embodiments, the to-be-processed flag may indicate that when adding a device task to the subsequent task queue, a third communication task for the device task is added. The to-be-processed flag may be determined according to the current value for the current task queue. The to-be-processed flag for the first subsequent task queue may be determined according to the first current value for the first current task queue. For example, the first current value may be the same as the first synchronization value for the host task C34 described above and may be 1.
[0080] In operation S3010, a subsequent value for the subsequent task queue is generated according to a preset value and the current value for the current task queue.
[0081] In some embodiments, the first current value and the preset value may be added together to generate a first subsequent value. For example, the first current value may be 1 and the preset value may be 1. The first subsequent value may be 2.
[0082] Next, operation S3011 may be executed to determine whether end indication information is received.
[0083] In some embodiments, in response to not receiving the end indication information, return to operation S3001. For example, after adding the host task C34 to the first current task queue, the user continues to submit a device task D35 without providing end indication information, and it may return to operation S3001. In response to determining that the task to be added to the current task queue is a device function, operation S3002 is executed. For another example, in the case where the user submits a device task D35, the first subsequent task queue described above may be used as the second current task queue.
[0084] In some embodiments, in response to determining that the current task queue has a to-be-processed flag, operation S3003 may be executed.
[0085] In operation S3003, a second synchronization value for the device task and a second target storage space for the target task queue are obtained.
[0086] In some embodiments, a third communication task for the device task can be generated according to a second synchronization value for the device task and a second target storage space for the target task queue. The second synchronization value for the device task can be obtained according to the to-be-processed tag. For example, the second synchronization value for the device task D35 can be determined by the to-be-processed tag of the second current task queue. As described above, the to-be-processed tag of the first subsequent task queue can be determined according to the first current value for the first current task queue. When the first subsequent task queue serves as the second current task queue, the second synchronization value for the device task D35 can be determined according to the first current value. The second synchronization value for the device task D35 can be the same as the first synchronization value for the host task, which is 1. It can be understood that the second current value for the second current task queue can be the first subsequent value (2) for the above-mentioned first subsequent task queue.
[0087] In operation S3004, the to-be-processed tag of the current task queue is deleted.
[0088] For example, the to-be-processed tag of the second current task queue can be deleted. Next, the device task and the third communication task for the device task can be added to the second current task queue to obtain a second subsequent task queue, which will be described in combination with operation S3005 and operation S3006.
[0089] In operation S3005, the third communication task for the device task is added to the current task queue.
[0090] For example, the third communication task for the host task D35 can be the third communication primitive acquire(ha_2, sv_d35). sv_d35 can be, for example, the second synchronization value (1) for the device task D35. The third communication task for the device task D35 can be added to the second current task queue.
[0091] In operation S3006, the device task is added to the current task queue.
[0092] For example, the device task D35 can be added to the second current task queue. After adding the device task D35 and the third communication task for the device task to the second current task queue, a second subsequent task queue can be obtained.
[0093] Next, operation S3011 can be executed to determine whether an end indication message is received.
[0094] In some embodiments, in response to receiving the end indication information, operation S3012 may be performed to end the process. For example, after submitting the device task D35, if the user does not continue to submit tasks after the first preset duration, the end indication information may be sent. After receiving the end indication information, the heterogeneous computing device may use the second subsequent task queue as the target task queue. The following will be combined with Figure 3C to further illustrate the target task queue.
[0095] Figure 3C is an execution schematic diagram of the target task queue according to an embodiment of the present disclosure.
[0096] As Figure 3C shown, the target task queue tq31 may include a target device task sub-queue tq311 and a target host task sub-queue tq312. The device side may execute the device tasks D31, D32, D33, the first communication task release_C34, the second communication task notify_C34, the third communication task acquire_D35, and the device task D35 in the target device task sub-queue tq311. The host side may receive the above target interrupt signal, read the first target storage space, and determine whether the first data in the first target storage space is greater than or equal to the first synchronization value for the host task C34. The host side may execute the host task C34 in the target host task sub-queue tq311. After executing the host task C34, the host side may write the first synchronization value for the host task C34 into the second target storage space. The device side executes the third communication task acquire_D35 to execute the device task D35 after determining that the second data in the second target storage space is greater than or equal to the second synchronization value for the device task D35.
[0097] Through the embodiments of the present disclosure, after the user submits a task, it is determined whether the task is a host task, so as to generate a communication task for the host task, which can keep the user's task submission method unchanged, reduce the user's operation difficulty, and effectively improve the user experience.
[0098] It can be understood that the target task queue has been described above. The following will further illustrate some ways for the device side to execute the target device task sub-queue.
[0099] Figure 4 is an execution flowchart of multiple device tasks according to an embodiment of the present disclosure.
[0100] In some embodiments, the first processor on the device side may include a first scheduling unit and a first execution unit. The first scheduling unit may sequentially provide the device tasks and communication tasks in the target device task sub-queue to the first execution unit so that the first execution unit executes the tasks in the target device task sub-queue. The following will be described in conjunction with operations S4101 to S4104, operations S4111 to S4112, operations S4121 to S4123, and operations S4131 to S4133. It can be understood that the description of operations S4111 to S4112 is a further description of the above operation S211. The description of operations S4121 to S4123 is a further description of the above operation S412.
[0101] In operation S4101, it is determined whether the first scheduling end information is received.
[0102] In some embodiments, in response to determining that the first scheduling end information is not received, operation S4102 is executed. For example, in the case where the first scheduling end information is not received, the first scheduling unit may provide the tasks in the above target device task sub-queue tq311 to the first execution unit so that the first execution unit executes operation S4102.
[0103] In some embodiments, in response to determining that the first scheduling end information is received, operation S4104 is executed to stop executing the tasks in the target task queue. Next, an example where the first scheduling end information is not received will be used for description.
[0104] In operation S4102, it is determined whether a device task is received.
[0105] In some embodiments, in response to receiving a device task, operation S4103 may be executed. For example, the first execution unit may receive the device task D31. Next, the first execution unit may execute operation S4103.
[0106] In operation S4103, the device task is executed.
[0107] For example, the first execution unit may execute the device task D31 to obtain the execution result of the device task D31. After executing the device task D31, it may return to operation S4101.
[0108] Next, without receiving the first scheduling end information, the first scheduling unit can provide the device task D32 in the target device task sub-queue to the first execution unit. Next, the first execution unit can execute operation S4102 and operation S4103 to obtain the execution result of the device task D32. After executing the device task D32, it can return to operation S4101. Without receiving the first scheduling end information, the first scheduling unit can provide the device task D33 in the target device task sub-queue to the first execution unit. Next, the first execution unit can execute operation S4102 and operation S4103 to obtain the execution result of the device task D33. It can be understood that in the target task queue, the tasks after the device task D33 include the host task C34. The host task C34 can be used as the target host task, and the device task D33 can be used as the first target device task.
[0109] After executing the device task D33, it can return to operation S4101. Without receiving the first scheduling end information, the first scheduling unit can provide the first communication task release_C34 in the target device task sub-queue to the first execution unit. Next, the first execution unit can execute operation S4102.
[0110] In some embodiments, in response to determining that no device task is received, operation S4131 is executed. For example, in the case of receiving the first communication task release_C34, operation S4131 can be executed.
[0111] In operation S4131, it is determined whether the third communication task is received.
[0112] In some embodiments, in response to not receiving the third communication task, operation S4111 is executed.
[0113] In operation S4111, it is determined whether the first communication task is received.
[0114] In some embodiments, in response to receiving the first communication task, operation S4112 is executed. For example, in the case of receiving the first communication task release_C34, operation S4112 can be executed.
[0115] In operation S4112, the first communication task is executed.
[0116] For example, when executing the first communication task release_C34, the first synchronization value for the host task C34 can be written into the first target storage space for the target task queue. After performing operation S4112, it is possible to return to operation S4101. Without receiving the first scheduling end information, the first scheduling unit can provide the second communication task notify_C34 in the target device task subqueue to the first execution unit. Next, the first execution unit can perform operation S4101. Upon receiving the second communication task notify_C34, the first execution unit can sequentially perform operation S4131 and operation S4111.
[0117] In some embodiments, in response to not receiving the first communication task, operation S4121 is performed. For example, when receiving the second communication task notify_C34, operation S4121 can be performed.
[0118] In operation S4121, it is determined whether the second communication task is received.
[0119] In some embodiments, in response to not receiving the second communication task, it is possible to return to operation S4101.
[0120] In some embodiments, in response to receiving the second communication task, operation S4122 is performed. For example, when receiving the second communication task notify_C34, operation S4122 can be performed.
[0121] In operation S4122, an event flag for the target task queue is set in the third target storage space in the target task queue.
[0122] For example, the third target storage space is a storage space in a register. The register includes multiple data bits. Each data bit corresponds to a target task queue. The data bit corresponding to the above-mentioned target task queue tq31 can be set to a preset event value. The preset event value can be 1, for example, and can be used as the event flag for the target task queue.
[0123] In operation S4123, the second communication task is executed.
[0124] For example, the second communication task notify_C34 can be executed to send a target interrupt signal to the host task execution device. Next, the process can return to operation S4101. In the case where the first scheduling unit has not received the first scheduling end information, the third communication task acquire_D35 in the target device task sub-queue can be provided to the first execution unit. Next, the first execution unit can sequentially execute operation S4101, operation S4102, and operation S4131. Through the embodiments of the present disclosure, after the first target device task is completed, the host side can execute the target host task, improving the execution efficiency of the task, and enabling the device task and the host task to be executed in the preset correct order, improving the accuracy of the heterogeneous computing device.
[0125] In some embodiments, in response to determining that the third communication task is received, the third communication task is executed, which will be described below in conjunction with operation S4132, operation S4133, and operation S4134.
[0126] In operation S4132, the second data is read from the second target storage space for the target task queue.
[0127] For example, in the first execution cycle, the second data can be read from the second target storage space for the target task queue tq31.
[0128] In operation S4133, it is determined whether the second data is greater than or equal to the second synchronization value for the device task.
[0129] For example, it can be determined whether the second data is greater than the second synchronization value for the device task D35.
[0130] In some embodiments, in response to determining that the second data is less than the second synchronization value for the device task, operation S4134 is executed. For example, if the second data read in the first execution cycle is less than the second synchronization value for the device task D35, operation S4134 can be executed.
[0131] In operation S4134, wait for the second preset duration.
[0132] For example, the second preset duration can be 1 microsecond. After 1 microsecond, the process can return to operation S4132 to read the second data from the second target storage space for the target task queue in the second execution cycle. Next, operation S4133 can be executed again. The second preset duration can be less than the first preset duration.
[0133] In some embodiments, in response to determining that the second data is greater than or equal to the second synchronization value for the device task, the process may return to operation S4101. For example, if the second data read in the second execution cycle is equal to the second synchronization value for device task D35, the process may return to operation S4101 so that the first scheduling unit can continue to provide the tasks in the target device task sub-queue to the first execution unit.
[0134] For another example, after returning from operation S4133 to operation S4101, the first scheduling unit may provide device task D35 in the target device task sub-queue to the first execution unit without receiving the first scheduling end information. Next, the first execution unit may perform operations S4102 and S4103 to obtain the execution result of device task D35. After executing device task D32, the process may return to operation S4101. If the user sends the first scheduling end information, operation S4104 may be performed to end the scheduling.
[0135] It can be understood that the present disclosure has been described above in conjunction with the target task queue tq31. However, the present disclosure is not limited thereto, and the following will be described.
[0136] In some embodiments, there may be at least one target task queue. For example, as described above, one target task queue may be the target task queue tq31. For another example, there may be multiple target task queues.
[0137] In some embodiments, the host task execution device includes at least one of a first target storage space and a second target storage space for the target task queue. For example, the storage unit of the host task execution device may include a first target storage space and a second target storage space for the target task queue. The storage unit of the host task execution device may be the main memory.
[0138] In some embodiments, the second data in the second target storage space is written after the target host task is executed. For example, after the host task C34 is executed as described above, the first synchronization value for the host task C34 may be written to the second target storage space.
[0139] In some embodiments, when there are multiple target task queues, the target host tasks of each of the multiple target task queues are executed by the host threads of the host task execution device. The multiple first target storage spaces for the multiple target task queues are different from each other, and the multiple second target storage spaces for the multiple target task queues are different from each other. For example, the multiple target task queues may include a first target task queue and a second target task queue. The first target storage space for the first target task queue is different from the first target storage space for the second target task queue. The second target storage space for the first target task queue is different from the second target storage space for the second target task queue. Through the embodiments of the present disclosure, since the target storage spaces for different target task queues are different, different target task queues can be executed efficiently and accurately, improving the task execution efficiency, and the computing resources of the artificial intelligence processor can also be fully utilized.
[0140] In other embodiments, the target task queue may include multiple target host tasks, and the multiple first synchronization values for the multiple target host tasks are different from each other. For example, the multiple target host tasks may include a first target host task and a second target host task. The first target host task may be, for example, the above-mentioned host task C34. The second target host task may be the host task after the device task D35. The first synchronization value for the first target host task is different from the first synchronization value for the second target host task. Thus, when the first data is equal to the first synchronization value for the first target host task and the first data is less than the first synchronization value for the second target host task, the first target host task can be executed. Through the embodiments of the present disclosure, the device tasks and host tasks can be executed in the correct order, improving the precision of the artificial intelligence processor.
[0141] In some embodiments, the first synchronization value and the second synchronization value are unsigned 64-bit integers (uint64). Thus, the problem of precision overflow can be effectively avoided.
[0142] It can be understood that the present disclosure has been described above in conjunction with the execution manner of the device task. Below, the present disclosure will be described in conjunction with the execution manner of the host task.
[0143] Figure 5 It is a schematic flowchart of a task execution method according to another embodiment of the present disclosure.
[0144] As Figure 5 shown, the method 500 may include operation S521 to operation S522. The method 500 may be executed, for example, by the host side.
[0145] In operation S521, in response to receiving a target interrupt signal, read the first data in the first target storage space corresponding to the target interrupt signal.
[0146] In an embodiment of the present disclosure, the first target storage space corresponding to the target interrupt signal is the first target storage space for the target task queue, and the first data is written when the first target device task is executed and completed.
[0147] It can be understood that the above descriptions about the target interrupt signal, the first target storage space, and the first data also apply to this embodiment, and the present disclosure will not elaborate herein.
[0148] In operation S522, according to the first data, execute the target host task.
[0149] In an embodiment of the present disclosure, the target host task is the host task after the first target device task in the target task queue. It can be understood that the above descriptions about the target host task and the first target device task also apply to this embodiment, and the present disclosure will not elaborate herein.
[0150] Through the embodiment of the present disclosure, after receiving the target interrupt signal, the host task execution device obtains the execution progress of the target task queue, and can execute the target host task according to the relationship between the first data and the first synchronization value, which can enable the device tasks and host tasks in the target task queue to be executed in the correct order, and can effectively improve the accuracy and efficiency of heterogeneous computing devices.
[0151] It can be understood that the above method 500 of the present disclosure has been described, and the method 500 will be further described below in conjunction with the above target host task sub-queue tq312.
[0152] Figure 6 It is a schematic diagram of the execution process of the host task according to an embodiment of the present disclosure.
[0153] In some embodiments, the second processor on the host side may include a second scheduling unit and a second execution unit. The second scheduling unit may provide the host tasks in the target host task sub-queue to the second execution unit so that the second execution unit executes the tasks in the target host task sub-queue. The following will be described in conjunction with operation S6201 to operation S6205, operation S6211 to operation S6212, and operation S6221 to operation S6224. It can be understood that the description of operation S6211 to operation S6212 is a further description of the above operation S521. The description of operation S6221 to operation S6224 is a further description of the above operation S522.
[0154] In operation S6201, determine whether the second scheduling end information is received.
[0155] In some embodiments, in response to not receiving the second scheduling end information, operation S6202 is performed. For example, in the case of not receiving the second scheduling end information, the second scheduling unit may provide the tasks in the above-mentioned target host task sub-queue tq312 to the second execution unit so that the second execution unit performs operation S6202.
[0156] In some embodiments, in response to determining that the second scheduling end information is received, operation S6205 is performed to stop executing the tasks in the target task queue. Next, an example of not receiving the second scheduling end information will be described.
[0157] In operation S6202, it is determined whether a host task is received.
[0158] In some embodiments, in response to determining that a host task is received, operation S4103 may be performed. For example, the second execution unit may receive host task C34. Next, the second execution unit may perform operation S6203.
[0159] In operation S6203, a first target storage space, a second target storage space for the target task queue, and a first synchronization value for the host task are obtained.
[0160] In some embodiments, a target host task staging linked list is set on the host side. The host linked list data can be determined according to the first target storage space, the second target storage space for the target task queue, and the first synchronization value for the host task. For example, according to the first target storage space, the second target storage space for target task queue tq31, the task description data of host task C34, and the first synchronization value for host task C34, the host linked list data of host task C34 is generated.
[0161] In operation S6204, the host linked list data is added to the target host task staging linked list.
[0162] For example, the host linked list data of host task C34 can be added to the end of the target host task staging linked list. Next, operation S6201 can be returned. In the case of not receiving the second scheduling end information, operation S6202 can be performed.
[0163] In some embodiments, in response to not receiving a host task, operation S6211 is performed.
[0164] In operation S6211, it is determined whether an interrupt signal is received.
[0165] In some embodiments, in response to not receiving an interrupt signal within a preset interrupt signal waiting duration, the process may return to operation S6201. For example, the target interrupt signal for the target task queue tq31 is sent after the execution of the above-mentioned second communication task notify_D33. During the execution of device task D31, device task D32, device task D33, first communication task release_D33, and second communication task notify_D33 on the device side, the second execution unit may execute operation S6211 multiple times and return to operation S6201 multiple times.
[0166] In some embodiments, in response to receiving an interrupt signal within a preset interrupt signal waiting duration, operation S6212 may be executed. For example, after the execution of the second communication task notify_D33, the host side may receive the target interrupt signal sent by the device side and may execute operation S6222.
[0167] In operation S6212, read the first data in the first target storage space corresponding to the target interrupt signal. For example, the target interrupt signal may cause the second execution unit to query the third target storage space. The second execution unit may determine that the data bit corresponding to the target task queue tq31 is a preset event value. Thus, the second execution unit may determine that a preset event has occurred in the target task queue tq31 and may read the first target storage space for the target task queue tq31. It can be understood that the preset event may be the completion of the execution of device task D33.
[0168] Next, operation S6221 may be executed to determine whether the first data is greater than or equal to the first synchronization value for the host task.
[0169] In some embodiments, in response to determining that the first data is greater than or equal to the first synchronization value for the host task, operation S6222 may be executed. For example, the second execution unit may obtain the first synchronization value for the host task C34 from the above-mentioned target host task staging linked list to execute operation S6221. If the first data is equal to the first synchronization value for the host task C34, operation S6222 may be executed.
[0170] In operation S6222, execute the host task.
[0171] For example, the second execution unit may obtain the task description data of the host task C34 from the above-mentioned target host task staging linked list to execute the host task C34 and obtain the execution result of the host task C34. In response to determining that the target host task has been executed, write the first synchronization value for the target host task to the second target storage space for the target task queue, which will be described in conjunction with operation S6223 below.
[0172] In operation S6223, a first synchronization value for a host task is written to a second target storage space for a target task queue.
[0173] For example, a first synchronization value for host task C34 can be written to a second target storage space for target task queue tq31. It can be understood that the indication of the first target storage space and the second target storage space for the target task queue can be obtained from the above-mentioned target host task staging linked list.
[0174] In operation S6224, the host linked list data for the host task is deleted from the target host task staging linked list. For example, after host task C34 is executed, the host linked list data of host task C34 can be deleted. Next, operation S6201 can be returned. If the second scheduling end information provided by the user is received, operation S6205 can be executed to stop the execution of tasks in the target task queue.
[0175] It can be understood that the above description of the present disclosure is made by taking the target host task between the first target device task and the second target device task as an example of one. However, the present disclosure is not limited thereto, and the following will be described.
[0176] In some other embodiments, the target task queue may include multiple target host tasks. For example, the multiple target host tasks may include a first target host task and a second target host task. The first target host task may be, for example, the above-mentioned host task C34. The second target host task may be the host task after device task D35. The first synchronization value for the first target host task is different from the first synchronization value for the second target host task. Thus, when performing the above operation S6221, it can be determined that the first data is equal to the first synchronization value for the first target host task, or it can be determined that the first data is less than the first synchronization value for the second target host task. Next, when performing operation S6222, the first target host task can be executed.
[0177] In some other embodiments, there may be multiple target host tasks between the first target device task and the second target device task.
[0178] It can be understood that the method of the present disclosure has been described above, and the apparatus of the present disclosure will be described below.
[0179] Figure 7 is a block diagram of a task execution apparatus according to an embodiment of the present disclosure.
[0180] As Figure 7 shown, the apparatus 710 may include a first scheduling unit 7111 and a first execution unit 7112.
[0181] The first scheduling unit 7111 is configured to provide at least one device task and a plurality of communication tasks in the target task queue to the first execution unit. The at least one device task includes a first target device task, and the plurality of communication tasks includes a first communication task for the first target device task and a second communication task for the first target device task.
[0182] The first execution unit 7112 is configured to: when the first target device task in the target task queue is completed, execute the first communication task for the target host task. The target host task is the host task after the first target device task in the target task queue, and the first communication task is used to write a first synchronization value for the target host task to a first target storage space for the target task queue. Execute the second communication task for the target host task. The second communication task is used to instruct the first task execution device to read first data in the first target storage space for the target task queue, and the host task execution device is used to execute the target host task according to the first data and the first synchronization value.
[0183] In some embodiments, the second communication task is used to send a target interrupt signal for the target task queue to the host task execution device, and the target interrupt signal is used to instruct the host task execution device to read first data in the first target storage space for the target task queue, and the target host task is executed when the first data is not less than the first synchronization value for the target host task.
[0184] In some embodiments, the first execution unit is further configured to: according to the execution result of a third communication task for a second target device task, execute the second target device task. The second target device task is a device task after the target host task in the target task queue.
[0185] In some embodiments, the third communication task is used to instruct to read at least one second data from a second target storage space for the target task queue in at least one execution cycle, and determine whether the second data is not less than a second synchronization value for the second target device task in the execution cycle. The execution result of the third communication task includes at least one execution sub-result, and the at least one execution sub-result includes a first execution sub-result and a second execution sub-result. The first execution sub-result is used to indicate that the second data is not less than the second synchronization value, and the second execution sub-result is used to indicate that the second data is less than the second synchronization value.
[0186] In some embodiments, the first execution unit is further configured to perform the following operations to execute the second target device task according to the execution result of the third communication task for the second target device task: in response to determining that the execution result of the third communication task includes the first execution sub-result in the current execution cycle, execute the second target device task.
[0187] In some embodiments, the target task queue is obtained based on at least one of a device task, a host task, a first communication task, a second communication task, and a third communication task.
[0188] In some embodiments, the target task queue is obtained based on at least one of a device task, a host task, a first communication task, a second communication task, and a third communication task through the following operations: In response to determining that the task to be added to the first current task queue is a host task, add the host task, the first communication task for the host task, and the second communication task for the host task to the first current task queue to obtain a first subsequent task queue. Set a to-be-processed flag for the first subsequent task queue. The to-be-processed flag is used to indicate that when a device task is added to the first subsequent task queue, add the third communication task for the device task.
[0189] In some embodiments, the target task queue is obtained based on at least one of a device task, a host task, a first communication task, a second communication task, and a third communication task through the following operations: In response to determining that the task to be added to the second current task queue is a device task and determining that the second current task queue has a to-be-processed flag, delete the to-be-processed flag of the second current task queue. Add the device task and the third communication task for the device task to the second current task queue to obtain a second subsequent task queue.
[0190] In some embodiments, the target task queue, the first target device task, and the target host task are each at least one. The host task execution device includes at least one of a first target storage space and a second target storage space for the target task queue, and the second data in the second target storage space is written after the target host task is executed.
[0191] In some embodiments, there are multiple target task queues, and the target host tasks of the multiple target task queues are executed by the host threads of the host task execution device. The multiple first target storage spaces for the multiple target task queues are different from each other, and the multiple second target storage spaces for the multiple target task queues are different from each other.
[0192] In some embodiments, the target task queue includes multiple target host tasks, and the multiple first synchronization values for the multiple target host tasks are different from each other.
[0193] Figure 8 It is a block diagram of a task execution device according to another embodiment of the present disclosure.
[0194] As Figure 8 shown, the device 820 may include a second scheduling unit 8221 and a second execution unit 8222.
[0195] The second scheduling unit 8221 is configured to: provide at least one host task in the target task queue to the second execution unit.
[0196] The second execution unit 8222 is configured to: in response to receiving a target interrupt signal, read first data in a first target storage space corresponding to the target interrupt signal. The first target storage space corresponding to the target interrupt signal is the first target storage space for the target task queue, and the first data is written when the first target device task is executed. According to the first data, execute the target host task. The target host task is the host task after the first target device task in the target task queue.
[0197] In some embodiments, according to the first data, executing the target host task includes: in response to determining that the first data is not less than a first synchronization value for the target host task, executing the target host task.
[0198] In some embodiments, the second execution unit is further configured to: in response to determining that the target host task is executed, write a first synchronization value for the target host task to a second target storage space for the target task queue.
[0199] It can be understood that the above describes the apparatus of the present disclosure, and the following will describe the device of the present disclosure.
[0200] Figure 9 is a schematic block diagram of a task execution device according to an embodiment of the present disclosure.
[0201] As Figure 9 shown, the device 90 may include a device task execution device 910 and a host task execution device 920. The device task execution device 910 may be the above-mentioned device 710. The host task execution device may be the above-mentioned device 820.
[0202] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.
[0203] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0204] Figure 10FIG. shows a schematic block diagram of an exemplary electronic device 1000 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0205] As Figure 10 shown, the device 1000 includes a computing unit 1001 that can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0206] A plurality of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a magnetic disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0207] The computing unit 1001 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 executes the various methods and processes described above, such as the task execution method. For example, in some embodiments, the task execution method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the task execution method described above can be executed. Alternatively, in other embodiments, the computing unit 1001 can be configured to execute the task execution method by any other suitable means (e.g., by means of firmware).
[0208] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard parts (ASSPs), system on chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0209] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, executed partially on the machine as an independent software package and partially on a remote machine, or executed entirely on a remote machine or server.
[0210] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories (EPROMs) or flash memories, optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0211] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a cathode ray tube (CRT) display or a liquid crystal display (LCD)); and a keyboard and a pointing device (e.g., a mouse or a trackball), by which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0212] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: a Local Area Network (LAN), a Wide Area Network (WAN), and the Internet.
[0213] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship between the client and the server is generated by computer programs that run on the respective computers and have a client-server relationship with each other.
[0214] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitation is imposed herein.
[0215] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A task execution method, comprising: When the first target device task in the target task queue is completed, execute a first communication task for the target host task, where the target host task is the host task after the first target device task in the target task queue, and the first communication task is used to write a first synchronization value for the target host task to a first target storage space for the target task queue; Execute a second communication task for the target host task, where the second communication task is used to instruct a first task execution device to read first data from a first target storage space for the target task queue, and the host task execution device is used to execute the target host task according to the first data and the first synchronization value.
2. The method according to claim 1, wherein, The second communication task is used to send a target interrupt signal for the target task queue to the host task execution device, and the target interrupt signal is used to instruct the host task execution device to read first data from a first target storage space for the target task queue, and the target host task is executed when the first data is not less than the first synchronization value for the target host task.
3. The method according to claim 1, further comprising: Execute the second target device task according to the execution result of a third communication task for the second target device task, where the second target device task is the device task after the target host task in the target task queue.
4. The method according to claim 3, wherein, The third communication task is used to instruct: read at least one second data from a second target storage space for the target task queue in at least one execution cycle, and determine whether the second data is not less than a second synchronization value for the second target device task in the execution cycle, The execution result of the third communication task includes at least one execution sub-result, and the at least one execution sub-result includes a first execution sub-result and a second execution sub-result. The first execution sub-result is used to indicate that the second data is not less than the second synchronization value, and the second execution sub-result is used to indicate that the second data is less than the second synchronization value.
5. The method according to claim 4, wherein, The executing the second target device task according to the execution result of the third communication task for the second target device task includes: In response to determining that the execution result of the third communication task includes a first execution sub-result in the current execution cycle, execute the second target device task.
6. The method according to claim 3, wherein, The target task queue is obtained according to at least one of a device task, a host task, a first communication task, a second communication task, and a third communication task.
7. The method according to claim 6, wherein, The target task queue is obtained according to at least one of a device task, a host task, a first communication task, a second communication task, and a third communication task through the following operations: In response to determining that the task to be added to the first current task queue is the host task; Add the host task, the first communication task for the host task, and the second communication task for the host task to the first current task queue to obtain a first subsequent task queue; Set a to-be-processed flag for the first subsequent task queue, where the to-be-processed flag is used to indicate that when adding the device task to the first subsequent task queue, a third communication task for the device task is added.
8. The method according to claim 6, wherein, The target task queue is obtained based on at least one of a device task, a host task, a first communication task, a second communication task, and a third communication task through the following operations: In response to determining that the task to be added to the second current task queue is the device task and determining that the second current task queue has a to-be-processed flag, delete the to-be-processed flag of the second current task queue; Add the device task and the third communication task for the device task to the second current task queue to obtain a second subsequent task queue.
9. The method according to claim 1, wherein The target task queue, the first target device task, and the target host task are each at least one. The host task execution device includes at least one of the first target storage space and the second target storage space for the target task queue, and the second data in the second target storage space is written after the target host task is executed.
10. The method according to claim 9, wherein, There are multiple target task queues, and the target host tasks of the multiple target task queues are executed by the host threads of the host task execution device. The multiple first target storage spaces for the multiple target task queues are different from each other, and the multiple second target storage spaces for the multiple target task queues are different from each other.
11. The method according to claim 9, wherein, The target task queue includes multiple target host tasks, and the multiple first synchronization values for the multiple target host tasks are different from each other.
12. A task execution method, including: In response to receiving a target interrupt signal, read first data in a first target storage space corresponding to the target interrupt signal, where the first target storage space corresponding to the target interrupt signal is the first target storage space for the target task queue, and the first data is written when a first target device task is executed; Execute a target host task according to the first data, where the target host task is the host task after the first target device task in the target task queue.
13. The method according to claim 12, wherein, The executing the target host task according to the first data includes: In response to determining that the first data is not less than the first synchronization value for the target host task, execute the target host task.
14. The method according to claim 12, further including: In response to determining that the target host task is executed, write the first synchronization value for the target host task to the second target storage space for the target task queue.
15. A task execution device, including: A first scheduling unit configured to provide at least one device task and multiple communication tasks in a target task queue to a first execution unit, where at least one of the device tasks includes a first target device task, and the multiple communication tasks include a first communication task for the first target device task and a second communication task for the first target device task; A first execution unit configured to: When the execution of the first target device task in the target task queue is completed, execute a first communication task for a target host task, where the target host task is the host task following the first target device task in the target task queue, and the first communication task is used to write a first synchronization value for the target host task to a first target storage space for the target task queue; Execute a second communication task for the target host task, where the second communication task is used to instruct a first task execution device to read first data from the first target storage space for the target task queue, and the host task execution device is used to execute the target host task according to the first data and the first synchronization value.
16. A task execution device, comprising: A second scheduling unit configured to: provide at least one host task in a target task queue to a second execution unit; A second execution unit configured to: In response to receiving a target interrupt signal, read first data in a first target storage space corresponding to the target interrupt signal, where the first target storage space corresponding to the target interrupt signal is the first target storage space for the target task queue, and the first data is written when the execution of a first target device task is completed; Execute a target host task according to the first data, where the target host task is the host task following the first target device task in the target task queue.
17. A task execution device, comprising a device task execution device and a host task execution device, where the device task execution device is the device according to claim 15, and the host task execution device is the device according to claim 16.
18. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1 to 14.
19. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 14.
20. A computer program product, comprising a computer program, where the computer program, when executed by a processor, implements the method according to any one of claims 1 to 14.