Credit adjustment circuit and method, task scheduling circuit and method, circuit and medium

By introducing a credit adjustment circuit into the credit scheduling system, the credit of each queue is dynamically adjusted, and the air conditioning problems and credit waste caused by the queue due to insufficient credit are solved, achieving more efficient task scheduling and user experience.

CN114896045BActive Publication Date: 2025-03-28SHANGHAI BIREN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210602485.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2025-03-28
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

When the existing credit scheduling method is unreasonable, it is easy for some queues to be unable to schedule tasks (air conditioning) or credit waste due to insufficient credit.

Method used

A credit adjustment circuit is designed, including a credit monitoring module and a credit adjustment module. By monitoring the credit application requests of each queue, the first selected queue and the second selected queue are determined, and their credit is adjusted to dynamically adjust the credit distribution between the queues.

Benefits of technology

It effectively reduces the number of air conditioning times, makes full use of the remaining credit, and improves the efficiency and user experience of task scheduling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896045B_ABST
    Figure CN114896045B_ABST
Patent Text Reader

Abstract

A credit adjustment circuit, a task scheduling circuit, a credit adjustment method, a task scheduling method, an integrated circuit and a non-transitory computer storage medium. The credit adjustment circuit is used to adjust the credit of at least part of a plurality of queues, and comprises: a credit monitoring module and a credit adjustment module. Each queue is allocated at least one credit; the credit monitoring module is configured to monitor a plurality of credit application requests corresponding to the plurality of queues respectively; the credit adjustment module is configured to obtain a plurality of credit application requests, determine a first selected queue and a second selected queue among the plurality of queues based on the plurality of credit application requests, and adjust the credit corresponding to the first selected queue and the credit corresponding to the second selected queue.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to a credit adjustment circuit, a task scheduling circuit, a credit adjustment method, a task scheduling method, an integrated circuit, and a non-transitory computer storage medium. Background Art

[0002] In the scenario of multi-user or multi-virtual graphics processing unit (GPU) task scheduling, the credit scheduling method can be used to schedule and execute tasks. The existing credit scheduling method mainly relies on software to configure the credit value for each queue. Each queue can be configured with a different credit value. Then, after a queue schedules a task, the queue will reduce the corresponding credit value. The credit value is determined by the information carried by the scheduled task. The credit values ​​corresponding to different tasks can be different or the same. After the scheduled task is processed, the queue will add back the corresponding credit value, that is, credit recycling. The software limits the scheduling capacity of the queue by configuring the initial credit value for each queue and the corresponding credit value for each task. Summary of the invention

[0003] At least one embodiment of the present disclosure provides a credit adjustment circuit for adjusting the credit of at least part of a plurality of queues, and comprises: a credit monitoring module and a credit adjustment module, wherein each queue is allocated at least one credit; the credit monitoring module is configured to monitor a plurality of credit application requests corresponding to the plurality of queues respectively; the credit adjustment module is configured to obtain the plurality of credit application requests, determine a first selected queue and a second selected queue among the plurality of queues based on the plurality of credit application requests, and adjust the credit corresponding to the first selected queue and the credit corresponding to the second selected queue.

[0004] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the credit application request corresponding to each queue includes a credit increase request and a credit reduction request, wherein the credit increase request includes the credit deficiency quantity, credit deficiency times and credit increase indication signal corresponding to the queue; the credit reduction request includes the credit redundancy quantity, credit redundancy times and credit reduction indication signal corresponding to the queue.

[0005] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the credit monitoring module includes a first credit quantity recording module, a first counting module and a first indication signal determination module corresponding to each queue, and for each queue: the first credit quantity recording module is configured to record the number of credit shortages corresponding to the queue; the first counting module is configured to record the number of credit shortages corresponding to the queue; the first indication signal determination module is configured to determine the credit increase indication signal corresponding to the queue based on the number of credit shortages corresponding to the queue and a shortage number threshold corresponding to the queue.

[0006] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the first credit quantity recording module includes a first quantity recording sub-module. For each queue, when a task in the queue is arbitrated, the first quantity recording sub-module is configured to: in response to the task being over-scheduled, record the number of credits required for the task that is over-scheduled, and determine the credit shortage quantity based on the number of remaining credits in the queue and the number of credits required for the task that is over-scheduled; in response to any task in the queue being scheduled out for execution, clear the credit shortage quantity.

[0007] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the first credit quantity recording module also includes a first missing comparator. When the task in the queue is arbitrated, the first missing comparator is configured to: compare the number of credits required for the task and the number of remaining credits in the queue, and in response to the number of credits required for the task being greater than the number of remaining credits in the queue, determine that the task is scheduled once; and in response to the number of credits required for the task being less than or equal to the number of remaining credits in the queue, determine that the task can be scheduled for execution.

[0008] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the first counting module includes a missing counter, and the missing counter is configured to, in response to monitoring that the task is under-adjusted, add a first value to the number of credit missing times corresponding to the queue; in response to any task in the queue being scheduled out for execution, clear the number of credit missing times corresponding to the queue.

[0009] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the first indication signal determination module includes a second missing comparator and a first signal determination submodule, the second missing comparator is configured to: compare the number of credit missing times corresponding to the queue with the missing times threshold corresponding to the queue to obtain a missing times comparison result; the first signal generation submodule is configured to: in response to the missing times comparison result indicating that the number of credit missing times corresponding to the queue is greater than or equal to the missing times threshold corresponding to the queue, determine that the credit increase indication signal corresponding to the queue is a first increase signal; in response to the missing times comparison result indicating that the number of credit missing times corresponding to the queue is less than the missing times threshold corresponding to the queue, determine that the credit increase indication signal corresponding to the queue is a second increase signal.

[0010] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the first indication signal determination module further includes a first memory, and the first memory is configured to store a lack times threshold value corresponding to the queue.

[0011] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the credit monitoring module includes a second credit quantity recording module, a second counting module and a second indication signal determination module corresponding to each queue, and for each queue: the second credit quantity recording module is configured to record the credit redundancy quantity corresponding to the queue; the second counting module is configured to record the number of credit redundancy times corresponding to the queue; the second indication signal determination module is configured to determine the credit reduction indication signal corresponding to the queue based on the credit redundancy times corresponding to the queue and the redundancy times threshold corresponding to the queue.

[0012] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the second credit quantity recording module includes a second quantity recording submodule, and for each queue, the second quantity recording submodule is configured to: record the number of remaining credits of the queue as the credit redundancy number.

[0013] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the second counting module includes a first redundant comparator and a redundant counter. When a task in the queue is scheduled out for execution, the first redundant comparator is configured to compare the number of remaining credits of the queue with the redundant number threshold corresponding to the queue, and in response to the number of remaining credits of the queue being greater than or equal to the redundant number threshold corresponding to the queue, determine that the number comparison result is a first result; in response to the number of remaining credits of the queue being less than the redundant number threshold corresponding to the queue, determine that the number comparison result is a second result; the redundant counter is configured to add a second value to the number of credit redundancy times corresponding to the queue in response to the number comparison result being the first result.

[0014] For example, in the credit adjustment circuit provided in at least one embodiment of the present disclosure, the redundancy counter is further configured to clear the credit redundancy times corresponding to the queue to zero in response to the quantity comparison result being the second result.

[0015] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the second indication signal determination module includes a second redundancy comparator and a second signal determination submodule, and the second redundancy comparator is configured to: compare the credit redundancy number corresponding to the queue with the redundancy number threshold corresponding to the queue to obtain a redundancy number comparison result; the second signal generation submodule is configured to: in response to the redundancy number comparison result indicating that the credit redundancy number corresponding to the queue is greater than or equal to the redundancy number threshold corresponding to the queue, determine that the credit reduction indication signal corresponding to the queue is a first reduction signal; in response to the redundancy number comparison result indicating that the credit redundancy number corresponding to the queue is less than the redundancy number threshold corresponding to the queue, determine that the credit reduction indication signal corresponding to the queue is a second reduction signal.

[0016] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the second indication signal determination module further includes a second memory, and the second memory is configured to store a redundancy number threshold corresponding to the queue.

[0017] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, among the multiple queues, the first selected queue corresponds to the largest number of credit shortages, and the first selected queue corresponds to the largest number of credit shortages, and among the multiple queues, the second selected queue corresponds to the largest number of credit redundancy, and the second selected queue corresponds to the largest number of credit redundancy times.

[0018] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the credit adjustment module includes a missing number arbitration module, a missing quantity arbitration module and a first selection module, wherein the missing number arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest number of credit missing from the multiple queues as at least one first queue to be adjusted; the missing quantity arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest number of credit missing from the at least one first queue to be adjusted as at least one second queue to be adjusted; and the first selection module is configured to determine the first selected queue from the at least one second queue to be adjusted.

[0019] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the first selection module is configured to determine the first selected queue from the at least one second queue to be adjusted according to at least one queue number that corresponds one-to-one to the at least one second queue to be adjusted.

[0020] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the credit adjustment module includes a redundancy number arbitration module, a remaining number arbitration module and a second selection module, wherein the redundancy number arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest credit redundancy number from the multiple queues as at least one third queue to be adjusted; the remaining number arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest credit redundancy number from the at least one third queue to be adjusted as at least one fourth queue to be adjusted; and the second selection module is configured to determine the second selected queue from the at least one fourth queue to be adjusted.

[0021] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the second selection module is configured to determine the second selected queue from the at least one fourth queue to be adjusted according to at least one queue number that corresponds one-to-one with the at least one fourth queue to be adjusted.

[0022] For example, in the credit adjustment circuit provided in at least one embodiment of the present disclosure, the credit adjustment module also includes a first adjustment module, and the first adjustment module is configured to: determine the credit to be adjusted in the second selected queue; and add the credit to be adjusted to the first selected queue.

[0023] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, when executing the step of determining the credit to be adjusted in the second selected queue, the first adjustment module is configured to: determine the number to be adjusted based on at least one credit redundancy number corresponding one-to-one to the at least one third queue to be adjusted; determine the target adjustment number based on the number to be adjusted and the number adjustment coefficient; determine the credit to be adjusted in the second selected queue based on the target adjustment number, wherein the number of credits to be adjusted is equal to the target adjustment number.

[0024] For example, in the credit adjustment circuit provided by at least one embodiment of the present disclosure, the credit adjustment module includes a second adjustment module, and the second adjustment module is configured to determine at least one request to increase credit queue and at least one request to reduce credit queue based on the multiple credit application requests, wherein the at least one request to increase credit queue is a queue that needs to increase credit, and the at least one request to reduce credit queue is a queue that needs to reduce credit, and in response to the number of the at least one request to increase credit queue and the number of the at least one request to reduce credit queue meeting a preset condition, at least one of the missing number threshold, the redundant number threshold and the redundant number threshold corresponding to at least some of the multiple queues is adjusted.

[0025] At least one embodiment of the present disclosure further provides a task scheduling circuit, comprising: a credit arbitrator, comprising a task arbitration circuit and the credit adjustment circuit provided by any embodiment of the present disclosure, and configured to arbitrate the multiple queues to obtain a credit arbitration result; a time wheel arbitrator, configured to arbitrate the tasks stored on the time wheel to obtain a time wheel arbitration result; a scheduler, configured to determine a target arbitration result based on the credit arbitration result and the time wheel arbitration result, and schedule the target arbitration result for execution.

[0026] For example, in the task scheduling circuit provided by at least one embodiment of the present disclosure, the credit adjustment circuit is configured to dynamically adjust the credits corresponding to the multiple queues, and the task arbitration circuit is configured to arbitrate all tasks in the multiple queues to obtain credit arbitration tasks, wherein the credit arbitration result includes the credit arbitration tasks.

[0027] For example, in a task scheduling circuit provided by at least one embodiment of the present disclosure, the scheduler includes a multiplexer and a scheduling module, and the multiplexer is configured to: in response to the timing wheel arbitration result including a task stored on the timing wheel, determine that the target arbitration result includes the task on the timing wheel; in response to the timing wheel arbitration result not including any task and the credit arbitration result including a credit arbitration task, determine that the target arbitration result includes the credit arbitration task; and the scheduling module is configured to schedule the target arbitration result for execution.

[0028] At least one embodiment of the present disclosure further provides a credit adjustment method, which is applied to the credit adjustment circuit provided in any embodiment of the present disclosure, wherein the credit adjustment method includes: monitoring the multiple credit application requests corresponding to the multiple queues respectively; determining the first selected queue and the second selected queue among the multiple queues based on the multiple credit application requests; and adjusting the credit corresponding to the first selected queue and the credit corresponding to the second selected queue.

[0029] At least one embodiment of the present disclosure further provides a task scheduling method, which is applied to the task scheduling circuit provided by any embodiment of the present disclosure, wherein the task scheduling method includes: arbitrating the multiple queues to obtain the credit arbitration result; arbitrating the tasks stored on the time wheel to obtain the time wheel arbitration result; determining the target arbitration result based on the credit arbitration result and the time wheel arbitration result; and scheduling the target arbitration result for execution.

[0030] For example, in the task scheduling method provided by at least one embodiment of the present disclosure, the target arbitration result is determined based on the credit arbitration result and the time wheel arbitration result, including: in response to the time wheel arbitration result including a task stored on the time wheel, determining that the target arbitration result includes the task on the time wheel; in response to the time wheel arbitration result not including any task and the credit arbitration result including a credit arbitration task, determining that the target arbitration result includes the credit arbitration task.

[0031] At least one embodiment of the present disclosure further provides an integrated circuit, comprising the credit adjustment circuit provided according to any embodiment of the present disclosure.

[0032] At least one embodiment of the present disclosure further provides a non-transitory computer storage medium for storing computer-executable instructions, wherein, when the computer-executable instructions are executed by a computer, the computer executes the credit adjustment method provided according to any embodiment of the present disclosure or executes the task scheduling method provided according to any embodiment of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure.

[0034] Figure 1A A schematic block diagram of a credit adjustment circuit provided for at least one embodiment of the present disclosure;

[0035] Figure 1B A schematic structural diagram of a credit adjustment circuit provided for at least one embodiment of the present disclosure;

[0036] Figure 2 A schematic diagram of multiple queues provided for at least one embodiment of the present disclosure;

[0037] Figure 3 A schematic diagram of the structure of a credit monitoring module provided by at least one embodiment of the present disclosure;

[0038] Figure 4 A structural diagram of a credit adjustment module provided by at least one embodiment of the present disclosure;

[0039] Figure 5 A schematic block diagram of a task scheduling circuit provided for at least one embodiment of the present disclosure;

[0040] Figure 6 A schematic structural diagram of a task scheduling circuit provided for at least one embodiment of the present disclosure;

[0041] Figure 7 A schematic flow chart of a credit adjustment method provided for at least one embodiment of the present disclosure;

[0042] Figure 8 A schematic flow chart of a task scheduling method provided for at least one embodiment of the present disclosure;

[0043] Fig. 9 A schematic block diagram of an integrated circuit provided for at least one embodiment of the present disclosure;

[0044] Fig.10 A schematic diagram of a non-transitory computer storage medium provided for at least one embodiment of the present disclosure. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0046] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0047] In order to keep the following description of the embodiments of the present disclosure clear and concise, the present disclosure omits detailed descriptions of some known functions and known components.

[0048] The problem with the current credit scheduling method is that when the credit configuration of each queue is unreasonable, it often leads to a queue being unable to schedule tasks due to lack of credit, that is, an empty schedule occurs (that is, the task cannot be scheduled because the remaining credit of the queue is less than the credit required for the task), or a queue always has surplus credit, resulting in credit waste.

[0049] From the perspective of system scheduling, the total value of credits that can be configured for all queues is a limited and fixed value, which is determined based on factors such as hardware (memory, etc.). Then, the software determines how to allocate credits to each queue. Different queues may correspond to tasks of different hardware processors. If the software allocates unreasonable credits to each queue, it is easy to cause some queues to be frequently not scheduled, resulting in empty scheduling, which causes efficiency loss, or some queues always have surplus credits, which does not achieve the effect of reasonable credit allocation.

[0050] At least one embodiment of the present disclosure provides a credit adjustment circuit, which is used to adjust the credit of at least part of the queues in a plurality of queues, and includes: a credit monitoring module and a credit adjustment module. Each queue is assigned at least one credit; the credit monitoring module is configured to monitor a plurality of credit application requests corresponding to the plurality of queues; the credit adjustment module is configured to obtain a plurality of credit application requests, determine a first selected queue and a second selected queue in the plurality of queues based on the plurality of credit application requests, and adjust the credit corresponding to the first selected queue and the credit corresponding to the second selected queue.

[0051] In the credit adjustment circuit provided in the embodiment of the present disclosure, by monitoring multiple credit application requests corresponding to multiple queues, and dynamically adjusting the credit between different queues based on the multiple credit application requests, the purpose of reducing the number of empty scheduling times and making full use of the remaining credit is comprehensively achieved, thereby improving scheduling efficiency, realizing efficient task scheduling, and increasing the task processing speed, thereby improving user experience.

[0052] At least one embodiment of the present disclosure further provides a credit adjustment method, a task scheduling circuit, a task scheduling method, an integrated circuit, and a non-transitory computer storage medium.

[0053] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings, but the present disclosure is not limited to these specific embodiments.

[0054] Figure 1A A schematic block diagram of a credit adjustment circuit provided by at least one embodiment of the present disclosure, Figure 1B A schematic structural diagram of a credit adjustment circuit provided for at least one embodiment of the present disclosure.

[0055] like Figure 1A and Figure 1B As shown, the credit adjustment circuit 100 is used to adjust the credit of at least part of the queues in the plurality of queues 101, and may include a credit monitoring module 102 and a credit adjustment module 103. Figure 1B As shown, multiple queues 101 are connected to both the credit monitoring module 102 and the credit adjustment module 103, and the credit monitoring module 102 is also connected to the credit adjustment module 103 to achieve information transmission.

[0056] It should be noted that, in some embodiments, the credit adjustment circuit 100 may also include multiple queues 101 .

[0057] For example, the credit adjustment circuit 100 may be a circuit module in an integrated circuit. In the specific circuit design process of the integrated circuit, the integrated circuit may be divided into dozens or hundreds of modules for separate design. For example, each module may be divided according to module function and position relationship, each module may implement a specific function, and each module may exchange data through ports (e.g., input ports and output ports).

[0058] In the embodiments of the present disclosure, the credit adjustment circuit 100 is mainly implemented based on hardware circuits instead of or less implemented by software, thereby reducing the workload of the software, and no software is required to calculate and adjust the number of credits for each queue. For example, in some embodiments, the credit adjustment circuit can be completely implemented based on hardware circuits instead of software, thereby not occupying software resources.

[0059] For example, each queue 101 is assigned at least one credit. The credit monitoring module 102 may be configured to monitor multiple credit application requests corresponding to the multiple queues. The credit adjustment module 103 is configured to obtain multiple credit application requests, determine a first selected queue and a second selected queue from the multiple queues based on the multiple credit application requests, and adjust the credit corresponding to the first selected queue and the credit corresponding to the second selected queue. For example, at least some of the multiple queues 101 include the first selected queue and the second selected queue.

[0060] In the credit adjustment circuit 100 provided in the embodiment of the present disclosure, the credit monitoring module 102 can monitor which queues are always under-regulated and which queues always have surplus credits. Then, the credit adjustment module 103 can dynamically allocate the credits of the queues with surplus credits to the queues that are always under-regulated. Thus, the credit adjustment circuit 100 can comprehensively achieve the purpose of reducing the number of under-regulated times and making full use of the remaining credits.

[0061] For example, for multiple virtual machines, within a period of time, some virtual machines may need to execute a large number of tasks, while other virtual machines may need to execute relatively few tasks. The credit adjustment circuit 100 provided in the embodiment of the present disclosure can dynamically adjust the credits of multiple queues, so that the queues corresponding to the tasks on the virtual machines with many tasks can effectively utilize hardware resources and be scheduled without affecting the scheduling of the queues with fewer tasks.

[0062] For example, each queue 101 may be implemented as a storage space. For example, the storage space may be a device such as a memory bar or a buffer that can cache data.

[0063] Figure 2A schematic diagram of multiple queues provided for at least one embodiment of the present disclosure.

[0064] For example, the number of the multiple queues 101 can be set according to actual conditions, and the present disclosure does not limit this. Figure 2 As shown, in some embodiments, the number of the plurality of queues 102 is 16, that is, the plurality of queues 101 are queue Q0, queue Q1, ..., queue Q14 and queue Q15.

[0065] For example, each queue 101 corresponds to a queue number. For example, the queue numbers of the multiple queues 101 may be numbered sequentially. The queue number of queue Q0 may be 0, the queue number of queue Q1 may be 1, and so on. The queue number of queue Q14 may be 14, and the queue number of queue Q15 may be 15. It should be noted that the queue number of the queue may be set according to actual conditions, and the present disclosure does not impose any specific limitation on this.

[0066] For example, the number of tasks that can be stored in each queue 101 can also be set according to actual conditions, and the present disclosure does not limit this. For example, in some embodiments, the number of tasks corresponding to multiple queues 101 can be the same, for example, Figure 2 As shown, each queue 101 can store 128 tasks t0-t127; in other embodiments, at least some of the numbers of tasks corresponding to the multiple queues 101 can be different. It should be noted that the number of tasks corresponding to a queue represents the number of tasks stored in the queue.

[0067] For example, in some embodiments, the tasks may include different types of tasks such as addition operation, subtraction operation, value operation, write operation and read operation. The types of the multiple tasks in each queue 101 may be the same or different.

[0068] For example, each queue 101 may be configured with at least one credit by software. For example, the initial credit quantities corresponding to the multiple queues 101 may be the same or at least partially different. The initial credit quantity of a queue indicates the number of credits configured by the software for the queue in the initial state. For example, in some embodiments, 512 credits may be allocated to each queue.

[0069] For example, when a task in a queue is scheduled for execution, the number of credits in the queue will change accordingly. Different credits can be assigned to each task according to the complexity of the task. Whenever a task in a queue is executed, the credits corresponding to the task will be consumed. After the task is completed, the consumed credits will be added to the credits corresponding to the queue. Figure 2As shown, in the initial state, 512 credits are allocated to queue Q0. In queue Q0, 1 to 20 credits can be allocated to each task according to the complexity of the task. For example, 5 credits can be allocated to task t0 in queue Q0, 10 credits can be allocated to task t1 in queue Q0, and so on. For example, when task t0 in queue Q0 is executed, 5 credits are consumed, and when task t1 in queue Q0 is executed, 10 credits are consumed. Then, after both task t0 and task t1 in queue Q0 are scheduled for execution, the number of credits corresponding to queue Q0 becomes 497 (512-5-10); after task t0 in queue Q0 is executed, the credits occupied by task t0 in queue Q0 will be released, that is, the 5 credits corresponding to task t0 in queue Q0 will be added back to queue Q0. At this time, if no other tasks in queue Q0 are scheduled for execution, the number of credits corresponding to queue Q0 becomes 502 (497+5).

[0070] It should be noted that the number of credits corresponding to each task is determined according to factors such as the type and complexity of the task, and the embodiments of the present disclosure do not impose specific limitations on this.

[0071] For example, the credit application request corresponding to each queue may include a credit increase request and a credit reduction request, wherein the credit increase request includes the credit shortage quantity, credit shortage times and credit increase indication signal corresponding to the queue, and the credit reduction request includes the credit redundancy quantity, credit redundancy times and credit reduction indication signal corresponding to the queue. That is, the credit increase request may be used to indicate the credit shortage information of the queue, and the credit reduction request may be used to indicate the credit surplus information of the queue.

[0072] It should be understood that, for a certain queue, the number of credit shortages and the number of credit shortages can be 0, that is, the queue does not have a credit shortage (i.e., lack of credit); similarly, the number of credit redundancy and the number of credit redundancy can also be 0, that is, the queue does not have a credit redundancy (i.e., credit is redundant).

[0073] For example, the credit shortage quantity is used to indicate the number of credits that are missing when a task with under-scheduling in the queue is scheduled. The credit shortage quantity may be the difference between the number of credits required for the task with under-scheduling in the queue and the number of remaining credits corresponding to the queue when the task is under-scheduling.

[0074] For example, the credit shortage count is used to indicate the number of times that a queue is continuously under-scheduled, for example, the number of times that a task in the queue is continuously under-scheduled.

[0075] For example, the credit increase indication signal is used to indicate whether the credit corresponding to the queue needs to be dynamically adjusted so that the number of credits corresponding to the queue increases.

[0076] For example, the empty degree indicates that a task in a queue arbitrated by the arbitrator is not scheduled for execution due to insufficient credit remaining in the queue.

[0077] For example, the credit redundancy number is used to indicate the number of remaining credits of the queue at the current moment. The credit redundancy number is used to indicate the number of consecutive times that the number of remaining credits corresponding to the queue is greater than the redundancy number threshold. The credit reduction indication signal is used to indicate whether the credits corresponding to the queue need to be dynamically adjusted so that the number of credits corresponding to the queue is reduced.

[0078] For example, whenever a task in a queue is scheduled for execution, the number of remaining credits corresponding to the queue is compared with the redundant number threshold. When the number of remaining credits corresponding to the queue is greater than the redundant number threshold, the credit redundancy count is determined to be plus 1. When multiple results corresponding to multiple consecutive comparisons are that the number of remaining credits corresponding to the queue is greater than or equal to the redundant number threshold, the number of multiple comparisons is the consecutive number, and when the result of a certain comparison is that the number of remaining credits corresponding to the queue is less than the redundant number threshold, the credit redundancy count is cleared.

[0079] For example, in some embodiments, Figure 2As shown, for queue Q1, after task t0 in queue Q1 is scheduled for execution, the number of remaining credits corresponding to queue Q1 (at this time, the remaining credits corresponding to queue Q1 represent the remaining credits after excluding the credits required for task t0 from the total credits corresponding to queue Q1) is compared with the redundant number threshold. If the number of remaining credits corresponding to queue Q1 is greater than or equal to the redundant number threshold, the number of credit redundancy times corresponding to queue Q1 is increased by 1. At this time, the number of credit redundancy times corresponding to queue Q1 is, for example, 1. After task t1 in queue Q1 is scheduled for execution, the number of credits corresponding to queue Q1 is compared with the redundant number threshold. The remaining credits of the queue Q1 (at this time, the remaining credits of the queue Q1 represent the remaining credits of the total credits of the queue Q1 after deducting the credits required by task t0 and the credits required by task t1) are compared with the redundancy threshold. If the remaining credits of the queue Q1 are greater than or equal to the redundancy threshold, the credit redundancy times of the queue Q1 are increased by 1. At this time, the credit redundancy times of the queue Q1 are, for example, 2. By analogy, when task tn in the queue Q1 is scheduled for execution, the remaining credits of the queue Q1 (at this time, the remaining credits of the queue Q1) are increased by 1. The credit represents the remaining credits after deducting the credits required for task tn and the credits required for tasks t0 to t(n-1) (tasks t0 to t(n-1) are all tasks executed before executing task tn) from the total credits corresponding to queue Q1. The credits are compared with the redundancy threshold. If the number of remaining credits corresponding to queue Q1 is greater than or equal to the redundancy threshold, the credit redundancy number corresponding to queue Q1 is increased by 1. At this time, the credit redundancy number corresponding to queue Q1 is, for example, n+1. That is to say, when each task t0 to tn in queue Q1 is scheduled for execution, queue Q1 The number of remaining credits is greater than or equal to the redundant number threshold; when task t(n+1) in queue Q1 is scheduled for execution, the number of remaining credits corresponding to queue Q1 (at this time, the remaining credits corresponding to queue Q1 represent the credits remaining in the total credits corresponding to queue Q1 after excluding the credits required for task t(n+1) and the credits required for tasks t0~tn) is compared with the redundant number threshold. If the number of remaining credits corresponding to queue Q1 is less than the redundant number threshold, the credit redundancy times corresponding to queue Q1 will be cleared, and the credit redundancy times corresponding to queue Q1 is 0.

[0080] It should be noted that the current time may represent the time when the credit monitoring module 102 monitors multiple credit application requests corresponding to multiple queues respectively.

[0081] For example, each credit application request can be represented in the form of an array, which can include 6 elements, representing the credit shortage quantity, the credit shortage times, the credit increase indication signal, the credit redundancy quantity, the credit redundancy times and the credit reduction indication signal. For example, when the number of queues is 16, multiple credit application requests can be represented in the form of a 6*16 matrix.

[0082] It should be noted that the present disclosure does not limit the form of the credit application request, which can be in any suitable form, such as a table form.

[0083] Figure 3 A schematic diagram of the structure of a credit monitoring module provided in at least one embodiment of the present disclosure.

[0084] In the embodiment of the present disclosure, the credit monitoring module 102 is used to record which queues are often not scheduled due to insufficient credits and which queues often have surplus credits resulting in credit waste.

[0085] For example, in some embodiments, the credit monitoring module 102 may include a first credit quantity recording module, a first counting module, and a first indication signal determining module corresponding to each queue. Figure 3 Only queue Q0, queue QN and queue Q15 are shown, and only the first credit quantity recording module, first counting module and first indication signal determination module corresponding to queue Q0 are shown. However, it should be understood that each queue corresponds to a first credit quantity recording module, a first counting module and a first indication signal determination module. The first credit quantity recording module, the first counting module and the first indication signal determination module corresponding to queue Q0 are described below as an example. In the absence of contradiction, the following description of queue Q0 is applicable to all queues.

[0086] For example, Figure 3 As shown, for each queue (eg, queue Q0 ), the credit monitoring module 102 may include a first credit quantity recording module 1021 , a first counting module 1022 , and a first indication signal determining module 1023 corresponding to the queue Q0 .

[0087] For example, the first credit quantity recording module 1021 is configured to record the number of credit shortages corresponding to queue Q0, the first counting module 1022 is configured to record the number of credit shortages corresponding to queue Q0, and the first indication signal determination module 1023 is configured to determine the credit increase indication signal corresponding to queue Q0 based on the number of credit shortages corresponding to queue Q0 and the number of shortages threshold corresponding to queue Q0.

[0088] For example, Figure 3As shown, the first credit quantity recording module 1021 includes a first quantity recording submodule 1021B. For example, for each queue (for example, queue Q0), when a task (for example, Figure 2 When the task t0 is shown, the first quantity recording submodule 1021B is configured to: in response to a task in the queue being under-scheduled, record the number of credits required for the task that is under-scheduled, and determine the credit shortage number based on the number of remaining credits in the queue and the number of credits required for the task that is under-scheduled; in response to any task in the queue being scheduled for execution, clear the credit shortage number. It should be noted that any task can be the above-mentioned task that is under-scheduled.

[0089] For example, the first quantity recording submodule 1021B can be implemented as a counter or other element, and the counter is used to count the number of credit shortages. Whenever an empty schedule occurs for a task in the queue, it is determined whether the task that has the empty schedule is the first time to have the empty schedule based on the number of credit shortages. If the task is the first time to have the empty schedule in one or more empty schedules indicated based on the number of credit shortages, the counter counts based on the remaining credits corresponding to the queue where the task is located and the credits required to execute the task to determine the number of credit shortages, and the number of credit shortages is the absolute value of the difference between the credits required to execute the task and the remaining credits corresponding to the queue where the task is located; if the task is not the first time to have the empty schedule in one or more empty schedules indicated based on the number of credit shortages, the count value of the counter remains unchanged, that is, the number of credit shortages remains unchanged. Whenever any task in the queue is scheduled for execution, the count value of the counter is cleared to zero, that is, the number of credit shortages is 0.

[0090] For example, in some embodiments, the first credit quantity recording module 1021 further includes a first missing comparator 1021A. For each queue (eg, queue Q0), when a task (eg, Figure 2 When performing task t0 as shown, the first missing comparator 1021A is configured to compare the number of credits required for the task with the number of credits remaining in the queue, and in response to the number of credits required for the task being greater than the number of credits remaining in the queue, it is determined that the task is scheduled to be empty, and in response to the number of credits required for the task being less than or equal to the number of credits remaining in the queue, it is determined that the task can be scheduled for execution.

[0091] For example, when a task t0 in queue Q0 is arbitrated for execution, if the remaining credits corresponding to queue Q0 are insufficient to execute task t0, that is, the number of remaining credits corresponding to queue Q0 is less than the number of credits required to execute task t0, at this time, the number of remaining credits corresponding to queue Q0 and the number of credits required to execute task t0 can be compared by the first missing comparator 1021A. When the result of the comparison indicates that the number of remaining credits corresponding to queue Q0 is less than the number of credits required to execute task t0, it is determined that task t0 is overscheduled; and when the result of the comparison indicates that the number of remaining credits corresponding to queue Q0 is greater than or equal to the number of credits required to execute task t0, then task t0 can be scheduled for execution.

[0092] For example, the first missing comparator 1021A may be implemented as any element capable of performing comparison, for example, may be a comparator implemented based on hardware.

[0093] For example, when queue Q0 wants to execute task t50, it needs to use 10 credits, that is, 10 credits are needed to execute task t50. At this time, the number of remaining credits corresponding to queue Q0 is 5, so it can be seen that task t50 cannot be executed at this time. At this time, the first missing comparator 1021A compares the number of remaining credits corresponding to queue Q0 (i.e. 5) and the number of credits required for task t50 (i.e. 10). Since the number of remaining credits corresponding to queue Q0 (i.e. 5) is less than the number of credits required for task t50 (i.e. 10), it is determined that queue Q0 has an empty schedule.

[0094] For example, in some embodiments, when the number of credits required by the task is greater than the number of remaining credits in the queue, the first missing comparator 1021A may send a first trigger signal to the first quantity recording submodule 1021B; when the number of credits required by the task is less than or equal to the number of remaining credits in the queue, the first missing comparator 1021A may send a second trigger signal to the first quantity recording submodule 1021B; when the first quantity recording submodule 1021B receives the first trigger signal, the first quantity recording submodule 1021B determines the number of credit shortages based on the number of remaining credits in the queue and the number of credits required for the task with empty scheduling; when the first quantity recording submodule 1021B receives the second trigger signal, the first quantity recording submodule 1021B clears the number of credit shortages. The first trigger signal and the second trigger signal may be binary numbers, for example, the first trigger signal may be a binary number 1, and the second trigger signal may be a binary number 0.

[0095] For example, the first counting module 1022 may include a missing counter, and the count value of the missing counter is the number of credit missing times. For example, the missing counter can be implemented as any element that can implement counting, such as a counter based on hardware implementation, such as an addition counter, a subtraction counter or a reversible counter.

[0096] For example, in some embodiments, the missing counter is configured to respond to monitoring that a task in the queue has an empty schedule, and add a first value to the number of credit missing times corresponding to the queue. For example, the first value may be 1. It should be noted that the first value may also be 2 or the like, which may be set according to actual conditions.

[0097] For example, whenever an under-determination occurs in a task, the first missing comparator 1021A may output a first trigger signal to the missing counter in the first counting module 1022. After receiving the first trigger signal, the missing counter may start counting. For example, each time an under-determination occurs, the count of the missing counter is increased by 1, that is, the number of credit missing times Credit Miss is increased by 1.

[0098] For example, in some embodiments, the missing counter is further configured to clear the number of credit missing times corresponding to the queue to zero in response to any task in the queue being scheduled for execution.

[0099] For example, whenever a task in the queue (for example, it can also be the task with over-scheduling as mentioned above) is scheduled out for execution, the first missing comparator 1021A can output a second trigger signal to the missing counter in the first counting module 1022. After receiving the second trigger signal, the missing counter can be cleared, that is, the credit missing count Credit Miss is set to 0.

[0100] In summary, the number of credit deficiency times and the number of credit deficiency can be cleared at the same time.

[0101] For example, Figure 3 As shown, in some embodiments, the first indication signal determination module 1023 includes a second missing comparator 1023A and a first signal determination submodule 1023B.

[0102] For example, the second missing comparator 1023A is configured to compare the number of credit missing times corresponding to the queue with the missing times threshold value corresponding to the queue to obtain a missing times comparison result. The first signal generating submodule 1023B is configured to determine that the credit increase indication signal corresponding to the queue is a first increase signal in response to the missing times comparison result indicating that the number of credit missing times corresponding to the queue is greater than or equal to the missing times threshold value corresponding to the queue; and determine that the credit increase indication signal corresponding to the queue is a second increase signal in response to the missing times comparison result indicating that the number of credit missing times corresponding to the queue is less than the missing times threshold value corresponding to the queue.

[0103] For example, Figure 3 As shown, in some embodiments, the first indication signal determination module 1023 further includes a first memory 1023C, and the first memory 1023C is configured to store a missing number threshold corresponding to the queue.

[0104] For example, the first memory 1023C may also store the above-mentioned first value, etc.

[0105] For example, the first increase signal and the second increase signal are different. In some examples, the first increase signal and the second increase signal can both be represented by binary numbers, and the first increase signal can be represented by binary number 1, and the second increase signal can be represented by binary number 0.

[0106] For example, when the credit increase indication signal is a first increase signal, it indicates that the credit adjustment module 103 can appropriately increase the credit for the queue to achieve task scheduling; when the credit increase indication signal is a second increase signal, it indicates that the queue does not need to increase the credit temporarily, so that the credit adjustment module 103 does not need to increase the credit for the queue.

[0107] For example, the second missing comparator 1023A may be implemented as any element that can implement comparison, for example, may be a comparator implemented based on hardware.

[0108] For example, the missing times threshold may be configured by software and may be set according to actual conditions.

[0109] For example, the credit missing quantity output by the first quantity recording submodule 1021B, the credit missing times Credit Miss output by the first counting module 1022, and the credit increase indication signal addrequest output by the first signal generating submodule 1023B together constitute a credit increase request.

[0110] For example, for a certain queue, such as Figure 2For the queue Q0 shown in the figure, after executing multiple tasks in the queue Q0, the number of remaining credits corresponding to the queue Q0 is 5. At this time, when a task in the queue Q0 is arbitrated for execution, a lack of credits may occur. For example, 10 credits are required to execute task t50 in the queue Q0. At this time, since the number of remaining credits corresponding to the queue Q0 is less than the number of credits required to execute task t50 in the queue Q0, the task t50 is overscheduled. For example, the queue Q0 generates 6 consecutive overschedules, that is, the task t50 is overscheduled a total of 6 times, and the 6 overschedules occur continuously, that is, there is no situation where a task in the queue Q0 is scheduled for execution between any two overschedules. At this time, the number of missing credits corresponding to the queue Q0 is the total credits required to execute task t50 minus the remaining credits corresponding to the queue Q0, that is, the number of missing credits = 10-5 = 5, and the number of missing credits is 6 times.

[0111] For example, if during the process of the queue being under-scheduled, as the tasks scheduled for execution in the queue are processed, the queue can recycle the corresponding credits, thereby increasing the number of remaining credits corresponding to the queue. If the remaining credits corresponding to the queue are greater than or equal to the credits required for the tasks that are under-scheduled, the queue can continue to schedule tasks for execution and perform task scheduling according to certain rules (for example, according to the order of tasks). At this time, the number of missing credits and the number of missing credits can be cleared to zero.

[0112] For example, in the above queue Q0, if task t45 of queue Q0 is executed and returns 10 credits, the remaining credits corresponding to queue Q0 are 15 (5+10). At this time, task t50 in queue Q0 can be scheduled for execution. After task t50 is scheduled for execution, the number of remaining credits corresponding to queue Q0 is 5. At this time, the number of credit shortages and the number of credit shortages corresponding to queue Q0 can be cleared, that is, the number of credit shortages is 0, and the number of credit shortages is 0. For task t51 in queue Q0, the number of credit shortages and the number of credit shortages need to be recalculated. For example, it takes 15 credits to execute task t51 in queue Q0. If task t51 is arbitrated for execution, since the number of remaining credits corresponding to queue Q0 (5) is less than the number of credits required for executing task t51 in queue Q0 (15), task t51 is underscheduled, and the number of credit shortages is 10. At this time, if it is the first time that task t51 is underscheduled, the number of credit shortages is 1.

[0113] For example, in some embodiments, the credit monitoring module 102 further includes a second credit quantity recording module, a second counting module, and a second indication signal determining module corresponding to each queue. Figure 3Only the second credit quantity recording module, the second counting module and the second indication signal determination module corresponding to the queue Q0 are shown. The following description is made by taking the second credit quantity recording module, the second counting module and the second indication signal determination module corresponding to the queue Q0 as an example.

[0114] For example, Figure 3 As shown, for each queue (eg, queue Q0), the credit monitoring module 102 may further include a second credit quantity recording module 1024, a second counting module 1025, and a second indication signal determining module 1026 corresponding to the queue Q0.

[0115] For example, the second credit quantity recording module 1024 is configured to record the credit redundancy quantity corresponding to the queue. The second counting module 1025 is configured to record the number of credit redundancy times corresponding to the queue. The second indication signal determination module 1026 is configured to determine the credit reduction indication signal corresponding to the queue based on the number of credit redundancy times corresponding to the queue and the redundancy times threshold value corresponding to the queue.

[0116] For example, the second credit quantity recording module 1024 may include a second quantity recording submodule 1024A. The second quantity recording submodule 1024A is configured to record the number of remaining credits of the queue as the credit redundancy number. For example, the second quantity recording submodule 1024A may also be implemented as a counter or other element, and the counter is used to count the number of remaining credits. Whenever a task in the queue is scheduled out for execution, the second quantity recording submodule 1024A may update the number of remaining credits corresponding to the queue based on the number of remaining credits of the queue.

[0117] It should be noted that, for example, the credit redundancy number can also be the product of the number of remaining credits of the queue and a coefficient (the coefficient is less than 1 and is determined based on actual conditions); for another example, when the number of remaining credits of the queue is greater than the redundancy number threshold corresponding to the queue, the credit redundancy number corresponding to the queue can also be set to the redundancy number threshold corresponding to the queue.

[0118] For example, Figure 3 As shown, the second counting module 1025 includes a first redundant comparator 1025A and a redundant counter 1025B.

[0119] For example, for each queue (e.g., queue Q0), when a task in queue Q0 (e.g., Figure 2After the task t0 shown in the figure is scheduled for execution, the second quantity recording submodule 1024A can send the recorded number of remaining credits of the queue to the first redundant comparator 1025A. The first redundant comparator 1025A is configured to compare the number of remaining credits of the queue with the redundant number threshold corresponding to the queue, and in response to the number of remaining credits of the queue being greater than or equal to the redundant number threshold corresponding to the queue, determine that the quantity comparison result is a first result, and in response to the number of remaining credits of the queue being less than the redundant number threshold corresponding to the queue, determine that the quantity comparison result is a second result.

[0120] For example, the redundancy counter 1025B is configured to add a second value to the credit redundancy times corresponding to the queue in response to the quantity comparison result being the first result. For example, the second value may be 1. It should be noted that the second value may also be 2 or the like, which may be set according to actual conditions.

[0121] For example, the redundancy counter 1025B is further configured to clear the credit redundancy times corresponding to the queue to zero in response to the quantity comparison result being the second result.

[0122] For example, the count value of the redundancy counter 1025B is the credit redundancy times. For example, the redundancy counter 1025B can be implemented as any element that can implement counting, such as a hardware-based counter, such as an addition counter, a subtraction counter, or a reversible counter.

[0123] For example, each queue corresponds to a first redundancy comparator 1025A and a redundancy counter 1025B. At the same time, a redundancy threshold can be set for each queue, for example, the redundancy threshold can be 70, 60, 50, etc. For example, each time a task is scheduled and the task is scheduled for execution, the first redundancy comparator 1025A compares the number of remaining credits corresponding to the queue with the redundancy threshold. If the number of remaining credits corresponding to the queue is greater than or equal to the redundancy threshold, the redundancy counter 1025B is triggered to start counting, for example, the count value of the redundancy counter 1025B (i.e., the number of credit redundancy times) is increased by 1; if the number of remaining credits corresponding to the queue is less than the redundancy threshold when the queue is executing a certain task, the count value of the redundancy counter 1025B is cleared, indicating that the queue has no surplus credits greater than the redundancy threshold; when one or more tasks of the queue are completed, if the number of remaining credits corresponding to the queue is greater than or equal to the redundancy threshold, the redundancy counter 1025B is triggered to start counting again. Therefore, the counting rule of redundant counter 1025B is: if the number of remaining credits is greater than or equal to the redundant number threshold, the count value of redundant counter 1025B will increase by 1 each time a task is scheduled; if the number of remaining credits is less than the redundant number threshold, the count value of redundant counter 1025B will be cleared.

[0124] It should be noted that in some embodiments, when the credit redundancy times are cleared, the credit redundancy quantity may also be cleared, however, the present disclosure is not limited to this, and when the credit redundancy times are cleared, the credit redundancy quantity may not be cleared, but may be equal to the number of remaining credits in the queue.

[0125] For example, the multiple redundancy number thresholds corresponding to the multiple queues 101 may be the same, or may be partially different.

[0126] For example, Figure 3 As shown, in some embodiments, the second indication signal determination module 1026 may include a second redundant comparator 1026A and a second signal determination submodule 1026B.

[0127] For example, the second redundancy comparator 1026A is configured to: compare the credit redundancy times corresponding to the queue with the redundancy times threshold corresponding to the queue to obtain a redundancy times comparison result. The second signal generation submodule 1026B is configured to: in response to the redundancy times comparison result indicating that the credit redundancy times corresponding to the queue is greater than or equal to the redundancy times threshold corresponding to the queue, determine that the credit reduction indication signal corresponding to the queue is a first reduction signal; in response to the redundancy times comparison result indicating that the credit redundancy times corresponding to the queue is less than the redundancy times threshold corresponding to the queue, determine that the credit reduction indication signal corresponding to the queue is a second reduction signal.

[0128] For example, the second indication signal determination module 1026 further includes a second memory 1026C, and the second memory 1026C is configured to store a redundancy number threshold corresponding to the queue.

[0129] For example, the second memory 1026C may also store the above-mentioned second value, etc.

[0130] For example, the first reduction signal and the second reduction signal are different. In some examples, the first reduction signal and the second reduction signal can both be represented by binary numbers, and the first reduction signal can be represented by binary number 1, and the second reduction signal can be represented by binary number 0.

[0131] For example, when the credit reduction indication signal is a first reduction signal, it indicates that the credit adjustment module 103 can appropriately reduce the credit for the queue; when the credit reduction indication signal is a second reduction signal, it indicates that the queue does not need to reduce the credit temporarily, so that the credit adjustment module 103 does not need to reduce the credit for the queue.

[0132] For example, the second redundant comparator 1026A may be implemented as any element capable of performing comparison, for example, may be a comparator implemented based on hardware.

[0133] For example, the second redundancy comparator 1026A can receive the count value (i.e., the number of credit redundancy times) transmitted by the redundancy counter 1025B, and compare the credit redundancy times with the redundancy times threshold. If the credit redundancy times are greater than or equal to the redundancy times threshold, the credit reduction indication signal corresponding to the queue is set to the first reduction signal. If the credit redundancy times are less than the redundancy times threshold, the credit reduction indication signal corresponding to the queue is set to the second reduction signal. For example, in some examples, the credit redundancy times counted by the redundancy counter 1025B is 10, that is, in the past 10 consecutive scheduling tasks, the credit redundancy number of the queue has exceeded the redundancy number threshold, proving that the task of the queue should be lighter. If the redundancy times threshold is also 10 at this time, the credit reduction indication signal is set to the first reduction signal, for example, 1. When the credit adjustment module 103 receives the first reduction signal, it indicates that the credit adjustment module 103 can appropriately reduce the credit of the queue.

[0134] For example, the second memory 1026C may also store a redundancy number threshold corresponding to the queue, and the first redundancy comparator 1025A may also obtain the redundancy number threshold from the second memory 1026C.

[0135] For example, both the redundancy times threshold and the redundancy quantity threshold can be configured by software and can be set according to actual conditions.

[0136] The software can configure the corresponding coefficients for the missing number threshold and the redundant number threshold. The hardware will calculate the specific missing number threshold and redundant number threshold based on the coefficient and the total arbitration times of the queue. Similarly, the redundant number threshold will also be calculated and adjusted according to the hardware scheduling situation.

[0137] For example, the credit redundancy quantity output by the second quantity recording submodule 1024A, the credit redundancy times Credit Redundant output by the redundancy counter 1025B, and the credit reduction indication signal sub request output by the second signal determining submodule 1026B together constitute a credit reduction request.

[0138] The credit reduction request and the credit increase request are used together as the credit application request of the queue, that is, each credit application request includes the credit missing quantity, the credit missing times Credit Miss, the credit increase indication signal add request, the credit redundancy quantity, the credit redundancy times Credit Redundant and the credit reduction indication signal sub request. After obtaining the credit application requests corresponding to all queues, the credit monitoring module 102 will pass the credit application requests corresponding to all queues together to the credit adjustment module 103.

[0139] It should be noted that credit can be added to a queue only when the credit increase indication signal add request corresponding to the queue is the first increase signal; similarly, credit can be reduced for the queue only when the credit reduction indication signal sub request corresponding to the queue is the first reduction signal. In other words, the credit adjustment module 103 will only adjust the credit of the queue whose credit increase indication signal add request is the first increase signal and whose credit reduction indication signal sub request is the first reduction signal; for the queue whose credit increase indication signal add request is the second increase signal and / or whose credit reduction indication signal sub request is the second reduction signal, it is not necessary to adjust the credit of the queue.

[0140] It should be understood that, for any queue, there is no situation where the credit increase indication signal add request is a first increase signal and the credit decrease indication signal sub request corresponding to the queue is a first decrease signal; however, there is a situation where the credit increase indication signal add request is a second increase signal and the credit decrease indication signal sub request corresponding to the queue is a second decrease signal.

[0141] For example, any one of the first credit quantity recording module 1021, the first counting module 1022, the first indication signal determination module 1023, the second credit quantity recording module 1024, the second counting module 1025, and the second indication signal determination module 1026 can be implemented using hardware, software, firmware, or any feasible combination thereof.

[0142] For example, the connection relationship between various software, hardware, and firmware is not limited and can be determined according to actual needs. The specific configuration of various software, hardware, and firmware is not limited and can be composed of digital chips, a combination of a processor and a memory, or other applicable methods.

[0143] After the credit application request is sent to the credit adjustment module 103, the credit adjustment module 103 can dynamically allocate the credit of the queue with surplus credit to the queue with insufficient credit (for example, the queue that is always under-allocated), so that the credit adjustment circuit 100 provided by the embodiment of the present disclosure can comprehensively achieve the purpose of reducing the number of under-allocated times and making full use of the remaining credit.

[0144] For example, among multiple queues, the first selected queue has the largest number of credit shortages and the first selected queue has the largest number of credit shortages. Among multiple queues, the second selected queue has the largest number of remaining credits and the second selected queue has the largest number of credit redundancy. For example, part of the credits corresponding to the second selected queue can be added to the first selected queue, so that the credit adjustment circuit provided by the present disclosure can dynamically allocate the credits of queues with surplus credits to queues with insufficient credits (for example, empty scheduling), thereby dynamically adjusting the credits of different queues, reducing the number of empty scheduling times and making full use of the remaining credits, improving scheduling efficiency, achieving efficient task scheduling, and increasing the processing speed of tasks.

[0145] Figure 4 A structural diagram of a credit adjustment module provided in at least one embodiment of the present disclosure.

[0146] For example, in some embodiments, Figure 4 As shown, the credit adjustment module 103 may include a missing times arbitration module 1031 , a missing quantity arbitration module 1032 , and a first selection module 1033 .

[0147] For example, the credit adjustment module 103 can make a judgment based on the principle of the largest number of credit shortages and the largest number of credit shortages, and select the corresponding queue (i.e., the first selected queue mentioned above) for credit compensation, that is, to increase credit for the queue. For example, the missing number arbitration module 1031 is configured to determine at least one queue with the largest number of credit shortages from multiple queues as at least one first queue to be adjusted based on multiple credit application requests; the missing number arbitration module 1032 is configured to determine at least one queue with the largest number of credit shortages from at least one first queue to be adjusted as at least one second queue to be adjusted based on multiple credit application requests; the first selection module 1033 is configured to determine the first selected queue from at least one second queue to be adjusted.

[0148] For example, the arbitration process of the missing number arbitration module 1031 is as follows: first, the missing number arbitration module 1031 can determine all queues whose credit increase indication signals are first increase signals based on multiple credit application requests. For example, the credit increase indication signals corresponding to queues Q1, queue Q2, queue Q3, queue Q5 and queue Q10 are all first increase signals. Then, the missing number arbitration module 1031 can arbitrate queues Q1, queue Q2, queue Q3, queue Q5 and queue Q10 based on multiple credit application requests to determine at least one first queue to be adjusted with the largest number of credit shortages. For example, in some examples, the number of credit shortages corresponding to queue Q1, the number of credit shortages corresponding to queue Q5 and the number of credit shortages corresponding to queue Q10 are all 10 times, the number of credit shortages corresponding to queue Q2 is 5 times, and the number of credit shortages corresponding to queue Q3 is 3 times. Then, according to the arbitration process, one or more queues with the largest number of credit shortages are arbitrated. In the above example, the largest number of credit shortages is 10, so queues Q1, queues Q5 and queues Q10 are arbitrated as the first queues to be adjusted.

[0149] For example, when the number of first queues to be adjusted is 1, the missing number arbitration module 1032 can directly use this first queue to be adjusted as the second queue to be adjusted; when the number of first queues to be adjusted is greater than 1, that is, when the missing number arbitration module 1031 arbitrates multiple first queues to be adjusted, the credit missing times corresponding to the multiple first queues to be adjusted are the same and are the largest among all queues, then the missing number arbitration module 1032 can arbitrate the multiple first queues to be adjusted based on multiple credit application requests to determine at least one queue with the largest credit missing number as at least one second queue to be adjusted. For example, based on the above example, queue Q1, queue Q5 and queue Q10 are all the first queues to be adjusted. For example, if the credit shortage number corresponding to queue Q1 is 20, the credit shortage number corresponding to queue Q5 is 20, and the credit shortage number corresponding to queue Q10 is 10, then, since the credit shortage number corresponding to queue Q1 and the credit shortage number corresponding to queue Q5 are both the largest, queue Q1 and queue Q5 are arbitrated as the second queue to be adjusted; for another example, if the credit shortage number corresponding to queue Q1 is 20, the credit shortage number corresponding to queue Q5 is 15, and the credit shortage number corresponding to queue Q10 is 10, then, since the credit shortage number corresponding to queue Q1 is the largest, queue Q1 is arbitrated as the second queue to be adjusted.

[0150] For example, when the number of second queues to be adjusted is 1, the first selection module 1033 can directly use the second queue to be adjusted as the first selected queue; when the number of second queues to be adjusted is greater than 1, that is, when the shortage number arbitration module 1032 arbitrates multiple second queues to be adjusted, the number of credit shortages corresponding to the multiple second queues to be adjusted is the same and the largest among all queues, and the number of credit shortages corresponding to the multiple second queues to be adjusted is also the same and the largest among all first queues to be adjusted. At this time, the first selection module 1033 can select one second queue to be adjusted from the multiple second queues to be adjusted as the first selected queue. For example, if after arbitration by the shortage number arbitration module 1032, queue Q1 and queue Q5 are both arbitrated as the second queue to be adjusted, at this time, the first selection module 1033 can select one queue from queue Q1 and queue Q5 as the first selected queue.

[0151] For example, in some embodiments, the first selection module 1033 is configured to determine the first selected queue from at least one second queue to be adjusted according to at least one queue number that corresponds one-to-one with at least one second queue to be adjusted.

[0152] For example, when arbitration obtains multiple second queues to be adjusted, the first selection module 1033 can select according to the queue number, for example, select the second queue to be adjusted with the smallest queue number among the multiple second queues to be adjusted as the first selected queue. At this time, when queue Q1 and queue Q5 are both second queues to be adjusted, queue Q1 can be selected as the first selected queue. However, the present disclosure is not limited to this, and the second queue to be adjusted with the largest queue number among the multiple second queues to be adjusted is selected as the first selected queue.

[0153] For example, the first selection module 1033 may also randomly select one queue from the plurality of second queues to be adjusted as the first selected queue, that is, the queue number of the first selected queue is random.

[0154] For example, in some embodiments, the first selection module 1033 is configured to determine a first selected queue from at least one second queue to be adjusted according to at least one historical adjustment information corresponding one-to-one to at least one second queue to be adjusted and at least one queue number corresponding one-to-one to at least one second queue to be adjusted. For example, the first selection module 1033 can use Round-Robin polling to select based on historical adjustment information and queue numbers. In some examples, the queue number of queue Q1 is 1, and the queue number of queue Q5 is 5. When queue Q1 and queue Q5 are both the second queues to be adjusted, if the historical adjustment information corresponding to queue Q1 indicates that the credit of queue Q1 has not been adjusted, and the historical adjustment information corresponding to queue Q5 indicates that the credit of queue Q5 has not been adjusted, the second queue to be adjusted with the smallest queue number can be selected as the first selected queue, so that queue Q1 is selected as the first selected queue at this time. At this time, the historical adjustment information corresponding to queue Q1 becomes that the credit of queue Q1 has been adjusted once; if the historical adjustment information corresponding to queue Q1 indicates that the credit of queue Q1 has been adjusted once, and the historical adjustment information corresponding to queue Q5 indicates that the credit of queue Q5 has not been adjusted, queue Q5 can be selected as the first selected queue. At this time, the historical adjustment information corresponding to queue Q1 becomes that the credit of queue Q1 has been adjusted once, thereby realizing polling selection of each queue. That is to say, the second queue to be adjusted that has not been adjusted is preferentially selected. When all the second queues to be adjusted have been adjusted the same number of times, they can be selected according to the queue number (for example, the minimum queue number, the maximum queue number or the random queue number).

[0155] For example, in some embodiments, Figure 4 As shown, the credit adjustment module 103 further includes a redundancy number arbitration module 1034 , a remaining number arbitration module 1035 and a second selection module 1036 .

[0156] For example, the credit adjustment module 103 may also make a judgment based on the principle of the maximum credit redundancy times and the maximum credit redundancy quantity, and select the corresponding queue (i.e., the second selected queue mentioned above) to reduce the credit of the queue. The redundancy times arbitration module 1034 is configured to determine at least one queue with the maximum credit redundancy times from the multiple queues as at least one third queue to be adjusted based on multiple credit application requests; the remaining quantity arbitration module 1035 is configured to determine at least one queue with the maximum credit redundancy quantity from at least one third queue to be adjusted as at least one fourth queue to be adjusted based on multiple credit application requests; the second selection module 1036 is configured to determine the second selected queue from at least one fourth queue to be adjusted.

[0157] For example, the arbitration process of the redundant number arbitration module 1034 is similar to the arbitration process of the missing number arbitration module 1031, the arbitration process of the remaining number arbitration module 1035 is similar to the arbitration process of the missing number arbitration module 1032, and the selection process of the second selection module 1036 is also similar to the selection process of the first selection module 1033. The specific working processes of the redundant number arbitration module 1034, the remaining number arbitration module 1035 and the second selection module 1036 can refer to the description of the working processes of the above-mentioned missing number arbitration module 1031, the missing number arbitration module 1032 and the first selection module 1033, respectively, and the similarities will not be repeated here.

[0158] For example, in some embodiments, the credit redundancy number corresponding to queue Q11, the credit redundancy number corresponding to queue Q12, and the credit redundancy number corresponding to queue Q13 are all 10 times, the credit redundancy number corresponding to queue Q14 is 5 times, and the credit redundancy number corresponding to queue Q15 is 3 times. According to the arbitration process, the redundancy number arbitration module 1034 can arbitrate one or more queues with the largest credit redundancy number from queues Q11 to queue Q15 as the third queue to be adjusted. In the above example, the maximum credit redundancy number is 10, so queue Q11, queue Q12 and queue Q13 are arbitrated as the third queue to be adjusted.

[0159] For example, when the number of third queues to be adjusted is 1, the remaining number arbitration module 1035 can directly use the third queue to be adjusted as the fourth queue to be adjusted; when the number of third queues to be adjusted is greater than 1, the credit redundancy times corresponding to the multiple third queues to be adjusted are the same and are the largest among all queues. For example, in the above example, the number of third queues to be adjusted is 3, namely queue Q11, queue Q12 and queue Q13. If the credit redundancy number corresponding to queue Q11 is 100, the credit redundancy number corresponding to queue Q12 is 100, and the credit redundancy number corresponding to queue Q13 is 60, because the credit redundancy number corresponding to queue Q11 and the credit redundancy number corresponding to queue Q12 are both the largest (for example, 100), at this time, queue Q11 and queue Q12 are arbitrated as the fourth queue to be adjusted; if the credit redundancy number corresponding to queue Q11 is 100, the credit redundancy number corresponding to queue Q12 is 80, and the credit redundancy number corresponding to queue Q13 is 60, because the credit redundancy number corresponding to queue Q11 is the largest (for example, 100), at this time, queue Q11 is arbitrated as the fourth queue to be adjusted.

[0160] For example, in some embodiments, the second selection module 1036 is configured to determine the second selected queue from the at least one fourth queue to be adjusted according to at least one queue number that corresponds one-to-one with the at least one fourth queue to be adjusted.

[0161] For example, when the number of fourth queues to be adjusted is 1, the second selection module 1036 can directly select the fourth queue to be adjusted as the second selected queue; when the number of fourth queues to be adjusted is greater than 1, the credit redundancy times corresponding to multiple fourth queues to be adjusted are the same and are the largest among all queues, and the credit redundancy numbers corresponding to multiple fourth queues to be adjusted are also the same and are the largest among all third queues to be adjusted. At this time, the second selection module 1036 can select a fourth queue to be adjusted from multiple fourth queues to be adjusted as the second selected queue. For example, in the above examples, queue Q11 and queue Q12 are both the fourth queues to be adjusted. In some examples, the selection can be made by selecting the queue corresponding to the smallest queue number, so that queue Q11 is selected as the second selected queue; in other examples, the selection can be made by selecting the queue corresponding to a random queue number. In this case, queue Q11 or queue Q12 is selected as the second selected queue; in other examples, the Round-Robin polling method can be used to select based on the historical adjustment information and queue number corresponding to queue Q11 and the historical adjustment information and queue number corresponding to queue Q12. For example, in one example, queue Q11 is selected as the second selected queue.

[0162] For example, after determining the first selected queue and the second selected queue, the credit adjustment module 103 is further configured to determine the credits to be adjusted in the second selected queue, and add the credits to be adjusted in the second selected queue to the first selected queue.

[0163] For example, in some embodiments, the credit adjustment module 103 may further include a first adjustment module (not shown), which is configured to: determine the credits to be adjusted in the second selected queue; and add the credits to be adjusted to the first selected queue.

[0164] For example, when executing the step of determining the credits to be adjusted in the second selected queue, the first adjustment module is configured to: determine the number to be adjusted based on at least one credit redundancy number corresponding to at least one third queue to be adjusted; determine the target adjustment number based on the number to be adjusted and the number adjustment coefficient; and determine the credits to be adjusted in the second selected queue based on the target adjustment number. For example, the number of credits to be adjusted is equal to the target adjustment number.

[0165] For example, the first adjustment module may determine the number to be adjusted based on the credit redundancy numbers corresponding to all third queues to be adjusted, for example, the number to be adjusted may be the minimum credit redundancy number determined among all credit redundancy numbers corresponding to at least one third queue to be adjusted. Then, the first adjustment module may determine the target adjustment number based on the number to be adjusted and the quantity adjustment coefficient, for example, the target adjustment number may be the product of the number to be adjusted and the quantity adjustment coefficient, the quantity adjustment coefficient may be 1 / 2, 1 / 3, etc., and may be set according to actual conditions, and is not limited here. For example, in the above example, since queue Q11, queue Q12, and queue Q13 are the third queues to be adjusted, and the credit redundancy number corresponding to queue Q11 is 100, the credit redundancy number corresponding to queue Q12 is 100, and the credit redundancy number corresponding to queue Q13 is 60, at this time, the number to be adjusted is the credit redundancy number corresponding to queue Q13, that is, 60, and when the quantity adjustment coefficient is 1 / 2, 30 (60*1 / 2) credits may be taken out from queue Q11 and added to the first selected queue (for example, queue Q1).

[0166] However, the present disclosure is not limited thereto, and the number to be adjusted may also be the credit redundancy number corresponding to the second selected queue.

[0167] For example, the number of credits to be adjusted may also be the number of credit shortages corresponding to the first selected queue. Typically, the number of credits to be adjusted is greater than the number of credit shortages corresponding to the first selected queue, so that after the credit adjustment, the queues in the first selected queue that are under-adjusted can be scheduled for execution.

[0168] For example, in some embodiments, the credit adjustment module 103 further includes a second adjustment module (not shown). The second adjustment module is configured to determine, based on multiple credit application requests, at least one request to increase a credit queue and at least one request to decrease a credit queue, and in response to at least one request to increase the number of credit queues and at least one request to decrease the number of credit queues satisfying a preset condition, adjust at least one of a lack count threshold, a redundancy count threshold, and a redundancy quantity threshold corresponding to at least some of the multiple queues.

[0169] For example, at least one queue for requesting to increase credit is a queue for which credit needs to be increased, and at least one queue for requesting to decrease credit is a queue for which credit needs to be decreased. For example, at least one queue for requesting to increase credit can be determined based on a credit increase indication signal, and at least one queue for requesting to decrease credit can be determined based on a credit decrease indication signal. For example, the credit increase indication signal corresponding to each queue for requesting to increase credit is a first increase signal, and the credit decrease indication signal corresponding to each queue for requesting to decrease credit is a first decrease signal.

[0170] For example, in some embodiments, the preset conditions may include a first condition and a second condition. The first condition may be that at least one request to increase the number of credit queues is greater than a first preset threshold, and at least one request to reduce the number of credit queues is less than a second preset threshold. At this time, there are more queues lacking credit and fewer queues with surplus credit. For example, the number of shortage thresholds may be increased, and the number of redundant thresholds and the number of redundant thresholds may be decreased. The second condition may be that at least one request to increase the number of credit queues is less than a third preset threshold, and at least one request to reduce the number of credit queues is greater than a fourth preset threshold. At this time, there are fewer queues lacking credit and more queues with surplus credit. For example, the number of shortage thresholds may be decreased, and the number of redundant thresholds and the number of redundant thresholds may be increased.

[0171] For example, when all queue tasks are relatively heavy, the credit redundancy quantity of most queues does not exceed the corresponding redundancy quantity threshold, or the credit redundancy times of most queues do not exceed the corresponding redundancy times threshold, or the credit shortage times of most queues exceed the corresponding shortage times threshold, then it is necessary to adjust the shortage times threshold, the redundancy times threshold and the redundancy quantity threshold. For example, the second adjustment module detects that there are more queues requesting to increase credit, and fewer queues requesting to reduce credit. The second adjustment module can automatically reduce the redundancy quantity threshold, for example, reduce the redundancy quantity threshold from 60 to 50 or 40, etc. The second adjustment module can also automatically reduce the redundancy times threshold, for example, reduce the redundancy times threshold from 10 times to 6 times or 5 times, etc., so as to achieve more efficient credit adjustment and task scheduling.

[0172] For example, any one of the missing number arbitration module 1031, the missing quantity arbitration module 1032, the first selection module 1033, the redundant number arbitration module 1034, the remaining quantity arbitration module 1035, the second selection module 1036 and the second adjustment module can be implemented using hardware, software, firmware or any feasible combination thereof.

[0173] It should be noted that the first credit quantity recording module 1021, the first counting module 1022, the first indication signal determination module 1023, the second credit quantity recording module 1024, the second counting module 1025, the second indication signal determination module 1026, the missing number arbitration module 1031, the missing number arbitration module 1032, the first selection module 1033, the redundant number arbitration module 1034, the remaining number arbitration module 1035, the second selection module 1036, the first adjustment module and the second adjustment module in the above-mentioned credit adjustment circuit 100 can be respectively implemented as a first credit quantity recording circuit, a first credit counting circuit, a first indication signal determination circuit, a second credit quantity recording circuit, a second credit counting circuit, a second indication signal determination circuit, a missing number arbitration circuit, a missing number arbitration circuit, a first selection circuit, a redundant number arbitration circuit, a remaining number arbitration circuit, a second selection circuit, a first adjustment circuit and a second adjustment circuit. It should be noted that the embodiments of the present disclosure do not limit the specific implementation methods of the above-mentioned modules.

[0174] At least one embodiment of the present disclosure further provides a task scheduling circuit. Figure 5 A schematic block diagram of a task scheduling circuit provided by at least one embodiment of the present disclosure, Figure 6 A schematic structural diagram of a task scheduling circuit provided for at least one embodiment of the present disclosure.

[0175] like Figure 5 and Figure 6 As shown, in some embodiments, the task scheduling circuit 200 may include a credit arbitrator 201 , a time wheel arbitrator 202 , and a scheduler 203 .

[0176] For example, Figure 6 As shown, the credit arbitrator 201 may include a credit adjustment circuit 2011 and a task arbitration circuit 2012, and is configured to arbitrate multiple queues to obtain a credit arbitration result. For example, the credit adjustment circuit 2011 may be a credit adjustment circuit provided by any embodiment of the present disclosure, for example, Figure 1A A credit adjustment circuit 100 is shown.

[0177] For example, Figure 6 As shown, the time wheel arbitrator 202 is configured to arbitrate the tasks stored on the time wheel 2021 to obtain a time wheel arbitration result.

[0178] For example, Figure 6 As shown, the scheduler 203 is configured to determine the target arbitration result based on the credit arbitration result and the time round arbitration result, and schedule the target arbitration result for execution.

[0179] The task scheduling circuit 200 provided by the embodiment of the present disclosure combines dynamic credit adjustment and time wheel scheduling, so as to improve scheduling efficiency. In the task scheduling circuit 200 provided by the embodiment of the present disclosure, based on the credit adjustment circuit 2011, it is possible to dynamically adjust the credit between different queues, so that the credit of the queue with surplus credit can be dynamically allocated to the queue with insufficient credit (for example, the empty scheduling always occurs), so as to comprehensively achieve the purpose of reducing the number of empty scheduling and making full use of the remaining credit, improve scheduling efficiency, realize efficient task scheduling, and increase the processing speed of tasks, so as to improve user experience. In addition, in the task scheduling circuit 200, based on the time wheel scheduling method of real-time scheduling introduced by the time wheel arbitrator 202, the scheduling of timing tasks can be taken into account to meet the needs of different scheduling scenarios.

[0180] For example, the credit adjustment circuit 2011 is configured to dynamically adjust the credits corresponding to the multiple queues, so as to ensure the effective use of hardware resources. For example, the credit adjustment circuit 2011 dynamically allocates the credits of the queues with surplus credits to the queues with insufficient credits (for example, the credits are always empty). The task arbitration circuit 2012 is configured to arbitrate all tasks in the multiple queues to obtain credit arbitration tasks. For example, the credit arbitration result includes the credit arbitration tasks. It should be noted that the process of implementing credit adjustment by the credit adjustment circuit 2011 can refer to the description of the credit adjustment circuit 100 in the above embodiment, and the repeated parts will not be repeated.

[0181] For example, the credit adjustment circuit 2011 and the task arbitration circuit 2012 are operated in parallel, that is, while the credit adjustment circuit 2011 adjusts the credits of multiple queues, the task arbitration circuit 2012 also arbitrates the queues and tasks to be executed each time. For example, the task arbitration circuit 2012 can arbitrate based on the priority of the task.

[0182] For example, Figure 6 As shown, the time wheel arbitrator 202 may include a time wheel 2021, and the time wheel 2021 may include 128 nodes TW~TW127. Each node may store one or more tasks. For example, a task A is stored at the node TW1, and a task B is stored at the node TW125.

[0183] For example, the time wheel 2021 includes at least one time counter. In some examples, the time wheel has two time counters counter0 and counter1. The time counter counter0 is a counter generated by the minimum time period Tick. Whenever the time indicated by the minimum time period Tick passes, the count value of the time counter counter0 is increased by 1. When the count value of the time counter counter0 reaches the first time count threshold Threshold0 configured by the software, the count value of the time counter counter0 returns to 0 and counts again. At the same time, the time counter counter0 generates a Tick indication signal. After the time counter counter1 receives the Tick indication signal, the count value of the time counter counter1 is increased by 1. When the count value of the time counter counter1 reaches the second time count threshold Threshold1 configured by the software, the count value of the time counter counter1 returns to 0 and counts again. At the same time, the node of the time wheel 2021 moves forward by one node. After moving to the node TW127, it returns to the node TW0 to continue the above rotation.

[0184] For example, for a timed task, the timed task can be written to a suitable node of the time wheel 221 in advance according to the node on the time wheel 221 and the time when the task needs to be triggered regularly, and the timed task can be scheduled after the waiting time reaches the node. For example, a time-critical task can be prioritized for execution through the time wheel scheduling method.

[0185] For example, Figure 6 As shown, in some embodiments, the scheduler 203 includes a multiplexer Mux and a scheduling module 2031. The multiplexer Mux is configured to: in response to the time wheel arbitration result including a task stored on the time wheel, determine that the target arbitration result includes the task on the time wheel; in response to the time wheel arbitration result not including any task and the credit arbitration result including the credit arbitration task, determine that the target arbitration result includes the credit arbitration task; the scheduling module 2031 is configured to schedule the target arbitration result for execution.

[0186] For example, when the task scheduling circuit 200 schedules tasks in real time, it will process the credit arbitration result and the time wheel arbitration result. The credit arbitration task in the credit arbitration result is the task or queue cut out by the credit arbitrator 201, for example, task t1 in queue Q0; the time wheel arbitration result is the task stored in the time wheel, for example, when the time wheel 2021 reaches the node TW1, task A will be scheduled for execution. At this time, the time wheel arbitration result includes task A.

[0187] When both the credit arbitration result and the time wheel arbitration result include tasks, the task in the time wheel arbitration result is selected first, and the credit arbitration result will not be scheduled until arbitration is continued later. At this time, it is equivalent to that the task in the credit arbitration result has not been scheduled for execution. The multiplexer Mux can be used to select from the credit arbitration result and the time wheel arbitration result. For example, when the credit arbitration result includes task t1 in queue Q0 and the time wheel arbitration result includes task A, the multiplexer Mux will prioritize the scheduled task A.

[0188] For example, when the time wheel arbitration result includes task A, the control signal ENA of the multiplexer Mux can be set to 1, and the output end of the multiplexer Mux will be connected to the input port 1, so that the target arbitration result is the time wheel arbitration result. When the time wheel arbitration result does not include the task but the credit arbitration result includes the task, the control signal ENA of the multiplexer Mux can be set to 0, and the output end of the multiplexer Mux will be connected to the input port 0, so that the target arbitration result is the credit arbitration result.

[0189] At least one embodiment of the present disclosure further provides a credit adjustment method. For example, the credit adjustment method can be applied to the credit adjustment circuit described in any embodiment of the present disclosure. For example, Figure 1A A credit adjustment circuit 100 is shown.

[0190] Figure 7 A schematic flow chart of a credit adjustment method provided by at least one embodiment of the present disclosure. Figure 7 As shown, the credit adjustment method may include the following steps S100-S120.

[0191] Step S100: monitoring multiple credit application requests corresponding to multiple queues respectively.

[0192] Step S110: Based on a plurality of credit application requests, determining a first selected queue and a second selected queue from a plurality of queues.

[0193] Step S120: adjusting the credit corresponding to the first selected queue and the credit corresponding to the second selected queue.

[0194] The credit monitoring module 101 in the credit adjustment circuit 100 is used to implement Figure 7 The step S100 shown in FIG. 1 is a step in which the credit adjustment module 102 in the credit adjustment circuit 100 is used to implement the credit adjustment module 102. Figure 7 As shown in step S110 and step S120, the specific operations of step S110 and step S120 can refer to the above description of the credit adjustment module 102, which will not be repeated here.

[0195] For example, the technical effect achieved by the credit adjustment method is the same as the technical effect achieved by the above-mentioned credit adjustment circuit, which will not be repeated here.

[0196] At least one embodiment of the present disclosure further provides a task scheduling method. For example, the task scheduling method can be applied to the task scheduling circuit described in any embodiment of the present disclosure. For example, Figure 5 The task scheduling circuit 200 is shown.

[0197] Figure 8 A schematic flow chart of a task scheduling method provided by at least one embodiment of the present disclosure. Figure 8 As shown, the task scheduling method may include the following steps S200 to S230.

[0198] Step S200: arbitrate multiple queues to obtain a credit arbitration result.

[0199] Step S210: arbitrate the tasks stored in the time wheel to obtain the time wheel arbitration result.

[0200] Step S220: Determine the target arbitration result based on the credit arbitration result and the time round arbitration result.

[0201] Step S230: Schedule the target arbitration result for execution.

[0202] The credit arbiter 201 in the task scheduling circuit 200 is used to implement Figure 8 The step S200 shown in FIG. 1 is a step of a process for executing a task. The specific operation of the step S200 can be found in the description of the credit arbitrator 201 above. The time wheel arbitrator 202 in the task scheduling circuit 200 is used to implement Figure 8 The step S210 shown in FIG. 1 is a step of executing the task scheduling circuit 200. The specific operation of the step S210 can refer to the description of the time wheel arbiter 202 above. The scheduler 203 in the task scheduling circuit 200 is used to implement Figure 8 As shown in step S220 and step S230, the specific operations of step S220 and step S230 can refer to the above description of the scheduler 203, which will not be repeated here.

[0203] For example, in step S200 , the credits of the multiple queues may have been adjusted by the credit adjustment circuit in the credit arbiter 201 , or may not have been adjusted.

[0204] For example, in some embodiments, step S220 may include: in response to the time wheel arbitration result including a task stored on the time wheel, determining that the target arbitration result includes the task on the time wheel; in response to the time wheel arbitration result not including any task and the credit arbitration result including the credit arbitration task, determining that the target arbitration result includes the credit arbitration task. That is, when the task in the credit arbitration result and the task in the time wheel arbitration result arrive at the same time, the task in the time wheel arbitration result may be scheduled first, thereby ensuring the execution of the scheduled task.

[0205] For example, the technical effect achieved by the task scheduling method is the same as the technical effect achieved by the above-mentioned task scheduling circuit, which will not be described in detail here.

[0206] At least one embodiment of the present disclosure further provides an integrated circuit. Fig. 9 A schematic block diagram of an integrated circuit provided for at least one embodiment of the present disclosure.

[0207] like Fig. 9 As shown, the integrated circuit 900 includes a credit adjustment circuit 901, and the credit adjustment circuit 901 can be a credit adjustment circuit provided by any embodiment of the present disclosure, for example, the above-mentioned credit adjustment circuit 100, thereby, the integrated circuit 900 can dynamically adjust the credit of the queue through the credit adjustment circuit 901, effectively utilize hardware resources, reduce the number of empty adjustments, and fully utilize the remaining credits in the queue. For example, the integrated circuit 900 can achieve the technical effects achieved by the above-mentioned credit adjustment circuit 100, and the repeated parts will not be repeated.

[0208] For example, the integrated circuit 900 may also include various other components to realize the functions that need to be realized, and the embodiments of the present disclosure do not limit the specific structure of the integrated circuit 900. For example, the integrated circuit 900 may also include all circuits in the above-mentioned task scheduling circuit 200 except the credit adjustment circuit, thereby, the integrated circuit 900 may combine dynamic credit adjustment and time wheel scheduling to improve scheduling efficiency, and at this time, the integrated circuit 900 may also realize the technical effects realized by the above-mentioned task scheduling circuit 200, and the repeated parts will not be repeated.

[0209] It should be noted that the integrated circuit 900 in the present disclosure may refer to a partial design or a partial module in a large circuit design, that is, the integrated circuit in the present disclosure may be a complete integrated circuit itself or a partial circuit in a complete integrated circuit, and the present disclosure does not impose any restrictions on this.

[0210] For example, the integrated circuit 900 may be applied to an electronic device, which may be a mobile phone, a tablet computer, a television, a display, a notebook computer, a digital photo frame, a navigator, or other product or component.

[0211] Fig.10 A schematic diagram of a non-transitory computer storage medium provided for at least one embodiment of the present disclosure.

[0212] For example, Fig.10 As shown, one or more computer executable instructions 1001 may be non-temporarily stored on a non-transitory computer storage medium 1000. For example, when the computer executable instructions 1001 are executed by a computer, the computer may be caused to execute one or more steps in the credit adjustment method according to any of the above embodiments or one or more steps in the task scheduling method according to any of the above embodiments.

[0213] For example, the non-transitory computer storage medium 1000 may be a non-transitory computer readable storage medium.

[0214] For example, the non-transitory computer storage medium 1000 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc.

[0215] One or more computer executable instructions may be stored on the computer readable storage medium, and the computer may execute the computer executable instructions to implement the credit adjustment method and / or the task scheduling method. For example, various application programs and various data (e.g., the above-mentioned lack times threshold, increase redundancy times threshold, redundancy quantity threshold, first time count threshold, second time count threshold, etc.) may also be stored in the computer readable storage medium.

[0216] There are a few points to note about this disclosure:

[0217] (1) The drawings of the embodiments of the present disclosure only relate to the structures related to the embodiments of the present disclosure, and other structures may refer to the general design.

[0218] (2) For the sake of clarity, the thickness and size of layers or structures are exaggerated in the drawings used to describe the embodiments of the present invention. It is understood that when an element such as a layer, film, region, or substrate is referred to as being "on" or "under" another element, the element may be "directly" "on" or "under" the other element, or there may be intervening elements.

[0219] (3) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to obtain new embodiments.

[0220] The above description is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. The protection scope of the present disclosure shall be based on the protection scope of the claims.

Claims

1. A credit adjustment circuit, for adjusting the credit of at least part of a plurality of queues, comprising: Credit monitoring module and credit adjustment module, Wherein, each queue is assigned at least one credit; The credit monitoring module is configured to monitor a plurality of credit application requests corresponding to the plurality of queues respectively, wherein the credit application request corresponding to each queue includes a credit increase request and a credit decrease request; The credit adjustment module is configured to: obtaining the plurality of credit application requests, Based on the multiple credit application requests, determining a first selected queue and a second selected queue among the multiple queues, wherein the first selected queue is a queue that needs to increase credit, and the second selected queue is a queue that needs to reduce credit, Adding at least one to-be-adjusted credit corresponding to the second selected queue to the first selected queue.

2. The credit adjustment circuit according to claim 1, wherein: The credit increase request includes the credit deficiency quantity corresponding to the queue, the credit deficiency times and a credit increase indication signal; The credit reduction request includes a credit redundancy quantity corresponding to the queue, a credit redundancy count, and a credit reduction indication signal.

3. The credit adjustment circuit according to claim 2, wherein: The credit monitoring module includes a first credit quantity recording module, a first counting module and a first indication signal determining module corresponding to each queue. For each queue: The first credit quantity recording module is configured to record the credit shortage quantity corresponding to the queue; The first counting module is configured to record the number of credit shortages corresponding to the queue; The first indication signal determination module is configured to determine a credit increase indication signal corresponding to the queue based on the number of credit shortages corresponding to the queue and a shortage number threshold corresponding to the queue.

4. The credit adjustment circuit according to claim 3, wherein: The first credit quantity recording module includes a first quantity recording submodule, For each queue, when a task in the queue is arbitrated, the first quantity recording submodule is configured to: in response to the task being overscheduled, record the number of credits required for the task that is overscheduled, and determine the credit shortage quantity based on the number of remaining credits in the queue and the number of credits required for the task that is overscheduled; in response to any task in the queue being scheduled out for execution, clear the credit shortage quantity.

5. The credit adjustment circuit according to claim 4, wherein: The first credit quantity recording module further includes a first missing comparator, When the task in the queue is arbitrated, the first missing comparator is configured to: compare the number of credits required for the task and the number of remaining credits in the queue, and in response to the number of credits required for the task being greater than the number of remaining credits in the queue, determine that the task is scheduled once; and in response to the number of credits required for the task being less than or equal to the number of remaining credits in the queue, determine that the task can be scheduled for execution.

6. The credit adjustment circuit according to claim 4 or 5, wherein: The first counting module comprises a missing counter, The missing counter is configured to, in response to monitoring that the task is under-scheduled once, add a first value to the number of credit missing times corresponding to the queue; in response to any task in the queue being scheduled out for execution, clear the number of credit missing times corresponding to the queue.

7. The credit adjustment circuit according to any one of claims 3 to 5, wherein: The first indication signal determination module includes a second missing comparator and a first signal determination submodule, The second lack comparator is configured to: compare the credit lack times corresponding to the queue with a lack times threshold value corresponding to the queue to obtain a lack times comparison result; The first signal determination submodule is configured to: in response to the lack of times comparison result indicating that the number of credit lacks corresponding to the queue is greater than or equal to the lack of times threshold value corresponding to the queue, determine that the credit increase indication signal corresponding to the queue is a first increase signal; in response to the lack of times comparison result indicating that the number of credit lacks corresponding to the queue is less than the lack of times threshold value corresponding to the queue, determine that the credit increase indication signal corresponding to the queue is a second increase signal.

8. The credit adjustment circuit according to claim 7, wherein: The first indication signal determination module further includes a first memory, The first memory is configured to store a lack count threshold corresponding to the queue.

9. The credit adjustment circuit according to any one of claims 2 to 5, wherein: The credit monitoring module includes a second credit quantity recording module, a second counting module and a second indication signal determining module corresponding to each queue. For each queue: The second credit quantity recording module is configured to record the credit redundancy quantity corresponding to the queue; The second counting module is configured to record the number of credit redundancy times corresponding to the queue; The second indication signal determination module is configured to determine a credit reduction indication signal corresponding to the queue based on a credit redundancy number corresponding to the queue and a redundancy number threshold corresponding to the queue.

10. The credit adjustment circuit according to claim 9, wherein: The second credit quantity recording module includes a second quantity recording submodule, For each queue, the second quantity recording submodule is configured to: record the number of remaining credits of the queue as the credit redundancy number.

11. The credit adjustment circuit according to claim 9, wherein: The second counting module includes a first redundant comparator and a redundant counter. After a task in the queue is scheduled for execution, the first redundancy comparator is configured to compare the number of remaining credits of the queue with a redundancy threshold corresponding to the queue, and in response to the number of remaining credits of the queue being greater than or equal to the redundancy threshold corresponding to the queue, determine that the number comparison result is a first result, and in response to the number of remaining credits of the queue being less than the redundancy threshold corresponding to the queue, determine that the number comparison result is a second result; The redundancy counter is configured to, in response to the quantity comparison result being the first result, add a second value to the credit redundancy times corresponding to the queue.

12. The credit adjustment circuit according to claim 11, wherein: The redundancy counter is further configured to clear the credit redundancy times corresponding to the queue to zero in response to the quantity comparison result being the second result.

13. The credit adjustment circuit according to claim 9, wherein: The second indication signal determination module includes a second redundant comparator and a second signal determination submodule, The second redundancy comparator is configured to: compare the credit redundancy times corresponding to the queue with a redundancy times threshold corresponding to the queue to obtain a redundancy times comparison result; The second signal determination submodule is configured to: in response to the redundancy number comparison result indicating that the credit redundancy number corresponding to the queue is greater than or equal to the redundancy number threshold corresponding to the queue, determine that the credit reduction indication signal corresponding to the queue is a first reduction signal; In response to the redundancy number comparison result indicating that the credit redundancy number corresponding to the queue is less than the redundancy number threshold corresponding to the queue, determining that the credit reduction indication signal corresponding to the queue is a second reduction signal.

14. The credit adjustment circuit according to claim 13, wherein: The second indication signal determination module further includes a second memory, The second memory is configured to store a redundancy threshold corresponding to the queue.

15. The credit adjustment circuit according to any one of claims 2 to 5, wherein: Among the multiple queues, the first selected queue corresponds to the largest number of credit shortages, and the first selected queue corresponds to the largest number of credit shortages. Among the multiple queues, the credit redundancy quantity corresponding to the second selected queue is the largest, and the credit redundancy times corresponding to the second selected queue are the largest.

16. The credit adjustment circuit according to claim 15, wherein: The credit adjustment module includes a missing number arbitration module, a missing quantity arbitration module and a first selection module. The missing number arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest number of credit missing times from the multiple queues as at least one first queue to be adjusted; The shortage quantity arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest credit shortage quantity from the at least one first queue to be adjusted as at least one second queue to be adjusted; The first selection module is configured to determine the first selected queue from the at least one second queue to be adjusted.

17. The credit adjustment circuit according to claim 16, wherein: The first selection module is configured to determine the first selected queue from the at least one second queue to be adjusted according to at least one queue number that corresponds one-to-one with the at least one second queue to be adjusted.

18. The credit adjustment circuit according to claim 15, wherein: The credit adjustment module includes a redundancy number arbitration module, a remaining number arbitration module and a second selection module. The redundancy number arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest credit redundancy number from the multiple queues as at least one third queue to be adjusted; The remaining quantity arbitration module is configured to determine, based on the multiple credit application requests, at least one queue with the largest credit redundancy quantity from the at least one third queue to be adjusted as at least one fourth queue to be adjusted; The second selection module is configured to determine the second selected queue from the at least one fourth queue to be adjusted.

19. The credit adjustment circuit according to claim 18, wherein: The second selection module is configured to determine the second selected queue from the at least one fourth queue to be adjusted according to at least one queue number that corresponds one-to-one with the at least one fourth queue to be adjusted.

20. The credit adjustment circuit according to claim 18, wherein: The credit adjustment module also includes a first adjustment module, The first adjustment module is configured to: determine the at least one credit to be adjusted in the second selected queue; and add the at least one credit to be adjusted to the first selected queue.

21. The credit adjustment circuit according to claim 20, wherein: In performing the step of determining the at least one credit to be adjusted in the second selected queue, The first adjustment module is configured to: determine the number to be adjusted based on at least one credit redundancy quantity corresponding one-to-one to the at least one third queue to be adjusted; determine the target adjustment quantity based on the number to be adjusted and the quantity adjustment coefficient; determine the at least one credit to be adjusted in the second selected queue based on the target adjustment quantity, wherein the quantity of the at least one credit to be adjusted is equal to the target adjustment quantity.

22. The credit adjustment circuit according to any one of claims 2 to 5, wherein: The credit adjustment module includes a second adjustment module, The second adjustment module is configured to determine at least one queue for requesting to increase credit and at least one queue for requesting to decrease credit based on the multiple credit application requests, wherein the at least one queue for requesting to increase credit is a queue for which credit needs to be increased, and the at least one queue for requesting to decrease credit is a queue for which credit needs to be decreased, In response to the at least one request to increase the number of credit queues and the at least one request to decrease the number of credit queues satisfying a preset condition, at least one of a shortage number threshold, a redundancy number threshold and a redundancy number threshold corresponding to at least some of the multiple queues is adjusted.

23. A task scheduling circuit, comprising: A credit arbitrator, comprising a task arbitration circuit and a credit adjustment circuit according to any one of claims 1 to 22, and configured to arbitrate the multiple queues to obtain a credit arbitration result; A time wheel arbitrator configured to arbitrate the tasks stored on the time wheel to obtain a time wheel arbitration result; The scheduler is configured to determine a target arbitration result based on the credit arbitration result and the time round arbitration result, and schedule the target arbitration result for execution.

24. The task scheduling circuit according to claim 23, wherein: The credit adjustment circuit is configured to dynamically adjust the credits corresponding to the multiple queues. The task arbitration circuit is configured to arbitrate all tasks in the plurality of queues to obtain credit arbitration tasks, wherein the credit arbitration result includes the credit arbitration task.

25. The task scheduling circuit according to claim 23 or 24, wherein: The scheduler includes a multiplexer and a scheduling module. The multiplexer is configured to: in response to the timing wheel arbitration result including a task stored on the timing wheel, determine that the target arbitration result includes the task on the timing wheel; In response to the time round arbitration result not including any task and the credit arbitration result including a credit arbitration task, determining that the target arbitration result includes the credit arbitration task; The scheduling module is configured to schedule the target arbitration result for execution.

26. A credit adjustment method, applied to the credit adjustment circuit according to any one of claims 1 to 22, wherein: The credit adjustment method includes: monitoring the multiple credit application requests respectively corresponding to the multiple queues; determining the first selected queue and the second selected queue from among the plurality of queues based on the plurality of credit application requests; The at least one to-be-adjusted credit corresponding to the second selected queue is added to the first selected queue.

27. A task scheduling method, applied to the task scheduling circuit according to any one of claims 23 to 25, wherein: The task scheduling method comprises: arbitrating the multiple queues to obtain the credit arbitration result; Arbitrating the tasks stored on the time wheel to obtain the time wheel arbitration result; Determining the target arbitration result based on the credit arbitration result and the time round arbitration result; The target arbitration result is dispatched for execution.

28. The task scheduling method according to claim 27, wherein: Determining the target arbitration result based on the credit arbitration result and the time round arbitration result includes: In response to the timing wheel arbitration result including a task stored on the timing wheel, determining that the target arbitration result includes the task on the timing wheel; In response to the time round arbitration result not including any task and the credit arbitration result including a credit arbitration task, it is determined that the target arbitration result includes the credit arbitration task.

29. An integrated circuit comprising the credit adjustment circuit according to any one of claims 1 to 22.

30. A non-transitory computer storage medium for storing computer executable instructions, in, When the computer executable instructions are executed by a computer, the computer is enabled to execute the credit adjustment method according to claim 26 or the task scheduling method according to claim 27 or 28.

Citation Information

Patent Citations

  • Processor resource accurate distributing method for predictive scheduling based on current credit

    CN103064746A

  • Method And System For Weighted Fair Queuing

    CN103916269A