Thread bundle scheduling method based on fusion scheduling strategy, scheduler and storage medium

Through the thread bundle scheduling method based on the converged scheduling strategy, the thread bundle state is dynamically monitored and adjusted, and the resource idle and waiting time increase caused by improper thread bundle scheduling in the prior art is solved, and the execution efficiency and resource utilization of GPGPU are improved.

CN118964030APending Publication Date: 2024-11-15SHANDONG INSPUR SCI RES INST CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411099033.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The existing thread beam scheduling mechanism cannot accurately predict the execution status of thread beams, resulting in increased waiting time for GPGPU cores and may cause idle computing resources and pipeline stagnation in multi-threaded environments.

Method used

Using a thread bundle scheduling method based on a fusion scheduling strategy, thread blocks are organized into different thread bundles through the thread block scheduling unit, and scheduled according to the activation table and mask table of the thread bundle state management unit. GTO scheduling policy and branch stack are used. Algorithm implements dynamic monitoring and adjustment of thread bundles, and quickly switches thread bundles to hide access delays.

Benefits of technology

It improves the execution efficiency and resource utilization of GPGPU, reduces power consumption, avoids waste of computing resources, reduces waiting time and pipeline stagnation, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964030A_ABST
    Figure CN118964030A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer internal thread beam scheduling, and discloses a thread beam scheduling method based on a fusion scheduling strategy, a scheduler and a storage medium, and the method comprises the steps: employing the fusion scheduling strategy to select one or more activated corresponding thread beams through analysis and check, and marking the information of the thread beams; and meanwhile, constructing a thread beam activation table, a thread mask table, a thread beam PC table, a thread beam stagnation table and a branch stack table. Through optimization design of a thread beam scheduling strategy and a scheduler, dynamic monitoring and adjustment of a thread beam state are realized. For a special branch instruction, a branch stack table is constructed by adopting a stack algorithm, invalid threads are shielded, power consumption is reduced, and waste of computing resources is avoided. In addition, according to the fusion scheduling strategy, access delay is hidden through rapid switching between thread bundles and more executable instructions in the thread bundles, assembly line stagnation is avoided, waiting time is shortened, the execution efficiency and the resource utilization rate of the GPGPU are greatly improved, and the overall performance of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of thread warp scheduling within a computer, and for example, to a thread warp scheduling method, a scheduler, and a storage medium based on a fusion scheduling strategy. Background Art

[0002] With the development of computer technology, especially the growing demand in areas such as high-performance computing, artificial intelligence and big data processing, the demand for computing resources is also increasing.

[0003] General-purpose graphics processing units (GPGPUs) play a key role in many computationally intensive tasks due to their powerful parallel processing capabilities and high computing density. As an important component of GPGPU, the warp scheduler is responsible for selecting one or more warps from the ready warps and sending them to the execution unit. This process involves two key stages: instruction fetching and execution. Therefore, the design of a suitable scheduler and scheduling strategy needs to comprehensively consider the complexity and overhead of hardware design as well as the complex situations that may arise during program execution, such as long-delay operations and multi-threaded execution progress balance, so as to achieve overall optimization of performance, resources and power consumption. The existing warp scheduling mechanism may not be able to accurately predict the execution status of the warp, resulting in an increase in the waiting time of the GPGPU core. In addition, in a multi-threaded environment, improper warp scheduling strategies often lead to idle computing resources and pipeline stagnation.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0006] The embodiment of the present disclosure provides a thread warp scheduling method based on a fusion scheduling strategy, the method comprising:

[0007] The thread block scheduling unit organizes the threads in the thread block into different thread warps according to a preset manner through a mapping relationship, and sends the thread warps to the thread warp scheduling unit for emission and execution;

[0008] After receiving the thread warp, the thread warp scheduling unit sets a corresponding table entry of the thread warp activation table according to the thread warp WID based on the thread warp state management unit to indicate that the corresponding thread warp is in an activated state;

[0009] The warp scheduling unit updates the instruction PC and thread mask of the warp initialization to the corresponding warp PC table and thread mask table respectively;

[0010] The thread warp scheduling unit divides the thread warps into multiple groups of fixed sizes according to the preset fusion scheduling strategy. The priorities of the groups are set based on the GroupID and polling scheduling is performed. The thread warps in the group adopt the GTO scheduling strategy and are executed in sequence until all the thread warps in the group cannot be executed. Then the groups are switched until all groups are executed.

[0011] In some embodiments, when a branch instruction appears in a thread warp, the scheduler enters a branch processing flow; the branch processing flow includes:

[0012] The subsequent execution unit generates the branch PC generated by the branch instruction. branch , branch mask and branch convergence instruction PC conver Push into the branch stack table;

[0013] After detecting that the stack table is not empty, the next instruction PC of the thread warp where the branch instruction appears will no longer be obtained from the thread warp PC table, but the stack table will be read to obtain the instruction PC branch and thread mask;

[0014] According to the instruction PC branch Get instruction I from the buffer queue branch After that, based on the GTO scheduling policy, the instruction PC of the thread bundle where the branch instruction appears will be changed from PC branch Automatically increment until a branch convergence instruction PC is encountered conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

[0015] In some embodiments, the thread warps in the group adopt a GTO scheduling strategy, including:

[0016] When the thread warps include W0, W1 and W2, the priority is W0>W2>W1 based on the time when the thread warps are activated. Each thread warp executes 4 instructions in its own instruction queue, of which 3 are immediately executed instructions, namely I1, I2 and I4, and 1 is a memory access instruction, namely I3.

[0017] Initially, W0 first reads the I1 instruction from the instruction cache instr_queue.w0 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. After I1 is emitted, the PC value automatically increases and continues to read I2 and emit it until it encounters the memory access instruction I3 of W0. The state of W0 is changed to stalled and the state of W0 is written into the thread bundle stall table. After that, W2 in G1 continues to be scheduled. W2 reads the I1 instruction from the instruction cache instr_queue.w2 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. The process is consistent with the scheduling process of W0.

[0018] In some embodiments, when the thread warps are W0, W1, W2, W3, W4, and W5, the thread warps are divided into a plurality of fixed-size groups, including thread groups G1 and G2, wherein G1 includes W0, W1, and W2, and G2 includes W3, W4, and W5;

[0019] When all the thread warps in G1 are blocked, thread warps W3, W4, and W5 in G2 are scheduled in the same way as G1.

[0020] When all the thread warps in G2 are blocked from execution, the instruction queues of the thread warps in G1 are rescheduled and the scheduling is repeated until all active thread warps are in a stopped state.

[0021] In some embodiments, each warp contains 32 threads, and the mask table corresponds to the warp one by one.

[0022] The thread warp scheduler based on the fusion scheduling strategy provided by the embodiment of the present disclosure is characterized in that the scheduler includes:

[0023] A thread block scheduling unit, used to organize threads in a thread block into different thread warps according to a preset manner through a mapping relationship, and send the thread warps to the thread warp scheduling unit for emission and execution;

[0024] A warp scheduling unit, configured to, after receiving the warp, set a corresponding entry in the warp activation table according to the warp WID based on the warp state management unit, so as to indicate that the corresponding warp is in an activated state;

[0025] The thread warp scheduling unit is further used to update the instruction PC and thread mask of the thread warp initialization to the corresponding thread warp PC table and thread mask table respectively;

[0026] The thread warp scheduling unit is also used to divide the thread warps into multiple groups of fixed sizes according to the preset fusion scheduling strategy. The priorities of the groups are set based on the GroupID and polling scheduling is performed. The thread warps in the group adopt the GTO scheduling strategy and are executed in sequence until all the thread warps in the group cannot be executed. Then the groups are switched until all groups are executed.

[0027] In some embodiments, when a branch instruction appears in a thread warp, the scheduler enters a branch processing flow; the branch processing flow includes:

[0028] The subsequent execution unit generates the branch PC generated by the branch instruction. branch , branch mask and branch convergence instruction PC conver Push into the branch stack table;

[0029] After detecting that the stack table is not empty, the next instruction PC of the thread warp where the branch instruction appears will no longer be obtained from the thread warp PC table, but the stack table will be read to obtain the instruction PC branch and thread mask;

[0030] According to the instruction PC branch Get instruction I from the buffer queue branch After that, based on the GTO scheduling policy, the instruction PC of the thread bundle where the branch instruction appears will be changed from PC branch Automatically increment until a branch convergence instruction PC is encountered conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

[0031] In some embodiments, the storage medium stores program instructions, wherein the program instructions, when running, execute the thread warp scheduling method based on the fusion scheduling strategy in the above embodiment.

[0032] The thread warp scheduling method, scheduler, and storage medium based on the fusion scheduling strategy provided by the embodiments of the present disclosure can achieve the following technical effects:

[0033] Through the optimization design of the thread warp scheduling strategy and scheduler, the dynamic monitoring and adjustment of the thread warp status is realized. For special branch instructions, the stack algorithm is used to build the branch stack table, which shields invalid threads and reduces power consumption while avoiding the waste of computing resources. In addition, the fusion scheduling strategy uses fast switching between thread warps and more executable instructions in the thread warp to hide access delays, avoid pipeline stagnation and reduce waiting time, greatly improving the execution efficiency and resource utilization of GPGPU and improving the overall performance of the system.

[0034] The above general description and the following description are exemplary and explanatory only and are not intended to limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] One or more embodiments are exemplarily described by corresponding drawings, which do not limit the embodiments. Elements with the same reference numerals in the drawings are shown as similar elements, and the drawings do not constitute a scale limitation, and wherein:

[0036] Figure 1 It is a flowchart of a thread warp scheduling method based on a fusion scheduling strategy provided by an embodiment of the present disclosure;

[0037] Figure 2 is a schematic diagram of a thread warp scheduler architecture provided by an embodiment of the present disclosure;

[0038] Figure 3 It is a scheduling schematic diagram of a fusion scheduling strategy provided by an embodiment of the present disclosure;

[0039] Figure 4 It is a schematic diagram of a thread warp scheduling process provided by an embodiment of the present disclosure;

[0040] Figure 5 It is a structural diagram of a thread warp scheduler based on a fusion scheduling strategy provided by an embodiment of the present disclosure;

[0041] Figure 6 It is a structural diagram of a thread warp scheduling system based on a fusion scheduling strategy provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0042] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.

[0043] The terms "first", "second", etc. in the embodiments of the present disclosure are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0044] Unless otherwise stated, the term "plurality" means two or more.

[0045] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0046] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0047] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.

[0048] The following describes a thread warp scheduling method, a scheduler, and a storage medium based on a fusion scheduling strategy provided by an embodiment of the present disclosure in conjunction with the accompanying drawings.

[0049] Figure 1 is a flowchart of a thread warp scheduling method based on a fusion scheduling strategy provided by an embodiment of the present disclosure, combined with Figure 1 ,The thread warp scheduling method based on the fusion scheduling strategy is described.

[0050] The thread warp scheduling method based on the fusion scheduling strategy may include:

[0051] S01, the thread block scheduling unit organizes the threads in the thread block into different thread warps according to a preset method through a mapping relationship, and sends the thread warps to the thread warp scheduling unit for emission and execution;

[0052] S02, after receiving the thread warp, the thread warp scheduling unit sets the corresponding table entry of the thread warp activation table according to the thread warp WID based on the thread warp state management unit to indicate that the corresponding thread warp is in an activated state;

[0053] S03, the warp scheduling unit updates the instruction PC and thread mask of the warp initialization into the corresponding warp PC table and thread mask table respectively;

[0054] S04, the warp scheduling unit divides the warps into multiple groups of fixed sizes according to a preset fusion scheduling strategy, sets priorities between the groups based on GroupID and performs round-robin scheduling, and the warps in the group adopt the GTO scheduling strategy and execute in sequence until all the warps in the group cannot be executed, and then switches groups until all groups are executed.

[0055] In the present disclosure, by cooperating with the fusion scheduling strategy, fast switching between thread bundles and more executable instructions within the thread bundle are utilized to hide access delays, avoid pipeline stalls and reduce waiting time, thereby greatly improving the execution efficiency and resource utilization of GPGPU and improving the overall performance of the system. This method is highly flexible and adaptable to meet diverse application needs.

[0056] Figure 2 is a schematic diagram of a thread warp scheduler architecture provided by an embodiment of the present disclosure, Figure 3 is a schematic diagram of a fusion scheduling strategy provided by an embodiment of the present disclosure. Figure 4 is a schematic diagram of a thread warp scheduling process provided by an embodiment of the present disclosure, combined with Figure 2 , Figure 3 as well as Figure 4 ,right Figure 1 The thread warp scheduling method based on the fusion scheduling strategy is further described in.

[0057] In some embodiments, when a branch instruction appears in a thread warp, the scheduler enters a branch processing flow; the branch processing flow includes:

[0058] The subsequent execution unit generates the branch PC generated by the branch instruction. branch , branch mask and branch convergence instruction PC conver Push into the branch stack table;

[0059] After detecting that the stack table is not empty, the next instruction PC of the thread warp where the branch instruction appears will no longer be obtained from the thread warp PC table, but the stack table will be read to obtain the instruction PC branch and thread mask;

[0060] According to the instruction PC branch Get instruction I from the buffer queue branch After that, based on the GTO scheduling policy, the instruction PC of the thread bundle where the branch instruction appears will be changed from PC branch Automatically increment until a branch convergence instruction PC is encountered conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

[0061] In some embodiments, the thread warps in the group adopt a GTO scheduling strategy, including:

[0062] When the thread warps include W0, W1 and W2, the priority is W0>W2>W1 based on the time when the thread warps are activated. Each thread warp executes 4 instructions in its own instruction queue, of which 3 are immediately executed instructions, namely I1, I2 and I4, and 1 is a memory access instruction, namely I3.

[0063] Initially, W0 first reads the I1 instruction from the instruction cache instr_queue.w0 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. After I1 is emitted, the PC value automatically increases and continues to read I2 and emit it until it encounters the memory access instruction I3 of W0. The state of W0 is changed to stalled and the state of W0 is written into the thread bundle stall table. After that, W2 in G1 continues to be scheduled. W2 reads the I1 instruction from the instruction cache instr_queue.w2 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. The process is consistent with the scheduling process of W0.

[0064] In some embodiments, when the thread warps are W0, W1, W2, W3, W4, and W5, the thread warps are divided into a plurality of fixed-size groups, including thread groups G1 and G2, wherein G1 includes W0, W1, and W2, and G2 includes W3, W4, and W5;

[0065] When all the thread warps in G1 are blocked, thread warps W3, W4, and W5 in G2 are scheduled in the same way as G1.

[0066] When all the thread warps in G2 are blocked from execution, the instruction queues of the thread warps in G1 are rescheduled and the scheduling is repeated until all active thread warps are in a stopped state.

[0067] In some embodiments, each warp contains 32 threads, and the mask table corresponds to the warp one by one.

[0068] In a specific example, when the thread warp scheduler receives the thread warp provided by the upper pipeline, it adopts the fusion scheduling strategy to select one or more corresponding thread warps for activation through analysis and inspection and mark the BID, TID and other information of the corresponding thread warps, and at the same time constructs the thread warp activation table, thread mask table, thread warp PC table, thread warp stall table and branch stack table, and groups the active thread warps according to the fusion scheduling strategy, adopts the polling scheduling strategy between groups and adopts the GTO scheduling strategy within the group, and selects the appropriate thread warp W. m Then, according to the initial instruction address PC and mask stored in the thread bundle PC table and thread mask table, an instruction is read from the instruction cache and sent to the subsequent execution unit until W is encountered. mAfter the long memory access delay instruction is executed, switch to the Wn thread bundle. Execute in sequence until all thread bundles in the group cannot be executed, then switch groups and repeat the above process. Through the optimization design of the thread bundle scheduling strategy and scheduler, dynamic monitoring and adjustment of the thread bundle status are realized. For special branch instructions, the stack algorithm is used to build a branch stack table, shielding invalid threads while reducing power consumption and avoiding the waste of computing resources. In addition, the fusion scheduling strategy uses fast switching between thread bundles and more executable instructions in the thread bundle to hide the access delay, avoid pipeline stagnation and reduce waiting time, greatly improving the execution efficiency and resource utilization of GPGPU, and improving the overall performance of the system.

[0069] The thread warp scheduler is mainly composed of a thread warp activation table, a thread mask table, a thread warp PC table, a thread warp stall table, a branch stack table, a thread warp state management unit, and a thread warp emission unit. When the thread warp state management unit receives the thread warp to be scheduled from the upper level, it sets the corresponding table entry in the thread warp activation table according to the thread warp WID, indicating that the thread warp is in an activated state. At the same time, the instruction PC and thread mask initialized by the thread warp are updated to the corresponding thread warp PC table and thread mask table respectively. Each thread warp contains 32 threads, and the mask table corresponds to each of them. According to the fusion scheduling strategy, the thread warp W m After the first instruction is issued, the PC value automatically increases and continues to read the second instruction until it encounters W m After the long-delay memory access instruction, W m The state of the thread warp is changed to stalled and its state is written to the corresponding entry in the thread warp stall table, and then the W in the same group is continued. n , process and W m The scheduling process is consistent. K When a branch instruction occurs, the instruction PC is obtained from the branch stack table branch And thread mask Mask branch , where the thread mask will mask the threads that do not execute the instruction, and then the thread bundle W K The next instruction PC will be from PC branch Automatically increment until a branch converges to the PC. conver , the branch execution process ends.

[0070] The fusion scheduling strategy hierarchizes the thread bundles and divides the thread bundles to be scheduled into multiple groups of fixed size. The priorities of each group are set based on the GroupID and polling scheduling is performed. The GTO (Greedy-Then-Oldest) scheduling strategy is adopted between the thread bundles in the group, that is, the thread bundles that have not been executed for a long time have the highest priority. First, all threads are organized into thread bundles. Assuming that the thread bundles to be scheduled are W0, W1, W2, W3, W4, and W5, they are divided into different thread groups G1 (Group1) and G2 (Group 2), where G1 includes W0, W1, and W2, and G2 includes W3, W4, and W5. Then the scheduling priority is set according to the GID. When G1 is executed preferentially, it is scheduled according to the GTO policy inside G1. According to the characteristics of the GTO policy, the time when the thread bundles are deployed to the computing core is compared and arranged with the priority W0>W2>W1. Assuming that each thread bundle executes its own instruction queue, when the W0 instruction is blocked when executing the memory access instruction, it switches to the thread bundle W2. When W2 is blocked again, it switches to W1 and repeats the above process. When the thread bundles in G1 are all blocked, the thread bundles W3, W4, and W5 in G2 will be scheduled in the same way. The process is similar to G1. Then, the thread bundles in G1 will be rescheduled and executed according to the polling scheduling policy.

[0071] In a specific implementation, the specific process of the thread warp scheduling method based on the fusion scheduling strategy may include:

[0072] S1) After the host computer generates a parallel computing task, the thread block scheduling unit organizes the threads in the thread block into different thread bundles in a certain way through a mapping relationship, and sends these thread bundles to be scheduled to the thread bundle scheduling unit for launch and execution.

[0073] S2) When the scheduler in the thread bundle scheduling unit receives the thread bundle to be scheduled from the superior, the thread bundle state management unit will set the corresponding table entry in the thread bundle activation table according to the thread bundle WID, indicating that the thread bundle is in the activated state. At the same time, the instruction PC and thread mask of the thread bundle initialization are updated to the corresponding thread bundle PC table and thread mask table respectively, where each thread bundle contains 32 threads, and the mask table corresponds to each one. According to the fusion scheduling strategy, the thread bundles to be scheduled are divided into multiple groups of fixed sizes. The priorities of each group are set based on the GroupID and polling scheduling is performed. The thread bundles within the group adopt the GTO (Greedy-Then-Oldest) scheduling strategy, that is, the thread bundles that have not been executed for a long time have the highest priority. Assume that the thread bundles to be scheduled are W0, W1, W2, W3, W4, and W5, and divide them into different thread groups G1 (Group 1) and G2 (Group 2), where G1 includes W0, W1, and W2, and G2 includes W3, W4, and W5. Then, the scheduling priority is set according to the GID (the larger the ID, the lower the priority), and G1 and G2 are stored in the scheduling queue.

[0074] S3) First, G1 is scheduled for execution first and is scheduled according to the GTO algorithm inside G1. According to the characteristics of the GTO policy, the activation time of the thread warps is compared and the priority is W0>W2>W1. It is assumed that each thread warp executes 4 instructions in its own instruction queue (instr_queue.w0, instr_queue.w1, instr_queue.w2), of which 3 are immediately executed instructions, namely I1, I2, and I4, and 1 is a memory access instruction, namely I3. Initially, W0 first reads the I1 instruction from the instruction cache instr_queue.w0 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. After I1 is emitted, the PC value automatically increases and continues to read I2 and emit until it encounters the memory access instruction I3 of W0, changes the state of W0 to stagnation and writes the state of W0 into the thread bundle stagnation table, and then continues to schedule W2 in G1. W2 reads the I1 instruction from the instruction cache instr_queue.w2 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. The process is consistent with the scheduling process of W0. When all the thread bundles in G1 are blocked in execution, the thread bundles W3, W4, and W5 in G2 will be scheduled in the same way, where the priority W3>W4>W5, and the process is the same as G1. When all the thread warps in G2 are also blocked from execution, the instruction queues of the thread warps in G1 are rescheduled and executed in a loop until all active thread warps are in a stopped state. Generally, the instructions of the thread warps are executed sequentially until all active thread warps are in a stopped state. At this time, the scheduler is most efficient.

[0075] S4) When a branch instruction appears in a thread bundle, the scheduler enters the branch processing flow. Assuming that a branch instruction is encountered when scheduling W1, the subsequent execution unit will first generate a branch PC for the branch instruction. branch And branch mask, branch convergence instruction PC conver The information is pushed into the branch stack table. After detecting that the stack table is not empty, the next instruction PC of W1 will no longer be obtained from the thread bundle PC table, but the stack table will be read to obtain the instruction PC. branch And the thread mask. At this time, due to the branch, the thread mask will block the thread that does not execute the instruction. branch Get instruction I from the buffer queue branch After that, the execution process and scheduling strategy are as in step S3), and then the instruction PC of thread bundle W1 will be branch Automatically increment until a branch converges to the PC. conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

[0076] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0077] Figure 5 is a structural diagram of a thread warp scheduler based on a fusion scheduling strategy provided by an embodiment of the present disclosure, such as Figure 5 As shown, in this scheduler,

[0078] A thread block scheduling unit 501 is used to organize threads in a thread block into different thread warps according to a preset manner through a mapping relationship, and send the thread warps to the thread warp scheduling unit for emission and execution;

[0079] A warp scheduling unit 502, configured to, after receiving the warp, set a corresponding entry in the warp activation table according to the warp WID based on the warp state management unit to indicate that the corresponding warp is in an activated state;

[0080] The warp scheduling unit 502 is further used to update the instruction PC and thread mask of the warp initialization to the corresponding warp PC table and thread mask table respectively;

[0081] The thread warp scheduling unit 502 is also used to divide the thread warps into multiple groups of fixed sizes according to a preset fusion scheduling strategy. Priorities are set based on GroupID and polling scheduling is performed between each group. The thread warps in the group adopt the GTO scheduling strategy and are executed in sequence until all thread warps in the group cannot be executed. Then, the groups are switched until all groups are executed.

[0082] In some embodiments, when a branch instruction appears in a thread warp, the scheduler enters a branch processing flow; the branch processing flow includes:

[0083] The subsequent execution unit generates the branch PC generated by the branch instruction. branch , branch mask and branch convergence instruction PC conver Push into the branch stack table;

[0084] After detecting that the stack table is not empty, the next instruction PC of the thread warp where the branch instruction appears will no longer be obtained from the thread warp PC table, but the stack table will be read to obtain the instruction PC branch and thread mask;

[0085] According to the instruction PC branch Get instruction I from the buffer queuebranch After that, based on the GTO scheduling policy, the instruction PC of the thread bundle where the branch instruction appears will be changed from PC branch Automatically increment until a branch convergence instruction PC is encountered conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

[0086] In some embodiments, the thread warps in the group adopt a GTO scheduling strategy, including:

[0087] When the thread warps include W0, W1 and W2, the priority is W0>W2>W1 based on the time when the thread warps are activated. Each thread warp executes 4 instructions in its own instruction queue, of which 3 are immediately executed instructions, namely I1, I2 and I4, and 1 is a memory access instruction, namely I3.

[0088] Initially, W0 first reads the I1 instruction from the instruction cache instr_queue.w0 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. After I1 is emitted, the PC value automatically increases and continues to read I2 and emit it until it encounters the memory access instruction I3 of W0. The state of W0 is changed to stalled and the state of W0 is written into the thread bundle stall table. After that, W2 in G1 continues to be scheduled. W2 reads the I1 instruction from the instruction cache instr_queue.w2 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. The process is consistent with the scheduling process of W0.

[0089] In some embodiments, when the thread warps are W0, W1, W2, W3, W4, and W5, the thread warps are divided into a plurality of fixed-size groups, including thread groups G1 and G2, wherein G1 includes W0, W1, and W2, and G2 includes W3, W4, and W5;

[0090] When all the thread warps in G1 are blocked, thread warps W3, W4, and W5 in G2 are scheduled in the same way as G1.

[0091] When all the thread warps in G2 are blocked from execution, the instruction queues of the thread warps in G1 are rescheduled and the scheduling is repeated until all active thread warps are stopped.

[0092] In some embodiments, each warp contains 32 threads, and the mask table corresponds to the warp one by one.

[0093] Combination Figure 6As shown, the embodiment of the present disclosure provides a thread warp scheduling system 600 based on a fusion scheduling strategy, including a processor 604 and a memory 601. Optionally, the system may also include a communication interface 602 and a bus 603. The processor 604, the communication interface 602, and the memory 601 may communicate with each other through the bus 603. The communication interface 602 may be used for information transmission. The processor 604 may call the logic instructions in the memory 601 to execute the thread warp scheduling method based on the fusion scheduling strategy of the above embodiment.

[0094] In addition, the logic instructions in the memory 601 described above can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.

[0095] The memory 601 is a computer-readable storage medium that can be used to store software programs and computer executable programs, such as program instructions / modules corresponding to the method in the embodiment of the present disclosure. The processor 604 executes the function application and data processing by running the program instructions / modules stored in the memory 601, that is, the thread warp scheduling method based on the fusion scheduling strategy in the above embodiment is implemented.

[0096] The memory 601 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 601 may include a high-speed random access memory and may also include a non-volatile memory.

[0097] An embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured to execute a thread warp scheduling method based on a fusion scheduling strategy.

[0098] The computer-readable storage medium mentioned above may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.

[0099] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and other media that can store program codes, or a transient storage medium.

[0100] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operations may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. As used in the description of the embodiments, unless the context clearly indicates otherwise, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or including (comprising) refer to the existence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components and / or these groups. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same or similar parts between the embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0101] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the systems, devices and units described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0102] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0103] The flowchart and block diagram in the accompanying drawings show the possible architecture, functions and operations of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A thread warp scheduling method based on a fusion scheduling strategy, characterized in that: The method comprises: The thread block scheduling unit organizes the threads in the thread block into different thread warps according to a preset manner through a mapping relationship, and sends the thread warps to the thread warp scheduling unit for emission and execution; After receiving the thread warp, the thread warp scheduling unit sets a corresponding table entry of the thread warp activation table according to the thread warp WID based on the thread warp state management unit to indicate that the corresponding thread warp is in an activated state; The warp scheduling unit updates the instruction PC and thread mask of the warp initialization to the corresponding warp PC table and thread mask table respectively; The thread warp scheduling unit divides the thread warps into multiple groups of fixed sizes according to the preset fusion scheduling strategy. The priorities of the groups are set based on the GroupID and polling scheduling is performed. The thread warps in the group adopt the GTO scheduling strategy and are executed in sequence until all the thread warps in the group cannot be executed. Then the groups are switched until all groups are executed.

2. The method according to claim 1, characterized in that When a branch instruction appears in a thread warp, the scheduler enters the branch processing flow; The branch processing flow includes: The subsequent execution unit generates the branch PC generated by the branch instruction. branch , branch mask and branch convergence instruction PC conver Push into the branch stack table; After detecting that the stack table is not empty, the next instruction PC of the thread warp where the branch instruction appears will no longer be obtained from the thread warp PC table, but the stack table will be read to obtain the instruction PC branch and thread mask; According to the instruction PC branch Get instruction I from the buffer queue branch After that, based on the GTO scheduling policy, the instruction PC of the thread bundle where the branch instruction appears will be changed from PC branch Automatically increment until a branch convergence instruction PC is encountered conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

3. The method according to claim 1, characterized in that The thread warps in the group adopt the GTO scheduling strategy, including: When the thread warps include W0, W1 and W2, the priority is W0>W2>W1 based on the time when the thread warps are activated. Each thread warp executes 4 instructions in its own instruction queue, of which 3 are immediately executed instructions, namely I1, I2 and I4, and 1 is a memory access instruction, namely I3. Initially, W0 first reads the I1 instruction from the instruction cache instr_queue.w0 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. After I1 is emitted, the PC value automatically increases and continues to read I2 and emit it until it encounters the memory access instruction I3 of W0. The state of W0 is changed to stalled and the state of W0 is written into the thread bundle stall table. After that, W2 in G1 continues to be scheduled. W2 reads the I1 instruction from the instruction cache instr_queue.w2 according to the initial instruction address PC and mask stored in the thread bundle PC table and the thread mask table, and sends it to the subsequent execution unit through the thread bundle emission unit. The process is consistent with the scheduling process of W0.

4. The method according to claim 3, characterized in that When the thread warps are W0, W1, W2, W3, W4, and W5, the thread warps are divided into a plurality of fixed-size groups, including thread groups G1 and G2, wherein G1 includes W0, W1, and W2, and G2 includes W3, W4, and W5; When all the thread warps in G1 are blocked, thread warps W3, W4, and W5 in G2 are scheduled in the same way as G1. When all the thread warps in G2 are blocked from execution, the instruction queues of the thread warps in G1 are rescheduled and the scheduling is repeated until all active thread warps are stopped.

5. The method according to claim 1, characterized in that Each warp contains 32 threads, and the mask table corresponds to the warp one by one.

6. A thread warp scheduler based on a fusion scheduling strategy, characterized in that: The scheduler comprises: A thread block scheduling unit, used to organize threads in a thread block into different thread warps according to a preset manner through a mapping relationship, and send the thread warps to the thread warp scheduling unit for emission and execution; A warp scheduling unit, configured to, after receiving the warp, set a corresponding entry in the warp activation table according to the warp WID based on the warp state management unit, so as to indicate that the corresponding warp is in an activated state; The thread warp scheduling unit is further used to update the instruction PC and thread mask of the thread warp initialization to the corresponding thread warp PC table and thread mask table respectively; The thread warp scheduling unit is also used to divide the thread warps into multiple groups of fixed sizes according to the preset fusion scheduling strategy. The priorities of the groups are set based on the GroupID and polling scheduling is performed. The thread warps in the group adopt the GTO scheduling strategy and are executed in sequence until all the thread warps in the group cannot be executed. Then the groups are switched until all groups are executed.

7. The scheduler according to claim 6, characterized in that When a branch instruction appears in a thread warp, the scheduler enters the branch processing flow; The branch processing flow includes: The subsequent execution unit generates the branch PC generated by the branch instruction. branch , branch mask and branch convergence instruction PC conver Push into the branch stack table; After detecting that the stack table is not empty, the next instruction PC of the thread warp where the branch instruction appears will no longer be obtained from the thread warp PC table, but the stack table will be read to obtain the instruction PC branch and thread mask; According to the instruction PC branch Get instruction I from the buffer queue branch After that, based on the GTO scheduling policy, the instruction PC of the thread bundle where the branch instruction appears will be changed from PC branch Automatically increment until a branch convergence instruction PC is encountered conver , the branch stack corresponding to the thread warp is empty, and the branch execution process ends.

8. A storage medium storing program instructions, characterized in that: When the program instructions are run, the thread warp scheduling method based on the fusion scheduling strategy according to any one of claims 1 to 5 is executed.

Citation Information

Cited By

  • RISC-V-based thread bundle scheduling method, equipment and medium

    CN119559032A

  • Scheduling circuit, method and unit, processing system, equipment and medium

    CN120371481A