Task processing method, chip, multi-chip module, electronic device, and storage medium
By obtaining and executing task queue information in multi-chip modules, and using synchronization registers to manage chip status, the problem of task processing synchronization in multi-chip interconnection architecture is solved, and effective synchronization and correct execution between multiple chips are achieved.
Patent Information
- Application Number
- PCT/CN2023/118880
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-14
- Filing Date
- 2023-09-14
- Publication Date
- 2024-09-19
AI Technical Summary
In a multi-chip interconnect architecture, how to effectively perform task processing to ensure synchronization between multiple chips, especially when there are synchronization commands, ensuring that the dependencies of previous and subsequent commands are executed correctly is a challenge.
By obtaining the sub-queue information related to the current task queue on each chip, execute the tasks in order of execution, and confirm whether all chips have completed the previous sub-tasks when executing the synchronization command. If the completion is confirmed, the synchronization command will be terminated to execute the subsequent subtasks. The synchronization register is used to characterize the chip status, ensuring that all chips complete the corresponding subtasks before the barrier command ends before the barrier command is completed, thereby achieving synchronization between multiple chips.
It effectively ensures the correct execution of multiple chips at synchronization points in the queue, improves processing efficiency and accuracy, and ensures the correct execution of dependencies on preceding and following commands.
Smart Images

Figure CN2023118880_19092024_PF_FP_ABST
Abstract
Description
Task processing method, chip, multi-chip module, electronic device and storage medium
[0001] This application claims priority to Chinese Patent Application No. 202310243912.0 filed on March 14, 2023, and the contents of the above-mentioned Chinese patent application disclosure are hereby incorporated by reference in their entirety as a part of this application. Technical Field
[0002] Embodiments of the present disclosure relate to a task processing method for a multi-chip module, a task processing method for a chip, a chip, a multi-chip module, an electronic device, and a computer-readable storage medium. Background Art
[0003] With the continuous increase in various demands, chips are required to have higher processing capabilities. DSA (Domain Specific Accelerator) chips are accelerators for specific domains, expanding general-purpose processing capabilities to improve the efficiency of solving problems in specific fields. Examples include TPU (Tensor Processing Unit) chips, NPU (Neural-Network Processing Unit) chips, and ASIC (Application Specific Integrated Circuit) chips for computing in special application scenarios. Due to the diversity of needs, the demand for a single chip is not large, and the computing power must be reasonably configured. Therefore, a DSA chip can be packaged together with other chips (such as CPU (Central Processing Unit) chips, GPU (Graphics Processing Unit) chips, etc.) using interconnect technology, or multiple CPUs or GPUs can be packaged together using interconnect technology. In addition, chip yield is also a concern. Under the same process, the larger the chip size, the lower the yield. If a large chip is split into several smaller chips, the chip yield can be greatly improved, thereby reducing mass production costs. Therefore, multi-chip interconnect packaging technology is increasingly favored in this field. In the multi-chip interconnection architecture, how to process tasks is an issue worthy of attention.
[0004] Summary of the Invention
[0005] At least one embodiment of the present disclosure provides a task processing method for a multi-chip module, wherein the multi-chip module includes N chips, and the task processing method includes: each of the N chips obtains sub-queue information related to its own current task queue, wherein the current task queue includes multiple tasks arranged in an execution order and synchronization commands located between the multiple tasks, each of the multiple tasks includes N sub-tasks, and the N sub-tasks are respectively configured to be executed by the N chips; each chip executes the corresponding sub-tasks in the current task queue in sequence according to the execution order based on its own sub-queue information; each chip confirms whether the N chips have all executed the corresponding sub-tasks in the current task queue that are located before the synchronization command in response to executing the synchronization command; if it is confirmed that the N chips have all executed the corresponding sub-tasks in the current task queue that are located before the synchronization command, then the synchronization command is terminated to execute the corresponding sub-tasks located after the synchronization command, wherein N is an integer greater than 1.
[0006] For example, in a task processing method provided in an embodiment of the present disclosure, the N chips include a master chip and at least one slave chip; each chip confirms whether the N chips have all completed the corresponding subtasks located before the synchronization command in the current task queue in response to executing the synchronization command, including: each slave chip in the at least one slave chip confirms whether the slave chip itself has completed the corresponding subtask located before the synchronization command in response to executing the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been completed, a first synchronization signal is sent to the master chip; if a second synchronization signal sent by the master chip is received, the synchronization command is ended; wherein, the second synchronization signal indicates that the master chip has received all of the first synchronization signals sent by the at least one slave chip.
[0007] For example, in the task processing method provided in an embodiment of the present disclosure, each chip responds to executing the synchronization command and confirms whether the N chips have all completed executing the corresponding subtasks located before the synchronization command in the current task queue, including: the master chip responds to executing the synchronization command and confirms whether the master chip itself has completed executing the corresponding subtask located before the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been completed, then checking whether the first synchronization signal sent by all of the at least one slave chip has been received; if the first synchronization signal sent by all of the at least one slave chip has been received, then sending the second synchronization signal to each of the slave chips and ending the synchronization command.
[0008] For example, in a task processing method provided in an embodiment of the present disclosure, each slave chip has a slave synchronization register associated with the current task queue, and the slave synchronization register includes a bit corresponding to the slave chip and a bit corresponding to the master chip, and the bit corresponding to the slave chip and the bit corresponding to the master chip both have initial values; for each slave chip, if it is confirmed that the corresponding subtask located before the synchronization command has been executed, a first synchronization signal is sent to the master chip, including: if it is confirmed that the corresponding subtask located before the synchronization command has been executed, the bit corresponding to the slave chip in the slave synchronization register is changed from the initial value to the target value, and the first synchronization signal is sent to the master chip; if a second synchronization signal sent by the master chip is received, the synchronization command is ended, including: in response to receiving the second synchronization signal sent by the master chip, the bit corresponding to the master chip in the slave synchronization register is changed from the initial value to the target value; the value of the slave synchronization register is queried, and if the bit corresponding to the slave chip and the bit corresponding to the master chip in the slave synchronization register are both the target values, the synchronization command is ended.
[0009] For example, in a task processing method provided in an embodiment of the present disclosure, the master chip has a master synchronization register associated with the current task queue, the master synchronization register includes N bits corresponding to the N chips respectively, and the N bits all have initial values; for the master chip, if it is confirmed that the corresponding subtask located before the synchronization command has been executed, then check whether the first synchronization signal sent by all the at least one slave chip has been received, including: if it is confirmed that the corresponding subtask located before the synchronization command has been executed, change the bit corresponding to the master chip in the master synchronization register from the initial value to the target value, and after each first synchronization signal sent by the slave chip is received, change the bit corresponding to the slave chip in the master synchronization register from the initial value to the target value, until after receiving the first synchronization signal sent by all the at least one slave chip, the N bits of the master synchronization register are all changed to the target value; query the value of the master synchronization register, if the N bits of the master synchronization register are all the target values, then confirm that all the first synchronization signals sent by the at least one slave chip have been received.
[0010] For example, in the task processing method provided in one embodiment of the present disclosure, the N chips are configured to communicate with a task initiating device; the task processing method also includes: after each chip completes the corresponding subtask of each task in the current task queue, sending completion information to the task initiating device, so that the task initiating device confirms whether each task is completed.
[0011] For example, in the task processing method provided in an embodiment of the present disclosure, the current task queue includes a first task, and the task initiating device pre-stores a task status value for the first task; after each chip completes the corresponding subtask of each task in the current task queue, it sends a completion message to the task initiating device, so that the task initiating device confirms whether each task is completed, including: after each chip completes the corresponding subtask of the first task, it performs an operation on the task status value to change the task status value, until all the N chips perform the operation, and the task status value is changed to the completion value, so that the task initiating device determines whether the first task is completed based on whether the task status value is the completion value.
[0012] At least one embodiment of the present disclosure provides a task processing method for a chip, the task processing method comprising: obtaining subqueue information related to a current task queue, wherein the current task queue comprises a plurality of tasks arranged in an execution order and synchronization commands located between the plurality of tasks, each of the plurality of tasks comprises N subtasks, and the N subtasks are respectively configured to be executed by the chip and (N-1) associated chips; executing the corresponding subtasks in the current task queue in sequence according to the execution order according to the subqueue information; in response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command; if it is confirmed that the chip itself and the (N-1) associated chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command, ending the synchronization command to execute the corresponding subtasks located after the synchronization command, wherein N is an integer greater than 1.
[0013] For example, in the task processing method provided in an embodiment of the present disclosure, when the (N-1) associated chips include a master chip and the chip is a slave chip related to the master chip, in response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have completed executing the corresponding subtasks located before the synchronization command in the current task queue, including: in response to executing the synchronization command, confirming whether the chip itself has completed executing the corresponding subtask located before the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been executed, sending a first synchronization signal to the master chip; if a second synchronization signal sent by the master chip is received, ending the synchronization command; wherein, the second synchronization signal indicates that the master chip has received the first synchronization signal sent by all slave chips related to the master chip.
[0014] For example, in the task processing method provided in an embodiment of the present disclosure, when the chip is the master chip and each of the (N-1) associated chips is a slave chip of the master chip, in response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have completed executing the corresponding subtasks in the current task queue that are located before the synchronization command, including: in response to executing the synchronization command, confirming whether the chip itself has completed executing the corresponding subtask that is located before the synchronization command; if it is confirmed that the corresponding subtask that is located before the synchronization command has been executed, checking whether the first synchronization signal sent by all the (N-1) associated chips has been received; if the first synchronization signal sent by all the (N-1) associated chips has been received, sending the second synchronization signal to the (N-1) associated chips respectively, and ending the synchronization command.
[0015] At least one embodiment of the present disclosure provides a chip, including a command processor and a task processing device, the command processor being configured to obtain subqueue information related to a current task queue, wherein the current task queue includes a plurality of tasks arranged in an execution order and synchronization commands located between the plurality of tasks, each of the plurality of tasks including N subtasks, and the N subtasks being respectively configured to be executed by the chip and (N-1) associated chips; the task processing device being configured to execute the corresponding subtasks in the current task queue in sequence according to the execution order based on the subqueue information; wherein the command processor is further configured to: in response to executing the synchronization command, confirm whether the chip itself and the (N-1) associated chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command; if it is confirmed that the chip itself and the (N-1) associated chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command, then terminate the synchronization command to execute the corresponding subtask that is located after the synchronization command, wherein N is an integer greater than 1.
[0016] At least one embodiment of the present disclosure provides a multi-chip module, comprising N chips, wherein each of the N chips is configured to: obtain sub-queue information related to a current task queue, wherein the current task queue comprises a plurality of tasks arranged in an execution order and synchronization commands located between the plurality of tasks, each of the plurality of tasks comprises N sub-tasks, and the N sub-tasks are respectively configured to be executed by the N chips; execute the corresponding sub-tasks in the current task queue in sequence according to the execution order according to the respective sub-queue information; in response to executing the synchronization command, confirm whether the N chips have all executed the corresponding sub-tasks in the current task queue that are located before the synchronization command; if it is confirmed that the N chips have all executed the corresponding sub-tasks in the current task queue that are located before the synchronization command, then end the synchronization command to execute the corresponding sub-task located after the synchronization command, wherein N is an integer greater than 1.
[0017] At least one embodiment of the present disclosure provides an electronic device, including a task initiating device and a multi-chip module provided by at least one embodiment of the present disclosure.
[0018] At least one embodiment of the present disclosure provides an electronic device, comprising a processor; a memory storing one or more computer program modules; wherein the one or more computer program modules are configured to be executed by the processor to implement the task processing method provided by any embodiment of the present disclosure.
[0019] At least one embodiment of the present disclosure provides a computer-readable storage medium storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the task processing method provided by any embodiment of the present disclosure can be implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, rather than limiting the present disclosure.
[0021] FIG1 shows a schematic diagram of the interaction between a chip and a task initiator;
[0022] FIG2 shows a schematic diagram of a command queue;
[0023] FIG3 shows a processing flow chart of a command processor;
[0024] FIG4 shows a schematic diagram of a multi-chip module provided by at least one embodiment of the present disclosure;
[0025] FIG5 shows a flowchart of a task processing method for a multi-chip module provided by at least one embodiment of the present disclosure;
[0026] FIG6 shows a schematic diagram of a current task queue provided by at least one embodiment of the present disclosure;
[0027] FIG7 shows a schematic diagram of a processing flow of a command processor provided by at least one embodiment of the present disclosure;
[0028] FIG8 shows a schematic diagram of a processing flow of another command processor provided by at least one embodiment of the present disclosure;
[0029] FIG9 shows a schematic diagram of a processing flow of another command processor provided by at least one embodiment of the present disclosure;
[0030] FIG10 shows a flowchart of a task processing method for a chip provided by at least one embodiment of the present disclosure;
[0031] FIG11 shows a schematic diagram of a chip provided by at least one embodiment of the present disclosure;
[0032] FIG12 shows a schematic diagram of a multi-chip module provided by at least one embodiment of the present disclosure;
[0033] FIG13 shows a schematic block diagram of another electronic device provided by at least one embodiment of the present disclosure;
[0034] FIG14 shows a schematic block diagram of yet another electronic device provided by at least one embodiment of the present disclosure; and
[0035] FIG15 shows a schematic diagram of a computer-readable storage medium provided by at least one embodiment of the present disclosure. DETAILED DESCRIPTION
[0036] To make the purpose, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0037] Unless otherwise defined, the technical or scientific terms used in this disclosure should have the usual meanings understood by people with ordinary skills in the field to which this disclosure belongs. The words "first", "second" and similar words used in this disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one", "an" or "the" do not indicate a quantity limitation, but rather indicate the existence of at least one. Words such as "include" or "comprise" mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the object being described changes, the relative positional relationship may also change accordingly.
[0038] FIG1 shows a schematic diagram of the interaction between a chip and a task initiator. As shown in FIG1 , the chip is, for example, a GPGPU (General-purpose computing on graphics processing units) chip 110, and the task initiator is, for example, a host (master control terminal) 120. The chip 110 includes a command processor 111 (or task scheduler, etc.), one or more computing units 112, and a storage unit 113. The command processor 111 is used to parse the command packet sent by the master control terminal host 120 and send the workload specified in the command packet to the core module of the chip (such as the computing unit 112). The host can be any hardware processor or hardware module, including a CPU.
[0039] Host 120 includes a driver 121 and a storage unit 122. Applications can create command queues (e.g., ring buffers) through driver 121 (or the driver itself) and map them to command processor 111. After creating the command queue, driver 121 prepares command packets in storage unit 122 and notifies command processor 111 via a doorbell to execute a task. Host 120 then waits for the task to complete. In some of the following embodiments, a command queue may also be referred to as a task queue or simply a queue.
[0040] Figure 2 shows a schematic diagram of a command queue. As shown in Figure 2, the command queue (or task queue) includes multiple computing loads arranged in sequence according to the execution order, for example, including computing load 1, computing load 2 and computing load 3 arranged in sequence. In addition, the command queue can also include a barrier (or barrier command, barrier). The barrier command is located between the computing loads. The barrier command is a command used for synchronization. When processing the barrier command, it is necessary to check whether the computing loads before the barrier command in the command queue have all been executed. Only when it is confirmed that they have all been executed can the barrier command be ended and the computing load after the barrier command can be executed. The command processor 111 can parse and process the synchronization command in the command packet.
[0041] Figure 3 shows a processing flow chart for a command processor. As shown in Figures 1 and 3, after receiving a doorbell notification, command processor 111 can read a command packet from storage unit 122 and then parse the command packet (step S101). If the current command packet is a workload command packet containing a computing task, the computing task is sent to the chip's computing unit 112 (step S102). Command processor 111 collects the completion status of each computing unit 112. When command processor 111 determines that a task in a queue (e.g., computing workload 1) has completed execution (step S103), command processor 111 can update the corresponding completion signal in memory (step S104). For example, when command processor 111 confirms that a computing workload has completed, it can write a 0 to a memory area designated by the driver in storage unit 112 (the area used to store the completion signal) (previously, the driver will set it to a valid value greater than 0). Driver 121 can determine whether a computing workload has completed execution by checking whether this memory area is 0.
[0042] If the current command packet contains a synchronization command such as a barrier command (for example, the current command packet is a barrier command packet or a command packet with a barrier function), the command processor 111 can start the barrier process of the queue (step S105), and the queue enters the barrier state. The command processor 111 needs to check whether all tasks (computational loads) before the barrier command have ended (step S106). If it is confirmed that all tasks before the barrier command in the current queue (for example, computational load 1 and computational load 2) have ended, the barrier command can be ended (step S108), or it can be said that the barrier state is ended to execute the task after the barrier command (for example, computational load 3). If the task before the barrier command in the current queue has not ended, that is, the queue is still in the barrier state, the query status can be continued or switched to other queues for execution (step S107), where continuing to query the status means continuing to query the processing status of all tasks before the barrier command in the current queue. In step S107, while the command processor is waiting for the computational load in the current queue to end, if there are still commands to be processed in other command queues, the command processor can still process the command packets of other command queues, such as processing and issuing command packets in other queues, to improve processing efficiency. For example, the chip includes multiple computing units such as computing unit A1 and computing unit A2. Computational load 1 is sent to computing unit A1 for execution, and computational load 2 is sent to computing unit A2 for execution. When computing unit A1 has completed computational load 1, but computing unit A2 has not yet completed computational load 2, it is necessary to wait for computational load 2 to complete. While waiting for computational load 2 to execute, the command processor can send computational loads in other queues to computing unit A1 so that computing unit A1 can process computational loads in other queues. After waiting for all computational loads in the current command queue that are located before the barrier command to complete, the barrier can be ended (step S108).
[0043] As shown in Figures 1 and 2, command processor 111 sends computational load 1 and computational load 2 to computational unit 112 sequentially. If sufficient resources are available, computational load 1 and computational load 2 can be executed simultaneously on computational unit 112. When a barrier command is encountered, command processor 111 waits for computational load 1 and computational load 2 to complete execution on computational unit 112 before terminating the barrier command and starting to send computational load 3 to computational unit 112.
[0044] The above scheme describes the task processing flow for a single chip. The inventors discovered that in a multi-chip interconnected architecture, if a multi-chip module is used to process the command queue, each computational load in the queue can be distributed to multiple chips for processing, with each chip processing a portion of the computational load. For example, if the multi-chip architecture includes four chips, computational load 1 can be divided into four sub-loads, with each chip executing one of the sub-loads. However, in this case, if a synchronization command is encountered, each chip can only achieve its own synchronization and cannot guarantee synchronization between multiple chips.
[0045] At least one embodiment of the present disclosure provides a task processing method for a multi-chip module, a task processing method for a chip, a chip, a multi-chip module, an electronic device, and a computer-readable storage medium. The multi-chip module includes N chips, and the task processing method for the multi-chip module includes: each chip in the N chips obtains subqueue information related to a current task queue, wherein the current task queue includes multiple tasks arranged in an execution order and a synchronization command located between the multiple tasks, each of the multiple tasks includes N subtasks, and the N subtasks are respectively configured to be executed by the N chips; each chip executes the corresponding subtasks in the current task queue in order of execution according to its own subqueue information; each chip confirms whether the N chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command in response to executing the synchronization command, and if it is confirmed that the N chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command, then the synchronization command is terminated to execute the corresponding subtask located after the synchronization command, wherein N is an integer greater than 1.
[0046] According to this task processing method, the barrier command is terminated only when it is confirmed that each chip in the multi-chip module has completed the corresponding subtask before the barrier command. In this way, synchronization between multiple chips is achieved through the barrier command, so that multiple chips are forced to synchronize when they execute to a certain point in the queue that requires synchronization, effectively ensuring that each chip can execute correctly when the previous and next commands in the queue are dependent.
[0047] FIG4 illustrates a schematic diagram of a multi-chip module according to at least one embodiment of the present disclosure. As shown in FIG4 , the multi-chip module 200 includes N interconnected chips (N is an integer greater than 1), such as a plurality of interconnected dies (die 0, die 1, die 2, and die 3, etc.), each of which can be considered a chip. The number of dies can also be determined based on actual conditions. In other embodiments, for example, two dies or more than four dies may be included.
[0048] For example, in some embodiments, the N chips included in the multi-chip module can be chips of the same type, such as all GPU chips or DSA chips. In other embodiments, the N chips included in the multi-chip module can be chips of multiple different types. For example, the multi-chip module can be a hybrid multi-chip module composed of DSA chips, GPU chips, GPGPU chips, etc.
[0049] For example, each Die may include modules such as a command processor, a computing unit, and a storage unit, and there are high-speed interconnection channels between Dies. Multiple Dies may include a master Die and multiple slave Dies. For example, Die 0 is the master Die, and Die 1 to Die 3 are all slave Dies. Each chip in the multi-chip module 200 can interact with the host side. For example, the master Die can interact directly with the host side, and each slave Die can interact with the host side through the master Die. The command processor in the master Die can be defined as the master command processor, and the command processor in the slave Die can be defined as the slave command processor. There can be an interconnection channel between the master command processor and each slave command processor. The master Die can be responsible for distributing tasks, synchronizing with the host side, etc., and each slave Die can share the computing load with the master Die. The tasks issued by the host side can be distributed to the computing units of each Die in some form.
[0050] FIG5 shows a flowchart of a task processing method for a multi-chip module provided by at least one embodiment of the present disclosure.
[0051] As shown in FIG5 , the task processing method may include steps S210 to S240 .
[0052] Step S210: Each of the N chips obtains subqueue information associated with a current task queue. The current task queue includes multiple tasks arranged in an execution order and synchronization commands between the multiple tasks. Each of the multiple tasks includes N subtasks, and the N subtasks are configured to be executed by the N chips.
[0053] Step S220: Each chip executes the corresponding subtasks in the current task queue in sequence according to its own subqueue information.
[0054] Step S230 : In response to executing the synchronization command, each chip confirms whether all N chips have completed executing the corresponding subtasks that are located before the synchronization command in the current task queue.
[0055] Step S240: If it is confirmed that the N chips have all completed executing the corresponding subtasks located before the synchronization command in the current task queue, then the synchronization command is terminated to execute the corresponding subtasks located after the synchronization command.
[0056] For example, in step S210, the task may include a computing task (or computing load), an image processing task, a rendering pipeline task, etc. In some of the following embodiments, multiple tasks including multiple computing loads are used as an example for explanation. For example, the current task queue includes computing load 1, computing load 2, and computing load 3 arranged in sequence according to the execution order. The synchronization command may include a barrier command. For example, there is a barrier command between computing load 2 and computing load 3. In this case, the current task queue includes computing load 1, computing load 2, a barrier command, and computing load 3 arranged in sequence. It should be noted that the barrier command may be a barrier command packet or a command packet with a barrier function.
[0057] For example, this task processing method can be used in the multi-chip module 200 shown in FIG4 . The multi-chip module 200 includes at least N chips. For example, if N=4, the multi-chip module 200 may include Die 0, Die 1, Die 2, and Die 3. Each of Die 0, Die 1, Die 2, and Die 3 can serve as a chip. Correspondingly, each computing load in the current command queue can include at least four sub-loads (or subtasks), which are executed by the four dies, respectively.
[0058] It should be noted that the embodiments of the present disclosure are described using N chips that are respectively used to execute N subtasks as an example, but are not intended to limit the multi-chip module to only include these N chips. In some embodiments, the multi-chip module may include other chips in addition to these N chips. In actual applications, other chips besides the N chips may also receive task packets in the current task queue, but since these chips are not used to execute task packets, these chips can directly enter the process of completing the processing after receiving the task packets. Each chip in the multi-chip module can determine whether it is necessary to execute the task packet by judging the conditions.
[0059] Figure 6 shows a schematic diagram of a current task queue provided by at least one embodiment of the present disclosure. As shown in Figure 6, computing load 1 can be divided into computing load 1a, computing load 1b, computing load 1c, and computing load 1d. Computing loads 1a-1d are all sub-loads of computing load 1 and are executed by Die 0-3 respectively. Similarly, other computing loads can also include four sub-loads.
[0060] For example, the subqueue information corresponding to each chip includes information about the subtasks in the current task queue that the chip needs to execute. In addition, the subqueue information can also include information about barrier commands between subtasks. In the subqueue information, the order in which each subtask and barrier command are arranged is consistent with the order in which each task and barrier command are arranged in the current task queue. It can be understood that the current task queue is divided into multiple subqueues, and each chip executes one of the subqueues. The subqueue information corresponding to each chip includes information about the subqueue that the chip needs to execute. For example, the subqueue information 310 corresponding to Die 0 includes information about the computational load 1a, computational load 2a, barrier commands, and computational load 3a that Die 0 needs to execute. Similarly, subqueue information 320 to 340 includes information about the subtasks that Die1 to Die3 need to execute, respectively.
[0061] For example, in some embodiments, each chip can obtain the complete computing load command packet in the current task queue 300. For example, the master chip can obtain it from the host's storage unit, and the slave chip can obtain it from the host's storage unit through the master chip. It can be understood that each chip has a complete current task queue 300. When executing, each chip can only execute a portion of each computing load. For example, for computing load 1, Die 0 to Die 3 can all obtain the command packet of computing load 1. When executing, Die 0 can execute computing load 1a according to its corresponding sub-queue information, Die 1 can execute computing load 1b according to its corresponding sub-queue information, Die 2 can execute computing load 1c according to its corresponding sub-queue information, and Die 3 can execute computing load 1d according to its corresponding sub-queue information. For example, in other embodiments, each chip can also only obtain the command packet of its corresponding sub-load.
[0062] For example, in step S220, Die 0 can execute computing load 1a, computing load 2a, etc. in sequence according to its corresponding subqueue information. When processing the barrier command, Die 0 enters the barrier state. In this barrier state, Die 0 needs to confirm whether it and other dies (Die 1 to Die 3) have completed the corresponding subtasks before the barrier command, for example, confirm whether Die 0 has completed computing load 1a and computing load 2a, whether Die 1 has completed computing load 1b and computing load 2b, whether Die 2 has completed computing load 1c and computing load 2c, and whether Die 3 has completed computing load 1d and computing load 2d. If Die 0 confirms that it and other dies have completed the corresponding subtasks before the barrier command, Die 0 can end the barrier task (i.e., end the barrier state) and start executing computing load 3a. Similarly, when processing the barrier task, each Die in Die 1, Die 2, and Die 3 also needs to confirm whether itself and other Dies have completed the corresponding subtasks before the barrier command. If they are all confirmed to be completed, the barrier command is ended to execute subsequent subtasks.
[0063] According to the task processing method of the embodiment of the present disclosure, the barrier command is terminated only when it is confirmed that each chip in the multi-chip module has completed executing the corresponding subtask before the barrier command. In this way, synchronization between multiple chips is achieved through the barrier command, so that multiple chips are forced to synchronize when they execute to a certain point in the queue that requires synchronization, effectively ensuring that each chip can execute correctly when the previous and next commands in the queue are dependent.
[0064] For example, N chips include a master chip and at least one slave chip. As shown in Figure 4, Die 0 is the master die, and Dies 1 through 3 are slave dies. For example, a register representing master-slave information can be added to each die. The value of this register allows the hardware to determine whether it is a master die or a slave die. In other embodiments, other methods can be used to distinguish between master and slave.
[0065] For example, in step S230, for each slave chip, in response to executing the synchronization command, it is confirmed whether the slave chip itself has completed the corresponding subtask located before the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been completed, a first synchronization signal is sent to the master chip; if a second synchronization signal sent by the master chip is received, the synchronization command is ended, wherein the second synchronization signal indicates that the master chip has received all the first synchronization signals sent by at least one slave chip.
[0066] For example, in step S230, for the master chip, in response to executing the synchronization command, confirm whether the master chip itself has completed executing the corresponding subtask located before the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been executed, check whether the first synchronization signal sent by all at least one slave chip has been received; if the first synchronization signal sent by all at least one slave chip has been received, send a second synchronization signal to each slave chip and end the synchronization command.
[0067] For example, as shown in Figure 6, when Die 1 processes the barrier command, the command processor of Die 1 can first confirm whether the calculation load 1b and the calculation load 2b have both ended. If the calculation load 1b and / or the calculation load 2b have not yet ended, it will wait for the calculation load 1b and the calculation load 2b to end. During this process, the command processor can continuously query the processing status and switch to execute other queues. After querying that the calculation load 1b and the calculation load 2b have both ended, a first synchronization signal can be sent to Die 0. Similarly, after confirming that each of Die 2 and Die 3 has completed the corresponding subtask before the load command, they can send the first synchronization signal to Die 0.
[0068] For example, after receiving the first synchronization signal sent by each slave Die, Die 0 can record the slave Die that sent the first synchronization signal. When processing the barrier command, Die 0 can first confirm whether the calculation load 1a and the calculation load 2a are both completed. If the calculation load 1a and / or the calculation load 2a have not yet ended, then wait for the calculation load 1a and the calculation load 2a to end. During this process, the command processor can continuously query the processing status and switch to execute other queues. After querying that the calculation load 1a and the calculation load 2a are both completed, it can further query whether each slave Die has sent the first synchronization signal. If the first synchronization signal of at least some of the slave Dies has not been received, then wait. During the waiting process, it can continuously query whether the first synchronization signal of at least some of the slave Dies has been received. After querying that the first synchronization signals of all slave Dies have been received, it can be confirmed that each Die has completed the subtask it was responsible for before the barrier command, so that the master Die can send a second synchronization signal to each slave Die to inform each slave Die that the synchronization has been completed, the barrier command can be ended, and the execution can continue.
[0069] According to the interactive operation described above, the master and slave chips first confirm whether they have completed their corresponding subtasks in the barrier state, then aggregate the task completion status to the master chip. Once the master chip confirms that all chips have completed the task, it notifies each slave chip to end the barrier state. This method can quickly aggregate the processing status of each chip, making synchronization more efficient.
[0070] For example, each slave chip may have a slave synchronization register associated with the current task queue, and the slave synchronization register includes at least a bit corresponding to the current slave chip (i.e., the slave chip to which the slave synchronization register belongs) and a bit corresponding to the master chip, and the bits corresponding to the slave chip and the bits corresponding to the master chip both have initial values. For each slave chip, if it is confirmed that the corresponding subtask located before the synchronization command has been executed, the bit corresponding to the current slave chip in the slave synchronization register is changed from the initial value to the target value, and a first synchronization signal is sent to the master chip. In response to receiving the second synchronization signal sent by the master chip, the bit corresponding to the master chip in the slave synchronization register is changed from the initial value to the target value; the value of the slave synchronization register is queried, and if the bit corresponding to the current slave chip and the bit corresponding to the master chip in the slave synchronization register are both target values, the synchronization command is terminated.
[0071] For example, the slave synchronization register may include bits corresponding to other slave chips in addition to bits corresponding to the current slave chip and bits corresponding to the master chip.
[0072] FIG7 shows a schematic diagram of a processing flow of a command processor provided by at least one embodiment of the present disclosure.
[0073] As shown in Figure 7, taking the slave chip Die 1 as an example, when processing the barrier command packet in the current queue (step S3011), the barrier process of the queue is started (step S302), the barrier state is entered, and the value of the synchronization register (the slave synchronization register of Die 1) is checked (step S303). The bit width of the slave synchronization register is, for example, consistent with the number of Dies included in the multi-chip module, and each bit of the slave synchronization register represents the state of a Die. The number of Dies is, for example, 4, and correspondingly, the slave synchronization register includes, for example, four bits, and the first to fourth bits represent the states of Die 0, Die 1, Die 2, and Die 3, respectively. The initial value of the slave synchronization register of Die 1 is, for example, 0011, that is, the initial value of the bit representing the current slave Die and master Die in the slave synchronization register can be set to 0, and the initial value of the bit representing other slave Dies can be set to 1. If the bit representing Die 1 in the slave synchronization register of Die 1 is found to be at the initial value, the process checks whether the local subtask has completed (step S304), that is, whether Die 1 itself has completed the corresponding subtask before the barrier command (computing loads 1b and 2b). If not, the process continues to query the task processing status or switches to another queue for execution (S305). If it has completed, the process confirms whether it is the master command processor (step S306). Since Die 1's command processor is not the master command processor, it needs to send a first synchronization signal to the master command processor (step S307) and change the value of the bit corresponding to Die 1 in the slave synchronization register (step S308), changing the bit corresponding to Die 1 in the slave synchronization register to the target value, for example, from 0011 to 0111. When Die 1 receives the second synchronization signal sent by Die 0, the bit corresponding to Die 0 in the slave synchronization register changes from the initial value to the target value, for example, to 1111. After Die 1 executes step S308 and before receiving the second synchronization signal, the bit representing the current slave chip Die 1 in the synchronization register is the target value, and the bit representing the master chip Die 0 is the initial value. During this period, it can continuously check whether the values of the synchronization registers have all become the target values (step S309). If the values of the synchronization registers are not all target values, it can continue to query the status of the synchronization registers or switch to other queues for execution (S305). If the values of the synchronization registers are all target values, it will confirm again whether it is the main command processor (step S310). Since the command processor of Die 1 is not the main command processor, the barrier can be ended (step S312). In addition, after each synchronization signal reception process ends (step S3012), the synchronization process of steps S302 to S312 can also be started. For example, after receiving the second synchronization signal sent by Die 0, Die 1 can start the synchronization process of steps S302 to S312.In the barrier state, if the task completion process of the queue ends (step S3013), the synchronization process of steps S302 to S312 can also be started. For example, after Die 1 completes the corresponding subtask, the synchronization process of steps S302 to S312 can be started multiple times during the waiting period to check in real time whether the barrier command can be ended.
[0074] For example, in other embodiments, the initial value of the slave synchronization register of Die 1 is 0000, that is, the initial values of the bits representing the current slave Die and other Dies in the slave synchronization register can be set to 0. After confirming that Die 1 itself has completed the corresponding subtask, it can be changed to 0100. After receiving the second synchronization signal sent by Die 0, it can be changed to 1111.
[0075] For example, the processing flow of the command processors of the other slave chips Die 2 and Die 3 can refer to the processing flow of the command processor of Die 1 above, and will not be repeated here.
[0076] For example, the above embodiments describe a scenario where a slave die first confirms that it has completed its corresponding subtask and then receives the second synchronization signal. In some embodiments, due to the faster execution speed of the master die and other slave dies, a slave die may first receive the second synchronization signal and then confirm whether it has completed its corresponding subtask. In the latter case, for each slave chip, in response to receiving the second synchronization signal sent by the master chip, the bits corresponding to the master chip and other slave chips in the slave synchronization register are changed to the target value. If it is confirmed that the current slave chip has completed the corresponding subtask that preceded the synchronization command, the bit corresponding to the current slave chip in the slave synchronization register is changed from the initial value to the target value. Taking Die 1 as an example, the initial value of Die 1's slave synchronization register is, for example, 0011. If Die 1 receives the second synchronization signal sent by the master die before confirming whether it has completed its corresponding subtask, in this case, Die 1's slave synchronization register may be changed to 1011. After Die 1 confirms that it has completed its corresponding subtask, Die 1's slave synchronization register is changed to 1111.
[0077] For example, the master chip may have a master synchronization register associated with the current task queue, the master synchronization register including N bits corresponding to the N chips, each of which has an initial value. For the master chip, if it is confirmed that the corresponding subtask located before the synchronization command has been executed, the bit corresponding to the master chip in the master synchronization register is changed from the initial value to the target value, and after each first synchronization signal sent by a slave chip is received, the bit corresponding to the corresponding slave chip in the master synchronization register is changed from the initial value to the target value, until all the first synchronization signals sent by at least one slave chip are received and all the N bits of the master synchronization register are changed to the target value; the value of the master synchronization register is queried, and if all the N bits of the master synchronization register are the target value, it is confirmed that all the first synchronization signals sent by at least one slave chip have been received.
[0078] As shown in FIG7 , taking the master chip Die 0 as an example, when processing the barrier command packet in the current queue (step S3011), the barrier process for that queue is started (step S302), the barrier state is entered, and the value of the synchronization register (the master synchronization register of Die 0) is checked (step S303). The bit width of the master synchronization register is, for example, consistent with the number of dies included in the multi-chip module, and each bit of the master synchronization register represents the state of one die. The number of dies is, for example, 4, and the master synchronization register includes, for example, four bits, with the first to fourth bits representing the states of Die 0, Die 1, Die 2, and Die 3, respectively. The initial value of Die 0's master synchronization register is, for example, 0000, that is, the initial value of each bit in the master synchronization register can be set to 0. If the bit representing Die 0 in the master synchronization register of Die 0 is found to be the initial value, then a check is made to see whether the local subtask has ended (step S304), that is, to see whether Die 0 itself has completed the corresponding subtask (computational loads 1a and 2a) before the barrier command. If it is not completed, the status is continued to be queried or execution is switched to another queue (S305). If it is completed, it is confirmed whether it is the master command processor (step S306). Since the command processor of Die 0 is the master command processor, the value of the synchronization register can be changed (step S308), and the bit corresponding to Die 0 in Die 0's master synchronization register is changed to the target value, for example, the master synchronization register is changed from 0000 to 1000. When Die 0 receives the first synchronization signal sent by a slave die, the bit corresponding to the slave die in the master synchronization register is changed to the target value (for example, 1). For example, when Die 0 receives the first synchronization signal sent by Die 1, the value of the master synchronization register can be changed to 1100; based on 1100, if it continues to receive the first synchronization signal sent by Die 2, the value of the master synchronization register can be changed to 1110; based on 1110, if it continues to receive the first synchronization signal sent by Die 3, the value of the master synchronization register can be changed to 1111. After executing step S308 and before all registers are changed to the target values, Die 0 can continuously check whether the values of the synchronization registers have all reached the target values (step S309). If the values of the synchronization registers are not all at the target values, it means that at least some slave dies still have unfinished corresponding subtasks. It can continue to query the status of the synchronization registers or switch to other queues for execution (step S305). If the values of the synchronization registers are all at the target values, it will reconfirm whether it is the master command processor (step S310). Since the command processor of Die 0 is the master command processor, it can send a second synchronization signal to each slave command processor (step S311) and end the barrier (step S312).
[0079] For example, the master chip has no restrictions on the order in which it receives the first synchronization signals from each slave chip. Each slave chip can send the first synchronization signal to the master chip after confirming that its subtask has completed. Each time the master chip receives the first synchronization signal from a slave die, it changes the bit corresponding to the slave die in the master synchronization register to 1.
[0080] For example, the above embodiment describes a situation where the master die first confirms that it has completed the corresponding subtask and then receives the first synchronization signal sent by each slave die. In some embodiments, due to the faster execution speed of each slave die, the master die may receive the first synchronization signal sent by at least some slave dies before confirming whether it has completed the corresponding subtask. In this case, after receiving the first synchronization signal sent by each slave die, the bit corresponding to the corresponding slave die in the master synchronization register of the master die is changed (for example, changed to 1). After the master die confirms that it has completed the corresponding subtask, the bit corresponding to the master die in the master synchronization register is changed again (for example, changed to 1). Taking Die 0 as an example, the initial value of the main synchronization register of Die 0 is 0000. If Die 0 receives the first synchronization signal sent from Die 1 before confirming whether it has completed the corresponding subtask, in this case, the main synchronization register of Die 0 can be changed to 0100. After receiving the first synchronization signal sent from Die 2, it continues to change to 0110. After Die 0 confirms that it has completed the corresponding subtask, the main synchronization register is changed to 1110. After receiving the first synchronization signal sent from Die 3, the main synchronization register is changed to 1111.
[0081] For example, for the master chip and each slave chip, after the barrier ends, each bit of the respective synchronization register can be reset to the initial value.
[0082] Based on the above operations on the synchronization register, each chip can use the value of the synchronization register to represent the current synchronization state, which is easy to implement and has high accuracy.
[0083] FIG8 shows a schematic diagram of a processing flow of another command processor provided by at least one embodiment of the present disclosure.
[0084] As shown in Figure 8, the difference from the processing flow shown in Figure 7 is that the synchronization status (parameters) is used to characterize the synchronization progress of each chip. For example, when each chip has not yet confirmed that the corresponding subtask has been completed locally, the synchronization status is the first state; when it has confirmed that it has completed the local subtask, the synchronization status is the second state. Taking Die 1 as an example, in step S403, the synchronization status is checked. If it is the first state, steps S404 to S407 are executed, and then the synchronization status is changed to the second state. In this case, the initial value of the slave synchronization register of Die 1 is, for example, 0111. After receiving the second synchronization signal, the slave synchronization register is changed to 1111. Taking Die 0 as an example, in step S403, the synchronization status (S403) is checked. If it is the first state, steps S404 to S407 are executed, and then the synchronization status is changed to the second state. In this case, the initial value of the master synchronization register of Die 0 is, for example, 1000. After each first synchronization signal sent by a slave Die is received, the bit corresponding to the slave Die in the master synchronization register is changed to 1. When the master command processor of Die 0 checks the master synchronization register, if its value is not all 1, it means that at least some Dies have not reached the second state, that is, there are unfinished subtasks in the current queue. Until the value of the master synchronization register becomes all 1, it means that all Dies have reached the second state, and the second synchronization signal is sent to each slave command processor, and Die 0 to Die 3 jointly end the barrier command. The other steps in Figure 8 can refer to the corresponding steps in Figure 7 and will not be repeated here.
[0085] For example, the above-mentioned N chips can be the same or similar chips, and the N chips can have different functions. The N chips all include a command processor or a similar module to complete the above-mentioned synchronization work. For example, one of the N chips is a CPU, and the other chip is a GPU. The subqueue information corresponding to the CPU is, for example, C1-C2-sync-C3, where C1, C2, and C3 each represent a subtask, and sync represents a synchronization command. The subqueue information corresponding to the CPU is, for example, G1-G2-sync-G3, where G1, G2, and G3 each represent a subtask, and sync represents a synchronization command. The task processing method of the embodiment of the present disclosure can ensure that after C1 and C2 in the CPU and G1 and G2 in the GPU are completed, the CPU and GPU will execute C3 and G3 respectively.
[0086] For example, N chips are configured to communicate with a task initiation device, such as Die 0 through Die 3 communicating with a host. For example, in some embodiments, the task processing method may further include: upon completing the corresponding subtask of each task in the current task queue, each chip transmits a completion message to the task initiation device, so that the task initiation device confirms the completion of each task. In this manner, each task is notified to the task initiation device upon completion, thereby achieving synchronization between each chip and the task initiation device.
[0087] For example, the current task queue includes a first task, and the task initiating device pre-stores a task status value for the first task. After each chip completes a corresponding subtask of the first task, it performs an arithmetic operation on the task status value to change the task status value. After all N chips have performed the arithmetic operation, the task status value is changed to a completion value. The task initiating device then determines whether the first task is completed based on whether the task status value is the completion value.
[0088] FIG9 illustrates a schematic diagram of the processing flow of another command processor provided by at least one embodiment of the present disclosure. As shown in FIG9 , taking Die 0 as an example, before sending a task to the main command processor, the host can pre-store a task status value for each task. This task status value can be consistent with the number of dies, for example, 4. This task status value can be stored in a memory area designated by the host. This task status value serves as a task completion signal, indicating whether the corresponding task has ended. After receiving a command packet for a task, the main command processor parses the computational command packet and distributes the resulting subtasks to the computational units of Die 0. If the command processor detects that a computational unit has completed a subtask for a task in a certain queue, it updates the task status value on the host side, for example, by using an atomic subtraction operation to decrement the corresponding task status value by one. Similarly, after other dies complete subtasks for the same task in the same queue, they also update the corresponding task status values, for example, by using an atomic operation to decrement the corresponding task status value by one. Atomic operations are hardware mechanisms that ensure that memory operations on a particular die are not interfered with by other dies. The host side can determine whether the task is completed in the multi-die system by checking whether the task status value is 0 (completion value). On any die, when the task is completed, if the queue is in the barrier state, the barrier process is entered.
[0089] At least one embodiment of the present disclosure further provides a task processing method for a chip.
[0090] FIG10 shows a flowchart of a task processing method for a chip provided by at least one embodiment of the present disclosure.
[0091] As shown in FIG10 , the task processing method for a chip includes steps S510 to S540 .
[0092] Step S510: Obtain subqueue information associated with the current task queue. The current task queue includes multiple tasks arranged in execution order and synchronization commands between the multiple tasks. Each of the multiple tasks includes N subtasks, and the N subtasks are respectively configured to be executed by a chip and (N-1) associated chips, where N is an integer greater than 1.
[0093] Step S520: Execute the corresponding subtasks in the current task queue in order according to the subqueue information.
[0094] Step S530: In response to the execution of the synchronization command, confirm whether the chip itself and the (N-1) associated chips have all completed the execution of the corresponding subtasks located before the synchronization command in the current task queue.
[0095] Step S540: If it is confirmed that the chip itself and the (N-1) associated chips have completed executing the corresponding subtasks before the synchronization command in the current task queue, then the synchronization command is terminated to execute the corresponding subtasks after the synchronization command.
[0096] For example, in the case where the (N-1) associated chips include a master chip, and the chip is a slave chip associated with the master chip, step S530 may include: in response to executing a synchronization command, confirming whether the chip itself has completed executing the corresponding subtask located before the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been completed, sending a first synchronization signal to the master chip; if a second synchronization signal sent by the master chip is received, confirming that the chip itself and the (N-1) associated chips have all completed executing the corresponding subtask located before the synchronization command in the current task queue. The second synchronization signal indicates that the master chip has received the first synchronization signal sent by all slave chips associated with the master chip.
[0097] For example, when the chip is the master chip and each of the (N-1) associated chips is a slave chip of the master chip, step S530 may include: in response to executing the synchronization command, confirming whether the chip itself has completed executing the corresponding subtask located before the synchronization command; if it is confirmed that the corresponding subtask located before the synchronization command has been completed, checking whether the first synchronization signal sent by all (N-1) associated chips has been received; if the first synchronization signal sent by all (N-1) associated chips has been received, confirming that the chip itself and the (N-1) associated chips have completed executing the corresponding subtask located before the synchronization command in the current task queue, sending the second synchronization signal to the (N-1) associated chips respectively, and ending the synchronization command.
[0098] For example, in the case where the (N-1) associated chips include a master chip, and the chip is a slave chip related to the master chip, step S530 may include: if it is confirmed that the corresponding subtask before the synchronization command has been executed, the bit corresponding to the chip in the slave synchronization register will be changed from the initial value to the target value, and a first synchronization signal will be sent to the master chip; in response to receiving the second synchronization signal sent by the master chip, the bit corresponding to the master chip in the slave synchronization register will be changed from the initial value to the target value; the value of the slave synchronization register will be queried, and if the bit corresponding to the chip and the bit corresponding to the master chip in the slave synchronization register are both target values, it is confirmed that the chip itself and the (N-1) associated chips have completed the corresponding subtasks before the synchronization command in the current task queue.
[0099] For example, when the chip is the master chip and each of the (N-1) associated chips is a slave chip of the master chip, step S530 may include: if it is confirmed that the corresponding subtask before the synchronization command has been executed, the bit corresponding to the master chip in the master synchronization register is changed from the initial value to the target value, and after each first synchronization signal sent by a slave chip is received, the bit corresponding to the corresponding slave chip in the master synchronization register is changed from the initial value to the target value, until after receiving the first synchronization signal sent by at least one slave chip, the N bits in the master synchronization register are all changed to the target value; query the value of the master synchronization register, if the N bits of the master synchronization register are all target values, it is confirmed that the chip itself and the (N-1) associated chips have completed the corresponding subtask before the synchronization command in the current task queue.
[0100] For example, the chip is configured to communicate with a task initiating device. The task processing method further includes: after completing the corresponding subtask of each task in the current task queue, sending completion information to the task initiating device so that the task initiating device can confirm whether each task is completed.
[0101] For example, the current task queue includes a first task, and the task initiating device pre-stores a task status value for the first task. After completing the corresponding subtask of each task in the current task queue, a completion message is sent to the task initiating device so that the task initiating device confirms whether each task is completed, including: performing an arithmetic operation on the task status value after completing the corresponding subtask of the first task to change the task status value. After all N chips perform the arithmetic operation on the task status value, the task status value is changed to a completion value. The task initiating device can determine whether the first task is completed based on whether the task status value is the completion value.
[0102] For example, the specific implementation and functions of the task processing method for a chip can refer to the relevant description of the task processing method for a multi-chip module, which will not be repeated here.
[0103] At least one embodiment of the present disclosure further provides a chip.
[0104] FIG11 shows a schematic diagram of a chip provided by at least one embodiment of the present disclosure. As shown in FIG11 , the chip 600 includes a command processor 610 and a task processing device 620. The command processor 610 is configured to obtain subqueue information related to a current task queue, wherein the current task queue includes multiple tasks arranged in an execution order and synchronization commands located between the multiple tasks. Each of the multiple tasks includes N subtasks, and the N subtasks are configured to be executed by the chip and (N-1) associated chips, respectively. The task processing device 620 is configured to execute the corresponding subtasks in the current task queue in the execution order according to the subqueue information. The command processor 610 is further configured to: in response to executing a synchronization command, confirm whether the chip itself and the (N-1) associated chips have all completed the corresponding subtasks in the current task queue that precede the synchronization command; if it is confirmed that the chip itself and the (N-1) associated chips have all completed the corresponding subtasks in the current task queue that precede the synchronization command, then terminate the synchronization command to execute the corresponding subtask located after the synchronization command, where N is an integer greater than 1.
[0105] For example, the command processor 610 may execute steps S510 , S530 , and S540 described in FIG. 10 , and the task processing device 620 may execute step S520 described in FIG. 10 .
[0106] For example, the components and structure of chip 600 shown in FIG11 are merely exemplary and non-restrictive. As needed, the chip may further include more or fewer circuits, devices, units, modules, or apparatuses, for example, a storage unit. Furthermore, the connection relationships between the various circuits, devices, units, modules, or apparatuses are not limited and may be determined based on actual needs. The specific configuration of each circuit, device, unit, module, or apparatus is not limited and may be composed of analog devices according to circuit principles, or may be composed of digital chips, or may be constructed in other applicable manners.
[0107] For example, the specific implementation and functions of the chip can refer to the relevant descriptions of the task processing method for the multi-chip module and the task processing method for the chip, which will not be repeated here.
[0108] At least one embodiment of the present disclosure further provides a multi-chip module.
[0109] FIG12 shows a schematic diagram of a multi-chip module provided by at least one embodiment of the present disclosure. As shown in FIG12 , the multi-chip module 700 includes N chips that communicate with each other: chip 1 to chip N. Each of the N chips is configured to: obtain subqueue information related to the current task queue, wherein the current task queue includes multiple tasks arranged in an execution order and synchronization commands located between the multiple tasks, each of the multiple tasks includes N subtasks, and the N subtasks are respectively configured to be executed by N chips; execute the corresponding subtasks in the current task queue in order of execution according to their respective subqueue information; in response to executing the synchronization command, confirm whether the N chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command; if it is confirmed that the N chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command, then end the synchronization command to execute the corresponding subtask located after the synchronization command, wherein N is an integer greater than 1.
[0110] For example, the N chips may be identical or similar chips, and the N chips may have different functions. The N chips all include a command processor or a similar module to complete the synchronization work. For example, one of the N chips is a CPU, and another chip is a GPU. The subqueue information corresponding to the CPU is, for example, C1-C2-sync-C3, where C1, C2, and C3 each represent a subtask, and sync represents a synchronization command. The subqueue information corresponding to the CPU is, for example, G1-G2-sync-G3, where G1, G2, and G3 each represent a subtask, and sync represents a synchronization command. The multi-chip module of the disclosed embodiment can ensure that after C1 and C2 in the CPU and G1 and G2 in the GPU are completed, the CPU and GPU will execute C3 and G3 respectively.
[0111] For example, the specific implementation and functions of the multi-chip module can refer to the relevant description of the task processing method for the multi-chip module, which will not be repeated here.
[0112] At least one embodiment of the present disclosure further provides an electronic device comprising a task initiating device and a multi-chip module.
[0113] The electronic device may be a server, a laptop computer, a desktop computer, a mobile phone, a smart home device, etc. The task initiating device and the multi-chip module in the electronic device may refer to the relevant descriptions in the above embodiments, which will not be repeated here.
[0114] At least one embodiment of the present disclosure further provides another electronic device, comprising a processor and a memory, wherein the memory stores one or more computer program modules. The one or more computer program modules are configured to be executed by the processor to implement the above-mentioned task processing method (the task processing method for a multi-chip module or the task processing method for a chip).
[0115] Figure 13 is a schematic block diagram of another electronic device provided by some embodiments of the present disclosure. As shown in Figure 13, the electronic device 800 includes a processor 810 and a memory 820. The memory 820 stores non-temporary computer-readable instructions (such as one or more computer program modules). The processor 810 is used to run non-temporary computer-readable instructions, and the non-temporary computer-readable instructions are executed by the processor 810 when they are executed. One or more steps in the task processing method described above are executed. The memory 820 and the processor 810 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For the specific implementation of each step of the information processing method and the related explanation content, please refer to the embodiment of the above-mentioned information processing method, and the repetitions will not be repeated here.
[0116] It should be noted that the components of the electronic device 800 shown in FIG13 are merely exemplary and non-limiting. The electronic device 800 may also have other components according to actual application requirements.
[0117] For example, the processor 810 and the memory 820 may communicate with each other directly or indirectly.
[0118] For example, the processor 810 and the memory 820 may communicate via a network. The network may include a wireless network, a wired network, and / or any combination of a wireless network and a wired network. The processor 810 and the memory 820 may also communicate with each other via a system bus, which is not limited in this disclosure.
[0119] For example, the processor 810 and the memory 820 may be provided on a server side (or a cloud side).
[0120] For example, the processor 810 can control other components in the electronic device 800 to perform desired functions. For example, the processor 810 can be a central processing unit (CPU), a graphics processing unit (GPU), or other processing units with data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) can be an X86 or ARM architecture. The processor 810 can be a general-purpose processor or a dedicated processor, and can control other components in the electronic device 800 to perform desired functions.
[0121] For example, the memory 820 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), a hard disk, an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, a flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 810 may execute one or more computer program modules to implement various functions of the electronic device 800. Various applications and various data, as well as various data used and / or generated by the applications, may also be stored in the computer-readable storage medium.
[0122] For example, in some embodiments, the electronic device 800 may be a mobile phone, a tablet computer, an electronic paper, a television, a monitor, a laptop computer, a digital photo frame, a navigator, a wearable electronic device, a smart home device, etc.
[0123] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 800 can be referred to the above description of the task processing method, which will not be repeated here.
[0124] Figure 14 is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. This electronic device 900 is suitable for implementing the task processing method provided in the embodiments of the present disclosure, for example. The electronic device 900 may be a terminal device, etc. It should be noted that the electronic device 900 shown in Figure 14 is merely an example and does not impose any limitations on the functionality and scope of use of the embodiments of the present disclosure.
[0125] As shown in FIG14 , the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 910, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 920 or a program loaded from a storage device 980 into a random access memory (RAM) 930. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 930. The processing device 910, the ROM 920, and the RAM 930 are connected to each other via a bus 940. An input / output (I / O) interface 950 is also connected to the bus 940.
[0126] Typically, the following devices may be connected to the I / O interface 950: an input device 960 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 970 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 980 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 990. The communication device 990 may allow the electronic device 900 to communicate with other electronic devices wirelessly or by wire to exchange data. Although FIG14 shows the electronic device 900 with various devices, it should be understood that it is not required to implement or have all of the devices shown, and the electronic device 900 may alternatively implement or have more or fewer devices.
[0127] For example, according to an embodiment of the present disclosure, the above-mentioned task processing method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned task processing method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 990, or installed from the storage device 980, or installed from the ROM 920. When the computer program is executed by the processing device 910, the functions defined in the task processing method provided in the embodiment of the present disclosure can be implemented.
[0128] At least one embodiment of the present disclosure further provides a computer-readable storage medium storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the above-mentioned task processing method can be implemented.
[0129] Figure 15 is a schematic diagram of a storage medium provided by some embodiments of the present disclosure. As shown in Figure 15, storage medium 1000 stores non-transitory computer-readable instructions 1010. For example, when non-transitory computer-readable instructions 1010 are executed by a computer, one or more steps of the task processing method described above are performed.
[0130] For example, the storage medium 1000 can be applied to the electronic device 800 described above. For example, the storage medium 1000 can be the memory 820 in the electronic device 800 shown in FIG13 . For example, the relevant description of the storage medium 1000 can refer to the corresponding description of the memory 820 in the electronic device 800 shown in FIG13 , and will not be repeated here.
[0131] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0132] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0133] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
[0134] Regarding this disclosure, the following points need to be explained:
[0135] (1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure. Other structures may refer to conventional designs.
[0136] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to form new embodiments.
[0137] The above description is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. The protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A task processing method for a multi-chip module, wherein: The multi-chip module includes N chips, and the method includes: Each of the N chips acquires respective subqueue information related to a current task queue, wherein the current task queue includes a plurality of tasks arranged in an execution order and synchronization commands between the plurality of tasks, each of the plurality of tasks includes N subtasks, and the N subtasks are respectively configured to be executed by the N chips; Each chip executes the corresponding subtasks in the current task queue in sequence according to the respective subqueue information and the execution order; In response to executing the synchronization command, each chip confirms whether the N chips have all completed the corresponding subtasks in the current task queue that are located before the synchronization command. If it is confirmed that the N chips have all completed the corresponding subtasks in the current task queue that are located before the synchronization command, the synchronization command is terminated to execute the corresponding subtasks located after the synchronization command. Wherein, N is an integer greater than 1.
2. The method according to claim 1, wherein: The N chips include a master chip and at least one slave chip; In response to executing the synchronization command, each chip confirms whether the N chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command, including: In response to executing the synchronization command, each of the at least one slave chip confirms whether the slave chip itself has completed executing a corresponding subtask located before the synchronization command; If it is confirmed that the corresponding subtask before the synchronization command has been executed, sending a first synchronization signal to the main chip; If the second synchronization signal sent by the master chip is received, the synchronization command is terminated; The second synchronization signal indicates that the master chip has received all of the first synchronization signals sent by the at least one slave chip.
3. The method according to claim 2, wherein: In response to executing the synchronization command, each chip confirms whether the N chips have all executed the corresponding subtasks in the current task queue that are located before the synchronization command, including: The master chip responds to the synchronization command and confirms whether the master chip itself executes Complete the corresponding subtask located before the synchronization command; If it is confirmed that the corresponding subtask before the synchronization command has been executed, checking whether all of the first synchronization signals sent by the at least one slave chip have been received; If the first synchronization signal sent by all the at least one slave chip has been received, the second synchronization signal is sent to each slave chip, and the synchronization command is ended.
4. The method according to claim 2, wherein: Each of the slave chips has a slave synchronization register associated with the current task queue, the slave synchronization register at least including a bit corresponding to the slave chip and a bit corresponding to the master chip, and the bit corresponding to the slave chip and the bit corresponding to the master chip both have initial values; For each of the slave chips, if it is confirmed that the corresponding subtask located before the synchronization command has been executed, the first synchronization signal is sent to the master chip, including: if it is confirmed that the corresponding subtask located before the synchronization command has been executed, the bit corresponding to the slave chip in the slave synchronization register is changed from the initial value to the target value, and the first synchronization signal is sent to the master chip; If the second synchronization signal sent by the master chip is received, then the synchronization command is ended, comprising: In response to receiving the second synchronization signal sent by the master chip, changing the bit in the slave synchronization register corresponding to the master chip from the initial value to the target value; The value of the slave synchronization register is queried, and if the bit corresponding to the slave chip and the bit corresponding to the master chip in the slave synchronization register are both the target values, the synchronization command is terminated.
5. The method according to claim 3, wherein: The master chip has a master synchronization register associated with the current task queue, the master synchronization register includes N bits corresponding to the N chips respectively, and the N bits all have initial values; For the master chip, if it is confirmed that the corresponding subtask before the synchronization command has been executed, checking whether all the first synchronization signals sent by the at least one slave chip have been received includes: If it is confirmed that the corresponding subtask before the synchronization command has been executed, the bit corresponding to the master chip in the master synchronization register is changed from the initial value to the target value, and after each first synchronization signal sent by the slave chip is received, the bit corresponding to the slave chip in the master synchronization register is changed from the initial value to the target value, until after receiving all the first synchronization signals sent by at least one slave chip, the N bits of the master synchronization register are changed is the target value; The value of the master synchronization register is queried, and if the N bits of the master synchronization register are all the target values, it is confirmed that all of the first synchronization signals sent by the at least one slave chip have been received.
6. The method according to any one of claims 1 to 5, wherein: The N chips are configured to communicate with a task initiating device; The task processing method further includes: after each chip completes the corresponding subtask of each task in the current task queue, sending completion information to the task initiating device, so that the task initiating device confirms whether each task is completed.
7. The method according to claim 6, wherein: The current task queue includes a first task, and the task initiating device pre-stores a task status value for the first task; After completing the corresponding subtask of each task in the current task queue, each chip sends completion information to the task initiating device so that the task initiating device confirms whether each task is completed, including: After completing the corresponding subtask of the first task, each chip performs an operation on the task status value to change the task status value. After all the N chips have performed the operation, the task status value is changed to a completion value, so that the task initiating device determines whether the first task is completed based on whether the task status value is the completion value.
8. A task processing method for a chip, comprising: Acquire subqueue information related to a current task queue, wherein the current task queue includes a plurality of tasks arranged in an execution order and synchronization commands between the plurality of tasks, each of the plurality of tasks includes N subtasks, and the N subtasks are respectively configured to be executed by the chip and (N-1) associated chips; According to the subqueue information, the corresponding subtasks in the current task queue are executed in sequence according to the execution order; In response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have all completed executing corresponding subtasks in the current task queue that are located before the synchronization command; If it is confirmed that the chip itself and the (N-1) associated chips have completed executing the corresponding subtasks in the current task queue before the synchronization command, then the synchronization command is terminated to execute the corresponding subtasks after the synchronization command. Wherein, N is an integer greater than 1.
9. The method according to claim 8, wherein: In the case where the (N-1) associated chips include a master chip, and the chip is a slave chip associated with the master chip, In response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have all completed executing the corresponding subtasks in the current task queue that are located before the synchronization command, includes: In response to executing the synchronization command, confirming whether the chip itself has completed executing a corresponding subtask located before the synchronization command; If it is confirmed that the corresponding subtask before the synchronization command has been executed, sending a first synchronization signal to the main chip; If the second synchronization signal sent by the master chip is received, the synchronization command is terminated; The second synchronization signal indicates that the master chip has received the first synchronization signals sent by all slave chips related to the master chip.
10. The method according to claim 8, wherein: In the case where the chip is a master chip and each of the (N-1) associated chips is a slave chip of the master chip, In response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have all completed executing the corresponding subtasks in the current task queue that are located before the synchronization command, includes: In response to executing the synchronization command, confirming whether the chip itself has completed executing a corresponding subtask located before the synchronization command; If it is confirmed that the corresponding subtask before the synchronization command has been executed, checking whether the first synchronization signal sent by all the (N-1) associated chips has been received; If the first synchronization signal sent by all the (N-1) associated chips has been received, the second synchronization signal is sent to each of the (N-1) associated chips, and the synchronization command is terminated.
11. A chip, comprising: a command processor configured to obtain subqueue information related to a current task queue, wherein the current task queue includes a plurality of tasks arranged in an execution order and synchronization commands between the plurality of tasks, each of the plurality of tasks includes N subtasks, and the N subtasks are respectively configured to be executed by the chip and (N-1) associated chips; The task processing device is configured to execute the tasks in sequence according to the sub-queue information. The corresponding subtask in the current task queue; Wherein, the command processor is further configured as: In response to executing the synchronization command, confirming whether the chip itself and the (N-1) associated chips have all completed executing corresponding subtasks in the current task queue that are located before the synchronization command; If it is confirmed that the chip itself and the (N-1) associated chips have completed executing the corresponding subtasks in the current task queue before the synchronization command, then the synchronization command is terminated to execute the corresponding subtasks after the synchronization command. Wherein, N is an integer greater than 1.
12. A multi-chip module, comprising N chips, wherein: Each of the N chips is configured as follows: Acquire subqueue information related to a current task queue, wherein the current task queue includes a plurality of tasks arranged in an execution order and synchronization commands between the plurality of tasks, each of the plurality of tasks includes N subtasks, and the N subtasks are respectively configured to be executed by the N chips; According to the respective sub-queue information, the corresponding sub-tasks in the current task queue are executed in sequence according to the execution order; In response to executing the synchronization command, confirm whether the N chips have all completed the corresponding subtasks in the current task queue that are located before the synchronization command; if it is confirmed that the N chips have all completed the corresponding subtasks in the current task queue that are located before the synchronization command, then end the synchronization command to execute the corresponding subtasks located after the synchronization command. Wherein, N is an integer greater than 1.
13. An electronic device comprising: Task initiating device; as well as The multi-chip module of claim 12.
14. An electronic device comprising: processor; a memory storing one or more computer program modules; The one or more computer program modules are configured to be executed by the processor to implement the task processing method according to any one of claims 1 to 10.
15. A computer-readable storage medium storing non-transitory computer-readable instructions, which can implement the task processing method according to any one of claims 1 to 10 when executed by a computer.
Citation Information
Patent Citations
Technologies for efficient synchronization barriers with work stealing support
CN107250984A
Method for unloading data, computing device and computer readable storage medium
CN112231018A
Task processing method, chip, multi-chip module, electronic equipment and storage medium
CN116339944A
Synchronization of multiple queues
US20190391856A1
Program execution control method and vehicle control device
US20210004278A1
