Command distributor, command distribution method and system, chip, board, device

Synchronization between command streams is achieved through hardware, and the storage unit, command queue and arbitration unit are used to directly detect synchronization events and transmit enable signals, solving the problem of low synchronization efficiency in the prior art and achieving efficient command stream synchronization.

CN115145638BActive Publication Date: 2025-01-07SHANGHAI POWERTENSORS INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210771273.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-30
Publication Date
2025-01-07
Estimated Expiration
2042-06-30

AI Technical Summary

Technical Problem

In the prior art, the synchronization efficiency between command streams is low, mainly due to the cumbersome implementation of synchronization in software, resulting in the cumbersome process of instruction analysis and priority arbitration, resulting in a large synchronization delay.

Method used

A command distributor is designed, including storage unit, command queue and arbitration unit, which realizes trigger status detection and enable signal transmission of synchronous events through hardware, and directly sends commands in parallel in the command queue to avoid software parsing and priority arbitration. .

Benefits of technology

Improves the parallel sending efficiency of commands in the command queue, reduces synchronization delay, and improves synchronization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115145638B_ABST
    Figure CN115145638B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a command distributor, a command distribution method and system, a chip, a board, and a device for distributing commands to multiple command streams, wherein the command distributor includes a storage unit for storing the trigger status of one or more synchronization events; each synchronization event corresponds to at least one synchronization command and at least one recording command; a command queue for storing the commands in the multiple command streams and sending the commands in each command stream to an arbitration unit; an arbitration unit for distributing the execution commands sent by the command queue to the execution unit; in response to receiving a recording command, updating the trigger status of the synchronization event corresponding to the recording command to triggered; in response to receiving a synchronization command and the trigger status of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue where the synchronization command is located to complete command synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a command distributor, a command distribution method and system, a chip, a board, and a device. Background Art

[0002] With the widespread use of artificial intelligence, deep learning models are becoming more and more complex, so multi-command stream programming is usually used to improve parallel execution. Different command streams often have interdependencies, so it is necessary to resolve the dependencies between commands in different command streams to achieve synchronization between different command streams. In related technologies, software is usually used to achieve synchronization between different command streams, and the synchronization efficiency is low. Summary of the invention

[0003] In a first aspect, an embodiment of the present disclosure provides a command distributor for distributing commands to multiple command streams, the command distributor comprising: a storage unit for storing the trigger status of one or more synchronization events; each synchronization event corresponds to at least one synchronization command and at least one recording command; a command queue for storing the commands in the multiple command streams and sending the commands in each command stream to an arbitration unit; an arbitration unit for distributing the execution commands sent by the command queue to the execution unit; in response to receiving a recording command, updating the trigger status of the synchronization event corresponding to the recording command to triggered; in response to receiving a synchronization command and the trigger status of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue where the synchronization command is located to complete command synchronization.

[0004] In some embodiments, the enable input port of the arbitration unit is connected to the storage unit; when the trigger state of at least one synchronization event is triggered, the storage unit stores a valid status flag; when the arbitration unit detects the valid storage status flag through the enable input port and receives a synchronization command, the arbitration unit queries the trigger state of the synchronization event corresponding to the synchronization command; when the trigger state of the synchronization event corresponding to the synchronization command is triggered, the enable signal is sent.

[0005] In some embodiments, an enable output port of the arbitration unit is connected to the command queue; and the enable signal is a valid level signal output by the arbitration unit from the enable output port.

[0006] In some embodiments, the command queue includes multiple sub-queues, each sub-queue corresponds to a command stream, and the arbitration unit includes multiple enable output ports, each enable output port corresponds to a sub-queue; the arbitration unit is used to: when it is detected that the trigger state of the synchronization event corresponding to the synchronization command is triggered and the synchronization command is received, send the enable signal to the target sub-queue through the enable output port corresponding to the target sub-queue, and the target sub-queue is the sub-queue corresponding to the command stream where the synchronization command is located.

[0007] In some embodiments, the arbitration unit is used to: cache the synchronization command when receiving the synchronization command sent by the command queue; and send the enable signal to the command queue when detecting that the trigger status of the synchronization event corresponding to the synchronization command is triggered.

[0008] In some embodiments, different synchronization events correspond to different identification information; the arbitration unit is used to: determine the synchronization event in the storage unit that has the same identification information as the synchronization command as the synchronization event corresponding to the synchronization command.

[0009] In some embodiments, different synchronization events correspond to different identification information; the storage unit is used to: store the occupancy status of each identification information; and upon receiving an application request sent by the host, send the available identification information in an unoccupied state to the host, so that the host inserts the synchronization command and the recording command into the corresponding command stream based on the available identification information.

[0010] In some embodiments, the storage unit is used to: receive a destruction request sent by the host, the destruction request carrying identification information to be destroyed; and in response to the destruction request, update the occupied state of the identification information to be destroyed to an unoccupied state.

[0011] In some embodiments, the arbitration unit is used to: obtain timestamp information of each recording command, where the timestamp information of a recording command is determined based on the time when the arbitration unit obtains the recording command from the command queue; and write the timestamp information into the storage unit.

[0012] In some embodiments, the storage unit is used to: receive a query request sent by a host, the query request carrying first identification information of a first record command and second identification information of a second record command, the first record command and the second record command being commands in the same command stream; based on the first identification information and the second identification information, return the timestamp information of the first record command and the timestamp information of the second record command to the host, so that the host determines the total execution time of each execution command between the first record command and the second record command based on the timestamp information of the first record command and the timestamp information of the second record command.

[0013] In a second aspect, an embodiment of the present disclosure provides a command distribution system, the system comprising: the command distributor described in any embodiment of the present disclosure; and a host, configured to send the multiple command streams to the command queue.

[0014] In a third aspect, an embodiment of the present disclosure provides a chip, wherein the chip includes the memory access request processing device described in any embodiment of the present disclosure, or the storage device described in any embodiment of the present disclosure.

[0015] In a fourth aspect, an embodiment of the present disclosure provides a board card, which includes a packaging structure encapsulating at least one chip as described in any embodiment of the present disclosure.

[0016] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising the chip described in any embodiment of the present disclosure, or the system described in any embodiment of the present disclosure, or the board described in any embodiment of the present disclosure.

[0017] In a sixth aspect, an embodiment of the present disclosure provides a command distribution method, which is applied to an arbitration unit in a command distributor described in any embodiment of the present disclosure, and the method includes: receiving commands in multiple command streams sent by a command queue, the commands including execution commands, synchronization commands and recording commands; in response to receiving the execution command, distributing the execution command to the execution unit; in response to receiving the recording command, setting the trigger state of the synchronization event corresponding to the recording command in the storage unit to triggered; in response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue to enable the command queue to send the next command in the command stream where the synchronization command is located.

[0018] In the seventh aspect, an embodiment of the present disclosure provides a command distribution device, which is applied to the arbitration unit in the command distributor described in any embodiment of the present disclosure, and the device includes: a receiving module, which is used to receive commands in multiple command streams sent by a command queue, and the commands include execution commands, synchronization commands and recording commands; a distribution module, which is used to distribute the execution command to the execution unit in response to receiving the execution command; a setting module, which is used to set the trigger state of the synchronization event corresponding to the recording command in the storage unit to triggered in response to receiving the recording command; and a sending module, which is used to send an enable signal to the command queue in response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, so that the command queue sends the next command in the command stream where the synchronization command is located.

[0019] In an eighth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the present disclosure.

[0020] In the embodiment of the present disclosure, after the arbitration unit receives the record command, the trigger state of the synchronization event corresponding to the record command in the storage unit is set to triggered, thereby indicating that the trigger condition of the synchronization command corresponding to the synchronization event has been met; in this way, the triggered synchronization event can enable the arbitration unit to send an enable signal to the command queue after receiving the synchronization command corresponding to the synchronization event. Under the action of the enable signal, the command queue can send the next command of the synchronization command corresponding to the synchronization event from the command stream where the synchronization command corresponding to the synchronization event is located to the arbitration unit. The above-mentioned synchronization process adopts a hardware method to realize the interaction between the storage unit, the command queue and the arbitration unit. Compared with the software synchronization process, on the one hand, the commands in each command stream in the command queue can be sent in parallel; on the other hand, in the hardware implementation method, the arbitration unit can directly detect the trigger state of the synchronization event, and the command queue can directly detect the enable signal, which saves the process of parsing instructions and priority arbitration between instructions in the software implementation process, thereby effectively improving the synchronization efficiency and reducing the synchronization delay.

[0021] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.

[0023] Figure 1A It is a schematic diagram of multiple command flows with dependencies.

[0024] Figure 1B It is a schematic diagram of the command stream synchronization method in the related art.

[0025] Figure 2 is a schematic diagram of different synchronization events.

[0026] Figure 3 is a schematic diagram of a command distributor in an embodiment of the present disclosure.

[0027] Figure 4 is a schematic diagram of a command dispatcher when a command queue includes multiple sub-queues.

[0028] Figure 5A This is a schematic diagram of the execution order of each command.

[0029] Figure 5B It is a schematic diagram of how different types of commands are processed.

[0030] Figure 6 It is a schematic diagram of inserting a recording command to count the execution time of the execution command.

[0031] Figure 7 It is a schematic diagram of how the state information and timestamps are stored in the storage unit.

[0032] Fig. 8A It is an overall architecture diagram of an embodiment of the present disclosure.

[0033] Figure 8B It is an overall flow chart of an embodiment of the present disclosure.

[0034] Fig. 9 This is a schematic diagram of the Record command packet and the Sync command packet.

[0035] Fig.10 It is a flowchart of the command distribution method of an embodiment of the present disclosure.

[0036] Fig.11 It is a block diagram of a command distribution device according to an embodiment of the present disclosure.

[0037] Fig.12 is a schematic diagram of a board card according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0038] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0039] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items. In addition, the term "at least one" herein means any combination of at least two of any one or more of a plurality of.

[0040] It should be understood that although the terms first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0041] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present disclosure and to make the above-mentioned purposes, features and advantages of the embodiments of the present disclosure more obvious and understandable, the technical solutions in the embodiments of the present disclosure are further described in detail below in conjunction with the accompanying drawings.

[0042] For multiple command streams, different command streams often have interdependencies. Figure 1A As shown, assume that there are three command streams, denoted as Stream1, Stream2, and Stream3, where command 1 in Stream1 needs to perform addition operations on two parameters a and b to obtain parameter c. Since parameter a and parameter b are obtained by command 1 in Stream2 and command 1 in Stream3, respectively, command 1 in Stream1 has a dependency relationship with command 1 in Stream2 and command 1 in Stream3, that is, command 1 in Stream1 can only be executed after command 1 in Stream2 and command 1 in Stream3 are executed. In order to ensure the execution order of the commands in the above three command streams, the commands in the three command streams need to be resolved to achieve synchronization between the three command streams.

[0043] In the related art, software is usually used to achieve synchronization between different command streams. There are two specific implementation methods: the first method is to solve the dependencies of the streams on the host side and then send the solved command streams to the device side; the second method is to use a microcontroller unit (MCU) on the device side to solve the dependencies of the command streams and then distribute the solved command streams to the execution units. Figure 1B , the specific process of the second method is illustrated by example.

[0044] In the related art, synchronization commands (sync) and record commands (record) can be inserted into the stream to achieve synchronization between multiple command streams, wherein the synchronization command is used to be inserted into a command stream that depends on other command streams, and the record command is used to be inserted into a dependent command stream. Since the MCU can only parse the commands of one stream at a time, the host sends the commands in each stream to the MCU serially (step 101). The MCU retrieves a command in the stream every cycle (step 102). The host sends commands in the following ways: (1) The host actively sends commands and informs the MCU after the sending is completed; (2) The host notifies the MCU to pull down the command. After the MCU retrieves the command, it can determine the command type (step 103).

[0045] If the task retrieved by the MCU is an execution command, the execution command is distributed to the execution unit (step 104).

[0046] If the MCU retrieves a synchronous command (sync), it will first store sync in the cache queue, and then query whether the trigger condition of sync is met (step 105). If the trigger condition is met, sync will be removed from the cache queue (step 108) and the next command in the stream will be retrieved; if the trigger condition is not met, sync will continue to be stored in the cache queue, and the trigger condition will be queried again after a period of time (step 106).

[0047] If the MCU retrieves a record command (record), it searches for the sync corresponding to the record from the sync cache queue. The search process traverses the cache queue (step 107). If the sync corresponding to the record is found, the found sync is removed from the cache queue (step 108) and the next command in the stream is retrieved.

[0048] Each time the execution unit completes the execution of an execution command, it sends an interrupt signal to the MCU so that the MCU can retrieve the next command in the stream. Alternatively, each execution unit can record a completion flag through a register, which is used to indicate whether the execution unit has completed the execution of the issued command. After the MCU sends an execution command to the execution unit, it will actively query the completion flag of the execution unit regularly and determine whether the issued command has been executed based on the completion flag. If the completion flag queried by the MCU indicates that the command has been executed, the next command in the stream can be retrieved.

[0049] It can be seen that in the above software synchronization method, since the MCU can only parse the command of one stream at a time, and the MCU takes a long time to execute operations such as interruption and traversal, the synchronization process delay is large and the synchronization efficiency is relatively low.

[0050] Based on this, the present disclosure provides a command distributor for distributing commands to multiple command streams. Among the multiple command streams, at least two command streams have a dependency relationship. For the sake of distinction, the command stream that depends on other command streams is referred to as the first command stream, and the command stream that is dependent is referred to as the second command stream. For example, in Figure 1A In the illustrated embodiment, Stream1 is the first command stream, and Stream2 and Stream3 are both second command streams. In practical applications, the number of first command streams is greater than or equal to 1, and the number of second command streams is also greater than or equal to 1, that is, one first command stream can depend on one or more second command streams, and the same second command stream can also be dependent on one or more first command streams. It should be noted that for a certain synchronization event, a certain command stream (assuming it is Stream1) is the first command stream, and another command stream (assuming it is Stream2) is the second command stream, but for another synchronization event, Stream1 can be the second command stream, and Stream2 can be the first command stream. For example, assuming Figure 1A Stream1 in also includes command 5: m=n+3, and assumes Figure 1A Stream2 also includes command 3: p=m-1, then Stream2 depends on Stream1, so Stream2 is the first command stream, and Stream1 is the second command stream.

[0051] In order to facilitate synchronization between streams, a synchronization command can be inserted into the first command stream, and a recording command can be inserted into the second command stream. Since commands in the same stream are sent and executed sequentially, a synchronization command can be inserted before commands that need to depend on other commands in the first command stream, and a recording command can be inserted after the dependent command stream in the second command stream. Each synchronization event corresponds to at least one synchronization command and at least one recording command. The same command stream can include only one of the synchronization command and the recording command, or both. See Figure 2 , assuming that the number of command streams is 3, the three command streams are recorded as Stream1, Stream2 and Stream3, where Stream1 can include execution commands k11, k12, k13 and k14, and can also include synchronization command sync1 and recording command rec2; Stream2 can include execution commands k21, k22, k23, k24 and k25, and can also include recording command rec1; Stream3 can include execution commands k31, k32, k33 and k34, and can also include synchronization command sync1 and synchronization command sync2. Among them, synchronization event 1 can correspond to synchronization command sync1 and recording command rec1, indicating that k13 and k32 depend on k21; synchronization event 2 can correspond to synchronization command sync2 and recording command rec2, indicating that k33 depends on k13. In this way, for synchronization event 1, Stream1 and Stream3 are both the first command stream, and Stream2 is the second command stream; for synchronization event 2, Stream3 is the first command stream, and Stream1 is the second command stream.

[0052] See also Figure 3 , the command distributor of the embodiment of the present disclosure includes:

[0053] The storage unit 301 is used to store the trigger status of one or more synchronization events; each synchronization event corresponds to at least one synchronization command and at least one recording command;

[0054] A command queue 302, used to store commands in the plurality of command streams and send commands in each command stream to an arbitration unit 303;

[0055] The arbitration unit 303 is used to distribute the execution commands sent by the command queue 302 to the execution units; in response to receiving a record command, the trigger state of the synchronization event corresponding to the record command is updated to triggered; in response to receiving a synchronization command, and the trigger state of the synchronization event corresponding to the synchronization command is triggered, an enable signal is sent to the command queue 302 where the synchronization command is located to complete command synchronization.

[0056] The arbitration unit 303 of the embodiment of the present disclosure can enable the command queue 302 to send commands, and the command queue 302 sends a command each time the arbitration unit 303 is enabled. Among them, multiple command streams can be stored in the command queue 302. In the case where there is no dependency between the commands in each command stream, the command queue 302 can send a command in each command stream in parallel each time it is enabled by the arbitration unit 303. For example, assuming that the command queue 302 includes 2 command streams, respectively denoted as Stream1 and Stream2, then each time the command queue 302 is enabled by the arbitration unit 303, it can send a command in Stream1 and a command in Stream2 to the arbitration unit 303 respectively.

[0057] In the case where there is a dependency between commands in at least two command streams, synchronization between the command streams is required. In the embodiment of the present disclosure, after the arbitration unit 303 receives the record command, the trigger state of the synchronization event corresponding to the record command in the storage unit 301 is set to triggered, thereby indicating that the trigger condition of the synchronization command corresponding to the synchronization event has been met; in this way, the triggered synchronization event can enable the arbitration unit 303 to send an enable signal to the command queue 302 after receiving the synchronization command corresponding to the synchronization event, thereby completing command synchronization. Under the action of the enable signal, the command queue 302 can send the next command of the synchronization command corresponding to the synchronization event from the command stream where the synchronization command corresponding to the synchronization event is located to the arbitration unit 303. The above-mentioned synchronization process adopts hardware to realize the interaction between the storage unit 301, the command queue 302 and the arbitration unit 303. Compared with the software synchronization process, on the one hand, the commands in each command stream in the command queue 302 can be sent in parallel; on the other hand, in the hardware implementation, the arbitration unit 303 can directly detect the trigger state of the synchronization event, and the command queue 302 can directly detect the enable signal, which saves the process of parsing instructions and priority arbitration between instructions in the software implementation process. Therefore, it can effectively improve the synchronization efficiency and reduce the synchronization delay.

[0058] The specific details of the embodiments of the present disclosure are illustrated below. The synchronization command mentioned below may refer to any synchronization command in any command stream, and the recording command mentioned below may refer to any recording command in any command stream.

[0059] The storage unit 301 may store the trigger status of one or more synchronization events. The event in which commands in one or more command streams wait for commands in another one or more command streams is called a synchronization event. Figure 1AIn the illustrated embodiment, command 1 in Stream 1 needs to wait for command 1 in Stream 2 and command 1 in Stream 3 to be executed before it can be executed. Therefore, the event in which command 1 in Stream 1 waits for command 1 in Stream 2 and command 1 in Stream 3 is called a synchronization event.

[0060] Different synchronization events may use different identification information (ID) to distinguish different synchronization events. Figure 2 In the illustrated embodiment, "1" and "2" can be used to identify two different synchronization events, respectively. Each synchronization event includes a trigger state, which is used to indicate whether the trigger condition of the synchronization command corresponding to the synchronization event has been met. If the trigger condition of the corresponding synchronization command has been met, the trigger state is triggered; if the trigger condition of the corresponding synchronization command has not been met, the trigger state is not triggered. Specifically, for a certain synchronization event, if the previous command in the command stream where the recording command corresponding to the synchronization event is located is executed, the trigger condition of the synchronization command corresponding to the synchronization event has been met; otherwise, the trigger condition of the synchronization command corresponding to the synchronization event is not met. In some embodiments, the trigger state can be recorded by a 1-bit data bit, for example, triggered is recorded as "0" and not triggered is recorded as "1".

[0061] In some embodiments, the enable input port of the arbitration unit 303 is connected to the storage unit 301, and the connection is a hardware connection. When the trigger state of any synchronization event is triggered, the storage unit 301 can store a valid state flag. In this way, when the arbitration unit 303 detects the valid storage state flag through the enable input port and receives the synchronization command, it can query the trigger state of the synchronization event corresponding to the synchronization command. When the trigger state of the synchronization event corresponding to the synchronization command is triggered, the arbitration unit 303 can send the enable signal to the command queue 302. The above method does not need to go through the instruction parsing, priority arbitration and other processes in the software method, thereby improving the efficiency of the synchronization process. In some embodiments, the valid storage state flag can be "1". Of course, this is just an example. In other embodiments, the valid storage state flag can also be "0".

[0062] The command queue 302 may be used to store commands in the plurality of command streams. In some embodiments, the command queue 302 may include a plurality of subqueues, each subqueue corresponding to a command stream. For example, when the number of command streams is N, the number of subqueues is also N, wherein the i-th subqueue is used to store commands in the i-th command stream.

[0063] The command queue 302 can send commands in each command stream that have no dependency relationship to the arbitration unit 303 in parallel when enabled by the arbitration unit 303, and each command in the same command stream is sent to the arbitration unit 303 in series. Figure 2 In the illustrated embodiment, there is no dependency relationship between k11, k21 and k31, and the command queue 302 can send k11, k21 and k31 to the arbitration unit 303 in parallel; and for commands in the same command stream (for example, Stream1), k11, k12, k13 and k14 are sent serially to the arbitration unit 303 according to the order of the above commands in Stream1.

[0064] The arbitration unit 303 can distribute each execution command sent by the command queue 302 to the execution unit for execution, while the synchronization command and the recording command do not need to be distributed to the execution unit. In addition, the arbitration unit 303 can also update the trigger state of the synchronization event stored in the storage unit 301, and enable the command queue 302 to send commands. The working principle of the arbitration unit 303 is described below by example.

[0065] First, after the command queue 302 obtains the command stream, the arbitration unit 303 can enable the command queue 302 to send commands. In some embodiments, the enable output port of the arbitration unit 303 is connected to the command queue 302, the connection is a hardware connection, and the enable signal is a valid level signal input by the enable output port of the arbitration unit 303 to the command queue 302. In this way, the arbitration unit 303 can directly send the enable signal through the enable output port without going through the instruction parsing, priority arbitration and other processes in the software mode, thereby improving the efficiency of the synchronization process.

[0066] In an embodiment where the command queue 302 includes multiple subqueues, the arbitration unit 303 includes multiple enable output ports, each of which corresponds to a subqueue. On this basis, when the arbitration unit 303 detects that the trigger state of the synchronization event corresponding to the synchronization command is triggered and receives the synchronization command, the enable signal is sent to the target subqueue through the enable output port corresponding to the target subqueue, and the target subqueue is the subqueue corresponding to the command stream where the synchronization command is located.

[0067] For example, in Figure 4In the example, the arbitration unit 303 includes four enable output ports, which are respectively denoted as EN1, EN2, EN3 and EN4, and the command queue 302 includes four sub-queues, which are respectively denoted as sub-queue 1, sub-queue 2, sub-queue 3 and sub-queue 4, and these four sub-queues correspond to the enable output ports EN1, EN2, EN3 and EN4 respectively. Assuming that the synchronization command is the sync command in sub-queue 1, the arbitration unit 303 can send the enable signal to the target sub-queue (i.e., sub-queue 1) through the enable output port EN1 when detecting that the trigger state of the synchronization event corresponding to the sync command in sub-queue 1 is triggered and receiving the sync command in sub-queue 1.

[0068] Similarly, the arbitration unit 303 may also be connected to the storage unit 301 through a plurality of enable output ports, and each enable output port between the arbitration unit 303 and the storage unit corresponds to a command stream. When receiving a record command sent by a command queue corresponding to a certain command stream, the arbitration unit 303 may output an enable signal to the storage unit 301 through the enable output port corresponding to the command stream between the arbitration unit 303 and the storage unit 301, so that the storage unit 301 records the timestamp and identification information of the synchronization event; when receiving a synchronization command sent by a command queue corresponding to a certain command stream, the arbitration unit 303 may output an enable signal to the storage unit 301 through the enable output port corresponding to the command stream between the arbitration unit 303 and the storage unit 301, so as to query the trigger status of the corresponding synchronization event in the storage unit 301.

[0069] In some embodiments, the effective level signal may be a high level effective. That is, the command queue 302 may use the high level signal output by the arbitration unit 303 through the enable output port as an enable signal, and when the arbitration unit 303 outputs a low level signal through the enable output port, the command queue 302 is not enabled. Of course, this is just an example, and in other embodiments, the effective level signal may also be a low level effective.

[0070] After being enabled by the arbitration unit 303, the command queue 302 can send commands in various command streams to the arbitration unit 303 in parallel. Figure 5AAs shown, the execution commands are recorded as k11, k12, ..., k15, k21, k22, ... k25. Assuming that k23 in command stream Stream2 depends on k13 in command stream Stream1, and there is no dependency relationship between other commands in command stream Stream1 and command stream Stream2, the command queue 302 can send command k11 and command k21 to the arbitration unit 303 in parallel after being enabled. After command k11 is executed, the arbitration unit 303 can enable the command queue 302 to send command k12 again, and after command k12 is executed, enable the command queue 302 to send command k13 again. The arbitration unit 303 enables the command queue 302 to send a command in Stream1 each time until the command queue 302 has sent all the commands in command stream Stream1. In addition, after command k21 is executed, the arbitration unit 303 can also enable the command queue 302 to send the synchronization command sync. The order of enabling record and sync can be arbitrary. For example, the arbitration unit 303 can first enable the command queue 302 to send record, and then enable the command queue 302 to send sync, or first enable the command queue 302 to send sync and then enable the command queue 302 to send record, or can synchronously enable the command queue 302 to send sync and record. The arbitration unit 303 enables the command queue 302 to send a command in Stream2 each time until the command queue 302 has sent all the commands in the command stream Stream2. In particular, when the command received by the arbitration unit 303 is an execution command, the arbitration unit 303 enables the command queue 302 to send the next command when the execution command is executed by the execution unit.

[0071] In particular, for the two commands record and sync, the arbitration unit 303 can process them in the following manner: when receiving the synchronization command sent by the command queue, the synchronization command is cached; when it is detected that the trigger status of the synchronization event corresponding to the synchronization command is triggered, the enable signal is sent to the command queue.

[0072] In order to facilitate the distinction between various synchronization events, different synchronization events may correspond to different identification information. The arbitration unit 303 may determine the synchronization event in the storage unit that has the same identification information as the synchronization command as the synchronization event corresponding to the synchronization command. For example, assuming that there are two synchronization events with identification information of "1" and "2", and the identification information of the synchronization command is "1", the synchronization command with the same identification information of "1" may be determined as the synchronization event corresponding to the synchronization command.

[0073] See also Figure 5B, the arbitration unit 303 can determine the type of the currently received command (step 501). In the case where the arbitration unit 303 receives the record command sent by the command queue 302, the arbitration unit 303 can update the trigger state of the synchronization event corresponding to the record command in the storage unit 301 from untriggered to triggered (step 502). In response to detecting that the trigger state of at least one synchronization event is triggered, the arbitration unit 303 sends an enable signal to the command queue 302 (step 503) to enable the command queue 302 to send the next command of the record command (i.e., command k15).

[0074] When the arbitration unit 303 receives the sync command sent by the command queue 302, if the arbitration unit 303 has detected that the trigger state of at least one synchronization event is triggered, it means that the trigger condition of a certain sync command has been met, but the sync command that meets the trigger condition is not necessarily the sync command currently received by the arbitration unit 303 from the command queue 302. Therefore, the arbitration unit 303 can query the trigger state of the synchronization event corresponding to sync from the storage unit 301 (step 504). If the trigger state of the synchronization event corresponding to sync is triggered (i.e., the synchronization event corresponding to sync has been triggered), the arbitration unit 303 can return to step 503 to enable the command queue 302 to send the next command of the sync command (i.e., command k23). If the trigger state of the synchronization event corresponding to sync is not triggered (i.e., the synchronization event corresponding to sync has not been triggered), the arbitration unit 303 can cache the currently received sync command (step 505), and re-execute step 504 when the trigger state of at least one synchronization event is detected to be triggered next time. When the arbitration unit 303 receives the sync command sent by the command queue 302 , if the arbitration unit 303 has not detected that the trigger state of any synchronization event is triggered, it means that no trigger condition of the sync command is met, so the arbitration unit 303 can return to step 505 .

[0075] In an embodiment where different synchronization events correspond to different identification information, the storage unit 301 may also store the occupation status of each identification information; when receiving an application request sent by the host, the available identification information in an unoccupied state is sent to the host, so that the host inserts the synchronization command and the recording command in the corresponding command stream based on the available identification information. The above process is called the process of the host applying for identification information. For example, assuming that the identification information in an unoccupied state stored in the storage unit includes "1", "2", ..., "N", the identification information applied by the host can be assigned to the host in order from small to large, that is, when receiving an application request sent by the host, the identification information "1" is first assigned to the host, and the host inserts the synchronization command and the recording command of the synchronization event corresponding to the identification information "1" into the first command stream and the second command stream respectively. After the identification information "1" is occupied by a certain synchronization event, when the application request sent by the host is received for the second time, the identification information "2" is assigned to the host again, and the host inserts the synchronization command and the recording command of the synchronization event corresponding to the identification information "2" into the first command stream and the second command stream respectively. And so on. After a piece of identification information is allocated to the host, the storage unit 301 may update the occupation state of the identification information from an unoccupied state to an occupied state.

[0076] Furthermore, the identification information assigned to the host can also be destroyed, and the destroyed identification information can be assigned to the host again, so that the host inserts synchronization commands and recording commands of other synchronization events corresponding to the identification information in the first command stream and the second command stream, respectively. Specifically, the storage unit 301 can receive a destruction request sent by the host, and the destruction request carries the identification information to be destroyed; in response to the destruction request, the occupied state of the identification information to be destroyed is updated to an unoccupied state. For example, continuing with the previous example, after the storage unit 301 assigns the identification information "1" to the host, it is assumed that the synchronization command and recording command inserted by the host in the first command stream and the second command stream respectively correspond to the synchronization event (recorded as synchronization event X) of command 1 in Stream1 waiting for command 2 in Stream2, that is, the synchronization event of the identification information "1" is synchronization event X. The host can send a destruction request carrying the identification information "1" to the storage unit 301, thereby updating the occupied state of the identification information "1" from an occupied state to an unoccupied state. When the occupied state of the identification information "1" is unoccupied, the identification information "1" can be reallocated to the host. After the host reacquires the identification information "1", the identification information "1" can be used to generate a synchronization command and a recording command corresponding to the synchronization event Y. For example, the synchronization event Y is a synchronization event in which command 3 in Stream2 waits for command 5 in Stream3. In this way, the same identification information is reused.

[0077] In some embodiments, the arbitration unit 303 can also obtain the timestamp information of each record command and write the timestamp information into the storage unit. The timestamp information of a record command is determined based on the time when the arbitration unit obtains the record command from the command queue. Since the record command is sent when the command queue 302 receives an enable signal (i.e., an enable signal) sent by hardware, there is no need to go through the process of instruction parsing and instruction priority on the bus. Therefore, the timestamp obtained by the arbitration unit 303 is more accurate. In the case where at least two record commands are inserted into the same command stream, the total execution time of each execution command between the two record commands can be determined based on the timestamps of any two record commands.

[0078] Specifically, the storage unit 301 can receive a query request sent by the host, wherein the query request carries first identification information of a first record command and second identification information of a second record command, and the first record command and the second record command are commands in the same command stream; based on the first identification information and the second identification information, the timestamp information of the first record command and the timestamp information of the second record command are returned to the host, so that the host determines the total execution time of each execution command between the first record command and the second record command based on the timestamp information of the first record command and the timestamp information of the second record command.

[0079] See also Figure 6 , assuming that a command stream includes execution commands k1, k2, k3, and k4, then the record command record1 can be inserted before the execution command k3, and the record command record2 can be inserted after the execution command k3. Assuming that the timestamp corresponding to the record command record1 is t1, and the timestamp corresponding to the record command record2 is t2, the execution time of the execution command k3 is t2-t1. The record command record3 can also be inserted after the execution command k4, assuming that the timestamp corresponding to the record command record3 is t3, the execution time of the execution command k4 is t3-t2, and the total execution time of the execution commands k3 and k4 is t3-t1.

[0080] The state information of each synchronization event (including the occupation state of the identification information corresponding to the synchronization event and the trigger state of the synchronization event) and the timestamp of the recording command corresponding to each synchronization event can be recorded in the storage unit 301. Figure 7, the state information of each synchronization event can be associated with the timestamp corresponding to the recording command corresponding to the synchronization event and stored. For example, the state information of the synchronization event with ID 0 is recorded as state information 0, and the timestamp corresponding to the recording command corresponding to the synchronization event with ID 0 is recorded as timestamp 0. Then, the state information 0 and timestamp 0 can be associated and stored in the storage unit 301. Assuming that the number of synchronization events is x, the storage unit 301 can store a total of x entries including state information and timestamps.

[0081] The overall structure and workflow diagram of the command distributor in the embodiment of the present disclosure are as follows: Fig. 8A and Figure 8B As shown. On the Host side, the processor of the host (e.g., CPU) generates a command stream (sbuf) and stores the command stream in the main memory. The device side is a hardware-implemented command distributor, which includes an Event pool (i.e., the storage unit 301 in the aforementioned embodiment), a Stream queue (i.e., the command queue 302 in the aforementioned embodiment), and a Dispatcher (i.e., the arbitration unit 303 in the aforementioned embodiment). The Event pool is connected to the Dispatcher via hardware, and the Dispatcher is also connected to the Stream queue via hardware. The Stream queue includes multiple sub-queues, each of which corresponds to a command stream. The number of sub-queues shown in the figure is n, which are respectively denoted as SQ0, SQ1, ..., SQn. The Dispatcher is also connected to multiple computing units (i.e., the execution units in the aforementioned embodiment), and the number of computing units shown in the figure is m, which are respectively denoted as computing unit 0, ..., computing unit m.

[0082] The host side can apply for an available Event ID (i.e., the identification information of the synchronization event in the above-mentioned embodiment) from the Event Pool through a communication interface (such as PCIE), and then encapsulate the available Event ID into a record command packet or a sync command packet and insert it into sbuf. The specific structure of the record command packet and the sync command packet is as follows: Fig. 9 As shown in the figure, the record command packet includes a header and a body. The header includes:

[0083] Event record pkg ID, indicating the identification information of the record command packet;

[0084] Flag, indicating the available status of the Event ID;

[0085] Verification value, used to verify the record command packet.

[0086] Similarly, the sync command packet also includes a header and a body. The header includes:

[0087] Event sync pkg ID, indicating the identification information of the sync command packet;

[0088] Flag, indicating the available status of the Event ID;

[0089] Checksum value, used to check the sync command packet.

[0090] The record command packet and the sync command packet both include the Event ID.

[0091] After inserting the record command packet and the sync command packet into sbuf, sbuf can be pulled down to the hardware command stream queue Stream queue. Dispatcher completes the distribution of commands in the command stream, parses the command packets related to Event to record the timestamp information, and completes the synchronization between streams according to the Event Pool recording the Event ID status. Specifically, Dispatcher can pull up the valid signal (i.e., the enable signal in the aforementioned embodiment), and when Stream queue detects that the valid signal is at a high level, it sends the command in the command stream Stream to Dispatcher. Dispatcher can determine the command type. If it is an execution command, it is sent to the computing unit; if it is a record command, the record flag corresponding to the Event ID (i.e., the trigger status of the synchronization event in the aforementioned embodiment) is changed; if it is a sync command, the trigger condition of record is waited. If the trigger condition of record is met, the valid signal is output to Stream queue so that Stream queue sends the next command of the sync command. In addition, Event Pool can also record the timestamp corresponding to each Event ID, which is the timestamp on the device side and is used to determine the execution time of the execution command. The host side can also destroy the occupied Event ID to the device side through the communication interface.

[0092] The disclosed embodiments include the following advantages:

[0093] (1) Hardware maintains the Event Pool, supports Event ID application, destruction, and query of the current execution status of each event ID;

[0094] (2) Supports measuring the execution time of a command packet. The hardware can more accurately record the execution time of each command packet.

[0095] (3) Supports synchronization between different streams. The hardware can remove the dependencies between different streams, reduce the software overhead between the host and the device, and improve synchronization efficiency.

[0096] An embodiment of the present disclosure further provides a command distribution system, the system comprising the command distributor described in any of the aforementioned embodiments; and a host, configured to send the multiple command streams to the command queue.

[0097] The embodiment of the present disclosure further provides a chip, the chip comprising the command distributor described in any of the above embodiments, or comprising the command distribution system described in any of the above embodiments. Optionally, the chip is an artificial intelligence (AI) chip.

[0098] Furthermore, the chip further includes an execution unit for executing the command distributed by the arbitration unit. Optionally, the execution unit may be a calculation unit, including but not limited to an arithmetic calculation unit (e.g., an addition calculation unit, a multiplication calculation unit, a convolution calculation unit) and / or a logic calculation unit (e.g., an AND gate, an OR gate, a NAND gate).

[0099] An embodiment of the present disclosure also provides an electronic device, comprising the chip described in any of the foregoing embodiments, or the system described in any of the embodiments herein, or the board described in any of the embodiments herein.

[0100] like Fig.10 As shown, the embodiment of the present disclosure further provides a command distribution method, which is applied to the arbitration unit in the command distributor described in any of the above embodiments, and the method includes:

[0101] Step 1001: receiving commands in a plurality of command streams sent by a command queue, wherein the commands include execution commands, synchronization commands, and recording commands;

[0102] Step 1002: In response to receiving the execution command, distribute the execution command to an execution unit;

[0103] Step 1003: in response to receiving the record command, setting the trigger state of the synchronization event corresponding to the record command in the storage unit to triggered;

[0104] Step 1004: In response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue to enable the command queue to send the next command in the command stream where the synchronization command is located.

[0105] In some embodiments, the enable input port of the arbitration unit is connected to the storage unit; when the trigger state of at least one synchronization event is triggered, the storage unit stores a valid status flag; in response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue, including: when the valid storage status flag is detected through the enable input port and the synchronization command is received, querying the trigger state of the synchronization event corresponding to the synchronization command; when the trigger state of the synchronization event corresponding to the synchronization command is triggered, sending the enable signal.

[0106] In some embodiments, an enable output port of the arbitration unit is connected to the command queue; and the enable signal is a valid level signal output by the arbitration unit from the enable output port.

[0107] In some embodiments, the command queue includes multiple sub-queues, each sub-queue corresponds to a command stream, and the arbitration unit includes multiple enable output ports, each enable output port corresponds to a sub-queue; in response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue, including: when it is detected that the trigger state of the synchronization event corresponding to the synchronization command is triggered and the synchronization command is received, sending the enable signal to the target sub-queue through the enable output port corresponding to the target sub-queue, and the target sub-queue is the sub-queue corresponding to the command stream where the synchronization command is located.

[0108] In some embodiments, in response to receiving the synchronization command and detecting that the trigger status of the synchronization event corresponding to the synchronization command is triggered, sending an enable signal to the command queue includes: caching the synchronization command when the synchronization command sent by the command queue is received; and sending the enable signal to the command queue when detecting that the trigger status of the synchronization event corresponding to the synchronization command is triggered.

[0109] In some embodiments, different synchronization events correspond to different identification information; the method further includes: determining a synchronization event in the storage unit that has the same identification information as the synchronization command as the synchronization event corresponding to the synchronization command.

[0110] In some embodiments, different synchronization events correspond to different identification information; the storage unit stores the occupancy status of each identification information; the available identification information in an unoccupied state is sent to the host when an application request sent by the host is received, so that the host inserts the synchronization command and the recording command into the corresponding command stream based on the available identification information.

[0111] In some embodiments, when the storage unit receives a destruction request sent by the host, in response to the destruction request, the storage unit updates the occupied state of the identification information to be destroyed carried in the destruction request to an unoccupied state.

[0112] In some embodiments, the method further includes: obtaining timestamp information of each recording command, where the timestamp information of a recording command is determined based on the time when the arbitration unit obtains the recording command from the command queue; and writing the timestamp information into the storage unit.

[0113] In some embodiments, the storage unit stores first identification information of a first recording command and second identification information of a second recording command, and the first identification information and the second identification information of the second recording command are used to determine the total execution time of each execution command located between the first recording command and the second command.

[0114] The specific details of the above method embodiment can be found in the above command distributor embodiment, which will not be repeated here.

[0115] See also Fig.11 The embodiment of the present disclosure further provides a command distribution device, which is applied to the arbitration unit in the command distributor described in any of the above embodiments, and the device includes:

[0116] The receiving module 1101 is used to receive commands in multiple command streams sent by the command queue, wherein the commands include execution commands, synchronization commands and recording commands;

[0117] A distribution module 1102, configured to distribute the execution command to an execution unit in response to receiving the execution command;

[0118] A setting module 1103, configured to, in response to receiving the recording command, set the trigger state of the synchronization event corresponding to the recording command in the storage unit to triggered;

[0119] The sending module 1104 is used to send an enable signal to the command queue in response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, so that the command queue sends the next command in the command stream where the synchronization command is located.

[0120] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation thereof can refer to the description of the above method embodiments and will not be repeated for the sake of brevity.

[0121] The present disclosure also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any of the above embodiments is implemented.

[0122] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0123] It can be known from the above description of the implementation mode that the technicians in this field can clearly understand that the embodiments of this specification can be implemented by means of software plus the necessary general hardware platform. Based on such an understanding, the technical solution of the embodiments of this specification can be essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments of this specification.

[0124] In addition, the embodiment of the present disclosure further provides a board, which includes a packaging structure encapsulating at least one of the above chips. Fig.12 , which provides an exemplary board card, the board card includes the chip 1201 and may also include other components, including but not limited to: a memory 1202 , an interface device 1203 and a processor 1204 .

[0125] The memory 1202 is connected to the chip 1201 in the chip package structure through a bus for storing data. The memory 1202 may include multiple groups of storage units 1202a, such as DDR SDRAM (English: Double Data Rate SDRAM, double rate synchronous dynamic random access memory), etc. Each group of storage units 1202a is connected to the chip 1201 through a bus.

[0126] The interface device 1203 is electrically connected to the chip 1201 in the chip package structure. The interface device 1203 is used to realize data transmission between the chip 1201 and an external device D (for example, a terminal, a server, a camera, etc.). In one embodiment, the interface device 1203 can be a PCIE interface, a network interface, or other interfaces, which is not limited in the present disclosure.

[0127] The processor 1204 can be the CPU of the host, or other types of processors, used to generate a command stream and send the command stream to the command distributor on the device side. The command distributor can adopt the command distributor in any of the aforementioned embodiments, which is used to synchronize the command stream sent by the processor 1204 and then distribute it to the execution unit.

[0128] The systems, devices, modules or units described in the above embodiments may be implemented by computer devices or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0129] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment scheme of this specification. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0130] The above is only a specific implementation of the embodiments of this specification. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiments of this specification. These improvements and modifications should also be regarded as the protection scope of the embodiments of this specification.

Claims

1. A command distributor, characterized in that: Used to distribute commands to multiple command streams, the command distributor includes: A storage unit, used to store the trigger status of one or more synchronization events; each synchronization event corresponds to at least one synchronization command and at least one recording command; A command queue, used to store commands in the plurality of command streams and to send commands in each command stream to the arbitration unit; an arbitration unit, configured to distribute the execution command sent by the command queue to the execution unit; in response to receiving a record command, update the trigger state of the synchronization event corresponding to the record command to triggered; in response to receiving a synchronization command, and the trigger state of the synchronization event corresponding to the synchronization command is triggered, send an enable signal to the command queue where the synchronization command is located, and complete command synchronization; The enable input port of the arbitration unit is connected to the storage unit; when the trigger state of at least one synchronization event is triggered, the storage unit stores a valid state flag bit; When the arbitration unit detects the valid status flag bit through the enable input port and receives a synchronization command, it queries the trigger status of the synchronization event corresponding to the synchronization command; When the trigger state of the synchronization event corresponding to the synchronization command is triggered, sending the enable signal; The command queue includes a plurality of sub-queues, each sub-queue corresponds to a command stream, the arbitration unit includes a plurality of enable output ports, each enable output port corresponds to a sub-queue; the arbitration unit is used to: When it is detected that the trigger state of the synchronization event corresponding to the synchronization command is triggered and the synchronization command is received, the enable signal is sent to the target sub-queue through the enable output port corresponding to the target sub-queue, and the target sub-queue is the sub-queue corresponding to the command stream where the synchronization command is located.

2. The command distributor according to claim 1, characterized in that: The enable signal is a valid level signal output by the arbitration unit from the enable output port.

3. The command distributor according to claim 1, characterized in that: The arbitration unit is used for: When receiving a synchronization command sent by the command queue, caching the synchronization command; When it is detected that the triggering state of the synchronization event corresponding to the synchronization command is triggered, the enable signal is sent to the command queue.

4. The command distributor according to claim 3, characterized in that: Different synchronization events correspond to different identification information; the arbitration unit is used to: A synchronization event in the storage unit having the same identification information as the synchronization command is determined as a synchronization event corresponding to the synchronization command.

5. The command distributor according to claim 1, characterized in that: Different synchronization events correspond to different identification information; the storage unit is used to: storing the occupancy status of each identification information; When receiving an application request sent by the host, available identification information in an unoccupied state is sent to the host, so that the host inserts the synchronization command and the recording command into the corresponding command stream based on the available identification information.

6. The command distributor according to claim 5, characterized in that: The storage unit is used for: receiving a destruction request sent by the host, wherein the destruction request carries identification information of the object to be destroyed; In response to the destruction request, the occupied state of the identification information to be destroyed is updated to an unoccupied state.

7. The command distributor according to claim 1, characterized in that: The arbitration unit is used for: Acquire timestamp information of each recording command, where the timestamp information of a recording command is determined based on the time when the arbitration unit acquires the recording command from the command queue; The timestamp information is written into the storage unit.

8. The command distributor according to claim 7, characterized in that: The storage unit is used for: receiving a query request sent by a host, wherein the query request carries first identification information of a first record command and second identification information of a second record command, and the first record command and the second record command are commands in the same command stream; Based on the first identification information and the second identification information, the timestamp information of the first recording command and the timestamp information of the second recording command are returned to the host, so that the host determines the total execution time of each execution command between the first recording command and the second recording command based on the timestamp information of the first recording command and the timestamp information of the second recording command.

9. A command distribution system, characterized in that: The system comprises: The command distributor according to any one of claims 1 to 8; and The host is configured to send the plurality of command streams to the command queue.

10. A chip, characterized in that: The chip includes the command distributor according to any one of claims 1 to 8, or includes the command distribution system according to claim 9.

11. The chip according to claim 10, characterized in that: The chip further comprises: An execution unit is used to execute the command distributed by the arbitration unit.

12. A board, characterized in that: The board includes a packaging structure encapsulating at least one chip as claimed in claim 10 or 11.

13. An electronic device, characterized in that: Includes the chip as claimed in claim 10 or 11, or the system as claimed in claim 9, or the board as claimed in claim 12.

14. A command distribution method, characterized in that: The arbitration unit in the command distributor according to any one of claims 1 to 8, the method comprising: receiving commands in a plurality of command streams sent by a command queue, wherein the commands include execution commands, synchronization commands, and recording commands; In response to receiving the execution command, distributing the execution command to an execution unit; In response to receiving the record command, setting the trigger state of the synchronization event corresponding to the record command in the storage unit to triggered; In response to receiving the synchronization command and detecting that the trigger state of the synchronization event corresponding to the synchronization command is triggered, an enable signal is sent to the command queue to enable the command queue to send the next command in the command stream where the synchronization command is located.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to claim 14 is implemented.

Citation Information

Patent Citations

  • Instruction synchronization device, chip, computer equipment and data processing method

    CN114265717A

  • Method, apparatus, and computer program product for synchronizing triggering of multiple hardware trace facilities using an existing system bus

    US20060184835A1