Arbitration method for task queue scheduling, processor, electronic equipment and storage medium

By introducing an arbitration module into the processor, scheduling priority is calculated based on the working status attributes of the task queue, and dynamically adjusting the scheduling order of the task queue, the problem of unbalanced scheduling of the task queue is solved, and the overall efficiency and resource utilization of the processor are improved. .

CN119201402APending Publication Date: 2024-12-27CHENGDU HAIGUANG INTEGRATED CIRCUIT DESIGN CO LTD
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202411382983.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

When scheduling the task queue, existing processors completely follow the schedule method pre-set by the user, resulting in unbalanced scheduling configuration, resulting in frequent unloading and interruption of the task queue, affecting processing efficiency.

Method used

By introducing an arbitration module into the processor, scheduling priority is calculated based on the real-time working status attributes of the task queue, dynamically adjust the scheduling order of the task queue, and arbitrate the task queues that need to be unloaded or loaded to ensure that hardware resources are allocated relatively balancedly.

Benefits of technology

It effectively reduces the time loss of tasks interrupted, improves the overall efficiency of task processing, ensures the balanced demand for hardware resources by different task queues, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201402A_ABST
    Figure CN119201402A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a task queue scheduling arbitration method, a processor, electronic equipment and a storage medium, relates to the technical field of processor resource management, and aims to conveniently schedule corresponding hardware resources configured to different task queues in a relatively balanced manner. The processor comprises an arbitration module which is configured to calculate the scheduling priority of a task queue according to the real-time working state attribute of the task queue; arbitrating a priority sequence of the task queues needing to be unloaded or loaded according to the scheduling priorities of the task queues; and according to the priority sequence, issuing the identity labels of the corresponding task queues to a hardware scheduling module in sequence. The method and the device are suitable for chip hardware design, configuration and task job processing scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of processor resource management, and in particular to an arbitration method, processor, electronic device and storage medium for task queue scheduling. Background Art

[0002] The processor is an important hardware resource in a device with computing power. It can execute multiple job tasks in parallel to improve processing efficiency. When executing multiple job tasks, a hardware queue resource pool will be configured in the processor to support the task queue processing tasks. Among them, the hardware queue resource pool includes at least one hardware execution resource slot, which is used to process at least one task queue. When the number of task queues exceeds the number of available hardware execution resource slots, the processor needs to allocate and schedule the task queues, which mainly involves determining the matching relationship between the task queues and the hardware execution resource slots, and notifying the working queues to unload in turn, while allowing the unworking task queues to load.

[0003] However, in the related task scheduling technology, when scheduling and configuring hardware resources, the problem of unbalanced scheduling configuration may occur because the task scheduling method pre-set by the user is completely followed. For example, in the time slice scheduling method, the task queue loaded into the hardware execution resource slot will be frequently unloaded, resulting in frequent interruptions of the ongoing task queue. For another example, the priority preemptive scheduling method is frequently interrupted because the hardware resources of the high-priority task queue are often preempted, resulting in the possibility that the ordinary queue may not be able to work at certain times. Summary of the invention

[0004] In view of this, an embodiment of the present application provides an arbitration method, processor, electronic device and storage medium for task queue scheduling, which facilitates more balanced scheduling of corresponding hardware resources allocated to different task queues when the number of task queues is greater than the number of hardware execution resource slots.

[0005] In order to achieve the above application purpose, the following technical solutions are adopted: The embodiment of the present application provides a processor, comprising: an arbitration module, configured to calculate the scheduling priority of the task queue according to the real-time working status attribute of the task queue; Arbitrating the priority order of the task queues that need to be unloaded or loaded according to the scheduling priority of the task queues; According to the priority order, the identity identifiers of the corresponding task queues are sent to the hardware scheduling module in sequence; The hardware scheduling module is configured to unload the task queue from the corresponding hardware execution resource slot according to the identity identifier of the task queue, or match and load the task queue to the corresponding hardware execution resource slot.

[0006] According to a specific implementation of the embodiment of the present application, the arbitration module includes: an attribute acquisition module configured to query and acquire the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and A priority calculation module is configured to calculate the scheduling priority of each task queue according to the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and, a ruling module configured to prioritize the task queues based on the scheduling priorities of all the task queues; According to the priority sorting and the number of hardware execution resource slots, arbitrating a task queue with a lower priority among the running task queues; The identity identifier of the task queue with a lower priority is sent as an uninstallation notification to the hardware scheduling module.

[0007] According to a specific implementation of the embodiment of the present application, the working status attributes of the running task queue include: whether the current subtask is completed, the amount of work to be processed and the push time; The priority calculation module is specifically configured to perform weighted sum calculation according to whether the current subtask is completed, the workload to be processed and the push time to obtain the scheduling priority of each task queue.

[0008] According to a specific implementation method of the embodiment of the present application, the hardware scheduling module is configured to send the unloaded task queue to the scheduling sorting list after unloading the task queue from the corresponding hardware execution resource slot.

[0009] According to a specific implementation of the embodiment of the present application, the arbitration module includes: an attribute acquisition module configured to query and acquire the working status attribute of the to-be-run task queue in the scheduling sort list; and A priority calculation module, configured to calculate the scheduling priority of each of the to-be-run task queues according to the working state attributes of the to-be-run task queues; and, a decision module configured to prioritize the to-be-run task queues based on the scheduling priority of each of the to-be-run task queues; According to the priority ranking of the task queues to be run and the number of hardware execution resource slots, arbitrating a task queue with a higher priority in the task queues to be run; The identity identifier of the task queue with a higher priority is sent as a loading notification to the hardware scheduling module.

[0010] According to a specific implementation of the embodiment of the present application, the working state attributes of the task queue to be run include: the workload to be processed, the push time, and the queue waiting time; The priority calculation module is specifically configured to perform weighted sum calculation according to the workload to be processed, the push time and the queue waiting time to obtain the scheduling priority of each of the queues of tasks to be processed.

[0011] According to a specific implementation method of an embodiment of the present application, the hardware scheduling module is configured to match and load the task queue into the corresponding hardware execution resource slot, and then send the unloaded task queue in the task queue to be run into the scheduling sort list.

[0012] According to a specific implementation method of the embodiment of the present application, each of the task queues carries a priority attribute, and the value of the priority attribute is configured to be a dynamically variable value.

[0013] In a second aspect, the present application also provides an arbitration method for task queue scheduling in an embodiment, the arbitration method comprising: Calculate the scheduling priority of the task queue according to the real-time working status attribute of the task queue; Arbitrating the priority order of the task queues that need to be unloaded or loaded according to the scheduling priority of the task queues; According to the priority order, the identities of the corresponding task queues are sent to the hardware scheduling module in sequence.

[0014] According to a specific implementation of the embodiment of the present application, the scheduling priority of the task queue is calculated according to the real-time working status attribute of the task queue, including: Query and obtain the working status attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and A priority calculation module is configured to calculate the scheduling priority of each task queue according to the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; Prioritize task queues based on the scheduling priorities of all task queues; According to the priority sorting and the number of hardware execution resource slots, arbitrating a task queue with a lower priority among the running task queues; The identity of the task queue with the lower priority is issued.

[0015] According to a specific implementation of the embodiment of the present application, the scheduling priority of the task queue is calculated according to the real-time working status attribute of the task queue, including: Query and obtain the working status attributes of the waiting task queue in the scheduling sort list; and Calculating the scheduling priority of each of the to-be-run task queues according to the working status attributes of the to-be-run task queues; Based on the scheduling priority of each of the to-be-run task queues, the to-be-run task queues are prioritized; According to the priority ranking of the task queues to be run and the number of hardware execution resource slots, arbitrating a task queue with a higher priority in the task queues to be run; The identity of the task queue with a higher priority is issued.

[0016] In a third aspect, an embodiment of the present application provides an electronic device, including: One or more processors; Memory; One or more executable program codes are stored in the memory, and the one or more processors read the executable program codes stored in the memory and run the programs corresponding to the executable program codes to execute the arbitration method for task queue scheduling described in any one of the second aspects.

[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to execute the arbitration method for task queue scheduling described in any of the second aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 A schematic diagram of a typical architecture and task operation flow of a GPU embodiment; Figure 2 Schematic diagram of subscription issues for transition; Figure 3 This is a schematic block diagram of the processor structure of an embodiment of the present application; Figure 4 This is a schematic block diagram of the processor structure of another embodiment of the present application; Figure 5 This is a schematic diagram of a process flow of a processor executing a task queue unloading process according to an embodiment of the present application; Figure 6 This is a schematic diagram of processor hardware executing resource slot unloading or loading in one embodiment of the present application; Figure 7 This is a schematic diagram of a process flow of a processor executing a task queue loading process according to an embodiment of the present application; Figure 8This is a schematic diagram of a process for a task queue to apply for matching hardware execution resource slots according to an embodiment of the present application; Fig. 9 A schematic diagram of a task queue application matching hardware execution resource slot according to an embodiment of the present application; Fig.10 A schematic diagram of unloading a task queue for an arbitration method for scheduling a task queue according to an embodiment of the present application; Fig.11 A schematic diagram of a task queue scheduling arbitration method for task queue scheduling according to an embodiment of the present application Fig.12 A schematic diagram of loading a task queue for an arbitration method for scheduling a task queue according to an embodiment of the present application; Fig.13 This is a schematic diagram of the structure of an embodiment of the electronic device of the present application. DETAILED DESCRIPTION

[0020] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0021] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0022] Processors are very important hardware resources in some devices with data processing and computing capabilities, including: CPU (Central Processing Unit), FPGA (Field-Programmable Gate Array), ASIC (Application Specific Integrated Circuit) and GPU (Graphics Processing Unit). In the following description, GPU is used as an example of a processor.

[0023] GPU is a heterogeneous computing device that can process large amounts of data in parallel. User programs (a task job, such as a calculation, a control process, etc.) will be split into several parallel task queues through hardware resource management software to improve work efficiency.

[0024] The tasks in each task queue need to be executed serially, while different task queues can be executed in parallel. There will be a small hardware queue resource pool in the GPU, which usually contains some hardware execution resource slots to support the work of the task queue. The GPU will also include at least one hardware scheduling module, which can match a hardware execution resource slot with a task queue. When the pairing is successful, the GPU hardware can parse the tasks contained in the software queue and send the parsed tasks to the GPU's computing module for calculation. Its architecture and typical workflow are as follows: Figure 1 shown.

[0025] See also Figure 2 When the number of task queues is greater than the number of hardware execution resource slots, due to insufficient resources, the GPU's task queues will be over-subscribed. Among them, transitional subscription refers to: when the number of task queues is greater than the number of hardware execution resource slots, the task queues need to be time-shared or preempted. When the task queue is over-subscribed, the GPU will allocate and schedule the current task queue through the hardware scheduling module, determine the matching relationship between the task queue and the hardware execution resource slot, and notify the queues that are already working to unload in turn, and then let the queues that are not working to load in turn. Through different job scheduling mechanisms, more software task queues can use limited hardware resources in a time-sharing manner.

[0026] In the current popular GPU ecological environment architecture, two main job scheduling mechanisms are used: time slice scheduling and priority preemption.

[0027] Time slice scheduling mechanism: When the number of software task queues is greater than the number of hardware execution resource slots, the GPU will unload the queues that have been working at regular intervals, and then load the queues to be worked on, constantly rotating and changing to ensure that each queue can work. When unloading a queue, the current work content needs to be saved; when loading a queue, the previous work needs to be restored.

[0028] Priority preemptive scheduling mechanism: Provides a specific software interface for creating high-priority queues. Specific software programs need to be bound to priorities. High-priority queues are processed first, and ordinary queues need to wait for the high-priority queues to be executed before they can be executed. When ordinary task queues are executed, if there are tasks with high priority, they can preempt ordinary task queues. When preempting, the current work queue also needs to be unloaded and the queue waiting for work needs to be loaded.

[0029] However, the above two scheduling mechanisms will cause the problem of unbalanced scheduling configuration when scheduling and configuring hardware resources because they completely follow the task scheduling method pre-set by the user. For example, in the time slice scheduling method, the task queue loaded into the hardware execution resource slot will be frequently unloaded, resulting in frequent interruptions of the ongoing task queue. For another example, the priority preemptive scheduling method is frequently interrupted because the hardware resources of the high-priority task queue are often preempted, resulting in the possibility that the ordinary queue will be unable to work at certain times, thus affecting the overall processing efficiency of the job.

[0030] Figure 3 This is a schematic block diagram of the processor structure of an embodiment of the present application. Figure 3 For the situation where the number of task queues is greater than the number of hardware execution resource slots and over-subscription occurs, an embodiment of the present application provides a processor that can be applied to chip hardware design, configuration, and task job processing scenarios. The processor includes a hardware resource queue pool, the hardware resource queue pool includes a hardware execution resource slot 110, and the hardware execution resource slot 110 is a hardware that can parse the tasks contained in the software task queue and send the tasks to the computing unit of the GPU.

[0031] The hardware scheduling module 120 is configured to start the hardware scheduling process, execute the task queue and hardware execution resource slot matching task, and unload / load the task queue operation for at least one hardware execution resource slot 110 when the number of received task queues is greater than the number of hardware execution resource slots.

[0032] The arbitration module 130 is configured to calculate the scheduling priority of the task queue according to the real-time working status attribute of the task queue; Arbitrating the priority order of the task queues that need to be unloaded or loaded according to the scheduling priority of the task queues; According to the priority order, the identity identifiers of the corresponding task queues are sent to the hardware scheduling module 120 in sequence; In this embodiment, before the hardware scheduling module executes the matching of task queues with hardware execution resource slots, the arbitration module 130 executes the above steps to dynamically adjust the scheduling order of the task queues to evenly schedule the corresponding hardware resources allocated to different task queues.

[0033] The hardware scheduling module 120 is configured to unload the task queue from the corresponding hardware execution resource slot according to the identity identifier of the task queue, or match and load the task queue to the corresponding hardware execution resource slot 110.

[0034] Specifically, when the number of task queues reaches or exceeds the number of hardware execution resource slots, that is, over-subscription occurs, when the hardware scheduling module 120 starts the hardware scheduling process in a time slice manner, before the hardware scheduling, the arbitration module 130 calculates the scheduling priority of the task queue according to the working status attributes of the task queue, including the workload to be processed, the push time, the waiting time, the subtask running status, etc., arbitrates the task queues that need to be loaded and unloaded, and dynamically adjusts the scheduling order of the task queues, so as to facilitate a more balanced scheduling and allocation of the hardware resource requirements of different types of task queues, and can reduce the time loss caused by task interruptions, thereby helping to improve the overall task processing process.

[0035] The processor provided in the embodiment of the present application sets an arbitration module. Before hardware scheduling is performed on the hardware execution resource slot, the scheduling priority of the task queue is calculated according to the working status attributes of the task queue, and the task queues that need to be loaded and unloaded are arbitrated. The scheduling order of the task queues is dynamically adjusted. When the number of task queues is greater than the number of hardware execution resource slots, it is convenient to more evenly schedule the corresponding hardware resources allocated to different task queues, which can balance the needs of different task queues and effectively reduce the efficiency loss when over-subscription occurs, thereby improving the overall efficiency of task processing.

[0036] To optimize the dynamic allocation and utilization efficiency of hardware resources, see Figure 4 and Figure 5 , the arbitration module 130 includes: an attribute acquisition module 131, configured to query and obtain the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and The priority calculation module 132 is configured to calculate the scheduling priority of each task queue according to the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and, a decision module 133 configured to prioritize the task queues based on the scheduling priorities of all the task queues; According to the priority sorting and the number of hardware execution resource slots, arbitrating a task queue with a lower priority among the running task queues; The identity identifier of the task queue with the lower priority is sent as an uninstallation notification to the hardware scheduling module 120 .

[0037] For example, see Figure 5 , the attribute acquisition module 131 in the arbitration module 130 first queries the working status attributes of the currently running task queues, including the execution time, current execution progress and resource occupancy of each task queue, etc. The attribute acquisition module 131 queries and obtains the working attributes of the task queues to be run in the scheduling sorting list, such as priority, estimated execution time, etc.

[0038] The priority calculation module 132 calculates the scheduling priority of each task queue according to the acquired working state attributes of the task queue being run and the working state attributes of the task queue to be run. Specifically, a priority value can be assigned to each task queue according to their working state attributes and preset calculation rules.

[0039] The decision module 133 sorts all the task queues based on their scheduling priorities. Assuming there are three task queues, the priority values ​​calculated correspond to high, medium and low respectively. The decision module 133 sorts them from high to low in terms of priority.

[0040] For example, according to the priority sorting and the number of currently available hardware execution resource slots being 2, the arbitration module unloads a task queue with a lower priority among the running task queues to release the hardware execution resource slot occupied by the task queue.

[0041] The arbitration module 133 sends the identity of the selected task queue with a lower priority to the hardware scheduling module 120 and sends an uninstallation notification. After receiving the notification, the hardware scheduling module 120 will perform corresponding operations to uninstall the task queue with a lower priority from the hardware execution resource slot where it is located, and send it to the scheduling sort list for subsequent processing.

[0042] In this embodiment, by setting an arbitration module in the processor, before the hardware executes the scheduling process, by dynamically calculating and allocating hardware resources, it is possible to effectively manage and schedule task operations, improve the overall performance of the system, ensure that high-priority tasks obtain sufficient resources, and low-priority tasks can be unloaded in a timely manner without affecting the overall performance, thereby balancing the needs of different task queues for hardware resources.

[0043] In some embodiments, the working state attributes of the running task queue include: whether the current subtask is completed, the amount of work to be processed, and the push time. These working state attributes provide an important basis for priority calculation, allowing the system to more accurately evaluate the urgency and resource requirements of each task queue.

[0044] In one embodiment, the priority calculation module is specifically configured to perform weighted sum calculation according to whether the current subtask is completed, the workload to be processed and the push time to obtain the scheduling priority of each task queue. Specifically, whether the current subtask is completed can be assigned a weight value, for example, a completed subtask may be assigned a lower weight, while an unfinished subtask may be assigned a higher weight. The workload to be processed is evaluated according to the number of remaining tasks to be processed in the task queue, and the more the number, the higher the weight. The push time takes into account the time when the task queue is postponed for execution, and the longer the postponement time, the corresponding increase in its weight. The weighted sum calculation of these attributes can be implemented by the following formula: ; in, is the weight value corresponding to different working states, and i is a positive integer. According to the above weighted sum calculation, the priority calculation module can dynamically determine and adjust the priority of each task queue more accurately, thereby achieving more efficient resource scheduling.

[0045] See also Figure 6 In some embodiments, the hardware scheduling module 120 is configured to perform a corresponding unloading operation after receiving the identity of the task queue with a lower priority. Specifically, when the hardware scheduling module 120 receives an unloading notification from the arbitration module 130, it first identifies the identity of the task queue to be unloaded and determines the task queue to be unloaded.

[0046] The hardware scheduling module 120 unloads the task queue corresponding to the identity identifier from the corresponding hardware execution resource slot according to the identity identifier of the task queue. Specifically, the hardware scheduling module 130 queries the list of currently running task queues according to the identity identifier to confirm the location of the task queue to be unloaded; and then sends an unloading instruction to the corresponding hardware execution resource slot, instructing the hardware execution resource slot to stop executing the task queue.

[0047] The unloading operation may include updating the state of the task queue to "unloaded" and releasing the occupied hardware resources so that other high priority tasks can use these resources. In addition, the unloaded task queue of the hardware scheduling module 120 will be sent to the scheduling sorting list so that its priority and scheduling process can be re-evaluated later.

[0048] See also Figure 5 and Figure 7 In some embodiments, the arbitration module 130 includes: an attribute acquisition module 131, configured to query and acquire the working status attributes of the task queue to be run in the scheduling sort list. In this embodiment, the status of the task queue to be run is mainly monitored to ensure that the priority calculation is dynamically adjusted based on the latest information.

[0049] Priority calculation module 132 is configured to calculate the scheduling priority of each task queue to be run according to the working state attribute of the task queue to be run. The working state attribute includes the workload to be processed, the push time and the queue waiting time. The priority calculation module can take these attributes into consideration by the weighted summation method to derive the scheduling priority of each task queue. For example, the larger the workload to be processed, the longer the push time or the longer the queue waiting time, the higher the priority of the task queue.

[0050] The arbitration module 133 is configured to prioritize the task queues to be run based on the scheduling priority of each task queue to be run. After the ranking is completed, the task queues with higher priorities in the task queues to be run are arbitrated according to the priority ranking of the task queues to be run and the number of hardware execution resource slots; and the identity of the task queue with higher priority is sent to the hardware scheduling module 120 for loading notification.

[0051] For example, suppose there is a task queue whose working status attributes include the following three parameters: pending workload, which indicates the number of tasks in the queue that have not been processed; push time, which indicates the time when the task is submitted to the queue, the longer the time, the higher the priority; queue waiting time, which indicates the time the task waits in the queue, the longer the waiting time, the higher the priority.

[0052] Each parameter is assigned a weight value in advance to reflect its importance in the priority calculation. Assume the weight values ​​are as follows: w 1= 0.5, w 2= 0.2, w3=0.3; Assume that the task queue attribute pending workload: 10, indicating that there are 10 tasks to be processed, push time: 5, indicating that the task was submitted for 5 time units; queue waiting time: 3, indicating that the task waited in the queue for 3 time units.

[0053] According to the weighted sum algorithm, the above specific values ​​are substituted into the above weighted sum formula to obtain a priority of 7.1. The scheduling priority value of the task queue is compared with the priorities of other task queues to determine which task queue should be executed first.

[0054] In this embodiment, by real-time dynamic monitoring and calculation of the priority of each task queue to be run, the scheduling order of task queue loading can be dynamically adjusted to balance the needs of different types of task queues and reduce the time loss caused by task interruption during scheduling.

[0055] In some embodiments, the working status attributes of the task queue to be run include: workload to be processed, push time and queue waiting time, which also provide a calculation basis for more accurately evaluating the urgency and resource requirements of each task queue.

[0056] Priority calculation module 133 is specifically configured to perform weighted sum calculation according to the workload to be processed, push time and queue waiting time to obtain the scheduling priority of each pending task queue. Specifically, whether the current subtask is completed can be assigned a weight value, for example, the completed subtask may be assigned a lower weight, while the unfinished subtask will be assigned a higher weight. The workload to be processed is evaluated according to the number of remaining pending tasks in the task queue, and the more the number, the higher the weight. The push time takes into account the time when the task queue is postponed for execution, and the longer the postponement time, the corresponding increase in its weight.

[0057] The specific weighted sum calculation formula is similar to the above, and the parameters are different, which will not be repeated here. In this embodiment, through the above real-time calculation, the priority of each task queue can be dynamically adjusted, thereby achieving more efficient resource scheduling.

[0058] See again Figure 6 In some embodiments, the hardware scheduling module 120 is configured to match and load the task queue to the corresponding hardware execution resource slot according to the identity of the task queue after receiving the identity of the task queue with a higher priority. When the hardware scheduling module 120 receives a loading notification from the arbitration module, it identifies the high-priority task queue that needs to be loaded.

[0059] The hardware scheduling module 120 queries the currently available hardware execution resource slots and determines the location of the target hardware execution resource slot according to the identity identifier. The high priority task queue is loaded into the target hardware execution resource slot and the task is started to be executed, ensuring that the high priority task can quickly obtain the necessary hardware resources, thereby reducing response delays.

[0060] If there are multiple task queues to be loaded, the hardware scheduling module 120 can select the corresponding hardware execution resource slot for loading according to the priority sorting. At the same time, other unloaded task queues to be run will be sent to the scheduling sorting list for subsequent re-evaluation of their priorities and resource requirements.

[0061] It is understandable that, before the processor performs the technical scheme of the aforementioned embodiment, it is also necessary to carry out some hardware configurations, for example, configure the priority attribute of task queue, and configuration can be realized on the hardware resource management software relevant to task scheduling.In certain embodiments, each described task queue carries the priority attribute, and the value of the described priority attribute of configuration is a dynamically variable value.In the present embodiment, by this configuration, can in the task queue scheduling process, make arbitration module 130 obtain the actual working state attribute of task queue in real time, and dynamically calculate and adjust the scheduling priority, realize the balanced allocation management of hardware resources.

[0062] See also Figure 8 Before executing the hardware scheduling process, the method further includes: applying for a hardware execution resource slot for the task queue on the hardware resource management software, specifically: After the user program is converted by the hardware resource management software, it will become several task queues, and hardware execution resource slots will be applied for the task queues; Determine whether the number of hardware execution resource slots is sufficient. If sufficient, select an idle hardware execution resource slot, match the task queue with it, and end the process; If it is insufficient, the task queue will be sent to the scheduling sorting list and the process will end.

[0063] In the case where the hardware execution resource slots are insufficient, that is, over-subscription occurs, the hardware scheduling process may be entered next, that is, the task process executed by the arbitration module and the hardware scheduling module of the processor mentioned in the aforementioned embodiments, which will not be repeated here.

[0064] In this embodiment, the arbitration module may also be implemented by hardware, software, or a combination of hardware and software to improve the efficiency of task scheduling and efficient management of hardware resources.

[0065] In some embodiments, the arbitration module may be designed and implemented using a hardware platform such as an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA).

[0066] In other embodiments, the arbitration module 130 uses FPGA as a hardware accelerator, which is responsible for executing high-frequency real-time task scheduling calculations, and runs a software control layer, i.e., hardware resource management software, on the main processor, which is responsible for managing the overall logic of the arbitration module, including the management of task queues, priority sorting, and arbitration decisions. The software control layer communicates with the hardware accelerator to obtain calculation results from the FPGA regularly or in real time, and prioritizes them according to these results. Data can be transmitted between the hardware acceleration unit and the software control layer via a high-speed bus. The software control layer sends the information of the task queue to be run to the FPGA, and the FPGA returns the result to the software control layer after completing the calculation. The software control layer sends the identity of the task queue with a higher priority to the hardware scheduling module for loading and execution.

[0067] It should be noted that some implementation methods of the arbitration module exemplified above cannot be regarded as specific limitations on the arbitration module in this embodiment. They are only used to help understanding. As long as the task flow logic executed by the arbitration module in the processor mentioned in this application can be implemented, it is not limited to a specific implementation method in hardware or software.

[0068] Among them, the working status attributes of the task queue based on the scheduling priority are not limited to the parameters listed above, and the quantity can also be increased or changed. The weighted calculation algorithm is also not limited to the weighted sum algorithm mentioned above. For example, the scheduling priority can also be calculated through the multi-attribute decision analysis (MADA) algorithm. Alternatively, a decision tree algorithm is used to build a decision tree model to determine the priority of each task based on the working status attributes of the task queue, such as the workload to be processed, the push time, and the queue waiting time. The decision tree divides tasks into different priority categories through a series of conditional judgments, and can be used to handle complex decision logic scenarios.

[0069] In addition, the present application uses the task scheduling of one GPU as an example to facilitate understanding, and the same is applicable to the scheduling and arbitration of task queues in multiple GPUs.

[0070] See also Fig. 9 The present application also provides an arbitration method 200 for scheduling a task queue in an embodiment, and the arbitration method includes: S210, before matching the execution task queue with the hardware execution resource slot, calculating the scheduling priority of the task queue according to the real-time working status attribute of the task queue; S220, arbitrating the priority order of the task queues that need to be unloaded or loaded according to the scheduling priorities of the task queues; S230 . Send the identities of the corresponding task queues to the hardware scheduling module in sequence according to the priority order.

[0071] Specifically, after step S230, the method further includes: unloading the task queue from the corresponding hardware execution resource slot according to the identity identifier of the task queue, or matching and loading the task queue to the corresponding hardware execution resource slot.

[0072] The arbitration method for task queue scheduling provided by the embodiment of the present invention dynamically adjusts the scheduling order of different types of task queues according to the real-time working status attributes of the task queues, thereby ensuring that task queues that need to work frequently or for a long time can use more hardware resources, and also takes into account the waiting time of other types of queues, etc., to provide them with reasonable opportunities to occupy hardware resources for operation, and facilitate more balanced scheduling and allocation of corresponding hardware resources to different task queues, thereby more reasonably improving the scheduling efficiency and reducing the time loss in scheduling.

[0073] In some embodiments, the scheduling priority of the task queue is calculated based on the real-time working status attributes of the task queue, including: querying and obtaining the working status attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; calculating the scheduling priority of each task queue based on the working status attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; prioritizing the task queues based on the scheduling priorities of all task queues; arbitrating the task queues with lower priorities in the running task queues based on the priority sorting and the number of hardware execution resource slots; and issuing the identity of the task queues with lower priorities to unload the task queues in the corresponding hardware execution resource slots and release hardware resource occupation.

[0074] In some embodiments, the scheduling priority of the task queue is calculated based on the real-time working status attributes of the task queue, including: querying and obtaining the working status attributes of the task queue to be run in the scheduling sort list; calculating the scheduling priority of each task queue to be run based on the working status attributes of the task queue to be run; prioritizing the task queues to be run based on the scheduling priority of each task queue to be run; arbitrating the task queues with higher priorities in the task queues to be run based on the priority sorting of the task queues to be run and the number of hardware execution resource slots; and issuing the identity of the task queue with higher priority to load it into the corresponding hardware execution resource slot to ensure the operation of high-priority tasks.

[0075] To help understand the technical solutions provided in the embodiments of the present application, Figures 10 to 12 , an exemplary embodiment is described as follows: See also Fig.10 ,When the number of task queues to be processed is greater than the number of ,hardware execution resource slots, the system generates an over-subscription ,problem, resulting in that some task queues cannot immediately obtain ,matched hardware execution resource slots.

[0076] like Fig.10 As shown, the hardware resource management software applies for hardware execution resource slots for each task queue and starts the work. Task queues that exceed the number of hardware execution resource slots are sent to the scheduling sorting list to wait for the subsequent hardware scheduling process.

[0077] like Fig.11 As shown, when the time slice of the scheduling process is completed, the system starts the hardware scheduling process. First, the arbitration module 130 obtains the attributes of the currently working task queue, and then obtains the attributes of the task queue to be run in the scheduling sort list. Based on the attributes of all the above queues, the arbitration module calculates the scheduling priority during unloading.

[0078] Since there are many pending tasks in task queue 1, the calculated scheduling priority will be very high. At the same time, queues 2 and 3 have been executed for a certain period of time, while task queues 4 and 5 have been waiting for a period of time, so the scheduling priority calculated by task queues 4 and 5 will be higher than that of task queues 2 and 3. The arbitration module decides to unload task queues 2 and 3 based on the actual working status of the above task queues, and sends an unloading notification to the hardware scheduling module, wherein the unloading notification carries the identity of the task queue to be unloaded.

[0079] The hardware scheduling module unloads task queues 2 and 3 from the hardware execution resource slot according to the identity of the task queue that needs to be unloaded, and sends them to the scheduling sort list to complete the unloading process.

[0080] like Fig.12 As shown in FIG. 1 , after the unloading process is completed, the system starts the loading process. The arbitration module obtains the attributes of the task queue to be run in the scheduling sort list and calculates the scheduling priority during loading.

[0081] Since task queues 2 and 3 have been executed for a certain period of time, and task queues 4 and 5 have been waiting for a period of time, the scheduling priority calculated by task queues 4 and 5 will be higher than that of task queues 2 and 3. The arbitration module decides to load task queues 4 and 5 based on the actual situation of the above queues, and sends a notification to the hardware scheduling module, wherein the loading notification carries the identity of the task queue to be loaded.

[0082] The hardware scheduling module loads task queues 4 and 5 into the idle hardware execution resource slots according to the identities of the task queues to be loaded, and removes the two queues from the scheduling sort list to complete the loading process.

[0083] When the hardware scheduling process starts next time, the above steps will be repeated to ensure the normal operation of all task queues.

[0084] In the embodiment of the present application, through the above technical solution, the relationship between the task queue and the hardware execution resource slot can be effectively managed to achieve dynamic and flexible task scheduling. The over-subscription problem is solved, resource utilization is improved, and while ensuring that high-priority tasks can obtain execution opportunities in a timely manner, other task queues are taken into account, so as to facilitate a more balanced scheduling of the corresponding hardware resources allocated to different task queues. In addition, through real-time monitoring and dynamic adjustment of priority sorting, the system can respond to changes quickly, improve overall processing efficiency, and thus improve processor performance.

[0085] It should be noted that the arbitration method for task queue scheduling provided in the embodiment of the present application also includes the technical solutions of other embodiments mentioned in the aforementioned processor embodiment, which can be referenced and added when necessary. They will not be repeated here and can be referenced to each other.

[0086] Compared with the unchanging priority scheduling method of the prior art, the technical solution provided in the embodiment of the present application dynamically adjusts the actual scheduling order according to the actual operation status of the task queue before scheduling hardware resources, comprehensively takes into account different task queues, and is suitable for task queues with different demand characteristics, so as to facilitate more balanced scheduling and allocation of corresponding hardware resources to different task queues.

[0087] Fig.13 This is a schematic block diagram of the architecture of an embodiment of the electronic device of the present application; based on the same technical concept as the above-mentioned embodiment 1, the electronic device provided by the embodiment of the present application includes: one or more processors; a memory; the memory stores one or more executable program codes, and the one or more processors read the executable program codes stored in the memory to run the program corresponding to the executable program code, so as to execute the arbitration method for task queue scheduling or the task operation processing method described in any one of the embodiments 1. Fig.13 As shown, the arbitration method step flow of the task queue scheduling described in any of the aforementioned embodiments of the present application can be implemented.

[0088] The above-mentioned electronic device may include: a shell 41, a processor 42, a memory 43, a circuit board 44 and a power supply circuit 45, wherein the circuit board 44 is arranged inside the space enclosed by the shell 41, and the processor 42 and the memory 43 are arranged on the circuit board 44; the power supply circuit 45 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 43 is used to store executable program codes; the processor 42 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 43, so as to execute the arbitration method of task queue scheduling described in any of the above-mentioned embodiments.

[0089] The specific execution process of the processor 42 for the above steps and the steps further executed by the processor 42 by running the executable program code can be found in the description of Example 1 of the present application, which will not be repeated here.

[0090] The electronic device exists in many forms, including but not limited to: (1) Mobile communication devices: These devices are characterized by their mobile communication functions and their main purpose is to provide voice and data communications. These terminals include: smart phones (such as iPhone), multimedia phones, feature phones, and low-end phones.

[0091] (2) Ultra-mobile personal computer devices: These devices fall into the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, such as iPad.

[0092] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as iPods), handheld game consoles, e-books, smart toys, and portable car navigation devices.

[0093] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general-purpose computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.

[0094] (5) Other electronic devices with data interaction functions.

[0095] The present application also provides a computer-readable storage medium in an embodiment, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to execute the arbitration method for task queue scheduling described in any of the aforementioned embodiments.

[0096] In summary, the arbitration method, processor, electronic device and storage medium for task queue scheduling provided in the embodiments of the present application dynamically adjust the scheduling order of different types of task queues according to the real-time working status attributes of the task queues, thereby ensuring that task queues that need to work frequently or for a long time can use more hardware resources, and also taking into account the waiting time of other types of queues, etc., to provide them with reasonable operation opportunities. When the number of task queues is greater than the number of hardware execution resource slots, it is convenient to more evenly schedule the corresponding hardware resources allocated to different task queues, which is beneficial to improving the efficiency of task scheduling and reducing the time loss in task scheduling, thereby improving the overall task processing efficiency.

[0097] It should be noted that, in this article, the emphasis of the scheme described between the various embodiments is different, but the various embodiments have a certain interrelated relationship. When understanding the scheme of the present application, the various embodiments can refer to each other; in addition, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or measurement control unit including a series of elements includes not only those elements, but also other elements that are not explicitly listed, or also includes elements inherent to such process, method, article or measurement control unit. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or measurement control unit including the elements.

[0098] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A processor, characterized in that: include: An arbitration module, configured to calculate the scheduling priority of the task queue according to the real-time working status attribute of the task queue; Arbitrating the priority order of the task queues that need to be unloaded or loaded according to the scheduling priority of the task queues; According to the priority order, the identity identifiers of the corresponding task queues are sent to the hardware scheduling module in sequence; The hardware scheduling module is configured to unload the task queue from the corresponding hardware execution resource slot according to the identity identifier of the task queue, or match and load the task queue to the corresponding hardware execution resource slot.

2. The processor according to claim 1, wherein: The arbitration module includes: an attribute acquisition module configured to query and acquire the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and A priority calculation module is configured to calculate the scheduling priority of each task queue according to the working state attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; and, a ruling module configured to prioritize the task queues based on the scheduling priorities of all the task queues; According to the priority sorting and the number of hardware execution resource slots, arbitrating a task queue with a lower priority among the running task queues; The identity identifier of the task queue with a lower priority is sent as an uninstallation notification to the hardware scheduling module.

3. The processor according to claim 2, wherein: The working status attributes of the running task queue include: whether the current subtask is completed, the amount of work to be processed and the push time; The priority calculation module is specifically configured to perform a weighted sum calculation based on whether the current subtask is completed, the workload to be processed and the push time to obtain the scheduling priority of each task queue.

4. The processor according to claim 2 or 3, characterized in that The hardware scheduling module is configured to send the unloaded task queue to a scheduling sorting list after unloading the task queue from the corresponding hardware execution resource slot.

5. The processor according to claim 1, wherein: The arbitration module includes: an attribute acquisition module configured to query and acquire the working status attributes of the waiting-to-run task queue in the scheduling sorting list; A priority calculation module, configured to calculate the scheduling priority of each of the to-be-run task queues according to the working state attributes of the to-be-run task queues; and, a decision module configured to prioritize the to-be-run task queues based on the scheduling priority of each of the to-be-run task queues; According to the priority ranking of the task queues to be run and the number of hardware execution resource slots, arbitrating a task queue with a higher priority in the task queues to be run; The identity identifier of the task queue with a higher priority is sent as a loading notification to the hardware scheduling module.

6. The processor according to claim 5, wherein: The working status attributes of the task queue to be run include: the amount of work to be processed, the push time, and the queue waiting time; The priority calculation module is specifically configured to perform weighted sum calculation according to the workload to be processed, the push time and the queue waiting time to obtain the scheduling priority of each of the queues of tasks to be processed.

7. The processor according to claim 5 or 6, characterized in that The hardware scheduling module is configured to send the unloaded task queues in the task queue to be run into a scheduling sort list after matching and loading the task queues into corresponding hardware execution resource slots.

8. The processor of claim 1, wherein: Each of the task queues carries a priority attribute, and the value of the priority attribute is configured to be a dynamically variable value.

9. A method for arbitrating task queue scheduling, characterized in that: The arbitration method comprises: Calculate the scheduling priority of the task queue according to the real-time working status attribute of the task queue; Arbitrating the priority order of the task queues that need to be unloaded or loaded according to the scheduling priority of the task queues; According to the priority order, the identities of the corresponding task queues are sent to the hardware scheduling module in sequence.

10. The arbitration method for task queue scheduling according to claim 9, characterized in that: According to the real-time working status attribute of the task queue, the scheduling priority of the task queue is calculated, including: Query and obtain the working status attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; Calculate the scheduling priority of each task queue according to the working status attributes of the running task queue and the working attributes of the task queue to be run in the scheduling sort list; Prioritize task queues based on the scheduling priorities of all task queues; According to the priority sorting and the number of hardware execution resource slots, arbitrating a task queue with a lower priority among the running task queues; The identity of the task queue with the lower priority is issued.

11. The arbitration method for task queue scheduling according to claim 9, characterized in that: According to the real-time working status attribute of the task queue, the scheduling priority of the task queue is calculated, including: Query and obtain the working status attributes of the waiting task queue in the scheduling sort list; Calculating the scheduling priority of each of the to-be-run task queues according to the working status attributes of the to-be-run task queues; Based on the scheduling priority of each of the to-be-run task queues, the to-be-run task queues are prioritized; According to the priority ranking of the task queues to be run and the number of hardware execution resource slots, arbitrating a task queue with a higher priority in the task queues to be run; The identity of the task queue with a higher priority is issued.

12. An electronic device, characterized in that: include: One or more processors; Memory; One or more executable program codes are stored in the memory, and the one or more processors read the executable program codes stored in the memory and run the program corresponding to the executable program codes to execute the arbitration method for task queue scheduling described in any one of claims 9 to 11.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to execute the arbitration method for task queue scheduling described in any one of claims 9 to 11.

Citation Information

Cited By

  • Storage device and control method thereof

    CN120010790A

  • A storage device and its control method

    CN120010790B

  • Flow arbitration device and method

    CN120238506A

  • Task-based resource scheduling method, electronic equipment and computer readable medium

    CN120371484A

  • Kubernetes off-line task scheduling time prediction method and device

    CN120448052A