Task processing method, device, computer equipment and storage medium

By adopting task group processing methods in a multi-device interconnection system, using task templates and communication descriptors to realize chain execution of task chains, the problem of low data transmission efficiency between NPU chips is solved, and computing efficiency and data transmission efficiency are improved.

CN113835848BActive Publication Date: 2025-03-18SHANGHAI CAMBRICON INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010586332.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-24
Publication Date
2025-03-18
Estimated Expiration
2040-09-16

AI Technical Summary

Technical Problem

The prior art cannot effectively support efficient data transmission between NPU chips, resulting in poor computing efficiency.

Method used

By introducing a task group processing method in a multi-device interconnection system, the task template and communication descriptor are used to realize the chain execution of the task chain, and the next task is directly started, thereby improving data transmission efficiency.

Benefits of technology

It realizes efficient data transmission in collaborative processing of multiple devices, improves task processing efficiency, and reduces interaction between devices and hosts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113835848B_ABST
    Figure CN113835848B_ABST
Patent Text Reader

Abstract

The present application relates to a task processing method, system, computer device and storage medium. The method includes: in the above-mentioned task processing method, by improving the task template, multiple tasks are executed uninterruptedly, and the next task is automatically jumped to be processed after the previous task is completed, which can improve the data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of chip technology, and in particular to a task processing method, apparatus, computer equipment and storage medium. Background Art

[0002] With the development of artificial intelligence technology, CPUs can no longer meet the computing needs of existing algorithms, and neural network dedicated chips have emerged. Practice has proved that artificial intelligence computing tasks have unique data structures, storage methods, computing modes, etc. compared to general processing tasks or image processing tasks. Therefore, dedicated integrated circuits can be designed to reallocate chip computing resources for artificial intelligence computing tasks to achieve low power consumption, low latency, and high throughput computing. NPU (Neural network Processing Unit) is a dedicated integrated circuit that can implement artificial intelligence computing tasks, such as neural network computing, and has the characteristics of low power consumption, high efficiency, and small area.

[0003] According to Moore's Law and Dennard Scaling Law, the computing power of a single-core high-performance processor will reach a bottleneck due to physical limitations. In order to improve computing parallelism, the industry's chip design has gradually turned to multi-core high-efficiency processor design. Not only that, with the development of high-performance computers and data centers, more and more computing resources are being concentrated, and multi-chip collaborative processing has become the norm. In order to achieve high processing performance and highly scalable AI processing systems based on NPUs, efficient data transmission needs to be supported between NPU chips.

[0004] However, there is currently no method or device that can support efficient data transmission between NPU chips. Summary of the invention

[0005] Based on this, it is necessary to provide a task group processing method, device, computer equipment and storage medium that can efficiently transmit data between devices in response to the above technical problems.

[0006] A task group processing method, wherein the task group includes a task chain formed by at least one task; the method comprises:

[0007] If the current task is successfully executed, then according to the task template of the current task, a next task template of the next task of the current task is determined to start the next task;

[0008] According to the next task template, task information of the next task is acquired to process the next task, wherein the task information of the next task is used to execute the next task.

[0009] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any one of the above methods when executing the computer program.

[0010] A system includes at least one device, wherein data can be transmitted between the devices, and each device in the system can execute the steps of any of the above methods.

[0011] In one embodiment, the device includes a combination of one or more of a chip, a board, a processor, or a processor core.

[0012] A computer-readable storage medium stores a computer program, which implements the steps of any of the above methods when executed by a processor.

[0013] The above-mentioned task group processing method, device, computer equipment and storage medium, the task group includes a task chain formed by at least one task; the method includes: if it is determined that the current task is successfully executed, then according to the task template of the current task, determine the next task template of the next task of the current task; according to the next task template, obtain the task information of the next task, wherein the task information of the next task is used to execute the next task. After executing the current task, the method directly starts the next task, thereby realizing the chain execution of multiple tasks in the task group, and improving the task processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 A schematic diagram of a multi-device interconnection system in one embodiment;

[0015] Figure 2 is a schematic diagram of a multi-device interconnection system in one embodiment, which shows the structure of the task processing system in each device;

[0016] Figure 3 is a schematic diagram of a second storage space in one embodiment;

[0017] Figure 4 is a schematic diagram of a first storage space in an embodiment;

[0018] Figure 5 is a flowchart of a task processing method in one embodiment;

[0019] Figure 6 is a schematic diagram of a data communication process in one embodiment;

[0020] Figure 7 A flowchart of a task group processing method in one embodiment;

[0021] Figure 8 A flowchart of a task group processing method in one embodiment;

[0022] Fig. 9 A flowchart of a task destruction method in an embodiment;

[0023] Fig.10 A flowchart of a task destruction method in an embodiment;

[0024] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0026] When the amount of data is large, it is difficult to meet the requirements of the operation by using a single device for calculation, and the calculation efficiency is low. Therefore, when the amount of data is large, the operation can be achieved by the collaboration of multiple devices. For example, when the device participates in neural network-related operations, such as multiple devices collaborate to implement neural network training, due to the large amount of data involved in the neural network training process, the corresponding operation can be achieved through the collaboration of multiple devices. However, the collaborative operation between multiple devices will inevitably involve communication and data exchange between devices. Since frequent communication or data exchange is required between devices, it usually brings about problems such as calculation delays, resulting in poor calculation efficiency. Based on this, the present application provides a system for interconnecting multiple devices and a task processing method for collaborative calculation of multiple devices. For details, please refer to the description below.

[0027] Figure 1 and Figure 2 It is a schematic diagram of a multi-device interconnection system. Among them, device 0, device 1, device 2 and device 3 can realize data transmission between devices through the task processing system. The device can be a chip, a board, a processor or a processor core, and the device for communication between devices includes but is not limited to realizing data exchange between chips, between boards, and between processors or processor cores. Optionally, the device can be a chip including an artificial intelligence processor (IPU), wherein the artificial intelligence processor includes but is not limited to an accelerated processor APU (Accelerated Processing Unit), a graphics processor GPU (Graphics Processing Unit), a neural network processor NPU (neural-network processing units) and other artificial intelligence processors. The chip may also include other structures such as CPU and storage, which are not specifically limited here.

[0028] Optionally, Figure 1 and Figure 2 Each device in the system includes a task processing system, which may include a set of sending devices and receiving devices. Figure 1 Each line in (A) is a duplex C2C interface (Chip to Chip Interface), with a transmitter and a receiver at each end of the line. Optionally, there are 8 channels in each direction of the duplex. The specific structure of the task processing system in each device can be found in Figure 2 It should be noted that Figure 1 and Figure 2 The system includes four devices as an example, which is not intended to limit the number of devices in the system. In a possible embodiment, the number of devices in the system may be more than two, which is not specifically limited here.

[0029] like Figure 2 As shown, device 0, device 1, device 2, and device 3 may all be connected to the host. Each device may include a task processing system 200, and the task processing system 200 on each device may include a memory 210, a task processing device 230, and a communication module for data communication between devices, and the communication module may include a sending device 220 and a receiving device 240. The sending device 220 is used to send data on the device to other devices, and the receiving device 240 is used to receive data transmitted by other devices.

[0030] Optionally, Figure 1 and Figure 2 The devices in a system can communicate in two ways:

[0031] Mode 1: Realize inter-device communication through the host (normal transmission mode). This mode is the communication between the device and the host, which is used to transmit normal data between the devices, and the transmission control instructions come from the host. For example, when realizing data transmission between device 0 and device 1 through mode 1, the host first controls the sending device 220 of device 0 to send relevant data to device 1, and the receiving device 240 of device 1 returns status information to the host after receiving the relevant data. That is, in the case of mode 1, data transmission between different devices requires frequent intervention of the host.

[0032] Mode 2: Each device automatically triggers the communication module thereon to realize inter-device communication (hardware acceleration mode). Specifically, when realizing data transmission between devices through mode 2, it is only necessary to intervene through the host at the beginning stage, and then each device can automatically trigger the communication module thereon to perform data communication between the devices, without the intervention of the central processing unit, thereby speeding up the data transmission efficiency. For example, when realizing data transmission between device 0 and device 1 through mode 2, the host first controls the sending device 220 of device 0 to send relevant data to device 1, and after receiving the relevant data, the receiving device 240 of device 1 can directly trigger the sending device 220 of device 1 to transmit the relevant data to device 2. For another example, when realizing data transmission between device 0 and device 1 through mode 2, the central processing unit first controls the sending device 220 of device 0 to send relevant data to device 1, and after receiving the relevant data, the receiving device 240 of device 1 can trigger the sending device 220 of device 1 to transmit the relevant data to device 2 according to the status information.

[0033] The embodiment of the present application mainly combines the hardware acceleration mode shown in the above-mentioned method 2 to illustrate the task processing method of the present application. In the hardware acceleration mode, when a task requires collaboration between multiple devices, such as when multiple devices are required to collaborate to complete a neural network training task, a task identifier (Task id) can be assigned to the task, and the task identifier can be used as a unique identifier for the task in the multi-device interconnected system. When the task is collaboratively processed between multiple devices, multiple devices can configure the task identifier (Task id).

[0034] Optionally, the data involved in the task (including input data involved in the calculation, intermediate result data, calculation result data, etc.) can be transmitted between multiple devices. Furthermore, the data involved in the task can include communication data, and the task processing system on each device can determine the task information of the task based on the communication data. For example, the task processing system on each device can enable each device to perform data transmission according to the above-mentioned hardware acceleration mode based on the communication data, and automatically transfer the data on the device to the next device. The task processing system on each device can also determine the task information of the task based on the communication data, and execute the task according to the task information of the task to obtain the execution result of the task. Among them, the task information of the task can include data information of the data involved in the task (such as the storage address of the data), the task scale of the task, and the required processor resource information, etc.

[0035] Optionally, the communication data may be a communication descriptor, wherein the communication descriptor (communication data) may include: a task identifier (task id) and information such as the source address and destination address of the data involved in the task. Each device may obtain the data involved in the task from the memory according to the communication descriptor it obtains. Optionally, the communication descriptor may also include a task template identifier of the corresponding task template, and the task processing system of each device may also obtain the corresponding task template according to the communication descriptor, thereby determining the processing information of the task according to the task template and the communication descriptor. Among them, the task template may be used to identify the task processing method of each task (such as the operation or forwarding operation to be included in the task) and other related information, and the task template may be configured by the driver software to the task processing system of the device before the task processing is performed. Optionally, the task template may include: task weight, data information, task type, identifier of the next task template, task chain identifier and other information.

[0036] Furthermore, when the scale of the task is large, the task can be split to complete the data transmission of the task between devices in batches. In an embodiment of the present application, each task may include at least one subtask (descriptor), and each subtask may be split into at least one communication slice. At this time, the communication descriptor may also include information on the number of task splits (such as the number of splits, the size of each data block, the index step of the split data block, etc.), etc. Optionally, the task of each device can be further decomposed into at least one communication slice (transfer), at which time, multiple devices can perform data transmission according to the communication slice. The communication slice can be a single transmission with a communication descriptor and data, and the size of the data in each communication slice can be equal to the size of each data block obtained by the split. Among them, the data blocks contained in each communication slice can be recorded through the data information of the communication slice, and the data information of the communication slice is used to represent the shape information and address information of the data blocks in the communication slice (such as the target address, such as Figure 4 Specifically, the shape information of the data block may include information such as the data block size, the data block number, and the data block step size.

[0037] Furthermore, each communication slice may have a slice identifier (transfer id), and the slice identifiers of multiple communication slices in the same task may be monotonically increasing. The following will explain the multi-device collaborative execution process of a task in conjunction with the structure of a multi-device interconnection system.

[0038] Alternatively, if Figure 2As shown, the memory 210 on each device can be used to store data involved in the task (including input data involved in the operation, intermediate result data, and operation result data, etc.) and data information corresponding to the data (including destination address, etc.), device status data, communication descriptors, and task templates. Optionally, the memory can be DRAM (Dynamic Random Access Memory). In other possible embodiments, the memory can be other memories other than DRAM, which is not specifically limited here. Further optionally, the first storage space and the second storage space can be determined by a software program (such as a driver). Further, the memory 210 may include a first storage space and a second storage space, wherein the first storage space is used to store data information of the communication slice, and the second storage space is used to store device status data.

[0039] When multiple devices perform data transmission according to communication slices, in order to facilitate data access, the data in the first storage space and the second storage space of the memory may be stored according to the slice identifier of each communication slice. Figure 3 As shown, the device status data in the second storage space may be stored according to the transmission status of the communication slice. Figure 4 As shown, the first storage space may be a two-dimensional storage space, wherein the vertical direction of the first storage space may represent different communication slices (slice identifiers are represented as t0~t63), and the horizontal direction of the second storage space may represent different devices (chip0~chip5). It should be clear that Figure 3 and 4 The data storage method is only illustrated by taking 64 slices and 6 devices as an example, and is not used to limit the specific number of communication slices and devices.

[0040] When data needs to be transmitted between devices, the sending device on each device can send the communication slice to its corresponding target receiving device, where the target receiving device can be more than one. Each device can also update the device status data in the second storage space and the data information at the corresponding position in the first storage space accordingly after the transmission is completed. Please refer to the description below for details.

[0041] Optionally, the receiving device 240 and the sending device 220 on each device are used to realize data transmission between different devices. For ease of description, the embodiment of the present application records the sending end of data as the sending device and the receiving end of data as the target receiving device. When performing task transmission between multiple devices, data transmission and reception of multiple devices can be carried out simultaneously, and the same device can be used as a sending device or a receiving device. Among them, the sending device 220 is used to send data to the target receiving device, and the receiving device 240 of the target receiving device is used to receive data sent by the sending device. For example, Figure 2 Device 0 can be used as the sending device, and its corresponding target receiving device can be device 1. For example, Figure 2 The device 1 in the figure can be used as a sending device, and its corresponding target receiving device can be device 2. This is only an example and will not be described in detail.

[0042] Specifically, before data communication is performed between multiple devices, the sending device 220 of the sending device may divide the task into multiple communication slices, and the devices may transmit according to the communication slices. Specifically, the sending device 220 of the sending device may divide the task into at least one communication slice according to the splitting information contained in the communication descriptor, and the data information of the data blocks corresponding to the multiple communication slices may be stored in the first storage space. The specific storage method may be referred to in Figure 4 As shown. When data is transmitted between devices, the sending device 220 of the sending device can transmit the communication slices to the target receiving device in batches. After receiving the communication slices, the target receiving device can also update the data information of the data blocks in the first storage space and the device status data in the second storage space accordingly. Optionally, the target receiving device can calculate and obtain the corresponding communication slice identifier, and update the corresponding positions of the data information in the first storage space and the device status data in the second storage space according to the communication slice identifier and the device identifier.

[0043] Further optionally, the target receiving device may calculate the communication slice identifier as follows:

[0044] transfer_id=(dst_data_addr-dst_data_base_addr) / segment_stride / segment_number;

[0045] Among them, dst_data_addr can refer to the target address of the current communication slice, which can be included in the communication descriptor; dst_data_base_addr refers to the starting address of the data block storage in the current communication slice; segment_stride refers to the index step corresponding to the data block in the current communication slice; segment_number refers to the number of splits of the data block obtained by splitting the task.

[0046] Further optionally, the target receiving device can determine the offset c2c_data_info_addr (such as Figure 4 As shown), the data information at the corresponding position in the first storage space can be updated according to the offset.

[0047] For example, before data transmission between devices, the sending device of the sending device may split the task into 64 communication slices, and divide the 64 communication slices into Figure 4 The 64 communication slices are stored in the first storage space in the manner shown, and can be transmitted between devices. The transmission process of communication slice t0 is used below to illustrate the data transmission between devices. Other communication slices between devices are similar to the communication slice t0 and will not be described one by one.

[0048] If the sending device is chip0 (chip0 can be Figure 2 The target receiving device is chip1 (chip1 can be Figure 2 In the device 1, the sending device chip0 can obtain the data block corresponding to the communication slice t0 from the memory 210 according to the communication descriptor, and bind the communication descriptor and the corresponding data block as the communication slice t0 and send it to the target receiving device chip1. Afterwards, when the target receiving device chip1 successfully receives the communication slice t0, the device state of the second storage space and the data information of the communication slice of the first storage space can be updated accordingly. Specifically, the Figure 3 The value of position 1 in the array represented by lock_status in the first row of the second storage space in . You can also update Figure 4 chip1_data_info in the first row and first column of the first storage space.

[0049] Optionally, the receiving device 240 on each device can be used to receive and store the communication slices transmitted by the sending device. When the receiving device 240 receives all the data, the task processing device 230 can be started so that the task processing device 230 can perform the corresponding task according to the data received by the receiving device and obtain the execution result of the task. Specifically, the task processing device 230 can obtain the corresponding task template according to the received communication descriptor, bind the communication descriptor and the task template to obtain the task information of the current task, and schedule the current task for execution according to the task information of the current task to obtain the execution result. Among them, the task template may include: task weight, data information, task type, identification of the next task template, task chain identification bit and other information, and the task template may be configured in the task processing device 230 by software.

[0050] Optionally, the task processing device 230 on each device may include a task scheduling device and an artificial intelligence processor. The task scheduling device may obtain a corresponding task template according to the above communication descriptor, and bind the communication descriptor and the corresponding task template to obtain task information. The task information of the task may include data information of the data involved in the task (such as the storage address of the data), the task scale of the task, and the required processor resource information, etc.

[0051] Furthermore, when the task requires the artificial intelligence processor to perform calculations, the task scheduling device can also schedule the task according to the task information to determine which processor cores of the artificial intelligence processor participate in the calculation. Specifically, the task scheduling device schedules the task according to the task information using a preset scheduling algorithm to obtain scheduling information. The artificial intelligence processor can perform related operations according to the scheduling information transmitted by the task scheduling device. The related operations may include reduce operations, all-reduce operations, reduce-scatter operations, all-gather operations, etc., which are not specifically limited here.

[0052] Optionally, the task processing device 230 can be used to trigger the action of the sending device on the device, so as to realize tasks such as forwarding data between the sending device and the receiving device on the same device and broadcasting or distributing data between different devices. Such data forwarding, broadcasting or distribution tasks do not require the artificial intelligence processor to perform related operations such as merging. The task template includes a first forwarding flag and a first forwarding path configured by software (the first forwarding path may include the identifier of the next target receiving device, etc.). Optionally, there may be more than one next target receiving device for each device, and the task scheduling device may determine which next target receiving devices each device needs to send data to through the identifier of the next target receiving device in its task template.

[0053] Specifically, the receiving device 240 on each device can transmit the communication descriptor to the task scheduling device, and the task scheduling device can obtain the corresponding task template according to the communication descriptor, and trigger the action of the sending device 220 on the device according to the task template, so as to send the communication data or the operation result and other data to the target receiving device through the sending device 220. Specifically, the task scheduling device can determine whether to trigger the action of the sending device 220 on the device according to the first forwarding flag in the task template, so as to send the received communication slice or the designated data such as the operation result to the next target receiving device through the sending device 220. When the first forwarding flag in the task template is the first flag value (such as 1), the task scheduling device can trigger the action of the sending device 220 on the device. When the first forwarding flag in the task template is the second flag value (such as 0), the task scheduling device will not trigger the action of the sending device 220 on the device. In the embodiment of the present application, the task scheduling device automatically triggers the forwarding operation of the sending device on the device according to the communication descriptor and its corresponding task template, thereby reducing the interaction between the device and the host, and improving the processing efficiency of the task.

[0054] Optionally, when data broadcasting or distribution is performed between various devices, the first forwarding flag bit can be set to the first flag bit, so that the artificial intelligence processor does not need to be started. Furthermore, when data broadcasting or distribution is performed between various devices, when the target receiving device successfully receives the data transmitted by the sending device, it can be determined that the current broadcast or distribution task is successfully executed; otherwise, it can be determined that the current broadcast or distribution task fails to execute.

[0055] Optionally, the task processing device 230 can also trigger the artificial intelligence processor on the device to start the operation. Specifically, the receiving device 240 on the device can transmit the communication descriptor to the task scheduling device, and the task scheduling device can obtain the corresponding task template according to the communication descriptor, and trigger the artificial intelligence processor on the same device to start according to the task template, and the artificial intelligence processor performs operations according to the corresponding data block. Optionally, the artificial intelligence processor can read the corresponding data block from the memory according to the destination address of the data block, and perform operations according to the data block. The operation can be a merge operation (Reduce), a full merge operation (All reduce), a scatter merge operation (Reduce-scatter), a full gather (All-gather), etc., which are not specifically limited here.

[0056] Furthermore, before triggering the start of the artificial intelligence processor, it is necessary to determine whether the device has received all the data involved in the operation, that is, before performing the operation, it is necessary to determine whether the data involved in the operation is complete. That is, after the sending device on the device receives all the data required to perform the task, the kernel function is configured to transmit information to the task scheduling device, and the task scheduling device starts and triggers the start of the artificial intelligence processor, so that the artificial intelligence processor performs the above-mentioned task. Among them, the kernel function transmission information may include the communication descriptors of each received communication slice.

[0057] For example, Figure 2 When the data on each device 0-3 needs to be sent to device 0 for data merging (reduce) operation, at this time, after the receiving device 240 of device 0 receives the data from devices 1, 2 and 3, the task scheduling device on device 0 can trigger the artificial intelligence processor to start, and the artificial intelligence processor on device 0 can perform the corresponding merging operation and obtain the corresponding execution result. Among them, the execution result includes the successful execution or failure of the current merging task and other computing tasks.

[0058] Furthermore, the task template may also include a second forwarding flag and a second forwarding path (the second forwarding path may include an identifier of the next target receiving device, etc.). Optionally, each device may have more than one target receiving device, and the task scheduling device may determine which target receiving devices each device needs to send data to based on the identifier of the target receiving device in its task template. The task scheduling device may also determine, based on the second forwarding flag in the task template, whether it is necessary to trigger the sending device on the device to send the calculation result to the target receiving device of the device after the artificial intelligence processor completes the calculation.

[0059] When the second forwarding flag in the task template is the third flag value (such as 1), the task scheduling device can trigger the action of the sending device 220 on the target receiving device after the artificial intelligence processor completes the operation to send the operation result to other devices. When the second forwarding flag in the task template is the fourth flag value (such as 0), the task scheduling device will not trigger the action of the sending device 220 on the target receiving device. In the embodiment of the present application, the task scheduling device automatically triggers the forwarding operation of the sending device on the device according to the communication descriptor and its corresponding task template, thereby reducing the interaction between the device and the host and improving the processing efficiency of the task.

[0060] Optionally, the task scheduling device can also configure the forwarding operation of the sending device. Further, the forwarding operation of the sending device can be identified by the value of a register, and the value of the register can be included in the above-mentioned task template. Wherein, when the value of the register is the first setting value, it means that the current descriptor is used for a split transmission, and after the transmission is completed, the sending device is no longer started for transmission. When the value of the register is the second setting value, it means that after the transmission is completed, the communication descriptor is switched. When the value of the register is the third setting value, it means that multiple communication slices are sent continuously until a communication slice with an identification bit E of 1 is encountered, that is, the sending device continuously sends multiple communication slices until all communication slices in the task are sent. Wherein, the task template may also include an identification bit E and an identification bit A, wherein the identification bit A identifies the last transmission of a subtask (descriptor), and the identification bit E indicates the last transmission of the task. Of course, in other embodiments, the above-mentioned configuration of the forwarding operation of the sending device can also be implemented by the driver software.

[0061] Optionally, in the hardware acceleration mode, the driver software may first trigger the start of the sending device of the sending device to trigger the first device transmission. After the sending device of the sending device is started, the sending device of the sending device may obtain the corresponding communication descriptor and the data corresponding to the current task from the memory, and split the data corresponding to the current task into at least one data block according to the communication descriptor, and bind each data block and the communication descriptor as a communication slice. After that, the sending device of the sending device may transmit the communication slice to the target receiving device. After receiving the communication slice, the target receiving device may also obtain the corresponding task template according to the communication descriptor in the communication slice, and send the communication slice on it to the next target receiving device according to the information such as the first forwarding flag bit or the second forwarding flag bit in the task template, thereby realizing continuous data transmission between multiple devices. That is, in the hardware acceleration mode, the first transmission of the sending device is triggered by the driver software, and the subsequent transmissions may be automatically triggered by the task scheduling device in the sending device. For details, please refer to the description below.

[0062] Optionally, the task processing system on each device may also execute the task according to the data blocks involved in the task, and obtain the execution result of the task. The execution result of the task may include success and failure. Optionally, the task template of each task may also include the identifier of the next task template of the current task and the task chain identifier, so that the multi-device system of the embodiment of the present application may also include the chain execution of the task group of multiple tasks, that is, the execution of the next task can be directly triggered after the current task is executed.

[0063] Specifically, when the current task is executed successfully and the task chain identifier in the task template of the current task is the first preset value (such as 1), the system can obtain the task template of the next task according to the identifier of the next task template in the task template of the current task, so that the system can obtain the task information of the next task according to the task template of the next task, and execute the next task according to the task information of the next task. Optionally, the next task can be a merge operation task (Reduce), an all-merge operation task (All reduce), a scatter-merge operation task (Reduce-scatter), an all-gather task (All-gather), a broadcast task or a distribution task, etc., which is not specifically limited here.

[0064] Figure 6 The data transmission process of several tasks is illustrated with examples. Figure 6 (A) shows the process of device 0 broadcasting data A on it to devices 1-3. Specifically, the sending device of device 0 can transmit the data on it to devices 1-3 respectively. This broadcast task does not require the artificial intelligence processor to participate in the calculation. When the amount of data A on device 0 is large, device 0 can split the data A into at least one data block, and bind each data block to a communication descriptor to form a communication slice. After that, device 0 can continuously send at least one communication slice to other devices 1-3, and each communication slice is used to complete a data copy process between different devices.

[0065] Figure 6 (B) shows the operation of sending the data on each device to one device for data merging. Device 1-3 transmits the data on it to the target receiving device 0 for merging operation. Optionally, the data on device 1-3 can be divided into at least one data block to form at least one communication slice. Device 1-3 can continuously transmit at least one communication slice to device 0 until the data transmission on each device is completed. Since the transmission of data between devices does not end at the same time, after receiving the data from device 1-3, the target receiving device 0 can perform synchronization operations between devices to ensure that the target receiving device 0 has received the data required to perform the merging operation. After the receiving device of device 0 determines that all data has been received, the target receiving device 0 can trigger the artificial intelligence processor to perform the merging operation through the task scheduling device.

[0066] Figure 6(C) shows the operation of full merging. Each device transmits its data to other devices for merging operations. Optionally, the data on each device can be divided into at least one data block to form at least one communication slice, and each device can continuously transmit at least one communication slice to other devices until the data transmission on each device is completed. Since the transmission of data between devices does not end at the same time, each device can perform synchronization operations between devices after receiving data from the other three devices to ensure that the target receiving device has received the data required to perform the merging operation. After the receiving device of each device determines that all data has been received, the device can trigger the artificial intelligence processor to perform the merging operation through the task scheduling device. After that, each device broadcasts its merging operation results to other devices.

[0067] Figure 6 (D) shows the operation of decentralized merging. Each device transmits part of its data to other devices for merging operations. Optionally, the data on each device can be divided into at least one data block to form at least one communication slice, and each device can transmit its communication slice to other devices for merging operations. Since the transmission of data between devices does not end at the same time, each device can perform synchronization operations between devices after receiving data from the other three devices to ensure that the target receiving device has received the data required to perform the merging operation. After the receiving device of each device determines that all data has been received, the device can trigger the artificial intelligence processor to perform the merging operation through the task scheduling device.

[0068] Figure 6 (E) shows the operation of full aggregation, where each device transmits its data to the other three devices. Optionally, the data on each device can be divided into at least one data block to form at least one communication slice, and each device can continuously transmit at least one communication slice to other devices until the data transmission on each device is completed.

[0069] Optionally, the task processing device 230 is further configured to determine whether to report an interruption based on an interruption flag in the task template and an execution status flag in the corresponding communication descriptor. Specifically, the task processing device 230 of the target receiving device can determine whether to report an interruption based on an interruption flag (Interrupt_enable) in the task template and a task execution status flag (E, A) in the communication descriptor.

[0070] More specifically, the interrupt flag in the task template can be 2 bits, which can represent 4 situations, namely 00, 01, 10, and 11. The E in the task execution status flag indicates the last transmission of a task, that is, the end of the task; the A in the task execution status flag indicates the last transmission of a subtask, that is, the end of the subtask.

[0071] Specifically, the task processing system 200 can determine whether to report an interrupt according to the value of Interrupt_Enable and the signals E and A in the following table. The task processing system 200 can also add the task to the finish queue after determining to report an interrupt. It should be noted that the tasks in the finish queue report interrupts in sequence.

[0072]

[0073] Specifically, when the task is completed (per task) and the task execution status flags (E, A) in the communication descriptor are both 1, it can be determined that an interrupt needs to be reported. When the subtasks of the task are completed (per descriptor) and the task execution status flags (A) in the communication descriptor are both 1, it can be determined that an interrupt needs to be reported. Furthermore, an interrupt can also be reported when each communication slice is completed (per transfer).

[0074] Below Figure 2The system shown is an example of a situation where multiple devices collaborate to train a neural network, and each device can independently calculate the difference in weights, that is, the initial data on devices 0-3 can be weights w1, w2, w3, and w4, respectively. In hardware acceleration mode, the driver can first configure the sending device of device 0 to start transmission, and device 0 can transmit the weight w1 on it to the receiving device of device 1. After the receiving device of device 1 receives the weight w1, the task scheduling device of device 1 can trigger the artificial intelligence processor on it to start, and the artificial intelligence processor can perform a merging operation to obtain a partial weight sum w1+w2. After completing the merging operation, device 1 can automatically trigger the sending device on it to start, so that device 1 can transmit the partial weight sum w1+w2 to device 2, and then device 2 can perform a merging operation based on the w1+w2 it receives to obtain the partial weight sum w1+w2+w3, and transmit the data to device 3 after performing the merging operation. Device 3 adds the received partial weight w1+w2+w3 to its local weight w4 to obtain a new weight w1+w2+w3+w4. After that, device 3 triggers the sending device on it to start broadcasting and transmit the new weight to device 0. After receiving the new weight, device 0 transmits the new weight to device 1 and device 2 in turn to complete the entire transmission process. After receiving the new weight, device 2 can report an interrupt to notify the host that the transmission is over.

[0075] Optionally, the task scheduling device in the task processing system of the present application can also generate an abnormal signal and destroy the task when the task execution fails, wherein the task includes the current task and the next task. Specifically, if the current task execution fails, the current task is placed in a preset register, and the task valid flag in the communication descriptor of the current task is updated to a value corresponding to the task invalidity, so that the task is destroyed according to the task valid flag. The preset register is used to store tasks that are not placed in the transmission queue.

[0076] Combine the following Figure 5 Describe the working process of the task processing system. Figure 5 As shown, the present application provides a task processing method, which is applied to Figure 1 and Figure 2 The implementation steps of the method are specifically described by taking the data transmission in the hardware acceleration mode implemented in the application scenario of FIG. 1 as an example. In the embodiment of the present application, data is transmitted between devices according to the communication slice. Specifically, the method may include the following steps:

[0077] Step S510, the sending device obtains the communication slice from the memory and sends the communication slice to the target receiving device.

[0078] The sending device may be a device that performs a sending operation. Figure 2 As shown, each sending device may include a receiving device and a sending device. The receiving device is used to obtain and cache the communication descriptor and / or communication slice; and the sending device is used to transmit the communication slice to the target receiving device.

[0079] Specifically, the sending device of the sending device can obtain the corresponding data block from the memory according to the communication descriptor, and send the communication descriptor and the corresponding data block as the current communication slice to the target receiving device. The target receiving device can be more than one, such as Figure 2 As shown, the number of target receiving devices may be 3. In other embodiments, the number of target receiving devices may also be 5, such as Figure 4 As shown, the system includes six devices chip0-chip5, one of which can be used as a sending device, and the other five devices can be used as target receiving devices.

[0080] Optionally, when data is transmitted between devices for the first time, the sending device of the sending device may first split the data involved in the task into at least one data block according to the communication descriptor, and bind the communication descriptor and each data block to form a communication slice. Afterwards, the sending device may transmit the data to the target receiving device in batches in units of communication slices. Optionally, the sending device may continuously send at least one communication slice to the target device until the transmission of the data involved in the current task is completed.

[0081] Step S520: If the target receiving device successfully receives the communication slice, the device status of the second storage space and the data information of the communication slice of the first storage space are updated accordingly.

[0082] Optionally, a data information table may be stored in the first storage space, and the table entries of the data information table are used to record the data information of the communication slice in a two-dimensional format, such as Figure 4 As shown, the first storage space stores data information of the communication slices corresponding to each device of the task group in a two-dimensional format according to the slice identifier of the communication slice. x (t0~t63) represents the slice identifier of the communication slice. Optionally, each slice identifier corresponds to a communication slice. x _data_info represents the data information of each communication slice, which involves the shape and address of the data (segment_size + segment_number + segment_stride + dest_addr). Where X is any value from 0 to n, chip xUsed to indicate different devices, segment_size indicates the data block size of the communication slice, segment_number indicates the number of data blocks, segment_stride indicates the data block stride, and dest_addr indicates the destination address.

[0083] The second storage space is a storage space on DRAM, and the second storage space is used to record the status information of the devices involved in the communication slice. The second storage space may store a task status information table, and the table entries of the task status information table are used to record the status information of the devices involved in the task group. Figure 3 The table shown in the figure records the status information of the devices involved in each communication slice. x (t0~t63 in the figure) represents the identity of the task, where X is any value from 0 to n. lock_status represents the status information of N devices. The status information of a device can be used to reflect whether the device has received a communication slice.

[0084] Optionally, when the target receiving device successfully receives the data block of the communication slice, the target receiving device may calculate the slice identifier of the current communication slice, and update the device state of the second storage space and the data information of the communication slice in the first storage space according to the slice identifier of the current communication slice and the device identifier of the target receiving device. The target receiving device may calculate the slice identifier of the current communication slice in the following manner:

[0085] transfer_id=(dst_data_addr-dst_data_base_addr) / segment_stride / segment_number;

[0086] Among them, dst_data_addr can refer to the target address of the current communication slice, which can be included in the communication descriptor; dst_data_base_addr refers to the starting address of the data block storage in the current communication slice; segment_stride refers to the index step corresponding to the data block in the current communication slice; segment_number refers to the number of splits of the data block obtained by splitting the task.

[0087] Further optionally, the target receiving device can determine the offset c2c_data_info_addr (such as Figure 4 As shown), the data information at the corresponding position in the first storage space can be updated according to the offset.

[0088] Optionally, when the receiving device of the target receiving device successfully receives the communication slice, the task scheduling device of the target receiving device can trigger the start of the artificial intelligence processor, which can calculate the slice identifier of the current communication slice (as shown in the formula above), and update the device status of the second storage space and the data information of the communication slice in the first storage space according to the slice identifier of the current communication slice and the device identifier of the target receiving device. Of course, in other embodiments, when the target receiving device successfully receives the communication slice, the device status of the second storage space and the data information of the communication slice in the first storage space can also be updated by a software program (such as a driver) accordingly.

[0089] Optionally, data transmission between devices may be performed simultaneously, in which case each device can act as a sending device to send data and can also act as a target receiving device to receive data. The sending data and the receiving data of the device may be the same or different.

[0090] Optionally, in hardware acceleration mode, the driver can configure a corresponding communication descriptor for each device. Before data is transmitted between devices, the sending device of each device can split the task into at least one communication slice according to the communication descriptor, and the transmission between each device can be performed according to the communication slice. Furthermore, in order to facilitate the indexing and access of the data blocks of each communication slice, the data information of each communication slice can be stored according to the communication slice.

[0091] The following example illustrates the data access and storage status update process when transmitting according to the communication slice:

[0092] For example, the sending device of the device can split the task into 64 communication slices, which are marked as t0~t63 respectively. The 64 communication slices can be transmitted between devices. The transmission process of communication slice t0 is used below to illustrate the data transmission between devices. Other communication slices between devices are similar to the communication slice t0 and will not be described one by one.

[0093] If the sending device is chip0 (chip0 can be Figure 2 The target receiving device is chip1 (chip1 can be Figure 2 In the device 1 in the communication slice t0, the sending device of the sending device chip0 can obtain the data block corresponding to the communication slice from the memory 210 according to the communication descriptor in the communication slice t0, and send the data block corresponding to the communication slice t0 to the target receiving device chip1. Afterwards, when the target receiving device chip1 successfully receives the data block corresponding to the communication slice t0, the device state of the second storage space and the data information of the communication slice of the first storage space can be updated accordingly. Specifically, the data block corresponding to the communication slice t0 can be updated. Figure 3The value of position 1 in the array represented by lock_status in the first row of the second storage space in . You can also update Figure 4 chip1_data_info in the first row and first column of the first storage space.

[0094] Optionally, the task scheduling device can be used to trigger the sending device on the device to perform actions to implement operations such as broadcasting, distributing or forwarding data. Such forwarding operations do not require the artificial intelligence processor to perform operations such as merging. The above-mentioned task processing method may also include:

[0095] The receiving device of the target receiving device receives and caches the communication slice. Optionally, the receiving device of the target receiving device can receive the communication slice transmitted from at least one sending device. After the receiving device of the target receiving device receives the communication slices transmitted by each sending device, the sending device of the target receiving device can configure the kernel function transmission information and transmit the kernel function transmission information to the task scheduling device to start the task scheduling device. The kernel function transmission information includes the communication descriptor of the communication slice, so that the task scheduling device can determine the task information according to the communication descriptor.

[0096] The task scheduling device of the target receiving device obtains the corresponding task template according to the communication descriptor transmitted by the sending device, and determines the task information according to the communication descriptor and the task template.

[0097] The sending device of the target receiving device transmits the specified data on the target receiving device to the next target receiving device according to the task information. The instruction data on the target receiving device can be the communication slice received by the receiving device of the target receiving device from the sending device, or the intermediate result data obtained after the artificial intelligence processor of the target receiving device performs calculations, etc.

[0098] Optionally, the sending device of the target receiving device transmits the specified data on the target receiving device to the next target receiving device according to the task information, which may include:

[0099] The task scheduling device determines whether to trigger the action of the sending device on the target receiving device according to the first forwarding flag in the task template, so as to send the designated data on the target receiving device to the next target receiving device through the sending device.

[0100] Specifically, the task scheduling device can determine whether to trigger the action of the sending device 220 on the device according to the first forwarding flag in the task template, so as to send data such as communication data or calculation results to the next target receiving device through the sending device 220. When the first forwarding flag in the task template is a first flag value (such as 1), the task scheduling device can trigger the action of the sending device 220 on the device. When the first forwarding flag in the task template is a second flag value (such as 0), the task scheduling device will not trigger the action of the sending device 220 on the device. In the embodiment of the present application, the task scheduling device automatically triggers the forwarding operation of the sending device on the device according to the communication descriptor and its corresponding task template, thereby reducing the interaction between the device and the host and improving the processing efficiency of the task.

[0101] Optionally, when data broadcast or distribution operations are performed between various devices, the first forwarding flag bit can be set to the first flag bit, so that there is no need to start the artificial intelligence processor. Further, when data broadcast or distribution operations are performed between various devices, when the target receiving device successfully receives the data transmitted by the sending device, it can be determined that the current broadcast or distribution task is successfully executed; otherwise, it can be determined that the current broadcast or distribution task fails to execute.

[0102] Optionally, the task scheduling device of the target receiving device may also determine the scheduling information based on a certain scheduling algorithm, so that the artificial intelligence processor can perform related tasks according to the task scheduling information. Specifically, the above method may also include:

[0103] The task scheduling device determines the scheduling information of the task according to the task information;

[0104] The artificial intelligence processor executes the task according to the scheduling information transmitted by the task scheduling device to obtain the execution result of the task. Optionally, the artificial intelligence processor can read the corresponding data block from the memory according to the destination address of the data block, and perform operations based on the data block to obtain the execution result of the task. Among them, the execution result of the task includes success and failure. The operation can be a merge operation (Reduce), a full merge operation (All reduce), a scatter merge operation (Reduce-scatter), a full gather (All-gather), etc., which is not specifically limited here.

[0105] Furthermore, before triggering the start of the artificial intelligence processor, it is necessary to determine whether the device has received all the data involved in the operation, that is, before performing the operation, it is necessary to determine whether the data involved in the operation is complete. After the sending device of the target receiving device receives the data required to perform the task, the artificial intelligence processor executes the task according to the scheduling information transmitted by the task scheduling device to obtain the execution result of the task.

[0106] For example, Figure 2 When the data on each device 0-3 needs to be sent to device 0 for data merging operation, at this time, after the receiving device 240 of device 0 receives the data from devices 1, 2 and 3, the task scheduling device on device 0 can trigger the artificial intelligence processor to start, and the artificial intelligence processor on device 0 can perform the corresponding merging operation and obtain the corresponding execution result. Among them, the execution result includes the successful execution or failure of the current merging task and other computing tasks.

[0107] Furthermore, after the artificial intelligence processor completes the operation, the task scheduling device can also determine whether to perform a second forwarding operation according to the task template. The above-mentioned task processing method also includes:

[0108] The task scheduling device determines whether to trigger the action of the sending device on the target receiving device after the artificial intelligence processor completes the calculation based on the second forwarding flag in the task template.

[0109] The task template may also include a second forwarding flag and a second forwarding path (the second forwarding path may include an identifier of the next target receiving device, etc.). Optionally, each device may have more than one target receiving device, and the task scheduling device may determine which target receiving devices each device needs to send data to based on the identifier of the target receiving device in its task template. The task scheduling device may also determine, based on the second forwarding flag in the task template, whether it is necessary to trigger the sending device on the device to send the calculation result to the target receiving device of the device after the artificial intelligence processor completes the calculation.

[0110] When the second forwarding flag in the task template is the third flag value (such as 1), the task scheduling device can trigger the action of the sending device 220 on the target receiving device after the artificial intelligence processor completes the operation to send the operation result to other devices. When the second forwarding flag in the task template is the fourth flag value (such as 0), the task scheduling device will not trigger the action of the sending device 220 on the target receiving device. In the embodiment of the present application, the task scheduling device automatically triggers the forwarding operation of the sending device on the device according to the communication descriptor and its corresponding task template, thereby reducing the interaction between the device and the host and improving the processing efficiency of the task.

[0111] Optionally, the above task processing method may further include:

[0112] When the current task is successfully executed, the target receiving device obtains the next task template according to the task chain identification bit in the task template of the current task, and executes the next task in the task group according to the next task template. That is, when the current task is successfully executed, the execution of the next task can be directly triggered by the task chain identification bit in the task template of the current task, without the intervention of the host, thereby improving the efficiency of data transmission.

[0113] Specifically, the task processing system 200 of the target receiving device can determine whether to start the next task based on the value of the task chain identification bit in the task template of the current task. For example, when the current task is successfully executed and the value of the task chain identification bit of the current task template is a first preset value (such as 1), it indicates that the execution of the next task can be automatically triggered. At this time, the task processing system 200 of the target receiving device determines to start the next task based on the value of the task chain identification bit being the first preset value. When the current task fails to execute, and / or the value of the task chain identification bit of the current task template is a second preset value (such as 0), it indicates that the execution of the next task will not be automatically triggered.

[0114] Further, when determining to start the next task, the task processing system 200 of the target receiving device obtains the next task template according to the identifier of the next task template in the current task template. The task scheduling device in the task processing system 200 of the target receiving device can obtain the task information of the next task according to the next task template; and schedule the next task according to the task information of the next task. The specific scheduling execution process can be found in the above description, which will not be repeated here.

[0115] In the above task processing method, by setting the task chain identification bit and the template identification of the next task template in the task template, multiple tasks can be executed uninterruptedly, and the next task can be automatically jumped to for processing after the previous task is completed, which can improve data processing efficiency.

[0116] Optionally, the task processing system 200 may be further used to determine whether to report an interrupt based on the interrupt flag in the task template and the corresponding execution status flag in the communication descriptor. Specifically, the task processing system 200 of the target receiving device may determine whether to report an interrupt based on the interrupt flag (Interrupt_enable) in the task template and the task execution status flag (E, A) in the communication descriptor.

[0117] More specifically, the interrupt flag (Interrupt_enable) in the task template is 2 bits, which can represent 4 situations, namely 00, 01, 10, and 11. The E in the task execution status flag indicates the task is terminated (End of task); the A in the task execution status flag indicates the termination of the job in the task. (End of descriptor).

[0118] Specifically, the task processing system 200 can determine whether to report an interrupt according to the value of Interrupt_Enable and the signals E and A in the following table. The task determined to report an interrupt is added to the finish queue. It should be noted that the tasks in the finish queue report interrupts in sequence.

[0119]

[0120] Optionally, multiple tasks may form a task chain, and the present application embodiment may implement continuous execution of at least one task in the task chain, thereby improving task processing efficiency. Figure 7 As shown, the present application also provides a task group processing method, which is applied to Figure 1 and Figure 2 The implementation steps of the method are specifically described in the application scenario in , the task processing method can realize the continuous triggering execution of at least one task in the task group according to the value of the task chain identification bit in the task template, thereby improving the processing efficiency of the task. Specifically, the method may include the following steps:

[0121] Step 710: Acquire a task template of the current task according to the communication descriptor of the current task.

[0122] Among them, the communication descriptor is used to record communication data, which is mainly used to describe the inter-device task (chip-to-chip task) and the process that the data involved in it needs to go through. Optionally, when a task requires multiple devices to complete in collaboration, the task can be an inter-device task. Each inter-device task can be configured with a corresponding communication descriptor. Optionally, the communication descriptor can include: task identification (task id) and the source address and destination address of the data involved in the task and the task template identification corresponding to the task and other information. The task processing system 200 of each device can store the communication descriptor through a queue mechanism.

[0123] Each device can parse the received communication descriptor of the current task, and determine the task template of the current task according to the task template identifier contained in the communication descriptor of the current task. The task template of the current task can be configured with the processing information of the current task, which can be used to obtain the processing information of the current task. Optionally, the task template of each task can be pre-configured by software (such as a driver) to the task processing system of each device before data communication, and the task processing system of each device can store the corresponding task template. Specifically, the software can configure the task template of each task to the task scheduling device of the device, and the task scheduling device can store the corresponding task template.

[0124] Optionally, the task template may include multiple identification bits, such as a validity flag bit for identifying the validity of the task, a task chain identification bit, a forwarding flag bit, etc. The task template may also include information such as task weight, data information, task type, and task template identification of the next task, which is not specifically limited here.

[0125] Step 720, determine whether to start the next task according to the task template of the current task. If it is determined to start the next task, execute step S730. If it is determined not to start the next task, then the information can be reported to the host, and the host triggers the data transmission between the devices, that is, switching from the hardware acceleration mode to the normal transmission mode. Alternatively, after the current task is successfully executed, the task transmission between the devices is terminated.

[0126] Among them, the task chain refers to a combination of multiple tasks with a time sequence, and the combination can be called a task group. Specifically, the task processing system 200 of the target receiving device can determine whether to start the next task based on the value of the task chain identification bit in the task template of the current task. For example, when the value of the task chain identification bit of the current task template is a first preset value (such as 1), it indicates that the execution of the next task can be automatically triggered. At this time, the task processing system 200 of the target receiving device determines to start the next task based on the value of the task chain identification bit being the first preset value. When the value of the task chain identification bit of the current task template is a second preset value (such as 0), it indicates that the execution of the next task will not be automatically triggered.

[0127] Step 730 , obtaining a next task template according to the identifier of the next task template in the current task template, so that the task processing system can process the next task according to the next task template.

[0128] The next task template is used to process the next task of the current task. Similarly, the next task template can be configured with the processing information of the next task. Optionally, the next task template can include multiple identification bits, such as the task template can include a validity flag bit for identifying the task, a task chain flag bit, a forwarding flag bit, etc. The next task template can also include information such as task weight, data information, task type, and task template identification of the next task, which is not specifically limited here.

[0129] Specifically, when determining to start the next task, the task processing system 200 of the target receiving device obtains the next task template according to the identifier of the next task template in the current task template. The task scheduling device in the task processing system 200 of the target receiving device can obtain the task information of the next task according to the next task template; and schedule the next task according to the task information of the next task. The artificial intelligence processor in the task processing device of the task processing system 200 of the target receiving device can perform scheduling according to the task information of the next task to obtain the execution result of the next task.

[0130] In the above task processing method, by setting the task chain identification bit and the template identification of the next task template in the task template, multiple tasks can be executed uninterruptedly, and the next task can be automatically jumped to for processing after the previous task is completed, which can improve data processing efficiency.

[0131] Optionally, the task processing system 200 can also obtain task information based on the communication descriptor and task template of the current task. Specifically, the sending device 220 of the task processing system 200 obtains the current communication descriptor, and then the sending device can transmit the communication descriptor to the task processing device. The task processing device can obtain the task template of the current task based on the communication descriptor of the current task, and then bind the communication descriptor and the task template to obtain the task information of the current task. The task processing device can process the current task according to the task information of the current task to obtain the execution result of the current task. The execution result of the current task includes success and failure.

[0132] Optionally, if the execution result of the current task is successful, and the task chain identification bit in the task template of the current task is the first preset value, the next task of the current task can be directly triggered, so that the chain execution of multiple tasks can be achieved, and the execution efficiency of multiple tasks in the task group can be improved. Specifically, if the execution result of the current task is successful, and the task chain identification bit in the task template of the current task is the first preset value, the above-mentioned step S730 can be executed to obtain the next task template according to the identification of the next task template in the current task template, so that the task processing system can process the next task according to the next task template.

[0133] Further, when the current task is successfully executed, and the task chain flag in the task template of the current task is the second preset value, the current task may be the last task in the task group, and there is no need to trigger the start of the next task. When the current task fails to execute, and / or the task chain flag in the current task template is the second preset value, it is determined not to start the next task. Specifically, when the current task fails to execute, regardless of whether the task chain flag in the task template of the current task is the first preset value or the second preset value, the next task will not be started, so as to avoid the failure of the execution of the current task leading to the failure of the execution of the next task.

[0134] Optionally, the task group may include one or a combination of reduce, reduce-Scatter, All-reduce, distribution or broadcast tasks. The distribution or broadcast tasks may be implemented by the receiving device and the sending device of the task processing system of the device without triggering the artificial intelligence processor. The data merging operation tasks need to trigger the sending device and the receiving device of the task processing system to forward data, and trigger the artificial intelligence processor to perform corresponding data operations through the task processing device.

[0135] For example, the current task may be a merge reduce operation, and the next task of the current task may be an all-reduce operation. When it is determined that the execution result of the current task is successful, the task template of the all-reduce task can be obtained through the identifier of the next task template in the task template of the current task, so as to execute the next task according to the task template of the all-reduce task, so as to realize the chained continuous execution of multiple tasks in the task group.

[0136] For another example, the current task may be a broadcast or distribution task, and the next task of the current task may be a computing task. Figure 6 (B) shows the process of merging data A, data B, data C, and data D on device 0 (target receiving device). Among them, data A is on device 0, data B is on device 1, data C is on device 2, and data D is on device 3. To implement this process, first determine the task group, in which "device 1 sends data B to device 0, device 2 sends data C to device 0, and device 3 sends data D to device 0" is the current task; "device 0 merges data A, data B, data C, and data D" is a subordinate task. Among them, data A, data B, data C, and data D can be a data block of a communication slice.

[0137] Execute the current task: the sending device of the task processing system of device 1 sends data B to the receiving device of the task processing system of device 0, the sending device of the task processing system of device 2 sends data C to the receiving device of the task processing system of device 0, and the sending device of the task processing system of device 3 sends data D to the receiving device of the task processing system of device 0; after device 0 receives data B, data C and data D, it performs a synchronization operation.

[0138] After the current task is successfully executed and the task identification chain in the task template of the current task is 1, the next task can be executed: and data A, data B, data C, and data D are merged. Specifically, the task scheduler of the task processing system can send the next task to the artificial intelligence processor, which can execute the task of merging data A, data B, data C, and data D.

[0139] In one embodiment of the present application, a task group processing method is proposed. The task group includes multiple tasks, and the multiple tasks form a task chain. The tasks in the task chain are executed in order. For example, a task that needs to merge data transmitted on multiple other chips is a task group. The execution of the data merging task in the task group depends on the execution results of the data transmitted by multiple other chips. Figure 2 The implementation steps of this method are described in detail using the application environment and application scenario in the example. Figure 8 As shown, the method comprises the following steps:

[0140] Step S810: If the current task is successfully executed, the task scheduling device may obtain the next task template of the next task of the current task according to the task template of the current task to start the next task.

[0141] Optionally, the task processing system 200 of the target receiving device obtains the current task template based on the acquired communication descriptor of the current task; and obtains the task information of the current task based on the communication descriptor of the current task and the current task template. Further, the task processing system 200 can execute the current task based on the task information of the current task and obtain the execution result of the current task; the execution result of the current task includes success and failure. If the task scheduling device on the device determines that the current task is successfully executed, the task scheduling device can obtain the next task template of the next task of the current task based on the task template of the current task.

[0142] The task template of the current task may include an identifier of a next task template, and the identifier of the next task template is used to indicate the next task template. Specifically, when the task processing system 200 of the target receiving device determines that the current task is successfully executed, the task scheduling device of the target receiving device can obtain the next task template of the next task of the current task according to the identifier of the next task template in the task template of the current task.

[0143] Optionally, the current task or the next task may be a reduce task, an all reduce task, a reduce-scatter task, an all-gather task, a broadcast task or a distribution task, etc., which is not specifically limited here.

[0144] Step S820: determining the task information of the next task according to the next task template.

[0145] Specifically, the task scheduling device of the task processing device 230 can determine the task information of the next task according to the next task template, and obtain task data from the task information of the next task so that the target receiving device can execute the next task.

[0146] The task processing method of this embodiment, by adding the next task template to the task template, can automatically switch tasks during task processing. This method can not only improve the task processing efficiency, but also ensure that the tasks with dependencies are logically correct during execution.

[0147] Optionally, the task template of the current task includes a task chain identification bit; the above method further includes:

[0148] When the current task is successfully executed, whether to start the next task is determined according to the value of the task chain flag in the current task template. The task chain flag is used to indicate whether the next task needs to be started after each communication task is completed.

[0149] Specifically, if the current task is successfully executed and the task chain flag in the current task template is the first preset value, it is determined to start the next task; if the current task fails to execute and / or the task chain flag in the current task template is the second preset value, it is determined not to start the next task.

[0150] Optionally, the task processing system of the present application can also generate an exception signal and destroy the task when the task fails to execute, wherein the task includes the current task and the next task. Specifically, if the current task fails to execute, the current task is placed in a preset register, and the task valid flag in the communication descriptor of the current task is updated to a value corresponding to the task invalidity, so that the task is destroyed according to the task valid flag. The preset register is used to store tasks that are not placed in the transmission queue.

[0151] Alternatively, if Fig. 9 As shown, the task processing method also includes:

[0152] Step S910: determining whether the task is valid according to the task validity flag in the communication descriptor.

[0153] Step S920: If the task is invalid, destroy the task.

[0154] Specifically, the task scheduling device of the target receiving device can determine whether the tasks that have not started processing are valid through the above method. If a task is determined to be invalid, the task valid identification bit in the communication descriptor is updated. Optionally, the identification bit value can be set to 1, when the task is valid; when the value is 0, the task is invalid (needs to be destroyed). After that, these tasks that have not started processing are placed in the designated register, and the task scheduling device reads the tasks that have not started processing from the designated register. The tasks with a valid identification bit of 0 are directly destroyed, and the tasks with a valid identification bit of 1 are put back into the task queue of the task scheduling device.

[0155] In one embodiment, if Fig.10 As shown, a task destruction method is also proposed, the method comprising:

[0156] Step S1001, when a pause instruction is received, identifying tasks to be destroyed among unprocessed tasks.

[0157] Step S1002, modifying the task validity bit of the communication descriptor to be destroyed to invalid, and then putting all the unprocessed tasks into a register.

[0158] Step S1003, reading the communication descriptor of the unprocessed task from the register, and if the task valid bit of the communication descriptor of a certain unprocessed task is invalid, destroying the certain unprocessed task.

[0159] It should be understood that although Figure 5 , Figure 7-10The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 5 , Figure 7-10 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0160] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0161] Optionally, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to perform the above-mentioned task group processing method, such as Figure 7 and Figure 8 Specifically, when the computer program in the storage medium is executed by the processor, the following steps are implemented:

[0162] If the current task is successfully executed, then according to the task template of the current task, a next task template of the next task of the current task is determined to start the next task;

[0163] According to the next task template, task information of the next task is acquired to process the next task, wherein the task information of the next task is used to execute the next task.

[0164] It should be clear that when the computer program in the storage medium is executed by the processor, the various method steps implemented are basically consistent with the execution of the various steps in the task group processing method in the above embodiment. For details, please refer to the above description and will not be repeated here.

[0165] Optionally, the embodiment of the present application further provides a computer device, which may be a terminal, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a task group processing method is implemented, as shown in the above Figure 7 and Figure 8 The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse.

[0166] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0167] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0168] The content of this application can be better understood according to the following terms:

[0169] A1. A method for processing a task group, wherein the task group includes a task chain formed by at least one task; the method comprises:

[0170] If the current task is successfully executed, then according to the task template of the current task, a next task template of the next task of the current task is determined to start the next task;

[0171] According to the next task template, task information of the next task is acquired to process the next task, wherein the task information of the next task is used to execute the next task.

[0172] A2. The method according to clause A1, wherein the task template of the current task includes a task chain identification bit; and the method further includes:

[0173] When the current task is successfully executed, whether to start the next task is determined according to the value of the task chain flag in the current task template. The task chain flag is used to indicate whether the next task needs to be started after each communication task is completed.

[0174] A3. The method according to clause A1 or A2, wherein when the current task is successfully executed, determining whether to start the next task according to the value of the task chain flag in the current task template includes:

[0175] If the current task is successfully executed and the task chain flag in the current task template is a first preset value, determining to start the next task;

[0176] If the execution of the current task fails and / or the task chain flag in the current task template is a second preset value, it is determined not to start the next task.

[0177] A4. According to the method described in any one of clauses A1-A3, the task template of the current task is configured by a driver.

[0178] A5. According to the method described in any one of clauses A1-A4, the current task or the next task includes a combination of one or more of a merge task, a full merge task, a dispersed merge task, a global aggregation task, a broadcast task or a distribution task.

[0179] A6. The method according to any one of clauses A1 to A5, wherein the current task template includes a template identifier of a next task template; and determining a next task template of a next task of the current task according to the task template of the current task comprises:

[0180] A next task template of a next task of the current task is determined according to the template identifier of the next task template in the task template of the current task.

[0181] A7. A method according to any one of clauses A1 to A5, further comprising:

[0182] Get the communication descriptor of the current task;

[0183] Obtaining a task template for the current task according to the acquired communication descriptor of the current task;

[0184] Obtaining task information of the current task according to the communication descriptor of the current task and the task template of the current task;

[0185] Execute the current task according to the task information of the current task, and obtain the execution result of the current task;

[0186] The execution result of the current task includes successful execution of the current task.

[0187] A8. The method according to clause A7, further comprising:

[0188] When it is determined that the data of the current task is complete, the current task is executed according to the task information of the current task to obtain the execution result of the current task.

[0189] A9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in any one of clauses A1 to A8 when executing the computer program.

[0190] A10. A system comprising at least one device, wherein data transmission can be performed between the devices, and each device in the system can execute the steps of the method described in any one of clauses A1-A8.

[0191] A11. According to the system described in clause A10, the device includes a combination of one or more of a chip, a board, a processor or a processor core.

[0192] A12. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of clauses A1 to A8.

[0193] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A task group processing method, characterized in that: The task group includes a task chain formed by at least one task; the method includes: If the current task is successfully executed, the next task template of the next task of the current task is determined according to the task template of the current task to start the next task; the task template of the current task includes the information required for the execution of the current task, the task weight, the data information, the task type and the identifier of the next task template, and the information required for the execution of the current task includes the task chain identifier; According to the next task template, task information of the next task is obtained to process the next task, wherein the task information of the next task is used to execute the next task; the task information of the next task includes data information of data involved in the next task, task scale, and required processor resource information; If the current task is successfully executed and the task chain identification bit is a first preset value, it is determined to start the next task; if the current task fails to execute and / or the task chain identification bit is a second preset value, it is determined not to start the next task; the task chain identification bit is used to indicate whether the next task needs to be started after each communication task is completed.

2. The method according to claim 1, characterized in that The task template of the current task is configured by the driver.

3. The method according to claim 1, characterized in that The current task or the next task includes a combination of one or more of a merge task, a full merge task, a dispersed merge task, a global aggregation task, a broadcast task or a distribution task.

4. The method according to claim 1, characterized in that: The current task template includes a template identifier of a next task template; Determining, according to the task template of the current task, a next task template of a next task of the current task, comprises: A next task template of a next task of the current task is determined according to the template identifier of the next task template in the task template of the current task.

5. The method according to claim 1, characterized in that The method further comprises: Get the communication descriptor of the current task; Obtaining a task template for the current task according to the acquired communication descriptor of the current task; Obtaining task information of the current task according to the communication descriptor of the current task and the task template of the current task; Execute the current task according to the task information of the current task, and obtain the execution result of the current task; The execution result of the current task includes successful execution of the current task.

6. The method according to claim 5, characterized in that The method further comprises: When it is determined that the data of the current task is complete, the current task is executed according to the task information of the current task to obtain the execution result of the current task.

7. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.

8. A system, characterized in that: The system comprises at least one device, and data transmission can be performed between the devices. Each device in the system can execute the steps of the method according to any one of claims 1 to 6.

9. The system according to claim 8, characterized in that The device includes a chip, a board, a processor or a combination of one or more of a processor core.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Business system checking method and device

    CN110264149A

  • Communication task processing method, task caching device and storage medium

    CN111026539A

  • Network communications processor architecture with memory load balancing

    US20100293345A1