Arbitration system, method, electronic device, storage medium and chip
By designing an arbitration system in a high-performance computing system and using the age information and timestamp information of thread blocks to prioritize longer-lived and residual thread groups, the problem of memory access pauses is solved and computing efficiency and performance are improved.
Patent Information
- Application Number
- CN202210114541.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-30
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-01-30
AI Technical Summary
In high-performance computing systems, memory access pauses often occur during the transfer of data between internal registers and external memories, causing the computing unit to wait for a long time, reducing the processing efficiency of the chip, and the existing polling arbitration method cannot effectively prioritize the survival. Longer thread blocks and residual thread groups lead to overall performance degradation.
An arbitration system is designed. Through the thread block control module and the memory access module working together, the age information and timestamp information of the thread block are used to determine the priority of access instructions, and priority is given to thread blocks and residual thread groups that have survived longer to improve Memory access efficiency.
It effectively reduces the running time of the thread block, improves the utilization rate of the thread block and the overall performance of the chip, and improves the processing efficiency of the high-performance computing system.
Smart Images

Figure CN114490074B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of integrated circuit technology, and in particular to an arbitration system, method, electronic device, storage medium and chip. Background Art
[0002] With the continuous development of artificial intelligence and high-performance computing, the amount of data that needs to be processed by the computing units in the chip is becoming increasingly large. During the calculation process, a large amount of data needs to be transferred between internal registers and external memory. Once a memory access pause occurs during data transfer, such as a long period of inability to return to load data, the computing unit will wait for a long time, which will cause the processing efficiency of the chip to drop seriously. With the continuous improvement of the computing power of multi-threaded parallel processors, improving the memory access efficiency of computing units has gradually become one of the bottlenecks of chip design. Therefore, in the circuit design of high-performance computing systems such as artificial intelligence, efficient arbitration design of multi-threaded group read and write memory access is particularly important. Summary of the invention
[0003] In view of this, the present disclosure at least provides an arbitration system, method, electronic device, storage medium and chip.
[0004] In a first aspect, the present disclosure provides an arbitration system, including: a thread block control module and a memory access module;
[0005] The thread block control module is used to determine the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block; wherein each thread block includes at least one thread group; and send the timeliness information corresponding to the thread group in each thread block to the memory access module;
[0006] The memory access module is used to determine the relative priority information between multiple access instructions based on the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; and based on the received relative priority information, determine at least one target access instruction for performing a memory access operation from multiple access instructions.
[0007] Here, the thread block control module is used to determine the timeliness information of at least one started thread block, and the obtained timeliness information of at least one thread group is sent to the memory access module. The timeliness information may include age information used to characterize the relative survival time between different thread blocks, and / or timestamp information used to characterize the number of times the thread block executes a task. The memory access module can more accurately determine the relative priority information between multiple access instructions based on the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; for example, the larger the age information, the higher the priority. Based on the received relative priority information, at least one target access instruction for performing a memory access operation is more accurately determined from multiple access instructions.
[0008] In an optional implementation, the memory access module includes a priority detection unit and an arbitration unit;
[0009] The priority detection unit is used to determine relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group; and send the determined relative priority information to the arbitration unit;
[0010] The arbitration unit is used to receive multiple access instructions and send the thread group identifier corresponding to the access instruction to the priority detection unit; and based on the received relative priority information, determine at least one target access instruction for performing a memory access operation from the multiple access instructions.
[0011] In a possible implementation, the aging information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times a thread block executes a task.
[0012] In a possible implementation, the thread block control module includes: a thread block age generation unit;
[0013] The thread block age generation unit is used to determine, based on the received first start instruction, that the age information of the newly started thread block corresponding to the first start instruction is a preset value, and to increase the current age information of other thread blocks among the started thread blocks except the newly started thread block by a first target value to obtain updated age information corresponding to the other thread blocks;
[0014] And the updated age information corresponding to the newly started thread block and the thread groups included in the other thread blocks is sent to the priority detection unit; wherein the first start instruction is used to start a new thread block.
[0015] In the disclosed embodiment, the thread block age generation unit is used to determine the age information of each started thread block according to the first start instruction. For example, each time a new thread block is started, the age information of other started thread blocks can be increased by one to obtain updated age information of multiple thread blocks. The age information can characterize the relative survival time between different thread blocks. The larger the age information, the longer the survival time. The updated age information corresponding to the thread groups included in the newly started thread block and other thread blocks is then sent to the priority detection unit to provide data support for the priority detection unit to determine the relative priority information, so that the priority detection unit can more accurately determine the relative priority information between multiple access instructions based on the age information of at least one thread group.
[0016] In a possible implementation manner, the priority detection unit includes a thread block priority detection unit; the thread block priority detection unit is connected to the thread block age generation unit and the arbitration unit respectively;
[0017] The thread block priority detection unit is used to receive updated age information corresponding to each thread group sent by the thread block age generation unit; and determine relative priority information between multiple access instructions based on the received updated age information corresponding to each thread group and the thread group identifier corresponding to the access instruction sent by the arbitration unit; and send the determined relative priority information to the arbitration unit; wherein the age information is positively correlated with the priority.
[0018] In order to balance the execution time of tasks among various thread blocks, the access instructions of at least one thread group in the thread block with a longer survival time can be given priority response, so as to reduce the running time of the thread block and improve the performance of the chip including multiple thread blocks. Based on this, the thread block priority detection unit can more accurately determine the relative priority information among multiple access instructions based on the received updated age information corresponding to each thread group and the thread group identifier corresponding to the access instruction sent by the arbitration unit according to the principle of positive correlation between age information and priority.
[0019] In a possible implementation manner, the thread block control module includes: a thread block timestamp generation unit;
[0020] The thread block timestamp generating unit is configured to increase the current timestamp information of the first thread block that executes the second start instruction by a second target value based on the received second start instruction to obtain updated timestamp information of the first thread block; and send the real-time timestamp information corresponding to at least one thread group included in the started thread block to the priority detection unit;
[0021] Among them, the second start instruction is used to start an existing thread block to execute a new task; the real-time timestamp information corresponding to the at least one thread group includes: the updated timestamp information corresponding to the first thread group included in the first thread block, and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks.
[0022] In the disclosed embodiment, the thread block timestamp generation unit is used to increase the current timestamp information of the first thread block that executes the second start instruction by a second target value according to the second start instruction, so as to obtain the updated timestamp information of the first thread block. For example, each time the first thread block is started, the timestamp information of the first thread block can be increased by one to obtain the updated timestamp information; the timestamp information can more accurately reflect the number of executions of the first thread block. Then, the real-time timestamp information corresponding to at least one thread group included in the started thread block is sent to the priority detection unit, so as to provide data support for the priority detection unit to determine the relative priority information, so that the priority detection unit can more accurately determine the relative priority information between multiple access instructions based on the real-time timestamp information of the thread group and the in-path timestamp information corresponding to the access instruction.
[0023] In a possible implementation manner, the priority detection unit includes a residual thread group detection unit; the residual thread group detection unit is connected to the thread block timestamp generation unit and the arbitration unit respectively;
[0024] The residual thread group detection unit is configured to receive the real-time timestamp information corresponding to the at least one thread group sent by the thread block timestamp generation unit, the thread group identifier corresponding to the access instruction sent by the arbitration unit, and the in-path timestamp information included in the access instruction; and
[0025] Determine relative priority information among a plurality of access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction, and the in-path timestamp information included in the access instruction; and send the determined relative priority information to the arbitration unit;
[0026] Among them, the in-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the in-path timestamp information.
[0027] When a thread block is executing a current task, if the calculation part of the current task is completed, the thread block can be controlled to execute a new task. However, when the thread block is executing the new task, the memory access task of the previous task may not have been completed. In order to give priority to the thread block in this case, so as to release the thread block as soon as possible and improve the utilization rate of the thread block, a residual thread group detection unit can be set. The thread group residual detection unit determines the relative priority information between multiple access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction and the in-path timestamp information included in the access instruction. For example, the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information can be set to the highest; wherein the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is the thread group included in the thread block in the above situation.
[0028] In a possible implementation manner, the memory access module further includes: at least one thread group instruction transmission unit; the thread group instruction transmission unit is connected to the arbitration unit; wherein each thread group corresponds to at least one thread group instruction transmission unit;
[0029] The thread group instruction transmission unit is used to receive an access instruction sent by a thread group matching the thread group instruction transmission unit, and send the access instruction to the arbitration unit.
[0030] In the above implementation, the access instruction may be sent to the arbitration unit through the thread group instruction transmission unit that matches the thread group corresponding to the access instruction, thereby improving the efficiency and accuracy of the transmission.
[0031] The effects of the following methods, chips, electronic devices, etc. are described in the description of the above system and will not be repeated here.
[0032] In a second aspect, the present disclosure provides a chip, including: the arbitration system and storage unit described in the first aspect or any embodiment;
[0033] The arbitration system is used to determine at least one target access instruction for executing a memory access operation from a plurality of access instructions, and send the target access instruction to the storage unit so as to perform a memory access operation on the storage unit based on the target access instruction.
[0034] Since the chip includes the arbitration system described in the first aspect or any one of the embodiments, the arbitration system can reduce the running time of the thread blocks and improve the utilization rate of the thread blocks, so that the performance of the chip is better.
[0035] In a third aspect, the present disclosure provides an arbitration method, comprising:
[0036] Based on the received start instruction for instructing to start the thread block, determine the timeliness information of at least one started thread block; wherein each thread block includes at least one thread group; the timeliness information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times the thread block executes a task;
[0037] Determine relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group;
[0038] At least one target access instruction for executing a memory access operation is determined from a plurality of access instructions based on the received relative priority information.
[0039] In a possible implementation manner, the aging information includes age information, and determining relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the aging information corresponding to at least one thread group includes:
[0040] Determining age information of a thread group that matches the thread group identifier corresponding to the access instruction from age information corresponding to at least one thread group;
[0041] Based on the age information of the thread group matching the thread group identifier, relative priority information between the plurality of access instructions is determined; wherein the age information is positively correlated with the priority.
[0042] In a possible implementation manner, the timeliness information includes timestamp information, and determining relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group includes:
[0043] Determine, from the timeliness information corresponding to at least one thread group, the real-time timestamp information of the thread group that matches the thread group identifier corresponding to the access instruction;
[0044] Based on the real-time timestamp information and the consistency information of the on-path timestamp information included in the access instruction, the relative priority information between the multiple access instructions is determined; wherein the on-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the on-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the on-path timestamp information.
[0045] In a fourth aspect, the present disclosure provides an arbitration device, including:
[0046] A first determination module is used to determine the timeliness information of at least one started thread block based on a received start instruction for instructing to start the thread block; wherein each thread block includes at least one thread group; the timeliness information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times the thread block executes a task;
[0047] A second determination module, configured to determine relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group;
[0048] The third determination module is used to determine at least one target access instruction for executing a memory access operation from a plurality of access instructions based on the received relative priority information.
[0049] In a possible implementation manner, the aging information includes age information, and the second determination module, when determining relative priority information between a plurality of the access instructions according to the thread group identifier corresponding to the received access instruction and the aging information corresponding to at least one thread group, is configured to:
[0050] Determining age information of a thread group that matches the thread group identifier corresponding to the access instruction from age information corresponding to at least one thread group;
[0051] Based on the age information of the thread group matching the thread group identifier, relative priority information between the plurality of access instructions is determined; wherein the age information is positively correlated with the priority.
[0052] In a possible implementation manner, the timeliness information includes timestamp information, and the second determination module, when determining relative priority information between a plurality of the access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group, is configured to:
[0053] Determine, from the timeliness information corresponding to at least one thread group, the real-time timestamp information of the thread group that matches the thread group identifier corresponding to the access instruction;
[0054] Based on the real-time timestamp information and the consistency information of the on-path timestamp information included in the access instruction, the relative priority information between the multiple access instructions is determined; wherein the on-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the on-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the on-path timestamp information.
[0055] In a fifth aspect, the present disclosure provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the steps of the arbitration method described in the third aspect or any embodiment are performed; or the chip described in the second aspect.
[0056] In a sixth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the arbitration method as described in the third aspect or any one of the embodiments above are executed.
[0057] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0059] Figure 1 A schematic diagram of the architecture of an arbitration system provided by an embodiment of the present disclosure is shown;
[0060] Figure 2 A schematic diagram of the architecture of another arbitration system provided by an embodiment of the present disclosure is shown;
[0061] Figure 3 A schematic diagram of the architecture of another arbitration system provided by an embodiment of the present disclosure is shown;
[0062] Figure 4 A schematic diagram of the architecture of another arbitration system provided by an embodiment of the present disclosure is shown;
[0063] Figure 5 A schematic diagram of the architecture of a chip provided by an embodiment of the present disclosure is shown;
[0064] Figure 6 A schematic diagram of a flow chart of an arbitration method provided by an embodiment of the present disclosure is shown;
[0065] Figure 7A schematic diagram of the architecture of an arbitration device provided by an embodiment of the present disclosure is shown;
[0066] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0068] With the continuous development of artificial intelligence and high-performance computing, the amount of data that needs to be processed by the computing units in the chip is becoming increasingly large. During the calculation process, a large amount of data needs to be transferred between internal registers and external memory. Once a memory access pause occurs during data transfer, such as a long period of inability to return to load data, the computing unit will wait for a long time, which will cause the processing efficiency of the chip to drop seriously. With the continuous improvement of the computing power of multi-threaded parallel processors, improving the memory access efficiency of computing units has gradually become one of the bottlenecks of chip design. Therefore, in the circuit design of high-performance computing systems such as artificial intelligence, efficient arbitration design of multi-threaded group read and write memory access is particularly important.
[0069] Generally, a polling arbitration method can be used to arbitrate access requests between multiple thread groups. For example, when any thread group has a memory access request, the memory access request signal can be set high, and the arbitration unit uses the last selected request port ID recorded in the register as the starting point to find the next valid request port and update the next valid request port ID into the register.
[0070] However, the above polling arbitration method cannot give priority to the access requests of thread blocks that have been running for a long time, nor can it give priority to the remaining thread groups in the thread block, resulting in a decrease in the overall performance of the chip. The remaining thread groups in the thread block refer to the thread groups that have completed the computing tasks but have not completed the memory access tasks.
[0071] In order to alleviate the above problems, the embodiments of the present disclosure provide an arbitration system, method, device, electronic device, storage medium and chip.
[0072] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0073] To facilitate understanding of the embodiments of the present disclosure, an arbitration system disclosed in the embodiments of the present disclosure is first introduced in detail.
[0074] See also Figure 1 As shown, it is a schematic diagram of the architecture of the arbitration system provided by the embodiment of the present disclosure, including: a thread block control module 11 and a memory access module 12; specifically:
[0075] The thread block control module 11 is used to determine the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block; wherein each thread block includes at least one thread group; and send the timeliness information corresponding to the thread group in each thread block to the memory access module.
[0076] The memory access module is used to determine the relative priority information between multiple access instructions based on the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; and based on the received relative priority information, determine at least one target access instruction for performing a memory access operation from multiple access instructions.
[0077] During implementation, the thread block control module can determine the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block. The thread block includes at least one thread group, and the timeliness information of each thread group included in the thread block is the timeliness information corresponding to the thread block. After obtaining the timeliness information of the thread block, the thread block control module sends the timeliness information corresponding to the thread group in each thread block to the memory access module.
[0078] The memory access module determines the relative priority information between the multiple access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; for example, the priority of access instruction one is higher than that of access instruction two, and the priority of access instruction two is higher than that of access instruction three, etc. And based on the received relative priority information, at least one target access instruction for executing the memory access operation is determined from the multiple access instructions, that is, the target access instruction can be determined in order of priority, for example, access instruction one can be determined as the target access instruction.
[0079] In an optional implementation, the memory access module includes a priority detection unit 121 and an arbitration unit 122 .
[0080] The arbitration unit 122 is used to receive multiple access instructions and send the thread group identifiers corresponding to the access instructions to the priority detection unit;
[0081] The priority detection unit 121 is used to determine the relative priority information between multiple access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; and send the determined relative priority information to the arbitration unit.
[0082] The arbitration unit 122 is further configured to determine at least one target access instruction for executing a memory access operation from a plurality of access instructions based on the received relative priority information.
[0083] The timeliness information includes age information used to characterize the relative survival time between different thread blocks, and / or timestamp information used to characterize the number of times a thread block executes a task.
[0084] The hardware circuits corresponding to the thread block control module and the memory access module can be implemented as logic circuits obtained by connecting basic gate circuits such as AND gates, NOT gates, OR gates, and timing logic components such as registers, triggers, and encoders according to the functions of the modules. The implementation method of the hardware circuit is not described here.
[0085] During implementation, when the chip is working, after other modules in the chip (such as a control module that controls each thread block) generate a start instruction, the start instruction can be sent to the thread block control module 11. The start instruction is an instruction for starting a thread block. The start instruction may include a first start instruction for starting a new thread block; and / or a second start instruction for starting an existing thread block to perform a new task.
[0086] The thread block control module 11 is used to determine the timeliness information of at least one thread block that has been started according to the start instruction. Each thread block includes at least one thread group. The timeliness information of each thread group included in the thread block is consistent, that is, the timeliness information corresponding to the thread block is the timeliness information of each thread group in the thread block. The timeliness information may include age information and / or timestamp information. The age information is used to characterize the relative survival time between different thread blocks. For example, if the age information of thread block 1 is 1 and the age information of thread block 2 is 2, it means that the survival time of thread block 2 is greater than the survival time of thread block 1. The timestamp information is used to characterize the number of times the thread block executes a task. For example, when the timestamp information of thread block 1 is 4, the number of times the thread block 1 is executed is N×c+4, where c is the number of operation cycles, and N is the number of executions included in each operation cycle. When c is 1 and N is 14, the number of tasks executed by the thread block is 1×14+4=18 times.
[0087] After determining the timeliness information of each thread block, the thread block control module 11 may send the timeliness information corresponding to the thread groups included in each thread block to the priority detection unit 121 based on the dimension of the thread group. For example, timeliness information 1 of thread group 1, timeliness information 2 of thread group 2, etc.
[0088] When the thread group needs to access the storage unit, it generates an access instruction, each of which includes a thread group identifier, and sends the generated access instruction to the arbitration unit.
[0089] When receiving an access instruction, the arbitration unit may send the thread group identifier corresponding to the access instruction to the priority detection unit.
[0090] The priority detection unit 121 determines the relative priority information between multiple access instructions based on the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to each thread group. For example, when the timeliness information includes age information, the larger the age information of the thread group, the higher the priority of the thread group. If the age information of multiple thread groups is consistent, the priorities of the multiple thread groups are consistent. The determined relative priority information can then be sent to the arbitration unit 122.
[0091] The arbitration unit 122 determines at least one target access instruction for executing a memory access operation from a plurality of access instructions according to the received relative priority information. The number of the target access instructions may be one or more. During implementation, the target access instruction may be determined from a plurality of access instructions in descending order of priority. When the priorities of the plurality of access instructions are consistent, the target access instruction may be selected from the plurality of access instructions with consistent priorities in a round-robin manner.
[0092] Here, the thread block control module is used to determine the timeliness information of at least one started thread block, and the obtained timeliness information of at least one thread group is sent to the memory access module. The timeliness information may include age information used to characterize the relative survival time between different thread blocks, and / or timestamp information used to characterize the number of times the thread block executes a task. The memory access module can more accurately determine the relative priority information between multiple access instructions based on the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; for example, the larger the age information, the higher the priority. Based on the received relative priority information, at least one target access instruction for performing a memory access operation is more accurately determined from multiple access instructions.
[0093] In an alternative embodiment, see Figure 2 As shown, the thread block control module 11 may include: a thread block age generation unit 111;
[0094] The thread block age generation unit 111 is used to determine, based on the received first start instruction, that the age information of the newly started thread block corresponding to the first start instruction is a preset value, and to increase the current age information of other thread blocks among the started thread blocks except the newly started thread block by a first target value to obtain updated age information corresponding to the other thread blocks; and to send the updated age information corresponding to the newly started thread block and the thread groups included in the other thread blocks to the priority detection unit; wherein the first start instruction is used to start a new thread block.
[0095] The first start instruction is used to start a new thread block. During implementation, the thread block age generation unit determines the age information of each started thread block according to the received first start instruction. The started thread block includes the newly started thread block and the thread block that existed before the first start instruction.
[0096] The thread block age generation unit 111 determines, according to the first start instruction, that the age information of the newly started thread block corresponding to the first start instruction is a preset value (obtaining the updated age information of the newly started thread block); and increases the current age information of other thread blocks except the newly started thread block in the started thread blocks by the first target value to obtain the updated age information of other thread blocks. The preset value and the first target value can be set as needed. For example, if the preset value is 0, the first target value is 1, and the started thread blocks include: the newly started thread block 1, other thread blocks 2 (current age information is 2), and other thread blocks 3 (current age information is 3), then it is determined that the updated age information of the newly started thread block 1 corresponding to the first start instruction is 0, the updated age information corresponding to other thread blocks 1 is 3, and the updated age information corresponding to other thread blocks 3 is 4.
[0097] The thread block age generation unit 111 then sends the updated age information corresponding to the newly started thread block and the thread groups included in other thread blocks to the priority detection unit.
[0098] In the disclosed embodiment, the thread block age generation unit is used to determine the age information of each started thread block according to the first start instruction. For example, each time a new thread block is started, the age information of other started thread blocks can be increased by one to obtain updated age information of multiple thread blocks. The age information can characterize the relative survival time between different thread blocks. The larger the age information, the longer the survival time. The updated age information corresponding to the thread groups included in the newly started thread block and other thread blocks is then sent to the priority detection unit to provide data support for the priority detection unit to determine the relative priority information, so that the priority detection unit can more accurately determine the relative priority information between multiple access instructions based on the age information of at least one thread group.
[0099] In an optional implementation, the priority detection unit 121 includes a thread block priority detection unit 1211; the thread block priority detection unit 1211 is connected to the thread block age generation unit 111 and the arbitration unit 122 respectively;
[0100] The thread block priority detection unit 1211 is used to receive updated age information corresponding to each thread group sent by the thread block age generation unit; and determine relative priority information between multiple access instructions based on the received updated age information corresponding to each thread group and the thread group identifier corresponding to the access instruction sent by the arbitration unit; and send the determined relative priority information to the arbitration unit; wherein the age information is positively correlated with the priority.
[0101] During implementation, the thread block age generation unit 111 may send updated age information corresponding to the newly started thread block and the thread groups included in other thread blocks to the thread block priority detection unit 1211. And after receiving the access instruction, the arbitration unit 122 may send the thread group identifier corresponding to the access instruction to the priority detection unit 1211.
[0102] The thread block priority detection unit 1211 determines the age information of the thread groups corresponding to the multiple access instructions from the updated age information of each thread group received according to the thread group identifier corresponding to the access instruction sent by the arbitration unit 122. Then, the relative priority information of the multiple access instructions is determined according to the age information of the thread groups corresponding to the multiple access instructions. For example, the relative priority information may be: the priority of access instruction 1 corresponding to thread group 1 is the highest, the priority of access instruction 2 corresponding to thread group 2 is the second highest, etc. Alternatively, the priority of access instruction 1 corresponding to thread group 1 is the first, the priority of access instruction 2 corresponding to thread group 2 is the second, etc.
[0103] Generally, the older the age information of a thread group is, the longer the running time of the thread group is. In order to give priority to responding to thread groups with longer running time, so that the running time between various thread groups is balanced, a positive correlation between age information and priority can be set. Among them, the age information of a thread group is positively correlated with the priority of the access instruction corresponding to the thread group. That is, the older the age information of a thread group is, the higher the priority of the access instruction corresponding to the thread group is; if the age information of multiple thread groups is consistent, the priority of the access instructions corresponding to the multiple thread groups is consistent.
[0104] The thread block priority detection unit 1211 then sends the determined relative priority information to the arbitration unit 122 .
[0105] In order to balance the execution time of tasks among various thread blocks, priority can be given to the access instructions of at least one thread group in the thread block with a longer survival time, so as to reduce the running time of the thread block and improve the performance of the chip including multiple thread blocks. Based on this, the thread block priority detection unit can more accurately determine the relative priority information among multiple access instructions based on the received updated age information corresponding to each thread group and the thread group identifier corresponding to the access instruction sent by the arbitration unit according to the principle of positive correlation between age information and priority.
[0106] In an alternative embodiment, see Figure 3 As shown, the thread block control module 11 may include: a thread block timestamp generation unit 112;
[0107] The thread block timestamp generating unit 112 is configured to increase the current timestamp information of the first thread block that executes the second start instruction by a second target value based on the received second start instruction to obtain updated timestamp information of the first thread block; and send the real-time timestamp information corresponding to at least one thread group included in the started thread block to the priority detection unit;
[0108] Among them, the second start instruction is used to start an existing thread block to execute a new task; the real-time timestamp information corresponding to the at least one thread group includes: the updated timestamp information corresponding to the first thread group included in the first thread block, and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks.
[0109] The second start instruction is used to start an existing thread block to execute a new task. Generally, when the operation part of the current task of the thread block is completed, the control module in the chip can generate a second start instruction to start the thread block to execute the next new task. When the operation part of the current task of the thread block is completed and the next task is started, the memory access part of the current task may not be completed. At this time, the priority of the thread block needs to be set to the highest so that the memory access part of the thread block can be executed more quickly to improve the utilization rate of the thread block. During implementation, it can be determined based on the timestamp information of the thread block whether the thread block is a thread block that has not executed the memory access part of the previous task but has started a new task.
[0110] During implementation, the thread block timestamp generation unit 112 increases the current timestamp information of the first thread block that executes the second start instruction by the second target value according to the second start instruction, and obtains the updated timestamp information of the first thread block. The second target value can be set as needed. For example, if the second target value is 1 and the current timestamp information of the first thread block is 3, the updated timestamp information of the first thread block is 4.
[0111] Furthermore, the updated timestamp information corresponding to the first thread group included in the first thread block in the started thread blocks and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks constitute the real-time timestamp information corresponding to at least one thread group. The first thread group is each thread group in the first thread block; the second thread group is each thread group in the second thread block.
[0112] During implementation, the thread block timestamp generation unit 112 may send the updated timestamp information corresponding to the first thread group included in the first thread block and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks to the priority detection unit. That is, the updated timestamp information corresponding to the first thread group may be used as the real-time timestamp information corresponding to the first thread group, and the current timestamp information corresponding to the second thread group may be used as the real-time timestamp information corresponding to the second thread group. The real-time timestamp information corresponding to at least one thread group included in the started thread block is sent to the priority detection unit.
[0113] Alternatively, the thread block timestamp generation unit 112 may send the updated timestamp information corresponding to the first thread group included in the first thread block to the priority detection unit, so as to replace the current timestamp information of the first thread group stored in the priority detection unit, and use the replaced timestamp information as the real-time timestamp information of the first thread group. And the current timestamp information of each thread group in the second thread block is the real-time timestamp information corresponding to the thread group.
[0114] In the disclosed embodiment, the thread block timestamp generation unit is used to increase the current timestamp information of the first thread block that executes the second start instruction by a second target value according to the second start instruction, so as to obtain the updated timestamp information of the first thread block. For example, each time the first thread block is started, the timestamp information of the first thread block can be increased by one to obtain the updated timestamp information; the timestamp information can more accurately reflect the number of executions of the first thread block. Then, the real-time timestamp information corresponding to at least one thread group included in the started thread block is sent to the priority detection unit, so as to provide data support for the priority detection unit to determine the relative priority information, so that the priority detection unit can more accurately determine the relative priority information between multiple access instructions based on the real-time timestamp information of the thread group and the in-path timestamp information corresponding to the access instruction.
[0115] Wherein, in the case where the thread block control module includes the thread block age generation unit 111 and the thread block timestamp generation unit 112, if the started thread blocks include thread block 1, thread block 2, and thread block 3, after starting a new thread block (i.e., thread block 4) in response to the first start instruction, the thread block age generation unit 111 determines that the age information of thread block 4 is a preset value (e.g., 0), and increases the current age information of thread block 1, thread block 2, and thread block 3 by a first target value (e.g., by 1), and obtains the updated age information corresponding to thread block 1, thread block 2, thread block 3, and thread block 4. That is, after starting a new thread block in response to the first start instruction, the age of the newly started thread block is determined to be a preset value, and the age of each started thread block is increased by the first target value.
[0116] After controlling the started thread block to execute a new task in response to the second start instruction, for example, after controlling thread block 2 to execute a new task in response to the second start instruction, the thread block timestamp generation unit 112 can determine to increase the current timestamp information of thread block 2 by the second target value (for example, by 1) according to the second start instruction, and obtain the updated timestamp information corresponding to thread block 2, and the current timestamp information of other started thread blocks such as thread block 1, thread block 3, and thread block 4 does not change. That is, after starting the started thread block to execute a new task in response to the second start instruction, the age information of the thread block executing the new task is updated, and the age information of other thread blocks does not change.
[0117] In an optional implementation manner, the priority detection unit 121 includes a residual thread group detection unit 1212; the residual thread group detection unit 1212 is connected to the thread block timestamp generation unit 112 and the arbitration unit 122 respectively;
[0118] The residual thread group detection unit 1212 is used to receive the real-time timestamp information corresponding to the at least one thread group sent by the thread block timestamp generation unit, and the thread group identifier corresponding to the access instruction sent by the arbitration unit, and the in-path timestamp information included in the access instruction; and determine the relative priority information between multiple access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction, and the in-path timestamp information included in the access instruction; and send the determined relative priority information to the arbitration unit.
[0119] Among them, the in-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the in-path timestamp information.
[0120] The thread block timestamp generation unit 112 may send the real-time timestamp information corresponding to at least one thread group included in the started thread block to the residual thread group detection unit 1212. And the arbitration unit 122 may send the thread group identifier corresponding to the access instruction and the in-path timestamp information included in the access instruction to the residual thread group detection unit 1212.
[0121] The residual thread group detection unit 1212, after receiving the real-time timestamp information corresponding to at least one thread group sent by the thread block timestamp generation unit, the thread group identifier corresponding to the access instruction sent by the arbitration unit, and the on-path timestamp information included in the access instruction, determines the real-time timestamp information of the thread group corresponding to the thread group identifier from the real-time timestamp information corresponding to the at least one thread group. Then, for each thread group corresponding to the thread group identifier, determine whether the real-time timestamp information of the thread group is consistent with the on-path timestamp information of the access instruction corresponding to the thread group. If they are inconsistent, the priority of the access instruction corresponding to the thread group is the highest; if they are consistent, the priority of the access instruction corresponding to the thread group is the second highest. That is, the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the on-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the on-path timestamp information. The on-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated.
[0122] Furthermore, relative priority information between multiple access instructions is obtained. The residual thread group detection unit 1212 may send the determined relative priority information to the arbitration unit.
[0123] It can be seen that when the computation part of the current task of the thread block is completed and the next task is started, and the memory access part of the current task is not completed, the real-time timestamp information of the thread group in the thread block will change (i.e., the second target value will be increased) because the thread block starts the next task, but the access instruction corresponding to the thread group is generated before the thread block starts the next task, and the on-path timestamp in the access instruction corresponding to the thread group will not change, which will cause the real-time timestamp information of the thread group to be inconsistent with the on-path timestamp in the access instruction corresponding to the thread group. Therefore, the priority of the access instruction with inconsistent real-time timestamp and on-path timestamp can be set to the highest.
[0124] When a thread block is executing a current task, if the calculation part of the current task is completed, the thread block can be controlled to execute a new task. However, when the thread block is executing the new task, the memory access task of the previous task may not have been completed. In order to give priority to the thread block in this case, so as to release the thread block as soon as possible and improve the utilization rate of the thread block, a residual thread group detection unit can be set. The thread group residual detection unit determines the relative priority information between multiple access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction and the in-path timestamp information included in the access instruction. For example, the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information can be set to the highest; wherein the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is the thread group included in the thread block in the above situation.
[0125] In an alternative embodiment, see Figure 4 As shown, the memory access module 12 also includes: at least one thread group instruction transmission unit 123; the thread group instruction transmission unit 123 is connected to the arbitration unit 122; wherein each thread group corresponds to at least one thread group instruction transmission unit 123; wherein the thread group instruction transmission unit 123 is used to receive an access instruction sent by a thread group matching the thread group instruction transmission unit, and send the access instruction to the arbitration unit 122.
[0126] During implementation, each thread group may correspond to one thread group instruction transmission unit, or each thread group may correspond to multiple thread group instruction transmission units, or multiple thread groups may correspond to one thread group instruction transmission unit. The number of thread group instruction transmission units and the mapping relationship between thread group instruction transmission units and thread groups may be set as required.
[0127] After receiving the access instruction sent by the corresponding thread group, each thread group instruction transmission unit sends the received access instruction to the arbitration unit 122. In the above implementation, the access instruction can be sent to the arbitration unit through the thread group instruction transmission unit matching the thread group corresponding to the access instruction, thereby improving the efficiency and accuracy of the sending.
[0128] Combination Figure 4 , the execution process of the arbitration system is illustrated by way of example.
[0129] First, the thread block age generation unit determines the age information of each started thread block according to the received first start instruction, and sends the age information of each thread group in the thread block to the thread block priority detection unit.
[0130] Second, the thread block timestamp generation unit determines the updated timestamp information of the first thread block corresponding to the second start instruction according to the received second start instruction, and sends the real-time timestamp information corresponding to at least one thread group included in the started thread block to the priority detection unit.
[0131] Among them, the real-time timestamp information corresponding to at least one thread group includes: updated timestamp information corresponding to the first thread group included in the first thread block, and current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks.
[0132] Third, after generating the access instruction, the thread group may send the access instruction to the arbitration unit through the thread group instruction transmission unit matching the thread group.
[0133] Fourth, the arbitration unit sends the thread group identifier corresponding to the access instruction to the thread block priority detection unit; and the arbitration unit may send the thread group identifier corresponding to the access instruction and the on-path timestamp corresponding to the access instruction to the residual thread group detection unit.
[0134] Fifth, the thread block priority detection unit can determine the first relative priority information among the multiple access instructions according to the age information corresponding to each thread group and the thread group identifier corresponding to the access instruction; and send the first relative priority information among the multiple access instructions to the arbitration unit.
[0135] Sixth, the residual thread group detection unit can determine the second relative priority information between multiple access instructions based on the real-time timestamp information corresponding to each thread group, the thread group identifier corresponding to the access instruction, and the in-path timestamp corresponding to the access instruction; and send the second relative priority information between the multiple access instructions to the arbitration unit.
[0136] Seventh, the arbitration unit determines at least one target access instruction from the multiple access instructions according to the received first relative priority information and the second relative priority information.
[0137] For example, the arbitration unit can determine whether there is an access instruction with an in-path timestamp and a real-time timestamp that are inconsistent in the second relative priority information. If so, the access instruction is determined as the target access instruction. If not, or if the number of determined target access instructions is insufficient, the target access instruction can be determined based on the first relative priority information. If the priorities of multiple access instructions are consistent, the target access instruction can be determined based on polling.
[0138] Those skilled in the art will appreciate that, in the above-mentioned system of a specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0139] Based on the same concept, the present disclosure also provides a chip, see Figure 5 As shown, it is a schematic diagram of the architecture of a chip provided by an embodiment of the present disclosure, including: the arbitration system 501 and the storage unit 502 of the above-mentioned implementation mode, specifically:
[0140] The arbitration system 501 is used to determine at least one target access instruction for executing a memory access operation from multiple access instructions, and send the target access instruction to the storage unit 502, so as to perform a memory access operation on the storage unit 502 based on the target access instruction.
[0141] Since the chip includes the arbitration system described in the first aspect or any one of the embodiments, the arbitration system can reduce the running time of the thread blocks and improve the utilization rate of the thread blocks, so that the performance of the chip is better.
[0142] Based on the same concept, the present disclosure also provides an arbitration method, see Figure 6 As shown, it is a flowchart of the arbitration method provided by the embodiment of the present disclosure, including S601-S603, specifically:
[0143] S601, based on a received start instruction for instructing to start a thread block, determining the timeliness information of at least one started thread block; wherein each thread block includes at least one thread group; the timeliness information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times a thread block executes a task;
[0144] S602, determining relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group;
[0145] S603: Determine at least one target access instruction for executing a memory access operation from a plurality of access instructions based on the received relative priority information.
[0146] In an optional implementation, the timeliness information includes age information, and determining relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group includes:
[0147] Determining age information of a thread group that matches the thread group identifier corresponding to the access instruction from age information corresponding to at least one thread group;
[0148] Based on the age information of the thread group matching the thread group identifier, relative priority information between the plurality of access instructions is determined; wherein the age information is positively correlated with the priority.
[0149] During implementation, the age information of the thread group that matches the thread group identifier corresponding to the access instruction can be determined from the timeliness information corresponding to at least one thread group. Then, the relative priority information between the multiple access instructions can be determined based on the age information of the thread group that matches the thread group identifier. For example, the relative priority information can be determined in descending order of the age information, for example, the larger the age information, the higher the priority.
[0150] In an optional implementation, the timeliness information includes timestamp information, and determining relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group includes:
[0151] Determine, from the timeliness information corresponding to at least one thread group, the real-time timestamp information of the thread group that matches the thread group identifier corresponding to the access instruction;
[0152] Based on the real-time timestamp information and the consistency information of the on-path timestamp information included in the access instruction, the relative priority information between the multiple access instructions is determined; wherein the on-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the on-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the on-path timestamp information.
[0153] During implementation, it can be determined whether the real-time timestamp information of the thread group corresponding to the access instruction and the on-path timestamp information included in the access instruction are consistent. If they are consistent, the consistency information is determined to be consistent; if they are inconsistent, the consistency information is determined to be inconsistent. Then, the relative priority information between multiple access instructions can be determined based on the determined consistency information. For example, when the real-time timestamp information of the thread group corresponding to the access instruction and the consistency information of the on-path timestamp information included in the access instruction indicate inconsistency, it is determined that the access instruction has the highest priority.
[0154] In a possible implementation manner, determining the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block includes:
[0155] Based on the received first start instruction, determine that the age information of the newly started thread block corresponding to the first start instruction is a preset value, and increase the current age information of other thread blocks among the started thread blocks except the newly started thread block by a first target value to obtain updated age information corresponding to the other thread blocks; and send the updated age information corresponding to the newly started thread block and the thread groups included in the other thread blocks to the priority detection unit; wherein the first start instruction is used to start a new thread block.
[0156] In a possible implementation manner, determining relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group includes:
[0157] Based on the updated age information corresponding to each thread group received and the thread group identifier corresponding to the access instruction sent by the arbitration unit, relative priority information between multiple access instructions is determined; and the determined relative priority information is sent to the arbitration unit; wherein the age information is positively correlated with the priority.
[0158] In a possible implementation manner, determining the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block includes:
[0159] Based on the received second start instruction, the current timestamp information of the first thread block executing the second start instruction is increased by a second target value to obtain updated timestamp information of the first thread block; and the real-time timestamp information corresponding to at least one thread group included in the started thread block is sent to the priority detection unit;
[0160] Among them, the second start instruction is used to start an existing thread block to execute a new task; the real-time timestamp information corresponding to the at least one thread group includes: the updated timestamp information corresponding to the first thread group included in the first thread block, and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks.
[0161] In a possible implementation manner, determining relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group includes:
[0162] Receive the real-time timestamp information corresponding to the at least one thread group sent by the thread block timestamp generation unit, the thread group identifier corresponding to the access instruction sent by the arbitration unit, and the in-path timestamp information included in the access instruction;
[0163] Determine relative priority information among a plurality of access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction, and the in-path timestamp information included in the access instruction; and send the determined relative priority information to the arbitration unit;
[0164] Among them, the in-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the in-path timestamp information.
[0165] In a possible implementation manner, the method further includes:
[0166] An access instruction sent by a thread group matching the thread group instruction transmission unit is received, and the access instruction is sent to the arbitration unit.
[0167] Based on the same concept, the present disclosure also provides an arbitration device, see Figure 7 As shown, it is a schematic diagram of the architecture of the arbitration device provided in the embodiment of the present disclosure, including a first determination module 701, a second determination module 702, and a third determination module 703. Specifically:
[0168] A first determining module 701 is used to determine the timeliness information of at least one started thread block based on a received start instruction for instructing to start the thread block; wherein each thread block includes at least one thread group; the timeliness information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times the thread block executes a task;
[0169] A second determination module 702, configured to determine relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group;
[0170] The third determination module 703 is used to determine at least one target access instruction for executing a memory access operation from a plurality of access instructions based on the received relative priority information.
[0171] In a possible implementation manner, the aging information includes age information, and the second determining module 702, when determining relative priority information between a plurality of the access instructions according to the thread group identifier corresponding to the received access instruction and the aging information corresponding to at least one thread group, is configured to:
[0172] Determining age information of a thread group that matches the thread group identifier corresponding to the access instruction from age information corresponding to at least one thread group;
[0173] Based on the age information of the thread group matching the thread group identifier, relative priority information between the plurality of access instructions is determined; wherein the age information is positively correlated with the priority.
[0174] In a possible implementation manner, the timeliness information includes timestamp information, and the second determination module 702, when determining relative priority information between a plurality of the access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group, is configured to:
[0175] Determine, from the timeliness information corresponding to at least one thread group, the real-time timestamp information of the thread group that matches the thread group identifier corresponding to the access instruction;
[0176] Based on the real-time timestamp information and the consistency information of the on-path timestamp information included in the access instruction, the relative priority information between the multiple access instructions is determined; wherein the on-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the on-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the on-path timestamp information.
[0177] In a possible implementation manner, when determining the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block, the first determination module 701 is configured to:
[0178] Based on the received first start instruction, determine that the age information of the newly started thread block corresponding to the first start instruction is a preset value, and increase the current age information of other thread blocks among the started thread blocks except the newly started thread block by a first target value to obtain updated age information corresponding to the other thread blocks; and send the updated age information corresponding to the newly started thread block and the thread groups included in the other thread blocks to the priority detection unit; wherein the first start instruction is used to start a new thread block.
[0179] In a possible implementation manner, the second determination module 702, when determining the relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group, is configured to:
[0180] Based on the updated age information corresponding to each thread group received and the thread group identifier corresponding to the access instruction sent by the arbitration unit, relative priority information between multiple access instructions is determined; and the determined relative priority information is sent to the arbitration unit; wherein the age information is positively correlated with the priority.
[0181] In a possible implementation manner, when determining the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block, the first determination module 701 is configured to:
[0182] Based on the received second start instruction, the current timestamp information of the first thread block executing the second start instruction is increased by a second target value to obtain updated timestamp information of the first thread block; and the real-time timestamp information corresponding to at least one thread group included in the started thread block is sent to the priority detection unit;
[0183] Among them, the second start instruction is used to start an existing thread block to execute a new task; the real-time timestamp information corresponding to the at least one thread group includes: the updated timestamp information corresponding to the first thread group included in the first thread block, and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks.
[0184] In a possible implementation manner, the second determination module 702, when determining the relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group, is configured to:
[0185] Receive the real-time timestamp information corresponding to the at least one thread group sent by the thread block timestamp generation unit, the thread group identifier corresponding to the access instruction sent by the arbitration unit, and the in-path timestamp information included in the access instruction;
[0186] Determine relative priority information among a plurality of access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction, and the in-path timestamp information included in the access instruction; and send the determined relative priority information to the arbitration unit;
[0187] Among them, the in-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the in-path timestamp information.
[0188] In a possible implementation manner, the device further includes: a receiving module, configured to receive an access instruction sent by a thread group matching the thread group instruction transmission unit, and send the access instruction to the arbitration unit.
[0189] In some embodiments, the functions or templates contained in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0190] Based on the same technical concept, the embodiment of the present disclosure also provides an electronic device. Figure 8 As shown, it is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, including a processor 801, a memory 802, and a bus 803. Among them, the memory 802 is used to store execution instructions, including a memory 8021 and an external memory 8022; the memory 8021 here is also called an internal memory, which is used to temporarily store the operation data in the processor 801, and the data exchanged with the external memory 8022 such as a hard disk. The processor 801 exchanges data with the external memory 8022 through the memory 8021. When the electronic device 800 is running, the processor 801 communicates with the memory 802 through the bus 803, so that the processor 801 executes the following instructions:
[0191] Based on the received start instruction for instructing to start the thread block, determine the timeliness information of at least one started thread block; wherein each thread block includes at least one thread group; the timeliness information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times the thread block executes a task;
[0192] Determine relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group;
[0193] At least one target access instruction for executing a memory access operation is determined from a plurality of access instructions based on the received relative priority information.
[0194] The specific processing flow of the processor 801 may refer to the description of the above method embodiment, which will not be repeated here.
[0195] In addition, the embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the arbitration method described in the above method embodiment are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0196] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the arbitration method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0197] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0198] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0199] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0200] 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 separately, or two or more units may be integrated into one unit.
[0201] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0202] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. An arbitration system, characterized in that: include: Thread block control module and memory access module; wherein, The thread block control module is used to determine the timeliness information of at least one started thread block based on the received start instruction for instructing to start the thread block; wherein each thread block includes at least one thread group; and send the timeliness information corresponding to the thread group in each thread block to the memory access module; the timeliness information includes timestamp information for representing the number of times the thread block executes a task; The memory access module is used to determine relative priority information between multiple access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; and determine at least one target access instruction for performing a memory access operation from the multiple access instructions based on the received relative priority information; The memory access module includes a priority detection unit and an arbitration unit; the thread block control module includes: a thread block timestamp generation unit; The priority detection unit includes a residual thread group detection unit; the residual thread group detection unit is connected to the thread block timestamp generation unit and the arbitration unit respectively; The residual thread group detection unit is used to receive the real-time timestamp information corresponding to the at least one thread group sent by the thread block timestamp generation unit, and the thread group identifier corresponding to the access instruction sent by the arbitration unit, and the on-path timestamp information included in the access instruction; and determine the relative priority information between multiple access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction, and the on-path timestamp information included in the access instruction; and send the determined relative priority information to the arbitration unit; The arbitration unit is used to determine at least one target access instruction for performing a memory access operation from a plurality of access instructions based on the relative priority information; Among them, the in-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the in-path timestamp information.
2. The arbitration system according to claim 1, characterized in that: The aging information also includes age information for representing the relative survival time between different thread blocks.
3. The arbitration system according to claim 1 or 2, characterized in that: The priority detection unit is used to determine relative priority information between a plurality of access instructions according to a thread group identifier corresponding to the received access instruction and timeliness information corresponding to at least one thread group; and sending the determined relative priority information to the arbitration unit; The arbitration unit is used to receive multiple access instructions and send thread group identifiers corresponding to the access instructions to the priority detection unit; And based on the received relative priority information, at least one target access instruction for executing a memory access operation is determined from a plurality of access instructions.
4. The arbitration system according to claim 3, characterized in that: The thread block control module includes: a thread block age generation unit; The thread block age generation unit is used to determine, based on the received first start instruction, that the age information of the newly started thread block corresponding to the first start instruction is a preset value, and to increase the current age information of other thread blocks among the started thread blocks except the newly started thread block by a first target value to obtain updated age information corresponding to the other thread blocks; And the updated age information corresponding to the newly started thread block and the thread groups included in the other thread blocks is sent to the priority detection unit; wherein the first start instruction is used to start a new thread block.
5. The arbitration system according to claim 4, characterized in that: The priority detection unit comprises a thread block priority detection unit; the thread block priority detection unit is connected to the thread block age generation unit and the arbitration unit respectively; The thread block priority detection unit is used to receive updated age information corresponding to each thread group sent by the thread block age generation unit; and determining relative priority information between the plurality of access instructions based on the received updated age information corresponding to each of the thread groups and the thread group identifier corresponding to the access instruction sent by the arbitration unit; And the determined relative priority information is sent to the arbitration unit; wherein the age information is positively correlated with the priority.
6. The arbitration system according to any one of claims 3 to 5, characterized in that: The thread block timestamp generating unit is configured to increase the current timestamp information of the first thread block that executes the second start instruction by a second target value based on the received second start instruction to obtain updated timestamp information of the first thread block; and send the real-time timestamp information corresponding to at least one thread group included in the started thread block to the priority detection unit; Among them, the second start instruction is used to start an existing thread block to execute a new task; the real-time timestamp information corresponding to the at least one thread group includes: the updated timestamp information corresponding to the first thread group included in the first thread block, and the current timestamp information corresponding to the second thread group included in the second thread block other than the first thread block in the started thread blocks.
7. The arbitration system according to any one of claims 1 to 6, characterized in that: The memory access module further includes: at least one thread group instruction transmission unit; the thread group instruction transmission unit is connected to the arbitration unit; wherein each thread group corresponds to at least one thread group instruction transmission unit; The thread group instruction transmission unit is used to receive an access instruction sent by a thread group matching the thread group instruction transmission unit, and send the access instruction to the arbitration unit.
8. A chip, characterized in that: include: The arbitration system and storage unit according to any one of claims 1 to 7; The arbitration system is used to determine at least one target access instruction for executing a memory access operation from a plurality of access instructions, and send the target access instruction to the storage unit so as to perform a memory access operation on the storage unit based on the target access instruction.
9. An arbitration method, characterized in that: include: Based on the received start instruction for instructing to start the thread block, determine the timeliness information of at least one started thread block; wherein each thread block includes at least one thread group; the timeliness information includes age information for representing the relative survival time between different thread blocks, and / or timestamp information for representing the number of times the thread block executes a task; the timeliness information includes: real-time timestamp information corresponding to the at least one thread group; Determine relative priority information between the plurality of access instructions according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group; Determining at least one target access instruction for performing a memory access operation from a plurality of access instructions based on the received relative priority information; The determining, according to the thread group identifier corresponding to the received access instruction and the timeliness information corresponding to at least one thread group, relative priority information between the plurality of access instructions comprises: Determine relative priority information among a plurality of access instructions based on the real-time timestamp information corresponding to the thread group, the thread group identifier corresponding to the access instruction, and the associated timestamp information included in the access instruction; Among them, the in-path timestamp information is the timestamp corresponding to the thread group when the access instruction is generated; the priority of the access instruction corresponding to the thread group whose real-time timestamp information is inconsistent with the in-path timestamp information is higher than the access instruction corresponding to the thread group whose real-time timestamp information is consistent with the in-path timestamp information.
10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the arbitration method according to claim 9 are performed; or The chip as claimed in claim 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the arbitration method according to claim 9 are executed.
