WO2022227693A1 - Command distribution apparatus and method, chip, computer device, and medium - Google Patents

Command distribution apparatus and method, chip, computer device, and medium Download PDF

Info

Publication number
WO2022227693A1
WO2022227693A1 PCT/CN2022/070709 CN2022070709W WO2022227693A1 WO 2022227693 A1 WO2022227693 A1 WO 2022227693A1 CN 2022070709 W CN2022070709 W CN 2022070709W WO 2022227693 A1 WO2022227693 A1 WO 2022227693A1
Authority
WO
WIPO (PCT)
Prior art keywords
command
circuit
operation unit
line
commands
Prior art date
Application number
PCT/CN2022/070709
Other languages
French (fr)
Chinese (zh)
Inventor
周琳
冷祥纶
孙海涛
张国栋
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2022227693A1 publication Critical patent/WO2022227693A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30007Arrangements for executing specific machine instructions to perform operations on data operands
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/16Handling requests for interconnection or transfer for access to memory bus
    • G06F13/1605Handling requests for interconnection or transfer for access to memory bus based on arbitration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3004Arrangements for executing specific machine instructions to perform operations on memory
    • G06F9/30047Prefetch instructions; cache control instructions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/36Arbitration

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to an apparatus, method, chip, computer device, and storage medium for command distribution.
  • Embodiments of the present disclosure provide at least a command distribution apparatus, method, chip, computer device, and storage medium.
  • an embodiment of the present disclosure provides a command distribution apparatus, including at least one distribution circuit and at least one information buffer; wherein each of the distribution circuits is connected to the at least one information buffer.
  • Each of the information buffers in the at least one information buffer is used to store the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit.
  • Each distribution circuit in the at least one distribution circuit is used to read the first command currently to be sent from the command queue corresponding to the distribution circuit, based on the arithmetic unit identifier carried in the first command, from the The number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the identification of the arithmetic unit; in response to the number of commands meeting a preset condition, an arbitration request signal is sent to the arbitration circuit.
  • each distribution circuit in the command distribution device will send an arbitration request signal to the arbitration circuit only when the number of commands satisfies the preset condition. Therefore, it is possible to avoid command accumulation in some operation units and no executable in other operation units. In the case of a command, the execution efficiency of the command is improved, and the computing resource utilization of the computing unit is increased.
  • each distribution circuit when the number of commands does not meet the preset conditions, each distribution circuit will not participate in the authority arbitration process, and will not occupy the bus; and the distribution circuit that has obtained the distribution authority will also not occupy the bus for a long time, which improves command distribution. s efficiency.
  • the command distribution is realized through hardware, which can effectively reduce the computing resource overhead.
  • the preset condition includes: the number of commands is less than the threshold of the number of commands.
  • each distribution circuit in the at least one distribution circuit is further configured to monitor in real time the number of commands in the first information buffer when the number of commands is equal to the threshold of the number of commands Whether the number of commands has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the arbitration request signal is sent to the arbitration circuit.
  • the command number threshold of the corresponding operation unit is based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the total data storage volume of the corresponding operation unit The size of the space is determined.
  • the operation unit can be dynamically configured according to the size of the data storage space occupied by the unprocessed commands received by each operation unit and the size of the total data storage space of the operation unit
  • the threshold of the number of commands can reduce the probability of command congestion in a certain computing unit, and at the same time, improve the processing efficiency of the computing unit.
  • each distribution circuit in the at least one distribution circuit is further configured to, after receiving the permission permission signal returned by the arbitration circuit based on the arbitration request signal, send a message to the arithmetic unit with the The first operation unit corresponding to the identifier sends the first command.
  • each distribution circuit in the at least one distribution circuit when reading the first command to be sent currently from the command queue corresponding to the distribution circuit, is used to:
  • the corresponding command queue reads the current command line of the first command.
  • the distribution circuit when reading the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the operation unit based on the identifier of the operation unit carried in the first command, is used to:
  • the current command line is the first command line of the first command, based on the operation unit identifier carried in the first command
  • the first information buffer corresponding to the operation unit identifier is read from the first information buffer.
  • the number of commands and the command number threshold when reading the first command to be sent currently from the command queue corresponding to the distribution circuit, is used to:
  • the distribution circuit when reading the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the operation unit based on the identifier of the operation unit carried in the first command, is used to:
  • each distribution circuit can determine whether the number of commands that have been received by the arithmetic unit corresponding to the new command and have not been processed yet reaches the command number threshold.
  • each distribution circuit in the at least one distribution circuit is further configured to: in the case that the current command line is a non-first line command line of the first command, to the arbitration A circuit sends the arbitration request signal.
  • an arbitration request signal can be directly sent to the arbitration circuit to participate in the arbitration of the arbitration circuit, thereby improving the distribution efficiency.
  • each distribution circuit in the at least one distribution circuit is further configured to: determine whether the current command line is the first line of the command line.
  • the distribution circuit when sending an arbitration request signal to the arbitration circuit in response to the number of commands satisfying a preset condition, is configured to: determine the first command line in the first command Whether it is in a ready state; if so, send the arbitration request signal to the arbitration circuit.
  • the first line of the first command being in a ready state includes: a first operation unit corresponding to the first command, a first operation unit corresponding to the second command recently sent by the command queue
  • the second operation unit is the same; or, the first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
  • each command can be processed sequentially according to the order in which the multiple commands are stored in the command queue, ensuring that the same command queue is stored in the same command queue.
  • the multiple commands are processed sequentially.
  • the distribution circuit includes a parsing circuit and a command line buffer; the parsing circuit is respectively connected to the command line buffer and the information buffer.
  • the parsing circuit is used to read the current command line of the first command from the command queue, and determine whether the current command line is the first command line; in the case that the current command line is the first command line Next, based on the operation unit identifier carried in the first line of the command line, read the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the operation unit; In the case of the above-mentioned threshold of the number of commands, the first line of the command line is sent to the command line buffer.
  • the command line buffer is configured to send the arbitration request signal to the arbitration circuit after receiving the first line of the command line sent by the parsing circuit.
  • the parsing circuit is further configured to send the first command line and the first command line to the command line buffer when the number of commands is equal to the command number threshold A pause instruction; the command line buffer is further configured to pause sending the arbitration request signal to the arbitration circuit after receiving the first line of the command line and the first pause instruction sent by the parsing circuit.
  • the parsing circuit is further configured to monitor in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands; after monitoring the change in the number of commands After the number of commands is less than the threshold of the number of commands, a first start command is sent to the command line buffer.
  • the command line buffer is further configured to send the arbitration request signal to the arbitration circuit after receiving the first start instruction.
  • the distribution circuit further includes a command line counter; the command line counter is connected to the parsing circuit.
  • the parsing circuit when determining whether the current command line is the first command line, is configured to read the first count value from the command line counter after reading the current command line from the command queue; When the first count value is equal to the first preset value or equal to the original value, it is determined that the current command line is the first command line in the first command.
  • the first preset value is determined based on the number of command line lines of the first command.
  • the parsing circuit can determine whether the read current command line is the first command line of the first command by reading the first count value of the command line counter and comparing the first count value with the current count threshold, so as to use A low-cost way to realize the identification of different commands in the same queue.
  • the parsing circuit is further configured to update the first preset value based on the number of command lines of the first command when it is determined that the current command line is the first command line, and Send a reset instruction to the command line counter;
  • the command line counter is further configured to reset the first count value to the original value after receiving the reset instruction sent by the parsing circuit, and increase the first count value numerical value.
  • the command line counter restarts to count the number of lines of the command line of the new command to be sent read by the parsing circuit.
  • the distribution circuit further includes a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer.
  • the parsing circuit is further configured to parse the first command line from the first command line when it is determined that the current command line is the first line command line and the number of commands is less than the command number threshold.
  • An operation unit identifier corresponding to a command is sent to the judgment circuit, and the current command line and the operation unit identifier are sent to the command line buffer.
  • the judging circuit is configured to receive the operation unit identifier sent by the parsing circuit, and based on the operation unit identifier, determine the first operation unit corresponding to the first command and the most recently sent data of the command queue.
  • a second pause instruction is sent to the command line buffer.
  • the command line buffer is further configured to suspend sending the arbitration request signal to the arbitration circuit in the case of receiving the second suspend instruction sent by the judgment circuit.
  • the processing order of the two adjacent commands will not be affected due to the processing efficiency of the operation units.
  • the command line buffer does not participate in the arbitration of the arbitration circuit to ensure that the current command is not issued, thereby ensuring the processing order of multiple commands in the same command queue.
  • the distribution circuit further includes a command counter; the command counter is connected to the judgment circuit.
  • the judging circuit is further configured to read a second count value from the command counter after receiving the operation unit identifier sent by the parsing circuit, and when the second count value is greater than a second preset In the case of a numerical value, it is determined that the second command has not been processed by the second operation unit.
  • the command counter is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
  • the judgment circuit compares the second count value read from the command counter with the second preset value, so as to know whether the recently sent second command in the command queue corresponding to the judgment circuit has been processed.
  • the judging circuit is further configured to monitor whether the second count value in the command counter is in the case of determining that the second command has not been processed by the second arithmetic unit. change to the second preset value; and send a second start instruction to the command line buffer when monitoring that the second count value of the command counter changes to the second preset value.
  • the command line buffer is further configured to send the arbitration request signal to the arbitration circuit after receiving the second start instruction.
  • the information buffer can send the third counting instruction to the command counter corresponding to the command queue after the corresponding operation unit has processed the command that has been sent in a certain command queue, and after the command counter receives the third counting instruction, it will The second count value is decreased by a second value to indicate that a command sent by the command queue has been processed.
  • the command counter is connected to the parsing circuit.
  • the parsing circuit is further configured to send the current command line to the first operation unit after monitoring that the command line buffer sends the current command line to the first operation unit when the current command line is the first command line.
  • the command counter sends a second counting instruction; the command counter is used to increase the second counting value by a second value after receiving the second counting instruction.
  • the command counter can record the number of commands that have been sent by the corresponding command queue.
  • the information buffer is connected to command counters corresponding to the plurality of command queues respectively.
  • the first information buffer is further configured to, after receiving the confirmation information fed back after the first operation unit has processed the first command, based on the command line queue identifier and the confirmation information, send The command counter corresponding to the command queue identifier sends a third counting instruction.
  • the command counter is used to decrease the second count value by a second value after receiving the third count instruction sent by the first information buffer.
  • the judgment circuit can notify the command line buffer to participate in the arbitration of the arbitration circuit in real time after the recently sent command in the corresponding command queue is processed, and send the first command line of the current command to be sent.
  • the first information buffer is further configured to update the number of commands after receiving confirmation information fed back after the first operation unit has processed the first command.
  • the distribution circuit can re-participate in the arbitration of the arbitration circuit under the condition that the first operation unit corresponding to the first command to be sent can receive the first command, and obtain the opportunity to send the first command to the first operation unit, Improve the efficiency of command distribution.
  • an embodiment of the present disclosure further provides a command distribution method, which is applied to a command distribution apparatus, where the command distribution apparatus includes at least one distribution circuit and at least one information buffer. Wherein, each of the distribution circuits is connected to the at least one information buffer.
  • the command distribution method includes: each information buffer in the at least one information buffer stores the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit; the at least After each distribution circuit in a distribution circuit reads the first command currently to be sent from the command queue corresponding to the distribution circuit, based on the operation unit identifier carried in the first command, the first command corresponding to the operation unit identifier is retrieved from the first command.
  • the number of commands and the threshold of the number of commands are read from an information buffer, and an arbitration request signal is sent to the arbitration circuit in response to the number of commands meeting a preset condition.
  • the preset condition includes: the number of commands is less than the threshold of the number of commands.
  • the command distribution method further includes: when each distribution circuit in the at least one distribution circuit is equal to the command number threshold, monitoring the first command in real time Whether the number of commands in the information buffer has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the arbitration request signal is sent to the arbitration circuit.
  • the command distribution method further includes: each information buffer in the at least one information buffer acquires a dynamically configured command number threshold of the corresponding operation unit.
  • the command number threshold of the corresponding operation unit is determined based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the size of the total data storage space of the corresponding operation unit.
  • the command distribution method further includes: after each distribution circuit in the at least one distribution circuit receives a permission permission signal returned by the arbitration circuit based on the arbitration request signal, send the The first operation unit corresponding to the operation unit identifier sends the first command.
  • each distribution circuit in the at least one distribution circuit reads the first command currently to be sent from a command queue corresponding to the distribution circuit, including: each of the at least one distribution circuit The distribution circuit reads the current command line of the first command from the command queue corresponding to the distribution circuit. The distribution circuit reads the command number and the command number threshold from the first information buffer corresponding to the operation unit identifier based on the operation unit identifier carried in the first command, including: in the current When the command line is the first line of the command line of the first command, based on the operation unit identifier carried in the first command, read the number of commands and the number of commands from the first information buffer corresponding to the operation unit identifier. The command number threshold.
  • the command distribution method further includes: in each distribution circuit in the at least one distribution circuit, when the current command line is a non-first line command line of the first command , sending the arbitration request signal to the arbitration circuit.
  • the command distribution method further includes: each distribution circuit in the at least one distribution circuit determines whether the current command line is the first line of the command line.
  • the distribution circuit in response to the number of commands meeting a preset condition, sends an arbitration request signal to the arbitration circuit, including: determining whether the first command line in the first command is in a ready state ; if yes, send the arbitration request signal to the arbitration circuit.
  • the first line of the first command being in a ready state includes: a first operation unit corresponding to the first command, a second command corresponding to the most recently sent second command in the command queue
  • the second operation unit is the same; or, the first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
  • the distribution circuit includes a parsing circuit and a command line buffer; the parsing circuit is respectively connected to the command line buffer and the information buffer.
  • each distribution circuit in the at least one distribution circuit reads the first command line of the first command from the command queue corresponding to the distribution circuit, based on the operation unit identifier carried in the first line command line, from the operation
  • the number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the unit identifier; when the number of commands is less than the threshold of the number of commands, an arbitration request signal is sent to the arbitration circuit, including: the The parsing circuit reads the current command line of the first command from the command queue, and determines whether the current command line is the first command line; in the case that the current command line is the first command line, based on the The arithmetic unit identifier carried in the first line of the command line, reads the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arith
  • the command distribution method further includes: when the number of commands is equal to the threshold of the number of commands, the parsing circuit sends the first line of the command line to the command line buffer , and a first pause command; after receiving the first command line and the first pause command sent by the parsing circuit, the command line buffer pauses sending the arbitration request signal to the arbitration circuit.
  • the command distribution method further includes: the parsing circuit monitors in real time whether the number of commands in the first information buffer changes to be less than the command number threshold; After the number of commands is changed to be less than the threshold of the number of commands, a first activation instruction is sent to the command line buffer; after receiving the first activation instruction, the command line buffer sends the first activation instruction to the arbitration circuit. the arbitration request signal.
  • the distribution circuit further includes a command line counter; the command line counter is connected to the parsing circuit.
  • the parsing circuit determining whether the current command line is the first command line includes: after the parsing circuit reads the current command line from the command queue, reading a first count value from the command line counter; In the case that the first count value is equal to the first preset value or equal to the original value, it is determined that the current command line is the first command line in the first command.
  • the first preset value is determined based on the number of command line lines of the first command.
  • the command distribution method further includes: when the parsing circuit determines that the current command line is the first command line, updating the first command line based on the number of command lines of the first command Presetting a value and sending a reset instruction to the command line counter; after receiving the reset instruction sent by the parsing circuit, the command line counter resets the first count value to the original value, and increases the first count value numerical value.
  • the command distribution method further includes: after the parsing circuit determines that the current command line is a non-first line command line of the first command, sending a first command line to the command line counter A counting instruction; after the command line counter receives the first counting instruction sent by the parsing circuit, the first counting value is increased by a first value.
  • the distribution circuit further includes a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer.
  • the command distribution method further includes: when the parsing circuit determines that the current command line is the first line of the command line, and when the number of commands is less than the command number threshold, extracting the command from the first line of the command line.
  • a second pause instruction is sent to the command line buffer; the command line buffer receives the judgment In the case of the second pause command sent by the circuit, transmission of the arbitration request signal to the arbitration circuit is paused.
  • the distribution circuit further includes a command counter; the command counter is connected to the judgment circuit.
  • the command distribution method further includes: after the judging circuit receives the operation unit identifier sent by the parsing circuit, reading a second count value from the command counter, and when the second count value is greater than In the case of the second preset value, it is determined that the second command has not been processed by the second operation unit.
  • the command counter is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
  • the command distribution method further includes: when the judgment circuit determines that the second command has not been processed by the second arithmetic unit, monitoring the first command in the command counter. Whether the second count value has changed to the second preset value; and in the case of monitoring that the second count value of the command counter has changed to the second preset value, send a second start command to the command line buffer; After receiving the second start command, the command line buffer sends the arbitration request signal to the arbitration circuit.
  • the command counter is connected to the parsing circuit.
  • the command distribution method further includes: when the current command line is the first command line, the parsing circuit detects that the command line buffer sends the current command line to the first computing unit after monitoring that the current command line is sent to the first computing unit. , sending a second counting instruction to the command counter; after receiving the second counting instruction, the command counter increases the second counting value by a second value.
  • the information buffer is connected to command counters corresponding to a plurality of command queues respectively; the command distribution method further includes: the first information buffer receives the first operation unit After the confirmation information fed back after the first command is processed, based on the command line queue identifier and the confirmation information, a third counting instruction is sent to the command counter corresponding to the command queue identifier; the command counter is in After receiving the third count instruction sent by the first information buffer, the second count value is decreased by a second value.
  • the command distribution method further includes: after the first information buffer receives the confirmation information fed back after the first operation unit has processed the first command, updating all the number of commands.
  • an optional implementation manner of the present disclosure further provides a chip, including the command distribution apparatus according to the first aspect or any one of the first aspect.
  • an optional implementation manner of the present disclosure further provides a computer device, including an instruction memory and the chip described in the third aspect above.
  • an optional implementation manner of the present disclosure further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor when the second aspect or the second aspect is executed.
  • FIG. 1 shows a schematic diagram of a command distribution apparatus provided by an embodiment of the present disclosure
  • FIG. 2 shows a schematic diagram of another command distribution apparatus provided by an embodiment of the present disclosure
  • FIG. 3 shows a schematic structural diagram of a distribution circuit provided by an embodiment of the present disclosure
  • FIG. 4 shows a schematic diagram of a command distribution method provided by an embodiment of the present disclosure.
  • the micro-control unit When the micro-control unit distributes the command, it sends the command to the command distribution unit. After the command distribution unit receives the command, it can use the software program deployed in the command distribution unit to distribute the command to each computing unit. When the command distribution unit sends commands to the operation unit, it will occupy the bus. If too many commands are distributed to an operation unit, the bus resources will always be occupied by the operation unit. In this way, commands may be piled up in the operation unit, but no commands can be executed by other operation units, resulting in lower execution efficiency of the commands, and the computing resources of the operation units cannot be fully utilized.
  • the present disclosure provides a command distribution device composed of hardware, which distributes commands through a hardware circuit, and each distribution circuit in the command distribution device determines the first operation unit corresponding to the first command to be sent currently.
  • a command distribution device composed of hardware, which distributes commands through a hardware circuit, and each distribution circuit in the command distribution device determines the first operation unit corresponding to the first command to be sent currently.
  • an arbitration request signal is sent to the arbitration circuit, so it can be avoided that the command accumulates in some operation units, and When other computing units have no executable commands, the execution efficiency of the commands is improved, and the computing resource utilization of the computing units is increased.
  • each distribution circuit in the command distribution device will send an arbitration request to the arbitration circuit when it is determined that the number of currently unprocessed commands in the first operation unit corresponding to the first command is less than the command number threshold of the first operation unit Signal, that is, when the number of currently unprocessed commands in the first operation unit corresponding to the command to be sent is equal to the command number threshold of the first operation unit, it will not participate in the authority arbitration process, so it will not Occupies the bus; and the distribution circuit that obtains the distribution authority also does not occupy the bus for a long time, which improves the efficiency of command distribution.
  • command distribution apparatus provided by the embodiments of the present disclosure is implemented by hardware, which can effectively reduce computing resource overhead and improve the efficiency of command distribution.
  • connection described in the embodiments of the present disclosure refers to the connection between hardware circuits.
  • different circuit modules eg, a distribution circuit, an arbitration circuit
  • level signals eg, a high level, a low level
  • the combination of different level signals can represent different meanings according to the convention.
  • the number 1 represents a high level
  • the number 0 represents a low level.
  • Multiple electrical signal transmission lines can be set between the two circuit modules, when different signals are transmitted, different lines are controlled to transmit different level signals, and the combination of different level signals forms different binary numbers.
  • the level signals sent in a certain processing cycle are high level, low level, and high level, respectively, and the binary number formed is 101. Different binary numbers represent different meanings by definition.
  • the command queue, command line buffer, and information buffer described in the embodiments of the present disclosure are electronic components with a storage function.
  • the operation unit described in the embodiments of the present disclosure is a hardware circuit that can implement different operations, for example, includes a convolution operation unit that performs multiplication and addition operations, an encoding/decoding operation unit that performs video encoding and decoding, and the like.
  • Each operation unit is connected with the bus; and each operation unit corresponds to an information buffer, each operation unit is connected with the corresponding information buffer, and each information buffer stores the number of commands that the corresponding operation unit has not processed as The number of commands, and the command number threshold.
  • Each computing unit has a limited ability to receive commands, and the command number threshold is the maximum number of received but unprocessed commands that the computing unit can store;
  • the command number threshold of an operation unit may be different. Specifically, the command number threshold of each operation unit may be set according to the processing capability of each operation unit, which is not limited here.
  • the commands described in the embodiments of the present disclosure are, for example, a command package, and each command includes multiple command lines.
  • the first line of the command line is also called the header line, and the header line carries the identifier of the operation unit to which the command is to be sent.
  • the command distribution device distributes the command to the corresponding computing unit based on the identifier.
  • the first line of the command line also includes the number of lines of the command line included in the command.
  • the first three bits of the first line of the command line represent the identifier of the operation unit to which the command is to be sent
  • the fourth and fifth bits represent the number of lines of the command line included in the command.
  • the specific information of the command is carried, such as the operation to be performed by the command, the address of the operand, and the command status.
  • the specific information of the command may vary according to different commands, which is not limited in this embodiment of the present disclosure.
  • Command line counter and command counter are electronic components with counting function.
  • the parsing circuit and the arbitration circuit are hardware circuits that implement corresponding functions through the connection of electronic components and the transmission of level signals (eg, high level, low level).
  • the command distribution apparatus includes at least one distribution circuit 10-0 to 10-n (hereinafter collectively referred to as distribution circuit 10) and at least one information cache 20-0 to 20-n (hereinafter collectively referred to as information buffers 20).
  • Each information buffer 20 in the at least one information buffer is used to store the number of current unprocessed commands in the corresponding arithmetic unit as the number of commands and the command number threshold of the corresponding arithmetic unit;
  • Each distribution circuit 10 in at least one distribution circuit is used to read the first command currently to be sent from the command queue corresponding to the distribution circuit 10, based on the operation unit identifier carried in the first command, from the operation unit identifier corresponding to The number of commands and the threshold of the number of commands are read from the first information buffer 20 of the first information buffer; in response to the number of commands meeting the preset condition, an arbitration request signal is sent to the arbitration circuit.
  • each distribution circuit 10 is connected with the at least one information buffer 20 .
  • the command distribution apparatus further includes an arbitration circuit 30 , and the arbitration circuit 30 is connected to at least one distribution circuit 10 respectively.
  • the arbitration circuit 30 is configured to perform authority arbitration on each distribution circuit 10 after receiving an arbitration request signal sent by each distribution circuit 10 in at least one distribution circuit, and return to the distribution circuit 10 that has obtained the transmission authority based on the result of the authority arbitration Permission permission signal.
  • the command distribution apparatus in the embodiment of the present disclosure is implemented by hardware, which can effectively reduce computing resource overhead.
  • each distribution circuit of the command distribution device After reading the first command to be sent, each distribution circuit of the command distribution device reads the number of commands and the number of commands from the first information buffer corresponding to the identifier of the operation unit based on the identifier of the operation unit carried in the first command. Threshold; when the number of commands is less than the threshold of the number of commands, an arbitration request signal is sent to the arbitration circuit. Therefore, it is possible to avoid a situation in which command accumulation occurs in some computing units, while other computing units have no executable commands, thereby improving the execution efficiency of commands and increasing the computing resource utilization rate of the computing units.
  • the distribution circuit will not participate in the authority arbitration process and will not occupy the bus when the number of currently unprocessed commands in the first operation unit corresponding to the first command is equal to the command number threshold of the first operation unit; and The distribution circuit that obtains the distribution authority also does not occupy the bus for a long time, thereby improving the efficiency of command distribution.
  • the distribution circuit 10 when the first command to be sent currently is read from the command queue corresponding to the distribution circuit, for example, the current command line of the first command is read from the command queue corresponding to the distribution circuit.
  • each information buffer 20 in the at least one information buffer it is also used to obtain a dynamically configured command number threshold of the corresponding operation unit.
  • the command number threshold corresponding to the operation unit is determined based on, for example, the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the total data storage space size of the corresponding operation unit.
  • the dynamic configuration is, for example, configuration by any one of the host, the distribution circuit 10 , and the configuration unit connected to each information buffer 20 .
  • the host or the configuration unit connected to each information buffer 20 determines the corresponding operation unit based on the size of the data storage space occupied by the currently unprocessed command in the corresponding operation unit and the size of the total data storage space of the corresponding operation unit. command count threshold.
  • the total data storage space of the operation unit can store 50 lines of command lines, the number of unprocessed commands received by the operation unit is 3, and the data storage space occupied by the three commands is 30 lines , the operation unit still has 20 lines of storage space.
  • the host or the configuration unit connected to each information buffer 20 determines that the operation unit has a command number threshold of 4.
  • the distribution circuit 10 reads the first command line of the first command from the command queue corresponding to the distribution circuit 10, parses the first command line to obtain the number of command lines of the first command, and sends the first information to the first information
  • the buffer sends the number of command lines; after receiving the number of command lines sent by the distribution circuit 10, the first information buffer is based on the number of command lines, the size of the data storage space occupied by the currently unprocessed commands in the first arithmetic unit, And the size of the total data storage space of the first operation unit determines the command number threshold of the first operation unit.
  • the total data storage space of the first operation unit can store 40 lines of command lines, the number of unprocessed commands received by the first operation unit is 3, and the data storage space occupied by the three commands
  • the size is 30 lines, and the first operation unit has 10 lines of storage space left. If the number of command lines of the first command is greater than 10 lines, the threshold of the number of commands of the first operation unit is 3; if the command line of the first command If the number of lines is less than or equal to 10 lines, the command number threshold of the first operation unit is 4.
  • each distribution circuit 10 in at least one distribution circuit For each distribution circuit 10 in at least one distribution circuit, read the current command line of the first command from the command queue corresponding to the distribution circuit 10, and determine whether the current command line is the first command line of the first command.
  • Case A1 In the case where it is determined that the current command line is the first command line of the first command, the distribution circuit 10, based on the operation unit identifier carried in the first line of the command line, selects from the first information buffer corresponding to the operation unit identifier.
  • the number of currently unprocessed commands in the first operation unit corresponding to the first command is read as the number of commands and the command number threshold of the first operation unit, and an arbitration request signal is sent to the arbitration circuit in response to the number of commands meeting a preset condition.
  • the preset condition includes, for example, that the number of commands is less than a threshold of the number of commands. Therefore, when the number of commands is smaller than the command number threshold, the distribution circuit 10 sends an arbitration request signal to the arbitration circuit 30 .
  • the first operation unit is the operation unit corresponding to the first command to be sent currently
  • the first information buffer is the information buffer corresponding to the first operation unit
  • the operation unit identifier includes, for example, the identifier of the corresponding operation unit (for example, At least one of the contents of the address of the corresponding operation unit), the identifier of the corresponding information buffer (for example, the address of the corresponding information buffer) and the like.
  • the distribution circuit 10 may also record the operation unit identifier; when the current command line is a non-first line command line, use the recorded operation unit identifier to send the current command line to the first operation unit corresponding to the operation unit identifier.
  • the current command line read by the distribution circuit 10 is the first command line, which means that the distribution circuit wants to start sending a new first command, and needs to determine the received, but not yet stored, first operation unit corresponding to the new first command. Whether the number of processed commands (hereinafter referred to as the number of commands) has reached the maximum value; if the number of commands is less than the threshold of the number of commands, it means that the number of received but unprocessed commands stored by the first operation unit has not reached the maximum value. , the first arithmetic unit can also normally receive the command sent by the distribution circuit. At this time, the distribution circuit can send an arbitration request signal to the arbitration circuit 30 to participate in the arbitration of the arbitration circuit 30 to obtain the opportunity to send the command to the first arithmetic unit.
  • the distribution circuit 10 monitors in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands; after monitoring that the number of commands changes to be less than the threshold of the number of commands, An arbitration request signal is sent to the arbitration circuit 30 .
  • the command sent by the distribution circuit 10 cannot be received until at least one of the stored commands is processed.
  • the command sent by the distribution circuit 10 is received.
  • the first arithmetic unit After the first arithmetic unit processes a command, it will give feedback information to the first information buffer, and the first information buffer will update the number of commands after receiving the feedback information, for example, reduce the number of commands by 1, and the distribution circuit 10 After monitoring that the number of commands stored in the first information buffer changes to be less than the command number threshold, an arbitration request signal is sent to the arbitration circuit 30 to participate in the arbitration of the arbitration circuit 30 to obtain an opportunity to send commands to the first arithmetic unit.
  • Case A2 When it is determined that the current command line is a non-first line command line of the first command, the distribution circuit 10 directly sends an arbitration request signal to the arbitration circuit 30 .
  • the distribution circuit 10 In the case where the current command line is not the first command line of the first command, it means that the distribution circuit 10 has determined that the first operation unit corresponding to the first command has received the received command line when sending the first command line of the first command. However, the number of unprocessed commands has not reached the maximum value. Therefore, when the current command line read is not the first command line of the first command, the distribution circuit 10 can directly send an arbitration request signal to the arbitration circuit 30. , without the need to determine whether the current number of unprocessed commands in the first operation unit is less than the command number threshold.
  • the corresponding operation unit will process the processing task corresponding to the command based on the command. Therefore, if the current command line is a non-first-line command line, you can continue to send the non-first-line command line to the corresponding operation unit. Therefore, the distribution circuit 10 directly sends an arbitration request signal to the arbitration circuit 30 when the current command line is a non-first-line command line.
  • any one of the following modes B1 or B2 may be adopted:
  • Mode B1 When the number of commands is less than the command number threshold, the distribution circuit 10 sends an arbitration request signal to the arbitration circuit 30 .
  • Mode B2 when the number of commands is less than the threshold of the number of commands, the distribution circuit 10 determines whether the first line of the command line is in a ready state; if so, it sends an arbitration request signal to the arbitration circuit 30; if it is not in a ready state, it does not send the arbitration circuit 30. The arbitration request signal is sent until it changes to the ready state.
  • the current command line is in the ready state, which means that when the number of commands is less than the command number threshold, the current command line can be sent to the corresponding first operation unit.
  • the ready state includes, for example, any one of the following states (1) to (2):
  • the first operation unit corresponding to the first command where the first line of the command line is located is the same as the second operation unit corresponding to the second command recently sent by the command queue.
  • each command in the latter command can be processed.
  • the rows are sent to the same operation unit, so that the processing order between different commands in the same command queue can also be guaranteed.
  • the current command line is determined as the ready state; in the above (2), in the first operation unit and the second operation unit When the units are different, and the second command is processed by the second operation unit, the current command line is determined to be in a ready state.
  • each distribution circuit 10 in the at least one distribution circuit sends a first command to the first operation unit corresponding to the operation unit identifier after receiving the authorization permission signal returned by the arbitration circuit 30 based on the arbitration request signal.
  • the command distribution device may further include a command distribution interface 40; the distribution circuit 10 may be connected to the command distribution interface 40, and when sending the current command line to the first operation unit, the current command line and the operation unit identifier may be sent together To the command distribution interface 40 .
  • the command distribution interface 40 is connected to the bus, and based on the identification of the operation unit, sends the current command line to the first operation unit connected to the bus through the bus.
  • the command distribution interface 40 can also be connected to the arbitration circuit 30; the distribution circuit 10 sends the current command line and the operation unit identifier to the arbitration circuit 30 after receiving the permission permission signal; the arbitration circuit 30 sends the current command line and the operation unit identifier to the arbitration circuit 30; The identifier is sent to the command distribution interface 40 together, and then the command distribution interface 40 sends the current command line to the first operation unit connected to the bus through the bus based on the operation unit identifier.
  • the command distribution interface 40 may be connected, for example, to a bus interface of a bus.
  • the command distribution interface 40 sends the current command line and the operation unit identifier to the bus interface, and the bus interface sends the current command line to the first operation unit through the bus and the operation unit identifier.
  • the distribution circuit 10 includes a parsing circuit 101 and a command line buffer 102; the parsing circuit 101 and the command line buffer 102 and the at least one information buffer 20 is connected;
  • the parsing circuit 101 is used to read the current command line of the first command from the command queue, and determine whether the current command line is the first command line; in the case that the current command line is the first command line, based on the first command line carried
  • the arithmetic unit identifier reads the command quantity and the command number threshold from the first information buffer corresponding to the arithmetic unit identifier; In the case that the command quantity is less than the command number threshold, send the first line command line to the command line buffer 102;
  • the command line buffer 102 is configured to send an arbitration request signal to the arbitration circuit after receiving the first line of the command line sent by the parsing circuit 101 .
  • each parsing circuit 101 is connected to the corresponding command queue, the parsing circuit 0 in FIG. 3 is connected to the command queue 0, the parsing circuit 1 is connected to the command queue 1; the parsing circuit 101 is connected to Corresponding command line buffers 102 are connected.
  • parsing circuit 0 is connected to command line buffer 0
  • parsing circuit 1 is connected to command line buffer 1 .
  • the process of reading the command queue by the parsing circuit 101 includes, for example: the parsing circuit 101 monitors the level state between it and the command queue, and monitors the level state between it and the command line buffer 102;
  • the level state of the command line indicates that there is a command to be sent in the command queue, and the level state between the command line buffer 102 and the command line buffer 102 indicates that the command line buffer 102 is empty, then the current command line is read from the command queue.
  • the process of reading the command queue by the parsing circuit 101 may further include: when the command queue stores the command to be sent, sending a first level signal to the parsing circuit 101, where the first level signal represents that the command to be sent is stored in the command queue ; After receiving the first level signal, the parsing circuit 101 sends a second level signal to the command line buffer 102. After the command line buffer 102 receives the second level signal, there is no signal in the command line buffer 102. In the case of storing any command line, a third level signal is sent to the parsing circuit 101. After receiving the third level signal, the parsing circuit 101 feeds back the fourth level signal to the command queue, and the command queue receives the fourth level signal. After the signal is sent, the parsing circuit 101 sends the current command line among the plurality of command lines to be sent.
  • the command line buffer 102 When the command line buffer 102 stores a command line, it feeds back a fifth level signal to the parsing circuit 101. After receiving the fifth level signal, the parsing circuit 101 feeds back a sixth level signal to the command queue, and the command queue After receiving the sixth level signal, continue to send the first level signal to the analysis circuit 101 until the fourth level signal fed back by the analysis circuit 101 is received.
  • the above-mentioned sending of the first level signal, the second level signal, the third level signal, the fourth level signal, the fifth level signal, and the sixth level signal may be a transmission state, or may It is the corresponding circuit module that maintains the state corresponding to the level signal. For example, if the first level signal sent by the command queue to the parsing circuit 101 is a high level, then the command queue may send a high level to the parsing circuit 101 once every clock cycle, or the command queue may keep a high level all the time. state.
  • the parsing circuit 101 is further configured to send the first line of the command line and the first pause instruction to the command line buffer when the number of commands is equal to the threshold of the number of commands; the command line buffer 102, after receiving the After the first line of the command line and the first pause instruction, the arbitration request signal is sent to the arbitration circuit by pause.
  • the parsing circuit 101 monitors in real time whether the number of commands in the first information buffer has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the parsing circuit 101 sends the first start to the command line buffer 102 command; after receiving the first start command, the command line buffer 102 sends an arbitration request signal to the arbitration circuit 30 .
  • the distribution circuit 10 After the distribution circuit 10 reads the current command line, it determines whether the current command line is the first command line of the first command.
  • the arithmetic unit identifier reads the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arithmetic unit; in the case that the number of commands is less than the threshold of the number of commands, determine whether the first line of the command line is in a ready state;
  • the arbitration circuit 30 transmits an arbitration request signal.
  • the distribution circuit 10 further includes a command line counter 103 ; the command line counter 103 is connected to the parsing circuit 101 .
  • the parsing circuit 101 is configured to read the first count value from the command line counter 103 after reading the current command line from the command queue; when the first count value is less than the first preset value and greater than the original value, determine The current command line is the non-first command line in the first command.
  • the first preset value is determined based on the number of command line lines of the first command.
  • the first preset value is related to the original value of the command line buffer 102 .
  • the first preset value can be m+n; the original value can be set according to the actual situation, such as the original value It can be set to 0, or 1, etc., and can be set according to actual needs.
  • the parsing circuit 101 reads the current command line from the command queue, and when it is determined that the current command line is a non-first line command line in the first command, sends the current command line to the command line buffer 102, as shown in 4 in Figure 3
  • the command line buffer 102 after receiving the current command line sent by the parsing circuit 101, sends an arbitration request signal to the arbitration circuit 30, as shown in 5 in FIG. 3 .
  • the parsing circuit 101 reads the current command line from the command queue, it reads the first count value from the command line counter 103, as shown in 1 and 3 in FIG. 3; after the parsing circuit 101 reads the first count value, After it is determined that the current command line is a non-first line command line in the first command, the command line counter 103 sends a first count instruction, as shown in 2 in FIG. 3 ; The first count value is incremented by the first value after the count instruction.
  • the first value is set according to the specific application situation, for example, for the number of lines of the command line read by the recording parsing circuit 101 , the first value is, for example, 1.
  • the parsing circuit 101 determines that the current command line is the first command line in the first command, Update the first preset value based on the number of command line lines of the first command and send a reset instruction to the command line counter 103, as shown in 6 in FIG. 3 ; after the command line counter 103 receives the reset instruction sent by the parsing circuit 101 , reset the first count value to the original value and then increase the first value.
  • the parsing circuit 101 determines that the current command line is the first line command of the first command, based on the operation unit identifier carried in the first line command line, the number of commands and the number of commands are read from the first information buffer corresponding to the operation unit identifier. Threshold; if the number of commands is less than the threshold of the number of commands, determine whether the first line of the command line is in a ready state; if so, send an arbitration request signal to the arbitration circuit 30 .
  • the distribution circuit 10 further includes a judgment circuit 104 .
  • the analysis circuit 101 is connected to the judgment circuit 104 .
  • the parsing circuit 101 is also used to determine that the current command line is the first command line in the first command, and in the case that the number of commands is less than the command number threshold, from the first command line to parse the operation unit identifier corresponding to the first command, and send the operation unit identifier to the judgment circuit 104, and send the current command line to the command line buffer 102;
  • the judgment circuit 104 is used to receive the arithmetic unit identifier sent by the parsing circuit 101, and based on the arithmetic unit identifier, it is judged that the first arithmetic unit corresponding to the first command and the second arithmetic unit corresponding to the second command that the command queue has recently sent are different, And when the second command is not processed by the second arithmetic unit, send a second pause command to the command line buffer 102;
  • the command line buffer 102 is further configured to suspend sending an arbitration request signal to the arbitration circuit 30 when the second suspend instruction sent by the judgment circuit 104 is received.
  • the command counter 105 is further included in the distribution circuit 10 .
  • the command counter 105 is connected to the judgment circuit 104 .
  • the judgment circuit 104 is further configured to read the second count value from the command counter 105 after receiving the operation unit identifier sent by the analysis circuit 101, and determine the first count value when the second count value is greater than the second preset value.
  • the second command has not been processed by the second operation unit;
  • the command counter 105 is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
  • the parsing circuit 101 is connected to the judgment circuit 104 and the command counter 105, and the command counter 105 is connected to the judgment circuit 104; when the current command line is the first command line in the first command, The parsing circuit 101 parses the arithmetic unit identification corresponding to the first command from the first line command line, and sends the arithmetic unit identification to the judgment circuit 104, as shown in 7 in Figure 3, and sends the current command line,
  • the operation unit identifier is shown as 8 in FIG. 3 ; wherein, the operation unit identifier may be, for example, a binary array, used to represent the address of the first operation unit corresponding to the first command.
  • the judgment circuit 104 After the judgment circuit 104 receives the operation unit identifier sent by the parsing circuit 101, it is determined that the received operation unit identifier is consistent with the second identifier of the second operation unit corresponding to the second command that the command queue has recently sent. That is, the ready state described in the above state (1), the judgment circuit 104 maintains a fixed level signal such as a high level. When the judgment circuit 104 is maintained at a high level, the command line buffer 102 receives the parsing circuit 101. After sending the current command line and the operation unit identifier, the arbitration request signal is sent to the arbitration circuit 30 as shown in 9 in FIG. 3 .
  • the second identifier may be, for example, a binary array, which is used to represent the address of the second operation unit.
  • the judgment circuit 104 reads the second count value from the command counter 105 after receiving the operation unit identifier sent by the parsing circuit 101 , and in the case that the second count value is equal to the second preset value , it is determined that the second command has been processed by the second operation unit, and when the operation unit identifier is inconsistent with the second identifier of the second operation unit corresponding to the second command, it is the ready state described in the above state (2).
  • the judging circuit 104 is kept at a fixed level signal, such as a high level.
  • the command line buffer 102 After receiving the current command line and the arithmetic unit identifier sent by the parsing circuit 101, sends the The arbitration circuit 30 sends the arbitration request signal as shown in 9 in FIG. 3 .
  • the judgment circuit 104 reads the second count value from the command counter 105 after receiving the operation unit identifier sent by the parsing circuit 101 , and when the second count value is greater than the second preset value In this case, it is determined that the second command that has been sent recently has not been processed by the second operation unit, and when the identifier of the operation unit is inconsistent with the second identifier of the second operation unit, the judgment circuit 104 sends the command to the command line buffer 102.
  • the second pause command is shown in Figure 3 As shown, the command line buffer 102 suspends sending the arbitration request signal to the arbitration circuit 30 when receiving the second suspend instruction sent by the judgment circuit 104 .
  • the judgment circuit 104 monitors whether the second count value in the command counter 105 changes to the second preset value when it is determined that the second command has not been processed by the second arithmetic unit; and monitors the second count of the command counter 105 When the value changes to the second preset value, a second start command is sent to the command line buffer 102 as shown in FIG. 3 As shown; the command line buffer 102 sends an arbitration request signal to the arbitration circuit 30 after receiving the second start command.
  • the arbitration circuit 30 After receiving the arbitration request signal sent by each command line buffer 102, the arbitration circuit 30 performs authority arbitration on each command line buffer 102, and based on the result of the authority arbitration, returns the authority permission to the command line buffer 102 that has obtained the sending authority
  • the signal is shown in Figure 3 shown.
  • the command line buffer 102 After receiving the permission permission signal returned by the arbitration circuit 30 based on the arbitration request signal, the command line buffer 102 sends the current command line to the first operation unit corresponding to the first command.
  • the command line buffer 102 sends the current command line and the arithmetic unit identifier of the first arithmetic unit to the arbitration circuit 30 after receiving the permission permission signal returned by the arbitration circuit 30 based on the arbitration request signal.
  • the arbitration circuit 30 sends the current command line and the arithmetic unit identification to the command distribution interface 40 as shown in Figure 3 shown;
  • the command distribution interface 40 sends the current command line and the operation unit identification to the bus interface after receiving the current command line and the arithmetic unit identification as shown in Figure 3
  • the bus interface sends the current command line to the first operation unit based on the operation unit identifier.
  • the bus is connected to each operation unit, and the bus selects the operation unit to be communicated through the identification of each operation unit.
  • the command line buffer 102 is connected to the command distribution interface 40; after receiving the permission permission signal returned by the arbitration circuit 30 based on the arbitration request signal, the command line buffer 102 sends the command distribution interface 40 The current command line and the operation unit identifier; the command distribution interface 40 sends the current command line and the operation unit identifier to the bus interface after receiving the current command line and the operation unit identifier; the bus interface receives the current command line and the operation unit identifier. After the unit identification, the current command line is sent to the first operation unit based on the operation unit identification.
  • the command line buffer 102 is connected to the information buffer 20; the parsing circuit 101 sends the command queue identifier of the command queue to the command line buffer 102 when it is determined that the current command line is the first command line in the first command; the command When the line buffer 102 sends the current command line to the first operation unit corresponding to the first command, it sends the command queue identifier to the first information buffer; wherein, the first information buffer is the information buffer corresponding to the first operation unit device 20.
  • the arbitration circuit 30 is connected to the information buffer 20 ; the information buffer 20 is connected to command counters corresponding to a plurality of command queues respectively; the command line buffer 102 sends the current command line, the operation unit to the arbitration circuit 30 Identification and command queue identification; when the arbitration circuit 30 sends the current command line and the arithmetic unit identification to the command distribution interface 40, it sends the command queue identification to the first information buffer as shown in Figure 3 shown.
  • the first information buffer receives the command queue identifier; and the confirmation information fed back after receiving the first operation unit to process the first command is as shown in Figure 3
  • a third counting instruction is sent to the command counter 105 as shown in FIG. 3
  • the first information buffer updates the number of commands, for example, decrements the number of commands by 1, after receiving the confirmation information fed back after the first operation unit has processed the first command.
  • the command counter 105 After receiving the third counting instruction sent by the first information buffer, the command counter 105 reduces the second counting value by the second value.
  • the acknowledgement information fed back to the information buffer 20 may be, for example, an acknowledgement character (Acknowledge character, ACK).
  • the command counter 105 can count the commands corresponding to the command queue that are currently sent but not yet processed.
  • Figure 3 It does not represent a specific processing sequence, but only to illustrate the processing logic in two cases where the current command line acquired by the distribution circuit 10 is the first command line or the non-first command line of the first command to be sent currently.
  • the arbitration circuit 30 only returns a permission permission signal to one command line register 102 , that is, the right to use the bus can only be given to one command line register 102 at the same time.
  • the arbitration logic of the arbitration circuit 30 may be defined based on the registers connected to the arbitration circuit 30, for example, arbitration is performed by dividing the command queues into levels, or arbitration is based on a polling manner, which is not limited here.
  • the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its functions and possible Internal logic is determined.
  • the embodiment of the present disclosure also provides a command distribution method corresponding to the command distribution device. Reference may be made to the implementation of the method, and repeated descriptions will not be repeated.
  • the execution subject of the command distribution method provided by the embodiment of the present disclosure is generally a computer device with a certain computing capability.
  • Equipment, UE mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (Personal Digital Assistant, PDA), handheld devices, computing devices, in-vehicle devices, wearable devices, etc.
  • PDA Personal Digital Assistant
  • the command distribution method may be implemented by the processor invoking computer-readable instructions stored in the memory.
  • the command distribution method provided by the embodiment of the present disclosure will be described below by taking the execution subject as the command distribution apparatus as an example.
  • a schematic diagram of a command distribution method provided by an embodiment of the present disclosure includes:
  • each information buffer in at least one information buffer stores the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit;
  • each distribution circuit in the at least one distribution circuit reads the first command line of the first command to be sent from the command queue corresponding to the distribution circuit, and based on the operation unit identifier carried in the first command line The number of read commands and the threshold of the number of commands in the first information buffer corresponding to the unit identifier; when the number of commands is less than the threshold of the number of commands, send an arbitration request signal to the arbitration circuit; after receiving the authority returned by the arbitration circuit based on the arbitration request signal After the permission signal is received, the first command line is sent to the first operation unit corresponding to the operation unit identifier.
  • the preset condition includes: the number of commands is less than the threshold of the number of commands.
  • the command distribution method further includes: when each distribution circuit in the at least one distribution circuit is equal to the command number threshold, monitoring the first command in real time Whether the number of commands in the information buffer has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the arbitration request signal is sent to the arbitration circuit.
  • the command distribution method further includes: each information buffer in the at least one information buffer acquires a dynamically configured command number threshold of the corresponding operation unit.
  • the command number threshold of the corresponding operation unit is determined based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the size of the total data storage space of the corresponding operation unit.
  • the command distribution method further includes: after each distribution circuit in the at least one distribution circuit receives a permission permission signal returned by the arbitration circuit based on the arbitration request signal, send the The first operation unit corresponding to the operation unit identifier sends the first command.
  • each distribution circuit in the at least one distribution circuit reads the first command currently to be sent from a command queue corresponding to the distribution circuit, including: each of the at least one distribution circuit The distribution circuit reads the current command line of the first command from the command queue corresponding to the distribution circuit. The distribution circuit reads the command number and the command number threshold from the first information buffer corresponding to the operation unit identifier based on the operation unit identifier carried in the first command, including: in the current When the command line is the first line of the command line of the first command, based on the operation unit identifier carried in the first command, read the number of commands and the number of commands from the first information buffer corresponding to the operation unit identifier. The command number threshold.
  • the command distribution method further includes: in each distribution circuit in the at least one distribution circuit, when the current command line is a non-first line command line of the first command , sending the arbitration request signal to the arbitration circuit.
  • the command distribution method further includes: each distribution circuit in the at least one distribution circuit determines whether the current command line is the first line of the command line.
  • the distribution circuit in response to the number of commands meeting a preset condition, sends an arbitration request signal to the arbitration circuit, including: determining whether the first line of command lines is in a ready state; if so, sending an arbitration request signal to the arbitration circuit.
  • the arbitration circuit sends the arbitration request signal.
  • the first-line command line being in a ready state includes: a first operation unit corresponding to the first command where the first-line command line is located, and a second command corresponding to the second command that has been recently sent by the command queue
  • the second operation unit is the same; or, the first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
  • the distribution circuit includes a parsing circuit and a command line buffer; the parsing circuit is respectively connected to the command line buffer and the information buffer.
  • each distribution circuit in the at least one distribution circuit reads the first command line of the first command from the command queue corresponding to the distribution circuit, based on the operation unit identifier carried in the first line command line, from the operation
  • the number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the unit identifier; when the number of commands is less than the threshold of the number of commands, an arbitration request signal is sent to the arbitration circuit, including: the The parsing circuit reads the current command line of the first command from the command queue, and determines whether the current command line is the first command line; in the case that the current command line is the first command line, based on the The arithmetic unit identifier carried in the first line of the command line, reads the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arith
  • the command distribution method further includes: when the number of commands is equal to the threshold of the number of commands, the parsing circuit sends the first line of the command line to the command line buffer , and a first pause command; after receiving the first command line and the first pause command sent by the parsing circuit, the command line buffer pauses sending the arbitration request signal to the arbitration circuit.
  • the command distribution method further includes: the parsing circuit monitors in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands, After the number of commands is changed to be less than the threshold of the number of commands, a first activation instruction is sent to the command line buffer; after receiving the first activation instruction, the command line buffer sends the first activation instruction to the arbitration circuit. the arbitration request signal.
  • the distribution circuit further includes a command line counter; the command line counter is connected to the parsing circuit.
  • the parsing circuit determining whether the current command line is the first command line includes: after the parsing circuit reads the current command line from the command queue, reading a first count value from the command line counter; In the case that the first count value is equal to the first preset value or equal to the original value, it is determined that the current command line is the first command line in the first command; wherein, the first preset value, is determined based on the number of command line lines of the first command.
  • the command distribution method further includes: when the parsing circuit determines that the current command line is the first command line, updating the first command line based on the number of command lines of the first command Presetting a value and sending a reset instruction to the command line counter; after receiving the reset instruction sent by the parsing circuit, the command line counter resets the first count value to the original value, and increases the first count value numerical value.
  • the command distribution method further includes: after the parsing circuit determines that the current command line is a non-first line command line of the first command, sending a first command line to the command line counter A counting instruction; after the command line counter receives the first counting instruction sent by the parsing circuit, the first counting value is increased by a first value.
  • the distribution circuit further includes a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer.
  • the command distribution method further includes: when the parsing circuit determines that the current command line is the first line of the command line, and when the number of commands is less than the command number threshold, extracting the command from the first line of the command line.
  • Parse the operation unit identifier corresponding to the first command send the operation unit identifier to the judgment circuit, and send the current command line and the operation unit identifier to the command line buffer; the judgment The circuit receives the operation unit identifier sent by the parsing circuit, and determines the second operation unit corresponding to the first operation unit corresponding to the first command and the second command recently sent by the command queue based on the operation unit identifier.
  • send a second pause instruction to the command line buffer; the command line buffer receives the judgment circuit When the second pause command is sent, transmission of the arbitration request signal to the arbitration circuit is paused.
  • the distribution circuit further includes a command counter; the command counter is connected to the judgment circuit.
  • the command distribution method further includes: after the judging circuit receives the operation unit identifier sent by the parsing circuit, reading a second count value from the command counter, and when the second count value is greater than In the case of a preset value, it is determined that the second command has not been processed by the second operation unit.
  • the command counter is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
  • the command distribution method further includes: when the judgment circuit determines that the second command has not been processed by the second arithmetic unit, monitoring the first command in the command counter. Whether the second count value has changed to the second preset value; and in the case of monitoring that the second count value of the command counter has changed to the second preset value, send a second start command to the command line buffer; After receiving the second start command, the command line buffer sends the arbitration request signal to the arbitration circuit.
  • the command counter is connected to the parsing circuit.
  • the command distribution method further includes: when the current command line is the first command line, the parsing circuit detects that the command line buffer sends the current command line to the first computing unit after monitoring that the current command line is sent to the first computing unit. , sending a second counting instruction to the command counter; after receiving the second counting instruction, the command counter increases the second counting value by a second value.
  • the information buffer is connected to command counters corresponding to the plurality of command queues respectively.
  • the command distribution method further includes: after the first information buffer receives the confirmation information fed back after the first operation unit has processed the first command, based on the command line queue identifier and the Confirm the information, and send a third count instruction to the command counter corresponding to the command queue identifier; after the command counter receives the third count instruction sent by the first information buffer, the second count value is reduced by the third count. binary value.
  • the command distribution method further includes: after the first information buffer receives the confirmation information fed back after the first operation unit has processed the first command, updating all the number of commands.
  • Embodiments of the present disclosure provide a specific example of a command distribution process, including:
  • Step 1 The parsing circuit 101 reads the current command line in the first command to be sent from the command queue, and reads the first count value from the command line counter 103 after reading the current command line.
  • Step 2 The parsing circuit 101 compares the first count value with the first preset value. If the first count value is less than the first preset value and greater than the original value, go to step 3; if the first count value is equal to the first preset value or equal to the original value, go to step 11.
  • Step 3 The parsing circuit 101 sends the current command line and the operation unit identifier corresponding to the first command to the command line buffer 102 . And send the first counting instruction to the command line counter 103 .
  • Step 4 The command line counter 103 increases the first count value by the first value according to the first count instruction.
  • Step 5 After receiving the current command line sent by the parsing circuit and the operation unit identifier corresponding to the first command, the command line buffer 102 sends an arbitration request signal to the arbitration circuit.
  • step 4 and step 5 have no order of execution.
  • Step 6 Following the above step 5, after receiving the arbitration request signal sent by each command line buffer 104, the arbitration circuit 30 performs authority arbitration on each command line buffer 102, and based on the result of the authority arbitration, sends the command to obtain the sending authority.
  • the line buffer 102 returns the permission permission signal, and jumps to step 7 or jumps to step 8 .
  • Step 7 After receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line and the operation unit identifier corresponding to the first command to the command distribution interface 40, and jumps to step 9.
  • the command line buffer 102 is connected to the command distribution interface 40 through an arbitration circuit.
  • Step 8 After receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line and the operation unit identifier corresponding to the first command to the arbitration circuit 30, and the arbitration circuit receives the current command line and the first command. After the operation unit identifier corresponding to a command is sent, the current command line and the operation unit identifier corresponding to the first command are sent to the command distribution interface 40 . In this case, the command line buffer 102 is directly connected to the command distribution interface 40 .
  • step 7 and step 8 are two mutually exclusive possible implementations.
  • Step 9 Following the above-mentioned step 7 or step 8 or step 23, the command distribution interface 40 sends the current command line and the operation corresponding to the first command to the bus interface after receiving the current command line and the operation unit identifier corresponding to the first command. Unit ID.
  • Step 10 After receiving the current command line sent by the command distribution interface 40 and the operation unit identifier corresponding to the first command, the bus interface sends the current command line to the first operation unit corresponding to the first command based on the operation unit identifier, and jumps. Go to step 27.
  • Step 11 Following the above step 2, the parsing circuit 101 sends a reset instruction to the command line counter 103, and updates the first preset value based on the number of lines of the command line of the first command; based on the arithmetic unit identifier carried in the current command line, The number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the identifier of the operation unit, and the identifier of the operation unit is sent to the judgment circuit 104 .
  • Step 12 After receiving the reset instruction sent by the parsing circuit 101, the command line counter 103 resets the first count value to the original value and then increases the first value.
  • Step 13 the parsing circuit 101 determines whether the number of commands is less than the threshold of the number of commands; if so, go to step 15 ; if not, go to step 14 .
  • step 12 and step 13 have no order of execution.
  • Step 14 The parsing circuit 101 sends the current command line, the operation unit identifier and the first pause instruction to the command line buffer 102; the command line buffer 102 receives the current command line, the operation unit identifier and the first pause sent by the parsing circuit 101 After the instruction, suspend sending an arbitration request signal to the arbitration circuit; and the parsing circuit 101 monitors in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands; Then, send the first startup instruction to the command line buffer 102 ; after the command line buffer 102 receives the first startup instruction, it jumps to step 16 .
  • Step 15 Following Step 13, the parsing circuit 101 sends the current command line and the arithmetic unit identifier to the command line buffer 102; the command line buffer 102 sends the current command line and arithmetic unit identifier sent by the parsing circuit 101 to the arbitration circuit Send an arbitration request signal.
  • Step 16 After the judgment circuit 104 receives the operation unit identifier sent by the analysis circuit 101, it reads the second count value of the command counter 105, and compares the second count value with the second preset value. In the case of two preset values, go to step 17, and in the case that the second count value is not equal to the second preset value, go to step 24.
  • Step 17 After receiving the current command line sent by the parsing circuit 101 and the operation unit identifier corresponding to the first command, the command line buffer 102 sends an arbitration request signal to the arbitration circuit.
  • Step 18 After receiving the arbitration request signal sent by each command line buffer 104, the arbitration circuit 30 performs authority arbitration on each command line buffer 102, and returns to the command line buffer 102 that has obtained the sending authority based on the result of the authority arbitration Permission permission signal, go to step 19 or go to step 20.
  • Step 19 After receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line and the operation unit identifier corresponding to the first command to the command distribution interface 40, and sends the current command to the first information buffer.
  • Step 20 Following Step 18, after receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line, the operation unit identifier corresponding to the first command, and the command queue where the current command line is located to the arbitration circuit 30. After receiving the current command line, the arithmetic unit identification corresponding to the first command, and the command queue identification of the command queue where the current command line is located, the arbitration circuit 30 sends the current command line and the first command corresponding to the command distribution interface 40. and send the command queue identifier of the command queue where the current command line is located to the first information buffer corresponding to the operation unit identifier.
  • step 19 and step 20 are two mutually exclusive possible implementations.
  • Step 21 Following Step 19 or Step 20, after sending the current command line, the command line buffer 102 feeds back to the parsing circuit 101 feedback information that the current command line has been sent.
  • Step 22 After receiving the feedback information that the current command line has been sent from the command line buffer 102, the parsing circuit 101 sends a second counting instruction to the command counter 105.
  • Step 23 after the command counter 105 receives the second count instruction sent by the parsing circuit 101 , it increases the second count value by a second value, and jumps to step 9 .
  • Step 24 Following step 16, the judgment circuit 104 judges, based on the operation unit identifier, whether the first operation unit corresponding to the first command and the second operation unit corresponding to the second command recently sent by the command queue are consistent, yes, jump to step 24 17, no, go to step 25.
  • Step 25 The judgment circuit 104 sends the second pause command to the command line register 102, and monitors the second count value of the command counter 105 in real time. Start command.
  • Step 26 After receiving the second pause command sent by the judgment circuit 104, the command line buffer 102 stops sending the arbitration request signal to the arbitration circuit 30, and sends the arbitration request signal to the arbitration circuit after receiving the second start command sent by the judgment circuit 104. request signal, go to step 18.
  • Step 27 Following step 10, the first operation unit feeds back the processed confirmation information to the first information buffer after receiving and processing the first command currently to be sent.
  • Step 28 After receiving the confirmation information fed back by the first arithmetic unit, the first information buffer sends a third counting instruction to the corresponding command counter 105 based on the command queue identifier where the processed command is located, and decrements the number of commands by 1 .
  • Step 29 After receiving the third counting instruction, the command counter 105 reduces the second counting value by the second value.
  • An embodiment of the present disclosure further provides a chip, including the command distribution apparatus according to any embodiment of the present disclosure.
  • An embodiment of the present disclosure further provides a computer device, including the chip provided by any embodiment of the present disclosure.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the steps of the command distribution method described in the foregoing method embodiments are executed.
  • the storage medium may be a volatile or non-volatile computer-readable storage medium.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a processor-executable non-volatile computer-readable storage medium.
  • the computer software products are stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computer And Data Communications (AREA)
  • Remote Monitoring And Control Of Power-Distribution Networks (AREA)

Abstract

The present invention provides a command distribution apparatus and method, a chip, a computer device, and a storage medium. The apparatus comprises: at least one information buffer, each information buffer therein being used for storing the number of commands which are not processed at present in a corresponding operation unit and a command number threshold value corresponding to the operation unit; and at least one distribution circuit, each distribution circuit therein being used for reading, from a command queue corresponding to the distribution circuit, the first command line of the current first command to be sent, then reading, on the basis of an operation unit identifier carried in said first command, the number of commands and the command number threshold value from a first information buffer corresponding to the operation unit identifier, and sending an arbitration request signal to an arbitration circuit in response to the number of commands satisfying a preset condition.

Description

用于命令分发的装置、方法、芯片、计算机设备及介质Apparatus, method, chip, computer device and medium for command distribution 技术领域technical field
本公开涉及计算机技术领域,具体而言,涉及用于命令分发的装置、方法、芯片、计算机设备及存储介质。The present disclosure relates to the field of computer technology, and in particular, to an apparatus, method, chip, computer device, and storage medium for command distribution.
背景技术Background technique
随着人工智能的广泛使用,深度学习的模型大小急剧增加,模型结构也越来越复杂。这使得需要分发给运算单元的命令的数量急剧增长,对命令分发单元的分发效率也提出了更高的要求。With the widespread use of artificial intelligence, the model size of deep learning has increased dramatically, and the model structure has become more and more complex. This causes a sharp increase in the number of commands that need to be distributed to the computing unit, and also puts forward higher requirements on the distribution efficiency of the command distribution unit.
发明内容SUMMARY OF THE INVENTION
本公开实施例至少提供一种命令分发装置、方法、芯片、计算机设备及存储介质。Embodiments of the present disclosure provide at least a command distribution apparatus, method, chip, computer device, and storage medium.
第一方面,本公开实施例提供了一种命令分发装置,包括至少一个分发电路、以及至少一个信息缓存器;其中,每一所述分发电路与所述至少一个信息缓存器连接。所述至少一个信息缓存器中的各信息缓存器,用于存储对应运算单元中当前未处理完命令的数量作为命令数量、以及所述对应运算单元的命令数阈值。所述至少一个分发电路中的各分发电路,用于从与该分发电路对应的命令队列读取当前待发送的第一命令后,基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号。In a first aspect, an embodiment of the present disclosure provides a command distribution apparatus, including at least one distribution circuit and at least one information buffer; wherein each of the distribution circuits is connected to the at least one information buffer. Each of the information buffers in the at least one information buffer is used to store the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit. Each distribution circuit in the at least one distribution circuit is used to read the first command currently to be sent from the command queue corresponding to the distribution circuit, based on the arithmetic unit identifier carried in the first command, from the The number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the identification of the arithmetic unit; in response to the number of commands meeting a preset condition, an arbitration request signal is sent to the arbitration circuit.
这样,命令分发装置中的各分发电路会在命令数量满足预设条件的情况下,才向仲裁电路发送仲裁请求信号,因此,能够避免在某些运算单元发生命令堆积而其他运算单元无可执行命令的情况,提升命令的执行效率,增加运算单元的计算资源利用率。In this way, each distribution circuit in the command distribution device will send an arbitration request signal to the arbitration circuit only when the number of commands satisfies the preset condition. Therefore, it is possible to avoid command accumulation in some operation units and no executable in other operation units. In the case of a command, the execution efficiency of the command is improved, and the computing resource utilization of the computing unit is increased.
此外,各分发电路在命令数量不满足预设条件情况下,不会参与到权限仲裁过程,也就不会占用总线;而获得分发权限的分发电路同样也不会长时间占用总线,提高命令分发的效率。且通过硬件实现命令分发,可以有效减少计算资源开销。In addition, when the number of commands does not meet the preset conditions, each distribution circuit will not participate in the authority arbitration process, and will not occupy the bus; and the distribution circuit that has obtained the distribution authority will also not occupy the bus for a long time, which improves command distribution. s efficiency. Moreover, the command distribution is realized through hardware, which can effectively reduce the computing resource overhead.
在一种可能的实施方式中,所述预设条件包括:所述命令数量小于所述命令数阈值。In a possible implementation manner, the preset condition includes: the number of commands is less than the threshold of the number of commands.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路,还用于在所述命令数量等于所述命令数阈值的情况下,实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;在监测到所述命令数量变化为小于所述命令数阈值后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, each distribution circuit in the at least one distribution circuit is further configured to monitor in real time the number of commands in the first information buffer when the number of commands is equal to the threshold of the number of commands Whether the number of commands has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the arbitration request signal is sent to the arbitration circuit.
这样,能够确保分发电路能在对应的运算单元能接收命令的情况下,重新参与仲裁电路的仲裁,提高命令分发的效率。In this way, it can be ensured that the distribution circuit can re-participate in the arbitration of the arbitration circuit when the corresponding arithmetic unit can receive the command, thereby improving the efficiency of command distribution.
在一种可能的实施方式中,所述对应运算单元的命令数阈值,是基于所述对应运算单元中当前未处理完命令所占据的数据存储空间大小、以及所述对应运算单元的数据存储总空间大小确定的。In a possible implementation manner, the command number threshold of the corresponding operation unit is based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the total data storage volume of the corresponding operation unit The size of the space is determined.
这样,即使每个命令的命令行行数不同,可以根据每一运算单元接收到的未处理完的命令占据的数据存储空间大小、以及该运算单元的数据存储总空间的大小动态配置该运算单元的命令数阈值,减小命令在某个运算单元拥塞的概率,同时,提升运算单元的处理效率。In this way, even if the number of command line lines of each command is different, the operation unit can be dynamically configured according to the size of the data storage space occupied by the unprocessed commands received by each operation unit and the size of the total data storage space of the operation unit The threshold of the number of commands can reduce the probability of command congestion in a certain computing unit, and at the same time, improve the processing efficiency of the computing unit.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路,还用于在接收 到所述仲裁电路基于所述仲裁请求信号返回的权限许可信号后,向与所述运算单元标识对应的第一运算单元发送所述第一命令。In a possible implementation manner, each distribution circuit in the at least one distribution circuit is further configured to, after receiving the permission permission signal returned by the arbitration circuit based on the arbitration request signal, send a message to the arithmetic unit with the The first operation unit corresponding to the identifier sends the first command.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路,在从与该分发电路对应的命令队列读取当前待发送的第一命令时,用于:从与该分发电路对应的命令队列读取第一命令的当前命令行。该分发电路,在基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值时,用于:在所述当前命令行为所述第一命令的首行命令行的情况下,基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值。In a possible implementation manner, each distribution circuit in the at least one distribution circuit, when reading the first command to be sent currently from the command queue corresponding to the distribution circuit, is used to: The corresponding command queue reads the current command line of the first command. The distribution circuit, when reading the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the operation unit based on the identifier of the operation unit carried in the first command, is used to: When the current command line is the first command line of the first command, based on the operation unit identifier carried in the first command, the first information buffer corresponding to the operation unit identifier is read from the first information buffer. The number of commands and the command number threshold.
这样,各分发电路在读取到一个新命令后,可以判断该新命令对应的运算单元已经接收到、且还未处理完毕的命令的数量是否达到命令数阈值。In this way, after reading a new command, each distribution circuit can determine whether the number of commands that have been received by the arithmetic unit corresponding to the new command and have not been processed yet reaches the command number threshold.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路,还用于:在所述当前命令行为所述第一命令的非首行命令行的情况下,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, each distribution circuit in the at least one distribution circuit is further configured to: in the case that the current command line is a non-first line command line of the first command, to the arbitration A circuit sends the arbitration request signal.
这样,当解析电路读取的当前命令行为第一命令的非首行命令行的情况下,可以直接向仲裁电路发送仲裁请求信号,参与仲裁电路的仲裁,提高分发效率。In this way, when the current command line read by the parsing circuit is a non-first line command line of the first command, an arbitration request signal can be directly sent to the arbitration circuit to participate in the arbitration of the arbitration circuit, thereby improving the distribution efficiency.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路,还用于:判断所述当前命令行是否为首行命令行。In a possible implementation manner, each distribution circuit in the at least one distribution circuit is further configured to: determine whether the current command line is the first line of the command line.
在一种可能的实施方式中,所述分发电路,在响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号时,用于:确定所述第一命令中的首行命令行是否为就绪状态;若是,则向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit, when sending an arbitration request signal to the arbitration circuit in response to the number of commands satisfying a preset condition, is configured to: determine the first command line in the first command Whether it is in a ready state; if so, send the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述第一命令中的首行命令行为就绪状态包括:所述第一命令对应的第一运算单元、与所述命令队列最近已发送的第二命令对应的第二运算单元相同;或者,所述第一运算单元、与所述第二运算单元不相同,但所述第二命令被所述第二运算单元处理完毕。In a possible implementation manner, the first line of the first command being in a ready state includes: a first operation unit corresponding to the first command, a first operation unit corresponding to the second command recently sent by the command queue The second operation unit is the same; or, the first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
这样,可保证同一个命令队列中的多个命令即使在不同的运算单元进行处理时,可以按照多个命令在该命令队列中的存储顺序对每一命令进行顺序处理,保证同一个命令队列中的多个命令被按照顺序处理。In this way, it can be ensured that even when multiple commands in the same command queue are processed by different computing units, each command can be processed sequentially according to the order in which the multiple commands are stored in the command queue, ensuring that the same command queue is stored in the same command queue. The multiple commands are processed sequentially.
在一种可能的实施方式中,所述分发电路包括解析电路、以及命令行缓存器;所述解析电路分别和所述命令行缓存器、以及所述信息缓存器连接。所述解析电路,用于从所述命令队列中读取所述第一命令的当前命令行,并确定所述当前命令行是否为首行命令行;在所述当前命令行为首行命令行的情况下,基于所述首行命令行中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;在所述命令数量小于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行。所述命令行缓存器,用于在接收所述解析电路发送的所述首行命令行后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit includes a parsing circuit and a command line buffer; the parsing circuit is respectively connected to the command line buffer and the information buffer. The parsing circuit is used to read the current command line of the first command from the command queue, and determine whether the current command line is the first command line; in the case that the current command line is the first command line Next, based on the operation unit identifier carried in the first line of the command line, read the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the operation unit; In the case of the above-mentioned threshold of the number of commands, the first line of the command line is sent to the command line buffer. The command line buffer is configured to send the arbitration request signal to the arbitration circuit after receiving the first line of the command line sent by the parsing circuit.
在一种可能的实施方式中,所述解析电路,还用于在所述命令数量等于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行、以及第一暂停指令;所述命令行缓存器,还用于在接收所述解析电路发送的所述首行命令行以及所述第一暂停指令后,暂停向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the parsing circuit is further configured to send the first command line and the first command line to the command line buffer when the number of commands is equal to the command number threshold A pause instruction; the command line buffer is further configured to pause sending the arbitration request signal to the arbitration circuit after receiving the first line of the command line and the first pause instruction sent by the parsing circuit.
在一种可能的实施方式中,所述解析电路,还用于实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;在监测到所述命令数量变化为小于所述命令数阈值后,向所述命令行缓存器发送第一启动指令。所述命令行缓存器,还用于在接收到所述第一启动指令后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the parsing circuit is further configured to monitor in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands; after monitoring the change in the number of commands After the number of commands is less than the threshold of the number of commands, a first start command is sent to the command line buffer. The command line buffer is further configured to send the arbitration request signal to the arbitration circuit after receiving the first start instruction.
在一种可能的实施方式中,所述分发电路还包括命令行计数器;所述命令行计数器与所述解析电路连接。所述解析电路,在确定所述当前命令行是否为首行命令行时,用 于从所述命令队列中读取所述当前命令行后,从所述命令行计数器读取第一计数数值;在所述第一计数数值等于第一预设数值、或等于原始数值的情况下,确定所述当前命令行为所述第一命令中的首行命令行。其中,所述第一预设数值,是基于所述第一命令的命令行行数确定的。In a possible implementation manner, the distribution circuit further includes a command line counter; the command line counter is connected to the parsing circuit. The parsing circuit, when determining whether the current command line is the first command line, is configured to read the first count value from the command line counter after reading the current command line from the command queue; When the first count value is equal to the first preset value or equal to the original value, it is determined that the current command line is the first command line in the first command. The first preset value is determined based on the number of command line lines of the first command.
这样,解析电路通过读取命令行计数器的第一计数数值,并将第一计数数值与当前计数阈值做比较就可判断读取的当前命令行是否为第一命令的首行命令行,从而以较低成本的方式实现对同一队列中不同命令的识别。In this way, the parsing circuit can determine whether the read current command line is the first command line of the first command by reading the first count value of the command line counter and comparing the first count value with the current count threshold, so as to use A low-cost way to realize the identification of different commands in the same queue.
在一种可能的实施方式中,所述解析电路,还用于在确定所述当前命令行为首行命令行的情况下,基于所述第一命令的命令行行数更新第一预设数值并向所述命令行计数器发送重置指令;所述命令行计数器,还用于接收到所述解析电路发送的重置指令后,将所述第一计数数值重置为原始数值后,增加第一数值。In a possible implementation manner, the parsing circuit is further configured to update the first preset value based on the number of command lines of the first command when it is determined that the current command line is the first command line, and Send a reset instruction to the command line counter; the command line counter is further configured to reset the first count value to the original value after receiving the reset instruction sent by the parsing circuit, and increase the first count value numerical value.
这样,能保证解析电路在读取新的待发送命令时,命令行计数器重新开始对解析电路读取的新的待发送命令的命令行的行数进行计数。In this way, it can be ensured that when the parsing circuit reads a new command to be sent, the command line counter restarts to count the number of lines of the command line of the new command to be sent read by the parsing circuit.
在一种可能的实施方式中,所述分发电路还包括判断电路;所述判断电路分别与所述解析电路、所述命令行缓存器连接。所述解析电路,还用于在确定所述当前命令行为所述首行命令行,且在所述命令数量小于所述命令数阈值的情况下,从所述首行命令行中解析所述第一命令对应的运算单元标识,并向所述判断电路发送所述运算单元标识,以及向所述命令行缓存器发送所述当前命令行、以及所述运算单元标识。所述判断电路,用于接收所述解析电路发送的所述运算单元标识,并在基于所述运算单元标识判断所述第一命令对应的第一运算单元和所述命令队列的最近已发送的第二命令对应的第二运算单元不同、且所述第二命令未被所述第二运算单元处理完毕的情况下,向所述命令行缓存器发送第二暂停指令。所述命令行缓存器,还用于在接收到所述判断电路发送的所述第二暂停指令的情况下,暂停向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit further includes a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer. The parsing circuit is further configured to parse the first command line from the first command line when it is determined that the current command line is the first line command line and the number of commands is less than the command number threshold. An operation unit identifier corresponding to a command is sent to the judgment circuit, and the current command line and the operation unit identifier are sent to the command line buffer. The judging circuit is configured to receive the operation unit identifier sent by the parsing circuit, and based on the operation unit identifier, determine the first operation unit corresponding to the first command and the most recently sent data of the command queue. When the second operation units corresponding to the second command are different and the second command has not been processed by the second operation unit, a second pause instruction is sent to the command line buffer. The command line buffer is further configured to suspend sending the arbitration request signal to the arbitration circuit in the case of receiving the second suspend instruction sent by the judgment circuit.
这样,同一个命令队列中的两个相邻的命令发往不同的运算单元时,不会因为运算单元的处理效率影响该相邻的两个命令的处理顺序。例如,在最近发送的命令没有处理完毕的情况下,命令行缓存器不参与仲裁电路的仲裁,保证当前的命令不下发,从而保证同一命令队列中的多个命令的处理顺序。In this way, when two adjacent commands in the same command queue are sent to different operation units, the processing order of the two adjacent commands will not be affected due to the processing efficiency of the operation units. For example, when the recently sent command is not processed, the command line buffer does not participate in the arbitration of the arbitration circuit to ensure that the current command is not issued, thereby ensuring the processing order of multiple commands in the same command queue.
在一种可能的实施方式中,所述分发电路还包括命令计数器;所述命令计数器与所述判断电路连接。所述判断电路,还用于在接收到所述解析电路发送的所述运算单元标识后,从所述命令计数器中读取第二计数数值,并在所述第二计数数值大于第二预设数值的情况下,确定所述第二命令未被所述第二运算单元处理完毕。其中,所述命令计数器,用于对与所述命令队列对应的当前已发送但未被处理完毕的命令进行计数。In a possible implementation manner, the distribution circuit further includes a command counter; the command counter is connected to the judgment circuit. The judging circuit is further configured to read a second count value from the command counter after receiving the operation unit identifier sent by the parsing circuit, and when the second count value is greater than a second preset In the case of a numerical value, it is determined that the second command has not been processed by the second operation unit. Wherein, the command counter is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
这样,判断电路将从命令计数器读取的第二计数数值与第二预设数值进行比较,便可以知道与该判断电路对应的命令队列中最近已发送的第二命令有没有被处理完毕。In this way, the judgment circuit compares the second count value read from the command counter with the second preset value, so as to know whether the recently sent second command in the command queue corresponding to the judgment circuit has been processed.
在一种可能的实施方式中,所述判断电路,还用于在确定所述第二命令未被所述第二运算单元处理完毕的情况下,监测所述命令计数器中的第二计数数值是否变化为第二预设数值;并在监测到所述命令计数器的第二计数数值变化为第二预设数值的情况下,向所述命令行缓存器发送第二启动指令。所述命令行缓存器,还用于在接收到所述第二启动指令后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the judging circuit is further configured to monitor whether the second count value in the command counter is in the case of determining that the second command has not been processed by the second arithmetic unit. change to the second preset value; and send a second start instruction to the command line buffer when monitoring that the second count value of the command counter changes to the second preset value. The command line buffer is further configured to send the arbitration request signal to the arbitration circuit after receiving the second start instruction.
这样,信息缓存器可以在对应的运算单元将某一命令队列中已发送的命令处理完毕之后,向该命令队列对应的命令计数器发送第三计数指令,命令计数器接收到第三计数指令后,将第二计数数值减少第二数值,以表征该命令队列已发送的一个命令被处理完毕。In this way, the information buffer can send the third counting instruction to the command counter corresponding to the command queue after the corresponding operation unit has processed the command that has been sent in a certain command queue, and after the command counter receives the third counting instruction, it will The second count value is decreased by a second value to indicate that a command sent by the command queue has been processed.
在一种可能的实施方式中,所述命令计数器与所述解析电路连接。所述解析电路,还用于在所述当前命令行为首行命令行的情况下,在监测到所述命令行缓存器将所述当前命令行向所述第一运算单元发送后,向所述命令计数器发送第二计数指令;所述命令 计数器,用于在接收到所述第二计数指令后,将所述第二计数数值增加第二数值。In a possible implementation, the command counter is connected to the parsing circuit. The parsing circuit is further configured to send the current command line to the first operation unit after monitoring that the command line buffer sends the current command line to the first operation unit when the current command line is the first command line. The command counter sends a second counting instruction; the command counter is used to increase the second counting value by a second value after receiving the second counting instruction.
这样,命令计数器可以记录对应的命令队列已经发送的命令的数量。In this way, the command counter can record the number of commands that have been sent by the corresponding command queue.
在一种可能的实施方式中,所述信息缓存器与多个命令队列分别对应的命令计数器连接。所述第一信息缓存器,还用于在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,基于所述命令行队列标识、以及所述确认信息,向所述命令队列标识对应的命令计数器发送第三计数指令。所述命令计数器,用于在接收到所述第一信息缓存器发送的第三计数指令后,将所述第二计数数值减少第二数值。In a possible implementation manner, the information buffer is connected to command counters corresponding to the plurality of command queues respectively. The first information buffer is further configured to, after receiving the confirmation information fed back after the first operation unit has processed the first command, based on the command line queue identifier and the confirmation information, send The command counter corresponding to the command queue identifier sends a third counting instruction. The command counter is used to decrease the second count value by a second value after receiving the third count instruction sent by the first information buffer.
这样,判断电路可以在对应的命令队列中最近已发送的命令被处理完毕后,实时通知命令行缓存器参加仲裁电路的仲裁,发送当前待发送命令的首个命令行。In this way, the judgment circuit can notify the command line buffer to participate in the arbitration of the arbitration circuit in real time after the recently sent command in the corresponding command queue is processed, and send the first command line of the current command to be sent.
在一种可能的实施方式中,所述第一信息缓存器,还用于在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,更新所述命令数量。In a possible implementation manner, the first information buffer is further configured to update the number of commands after receiving confirmation information fed back after the first operation unit has processed the first command.
这样,能够确保分发电路能在当前待发送的第一命令对应的第一运算单元能接收第一命令的情况下,重新参与仲裁电路的仲裁,获得向第一运算单元发送第一命令的机会,提高命令分发的效率。In this way, it can be ensured that the distribution circuit can re-participate in the arbitration of the arbitration circuit under the condition that the first operation unit corresponding to the first command to be sent can receive the first command, and obtain the opportunity to send the first command to the first operation unit, Improve the efficiency of command distribution.
第二方面,本公开实施例还提供一种命令分发方法,应用于命令分发装置,所述命令分发装置包括至少一个分发电路、以及至少一个信息缓存器。其中,每一所述分发电路与所述至少一个信息缓存器连接。所述命令分发方法包括:所述至少一个信息缓存器中的各信息缓存器存储对应运算单元中当前未处理完命令的数量作为命令数量、以及所述对应运算单元的命令数阈值;所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取当前待发送的第一命令后,基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值,响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号。In a second aspect, an embodiment of the present disclosure further provides a command distribution method, which is applied to a command distribution apparatus, where the command distribution apparatus includes at least one distribution circuit and at least one information buffer. Wherein, each of the distribution circuits is connected to the at least one information buffer. The command distribution method includes: each information buffer in the at least one information buffer stores the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit; the at least After each distribution circuit in a distribution circuit reads the first command currently to be sent from the command queue corresponding to the distribution circuit, based on the operation unit identifier carried in the first command, the first command corresponding to the operation unit identifier is retrieved from the first command. The number of commands and the threshold of the number of commands are read from an information buffer, and an arbitration request signal is sent to the arbitration circuit in response to the number of commands meeting a preset condition.
在一种可能的实施方式中,所述预设条件包括:所述命令数量小于所述命令数阈值。In a possible implementation manner, the preset condition includes: the number of commands is less than the threshold of the number of commands.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路在所述命令数量等于所述命令数阈值的情况下,实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;在监测到所述命令数量变化为小于所述命令数阈值后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: when each distribution circuit in the at least one distribution circuit is equal to the command number threshold, monitoring the first command in real time Whether the number of commands in the information buffer has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the arbitration request signal is sent to the arbitration circuit.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个信息缓存器中的各信息缓存器获取动态配置的所述对应运算单元的命令数阈值。其中,所述对应运算单元的命令数阈值,是基于所述对应运算单元中当前未处理完命令所占据的数据存储空间大小、以及所述对应运算单元的数据存储总空间大小确定的。In a possible implementation manner, the command distribution method further includes: each information buffer in the at least one information buffer acquires a dynamically configured command number threshold of the corresponding operation unit. The command number threshold of the corresponding operation unit is determined based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the size of the total data storage space of the corresponding operation unit.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路在接收到所述仲裁电路基于所述仲裁请求信号返回的权限许可信号后,向与所述运算单元标识对应的第一运算单元发送所述第一命令。In a possible implementation manner, the command distribution method further includes: after each distribution circuit in the at least one distribution circuit receives a permission permission signal returned by the arbitration circuit based on the arbitration request signal, send the The first operation unit corresponding to the operation unit identifier sends the first command.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取当前待发送的第一命令,包括:所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取所述第一命令的当前命令行。该分发电路在基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值,包括:在所述当前命令行为所述第一命令的首行命令行的情况下,基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值。In a possible implementation manner, each distribution circuit in the at least one distribution circuit reads the first command currently to be sent from a command queue corresponding to the distribution circuit, including: each of the at least one distribution circuit The distribution circuit reads the current command line of the first command from the command queue corresponding to the distribution circuit. The distribution circuit reads the command number and the command number threshold from the first information buffer corresponding to the operation unit identifier based on the operation unit identifier carried in the first command, including: in the current When the command line is the first line of the command line of the first command, based on the operation unit identifier carried in the first command, read the number of commands and the number of commands from the first information buffer corresponding to the operation unit identifier. The command number threshold.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路,在所述当前命令行为所述第一命令的非首行命令行的情况下,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: in each distribution circuit in the at least one distribution circuit, when the current command line is a non-first line command line of the first command , sending the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路判断所述当前命令行是否为首行命令行。In a possible implementation manner, the command distribution method further includes: each distribution circuit in the at least one distribution circuit determines whether the current command line is the first line of the command line.
在一种可能的实施方式中,所述分发电路响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号,包括:确定所述第一命令中的首行命令行是否为就绪状态;若是,则向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, in response to the number of commands meeting a preset condition, the distribution circuit sends an arbitration request signal to the arbitration circuit, including: determining whether the first command line in the first command is in a ready state ; if yes, send the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述第一命令中的首行命令行为就绪状态包括:所述第一命令对应的第一运算单元、与所述命令队列的最近已发送的第二命令对应的第二运算单元相同;或者,所述第一运算单元、与所述第二运算单元不相同,但所述第二命令被所述第二运算单元处理完毕。In a possible implementation manner, the first line of the first command being in a ready state includes: a first operation unit corresponding to the first command, a second command corresponding to the most recently sent second command in the command queue The second operation unit is the same; or, the first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
在一种可能的实施方式中,所述分发电路包括解析电路、以及命令行缓存器;所述解析电路分别和所述命令行缓存器、以及所述信息缓存器连接。所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取第一命令的首行命令行后,基于所述首行命令行中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;在所述命令数量小于所述命令数阈值的情况下,向仲裁电路发送仲裁请求信号,包括:所述解析电路从所述命令队列中读取所述第一命令的当前命令行,并确定所述当前命令行是否为首行命令行;在所述当前命令行为首行命令行的情况下,基于所述首行命令行中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;在所述命令数量小于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行。所述命令行缓存器在接收所述解析电路发送的所述首行命令行后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit includes a parsing circuit and a command line buffer; the parsing circuit is respectively connected to the command line buffer and the information buffer. After each distribution circuit in the at least one distribution circuit reads the first command line of the first command from the command queue corresponding to the distribution circuit, based on the operation unit identifier carried in the first line command line, from the operation The number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the unit identifier; when the number of commands is less than the threshold of the number of commands, an arbitration request signal is sent to the arbitration circuit, including: the The parsing circuit reads the current command line of the first command from the command queue, and determines whether the current command line is the first command line; in the case that the current command line is the first command line, based on the The arithmetic unit identifier carried in the first line of the command line, reads the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arithmetic unit; when the number of commands is less than the threshold of the number of commands In this case, the first line of the command line is sent to the command line buffer. The command line buffer sends the arbitration request signal to the arbitration circuit after receiving the first line of the command line sent by the parsing circuit.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路在所述命令数量等于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行、以及第一暂停指令;所述命令行缓存器在接收所述解析电路发送的所述首行命令行以及所述第一暂停指令后,暂停向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: when the number of commands is equal to the threshold of the number of commands, the parsing circuit sends the first line of the command line to the command line buffer , and a first pause command; after receiving the first command line and the first pause command sent by the parsing circuit, the command line buffer pauses sending the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;在监测到所述命令数量变化为小于所述命令数阈值后,向所述命令行缓存器发送第一启动指令;所述命令行缓存器在接收到所述第一启动指令后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: the parsing circuit monitors in real time whether the number of commands in the first information buffer changes to be less than the command number threshold; After the number of commands is changed to be less than the threshold of the number of commands, a first activation instruction is sent to the command line buffer; after receiving the first activation instruction, the command line buffer sends the first activation instruction to the arbitration circuit. the arbitration request signal.
在一种可能的实施方式中,所述分发电路还包括命令行计数器;所述命令行计数器与所述解析电路连接。所述解析电路确定所述当前命令行是否为首行命令行,包括:所述解析电路从所述命令队列中读取所述当前命令行后,从所述命令行计数器读取第一计数数值;在所述第一计数数值等于第一预设数值、或等于原始数值的情况下,确定所述当前命令行为所述第一命令中的首行命令行。其中,所述第一预设数值,是基于所述第一命令的命令行行数确定的。In a possible implementation manner, the distribution circuit further includes a command line counter; the command line counter is connected to the parsing circuit. The parsing circuit determining whether the current command line is the first command line includes: after the parsing circuit reads the current command line from the command queue, reading a first count value from the command line counter; In the case that the first count value is equal to the first preset value or equal to the original value, it is determined that the current command line is the first command line in the first command. The first preset value is determined based on the number of command line lines of the first command.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路在确定所述当前命令行为首行命令行的情况下,基于所述第一命令的命令行行数更新第一预设数值并向所述命令行计数器发送重置指令;所述命令行计数器接收到所述解析电路发送的重置指令后,将所述第一计数数值重置为原始数值后,增加第一数值。In a possible implementation manner, the command distribution method further includes: when the parsing circuit determines that the current command line is the first command line, updating the first command line based on the number of command lines of the first command Presetting a value and sending a reset instruction to the command line counter; after receiving the reset instruction sent by the parsing circuit, the command line counter resets the first count value to the original value, and increases the first count value numerical value.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路在确定所述当前命令行为所述第一命令的非首行命令行后,向所述命令行计数器发送第一计数指令;所述命令行计数器接收到所述解析电路发送的第一计数指令后,将所述第一计数数值增加第一数值。In a possible implementation manner, the command distribution method further includes: after the parsing circuit determines that the current command line is a non-first line command line of the first command, sending a first command line to the command line counter A counting instruction; after the command line counter receives the first counting instruction sent by the parsing circuit, the first counting value is increased by a first value.
在一种可能的实施方式中,所述分发电路还包括判断电路;所述判断电路分别与所述解析电路、所述命令行缓存器连接。所述命令分发方法还包括:所述解析电路在确定所述当前命令行为所述首行命令行,且在所述命令数量小于所述命令数阈值的情况下,从所述首行命令行中解析所述第一命令对应的运算单元标识,并向所述判断电路发送所述运算单元标识,以及向所述命令行缓存器发送所述当前命令行、以及所述运算单元标识;所述判断电路接收所述解析电路发送的所述运算单元标识,并在基于所述运算单元 标识判断所述第一命令对应的第一运算单元和所述命令队列的最近已发送的第二命令对应的第二运算单元不同、且所述第二命令未被所述第二运算单元处理完毕的情况下,向所述命令行缓存器发送第二暂停指令;所述命令行缓存器在接收到所述判断电路发送的所述第二暂停指令的情况下,暂停向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit further includes a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer. The command distribution method further includes: when the parsing circuit determines that the current command line is the first line of the command line, and when the number of commands is less than the command number threshold, extracting the command from the first line of the command line. Parse the operation unit identifier corresponding to the first command, send the operation unit identifier to the judgment circuit, and send the current command line and the operation unit identifier to the command line buffer; the judgment The circuit receives the operation unit identifier sent by the parsing circuit, and determines, based on the operation unit identifier, the first operation unit corresponding to the first command and the second command corresponding to the most recently sent second command of the command queue. When the two operation units are different and the second command has not been processed by the second operation unit, a second pause instruction is sent to the command line buffer; the command line buffer receives the judgment In the case of the second pause command sent by the circuit, transmission of the arbitration request signal to the arbitration circuit is paused.
在一种可能的实施方式中,所述分发电路还包括命令计数器;所述命令计数器与所述判断电路连接。所述命令分发方法还包括:所述判断电路在接收到所述解析电路发送的所述运算单元标识后,从所述命令计数器中读取第二计数数值,并在所述第二计数数值大于第二预设数值的情况下,确定所述第二命令未被所述第二运算单元处理完毕。其中,所述命令计数器,用于对与所述命令队列对应的当前已发送但未被处理完毕的命令进行计数。In a possible implementation manner, the distribution circuit further includes a command counter; the command counter is connected to the judgment circuit. The command distribution method further includes: after the judging circuit receives the operation unit identifier sent by the parsing circuit, reading a second count value from the command counter, and when the second count value is greater than In the case of the second preset value, it is determined that the second command has not been processed by the second operation unit. Wherein, the command counter is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
在一种可能的实施方式中,所述命令分发方法还包括:所述判断电路在确定所述第二命令未被所述第二运算单元处理完毕的情况下,监测所述命令计数器中的第二计数数值是否变化为第二预设数值;并在监测到所述命令计数器的第二计数数值变化为第二预设数值的情况下,向所述命令行缓存器发送第二启动指令;所述命令行缓存器在接收到所述第二启动指令后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: when the judgment circuit determines that the second command has not been processed by the second arithmetic unit, monitoring the first command in the command counter. Whether the second count value has changed to the second preset value; and in the case of monitoring that the second count value of the command counter has changed to the second preset value, send a second start command to the command line buffer; After receiving the second start command, the command line buffer sends the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述命令计数器与所述解析电路连接。所述命令分发方法还包括:所述解析电路在所述当前命令行为首行命令行的情况下,在监测到所述命令行缓存器将所述当前命令行向所述第一运算单元发送后,向所述命令计数器发送第二计数指令;所述命令计数器在接收到所述第二计数指令后,将所述第二计数数值增加第二数值。In a possible implementation, the command counter is connected to the parsing circuit. The command distribution method further includes: when the current command line is the first command line, the parsing circuit detects that the command line buffer sends the current command line to the first computing unit after monitoring that the current command line is sent to the first computing unit. , sending a second counting instruction to the command counter; after receiving the second counting instruction, the command counter increases the second counting value by a second value.
在一种可能的实施方式中,所述信息缓存器与多个命令队列分别对应的命令计数器连接;所述命令分发方法还包括:所述第一信息缓存器在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,基于所述命令行队列标识、以及所述确认信息,向所述命令队列标识对应的命令计数器发送第三计数指令;所述命令计数器在接收到所述第一信息缓存器发送的第三计数指令后,将所述第二计数数值减少第二数值。In a possible implementation manner, the information buffer is connected to command counters corresponding to a plurality of command queues respectively; the command distribution method further includes: the first information buffer receives the first operation unit After the confirmation information fed back after the first command is processed, based on the command line queue identifier and the confirmation information, a third counting instruction is sent to the command counter corresponding to the command queue identifier; the command counter is in After receiving the third count instruction sent by the first information buffer, the second count value is decreased by a second value.
在一种可能的实施方式中,所述命令分发方法还包括:所述第一信息缓存器在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,更新所述命令数量。In a possible implementation manner, the command distribution method further includes: after the first information buffer receives the confirmation information fed back after the first operation unit has processed the first command, updating all the number of commands.
第三方面,本公开可选实现方式还提供一种芯片,包括如上述第一方面、或第一方面任一项所述的命令分发装置。In a third aspect, an optional implementation manner of the present disclosure further provides a chip, including the command distribution apparatus according to the first aspect or any one of the first aspect.
第四方面,本公开可选实现方式还提供一种计算机设备,包括指令存储器和如上述第三方面所述的芯片。In a fourth aspect, an optional implementation manner of the present disclosure further provides a computer device, including an instruction memory and the chip described in the third aspect above.
第五方面,本公开可选实现方式还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如上述第二方面、或第二方面任一项所述的命令分发方法的步骤。In a fifth aspect, an optional implementation manner of the present disclosure further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor when the second aspect or the second aspect is executed. The steps of the command distribution method of any one of the aspects.
关于上述命令分发方法、芯片、计算机设备、及存储介质的效果描述参见上述命令分发装置的说明,这里不再赘述。For a description of the effects of the above command distribution method, chip, computer equipment, and storage medium, please refer to the description of the above command distribution apparatus, which will not be repeated here.
为使本公开的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and easy to understand, the preferred embodiments are exemplified below, and are described in detail as follows in conjunction with the accompanying drawings.
附图说明Description of drawings
为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍。这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。应当理解,以下附图仅示出了本公开的某些实施例,因此不应被看作是对范围的限定。本领域普通技术人员在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present disclosure more clearly, the accompanying drawings required in the embodiments will be briefly introduced below. These drawings illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the technical solutions of the present disclosure. It is to be understood that the following drawings illustrate only certain embodiments of the present disclosure and are therefore not to be considered limiting of scope. Those of ordinary skill in the art can also obtain other related drawings based on these drawings without any creative effort.
图1示出了本公开实施例所提供的一种命令分发装置的示意图;FIG. 1 shows a schematic diagram of a command distribution apparatus provided by an embodiment of the present disclosure;
图2示出了本公开实施例所提供的另一种命令分发装置的示意图;FIG. 2 shows a schematic diagram of another command distribution apparatus provided by an embodiment of the present disclosure;
图3示出了本公开实施例所提供的一种分发电路的结构示意图;FIG. 3 shows a schematic structural diagram of a distribution circuit provided by an embodiment of the present disclosure;
图4示出了本公开实施例所提供的一种命令分发方法的示意图。FIG. 4 shows a schematic diagram of a command distribution method provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例中附图,对本公开实施例中的技术方案进行清楚、完整地描述。所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。通常在此处描述和示出的本公开实施例的组件可以以各种不同的配置来布置和设计。因此,以下对本公开的实施例的详细描述并非旨在限制要求保护的本公开的范围,而是仅仅表示本公开的选定实施例。基于本公开的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. The described embodiments are only some, but not all, embodiments of the present disclosure. The components of the disclosed embodiments generally described and illustrated herein may be arranged and designed in a variety of different configurations. Thus, the following detailed description of the embodiments of the present disclosure is not intended to limit the scope of the disclosure as claimed, but is merely representative of selected embodiments of the disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present disclosure.
微控制单元进行命令分发时,将命令发送给命令分发单元。命令分发单元接收到命令后,可利用部署在命令分发单元中的软件程序,将命令分发给各个运算单元。命令分发单元在向运算单元发送命令时,会占用总线。若分发给某个运算单元的命令过多,总线资源一直会被该运算单元占用。这样,可能造成命令在该运算单元发生堆积,但其他的运算单元无命令可执行,进而造成命令的执行效率较低,且运算单元的计算资源无法得到充分的利用。When the micro-control unit distributes the command, it sends the command to the command distribution unit. After the command distribution unit receives the command, it can use the software program deployed in the command distribution unit to distribute the command to each computing unit. When the command distribution unit sends commands to the operation unit, it will occupy the bus. If too many commands are distributed to an operation unit, the bus resources will always be occupied by the operation unit. In this way, commands may be piled up in the operation unit, but no commands can be executed by other operation units, resulting in lower execution efficiency of the commands, and the computing resources of the operation units cannot be fully utilized.
在另外一种情况下,若某个运算单元接收到的命令已经达到了其上限,但命令分发单元依然可以根据分发策略向其分发新的命令,此时,新的命令因无法到达该运算单元而一直占用总线资源,直至该运算单元执行了当前接收到的一个命令后,才会接收新的命令。这样,导致了命令在分发的时候出现拥塞,进而造成命令分发的效率较低。In another case, if the command received by a certain computing unit has reached its upper limit, but the command distribution unit can still distribute new commands to it according to the distribution strategy, at this time, the new command cannot reach the computing unit because However, the bus resource is occupied all the time, and a new command will not be received until the operation unit executes a command currently received. In this way, congestion occurs when commands are distributed, and thus the efficiency of command distribution is low.
此外,随着深度学习的模型大小急剧增加、以及模型结构越来越复杂,命令的数量变得越来越庞大。然而,命令分发软件对大数量的命令进行分发时需要大量的计算资源开销,分发效率低。In addition, as the model size of deep learning increases dramatically, and the model structure becomes more complex, the number of commands becomes larger and larger. However, when the command distribution software distributes a large number of commands, a large amount of computing resource overhead is required, and the distribution efficiency is low.
基于上述研究,本公开提供了一种硬件构成的命令分发装置,通过硬件电路对命令进行分发,且命令分发装置中的各分发电路会在确定当前待发送的第一命令对应的第一运算单元中已经接收到、但当前未处理完的命令的数量小于第一运算单元的命令数阈值的情况下,向仲裁电路发送仲裁请求信号,因此,能够避免命令在某些运算单元发生命令堆积、而其他运算单元无可执行命令的情况,提升命令的执行效率,增加运算单元的计算资源利用率。Based on the above research, the present disclosure provides a command distribution device composed of hardware, which distributes commands through a hardware circuit, and each distribution circuit in the command distribution device determines the first operation unit corresponding to the first command to be sent currently. In the case where the number of commands that have been received but not currently processed is less than the command number threshold of the first operation unit, an arbitration request signal is sent to the arbitration circuit, so it can be avoided that the command accumulates in some operation units, and When other computing units have no executable commands, the execution efficiency of the commands is improved, and the computing resource utilization of the computing units is increased.
此外,由于命令分发装置中的各分发电路会在确定第一命令对应的第一运算单元中当前未处理完命令的数量小于第一运算单元的命令数阈值的情况下,向仲裁电路发送仲裁请求信号,也即,在当前待发送命令对应的第一运算单元中当前未处理完命令的数量等于第一运算单元的命令数阈值的情况下,不会参与到权限仲裁过程,因此也就不会占用总线;而获得分发权限的分发电路同样也不会长时间的占用总线,提高命令分发的效率。In addition, each distribution circuit in the command distribution device will send an arbitration request to the arbitration circuit when it is determined that the number of currently unprocessed commands in the first operation unit corresponding to the first command is less than the command number threshold of the first operation unit Signal, that is, when the number of currently unprocessed commands in the first operation unit corresponding to the command to be sent is equal to the command number threshold of the first operation unit, it will not participate in the authority arbitration process, so it will not Occupies the bus; and the distribution circuit that obtains the distribution authority also does not occupy the bus for a long time, which improves the efficiency of command distribution.
另外,本公开实施例提供的命令分发装置通过硬件实现,可有效减少计算资源开销,同时提高命令分发的效率。In addition, the command distribution apparatus provided by the embodiments of the present disclosure is implemented by hardware, which can effectively reduce computing resource overhead and improve the efficiency of command distribution.
以上均是发明人在经过实践并仔细研究后得出的结果,因此,上述问题的发现过程以及下文中本公开针对上述问题所提出的解决方案,都应该是发明人在本公开过程中对本公开做出的贡献。The above are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above-mentioned problems and the solutions to the above-mentioned problems proposed by the present disclosure below should be the results of the inventors' understanding of the present disclosure in the process of the present disclosure. contribution made.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。It should be noted that like numerals and letters refer to like items in the following figures, so once an item is defined in one figure, it does not require further definition and explanation in subsequent figures.
本公开实施例所述的连接是指硬件电路之间的连接。例如通过线路将不同的电路模块(例如分发电路、仲裁电路)接通,以使得不同的电路模块可以通过线路传递电平信号(例如高电平、低电平)。不同的电平信号的组合按照约定可以表征不同的含义。例如数字1代表高电平,数字0代表低电平。两个电路模块之间可以通过设置多路电信号传递线路,在传递不同的信号时,控制不同线路传递不同的电平信号,不同电平信号的组合形成不同的二进制数。例如三个线路,在某个处理周期发送的电平信号分别为高电平、低电平、高电平,则形成的二进制数为101。不同的二进制数根据定义代表不同的含义。The connection described in the embodiments of the present disclosure refers to the connection between hardware circuits. For example, different circuit modules (eg, a distribution circuit, an arbitration circuit) are connected through a line, so that the different circuit modules can transmit level signals (eg, a high level, a low level) through the line. The combination of different level signals can represent different meanings according to the convention. For example, the number 1 represents a high level, and the number 0 represents a low level. Multiple electrical signal transmission lines can be set between the two circuit modules, when different signals are transmitted, different lines are controlled to transmit different level signals, and the combination of different level signals forms different binary numbers. For example, for three lines, the level signals sent in a certain processing cycle are high level, low level, and high level, respectively, and the binary number formed is 101. Different binary numbers represent different meanings by definition.
下面对本公开实施例所述的一些名词进行解释说明:Some terms described in the embodiments of the present disclosure are explained below:
本公开实施例所述的命令队列、命令行缓存器、信息缓存器,为具有存储功能的电子元件。The command queue, command line buffer, and information buffer described in the embodiments of the present disclosure are electronic components with a storage function.
本公开实施例所述的运算单元,为可以实现不同的运算的硬件电路,例如包括进行乘加运算的卷积运算单元、进行视屏编码解码的编解码运算单元等。每一运算单元都与总线连接;且每一运算单元对应于一个信息缓存器,每一运算单元与对应的信息缓存器连接,每一信息缓存器存储对应的运算单元没有处理完毕命令的数量作为命令数量、以及命令数阈值。每一运算单元对命令的接收能力有限,命令数阈值为运算单元可以存储的已接收到、但未处理完的命令的数量的最大值;因为每一运算单元对命令的处理能力不同,因此每一运算单元的命令数阈值可以不同,具体可以根据每一运算单元对命令的处理能力设定每一运算单元的命令数阈值,这里不做限定。The operation unit described in the embodiments of the present disclosure is a hardware circuit that can implement different operations, for example, includes a convolution operation unit that performs multiplication and addition operations, an encoding/decoding operation unit that performs video encoding and decoding, and the like. Each operation unit is connected with the bus; and each operation unit corresponds to an information buffer, each operation unit is connected with the corresponding information buffer, and each information buffer stores the number of commands that the corresponding operation unit has not processed as The number of commands, and the command number threshold. Each computing unit has a limited ability to receive commands, and the command number threshold is the maximum number of received but unprocessed commands that the computing unit can store; The command number threshold of an operation unit may be different. Specifically, the command number threshold of each operation unit may be set according to the processing capability of each operation unit, which is not limited here.
本公开实施例所述的命令,例如为一个命令包,每一命令中包含多个命令行。其中,首行命令行又称为包头行,在包头行中携带了命令要发往的运算单元的标识。命令分发装置基于该标识,将命令分发至对应的运算单元。另外,首行命令行中还包括了该命令所包括的命令行的行数。示例性的,首行命令行的前三个比特位代表该命令要被发送到的运算单元的标识、第四个比特位和第五个比特位表示该命令包含的命令行的行数。在除包头行外的其他命令行中,携带了该命令的具体信息,如命令要执行的操作、操作数的地址、命令状态等。命令的具体信息,根据不同的命令可能会有所不同,本公开实施例不做限定。The commands described in the embodiments of the present disclosure are, for example, a command package, and each command includes multiple command lines. The first line of the command line is also called the header line, and the header line carries the identifier of the operation unit to which the command is to be sent. The command distribution device distributes the command to the corresponding computing unit based on the identifier. In addition, the first line of the command line also includes the number of lines of the command line included in the command. Exemplarily, the first three bits of the first line of the command line represent the identifier of the operation unit to which the command is to be sent, and the fourth and fifth bits represent the number of lines of the command line included in the command. In other command lines except the header line, the specific information of the command is carried, such as the operation to be performed by the command, the address of the operand, and the command status. The specific information of the command may vary according to different commands, which is not limited in this embodiment of the present disclosure.
命令行计数器、命令计数器为具有计数功能的电子元件。Command line counter and command counter are electronic components with counting function.
解析电路、仲裁电路为通过电子元件的连接、以及电平信号(例如高电平、低电平)的传递实现对应功能的硬件电路。The parsing circuit and the arbitration circuit are hardware circuits that implement corresponding functions through the connection of electronic components and the transmission of level signals (eg, high level, low level).
参见图1所示,为本公开实施例提供的命令分发装置的示意图,所述命令分发装置包括至少一个分发电路10-0~10-n(以下可统称为分发电路10)以及至少一个信息缓存器20-0~20-n(以下可统称为信息缓存器20)。Referring to FIG. 1, which is a schematic diagram of a command distribution apparatus provided by an embodiment of the present disclosure, the command distribution apparatus includes at least one distribution circuit 10-0 to 10-n (hereinafter collectively referred to as distribution circuit 10) and at least one information cache 20-0 to 20-n (hereinafter collectively referred to as information buffers 20).
至少一个信息缓存器中的各信息缓存器20,用于存储对应运算单元中当前未处理完命令的数量作为命令数量、以及对应运算单元的命令数阈值;Each information buffer 20 in the at least one information buffer is used to store the number of current unprocessed commands in the corresponding arithmetic unit as the number of commands and the command number threshold of the corresponding arithmetic unit;
至少一个分发电路中的各分发电路10,用于从与该分发电路10对应的命令队列读取当前待发送的第一命令后,基于第一命令中携带的运算单元标识,从运算单元标识对应的第一信息缓存器20中读取命令数量以及命令数阈值;响应于命令数量满足预设条件,向仲裁电路发送仲裁请求信号。Each distribution circuit 10 in at least one distribution circuit is used to read the first command currently to be sent from the command queue corresponding to the distribution circuit 10, based on the operation unit identifier carried in the first command, from the operation unit identifier corresponding to The number of commands and the threshold of the number of commands are read from the first information buffer 20 of the first information buffer; in response to the number of commands meeting the preset condition, an arbitration request signal is sent to the arbitration circuit.
其中,每一分发电路10与该至少一个信息缓存器20连接。Wherein, each distribution circuit 10 is connected with the at least one information buffer 20 .
参见图2所示,本公开另一实施例中,命令分发装置还包括仲裁电路30,仲裁电路30与至少一个分发电路10分别连接。Referring to FIG. 2 , in another embodiment of the present disclosure, the command distribution apparatus further includes an arbitration circuit 30 , and the arbitration circuit 30 is connected to at least one distribution circuit 10 respectively.
仲裁电路30,用于在接收到至少一个分发电路中各分发电路10发送的仲裁请求信号后,对各分发电路10进行权限仲裁,并基于权限仲裁的结果,向获得发送权限的分发电路10返回权限许可信号。The arbitration circuit 30 is configured to perform authority arbitration on each distribution circuit 10 after receiving an arbitration request signal sent by each distribution circuit 10 in at least one distribution circuit, and return to the distribution circuit 10 that has obtained the transmission authority based on the result of the authority arbitration Permission permission signal.
本公开实施例的命令分发装置通过硬件实现,可有效减少计算资源开销。该命令分 发装置的各分发电路在读取当前待发送的第一命令后,基于第一命令中携带的运算单元标识,从运算单元标识对应的第一信息缓存器中读取命令数量以及命令数阈值;在命令数量小于命令数阈值的情况下,向仲裁电路发送仲裁请求信号。因此,能够避免在某些运算单元发生命令堆积、而其他运算单元无可执行命令的情况,提升命令的执行效率,增加运算单元的计算资源利用率。The command distribution apparatus in the embodiment of the present disclosure is implemented by hardware, which can effectively reduce computing resource overhead. After reading the first command to be sent, each distribution circuit of the command distribution device reads the number of commands and the number of commands from the first information buffer corresponding to the identifier of the operation unit based on the identifier of the operation unit carried in the first command. Threshold; when the number of commands is less than the threshold of the number of commands, an arbitration request signal is sent to the arbitration circuit. Therefore, it is possible to avoid a situation in which command accumulation occurs in some computing units, while other computing units have no executable commands, thereby improving the execution efficiency of commands and increasing the computing resource utilization rate of the computing units.
且分发电路在第一命令对应的第一运算单元中当前未处理完命令的数量等于第一运算单元的命令数阈值的情况下,不会参与到权限仲裁过程,也就不会占用总线;而获得分发权限的分发电路同样也不会长时间的占用总线,从而提高命令分发的效率。And the distribution circuit will not participate in the authority arbitration process and will not occupy the bus when the number of currently unprocessed commands in the first operation unit corresponding to the first command is equal to the command number threshold of the first operation unit; and The distribution circuit that obtains the distribution authority also does not occupy the bus for a long time, thereby improving the efficiency of command distribution.
下面对本公开实施例所述的命令分发装置进行详细介绍。The command distribution apparatus described in the embodiments of the present disclosure will be introduced in detail below.
针对分发电路10,在从与该分发电路对应的命令队列读取当前待发送的第一命令时,例如从与该分发电路对应的命令队列读取第一命令的当前命令行。For the distribution circuit 10, when the first command to be sent currently is read from the command queue corresponding to the distribution circuit, for example, the current command line of the first command is read from the command queue corresponding to the distribution circuit.
针对至少一个信息缓存器中的各信息缓存器20,还用于获取动态配置的对应运算单元的命令数阈值。其中,对应运算单元的命令数阈值例如是基于对应运算单元中当前未处理完命令所占据的数据存储空间大小、以及对应运算单元的数据存储总空间大小确定的。For each information buffer 20 in the at least one information buffer, it is also used to obtain a dynamically configured command number threshold of the corresponding operation unit. The command number threshold corresponding to the operation unit is determined based on, for example, the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the total data storage space size of the corresponding operation unit.
此处,动态配置例如是主机、分发电路10、以及与各信息缓存器20连接的配置单元中任一主体配置的。Here, the dynamic configuration is, for example, configuration by any one of the host, the distribution circuit 10 , and the configuration unit connected to each information buffer 20 .
示例性的,主机、或者与各信息缓存器20连接的配置单元基于对应运算单元中当前未处理完命令所占据的数据存储空间大小、以及对应运算单元的数据存储总空间大小确定该对应运算单元的命令数阈值。例如,运算单元的数据存储总空间大小为可以存储50行命令行,该运算单元接收到的、但未处理完的命令的数量是3,该3个命令所占据的数据存储空间大小是30行,该运算单元还剩20行的存储空间,假设1个命令的命令行行数最大为15行,则主机或者与各信息缓存器20连接的配置单元确定该运算单元的命令数阈值为4。Exemplarily, the host or the configuration unit connected to each information buffer 20 determines the corresponding operation unit based on the size of the data storage space occupied by the currently unprocessed command in the corresponding operation unit and the size of the total data storage space of the corresponding operation unit. command count threshold. For example, the total data storage space of the operation unit can store 50 lines of command lines, the number of unprocessed commands received by the operation unit is 3, and the data storage space occupied by the three commands is 30 lines , the operation unit still has 20 lines of storage space. Assuming that the maximum number of command lines of a command is 15 lines, the host or the configuration unit connected to each information buffer 20 determines that the operation unit has a command number threshold of 4.
或者,示例性的,分发电路10从与该分发电路10对应的命令队列读取第一命令的首行命令行后,解析首行命令行得到第一命令的命令行行数,向第一信息缓存器发送命令行行数;第一信息缓存器接收到分发电路10发送的命令行行数后,基于命令行行数、第一运算单元中当前未处理完命令所占据的数据存储空间大小、以及第一运算单元的数据存储总空间大小确定第一运算单元的命令数阈值。例如,第一运算单元的数据存储总空间大小为可以存储40行命令行,该第一运算单元接收到的、但未处理完的命令的数量是3,该3个命令所占据的数据存储空间大小是30行,该第一运算单元还剩10行的存储空间,如果第一命令的命令行行数大于10行,则第一运算单元的命令数阈值为3;如果第一命令的命令行行数小于或者等于10行,则第一运算单元的命令数阈值为4。Or, exemplarily, after the distribution circuit 10 reads the first command line of the first command from the command queue corresponding to the distribution circuit 10, parses the first command line to obtain the number of command lines of the first command, and sends the first information to the first information The buffer sends the number of command lines; after receiving the number of command lines sent by the distribution circuit 10, the first information buffer is based on the number of command lines, the size of the data storage space occupied by the currently unprocessed commands in the first arithmetic unit, And the size of the total data storage space of the first operation unit determines the command number threshold of the first operation unit. For example, the total data storage space of the first operation unit can store 40 lines of command lines, the number of unprocessed commands received by the first operation unit is 3, and the data storage space occupied by the three commands The size is 30 lines, and the first operation unit has 10 lines of storage space left. If the number of command lines of the first command is greater than 10 lines, the threshold of the number of commands of the first operation unit is 3; if the command line of the first command If the number of lines is less than or equal to 10 lines, the command number threshold of the first operation unit is 4.
针对至少一个分发电路中的各分发电路10,从该分发电路10对应的命令队列中读取第一命令的当前命令行,并确定当前命令行是否为第一命令的首行命令行。For each distribution circuit 10 in at least one distribution circuit, read the current command line of the first command from the command queue corresponding to the distribution circuit 10, and determine whether the current command line is the first command line of the first command.
情况A1:在确定当前命令行是第一命令的首行命令行的情况下,分发电路10基于首行命令行中携带的运算单元标识,从与该运算单元标识对应的第一信息缓存器中读取第一命令对应的第一运算单元中当前未处理完命令的数量作为命令数量以及该第一运算单元的命令数阈值,响应于命令数量满足预设条件,向仲裁电路发送仲裁请求信号。其中,预设条件例如包括命令数量小于命令数阈值。因此在命令数量小于命令数阈值的情况下,分发电路10向仲裁电路30发送仲裁请求信号。Case A1: In the case where it is determined that the current command line is the first command line of the first command, the distribution circuit 10, based on the operation unit identifier carried in the first line of the command line, selects from the first information buffer corresponding to the operation unit identifier. The number of currently unprocessed commands in the first operation unit corresponding to the first command is read as the number of commands and the command number threshold of the first operation unit, and an arbitration request signal is sent to the arbitration circuit in response to the number of commands meeting a preset condition. The preset condition includes, for example, that the number of commands is less than a threshold of the number of commands. Therefore, when the number of commands is smaller than the command number threshold, the distribution circuit 10 sends an arbitration request signal to the arbitration circuit 30 .
其中,第一运算单元为与当前待发送的第一命令对应的运算单元,第一信息缓存器为与第一运算单元对应的信息缓存器;运算单元标识例如包括该对应运算单元的标识(例如该对应的运算单元的地址)、该对应的信息缓存器的标识(例如该对应的信息缓存器的地址)等内容中的至少一项。另外,分发电路10还可以记录该运算单元标识; 在当前命令行为非首行命令行时,利用记录的运算单元标识,向运算单元标识对应的第一运算单元发送该当前命令行。Wherein, the first operation unit is the operation unit corresponding to the first command to be sent currently, and the first information buffer is the information buffer corresponding to the first operation unit; the operation unit identifier includes, for example, the identifier of the corresponding operation unit (for example, At least one of the contents of the address of the corresponding operation unit), the identifier of the corresponding information buffer (for example, the address of the corresponding information buffer) and the like. In addition, the distribution circuit 10 may also record the operation unit identifier; when the current command line is a non-first line command line, use the recorded operation unit identifier to send the current command line to the first operation unit corresponding to the operation unit identifier.
分发电路10读取的当前命令行为首行命令行代表该分发电路要开始发送一个新的第一命令,需要确定该新的第一命令对应的第一运算单元存储的已接收到的、但未处理完毕的命令的数量(以下可简称为命令数量)是否达到最大值;命令数量小于命令数阈值代表第一运算单元存储的已接收到的、但未处理完毕的命令的数量还没有达到最大值,该第一运算单元还可以正常接收分发电路发送的命令,此时分发电路可以向仲裁电路30发送仲裁请求信号,参与仲裁电路30的仲裁以便获得向第一运算单元发送命令的机会。The current command line read by the distribution circuit 10 is the first command line, which means that the distribution circuit wants to start sending a new first command, and needs to determine the received, but not yet stored, first operation unit corresponding to the new first command. Whether the number of processed commands (hereinafter referred to as the number of commands) has reached the maximum value; if the number of commands is less than the threshold of the number of commands, it means that the number of received but unprocessed commands stored by the first operation unit has not reached the maximum value. , the first arithmetic unit can also normally receive the command sent by the distribution circuit. At this time, the distribution circuit can send an arbitration request signal to the arbitration circuit 30 to participate in the arbitration of the arbitration circuit 30 to obtain the opportunity to send the command to the first arithmetic unit.
另外,分发电路10在命令数量等于命令数阈值的情况下,实时监测第一信息缓存器中的所述命令数量是否变化为小于命令数阈值;在监测到命令数量变化为小于命令数阈值后,向仲裁电路30发送仲裁请求信号。In addition, when the number of commands is equal to the threshold of the number of commands, the distribution circuit 10 monitors in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands; after monitoring that the number of commands changes to be less than the threshold of the number of commands, An arbitration request signal is sent to the arbitration circuit 30 .
第一运算单元中存储的接收到的、但未处理完毕的命令的数量达到最大值时,无法接收分发电路10发送的命令,直到将所存储的命令中的至少一条命令处理完毕后,才可以接收分发电路10发送的命令。When the number of received but unprocessed commands stored in the first arithmetic unit reaches the maximum value, the command sent by the distribution circuit 10 cannot be received until at least one of the stored commands is processed. The command sent by the distribution circuit 10 is received.
第一运算单元将一个命令处理完之后会给第一信息缓存器一个反馈信息,第一信息缓存器会在接收到该反馈信息后更新命令数量,例如将命令数量做减1操作,分发电路10在监测到第一信息缓存器中存储的命令数量变化为小于命令数阈值后,向仲裁电路30发送仲裁请求信号,参与仲裁电路30的仲裁以便获得向第一运算单元发送命令的机会。After the first arithmetic unit processes a command, it will give feedback information to the first information buffer, and the first information buffer will update the number of commands after receiving the feedback information, for example, reduce the number of commands by 1, and the distribution circuit 10 After monitoring that the number of commands stored in the first information buffer changes to be less than the command number threshold, an arbitration request signal is sent to the arbitration circuit 30 to participate in the arbitration of the arbitration circuit 30 to obtain an opportunity to send commands to the first arithmetic unit.
情况A2:在确定当前命令行是第一命令的非首行命令行的情况下,分发电路10直接向仲裁电路30发送仲裁请求信号。Case A2: When it is determined that the current command line is a non-first line command line of the first command, the distribution circuit 10 directly sends an arbitration request signal to the arbitration circuit 30 .
在当前命令行不是第一命令的首行命令行的情况下,说明该分发电路10在发送该第一命令的首行命令行时,已经确定第一命令对应的第一运算单元存储的接收到的、但未处理完毕的命令的数量还没有达到最大值,因此在读取的当前命令行不是第一命令的首行命令行的情况下,分发电路10可直接向仲裁电路30发送仲裁请求信号,而无需再确定第一运算单元中的当前未处理完命令的数量是否小于命令数阈值。In the case where the current command line is not the first command line of the first command, it means that the distribution circuit 10 has determined that the first operation unit corresponding to the first command has received the received command line when sending the first command line of the first command. However, the number of unprocessed commands has not reached the maximum value. Therefore, when the current command line read is not the first command line of the first command, the distribution circuit 10 can directly send an arbitration request signal to the arbitration circuit 30. , without the need to determine whether the current number of unprocessed commands in the first operation unit is less than the command number threshold.
并且,对于某个命令而言,其所有命令行被全部发送至对应的运算单元后,对应的运算单元才会基于该命令处理与该命令对应的处理任务。因此,若当前命令行为非首行命令行,可以继续将非首行命令行向对应的运算单元发送。因而,分发电路10在当前命令行为非首行命令行的情况下,直接向仲裁电路30发送仲裁请求信号。Moreover, for a certain command, only after all the command lines of the command are sent to the corresponding operation unit, the corresponding operation unit will process the processing task corresponding to the command based on the command. Therefore, if the current command line is a non-first-line command line, you can continue to send the non-first-line command line to the corresponding operation unit. Therefore, the distribution circuit 10 directly sends an arbitration request signal to the arbitration circuit 30 when the current command line is a non-first-line command line.
分发电路10在向仲裁电路发送仲裁请求信号时,例如可以采用下述方式B1或者B2中任一种:When the distribution circuit 10 sends the arbitration request signal to the arbitration circuit, for example, any one of the following modes B1 or B2 may be adopted:
方式B1:分发电路10在命令数量小于命令数阈值的情况下,即向仲裁电路30发送仲裁请求信号。Mode B1: When the number of commands is less than the command number threshold, the distribution circuit 10 sends an arbitration request signal to the arbitration circuit 30 .
方式B2:分发电路10在命令数量小于命令数阈值的情况下,确定首行命令行是否为就绪状态;若是,则向仲裁电路30发送仲裁请求信号;若不是就绪状态,则不向仲裁电路30发送仲裁请求信号,直到其变化至就绪状态为止。Mode B2: when the number of commands is less than the threshold of the number of commands, the distribution circuit 10 determines whether the first line of the command line is in a ready state; if so, it sends an arbitration request signal to the arbitration circuit 30; if it is not in a ready state, it does not send the arbitration circuit 30. The arbitration request signal is sent until it changes to the ready state.
此处,当前命令行为就绪状态,表示:命令数量小于命令数阈值的情况下,可以将当前命令行向对应的第一运算单元发送。该就绪状态例如包括下述状态(1)~(2)中任一种:Here, the current command line is in the ready state, which means that when the number of commands is less than the command number threshold, the current command line can be sent to the corresponding first operation unit. The ready state includes, for example, any one of the following states (1) to (2):
状态(1):首行命令行所在的第一命令对应的第一运算单元、与命令队列最近已发送的第二命令对应的第二运算单元相同。State (1): The first operation unit corresponding to the first command where the first line of the command line is located is the same as the second operation unit corresponding to the second command recently sent by the command queue.
状态(2):首行命令行所在的第一命令对应的第一运算单元、与命令队列最近已发送的第二命令对应的第二运算单元不相同,但第二命令被第二运算单元处理完毕。State (2): The first operation unit corresponding to the first command where the first command line is located is different from the second operation unit corresponding to the second command recently sent by the command queue, but the second command is processed by the second operation unit complete.
此处,对于属于同一命令队列的不同命令,其是具有先后处理顺序的;在很多情况下,后一命令的处理,需要在前一命令被处理完毕后才可以处理;因此,为了保证属 于同一命令队列的不同命令之间的处理顺序,若不同命令被发送至不同的运算单元,就需要前一命令对应的运算单元将该前一命令处理完毕后,再将后一命令向该后一命令对应的运算单元发送。Here, for different commands belonging to the same command queue, they have a sequential processing order; in many cases, the processing of the next command can only be processed after the previous command has been processed; therefore, in order to ensure that they belong to the same command queue The processing sequence between different commands in the command queue. If different commands are sent to different operation units, the operation unit corresponding to the previous command needs to process the previous command, and then send the next command to the next command. The corresponding operation unit is sent.
若不同命令被发送至相同的运算单元,由于运算单元在处理完一个命令后才会处理另一命令,因此在前一命令未被处理完毕的情况下,就可以将后一命令中的各命令行向同一运算单元发送,这样,也能够保证同一命令队列的不同命令之间的处理顺序。If different commands are sent to the same operation unit, since the operation unit will only process another command after processing one command, if the previous command has not been processed, each command in the latter command can be processed. The rows are sent to the same operation unit, so that the processing order between different commands in the same command queue can also be guaranteed.
因此,在上述状态(1)中,在第一运算单元与第二运算单元相同的情况下,将当前命令行确定为就绪状态;在上述(2)中,在第一运算单元和第二运算单元不同,且第二命令被第二运算单元处理完毕的情况下,将当前命令行确定为就绪状态。Therefore, in the above state (1), when the first operation unit is the same as the second operation unit, the current command line is determined as the ready state; in the above (2), in the first operation unit and the second operation unit When the units are different, and the second command is processed by the second operation unit, the current command line is determined to be in a ready state.
另外,至少一个分发电路中的各分发电路10,在接收到仲裁电路30基于仲裁请求信号返回的权限许可信号后,向与运算单元标识对应的第一运算单元发送第一命令。In addition, each distribution circuit 10 in the at least one distribution circuit sends a first command to the first operation unit corresponding to the operation unit identifier after receiving the authorization permission signal returned by the arbitration circuit 30 based on the arbitration request signal.
在命令分发装置中,还可以包括命令分发接口40;分发电路10可以与该命令分发接口40连接,其在向第一运算单元发送当前命令行时,可以将当前命令行和运算单元标识一起发送给命令分发接口40。相应地,命令分发接口40与总线连接,基于运算单元标识,通过总线,将当前命令行发送给与总线连接的第一运算单元。The command distribution device may further include a command distribution interface 40; the distribution circuit 10 may be connected to the command distribution interface 40, and when sending the current command line to the first operation unit, the current command line and the operation unit identifier may be sent together To the command distribution interface 40 . Correspondingly, the command distribution interface 40 is connected to the bus, and based on the identification of the operation unit, sends the current command line to the first operation unit connected to the bus through the bus.
另外,命令分发接口40还可以与仲裁电路30连接;分发电路10在接收到权限许可信号后,将当前命令行和运算单元标识一起发送给仲裁电路30;仲裁电路30将当前命令行和运算单元标识一起发送给命令分发接口40,然后由命令分发接口40基于运算单元标识,通过总线将当前命令行发送给与总线连接的第一运算单元。In addition, the command distribution interface 40 can also be connected to the arbitration circuit 30; the distribution circuit 10 sends the current command line and the operation unit identifier to the arbitration circuit 30 after receiving the permission permission signal; the arbitration circuit 30 sends the current command line and the operation unit identifier to the arbitration circuit 30; The identifier is sent to the command distribution interface 40 together, and then the command distribution interface 40 sends the current command line to the first operation unit connected to the bus through the bus based on the operation unit identifier.
命令分发接口40可例如和总线的总线接口连接。命令分发接口40将当前命令行和运算单元标识一起发送给总线接口,由总线接口通过总线、以及运算单元标识,将当前命令行发送给第一运算单元。The command distribution interface 40 may be connected, for example, to a bus interface of a bus. The command distribution interface 40 sends the current command line and the operation unit identifier to the bus interface, and the bus interface sends the current command line to the first operation unit through the bus and the operation unit identifier.
图3为公开实施例提供一种分发电路10的结构示意图,在该实施例中,分发电路10包括解析电路101、以及命令行缓存器102;解析电路101分别和命令行缓存器102、以及该至少一个信息缓存器20连接;3 is a schematic structural diagram of a distribution circuit 10 provided by the disclosed embodiment. In this embodiment, the distribution circuit 10 includes a parsing circuit 101 and a command line buffer 102; the parsing circuit 101 and the command line buffer 102 and the at least one information buffer 20 is connected;
解析电路101,用于从命令队列中读取第一命令的当前命令行,并确定当前命令行是否为首行命令行;在当前命令行为首行命令行的情况下,基于首行命令行中携带的运算单元标识,从运算单元标识对应的第一信息缓存器中读取命令数量以及命令数阈值;在命令数量小于命令数阈值的情况下,向命令行缓存器102发送首行命令行;The parsing circuit 101 is used to read the current command line of the first command from the command queue, and determine whether the current command line is the first command line; in the case that the current command line is the first command line, based on the first command line carried The arithmetic unit identifier, reads the command quantity and the command number threshold from the first information buffer corresponding to the arithmetic unit identifier; In the case that the command quantity is less than the command number threshold, send the first line command line to the command line buffer 102;
命令行缓存器102,用于在接收解析电路101发送的首行命令行后,向仲裁电路发送仲裁请求信号。The command line buffer 102 is configured to send an arbitration request signal to the arbitration circuit after receiving the first line of the command line sent by the parsing circuit 101 .
针对解析电路101,参见图3所示,每一解析电路101与对应的命令队列连接,如图3中的解析电路0与命令队列0连接,解析电路1与命令队列1连接;解析电路101与对应的命令行缓存器102连接,例如图3中解析电路0与命令行缓存器0连接,解析电路1与命令行缓存器1连接。For the parsing circuit 101, see FIG. 3, each parsing circuit 101 is connected to the corresponding command queue, the parsing circuit 0 in FIG. 3 is connected to the command queue 0, the parsing circuit 1 is connected to the command queue 1; the parsing circuit 101 is connected to Corresponding command line buffers 102 are connected. For example, in FIG. 3 , parsing circuit 0 is connected to command line buffer 0 , and parsing circuit 1 is connected to command line buffer 1 .
解析电路101读取命令队列的过程例如包括:解析电路101监测其与命令队列之间电平状态,并监测其与命令行缓存器102之间的电平状态;当检测到与命令队列之间的电平状态表征命令队列中存在待发送命令,且与命令行缓存器102之间的电平状态表征命令行缓存器102为空,则从命令队列中读取当前命令行。The process of reading the command queue by the parsing circuit 101 includes, for example: the parsing circuit 101 monitors the level state between it and the command queue, and monitors the level state between it and the command line buffer 102; The level state of the command line indicates that there is a command to be sent in the command queue, and the level state between the command line buffer 102 and the command line buffer 102 indicates that the command line buffer 102 is empty, then the current command line is read from the command queue.
另外,解析电路101读取命令队列的过程还可以包括:命令队列在存储有待发送命令时,向解析电路101发送第一电平信号,该第一电平信号表征在命令队列中存储有待发送命令;解析电路101在接收到该第一电平信号后,向命令行缓存器102发送第二电平信号,命令行缓存器102接收到第二电平信号后,在命令行缓存器102中没有存储任何命令行的情况下,向解析电路101发送第三电平信号,解析电路101在接收到第三电平信号后,向命令队列反馈第四电平信号,命令队列接收到第四电平信号后,向解析电路101发送待发送命令的多个命令行中的当前命令行。In addition, the process of reading the command queue by the parsing circuit 101 may further include: when the command queue stores the command to be sent, sending a first level signal to the parsing circuit 101, where the first level signal represents that the command to be sent is stored in the command queue ; After receiving the first level signal, the parsing circuit 101 sends a second level signal to the command line buffer 102. After the command line buffer 102 receives the second level signal, there is no signal in the command line buffer 102. In the case of storing any command line, a third level signal is sent to the parsing circuit 101. After receiving the third level signal, the parsing circuit 101 feeds back the fourth level signal to the command queue, and the command queue receives the fourth level signal. After the signal is sent, the parsing circuit 101 sends the current command line among the plurality of command lines to be sent.
命令行缓存器102存储有命令行的情况下,则向解析电路101反馈第五电平信号,解析电路101在接收到该第五电平信号后向命令队列反馈第六电平信号,命令队列接收到第六电平信号后,继续向解析电路101发送第一电平信号,直至收到解析电路101反馈的第四电平信号。When the command line buffer 102 stores a command line, it feeds back a fifth level signal to the parsing circuit 101. After receiving the fifth level signal, the parsing circuit 101 feeds back a sixth level signal to the command queue, and the command queue After receiving the sixth level signal, continue to send the first level signal to the analysis circuit 101 until the fourth level signal fed back by the analysis circuit 101 is received.
需要说明的是,上述发送第一电平信号、第二电平信号、第三电平信号、第四电平信号、第五电平信号、第六电平信号可以是一个传输状态,也可以是对应的电路模块保持该电平信号对应的状态。例如,命令队列向解析电路101发送的第一电平信号是高电平,则可以是命令队列在每个时钟周期向解析电路101发送一次高电平,也可以是命令队列一直保持高电平状态。It should be noted that the above-mentioned sending of the first level signal, the second level signal, the third level signal, the fourth level signal, the fifth level signal, and the sixth level signal may be a transmission state, or may It is the corresponding circuit module that maintains the state corresponding to the level signal. For example, if the first level signal sent by the command queue to the parsing circuit 101 is a high level, then the command queue may send a high level to the parsing circuit 101 once every clock cycle, or the command queue may keep a high level all the time. state.
另外,解析电路101还用于在命令数量等于命令数阈值的情况下,向命令行缓存器发送所述首行命令行、以及第一暂停指令;命令行缓存器102,在接收述解析电路发送的首行命令行以及所述第一暂停指令后,暂停向仲裁电路发送仲裁请求信号。解析电路101实时监测第一信息缓存器中的所述命令数量是否变化为小于命令数阈值;在监测到命令数量变化为小于命令数阈值后,解析电路101向命令行缓存器102发送第一启动指令;命令行缓存器102在接收到第一启动指令后,向仲裁电路30发送仲裁请求信号。In addition, the parsing circuit 101 is further configured to send the first line of the command line and the first pause instruction to the command line buffer when the number of commands is equal to the threshold of the number of commands; the command line buffer 102, after receiving the After the first line of the command line and the first pause instruction, the arbitration request signal is sent to the arbitration circuit by pause. The parsing circuit 101 monitors in real time whether the number of commands in the first information buffer has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the parsing circuit 101 sends the first start to the command line buffer 102 command; after receiving the first start command, the command line buffer 102 sends an arbitration request signal to the arbitration circuit 30 .
分发电路10读取到当前命令行之后,确定当前命令行是否为第一命令的首行命令行,在当前命令行为第一命令的首行命令行的情况下,基于首行命令行中携带的运算单元标识,从运算单元标识对应的第一信息缓存器中读取命令数量以及命令数阈值;在命令数量小于命令数阈值的情况下,确定首行命令行是否为就绪状态;若是,则向仲裁电路30发送仲裁请求信号。After the distribution circuit 10 reads the current command line, it determines whether the current command line is the first command line of the first command. The arithmetic unit identifier, reads the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arithmetic unit; in the case that the number of commands is less than the threshold of the number of commands, determine whether the first line of the command line is in a ready state; The arbitration circuit 30 transmits an arbitration request signal.
当前命令行对应的就绪状态,可以参见上述状态(1)~(2)任一项,在此不再赘述。For the ready state corresponding to the current command line, reference may be made to any one of the above states (1) to (2), which will not be repeated here.
在本公开另一实施例中,分发电路10还包括命令行计数器103;命令行计数器103与解析电路101连接。In another embodiment of the present disclosure, the distribution circuit 10 further includes a command line counter 103 ; the command line counter 103 is connected to the parsing circuit 101 .
解析电路101,用于从命令队列中读取当前命令行后,从命令行计数器103读取第一计数数值;在第一计数数值小于第一预设数值,且大于原始数值的情况下,确定当前命令行为第一命令中的非首行命令行。The parsing circuit 101 is configured to read the first count value from the command line counter 103 after reading the current command line from the command queue; when the first count value is less than the first preset value and greater than the original value, determine The current command line is the non-first command line in the first command.
其中,第一预设数值,是基于第一命令的命令行行数确定的。The first preset value is determined based on the number of command line lines of the first command.
且第一预设数值与命令行缓存器102的原始数值有关。具言之,对于同一命令,例如原始数值为m,且该命令的命令行数量为n时,则该第一预设数值可以为m+n;原始数值可以根据实际情况设定,例如原始数值可以设置为0,或者1等,具体可以根据实际的需要进行设定。And the first preset value is related to the original value of the command line buffer 102 . Specifically, for the same command, for example, when the original value is m and the number of command lines of the command is n, the first preset value can be m+n; the original value can be set according to the actual situation, such as the original value It can be set to 0, or 1, etc., and can be set according to actual needs.
解析电路101从命令队列中读取当前命令行,并在确定当前命令行为第一命令中的非首行命令行的情况下,向命令行缓存器102发送当前命令行,如图3中④所示;命令行缓存器102,在接收解析电路101发送的当前命令行后,向仲裁电路30发送仲裁请求信号如图3中⑤所示。The parsing circuit 101 reads the current command line from the command queue, and when it is determined that the current command line is a non-first line command line in the first command, sends the current command line to the command line buffer 102, as shown in ④ in Figure 3 The command line buffer 102, after receiving the current command line sent by the parsing circuit 101, sends an arbitration request signal to the arbitration circuit 30, as shown in ⑤ in FIG. 3 .
另外,解析电路101从命令队列中读取当前命令行后,从命令行计数器103读取第一计数数值,如图3中①、③所示;解析电路101在读取第一计数数值后,在确定了当前命令行为第一命令中的非首行命令行后,向命令行计数器103发送第一计数指令,如图3中②所示;命令行计数器103接收到解析电路101发送的第一计数指令后将第一计数数值增加第一数值。In addition, after the parsing circuit 101 reads the current command line from the command queue, it reads the first count value from the command line counter 103, as shown in ① and ③ in FIG. 3; after the parsing circuit 101 reads the first count value, After it is determined that the current command line is a non-first line command line in the first command, the command line counter 103 sends a first count instruction, as shown in ② in FIG. 3 ; The first count value is incremented by the first value after the count instruction.
其中,第一数值根据具体应用情况设定,例如针对记录解析电路101读取的命令行的行数,第一数值例如为1。Wherein, the first value is set according to the specific application situation, for example, for the number of lines of the command line read by the recording parsing circuit 101 , the first value is, for example, 1.
本公开另一实施例中,解析电路101读取的第一计数数值等于第一预设数值,或等于原始数值的情况下,解析电路101确定当前命令行为第一命令中的首行命令行,基于第一命令的命令行行数更新第一预设数值并向命令行计数器103发送重置指令,如图 3中的⑥所示;命令行计数器103接收到解析电路101发送的重置指令后,将第一计数数值重置为原始数值后增加第一数值。In another embodiment of the present disclosure, when the first count value read by the parsing circuit 101 is equal to the first preset value, or equal to the original value, the parsing circuit 101 determines that the current command line is the first command line in the first command, Update the first preset value based on the number of command line lines of the first command and send a reset instruction to the command line counter 103, as shown in ⑥ in FIG. 3 ; after the command line counter 103 receives the reset instruction sent by the parsing circuit 101 , reset the first count value to the original value and then increase the first value.
解析电路101在确定当前命令行为第一命令的首行命令的情况下,基于首行命令行中携带的运算单元标识,从运算单元标识对应的第一信息缓存器中读取命令数量以及命令数阈值;在命令数量小于命令数阈值的情况下,确定首行命令行是否为就绪状态;若是,则向仲裁电路30发送仲裁请求信号。In the case that the parsing circuit 101 determines that the current command line is the first line command of the first command, based on the operation unit identifier carried in the first line command line, the number of commands and the number of commands are read from the first information buffer corresponding to the operation unit identifier. Threshold; if the number of commands is less than the threshold of the number of commands, determine whether the first line of the command line is in a ready state; if so, send an arbitration request signal to the arbitration circuit 30 .
参见图3所示,本公开另一实施例中,分发电路10还包括了判断电路104。Referring to FIG. 3 , in another embodiment of the present disclosure, the distribution circuit 10 further includes a judgment circuit 104 .
解析电路101与判断电路104连接。The analysis circuit 101 is connected to the judgment circuit 104 .
解析电路101,还用于在确定当前命令行为第一命令中的首行命令行,且在命令数量小于命令数阈值的情况下,从首行命令行中解析第一命令对应的运算单元标识,并向判断电路104发送运算单元标识,以及向命令行缓存器102发送当前命令行;The parsing circuit 101 is also used to determine that the current command line is the first command line in the first command, and in the case that the number of commands is less than the command number threshold, from the first command line to parse the operation unit identifier corresponding to the first command, and send the operation unit identifier to the judgment circuit 104, and send the current command line to the command line buffer 102;
判断电路104,用于接收解析电路101发送的运算单元标识,并在基于运算单元标识判断第一命令对应的第一运算单元和命令队列最近已发送的第二命令对应的第二运算单元不同、且第二命令未被第二运算单元处理完毕的情况下,向命令行缓存器102发送第二暂停指令;The judgment circuit 104 is used to receive the arithmetic unit identifier sent by the parsing circuit 101, and based on the arithmetic unit identifier, it is judged that the first arithmetic unit corresponding to the first command and the second arithmetic unit corresponding to the second command that the command queue has recently sent are different, And when the second command is not processed by the second arithmetic unit, send a second pause command to the command line buffer 102;
命令行缓存器102,还用于在接收到判断电路104发送的第二暂停指令的情况下,暂停向仲裁电路30发送仲裁请求信号。The command line buffer 102 is further configured to suspend sending an arbitration request signal to the arbitration circuit 30 when the second suspend instruction sent by the judgment circuit 104 is received.
另一实施例中,在分发电路10中还包括命令计数器105。命令计数器105与判断电路104连接。In another embodiment, the command counter 105 is further included in the distribution circuit 10 . The command counter 105 is connected to the judgment circuit 104 .
判断电路104,还用于在接收到解析电路101发送的运算单元标识后,从命令计数器105中读取第二计数数值,并在第二计数数值大于第二预设数值的情况下,确定第二命令未被第二运算单元处理完毕;The judgment circuit 104 is further configured to read the second count value from the command counter 105 after receiving the operation unit identifier sent by the analysis circuit 101, and determine the first count value when the second count value is greater than the second preset value. The second command has not been processed by the second operation unit;
其中,命令计数器105,用于对与命令队列对应的当前已发送但未被处理完毕的命令进行计数。Among them, the command counter 105 is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
示例性的,如图3所示,解析电路101与判断电路104、以及命令计数器105连接,命令计数器105与判断电路104连接;在当前命令行为第一命令中的首行命令行的情况下,解析电路101从首行命令行中解析第一命令对应的运算单元标识,并向判断电路104发送运算单元标识,如图3中的⑦所示,以及向命令行缓存器102发送当前命令行、运算单元标识,如图3中的⑧所示;其中,运算单元标识可例如为一个二进制数组,用于表征第一命令对应的第一运算单元的地址。Exemplarily, as shown in FIG. 3, the parsing circuit 101 is connected to the judgment circuit 104 and the command counter 105, and the command counter 105 is connected to the judgment circuit 104; when the current command line is the first command line in the first command, The parsing circuit 101 parses the arithmetic unit identification corresponding to the first command from the first line command line, and sends the arithmetic unit identification to the judgment circuit 104, as shown in ⑦ in Figure 3, and sends the current command line, The operation unit identifier is shown as ⑧ in FIG. 3 ; wherein, the operation unit identifier may be, for example, a binary array, used to represent the address of the first operation unit corresponding to the first command.
判断电路104在接收到解析电路101发送的运算单元标识后,在确定所接收到的运算单元标识和该命令队列最近已发送的第二命令对应的第二运算单元的第二标识一致的情况下即为上述状态(1)所述的就绪状态,判断电路104保持在一个固定的电平信号例如高电平,当判断电路104保持在高电平时,命令行缓存器102在接收到解析电路101发送的当前命令行、运算单元标识后,向仲裁电路30发送仲裁请求信号如图3中⑨所示。其中,第二标识可例如为一个二进制数组,用于表征第二运算单元的地址。After the judgment circuit 104 receives the operation unit identifier sent by the parsing circuit 101, it is determined that the received operation unit identifier is consistent with the second identifier of the second operation unit corresponding to the second command that the command queue has recently sent. That is, the ready state described in the above state (1), the judgment circuit 104 maintains a fixed level signal such as a high level. When the judgment circuit 104 is maintained at a high level, the command line buffer 102 receives the parsing circuit 101. After sending the current command line and the operation unit identifier, the arbitration request signal is sent to the arbitration circuit 30 as shown in ⑨ in FIG. 3 . The second identifier may be, for example, a binary array, which is used to represent the address of the second operation unit.
本公开另一实施例中,判断电路104在接收到解析电路101发送的运算单元标识后,从命令计数器105中读取第二计数数值,在第二计数数值等于第二预设数值的情况下,确定第二命令已经被第二运算单元处理完毕,且在运算单元标识和该第二命令对应的第二运算单元的第二标识不一致的情况下即为上述状态(2)所述的就绪状态,判断电路104保持在一个固定的电平信号例如高电平,当判断电路104保持在高电平时,命令行缓存器102在接收到解析电路101发送的当前命令行、运算单元标识后,向仲裁电路30发送仲裁请求信号如图3中⑨所示。In another embodiment of the present disclosure, the judgment circuit 104 reads the second count value from the command counter 105 after receiving the operation unit identifier sent by the parsing circuit 101 , and in the case that the second count value is equal to the second preset value , it is determined that the second command has been processed by the second operation unit, and when the operation unit identifier is inconsistent with the second identifier of the second operation unit corresponding to the second command, it is the ready state described in the above state (2). , the judging circuit 104 is kept at a fixed level signal, such as a high level. When the judging circuit 104 is kept at a high level, the command line buffer 102, after receiving the current command line and the arithmetic unit identifier sent by the parsing circuit 101, sends the The arbitration circuit 30 sends the arbitration request signal as shown in ⑨ in FIG. 3 .
本公开另一实施例中,判断电路104在接收到解析电路101发送的运算单元标识后,从所述命令计数器105中读取第二计数数值,在第二计数数值大于第二预设数值的情况下,确定最近已发送的第二命令未被第二运算单元处理完毕,且当运算单元标识和 该第二运算单元的第二标识不一致的情况下,判断电路104向命令行缓存器102发送第二暂停指令如图3中
Figure PCTCN2022070709-appb-000001
所示,命令行缓存器102在接收到判断电路104发送的第二暂停指令的情况下,暂停向仲裁电路30发送仲裁请求信号。
In another embodiment of the present disclosure, the judgment circuit 104 reads the second count value from the command counter 105 after receiving the operation unit identifier sent by the parsing circuit 101 , and when the second count value is greater than the second preset value In this case, it is determined that the second command that has been sent recently has not been processed by the second operation unit, and when the identifier of the operation unit is inconsistent with the second identifier of the second operation unit, the judgment circuit 104 sends the command to the command line buffer 102. The second pause command is shown in Figure 3
Figure PCTCN2022070709-appb-000001
As shown, the command line buffer 102 suspends sending the arbitration request signal to the arbitration circuit 30 when receiving the second suspend instruction sent by the judgment circuit 104 .
判断电路104在确定第二命令未被第二运算单元处理完毕的情况下,监测命令计数器105中的第二计数数值是否变化为第二预设数值;并在监测到命令计数器105的第二计数数值变化为第二预设数值的情况下,向命令行缓存器102发送第二启动指令如图3中
Figure PCTCN2022070709-appb-000002
所示;命令行缓存器102在接收到第二启动指令后,向仲裁电路30发送仲裁请求信号。
The judgment circuit 104 monitors whether the second count value in the command counter 105 changes to the second preset value when it is determined that the second command has not been processed by the second arithmetic unit; and monitors the second count of the command counter 105 When the value changes to the second preset value, a second start command is sent to the command line buffer 102 as shown in FIG. 3
Figure PCTCN2022070709-appb-000002
As shown; the command line buffer 102 sends an arbitration request signal to the arbitration circuit 30 after receiving the second start command.
仲裁电路30在接收到各个命令行缓存器102发送的仲裁请求信号后,对各命令行缓存器102进行权限仲裁,并基于权限仲裁的结果,向获得发送权限的命令行缓存器102返回权限许可信号如图3中
Figure PCTCN2022070709-appb-000003
所示。
After receiving the arbitration request signal sent by each command line buffer 102, the arbitration circuit 30 performs authority arbitration on each command line buffer 102, and based on the result of the authority arbitration, returns the authority permission to the command line buffer 102 that has obtained the sending authority The signal is shown in Figure 3
Figure PCTCN2022070709-appb-000003
shown.
命令行缓存器102在接收到仲裁电路30基于仲裁请求信号返回的权限许可信号后,向与第一命令对应的第一运算单元发送当前命令行。After receiving the permission permission signal returned by the arbitration circuit 30 based on the arbitration request signal, the command line buffer 102 sends the current command line to the first operation unit corresponding to the first command.
在一种可能的实施方式中,命令行缓存器102在接收到仲裁电路30基于仲裁请求信号返回的权限许可信号后向仲裁电路30发送当前命令行、以及第一运算单元的运算单元标识如图3中
Figure PCTCN2022070709-appb-000004
所示;仲裁电路30在接收到当前命令行、以及运算单元标识后,向命令分发接口40发送当前命令行、以及运算单元标识如图3中
Figure PCTCN2022070709-appb-000005
所示;命令分发接口40在接收到当前命令行、以及运算单元标识后,向总线接口发送当前命令行、以及运算单元标识如图3中
Figure PCTCN2022070709-appb-000006
所示;总线接口在接收到当前命令行、以及运算单元标识后,基于运算单元标识向第一运算单元发送当前命令行。
In a possible implementation manner, the command line buffer 102 sends the current command line and the arithmetic unit identifier of the first arithmetic unit to the arbitration circuit 30 after receiving the permission permission signal returned by the arbitration circuit 30 based on the arbitration request signal. 3 in
Figure PCTCN2022070709-appb-000004
After receiving the current command line and the arithmetic unit identification, the arbitration circuit 30 sends the current command line and the arithmetic unit identification to the command distribution interface 40 as shown in Figure 3
Figure PCTCN2022070709-appb-000005
shown; the command distribution interface 40 sends the current command line and the operation unit identification to the bus interface after receiving the current command line and the arithmetic unit identification as shown in Figure 3
Figure PCTCN2022070709-appb-000006
After receiving the current command line and the operation unit identifier, the bus interface sends the current command line to the first operation unit based on the operation unit identifier.
其中,总线与每一运算单元连接,总线通过每一运算单元的标识选择出需要进行通信的运算单元。Wherein, the bus is connected to each operation unit, and the bus selects the operation unit to be communicated through the identification of each operation unit.
在另一种可能的实施方式中,命令行缓存器102与命令分发接口40连接;命令行缓存器102在接收到仲裁电路30基于仲裁请求信号返回的权限许可信号后,向命令分发接口40发送当前命令行、以及运算单元标识;命令分发接口40在接收到当前命令行、以及运算单元标识后,向总线接口发送当前命令行、以及运算单元标识;总线接口在接收到当前命令行、以及运算单元标识后,基于运算单元标识向第一运算单元发送当前命令行。In another possible implementation, the command line buffer 102 is connected to the command distribution interface 40; after receiving the permission permission signal returned by the arbitration circuit 30 based on the arbitration request signal, the command line buffer 102 sends the command distribution interface 40 The current command line and the operation unit identifier; the command distribution interface 40 sends the current command line and the operation unit identifier to the bus interface after receiving the current command line and the operation unit identifier; the bus interface receives the current command line and the operation unit identifier. After the unit identification, the current command line is sent to the first operation unit based on the operation unit identification.
另外,命令行缓存器102与信息缓存器20连接;解析电路101在确定当前命令行为第一命令中的首行命令行的情况下,向命令行缓存器102发送命令队列的命令队列标识;命令行缓存器102在向与第一命令对应的第一运算单元发送当前命令行时,向第一信息缓存器发送命令队列标识;其中,第一信息缓存器为与第一运算单元对应的信息缓存器20。In addition, the command line buffer 102 is connected to the information buffer 20; the parsing circuit 101 sends the command queue identifier of the command queue to the command line buffer 102 when it is determined that the current command line is the first command line in the first command; the command When the line buffer 102 sends the current command line to the first operation unit corresponding to the first command, it sends the command queue identifier to the first information buffer; wherein, the first information buffer is the information buffer corresponding to the first operation unit device 20.
本公开另一实施例中,仲裁电路30与信息缓存器20连接;信息缓存器20与多个命令队列分别对应的命令计数器连接;命令行缓存器102向仲裁电路30发送当前命令行、运算单元标识、以及命令队列标识;仲裁电路30向命令分发接口40发送当前命令行、运算单元标识时,向第一信息缓存器发送命令队列标识如图3中
Figure PCTCN2022070709-appb-000007
所示。
In another embodiment of the present disclosure, the arbitration circuit 30 is connected to the information buffer 20 ; the information buffer 20 is connected to command counters corresponding to a plurality of command queues respectively; the command line buffer 102 sends the current command line, the operation unit to the arbitration circuit 30 Identification and command queue identification; when the arbitration circuit 30 sends the current command line and the arithmetic unit identification to the command distribution interface 40, it sends the command queue identification to the first information buffer as shown in Figure 3
Figure PCTCN2022070709-appb-000007
shown.
第一信息缓存器接收命令队列标识;并在接收到第一运算单元将第一命令处理完毕后反馈的确认信息如图3中
Figure PCTCN2022070709-appb-000008
所示后,基于命令队列标识、以及确认信息,向命令计数器105发送第三计数指令如图3中
Figure PCTCN2022070709-appb-000009
所示,且第一信息缓存器在接收到第一运算单元将第一命令处理完毕后反馈的确认信息后,更新命令数量,例如将命令数量减1。
The first information buffer receives the command queue identifier; and the confirmation information fed back after receiving the first operation unit to process the first command is as shown in Figure 3
Figure PCTCN2022070709-appb-000008
After shown, based on the command queue identifier and the confirmation information, a third counting instruction is sent to the command counter 105 as shown in FIG. 3
Figure PCTCN2022070709-appb-000009
As shown, the first information buffer updates the number of commands, for example, decrements the number of commands by 1, after receiving the confirmation information fed back after the first operation unit has processed the first command.
命令计数器105在接收到第一信息缓存器发送的第三计数指令后,将第二计数数值减少第二数值。After receiving the third counting instruction sent by the first information buffer, the command counter 105 reduces the second counting value by the second value.
运算单元在将命令处理完毕之后,向信息缓存器20反馈的确认信息,可例如为确认字符(Acknowledge character,ACK)。After the operation unit completes processing the command, the acknowledgement information fed back to the information buffer 20 may be, for example, an acknowledgement character (Acknowledge character, ACK).
这样,命令计数器105能够实现对与命令队列对应的当前已发送但未被处理完毕 的命令进行计数。In this way, the command counter 105 can count the commands corresponding to the command queue that are currently sent but not yet processed.
需要说明的是,图3中的
Figure PCTCN2022070709-appb-000010
不代表具体的处理顺序,只是为了说明分发电路10获取的当前命令行是当前待发送的第一命令的首行命令行或非首行命令行这两种情况下的处理逻辑。
It should be noted that in Figure 3
Figure PCTCN2022070709-appb-000010
It does not represent a specific processing sequence, but only to illustrate the processing logic in two cases where the current command line acquired by the distribution circuit 10 is the first command line or the non-first command line of the first command to be sent currently.
另外,仲裁电路30每次仲裁后,只会给一个命令行缓存器102返回权限许可信号,也即总线的使用权只能同时给一个命令行缓存器102。仲裁电路30的仲裁逻辑可以基于与仲裁电路30连接的寄存器去定义,例如通过对命令队列的等级划分来仲裁,或者基于轮询的方式仲裁,这里不做限定。In addition, after each arbitration, the arbitration circuit 30 only returns a permission permission signal to one command line register 102 , that is, the right to use the bus can only be given to one command line register 102 at the same time. The arbitration logic of the arbitration circuit 30 may be defined based on the registers connected to the arbitration circuit 30, for example, arbitration is performed by dividing the command queues into levels, or arbitration is based on a polling manner, which is not limited here.
本领域技术人员可以理解,在具体实施方式的上述装置中,各步骤的撰写顺序并不意味着严格的执行顺序而对实施过程构成任何限定,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。Those skilled in the art can understand that, in the above device of the specific embodiment, the writing order of each step does not mean a strict execution order but constitutes any limitation on the implementation process, and the specific execution order of each step should be based on its functions and possible Internal logic is determined.
基于同一发明构思,本公开实施例中还提供了与命令分发装置对应的命令分发方法,由于本公开实施例中的装置解决问题的原理与本公开实施例上述命令分发装置相似,因此装置的实施可以参见方法的实施,重复之处不再赘述。Based on the same inventive concept, the embodiment of the present disclosure also provides a command distribution method corresponding to the command distribution device. Reference may be made to the implementation of the method, and repeated descriptions will not be repeated.
本公开实施例所提供的命令分发方法的执行主体一般为具有一定计算能力的计算机设备,该计算机设备例如包括:命令分发装置、终端设备或服务器或其它处理设备,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等。在一些可能的实现方式中,该命令分发方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。The execution subject of the command distribution method provided by the embodiment of the present disclosure is generally a computer device with a certain computing capability. Equipment, UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (Personal Digital Assistant, PDA), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. In some possible implementations, the command distribution method may be implemented by the processor invoking computer-readable instructions stored in the memory.
下面以执行主体为命令分发装置为例对本公开实施例提供的命令分发方法加以说明。The command distribution method provided by the embodiment of the present disclosure will be described below by taking the execution subject as the command distribution apparatus as an example.
参照图4所示,为本公开实施例提供的一种命令分发方法的示意图,包括:Referring to FIG. 4, a schematic diagram of a command distribution method provided by an embodiment of the present disclosure includes:
S401:至少一个信息缓存器中的各信息缓存器存储对应运算单元中当前未处理完命令的数量作为命令数量、以及对应运算单元的命令数阈值;S401: each information buffer in at least one information buffer stores the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit;
S402:至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取当前待发送的第一命令的首行命令行后,基于首行命令行中携带的运算单元标识,从运算单元标识对应的第一信息缓存器中读取命令数量以及命令数阈值;在命令数量小于命令数阈值的情况下,向仲裁电路发送仲裁请求信号;在接收到仲裁电路基于仲裁请求信号返回的权限许可信号后,向与运算单元标识对应的第一运算单元发送首行命令行。S402: After each distribution circuit in the at least one distribution circuit reads the first command line of the first command to be sent from the command queue corresponding to the distribution circuit, and based on the operation unit identifier carried in the first command line The number of read commands and the threshold of the number of commands in the first information buffer corresponding to the unit identifier; when the number of commands is less than the threshold of the number of commands, send an arbitration request signal to the arbitration circuit; after receiving the authority returned by the arbitration circuit based on the arbitration request signal After the permission signal is received, the first command line is sent to the first operation unit corresponding to the operation unit identifier.
在一种可能的实施方式中,所述预设条件包括:所述命令数量小于所述命令数阈值。In a possible implementation manner, the preset condition includes: the number of commands is less than the threshold of the number of commands.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路在所述命令数量等于所述命令数阈值的情况下,实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;在监测到所述命令数量变化为小于所述命令数阈值后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: when each distribution circuit in the at least one distribution circuit is equal to the command number threshold, monitoring the first command in real time Whether the number of commands in the information buffer has changed to be less than the threshold of the number of commands; after monitoring that the number of commands has changed to be less than the threshold of the number of commands, the arbitration request signal is sent to the arbitration circuit.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个信息缓存器中的各信息缓存器获取动态配置的所述对应运算单元的命令数阈值。其中,所述对应运算单元的命令数阈值,是基于所述对应运算单元中当前未处理完命令所占据的数据存储空间大小、以及所述对应运算单元的数据存储总空间大小确定的。In a possible implementation manner, the command distribution method further includes: each information buffer in the at least one information buffer acquires a dynamically configured command number threshold of the corresponding operation unit. The command number threshold of the corresponding operation unit is determined based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit and the size of the total data storage space of the corresponding operation unit.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路在接收到所述仲裁电路基于所述仲裁请求信号返回的权限许可信号后,向与所述运算单元标识对应的第一运算单元发送所述第一命令。In a possible implementation manner, the command distribution method further includes: after each distribution circuit in the at least one distribution circuit receives a permission permission signal returned by the arbitration circuit based on the arbitration request signal, send the The first operation unit corresponding to the operation unit identifier sends the first command.
在一种可能的实施方式中,所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取当前待发送的第一命令,包括:所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取第一命令的当前命令行。该分发电路在基于 所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值,包括:在所述当前命令行为所述第一命令的首行命令行的情况下,基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值。In a possible implementation manner, each distribution circuit in the at least one distribution circuit reads the first command currently to be sent from a command queue corresponding to the distribution circuit, including: each of the at least one distribution circuit The distribution circuit reads the current command line of the first command from the command queue corresponding to the distribution circuit. The distribution circuit reads the command number and the command number threshold from the first information buffer corresponding to the operation unit identifier based on the operation unit identifier carried in the first command, including: in the current When the command line is the first line of the command line of the first command, based on the operation unit identifier carried in the first command, read the number of commands and the number of commands from the first information buffer corresponding to the operation unit identifier. The command number threshold.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路,在所述当前命令行为所述第一命令的非首行命令行的情况下,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: in each distribution circuit in the at least one distribution circuit, when the current command line is a non-first line command line of the first command , sending the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述命令分发方法,还包括:所述至少一个分发电路中的各分发电路判断所述当前命令行是否为首行命令行。In a possible implementation manner, the command distribution method further includes: each distribution circuit in the at least one distribution circuit determines whether the current command line is the first line of the command line.
在一种可能的实施方式中,所述分发电路响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号,包括:确定所述首行命令行是否为就绪状态;若是,则向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, in response to the number of commands meeting a preset condition, the distribution circuit sends an arbitration request signal to the arbitration circuit, including: determining whether the first line of command lines is in a ready state; if so, sending an arbitration request signal to the arbitration circuit. The arbitration circuit sends the arbitration request signal.
在一种可能的实施方式中,所述首行命令行为就绪状态包括:所述首行命令行所在的第一命令对应的第一运算单元、与所述命令队列最近已发送的第二命令对应的第二运算单元相同;或者,所述第一运算单元、与所述第二运算单元不相同,但所述第二命令被所述第二运算单元处理完毕。In a possible implementation manner, the first-line command line being in a ready state includes: a first operation unit corresponding to the first command where the first-line command line is located, and a second command corresponding to the second command that has been recently sent by the command queue The second operation unit is the same; or, the first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
在一种可能的实施方式中,所述分发电路包括解析电路、以及命令行缓存器;所述解析电路分别和所述命令行缓存器、以及所述信息缓存器连接。所述至少一个分发电路中的各分发电路从与该分发电路对应的命令队列读取第一命令的首行命令行后,基于所述首行命令行中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;在所述命令数量小于所述命令数阈值的情况下,向仲裁电路发送仲裁请求信号,包括:所述解析电路从所述命令队列中读取所述第一命令的当前命令行,并确定所述当前命令行是否为首行命令行;在所述当前命令行为首行命令行的情况下,基于所述首行命令行中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;在所述命令数量小于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行;所述命令行缓存器在接收所述解析电路发送的所述首行命令行后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit includes a parsing circuit and a command line buffer; the parsing circuit is respectively connected to the command line buffer and the information buffer. After each distribution circuit in the at least one distribution circuit reads the first command line of the first command from the command queue corresponding to the distribution circuit, based on the operation unit identifier carried in the first line command line, from the operation The number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the unit identifier; when the number of commands is less than the threshold of the number of commands, an arbitration request signal is sent to the arbitration circuit, including: the The parsing circuit reads the current command line of the first command from the command queue, and determines whether the current command line is the first command line; in the case that the current command line is the first command line, based on the The arithmetic unit identifier carried in the first line of the command line, reads the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arithmetic unit; when the number of commands is less than the threshold of the number of commands In this case, send the first line of the command line to the command line buffer; the command line buffer sends the arbitration request to the arbitration circuit after receiving the first line of the command line sent by the parsing circuit Signal.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路在所述命令数量等于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行、以及第一暂停指令;所述命令行缓存器在接收所述解析电路发送的所述首行命令行以及所述第一暂停指令后,暂停向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: when the number of commands is equal to the threshold of the number of commands, the parsing circuit sends the first line of the command line to the command line buffer , and a first pause command; after receiving the first command line and the first pause command sent by the parsing circuit, the command line buffer pauses sending the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值,在监测到所述命令数量变化为小于所述命令数阈值后,向所述命令行缓存器发送第一启动指令;所述命令行缓存器在接收到所述第一启动指令后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: the parsing circuit monitors in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands, After the number of commands is changed to be less than the threshold of the number of commands, a first activation instruction is sent to the command line buffer; after receiving the first activation instruction, the command line buffer sends the first activation instruction to the arbitration circuit. the arbitration request signal.
在一种可能的实施方式中,所述分发电路还包括命令行计数器;所述命令行计数器与所述解析电路连接。所述解析电路确定所述当前命令行是否为首行命令行,包括:所述解析电路从所述命令队列中读取所述当前命令行后,从所述命令行计数器读取第一计数数值;在所述第一计数数值等于第一预设数值、或等于原始数值的情况下,确定所述当前命令行为所述第一命令中的首行命令行;其中,所述第一预设数值,是基于所述第一命令的命令行行数确定的。In a possible implementation manner, the distribution circuit further includes a command line counter; the command line counter is connected to the parsing circuit. The parsing circuit determining whether the current command line is the first command line includes: after the parsing circuit reads the current command line from the command queue, reading a first count value from the command line counter; In the case that the first count value is equal to the first preset value or equal to the original value, it is determined that the current command line is the first command line in the first command; wherein, the first preset value, is determined based on the number of command line lines of the first command.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路在确定所述当前命令行为首行命令行的情况下,基于所述第一命令的命令行行数更新第一预设数值并向所述命令行计数器发送重置指令;所述命令行计数器接收到所述解析电路发送的重置指令后,将所述第一计数数值重置为原始数值后,增加第一数值。In a possible implementation manner, the command distribution method further includes: when the parsing circuit determines that the current command line is the first command line, updating the first command line based on the number of command lines of the first command Presetting a value and sending a reset instruction to the command line counter; after receiving the reset instruction sent by the parsing circuit, the command line counter resets the first count value to the original value, and increases the first count value numerical value.
在一种可能的实施方式中,所述命令分发方法还包括:所述解析电路在确定所述 当前命令行为所述第一命令的非首行命令行后,向所述命令行计数器发送第一计数指令;所述命令行计数器接收到所述解析电路发送的第一计数指令后,将所述第一计数数值增加第一数值。In a possible implementation manner, the command distribution method further includes: after the parsing circuit determines that the current command line is a non-first line command line of the first command, sending a first command line to the command line counter A counting instruction; after the command line counter receives the first counting instruction sent by the parsing circuit, the first counting value is increased by a first value.
在一种可能的实施方式中,所述分发电路还包括判断电路;所述判断电路分别与所述解析电路、所述命令行缓存器连接。所述命令分发方法还包括:所述解析电路在确定所述当前命令行为所述首行命令行,且在所述命令数量小于所述命令数阈值的情况下,从所述首行命令行中解析所述第一命令对应的运算单元标识,并向所述判断电路发送所述运算单元标识,以及向所述命令行缓存器发送所述当前命令行、以及所述运算单元标识;所述判断电路接收所述解析电路发送的所述运算单元标识,并在基于所述运算单元标识判断所述第一命令对应的第一运算单元和所述命令队列最近已发送的第二命令对应的第二运算单元不同、且所述第二命令未被所述第二运算单元处理完毕的情况下,向所述命令行缓存器发送第二暂停指令;所述命令行缓存器在接收到所述判断电路发送的所述第二暂停指令的情况下,暂停向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the distribution circuit further includes a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer. The command distribution method further includes: when the parsing circuit determines that the current command line is the first line of the command line, and when the number of commands is less than the command number threshold, extracting the command from the first line of the command line. Parse the operation unit identifier corresponding to the first command, send the operation unit identifier to the judgment circuit, and send the current command line and the operation unit identifier to the command line buffer; the judgment The circuit receives the operation unit identifier sent by the parsing circuit, and determines the second operation unit corresponding to the first operation unit corresponding to the first command and the second command recently sent by the command queue based on the operation unit identifier. When the arithmetic units are different and the second command has not been processed by the second arithmetic unit, send a second pause instruction to the command line buffer; the command line buffer receives the judgment circuit When the second pause command is sent, transmission of the arbitration request signal to the arbitration circuit is paused.
在一种可能的实施方式中,所述分发电路还包括命令计数器;所述命令计数器与所述判断电路连接。所述命令分发方法还包括:所述判断电路在接收到所述解析电路发送的所述运算单元标识后,从所述命令计数器中读取第二计数数值,并在所述第二计数数值大于预设数值的情况下,确定所述第二命令未被所述第二运算单元处理完毕。其中,所述命令计数器,用于对与所述命令队列对应的当前已发送但未被处理完毕的命令进行计数。In a possible implementation manner, the distribution circuit further includes a command counter; the command counter is connected to the judgment circuit. The command distribution method further includes: after the judging circuit receives the operation unit identifier sent by the parsing circuit, reading a second count value from the command counter, and when the second count value is greater than In the case of a preset value, it is determined that the second command has not been processed by the second operation unit. Wherein, the command counter is used to count the commands corresponding to the command queue that are currently sent but not yet processed.
在一种可能的实施方式中,所述命令分发方法还包括:所述判断电路在确定所述第二命令未被所述第二运算单元处理完毕的情况下,监测所述命令计数器中的第二计数数值是否变化为第二预设数值;并在监测到所述命令计数器的第二计数数值变化为第二预设数值的情况下,向所述命令行缓存器发送第二启动指令;所述命令行缓存器在接收到所述第二启动指令后,向所述仲裁电路发送所述仲裁请求信号。In a possible implementation manner, the command distribution method further includes: when the judgment circuit determines that the second command has not been processed by the second arithmetic unit, monitoring the first command in the command counter. Whether the second count value has changed to the second preset value; and in the case of monitoring that the second count value of the command counter has changed to the second preset value, send a second start command to the command line buffer; After receiving the second start command, the command line buffer sends the arbitration request signal to the arbitration circuit.
在一种可能的实施方式中,所述命令计数器与所述解析电路连接。所述命令分发方法还包括:所述解析电路在所述当前命令行为首行命令行的情况下,在监测到所述命令行缓存器将所述当前命令行向所述第一运算单元发送后,向所述命令计数器发送第二计数指令;所述命令计数器在接收到所述第二计数指令后,将所述第二计数数值增加第二数值。In a possible implementation, the command counter is connected to the parsing circuit. The command distribution method further includes: when the current command line is the first command line, the parsing circuit detects that the command line buffer sends the current command line to the first computing unit after monitoring that the current command line is sent to the first computing unit. , sending a second counting instruction to the command counter; after receiving the second counting instruction, the command counter increases the second counting value by a second value.
在一种可能的实施方式中,所述信息缓存器与多个命令队列分别对应的命令计数器连接。所述命令分发方法还包括:所述第一信息缓存器在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,基于所述命令行队列标识、以及所述确认信息,向所述命令队列标识对应的命令计数器发送第三计数指令;所述命令计数器在接收到所述第一信息缓存器发送的第三计数指令后,将所述第二计数数值减少第二数值。In a possible implementation manner, the information buffer is connected to command counters corresponding to the plurality of command queues respectively. The command distribution method further includes: after the first information buffer receives the confirmation information fed back after the first operation unit has processed the first command, based on the command line queue identifier and the Confirm the information, and send a third count instruction to the command counter corresponding to the command queue identifier; after the command counter receives the third count instruction sent by the first information buffer, the second count value is reduced by the third count. binary value.
在一种可能的实施方式中,所述命令分发方法还包括:所述第一信息缓存器在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,更新所述命令数量。In a possible implementation manner, the command distribution method further includes: after the first information buffer receives the confirmation information fed back after the first operation unit has processed the first command, updating all the number of commands.
关于方法的处理流程可以参照上述装置实施例中的相关说明,这里不再详述。For the processing flow of the method, reference may be made to the relevant descriptions in the foregoing apparatus embodiments, which will not be described in detail here.
本公开实施例提供一种命令分发过程的具体示例,包括:Embodiments of the present disclosure provide a specific example of a command distribution process, including:
步骤1:解析电路101从命令队列中读取当前待发送的第一命令中的当前命令行,并在读取了当前命令行后,从命令行计数器103中读取第一计数数值。Step 1: The parsing circuit 101 reads the current command line in the first command to be sent from the command queue, and reads the first count value from the command line counter 103 after reading the current command line.
步骤2:解析电路101将第一计数数值和第一预设数值进行比对。如果第一计数数值小于第一预设数值,且大于原始数值,则跳转到步骤3;如果第一计数数值等于第一预设数值或等于原始数值,则跳转至步骤11。Step 2: The parsing circuit 101 compares the first count value with the first preset value. If the first count value is less than the first preset value and greater than the original value, go to step 3; if the first count value is equal to the first preset value or equal to the original value, go to step 11.
步骤3:解析电路101将当前命令行、以及第一命令对应的运算单元标识发送给命令行缓存器102。并向命令行计数器103发送第一计数指令。Step 3: The parsing circuit 101 sends the current command line and the operation unit identifier corresponding to the first command to the command line buffer 102 . And send the first counting instruction to the command line counter 103 .
步骤4:命令行计数器103根据第一计数指令将第一计数数值增加第一数值。Step 4: The command line counter 103 increases the first count value by the first value according to the first count instruction.
步骤5:命令行缓存器102在接收到解析电路发送的当前命令行、以及第一命令对应的运算单元标识后,向仲裁电路发送仲裁请求信号。Step 5: After receiving the current command line sent by the parsing circuit and the operation unit identifier corresponding to the first command, the command line buffer 102 sends an arbitration request signal to the arbitration circuit.
其中,步骤4和步骤5无执行的先后顺序。Wherein, step 4 and step 5 have no order of execution.
步骤6:承接上述步骤5,仲裁电路30接收到各个命令行缓存器104发送的仲裁请求信号后,对各命令行缓存器102进行权限仲裁,并基于权限仲裁的结果,向获得发送权限的命令行缓存器102返回权限许可信号,跳转至步骤7或者跳转至步骤8。Step 6: Following the above step 5, after receiving the arbitration request signal sent by each command line buffer 104, the arbitration circuit 30 performs authority arbitration on each command line buffer 102, and based on the result of the authority arbitration, sends the command to obtain the sending authority. The line buffer 102 returns the permission permission signal, and jumps to step 7 or jumps to step 8 .
步骤7:命令行缓存器102在接收到仲裁电路30发送的权限许可信号后,向命令分发接口40发送当前命令行、以及第一命令对应的运算单元标识,跳转至步骤9。在该种情况下,命令行缓存器102通过仲裁电路,和命令分发接口40连接。Step 7: After receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line and the operation unit identifier corresponding to the first command to the command distribution interface 40, and jumps to step 9. In this case, the command line buffer 102 is connected to the command distribution interface 40 through an arbitration circuit.
步骤8:命令行缓存器102在接收到仲裁电路30发送的权限许可信号后,向仲裁电路30发送当前命令行、以及第一命令对应的运算单元标识,仲裁电路接收到当前命令行、以及第一命令对应的运算单元标识后,向命令分发接口40发送当前命令行、以及第一命令对应的运算单元标识。在该种情况下,命令行缓存器102直接和命令分发接口40连接。Step 8: After receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line and the operation unit identifier corresponding to the first command to the arbitration circuit 30, and the arbitration circuit receives the current command line and the first command. After the operation unit identifier corresponding to a command is sent, the current command line and the operation unit identifier corresponding to the first command are sent to the command distribution interface 40 . In this case, the command line buffer 102 is directly connected to the command distribution interface 40 .
其中,步骤7和步骤8为两种互斥的可能的实施方式。Wherein, step 7 and step 8 are two mutually exclusive possible implementations.
步骤9:承接上述步骤7或者步骤8或者步骤23,命令分发接口40在接收到当前命令行、以及第一命令对应的运算单元标识后,向总线接口发送当前命令行、第一命令对应的运算单元标识。Step 9: Following the above-mentioned step 7 or step 8 or step 23, the command distribution interface 40 sends the current command line and the operation corresponding to the first command to the bus interface after receiving the current command line and the operation unit identifier corresponding to the first command. Unit ID.
步骤10:总线接口在接收到命令分发接口40发送的当前命令行、以及第一命令对应的运算单元标识后,基于运算单元标识向第一命令对应的第一运算单元发送当前命令行,跳转至步骤27。Step 10: After receiving the current command line sent by the command distribution interface 40 and the operation unit identifier corresponding to the first command, the bus interface sends the current command line to the first operation unit corresponding to the first command based on the operation unit identifier, and jumps. Go to step 27.
步骤11:承接上述步骤2,解析电路101向命令行计数器103发送重置指令,并基于第一命令的命令行的行数更新第一预设数值;基于当前命令行中携带的运算单元标识,从运算单元标识对应的第一信息缓存器中读取命令数量以及命令数阈值,向判断电路104发送运算单元标识。Step 11: Following the above step 2, the parsing circuit 101 sends a reset instruction to the command line counter 103, and updates the first preset value based on the number of lines of the command line of the first command; based on the arithmetic unit identifier carried in the current command line, The number of commands and the threshold of the number of commands are read from the first information buffer corresponding to the identifier of the operation unit, and the identifier of the operation unit is sent to the judgment circuit 104 .
步骤12:命令行计数器103接收到解析电路101发送的重置指令后,将第一计数数值重置为原始数值后增加第一数值。Step 12: After receiving the reset instruction sent by the parsing circuit 101, the command line counter 103 resets the first count value to the original value and then increases the first value.
步骤13:解析电路101确定命令数量是否小于命令数阈值;如果是,跳转至步骤15;如果否,跳转至步骤14。Step 13 : the parsing circuit 101 determines whether the number of commands is less than the threshold of the number of commands; if so, go to step 15 ; if not, go to step 14 .
其中,步骤12和步骤13无执行的先后顺序。Wherein, step 12 and step 13 have no order of execution.
步骤14:解析电路101向命令行缓存器102发送当前命令行、运算单元标识、以及第一暂停指令;命令行缓存器102在接收解析电路101发送的当前命令行、运算单元标识以及第一暂停指令后,暂停向仲裁电路发送仲裁请求信号;且解析电路101实时监测第一信息缓存器中的所述命令数量是否变化为小于命令数阈值;在监测到所述命令数量变化为小于命令数阈值后,向命令行缓存器102发送第一启动指令;命令行缓存器102接收到第一启动指令后,跳转至步骤16。Step 14: The parsing circuit 101 sends the current command line, the operation unit identifier and the first pause instruction to the command line buffer 102; the command line buffer 102 receives the current command line, the operation unit identifier and the first pause sent by the parsing circuit 101 After the instruction, suspend sending an arbitration request signal to the arbitration circuit; and the parsing circuit 101 monitors in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands; Then, send the first startup instruction to the command line buffer 102 ; after the command line buffer 102 receives the first startup instruction, it jumps to step 16 .
步骤15:承接步骤13,解析电路101向命令行缓存器102发送当前命令行、运算单元标识;命令行缓存器102在接收到解析电路101发送的当前命令行、运算单元标识后,向仲裁电路发送仲裁请求信号。Step 15: Following Step 13, the parsing circuit 101 sends the current command line and the arithmetic unit identifier to the command line buffer 102; the command line buffer 102 sends the current command line and arithmetic unit identifier sent by the parsing circuit 101 to the arbitration circuit Send an arbitration request signal.
步骤16:判断电路104接收到解析电路101发送的运算单元标识后,读取命令计数器105的第二计数数值,将第二计数数值与第二预设数值进行比较,在第二计数数值等于第二预设数值的情况下,跳转至步骤17,在第二计数数值不等于第二预设数值的情况下,跳转至步骤24。Step 16: After the judgment circuit 104 receives the operation unit identifier sent by the analysis circuit 101, it reads the second count value of the command counter 105, and compares the second count value with the second preset value. In the case of two preset values, go to step 17, and in the case that the second count value is not equal to the second preset value, go to step 24.
步骤17:命令行缓存器102在接收到解析电路101发送的当前命令行、以及第一命令对应的运算单元标识后,向仲裁电路发送仲裁请求信号。Step 17: After receiving the current command line sent by the parsing circuit 101 and the operation unit identifier corresponding to the first command, the command line buffer 102 sends an arbitration request signal to the arbitration circuit.
步骤18:仲裁电路30接收到各个命令行缓存器104发送的仲裁请求信号后,对各命令行缓存器102进行权限仲裁,并基于权限仲裁的结果,向获得发送权限的命令行缓存器102返回权限许可信号,跳转至步骤19或者跳转至步骤20。Step 18: After receiving the arbitration request signal sent by each command line buffer 104, the arbitration circuit 30 performs authority arbitration on each command line buffer 102, and returns to the command line buffer 102 that has obtained the sending authority based on the result of the authority arbitration Permission permission signal, go to step 19 or go to step 20.
步骤19:命令行缓存器102在接收到仲裁电路30发送的权限许可信号后,向命令分发接口40发送当前命令行、以及第一命令对应的运算单元标识,向第一信息缓存器发送当前命令行所在命令队列的命令队列标识,跳转至步骤21。Step 19: After receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line and the operation unit identifier corresponding to the first command to the command distribution interface 40, and sends the current command to the first information buffer. The command queue identifier of the command queue where the line is located, and go to step 21.
步骤20:承接步骤18,命令行缓存器102在接收到仲裁电路30发送的权限许可信号后,向仲裁电路30发送当前命令行、第一命令对应的运算单元标识,以及当前命令行所在命令队列的命令队列标识;仲裁电路30接收到当前命令行、第一命令对应的运算单元标识、以及当前命令行所在命令队列的命令队列标识后,向命令分发接口40发送当前命令行、第一命令对应的运算单元标识,并向该运算单元标识对应的第一信息缓存器发送当前命令行所在命令队列的命令队列标识。Step 20: Following Step 18, after receiving the permission permission signal sent by the arbitration circuit 30, the command line buffer 102 sends the current command line, the operation unit identifier corresponding to the first command, and the command queue where the current command line is located to the arbitration circuit 30. After receiving the current command line, the arithmetic unit identification corresponding to the first command, and the command queue identification of the command queue where the current command line is located, the arbitration circuit 30 sends the current command line and the first command corresponding to the command distribution interface 40. and send the command queue identifier of the command queue where the current command line is located to the first information buffer corresponding to the operation unit identifier.
其中,步骤19和步骤20为两种互斥的可能的实施方式。Among them, step 19 and step 20 are two mutually exclusive possible implementations.
步骤21:承接步骤19或步骤20,命令行缓存器102在发送当前命令行之后,向解析电路101反馈已发送当前命令行的反馈信息。Step 21: Following Step 19 or Step 20, after sending the current command line, the command line buffer 102 feeds back to the parsing circuit 101 feedback information that the current command line has been sent.
步骤22:解析电路101在接收到命令行缓存器102反馈已发送当前命令行的反馈信息后,向命令计数器105发送第二计数指令。Step 22: After receiving the feedback information that the current command line has been sent from the command line buffer 102, the parsing circuit 101 sends a second counting instruction to the command counter 105.
步骤23:命令计数器105接收到解析电路101发送的第二计数指令后,将第二计数数值增加第二数值,跳转至步骤9。Step 23 : after the command counter 105 receives the second count instruction sent by the parsing circuit 101 , it increases the second count value by a second value, and jumps to step 9 .
步骤24:承接步骤16,判断电路104基于运算单元标识,判断第一命令对应的第一运算单元和命令队列最近已发送的第二命令对应的第二运算单元是否一致,是,跳转至步骤17,否,跳转至步骤25。Step 24: Following step 16, the judgment circuit 104 judges, based on the operation unit identifier, whether the first operation unit corresponding to the first command and the second operation unit corresponding to the second command recently sent by the command queue are consistent, yes, jump to step 24 17, no, go to step 25.
步骤25:判断电路104向命令行缓存器102发送第二暂停指令,并实时监测命令计数器105的第二计数数值,直至第二计数数值等于预设数值后,向命令行缓存器102发送第二启动指令。Step 25: The judgment circuit 104 sends the second pause command to the command line register 102, and monitors the second count value of the command counter 105 in real time. Start command.
步骤26:命令行缓存器102接收到判断电路104发送的第二暂停指令后,停止向仲裁电路30发送仲裁请求信号,直至接收到判断电路104发送的第二启动指令后,向仲裁电路发送仲裁请求信号,跳转至步骤18。Step 26: After receiving the second pause command sent by the judgment circuit 104, the command line buffer 102 stops sending the arbitration request signal to the arbitration circuit 30, and sends the arbitration request signal to the arbitration circuit after receiving the second start command sent by the judgment circuit 104. request signal, go to step 18.
步骤27:承接步骤10,第一运算单元在接收到当前待发送的第一命令并处理完毕后,向第一信息缓存器反馈处理完毕的确认信息。Step 27: Following step 10, the first operation unit feeds back the processed confirmation information to the first information buffer after receiving and processing the first command currently to be sent.
步骤28:第一信息缓存器接收到第一运算单元反馈的确认信息后,基于该被处理完毕的命令所在的命令队列标识向对应的命令计数器105发送第三计数指令,并将命令数量减1。Step 28: After receiving the confirmation information fed back by the first arithmetic unit, the first information buffer sends a third counting instruction to the corresponding command counter 105 based on the command queue identifier where the processed command is located, and decrements the number of commands by 1 .
步骤29:命令计数器105接收到第三计数指令后,将第二计数数值减少第二数值。Step 29: After receiving the third counting instruction, the command counter 105 reduces the second counting value by the second value.
本公开实施例还提供了一种芯片,包括如本公开任一实施例所述的命令分发装置。An embodiment of the present disclosure further provides a chip, including the command distribution apparatus according to any embodiment of the present disclosure.
上述命令分发装置的具体执行命令的具体过程可以参考本公开实施例中所述的命令分发方法的步骤,此处不再赘述。For the specific process of executing the command by the above-mentioned command distribution apparatus, reference may be made to the steps of the command distribution method described in the embodiment of the present disclosure, which will not be repeated here.
本公开实施例还提供一种计算机设备,包括本公开任一实施例提供的芯片。An embodiment of the present disclosure further provides a computer device, including the chip provided by any embodiment of the present disclosure.
本公开实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行上述方法实施例中所述的命令分发方法的步骤。其中,该存储介质可以是易失性或非易失的计算机可读取存储介质。Embodiments of the present disclosure further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the steps of the command distribution method described in the foregoing method embodiments are executed. Wherein, the storage medium may be a volatile or non-volatile computer-readable storage medium.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统和方法的具体工作过程,可以参考前述装置实施例中的对应过程,在此不再赘述。在本公开所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可 以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the specific working process of the system and method described above, reference may be made to the corresponding process in the foregoing device embodiments, which will not be repeated here. In the several embodiments provided by the present disclosure, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. The apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本公开各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a processor-executable non-volatile computer-readable storage medium. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of software products in essence, or the parts that contribute to the prior art or the parts of the technical solutions. The computer software products are stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .
最后应说明的是:以上所述实施例,仅为本公开的具体实施方式,用以说明本公开的技术方案,而非对其限制,本公开的保护范围并不局限于此,尽管参照前述实施例对本公开进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本公开实施例技术方案的精神和范围,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present disclosure, and are used to illustrate the technical solutions of the present disclosure, but not to limit them. The protection scope of the present disclosure is not limited to this, although the aforementioned The embodiments describe the present disclosure in detail, and those skilled in the art should understand that: any person skilled in the art can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present disclosure. Or can easily think of changes, or equivalently replace some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered in the present disclosure. within the scope of protection. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims (20)

  1. 一种命令分发装置,其特征在于,包括至少一个分发电路、以及至少一个信息缓存器;其中,每一所述分发电路与所述至少一个信息缓存器连接;A command distribution device, comprising at least one distribution circuit and at least one information buffer; wherein each of the distribution circuits is connected to the at least one information buffer;
    所述至少一个信息缓存器中的各信息缓存器,用于Each information buffer in the at least one information buffer is used for
    存储对应运算单元中当前未处理完命令的数量作为命令数量、以及所述对应运算单元的命令数阈值;Store the number of current unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit;
    所述至少一个分发电路中的各分发电路,用于each distribution circuit in the at least one distribution circuit for
    从与该分发电路对应的命令队列读取当前待发送的第一命令;Read the first command currently to be sent from the command queue corresponding to the distribution circuit;
    基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;Based on the operation unit identifier carried in the first command, read the command number and the command number threshold from the first information buffer corresponding to the operation unit identifier;
    响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号。In response to the number of commands meeting a preset condition, an arbitration request signal is sent to the arbitration circuit.
  2. 根据权利要求1所述的命令分发装置,其特征在于,所述预设条件包括:The command distribution apparatus according to claim 1, wherein the preset conditions include:
    所述命令数量小于所述命令数阈值。The number of commands is less than the number of commands threshold.
  3. 根据权利要求2所述的命令分发装置,其特征在于,所述至少一个分发电路中的各分发电路,还用于在所述命令数量等于所述命令数阈值的情况下,The command distribution apparatus according to claim 2, wherein each distribution circuit in the at least one distribution circuit is further configured to:
    实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;Monitor in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands;
    在监测到所述命令数量变化为小于所述命令数阈值后,向所述仲裁电路发送所述仲裁请求信号。The arbitration request signal is sent to the arbitration circuit after monitoring that the number of commands is changed to be less than the threshold of the number of commands.
  4. 根据权利要求1至3任一项所述的命令分发装置,其特征在于,所述对应运算单元的命令数阈值,是基于所述对应运算单元中当前未处理完命令所占据的数据存储空间大小、以及所述对应运算单元的数据存储总空间大小确定的。The command distribution device according to any one of claims 1 to 3, wherein the command number threshold of the corresponding operation unit is based on the size of the data storage space occupied by the currently unprocessed commands in the corresponding operation unit , and the size of the total data storage space of the corresponding operation unit.
  5. 根据权利要求1至4任一项所述的命令分发装置,其特征在于,所述至少一个分发电路中的各分发电路,还用于:The command distribution device according to any one of claims 1 to 4, wherein each distribution circuit in the at least one distribution circuit is further configured to:
    在接收到所述仲裁电路基于所述仲裁请求信号返回的权限许可信号后,向与所述运算单元标识对应的第一运算单元发送所述第一命令。After receiving the permission permission signal returned by the arbitration circuit based on the arbitration request signal, the first command is sent to the first operation unit corresponding to the operation unit identifier.
  6. 根据权利要求1至5任一项所述的命令分发装置,其特征在于,The command distribution device according to any one of claims 1 to 5, characterized in that:
    所述至少一个分发电路中的各分发电路,在从与该分发电路对应的命令队列读取当前待发送的第一命令时,用于:Each distribution circuit in the at least one distribution circuit, when reading the first command currently to be sent from the command queue corresponding to the distribution circuit, is used for:
    从与该分发电路对应的命令队列读取所述第一命令的当前命令行;Read the current command line of the first command from the command queue corresponding to the distribution circuit;
    该分发电路,在基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值时,用于:The distribution circuit, when reading the number of commands and the threshold of the number of commands from the first information buffer corresponding to the identifier of the arithmetic unit based on the identifier of the arithmetic unit carried in the first command, is used to:
    在所述当前命令行为所述第一命令的首行命令行的情况下,基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值。In the case where the current command line is the first command line of the first command, based on the operation unit identifier carried in the first command, read the information from the first information buffer corresponding to the operation unit identifier the command number and the command number threshold.
  7. 根据权利要求6所述命令分发装置,其特征在于,所述至少一个分发电路中的各分发电路,还用于:The command distribution device according to claim 6, wherein each distribution circuit in the at least one distribution circuit is further configured to:
    在所述当前命令行为所述第一命令的非首行命令行的情况下,向所述仲裁电路发送所述仲裁请求信号。When the current command line is a non-first line command line of the first command, the arbitration request signal is sent to the arbitration circuit.
  8. 根据权利要求6或7所述的命令分发装置,其特征在于,所述至少一个分发电路中的各分发电路,在响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号时,用于:The command distribution device according to claim 6 or 7, wherein each distribution circuit in the at least one distribution circuit, in response to the number of commands meeting a preset condition, sends an arbitration request signal to the arbitration circuit, Used for:
    确定所述第一命令中的首行命令行是否为就绪状态;Determine whether the first line of the command line in the first command is in a ready state;
    若是,则向所述仲裁电路发送所述仲裁请求信号。If so, send the arbitration request signal to the arbitration circuit.
  9. 根据权利要求8所述的命令分发装置,其特征在于,所述第一命令中的首行命令行为就绪状态包括:The command distribution device according to claim 8, wherein the first command line in the first command is in a ready state comprising:
    所述第一命令对应的第一运算单元、与所述命令队列的最近已发送的第二命令对应 的第二运算单元相同;或者,The first operation unit corresponding to the first command is the same as the second operation unit corresponding to the recently sent second command of the command queue; or,
    所述第一运算单元、与所述第二运算单元不相同,但所述第二命令被所述第二运算单元处理完毕。The first operation unit is different from the second operation unit, but the second command has been processed by the second operation unit.
  10. 根据权利要求6至9任一项所述的命令分发装置,其特征在于,所述分发电路包括解析电路、以及命令行缓存器;所述解析电路分别和所述命令行缓存器、以及所述信息缓存器连接;The command distribution device according to any one of claims 6 to 9, wherein the distribution circuit comprises a parsing circuit and a command line buffer; the parsing circuit is respectively associated with the command line buffer and the command line buffer. information buffer connection;
    所述解析电路,用于The parsing circuit for
    从所述命令队列中读取所述第一命令的当前命令行;Read the current command line of the first command from the command queue;
    在所述当前命令行为首行命令行的情况下,基于所述首行命令行中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;In the case where the current command line is the first command line, based on the operation unit identifier carried in the first line of the command line, read the number of commands and the total number of commands from the first information buffer corresponding to the operation unit identifier. the number of commands described above;
    在所述命令数量小于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行;In the case that the number of commands is less than the threshold of the number of commands, sending the first command line to the command line buffer;
    所述命令行缓存器,用于the command line buffer for
    在接收所述解析电路发送的所述首行命令行后,向所述仲裁电路发送所述仲裁请求信号。After receiving the first command line sent by the parsing circuit, the arbitration request signal is sent to the arbitration circuit.
  11. 根据权利要求10所述的命令分发装置,其特征在于,The command distribution device according to claim 10, wherein:
    所述解析电路,还用于:The parsing circuit is also used for:
    在所述命令数量等于所述命令数阈值的情况下,向所述命令行缓存器发送所述首行命令行、以及第一暂停指令;In the case that the number of commands is equal to the threshold of the number of commands, sending the first line of the command line and the first pause instruction to the command line buffer;
    所述命令行缓存器,还用于:The command line cache is also used to:
    在接收所述解析电路发送的所述首行命令行以及所述第一暂停指令后,暂停向所述仲裁电路发送所述仲裁请求信号。After receiving the first line of the command line and the first pause instruction sent by the parsing circuit, the arbitration request signal is paused to be sent to the arbitration circuit.
  12. 根据权利要求11所述的命令分发装置,其特征在于,The command distribution apparatus according to claim 11, wherein:
    所述解析电路,还用于:The parsing circuit is also used for:
    实时监测所述第一信息缓存器中的所述命令数量是否变化为小于所述命令数阈值;Monitor in real time whether the number of commands in the first information buffer changes to be less than the threshold of the number of commands;
    在监测到所述命令数量变化为小于所述命令数阈值后,向所述命令行缓存器发送第一启动指令;After monitoring that the number of commands is changed to be less than the threshold of the number of commands, sending a first activation instruction to the command line buffer;
    所述命令行缓存器,还用于:The command line cache is also used to:
    在接收到所述第一启动指令后,向所述仲裁电路发送所述仲裁请求信号。After receiving the first start instruction, the arbitration request signal is sent to the arbitration circuit.
  13. 根据权利要求10至12任一项所述的命令分发装置,其特征在于,所述分发电路还包括命令行计数器;所述命令行计数器与所述解析电路连接;The command distribution device according to any one of claims 10 to 12, wherein the distribution circuit further comprises a command line counter; the command line counter is connected to the parsing circuit;
    所述解析电路,还用于:The parsing circuit is also used for:
    从所述命令队列中读取所述当前命令行后,从所述命令行计数器读取第一计数数值;After reading the current command line from the command queue, read the first count value from the command line counter;
    在所述第一计数数值等于基于所述第一命令的命令行行数确定的第一预设数值、或等于原始数值的情况下,确定所述当前命令行为所述第一命令中的首行命令行。In the case that the first count value is equal to the first preset value determined based on the number of command line lines of the first command, or is equal to the original value, determining that the current command line is the first line in the first command Command Line.
  14. 根据权利要求13所述的命令分发装置,其特征在于,The command distribution apparatus according to claim 13, wherein:
    所述解析电路,还用于在确定所述当前命令行为首行命令行的情况下,The parsing circuit is further configured to, in the case of determining that the current command line is the first command line,
    基于所述第一命令的命令行行数更新第一预设数值,并update the first preset value based on the number of command line lines of the first command, and
    向所述命令行计数器发送重置指令;sending a reset instruction to the command line counter;
    所述命令行计数器,还用于:The command line counters are also used to:
    接收到所述解析电路发送的重置指令后,将所述第一计数数值重置为原始数值后,增加第一数值。After receiving the reset instruction sent by the parsing circuit, after resetting the first count value to the original value, the first value is increased.
  15. 根据权利要求10至14任一项所述的命令分发装置,其特征在于,所述分发电 路还包括判断电路;所述判断电路分别与所述解析电路、所述命令行缓存器连接;The command distribution device according to any one of claims 10 to 14, wherein the distribution circuit further comprises a judgment circuit; the judgment circuit is respectively connected with the parsing circuit and the command line buffer;
    所述解析电路,还用于在所述当前命令行为所述首行命令行、且所述命令数量小于所述命令数阈值的情况下,The parsing circuit is further configured to, when the current command line is the first line command line and the number of commands is less than the threshold of the number of commands,
    从所述首行命令行中解析所述第一命令对应的运算单元标识;Parse the operation unit identifier corresponding to the first command from the first command line;
    向所述判断电路发送所述运算单元标识,以及sending the arithmetic unit identifier to the judgment circuit, and
    向所述命令行缓存器发送所述当前命令行、以及所述运算单元标识;sending the current command line and the operation unit identifier to the command line buffer;
    所述判断电路,用于:The judgment circuit is used for:
    接收所述解析电路发送的所述运算单元标识,并receiving the operation unit identifier sent by the parsing circuit, and
    在基于所述运算单元标识判断所述第一命令对应的第一运算单元和所述命令队列最近已发送的第二命令对应的第二运算单元不同、且所述第二命令未被所述第二运算单元处理完毕的情况下,向所述命令行缓存器发送第二暂停指令;When it is determined based on the operation unit identifier that the first operation unit corresponding to the first command and the second operation unit corresponding to the second command recently sent by the command queue are different, and the second command is not In the case that the two arithmetic units are processed, send a second pause instruction to the command line buffer;
    所述命令行缓存器,还用于:The command line cache is also used to:
    在接收到所述判断电路发送的所述第二暂停指令的情况下,暂停向所述仲裁电路发送所述仲裁请求信号。In the case of receiving the second pause command sent by the judgment circuit, the transmission of the arbitration request signal to the arbitration circuit is paused.
  16. 根据权利要求15所述的命令分发装置,其特征在于,所述信息缓存器与多个命令队列分别对应的命令计数器连接;The command distribution device according to claim 15, wherein the information buffer is connected to command counters corresponding to a plurality of command queues respectively;
    所述第一信息缓存器,还用于:The first information buffer is also used for:
    在接收到所述第一运算单元将所述第一命令处理完毕后反馈的确认信息后,基于所述命令行队列标识、以及所述确认信息,向所述命令队列标识对应的命令计数器发送第三计数指令;After receiving the confirmation information fed back after the first operation unit has processed the first command, based on the command line queue identifier and the confirmation information, send the first command counter to the command queue identifier corresponding to the command queue identifier. Three counting instructions;
    所述命令计数器,用于:The command counter for:
    在接收到所述第一信息缓存器发送的第三计数指令后,将所述命令计数器的当前第二计数数值减少第二数值。After receiving the third count instruction sent by the first information buffer, the current second count value of the command counter is decreased by a second value.
  17. 一种命令分发方法,其特征在于,应用于命令分发装置,所述命令分发装置包括至少一个分发电路、以及至少一个信息缓存器;其中,每一所述分发电路与所述至少一个信息缓存器连接;所述命令分发方法包括:A command distribution method, characterized by being applied to a command distribution device, the command distribution device comprising at least one distribution circuit and at least one information buffer; wherein, each of the distribution circuits and the at least one information buffer connection; the command distribution method includes:
    所述至少一个信息缓存器中的各信息缓存器存储对应运算单元中当前未处理完命令的数量作为命令数量、以及所述对应运算单元的命令数阈值;Each information buffer in the at least one information buffer stores the number of currently unprocessed commands in the corresponding operation unit as the number of commands and the command number threshold of the corresponding operation unit;
    所述至少一个分发电路中的各分发电路each distribution circuit in the at least one distribution circuit
    从与该分发电路对应的命令队列读取当前待发送的第一命令,Read the first command currently to be sent from the command queue corresponding to the distribution circuit,
    基于所述第一命令中携带的运算单元标识,从所述运算单元标识对应的第一信息缓存器中读取所述命令数量以及所述命令数阈值;Based on the operation unit identifier carried in the first command, read the command number and the command number threshold from the first information buffer corresponding to the operation unit identifier;
    响应于所述命令数量满足预设条件,向仲裁电路发送仲裁请求信号。In response to the number of commands meeting a preset condition, an arbitration request signal is sent to the arbitration circuit.
  18. 一种芯片,其特征在于,包括如权利要求1至16任一项所述的命令分发装置。A chip, characterized by comprising the command distribution device according to any one of claims 1 to 16.
  19. 一种计算机设备,其特征在于,包括指令存储器和如权利要求18所述的芯片。A computer device, characterized in that it includes an instruction memory and a chip as claimed in claim 18 .
  20. 一种计算机可读存储介质,其特征在于,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行如权利要求17所述的命令分发方法的步骤。A computer-readable storage medium, characterized in that, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the command distribution method according to claim 17 are executed.
PCT/CN2022/070709 2021-04-29 2022-01-07 Command distribution apparatus and method, chip, computer device, and medium WO2022227693A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110476337.X 2021-04-29
CN202110476337.XA CN113138802B (en) 2021-04-29 2021-04-29 Command distribution device, method, chip, computer device and storage medium

Publications (1)

Publication Number Publication Date
WO2022227693A1 true WO2022227693A1 (en) 2022-11-03

Family

ID=76816584

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/070709 WO2022227693A1 (en) 2021-04-29 2022-01-07 Command distribution apparatus and method, chip, computer device, and medium

Country Status (2)

Country Link
CN (1) CN113138802B (en)
WO (1) WO2022227693A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113138802B (en) * 2021-04-29 2024-03-05 上海阵量智能科技有限公司 Command distribution device, method, chip, computer device and storage medium
CN113138801B (en) * 2021-04-29 2023-08-04 上海阵量智能科技有限公司 Command distribution device, method, chip, computer device and storage medium
CN114265717A (en) * 2021-12-30 2022-04-01 上海阵量智能科技有限公司 Instruction synchronization device, chip, computer equipment and data processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298628A (en) * 2014-09-30 2015-01-21 中国电子科技集团公司第三十八研究所 Data storage device arbitration circuit and method for concurrent access
CN105243033A (en) * 2015-09-28 2016-01-13 联想(北京)有限公司 Data processing method and electronic device
US20170185542A1 (en) * 2015-12-24 2017-06-29 Arm Limited Arbitration of requests requiring a variable number of resources
CN112597080A (en) * 2020-12-29 2021-04-02 联芸科技(杭州)有限公司 Read request control device and method and memory controller
CN113138802A (en) * 2021-04-29 2021-07-20 上海阵量智能科技有限公司 Command distribution device, method, chip, computer equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007265303A (en) * 2006-03-29 2007-10-11 Brother Ind Ltd Computer program
JP5722264B2 (en) * 2012-03-23 2015-05-20 株式会社日立ハイテクノロジーズ Data processing apparatus and data capacity increase suppressing method
US20170109203A1 (en) * 2015-10-15 2017-04-20 International Business Machines Corporation Task scheduling
CN110825312B (en) * 2018-08-10 2023-06-23 昆仑芯(北京)科技有限公司 Data processing device, artificial intelligent chip and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298628A (en) * 2014-09-30 2015-01-21 中国电子科技集团公司第三十八研究所 Data storage device arbitration circuit and method for concurrent access
CN105243033A (en) * 2015-09-28 2016-01-13 联想(北京)有限公司 Data processing method and electronic device
US20170185542A1 (en) * 2015-12-24 2017-06-29 Arm Limited Arbitration of requests requiring a variable number of resources
CN112597080A (en) * 2020-12-29 2021-04-02 联芸科技(杭州)有限公司 Read request control device and method and memory controller
CN113138802A (en) * 2021-04-29 2021-07-20 上海阵量智能科技有限公司 Command distribution device, method, chip, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113138802B (en) 2024-03-05
CN113138802A (en) 2021-07-20

Similar Documents

Publication Publication Date Title
WO2022227693A1 (en) Command distribution apparatus and method, chip, computer device, and medium
WO2022227614A1 (en) Command distribution apparatus and method, chip, computer device, and storage medium
US7953915B2 (en) Interrupt dispatching method in multi-core environment and multi-core processor
WO2018076793A1 (en) Nvme device, and methods for reading and writing nvme data
US8893146B2 (en) Method and system of an I/O stack for controlling flows of workload specific I/O requests
US20200218662A1 (en) Data caching device and control method therefor, data processing chip, and data processing system
CN104572974B (en) service request processing method and device
CN108023829B (en) Message processing method and device, storage medium and electronic equipment
US20230421512A1 (en) Packet processing with reduced latency
US8447897B2 (en) Bandwidth control for a direct memory access unit within a data processing system
CN107743137B (en) File uploading method and device
US9798591B2 (en) Method, apparatus, and chip for implementing mutually-exclusive operation of multiple threads
CN114567607B (en) Multi-port arbitration method, device, equipment and computer readable storage medium
CN115934625B (en) Doorbell knocking method, equipment and medium for remote direct memory access
CN116627869B (en) Data transmission method and device applied to electronic equipment
CN115964319A (en) Data processing method for remote direct memory access and related product
CN117389766A (en) Message sending method and device, storage medium and electronic device
CN115469804B (en) NVMe multi-queue arbitration method and device
WO2023093805A1 (en) Storage control method, storage controller, storage chip, network card, and readable medium
CN115981893A (en) Message queue task processing method and device, server and storage medium
WO2022227561A1 (en) Apparatus and method for data reading, chip, computer device, and storage medium
CN112732176B (en) SSD (solid State disk) access method and device based on FPGA (field programmable Gate array), storage system and storage medium
CN116136790A (en) Task processing method and device
CN113076138B (en) NVMe command processing method, device and medium
US9934184B1 (en) Distributed ordering system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22794176

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22794176

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 22794176

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 160424)