A task arbitration system
By assigning dynamic weights to tasks in the GPU cloud service and adjusting them, the problem of unbalanced task arbitration is solved, and balanced and fair task execution is achieved.
Patent Information
- Application Number
- CN202410874706.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2025-10-14
- Estimated Expiration
- 2044-07-02
AI Technical Summary
In the GPU cloud service scenario, a single user's multiple tasks lack priority information, making it difficult to balance task arbitration.
Dynamic weights are assigned to tasks and adjusted according to the dynamic weights during the arbitration process to ensure the balance of task arbitration.
In the absence of priority information, the balance of task arbitration is achieved, and the fairness of task execution is improved.
Smart Images

Figure CN118708322B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and in particular to a task arbitration system. BACKGROUND
[0002] GPU cloud service is an elastic computing service that provides GPU computing power. Since GPU chips have strong parallel computing capabilities, they can serve deep learning training, scientific computing, graphics image processing, video encoding and decoding, etc. In the GPU cloud service scenario, GPU chips can provide services for multiple terminal users, so that users do not need to deploy GPU chips locally.
[0003] When a GPU chip provides services for a single user, the single user may have multiple tasks to be executed. These tasks usually do not have priority information, so it is difficult to use existing arbiters to arbitrate tasks, thereby making it difficult to ensure the balance of task arbitration. Therefore, how to improve the balance of task arbitration has become a problem to be solved. SUMMARY
[0004] To solve the above technical problems, the technical solution adopted by the present application is:
[0005] A task arbitration system, the system comprising: a GPU chip, a temporary user a k , a k corresponding task set E k ={e k 1, e k 2, …, e k n(k) , e k N(k)}, e k n(k) is the n(k)th task in the temporary user a k corresponding task set E k , the task set E k includes N(k) tasks, and n(k) is an integer in the range of [1, N(k)]. When the computer program is executed by the processor, the following steps are implemented:
[0006] S201, respectively assigning dynamic weights to the N(k) tasks.
[0007] S202, arbitrating a target task from the N(k) tasks according to the dynamic weights respectively corresponding to the N(k) tasks, wherein the target task is executed by the GPU chip.
[0008] S203, updating the dynamic weights respectively corresponding to the N(k) tasks according to the dynamic weight corresponding to the target task.
[0009] S204, return to execute step S202 to step S203.
[0010] The present application has obvious beneficial effects compared with the prior art, and the task arbitration system provided by the present application can achieve considerable technical progress and practicality, and has wide industrial utilization value, and at least has the following beneficial effects:
[0011] The present application provides a task arbitration system, which comprises a GPU chip, a temporary user a k , a k corresponding task set E k ={e k 1, e k 2, …, e k n(k) , e k N(k)}, e k n(k) is the nth(k) task in the corresponding task set E k of the temporary user a k , the task set E k comprises N(k) tasks, and n(k) is an integer in the range of [1, N(k)], and when a computer program is executed by a processor, the following steps are implemented: S201, dynamically assigning a weight to each of the N(k) tasks; S202, arbitrating a target task from the N(k) tasks according to the dynamic weight corresponding to each of the N(k) tasks, wherein the target task is executed by the GPU chip; S203, updating the dynamic weight corresponding to each of the N(k) tasks according to the dynamic weight corresponding to the target task; and S204, returning to execute step S202 to step S203.
[0012] It can be known that the dynamic weight is set for the tasks with the same priority, and the dynamic weight is adjusted along with the arbitration process, so that the arbitration process meets the result of round-robin arbitration without using priority information, thereby effectively improving the balance of arbitration of tasks without priority or with the same priority. BRIEF DESCRIPTION OF DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below, and obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0014] Figure 1 A flowchart of a computer program for a user arbitration system for a GPU provided by the first embodiment of the present application when executed by a processor is shown in the figure.
[0015] Figure 2 A flowchart of a computer program for a task arbitration system provided by Embodiment Two of the present application is executed by a processor. DETAILED DESCRIPTION
[0016] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person skilled in the art without creative work fall within the protection scope of the present application.
[0017] Embodiment One of the present application provides a user arbitration system for a GPU, the system comprising: a GPU chip, a user set A={a1, a2, …, a m , …, a M}, a processor and a memory storing a computer program, wherein a m is the mth user in the user set A, the user set A comprises M users, m is an integer in the range of [1, M], a m corresponds to b m , b m is user information corresponding to the mth user in A, the user information comprises a priority of the corresponding user, see Figure 1 A flowchart of a computer program for a user arbitration system for a GPU provided by Embodiment One of the present application is executed by a processor. When the computer program is executed by the processor, the following steps are implemented:
[0018] S101, determining initial values of reference weights corresponding to M users respectively according to a preset total weight C and user information corresponding to the M users respectively, wherein the sum of the M initial values is equal to C;
[0019] S102, for a single call cycle of the GPU chip, at an ith time point of the call cycle, according to a request state of the M users at the ith time point and reference weights and priorities corresponding to the M users at the ith time point, arbitrating to obtain a temporary user corresponding to an ith time slice, the ith time slice being a time period corresponding to the ith time point to an (i+1)th time point;
[0020] S103, updating the reference weight corresponding to the temporary user;
[0021] S104, updating i=i+1, returning to execute steps S101 to S103 until i=C+1, and executing step S105;
[0022] S105, set the reference weight corresponding to each of the M users as the initial value corresponding thereto, and return to execute steps S102-S104.
[0023] In this embodiment, the GPU chip mentioned is not limited to a single GPU chip, but can also be one or more threads in a single GPU chip, or a GPU chip set formed by multiple GPU chips, and the user can be a user who needs to call the GPU chip. In this embodiment, different users have different priorities.
[0024] The time point can be a time at which user arbitration is started. The temporary user obtained by arbitration at the i-th time point can call the GPU chip in the i-th time slice. The duration corresponding to the time slice can be a fixed value.
[0025] In a specific implementation, the total weight C is the same as the number of time points included in a single calling period of the GPU chip.
[0026] In this embodiment, the total weight C is the same as the number of time points included in a single calling period of the GPU chip. Accordingly, the sum of the initial values of the reference weights corresponding to the M users is the same as the number of time points included in a single calling period of the GPU chip. In the case where the M users have requests at each time point in a single calling period, the user arbitration provided in this embodiment can enable users with different priorities to call the GPU chip, thereby improving the balance of user arbitration.
[0027] In a specific implementation, the user information further includes historical usage information.
[0028] According to the preset total weight C and the user information corresponding to the M users, the initial values of the reference weights corresponding to the M users are determined, including:
[0029] According to C and the priority and historical usage information corresponding to the M users, the initial values of the reference weights corresponding to the M users are determined.
[0030] In this embodiment, the user information can include the priority of the user, historical usage information, membership level, etc. The historical usage information can include historical usage duration, historical usage frequency, etc. The implementer can select one or more of the above types of user information according to actual needs for reference weight initial value determination. In this embodiment, the priority and historical usage information are used as examples, and in this example, the historical usage information is the historical usage duration.
[0031] Specifically, in the embodiment, an initial value determination method is provided as an example, and the implementer should know that no matter which initial value determination method is used to determine the initial value of the reference weight of each user according to the user information of each user, it is within the protection scope of the application. The initial value determination method can be: normalizing the priority of each user by the maximum value of the priority of each user, obtaining the normalized priority of each user, normalizing the historical use time length of each user by the maximum value of the historical use time length of each user, obtaining the historical use time length priority of each user, multiplying the normalized priority and the historical use time length priority of any user to obtain an intermediate normalization result, summing all intermediate normalization results to obtain a summation result, multiplying the ratio of the intermediate normalization result of any user to the summation result by C and then performing an integer operation, and the initial value of the reference weight corresponding to the user can be obtained. It should be noted that, in order to meet the condition that the sum of the initial values of the reference weights corresponding to the M users is equal to C, the implementer can flexibly select the integer operation of each user according to the actual situation, and the integer operation can include rounding up and rounding down.
[0032] In a specific embodiment, the request state includes a request state and a non-request state.
[0033] In step S102, the following steps are further included:
[0034] S1021, if only a single user has a request state of a request state at the i th time point, the user is taken as a temporary user corresponding to the i th time slice.
[0035] If only a single user has a request state of a request state at the i th time point, the priority and reference value of the user do not need to be considered at this time, and the GPU chip can be directly allocated to the user for calling, so as to avoid the idle state of the GPU chip.
[0036] In a specific embodiment, in step S102, the following steps are further included:
[0037] S1022, if at least two users have a request state of a request state at the i th time point, the user with the highest priority from the users with a reference weight of zero is selected as a temporary user corresponding to the i th time slice.
[0038] Among them, a user's reference weight of zero indicates that all of its allocated time slices have been used, and a user's reference weight of non-zero indicates that there are some allocated time slices left. If at the i-th time point, at least two users have a request status of "requested," since the user with a reference weight of zero should have used up all of its allocated time slices, the user with the highest priority is selected from the users with a non-zero reference weight as the temporary user corresponding to the i-th time slice.
[0039] In a specific embodiment, step S103 further includes the following steps:
[0040] S1031: If the reference weight corresponding to the temporary user is zero, the reference weight corresponding to the temporary user is maintained.
[0041] If the reference weight corresponding to the temporary user is zero, the reference weight corresponding to the temporary user is kept zero.
[0042] In a specific embodiment, step S103 further includes the following steps:
[0043] S1032: If the reference weight corresponding to the temporary user is not zero, subtract 1 from the reference weight corresponding to the temporary user.
[0044] Among them, if the reference weight corresponding to the temporary user is not zero, the reference weight corresponding to the temporary user is reduced by 1. For example, the reference weight corresponding to a user before being determined as a temporary user is 2, and after the user is determined as a temporary user, the reference weight is updated to 1.
[0045] In a specific embodiment, step S105 further includes the following steps:
[0046] S1051: If the user information corresponding to the M users has not been updated, the reference weights corresponding to the M users are set to their corresponding initial values, and the process returns to step S102 to step S104.
[0047] S1052: If the user information corresponding to any user is updated, the process returns to step S101 to step S104.
[0048] Among them, there may be updates to user information during the call cycle. In order to distribute the calls of GPU chips more evenly, when there is an update to user information, the initial value needs to be re-determined.
[0049] In one embodiment, if there is an update on the M users, such as adding a new user or deleting a user, the process returns to step S101 to step S104 .
[0050] In the first embodiment, the initial value of the reference weight of each user is allocated according to the total weight value and the user information of each user, which is different from the prior art. When arbitration is performed, the arbitration result is determined according to the priority, the request state and the reference weight, and the reference weight of the temporary user is updated after arbitration, so that the user with high priority cannot continuously occupy the GPU chip, thereby effectively improving the balance of user arbitration.
[0051] The second embodiment of the present application provides a task arbitration system, which comprises a GPU chip, a temporary user a k 、a k corresponding task set E k ={e k 1, e k 2, …, e k n(k) , e k N(k)}, e k n(k) is the n(k)th task in the corresponding task set E k of the temporary user a k , the task set E k includes N(k) tasks, n(k) is an integer in the range of [1, N(k)], and the reference weight of the n(k)th task is p Figure 2 , a flowchart of a computer program in the task arbitration system provided by the second embodiment of the present application is executed by a processor, when the computer program is executed by the processor, the following steps are implemented:
[0052] S201, respectively allocating dynamic weights for the N(k) tasks;
[0053] S202, arbitrating a target task from the N(k) tasks according to the dynamic weights corresponding to the N(k) tasks, wherein the target task is executed by the GPU chip;
[0054] S203, updating the dynamic weights corresponding to the N(k) tasks according to the dynamic weight corresponding to the target task;
[0055] S204, returning to steps S202 to S203.
[0056] In the second embodiment, the dynamic weights allocated to the N(k) tasks are all the same.
[0057] In a specific embodiment, the initial value of the dynamic weight is p=f[log2(N(k))], wherein f[] is a rounding-up function.
[0058] Among them, since the dynamic weight can be zero, the value range corresponding to the dynamic weight is [0, f[log2(N(k))]], that is, the dynamic weight can have f[log2(N(k))]+1 values.
[0059] In a specific embodiment, step S202 further includes the following steps:
[0060] S2021: If the maximum value among the dynamic weights corresponding to the N(k) tasks corresponds to a single task, then the task is determined to be the target task.
[0061] In a specific embodiment, each of the N(k) tasks corresponds to a static weight, and step S202 further includes the following steps:
[0062] S2022, if the maximum value among the dynamic weights corresponding to the N(k) tasks corresponds to multiple tasks, determine that the multiple tasks corresponding to the maximum value among the dynamic weights corresponding to the N(k) tasks are all intermediate tasks;
[0063] S2023: Arbitrate the target task from all the intermediate tasks according to the static weights corresponding to all the intermediate tasks.
[0064] Among them, when the maximum value of the dynamic weights corresponding to N(k) tasks corresponds to multiple tasks, the balance of task arbitration cannot be guaranteed by dynamic weight alone, so arbitration is performed by static weight.
[0065] In a specific implementation, the static weights corresponding to the N(k) tasks are updated in a sequential cycle manner.
[0066] The sequential cycle method may mean that the static weights corresponding to the N(k) tasks are maximized in sequence according to the sequential cycle method.
[0067] In a specific embodiment, step S203 further includes the following steps:
[0068] S2031: Update the dynamic weight corresponding to the target task to zero.
[0069] In a specific embodiment, step S203 further includes the following steps:
[0070] S2031, if the dynamic weights corresponding to the other intermediate tasks except the target task are the initial values, then maintaining the dynamic weights corresponding to the other intermediate tasks except the target task;
[0071] S2032: If the dynamic weights corresponding to the other intermediate tasks except the target task are smaller than the initial value, the dynamic weights corresponding to the other intermediate tasks except the target task are increased by one respectively.
[0072] Specifically, taking N(k)=3 as an example, there are tasks R1, R2, and R3, and the initial value corresponding to the dynamic weight is 3. The polling mechanism cycles sequentially in the order of R1, R2, and R3. The static weight of R1 is the largest at the beginning. In this embodiment, the values of the static weight are limited to 0 and 1. The static weight of R1 is 1 at the beginning, and the static weights of R2 and R3 are 0. The dynamic weights of R1, R2, and R3 are all 3 at the beginning. Therefore, the static weight is used for arbitration, and R1 is the result of the first round of arbitration.
[0073] Before the second round of arbitration, R2's static weight is changed to 1, and the static weights of R1 and R3 are 0. At the same time, R1's dynamic weight is updated to 0, and the dynamic weights of R2 and R3 are 3. At this time, the intermediate tasks are R2 and R3. Since R2 and R3 have the same dynamic weight, arbitration is performed according to the static weights of R2 and R3, and R2 is the result of the second round of arbitration.
[0074] Before the third round of arbitration, R3's static weight is changed to 1, and the static weights of R1 and R2 are 0. At the same time, R2's dynamic weight is updated to 0, R1's dynamic weight is 0, and R3's dynamic weight is 3. At this time, according to the dynamic weights, R3 is the result of the third round of arbitration.
[0075] It can be seen that the task arbitration system provided in this embodiment can implement arbitration in a round-robin manner without using the priorities corresponding to the tasks, thereby ensuring the balance of arbitration of tasks with no priority or the same priority.
[0076] In a specific embodiment, the system further includes a user set A={a1, a2, ..., a m ,…,a M}, where a m is the mth user in the user set A, the user set A includes M users, m and k are both integers in the range [1, M], a m Corresponding to b m , b m is the user information corresponding to the mth user in A, where the user information includes the priority of the corresponding user;
[0077] When the computer program is executed by a processor, the following steps are also implemented:
[0078] S301, determining initial values of reference weights corresponding to the M users respectively based on a preset total weight C and user information corresponding to the M users respectively;
[0079] S302, at the jth time point, according to the request status of M users at the jth time point, and the reference weights and priorities corresponding to the M users at the jth time point, the temporary user a is obtained by arbitration. k , j is a positive integer.
[0080] The process of user arbitration is described in Example 1 and will not be described in detail here.
[0081] It should be noted that the above-mentioned embodiment 1 can be applied to arbitration between objects of different priorities, and the above-mentioned embodiment 2 can be applied to arbitration between objects of the same priority. The implementer can adjust the application scenarios of different embodiments according to actual conditions. For example, if arbitration is performed on several users of the same priority, the process provided in embodiment 2 can also be used for implementation. If arbitration is performed on several tasks of different priorities, the process provided in embodiment 1 can also be used for implementation.
[0082] The second embodiment of the present invention sets dynamic weights for tasks with the same priority, and adjusts the dynamic weights along the arbitration process, so that the arbitration process conforms to the results of polling arbitration without using priority information, thereby effectively improving the balance of arbitration of tasks with no priority or the same priority.
[0083] Although some specific embodiments of the present invention have been described in detail by way of example, it will be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present invention. It will also be understood by those skilled in the art that various modifications may be made to the embodiments without departing from the scope and spirit of the present invention. The scope of the present invention is defined by the appended claims.
Claims
1. A task arbitration system, characterized in that: The system includes: GPU chip, temporary user a k 、a k The corresponding task set E k ={e k 1,e k 2,…,e k n(k) , e k N(k) }, e k n(k) For temporary user a k The corresponding task set E k The n(k)th task in the task set E k The computer program includes N(k) tasks, where n(k) is an integer in the range [1, N(k)]. When the computer program is executed by a processor, the following steps are implemented: S201, assigning dynamic weights to N(k) tasks respectively, wherein the initial values of the dynamic weights assigned to the N(k) tasks are all the same; S202, arbitrating a target task from the N(k) tasks based on the dynamic weights corresponding to the N(k) tasks, wherein the target task is executed by the GPU chip, wherein the N(k) tasks respectively correspond to static weights. Step S202 also includes the following steps: S2022, if the maximum value among the dynamic weights corresponding to the N(k) tasks corresponds to multiple tasks, determine that the multiple tasks corresponding to the maximum value among the dynamic weights corresponding to the N(k) tasks are all intermediate tasks; S2023, arbitrating the target task from all the intermediate tasks based on the static weights corresponding to all the intermediate tasks, including: selecting the intermediate task with the largest static weight among the static weights corresponding to all the intermediate tasks as the target task; The static weights corresponding to the N(k) tasks are updated in a sequential cycle, wherein the sequential cycle means that the static weights corresponding to the N(k) tasks are maximized in a sequential cycle. S203, based on the dynamic weight corresponding to the target task, updating the dynamic weights corresponding to the N(k) tasks, wherein step S203 further includes the following steps: S2031, updating the dynamic weight corresponding to the target task to zero; S2032: If the dynamic weights corresponding to the other intermediate tasks except the target task are the initial values, then the dynamic weights corresponding to the other intermediate tasks except the target task are maintained; S2033: If the dynamic weights corresponding to the other intermediate tasks except the target task are smaller than the initial value, the dynamic weights corresponding to the other intermediate tasks except the target task are increased by one respectively; S204, return to execute steps S202 to S203.
2. The task arbitration system according to claim 1, characterized in that: The initial value p corresponding to the dynamic weight is p=f[log2(N(k))], where f[] is a rounding-up function.
3. The task arbitration system according to claim 2, characterized in that: Step S202 also includes the following steps: S2021: If the maximum value among the dynamic weights corresponding to the N(k) tasks corresponds to a single task, then the task is determined to be the target task.
4. The task arbitration system according to claim 1, characterized in that: The system also includes a user set A={a1, a2, ..., a m ,…,a M }, where a m is the mth user in the user set A, the user set A includes M users, m and k are both integers in the range [1, M], a m Corresponding to b m , b m is the user information corresponding to the mth user in A, where the user information includes the priority of the corresponding user; When the computer program is executed by a processor, the following steps are also implemented: S301, determining initial values of reference weights corresponding to the M users respectively based on a preset total weight C and user information corresponding to the M users respectively; S302, at the jth time point, according to the request status of M users at the jth time point, and the reference weights and priorities corresponding to the M users at the jth time point, the temporary user a is obtained by arbitration. k , wherein the request state includes a request state and a no request state, and j is a positive integer.
Citation Information
Patent Citations
Reliability demand-based arbitration method in network on chip
CN102394829A
Weighted polling arbiter and polling arbitration method and chip thereof
CN115080474A