Power consumption control method and device for GPU, electronic equipment and storage medium

CN116643639BActive Publication Date: 2026-09-08MOORE THREADS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310626726.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2026-09-08
Estimated Expiration
2043-05-30

AI Technical Summary

Technical Problem

在GPU运行过程中,要保证GPU的功耗在安全和合理的范围内,否则有损坏芯片和降低性能的风险

Benefits of technology

[0101]在本公开实施例中,通过获得GPU的当前功耗以及所述GPU在第一预设时长内的平均功耗,获取所述GPU的目标功耗,根据所述当前功耗和所述目标功耗,确定所述GPU的第一候选工作频率,将所述GPU在所述第一预设时长内的平均功耗和所述目标功耗输入比例积分微分控制器,经由所述比例积分微分控制器输出所述GPU的第二候选工作频率,并根据所述第一候选工作频率和所述第二候选工作频率,确定所述GPU的目标工作频率,由此基于GPU的当前功耗对GPU进行功耗控制,能够提高功耗控制的响应速度,减少过高的功耗对芯片的损害,从而能够提高GPU的安全性和性能,并且,通过关注到较长时间内GPU的平均功耗,并通过比例积分微分控制器对GPU的较长时间内的平均功耗进行处理,能够使GPU的工作频率更稳定,从而能够使GPU的性能更稳定。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116643639B_ABST
    Figure CN116643639B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a power consumption control method and device for a GPU, an electronic device and a storage medium. The method comprises: obtaining a current power consumption of a GPU and an average power consumption of the GPU within a first preset time length; obtaining a target power consumption of the GPU; determining a first candidate working frequency of the GPU according to the current power consumption and the target power consumption; inputting the average power consumption of the GPU within the first preset time length and the target power consumption into a proportional-integral-derivative controller, and outputting a second candidate working frequency of the GPU via the proportional-integral-derivative controller; and determining a target working frequency of the GPU according to the first candidate working frequency and the second candidate working frequency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of electronic digital data processing technology, and in particular to a power consumption control method for a GPU, a power consumption control device for a GPU, an electronic device, and a storage medium. Background Technology

[0002] A GPU (Graphics Processing Unit) is a high-performance, high-power image processor. During GPU operation, it's crucial to ensure that the GPU's power consumption remains within a safe and reasonable range; otherwise, there is a risk of damaging the chip and reducing performance. Summary of the Invention

[0003] This disclosure provides a power consumption control technology solution for GPUs.

[0004] According to one aspect of this disclosure, a power consumption control method for a GPU is provided, comprising:

[0005] Obtain the current power consumption of the GPU and the average power consumption of the GPU over a first preset time period;

[0006] Obtain the target power consumption of the GPU;

[0007] Based on the current power consumption and the target power consumption, the first candidate operating frequency of the GPU is determined;

[0008] The average power consumption of the GPU within the first preset time period and the target power consumption are input into the proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller;

[0009] The target operating frequency of the GPU is determined based on the first candidate operating frequency and the second candidate operating frequency.

[0010] In one possible implementation, the target power consumption includes a first target power consumption and a second target power consumption, wherein the first target power consumption is higher than the second target power consumption;

[0011] Determining the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption includes: determining the first candidate operating frequency of the GPU based on the current power consumption and the first target power consumption;

[0012] The step of inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a proportional-integral-derivative (PID) controller, and outputting the second candidate operating frequency of the GPU through the PID controller, includes: inputting the average power consumption of the GPU within the first preset time period and the second target power consumption into a PID controller, and outputting the second candidate operating frequency of the GPU through the PID controller.

[0013] In one possible implementation, determining the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption includes:

[0014] Obtain the static power consumption and current operating frequency of the GPU;

[0015] The current scaling factor is determined based on the current power consumption, the target power consumption, and the static power consumption.

[0016] The first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

[0017] In one possible implementation, obtaining the average power consumption of the GPU over a first preset duration includes:

[0018] The average power consumption of the GPU within the first preset time period is obtained by averaging the power consumption values ​​of the GPU within the first preset time period.

[0019] In one possible implementation, averaging the power consumption values ​​of the GPU obtained within the first preset time period to obtain the average power consumption of the GPU within the first preset time period includes:

[0020] In response to the first preset duration being less than or equal to a duration threshold, the average power consumption values ​​of the GPU obtained within the first preset duration are averaged to obtain the average power consumption of the GPU within the first preset duration.

[0021] In one possible implementation, obtaining the average power consumption of the GPU over a first preset duration includes:

[0022] Obtain the average power consumption of the GPU at the previous time step;

[0023] The average power consumption of the GPU within the first preset time period is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0024] In one possible implementation, determining the average power consumption of the GPU within the first preset time period based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU includes:

[0025] In response to the first preset duration being greater than the duration threshold, the average power consumption of the GPU within the first preset duration is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0026] In one possible implementation, obtaining the current power consumption of the GPU includes:

[0027] The sampling power consumption of the GPU during a second preset time period is obtained, wherein the second preset time period is less than the first preset time period;

[0028] The sampled power consumption within the second preset time period is filtered to obtain the current power consumption of the GPU.

[0029] In one possible implementation, determining the target operating frequency of the GPU based on the first candidate operating frequency and the second candidate operating frequency includes:

[0030] The smaller value between the first candidate operating frequency and the second candidate operating frequency is determined as the target operating frequency of the GPU.

[0031] In one possible implementation, determining the first candidate operating frequency of the GPU based on the current operating frequency and the current scaling factor includes:

[0032] In response to the GPU being in a first power control state, a first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

[0033] In one possible implementation, the method further includes:

[0034] In response to the fact that the GPU is not in the first power control state and the current power consumption is greater than or equal to the first preset control power consumption, it is determined that the GPU enters the first power control state.

[0035] or,

[0036] In response to the fact that the GPU is not in the first power control state and the current power consumption is less than the first preset control power consumption, it is determined that the GPU is not in the first power control state.

[0037] In one possible implementation, the method further includes:

[0038] In response to the GPU being in the first power control state and the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption not reaching the first preset number, it is determined that the GPU will continue to be in the first power control state, wherein the first preset number is greater than 1;

[0039] or,

[0040] In response to the GPU being in the first power control state, the current power consumption being less than the first preset exit power consumption, and the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption reaching the first preset number, it is determined that the GPU exits the first power control state.

[0041] In one possible implementation, the step of inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a proportional-integral-derivative (PID) controller, and outputting the second candidate operating frequency of the GPU via the PID controller, includes:

[0042] In response to the GPU being in a second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption are input into a proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller.

[0043] In one possible implementation, the method further includes:

[0044] In response to the fact that the GPU is not in the second power control state and the average power consumption of the GPU within the first preset time period is greater than or equal to the second preset control power consumption, it is determined that the GPU enters the second power control state.

[0045] or,

[0046] In response to the fact that the GPU is not in the second power control state and the average power consumption of the GPU within the first preset time period is less than the second preset control power consumption, it is determined that the GPU is not in the second power control state.

[0047] In one possible implementation, the method further includes:

[0048] In response to the GPU being in the second power control state and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption not reaching the second preset number, it is determined that the GPU continues to be in the second power control state, wherein the second preset number is greater than 1;

[0049] or,

[0050] In response to the GPU being in the second power control state, the average power consumption of the GPU within the first preset time period is less than the second preset exit power consumption, and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption reaches the second preset number, it is determined that the GPU exits the second power control state.

[0051] According to one aspect of this disclosure, a power consumption control device for a GPU is provided, comprising:

[0052] The first acquisition module is used to acquire the current power consumption of the GPU and the average power consumption of the GPU within a first preset time period.

[0053] The acquisition module is used to acquire the target power consumption of the GPU;

[0054] The first determining module is used to determine the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption;

[0055] The second acquisition module is used to input the average power consumption of the GPU within the first preset time period and the target power consumption into the proportional-integral-derivative controller, and output the second candidate operating frequency of the GPU through the proportional-integral-derivative controller;

[0056] The second determining module is used to determine the target operating frequency of the GPU based on the first candidate operating frequency and the second candidate operating frequency.

[0057] In one possible implementation, the target power consumption includes a first target power consumption and a second target power consumption, wherein the first target power consumption is higher than the second target power consumption;

[0058] The first determining module is configured to: determine a first candidate operating frequency of the GPU based on the current power consumption and the first target power consumption;

[0059] The second obtaining module is used to: input the average power consumption of the GPU within the first preset time period and the second target power consumption into the proportional-integral-derivative controller, and output the second candidate operating frequency of the GPU via the proportional-integral-derivative controller.

[0060] In one possible implementation, the first determining module is used to:

[0061] Obtain the static power consumption and current operating frequency of the GPU;

[0062] The current scaling factor is determined based on the current power consumption, the target power consumption, and the static power consumption.

[0063] The first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

[0064] In one possible implementation, the first obtaining module is used to:

[0065] The average power consumption of the GPU within the first preset time period is obtained by averaging the power consumption values ​​of the GPU within the first preset time period.

[0066] In one possible implementation, the first obtaining module is used to:

[0067] In response to the first preset duration being less than or equal to a duration threshold, the average power consumption values ​​of the GPU obtained within the first preset duration are averaged to obtain the average power consumption of the GPU within the first preset duration.

[0068] In one possible implementation, the first obtaining module is used to:

[0069] Obtain the average power consumption of the GPU at the previous time step;

[0070] The average power consumption of the GPU within the first preset time period is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0071] In one possible implementation, the first obtaining module is used to:

[0072] In response to the first preset duration being greater than the duration threshold, the average power consumption of the GPU within the first preset duration is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0073] In one possible implementation, the first obtaining module is used to:

[0074] The sampling power consumption of the GPU during a second preset time period is obtained, wherein the second preset time period is less than the first preset time period;

[0075] The sampled power consumption within the second preset time period is filtered to obtain the current power consumption of the GPU.

[0076] In one possible implementation, the second determining module is used to:

[0077] The smaller value between the first candidate operating frequency and the second candidate operating frequency is determined as the target operating frequency of the GPU.

[0078] In one possible implementation, the first determining module is used to:

[0079] In response to the GPU being in a first power control state, a first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

[0080] In one possible implementation, the device further includes:

[0081] The third determining module is used to determine that the GPU enters the first power control state in response to the fact that the GPU is not in the first power control state and the current power consumption is greater than or equal to the first preset control power consumption.

[0082] or,

[0083] The fourth determining module is configured to determine that the GPU is not in the first power control state in response to the GPU not being in the first power control state and the current power consumption being less than the first preset control power consumption.

[0084] In one possible implementation, the device further includes:

[0085] The fifth determining module is configured to determine that the GPU continues to be in the first power control state in response to the fact that the number of consecutive times the power consumption of the GPU is less than the first preset exit power consumption has not reached the first preset number, wherein the first preset number is greater than 1.

[0086] or,

[0087] The sixth determining module is used to determine that the GPU exits the first power control state in response to the GPU being in the first power control state, the current power consumption being less than the first preset exit power consumption, and the number of consecutive times the power consumption of the GPU is less than the first preset exit power consumption reaching the first preset number.

[0088] In one possible implementation, the second obtaining module is used for:

[0089] In response to the GPU being in a second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption are input into a proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller.

[0090] In one possible implementation, the device further includes:

[0091] The seventh determining module is used to determine that the GPU enters the second power control state in response to the fact that the GPU is not in the second power control state and the average power consumption of the GPU in the first preset time period is greater than or equal to the second preset control power consumption.

[0092] or,

[0093] The eighth determining module is used to determine that the GPU is not in the second power control state in response to the GPU not being in the second power control state and the average power consumption of the GPU within the first preset time period being less than the second preset control power consumption.

[0094] In one possible implementation, the device further includes:

[0095] The ninth determining module is configured to determine that the GPU continues to be in the second power control state in response to the fact that the GPU is in the second power control state and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption has not reached the second preset number, wherein the second preset number is greater than 1;

[0096] or,

[0097] The tenth determining module is used to determine that the GPU exits the second power control state in response to the GPU being in the second power control state, the average power consumption of the GPU within the first preset time period being less than the second preset exit power consumption, and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption reaching the second preset number.

[0098] According to one aspect of this disclosure, an electronic device is provided, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to invoke the executable instructions stored in the memory to perform the method described above.

[0099] According to one aspect of this disclosure, a computer-readable storage medium is provided that stores computer program instructions thereon, which, when executed by a processor, implement the above-described method.

[0100] According to one aspect of this disclosure, a computer program product is provided, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in an electronic device, a processor in the electronic device performs the above-described method.

[0101] In this embodiment, by obtaining the current power consumption of the GPU and the average power consumption of the GPU within a first preset time period, the target power consumption of the GPU is obtained. Based on the current power consumption and the target power consumption, a first candidate operating frequency of the GPU is determined. The average power consumption of the GPU within the first preset time period and the target power consumption are input to a proportional-integral-derivative (PID) controller. The PID controller outputs a second candidate operating frequency of the GPU. Based on the first candidate operating frequency and the second candidate operating frequency, the target operating frequency of the GPU is determined. Thus, power consumption control of the GPU based on its current power consumption can improve the response speed of power consumption control, reduce the damage to the chip caused by excessive power consumption, and thereby improve the security and performance of the GPU. Furthermore, by focusing on the average power consumption of the GPU over a longer period and processing the average power consumption of the GPU over a longer period through the PID controller, the operating frequency of the GPU can be made more stable, thereby making the performance of the GPU more stable.

[0102] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure.

[0103] Other features and aspects of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description

[0104] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.

[0105] Figure 1 This diagram illustrates the operating frequency of a GPU after power consumption control in related technologies.

[0106] Figure 2 A flowchart illustrating a power consumption control method for a GPU provided in an embodiment of this disclosure is shown.

[0107] Figure 3 This diagram illustrates the operating frequency of a GPU after power consumption control is performed using the power consumption control method for GPUs provided in this embodiment of the present disclosure.

[0108] Figure 4 A block diagram of a power control device for a GPU provided in an embodiment of this disclosure is shown.

[0109] Figure 5 A block diagram of an electronic device 1900 provided in an embodiment of this disclosure is shown. Detailed Implementation

[0110] Various exemplary embodiments, features, and aspects of this disclosure will now be described in detail with reference to the accompanying drawings. The same reference numerals in the drawings denote elements that have the same or similar functions. Although various aspects of the embodiments are shown in the drawings, they are not necessarily drawn to scale unless specifically indicated otherwise.

[0111] The term “exemplary” as used herein means “serving as an example, embodiment, or illustration.” Any embodiment illustrated herein as “exemplary” is not necessarily to be construed as superior to or better than other embodiments.

[0112] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0113] Furthermore, to better illustrate this disclosure, numerous specific details are set forth in the following detailed description. Those skilled in the art will understand that this disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art have not been described in detail in order to highlight the main points of this disclosure.

[0114] In related technologies, by controlling the power consumption of the GPU, it is possible to control the high power consumption of the GPU in a short period of time, so that the power consumption of the GPU is kept within a safe and reasonable range. Figure 1 This diagram illustrates the GPU's operating frequency after power consumption control, as described in related technologies. Figure 1 In the graph, the horizontal axis represents time, and the vertical axis represents the operating frequency. Figure 1 It is evident that, in the long run, the power consumption control methods used for GPUs in related technologies cause the GPU's operating frequency to fluctuate continuously, resulting in unstable GPU performance.

[0115] This disclosure provides a power consumption control method for a GPU. By obtaining the current power consumption of the GPU and its average power consumption over a first preset time period, a target power consumption of the GPU is obtained. Based on the current power consumption and the target power consumption, a first candidate operating frequency of the GPU is determined. The average power consumption of the GPU over the first preset time period and the target power consumption are input to a proportional-integral-derivative (PID) controller. The PID controller outputs a second candidate operating frequency of the GPU. Based on the first candidate operating frequency and the second candidate operating frequency, the target operating frequency of the GPU is determined. This method controls the GPU's power consumption based on its current power consumption, improving the response speed of power consumption control and reducing damage to the chip from excessive power consumption. This improves the security and performance of the GPU. Furthermore, by focusing on the average power consumption of the GPU over a longer period and processing this average power consumption over a longer period using the PID controller, the operating frequency of the GPU can be made more stable, thus improving the performance of the GPU.

[0116] The power consumption control method for GPUs provided in this disclosure will now be described in detail with reference to the accompanying drawings.

[0117] Figure 2 A flowchart illustrating a power control method for a GPU provided in an embodiment of this disclosure is shown. In one possible implementation, the entity executing the power control method for a GPU can be a power control device for a GPU. For example, the power control method for a GPU can be executed by a terminal device, a server, or other electronic equipment. The terminal device can be a user equipment (UE), mobile device, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (PDA), handheld device, computing device, in-vehicle device, or wearable device, etc. In some possible implementations, the power control method for a GPU can be implemented by a processor calling computer-readable instructions stored in memory. Figure 2 As shown, the power consumption control method for the GPU includes steps S21 to S25.

[0118] In step S21, the current power consumption of the GPU and the average power consumption of the GPU within a first preset time period are obtained.

[0119] In step S22, the target power consumption of the GPU is obtained.

[0120] In step S23, the first candidate operating frequency of the GPU is determined based on the current power consumption and the target power consumption.

[0121] In step S24, the average power consumption of the GPU within the first preset time period and the target power consumption are input into the proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller.

[0122] In step S25, the target operating frequency of the GPU is determined based on the first candidate operating frequency and the second candidate operating frequency.

[0123] In this embodiment of the disclosure, the power consumption of the GPU is controlled based on the current power consumption of the GPU and the average power consumption of the GPU within a first preset time period.

[0124] In one possible implementation, obtaining the current power consumption of the GPU includes: acquiring the sampled power consumption of the GPU within a second preset duration, wherein the second preset duration is shorter than the first preset duration; and filtering the sampled power consumption within the second preset duration to obtain the current power consumption of the GPU.

[0125] As an example of this implementation, the first preset duration can be N times the second preset duration, where N is an integer greater than 1. For example, N can be equal to 5, 10, 8, etc., and is not limited here. For example, the second preset duration is 10ms, and the first preset duration is 50ms.

[0126] In this implementation, the GPU's sampled power consumption can represent the power consumption obtained by sampling the GPU's power consumption.

[0127] In this implementation, filtering methods such as mean filtering can be used to filter the sampled power consumption of the GPU to obtain the current power consumption of the GPU.

[0128] In this implementation, by obtaining the sampled power consumption of the GPU within a second preset time period and filtering the sampled power consumption within the second preset time period, the current power consumption of the GPU is obtained. This enables power consumption control of the GPU based on a more stable current power consumption, thereby helping to improve the stability of GPU power consumption control and thus helping to improve the stability of GPU performance.

[0129] As an example of this implementation, obtaining the sampling power consumption of the GPU includes: collecting the power consumption of the GPU through an external power acquisition device; and obtaining the sampling power consumption of the GPU from the power acquisition device at a preset frequency.

[0130] For example, the power consumption acquisition device could be an INA3221, etc., and is not limited here. In this example, the sampled power consumption of the GPU can be obtained from the power consumption acquisition device. For example, the sampled power consumption of the GPU can be obtained from the power consumption acquisition device at a preset frequency.

[0131] In one example, the power consumption of the GPU can be obtained by interacting with the power acquisition device through a preset communication protocol. For example, the preset communication protocol can be the I2C (Inter-Integrated Circuit) communication protocol, etc., and is not limited here.

[0132] In one example, the method further includes: initializing the power acquisition device in response to the GPU startup.

[0133] In this example, the power consumption of the GPU is collected by an external power acquisition device, and the sampled power consumption of the GPU is obtained from the power acquisition device at a preset frequency, thereby improving the efficiency of GPU power consumption control.

[0134] In another possible implementation, obtaining the current power consumption of the GPU includes: acquiring the sampled power consumption of the GPU as the current power consumption of the GPU. In this implementation, the latest sampled power consumption output by the power acquisition device can be directly used as the current power consumption of the GPU without filtering.

[0135] In one possible implementation, the current power consumption of the GPU can be obtained based on a timing duration or a preset frequency, and the first candidate operating frequency of the GPU can be determined based on the current power consumption. This implementation, by obtaining the current power consumption of the GPU based on a timing duration or a preset frequency, enables more reliable and efficient power consumption control of the GPU.

[0136] In one possible implementation, obtaining the average power consumption of the GPU within a first preset time period includes: averaging the power consumption values ​​of the GPU obtained within the first preset time period to obtain the average power consumption of the GPU within the first preset time period.

[0137] For example, if the current time is t5, the GPU power consumption values ​​obtained within the first preset time period include the power consumption value p1 at time t1, p2 at time t2, p3 at time t3, p4 at time t4, and p5 at time t5. Therefore, at the current time, averaging the power consumption values ​​p1 at time t1, p2 at time t2, p3 at time t3, p4 at time t4, and p5 at time t5 yields the average power consumption p of the GPU within the first preset time period. 5a = (p1+p2+p3+p4+p5) / 5. Where p 5a This is the average power consumption corresponding to time t5.

[0138] For the previous time step t4, the GPU power consumption values ​​obtained within the first preset time period include the power consumption values ​​p0 at time t0, p1 at time t1, p2 at time t2, p3 at time t3, and p4 at time t4. Therefore, for the previous time step, averaging the power consumption values ​​p0 at time t0, p1 at time t1, p2 at time t2, p3 at time t3, and p4 at time t4 yields the average power consumption p of the GPU within the first preset time period. 4a = (p0 + p1 + p2 + p3 + p4) / 5. Where p 4a This is the average power consumption at time t4.

[0139] In this implementation, the average power consumption of the GPU within the first preset time period is obtained by averaging the power consumption values ​​of the GPU obtained within the first preset time period. This reduces the impact of earlier power consumption values ​​of the GPU on the current average power consumption calculation, increases the sensitivity of the average power consumption calculation to newer power consumption values ​​of the GPU, and thus improves the response speed of power consumption control.

[0140] As an example of this implementation, the step of averaging the power consumption values ​​of the GPU obtained within the first preset time period to obtain the average power consumption of the GPU within the first preset time period includes: averaging the power consumption values ​​of the GPU obtained within the first preset time period in response to the first preset time period being less than or equal to a time threshold, to obtain the average power consumption of the GPU within the first preset time period. In this example, by averaging the power consumption values ​​of the GPU obtained within the first preset time period in response to the first preset time period being less than or equal to a time threshold, the average power consumption of the GPU within the first preset time period can be obtained. This reduces the impact of earlier power consumption values ​​of the GPU on the current average power consumption calculation without consuming too much memory to store historical power consumption values, and improves the sensitivity of the average power consumption calculation to newer power consumption values ​​of the GPU, thereby improving the response speed of power consumption control.

[0141] As another example of this implementation, the step of averaging the power consumption values ​​of the GPU obtained within the first preset time period to obtain the average power consumption of the GPU within the first preset time period includes: averaging the power consumption values ​​of the GPU obtained within the first preset time period in response to the number of power consumption values ​​within the first preset time period being less than or equal to a preset value, to obtain the average power consumption of the GPU within the first preset time period. For example, the preset value can be 10, 5, 15, etc., and is not limited here.

[0142] As another example of this implementation, it is possible to disregard whether the first preset duration is less than or equal to the duration threshold or whether the number of power consumption values ​​within the first preset duration is less than or equal to the preset value. In all cases, the average power consumption of the GPU obtained within the first preset duration is calculated to obtain the average power consumption of the GPU within the first preset duration.

[0143] In another possible implementation, obtaining the average power consumption of the GPU within a first preset time period includes: obtaining the average power consumption of the GPU at the previous moment; and determining the average power consumption of the GPU within the first preset time period based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0144] For example, if the current time is t5, the current power consumption of the GPU is p5, and the average power consumption of the GPU at the previous time (t4) is p... 4a = (p0+p1+p2+p3+p4) / 5, then the average power consumption p of the GPU during the first preset time period can be determined. 5a =(p 4a ×4+p5) / 5. Where, p 5a This is the average power consumption corresponding to time t5.

[0145] In this implementation, the average power consumption of the GPU at the previous moment is obtained, and the average power consumption of the GPU within the first preset time period is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU. Thus, in the calculation of the average power consumption, only the average power consumption value needs to be stored, and there is no need to store the power consumption at each moment, thereby saving memory.

[0146] As an example of this implementation, determining the average power consumption of the GPU within the first preset duration based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU includes: in response to the first preset duration being greater than a duration threshold, determining the average power consumption of the GPU within the first preset duration based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0147] In this example, in response to the first preset duration being greater than the duration threshold, the average power consumption of the GPU within the first preset duration is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU. Thus, in the calculation of the average power consumption, only the average power consumption needs to be stored, and there is no need to store the power consumption values ​​at each moment, thereby saving memory.

[0148] As another example of this implementation, determining the average power consumption of the GPU within the first preset duration based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU includes: in response to the number of power consumption values ​​within the first preset duration being greater than a preset value, determining the average power consumption of the GPU within the first preset duration based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0149] As another example of this implementation, it is not necessary to consider whether the first preset duration is greater than the duration threshold or whether the number of power consumption values ​​within the first preset duration is greater than the preset value. In all cases, the average power consumption of the GPU within the first preset duration is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0150] In one possible implementation, the step of averaging the power consumption values ​​of the GPU obtained within the first preset duration to obtain the average power consumption of the GPU within the first preset duration includes: averaging the power consumption values ​​of the GPU obtained within the first preset duration in response to the first preset duration being less than or equal to a duration threshold to obtain the average power consumption of the GPU within the first preset duration; and determining the average power consumption of the GPU within the first preset duration based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU in response to the first preset duration being greater than the duration threshold.

[0151] By adopting this implementation method, when the computational workload of average power consumption is small, the average power consumption of the GPU within the first preset time period is obtained by averaging the power consumption values ​​of the GPU obtained within the first preset time period. This reduces the influence of earlier power consumption values ​​of the GPU on the current average power consumption calculation and improves the sensitivity of the average power consumption calculation to newer power consumption values ​​of the GPU, thereby improving the response speed of power consumption control. When the computational workload of average power consumption is large, the average power consumption of the GPU within the first preset time period is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU, thereby saving memory.

[0152] In this embodiment of the disclosure, the target power consumption of the GPU can represent the target value of the GPU's power consumption, that is, the power consumption that the GPU is expected to achieve. At the target power consumption, the GPU can achieve higher performance while ensuring chip security.

[0153] GPU power consumption can be expressed as the total power consumption of the GPU, which can include both dynamic power consumption and static power consumption. For example, the total power consumption of the GPU, P...total =P dynamic +P static Among them, P dynamic P represents the dynamic power consumption of the GPU. static This represents the GPU's static power consumption. The GPU's static power consumption can be a fixed value and can be measured using an oscilloscope or obtained through other methods.

[0154] Prior to 40nm process nodes, dynamic power consumption accounted for a large proportion of total power consumption in GPUs. However, as process technology has evolved, static power consumption has gradually increased as a percentage of total power consumption, reaching a level comparable to dynamic power consumption at 7nm. This further increases the difficulty of implementing DVFS (Dynamic Voltage and Frequency Scaling).

[0155] In one example, the dynamic power consumption P dynamic =α×C×v 2 ×f. Where α is the flip-flop ratio, C is the load capacitance, v is the operating voltage, and f is the operating frequency. Therefore, by reducing the operating frequency, the power consumption can be reduced.

[0156] In one possible implementation, the target power consumption includes a first target power consumption and a second target power consumption, wherein the first target power consumption is higher than the second target power consumption; determining the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption includes: determining the first candidate operating frequency of the GPU based on the current power consumption and the first target power consumption; inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a proportional-integral-derivative (PID) controller, and outputting the second candidate operating frequency of the GPU via the PID controller includes: inputting the average power consumption of the GPU within the first preset time period and the second target power consumption into the PID controller, and outputting the second candidate operating frequency of the GPU via the PID controller.

[0157] In this implementation, a first candidate operating frequency of the GPU is determined based on a higher first target power consumption, and a second candidate operating frequency of the GPU is determined based on a lower second target power consumption. This allows the GPU to have higher power consumption in a short period of time and controls the GPU to have more stable power consumption in a long period of time, thereby improving the performance and security of the GPU.

[0158] In another possible implementation, the first candidate operating frequency and the second candidate operating frequency can be determined based on the same target power consumption, that is, the first target power consumption can be equal to the second target power consumption.

[0159] In this embodiment of the disclosure, a first candidate operating frequency of the GPU can be determined based on the GPU's current power consumption and the GPU's target power consumption. The first candidate operating frequency can represent a candidate operating frequency of the GPU determined based on the GPU's current power consumption and the GPU's target power consumption.

[0160] In one possible implementation, determining the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption includes: obtaining the static power consumption of the GPU and the current operating frequency of the GPU; determining a current scaling factor based on the current power consumption, the target power consumption, and the static power consumption; and determining the first candidate operating frequency of the GPU based on the current operating frequency and the current scaling factor.

[0161] In related technologies, GPU power consumption is controlled through a multi-step control scheme. That is, multiple adjustments are required to bring the GPU power consumption to the desired target. This approach results in a slow reduction in GPU power consumption, still posing a risk of chip damage and performance degradation.

[0162] In this implementation, by obtaining the static power consumption and the current operating frequency of the GPU, a current scaling factor is determined based on the current power consumption, the target power consumption, and the static power consumption. Then, based on the current operating frequency and the current scaling factor, a first candidate operating frequency of the GPU is determined. This allows the GPU's power consumption to be controlled to the target power consumption in a single step, i.e., the GPU's power consumption can be controlled quickly without multi-step control. This reduces the damage to the chip caused by excessive power consumption, thereby improving the GPU's security and performance.

[0163] As an example of this implementation, determining the current scaling factor based on the current power consumption, the target power consumption, and the static power consumption includes: determining a first difference between the target power consumption and the static power consumption; determining a second difference between the current power consumption and the static power consumption; and determining a current scaling factor between the first difference and the second difference.

[0164] In this example, the first difference can represent the difference between the target power consumption and the static power consumption, and the second difference can represent the difference between the current power consumption and the static power consumption. In this example, the ratio of the first difference to the second difference can be determined as the current scaling factor. For example, it can be determined according to a = (P set -P static ) / (P current -P static ), determine the current proportionality coefficient a. Where P set P represents the target power consumption. static P represents static power consumption. currentThis indicates the current power consumption.

[0165] In one example, the product of the current operating frequency and the current scaling factor can be used to determine the first candidate operating frequency.

[0166] In this example, by determining a first difference between the target power consumption and the static power consumption, a second difference between the current power consumption and the static power consumption is determined, and a current scaling factor between the first difference and the second difference is determined, thereby enabling a reasonable determination of the current scaling factor. Determining the first candidate operating frequency of the GPU based on this determined current scaling factor helps improve the GPU's security and performance.

[0167] As another example of this implementation, determining the current scaling factor based on the current power consumption, the target power consumption, and the static power consumption includes: determining a first difference between the target power consumption and the static power consumption; determining a second difference between the current power consumption and the static power consumption; and determining a current scaling factor between the second difference and the first difference.

[0168] In this example, the first difference can represent the difference between the target power consumption and the static power consumption, and the second difference can represent the difference between the current power consumption and the static power consumption. In this example, the ratio of the second difference to the first difference can be determined as the current scaling factor. For example, it can be determined according to a = (P current -P static ) / (P set -P static ), determine the current proportionality coefficient a. Where P set P represents the target power consumption. static P represents static power consumption. current This indicates the current power consumption.

[0169] In one example, the current operating frequency can be divided by the current scaling factor to obtain the first candidate operating frequency.

[0170] As an example of this implementation, determining the first candidate operating frequency of the GPU based on the current operating frequency and the current scaling factor includes: in response to the GPU being in a first power control state, determining the first candidate operating frequency of the GPU based on the current operating frequency and the current scaling factor.

[0171] In this example, the first power control state can represent a state where short-cycle power control is required.

[0172] In this example, in response to the GPU being in a first power control state, a first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor. This allows the GPU's power consumption to be reduced by lowering the GPU's operating frequency when the GPU is in the first power control state, thereby reducing unnecessary power control and improving the efficiency of power control for the GPU.

[0173] As an example of this implementation, it can be determined whether the GPU is in the first power control state based on the current power consumption, the first preset control power consumption, and the first preset exit power consumption, wherein the first preset control power consumption is higher than the first preset exit power consumption. The first preset control power consumption can represent a pre-set power consumption value used to control the GPU to enter the first power control state, and the first preset exit power consumption can represent a pre-set power consumption value used to control the GPU to exit the first power control state.

[0174] In this example, the GPU is determined to be in the first power control state based on the current power consumption, the first preset control power consumption, and the first preset exit power consumption, wherein the first preset control power consumption is higher than the first preset exit power consumption, thereby enabling effective short-cycle power control of the GPU.

[0175] In one example, the method further includes: determining that the GPU enters the first power control state in response to the GPU not being in the first power control state and the current power consumption being greater than or equal to a first preset control power consumption; or, determining that the GPU is not in the first power control state in response to the GPU not being in the first power control state and the current power consumption being less than the first preset control power consumption.

[0176] In this example, if the GPU is not in the first power control state before the current power consumption of the GPU is obtained, and the current power consumption of the GPU is greater than or equal to the first preset control power consumption, then it can be determined that the GPU has entered the first power control state.

[0177] If the GPU was not in the first power control state before obtaining the current power consumption of the GPU, and the current power consumption of the GPU is less than the first preset control power consumption, then it can be determined that the GPU will not enter the first power control state.

[0178] In one example, the method further includes: in response to the GPU being in the first power control state and the number of consecutive times the power consumption of the GPU is less than the first preset exit power consumption not reaching the first preset number, determining that the GPU continues to be in the first power control state, wherein the first preset number is greater than 1; or, in response to the GPU being in the first power control state, the current power consumption being less than the first preset exit power consumption and the number of consecutive times the power consumption of the GPU is less than the first preset exit power consumption reaching the first preset number, determining that the GPU exits the first power control state.

[0179] In this example, if the GPU was in the first power control state before the current power consumption of the GPU was obtained, and the current power consumption of the GPU was greater than or equal to the first preset exit power consumption, then it can be determined that the number of consecutive times the power consumption of the GPU was less than the first preset exit power consumption was 0, and the first preset number of times was not reached. Therefore, it can be determined that the GPU continues to be in the first power control state.

[0180] If the GPU was in a first power control state before obtaining its current power consumption, and the GPU's current power consumption is less than a first preset exit power consumption, then it can be further determined whether the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption has reached a first preset number. If the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption has not reached the first preset number, then it can be determined that the GPU continues to be in the first power control state.

[0181] If the GPU was in a first power control state before obtaining its current power consumption, and the GPU's current power consumption is less than a first preset exit power consumption, then it can be further determined whether the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption has reached a first preset number. If the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption has reached the first preset number, then it can be determined that the GPU has exited the first power control state.

[0182] In this example, by setting a first preset number of delays to exit the first power control state, the power consumption of the GPU can be stably controlled at the target power consumption, which can be compatible with more power consumption scenarios and effectively reduce the performance loss in power control.

[0183] In another example, determining whether the GPU is in the first power control state based on the current power consumption, the first preset control power consumption, and the first preset exit power consumption includes: in response to the GPU being in the first power control state and the current power consumption of the GPU being less than the first preset exit power consumption, determining that the GPU exits the first power control state; or, in response to the GPU being in the first power control state and the current power consumption being greater than or equal to the first preset exit power consumption, determining that the GPU continues to be in the first power control state; or, in response to the GPU not being in the first power control state and the current power consumption being greater than or equal to the first preset control power consumption, determining that the GPU enters the first power control state; or, in response to the GPU not being in the first power control state and the current power consumption being less than the first preset control power consumption, determining that the GPU is not in the first power control state.

[0184] As another example of this implementation, it can be determined whether the GPU is in the first power control state based on the current power consumption and the first preset control power consumption.

[0185] In one example, determining whether the GPU is in the first power control state based on the current power consumption and the first preset control power consumption includes: if the GPU is in the first power control state and the number of consecutive times the GPU's power consumption is less than the first preset control power consumption has not reached a first preset number, determining that the GPU continues to be in the first power control state, wherein the first preset number is greater than 1; or, if the GPU is in the first power control state, the current power consumption is less than the first preset control power consumption, and the number of consecutive times the GPU's power consumption is less than the first preset control power consumption has reached the first preset number, determining that the GPU exits the first power control state; or, if the GPU is not in the first power control state and the current power consumption is greater than or equal to the first preset control power consumption, determining that the GPU enters the first power control state; or, if the GPU is not in the first power control state and the current power consumption is less than the first preset control power consumption, determining that the GPU is not in the first power control state.

[0186] In another example, determining whether the GPU is in the first power control state based on the current power consumption and the first preset control power consumption includes: in response to the GPU being in the first power control state and the current power consumption of the GPU being greater than or equal to the first preset control power consumption, determining that the GPU continues to be in the first power control state; in response to the GPU being in the first power control state and the current power consumption of the GPU being less than the first preset control power consumption, determining that the GPU exits the first power control state; in response to the GPU not being in the first power control state and the current power consumption being greater than or equal to the first preset control power consumption, determining that the GPU enters the first power control state; and in response to the GPU not being in the first power control state and the current power consumption being less than the first preset control power consumption, determining that the GPU is not in the first power control state.

[0187] As another example of this implementation, the first candidate operating frequency of the GPU can be determined directly based on the current operating frequency and the current scaling factor, without considering whether the GPU is in the first power control state.

[0188] In this embodiment of the disclosure, a Proportional-Integral-Differential (PID) controller can be used to process the average power consumption of the GPU within the first preset time period and the target power consumption to obtain a second candidate operating frequency of the GPU. The second candidate operating frequency can represent a candidate operating frequency of the GPU determined based on the average power consumption of the GPU within the first preset time period and the target power consumption of the GPU.

[0189] In one possible implementation, the parameters of the proportional-integral-derivative (PID) controller can be obtained from flash memory (e.g., NOR Flash). These parameters can then be adjusted according to the specific application scenario.

[0190] In one possible implementation, the step of inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a proportional-integral-derivative (PID) controller, and outputting the second candidate operating frequency of the GPU via the PID controller, includes: in response to the GPU being in a second power control state, inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a PID controller, and outputting the second candidate operating frequency of the GPU via the PID controller.

[0191] In this implementation, the second power control state can represent a state where long-cycle power control is required.

[0192] In this implementation, in response to the GPU being in a second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption are input to a proportional-integral-derivative (PID) controller. The PID controller then outputs the second candidate operating frequency of the GPU. This allows the GPU's power consumption to be reduced by lowering its operating frequency when the GPU is in the second power control state, thereby reducing unnecessary power control and improving the efficiency of power control for the GPU.

[0193] As an example of this implementation, it can be determined whether the GPU is in the second power control state based on the GPU's average power consumption during the first preset time period, the second preset control power consumption, and the second preset exit power consumption, wherein the second preset control power consumption is higher than the second preset exit power consumption. The second preset control power consumption can represent a pre-set power consumption value used to control the GPU to enter the second power control state, and the second preset exit power consumption can represent a pre-set power consumption value used to control the GPU to exit the second power control state.

[0194] In this example, the GPU is determined to be in the second power control state based on the average power consumption of the GPU within the first preset duration, the second preset control power consumption, and the second preset exit power consumption, wherein the second preset control power consumption is higher than the second preset exit power consumption, thereby enabling effective long-cycle power control of the GPU.

[0195] As an example of this implementation, the method further includes: determining that the GPU enters the second power control state in response to the GPU not being in the second power control state and the average power consumption of the GPU within the first preset duration being greater than or equal to the second preset control power consumption; or, determining that the GPU is not in the second power control state in response to the GPU not being in the second power control state and the average power consumption of the GPU within the first preset duration being less than the second preset control power consumption.

[0196] In this example, if the GPU was not in the second power control state before the average power consumption of the GPU was obtained, and the average power consumption of the GPU obtained this time is greater than or equal to the second preset control power consumption, then it can be determined that the GPU has entered the second power control state.

[0197] If the GPU was not in the second power control state before the average power consumption of the GPU was obtained this time, and the average power consumption of the GPU obtained this time is less than the second preset control power consumption, then it can be determined that the GPU will not enter the second power control state.

[0198] As an example of this implementation, the method further includes: in response to the GPU being in the second power control state and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption not reaching the second preset number, determining that the GPU continues to be in the second power control state, wherein the second preset number is greater than 1; or, in response to the GPU being in the second power control state, the average power consumption of the GPU within the first preset duration is less than the second preset exit power consumption, and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption reaches the second preset number, determining that the GPU exits the second power control state.

[0199] In this example, if the GPU was in the second power control state before the average power consumption of the GPU was obtained this time, and the average power consumption of the GPU obtained this time is greater than or equal to the second preset exit power consumption, then it can be determined that the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption is 0, and the second preset number has not been reached. Therefore, it can be determined that the GPU continues to be in the second power control state.

[0200] If the GPU was in the second power control state before obtaining the average power consumption, and the obtained average power consumption is less than the second preset exit power consumption, then it can be further determined whether the number of consecutive times the average power consumption is less than the second preset exit power consumption has reached the second preset number. If the number of consecutive times the average power consumption is less than the second preset exit power consumption has not reached the second preset number, then it can be determined that the GPU continues to be in the second power control state.

[0201] If the GPU was in the second power control state before obtaining the average power consumption, and the obtained average power consumption is less than the second preset exit power consumption, then it can be further determined whether the number of consecutive times the average power consumption is less than the second preset exit power consumption has reached the second preset number. If the number of consecutive times the average power consumption is less than the second preset exit power consumption has reached the second preset number, then it can be determined that the GPU has exited the second power control state.

[0202] In this example, by setting a second preset number of delays to exit the second power control state, the average power consumption of the GPU can be stably controlled at the target power consumption, which can be compatible with more power consumption scenarios and effectively reduce performance loss in power control.

[0203] In another example, determining whether the GPU is in the second power control state based on the average power consumption, the second preset control power consumption, and the second preset exit power consumption includes: in response to the GPU being in the second power control state and the average power consumption of the GPU within a first preset duration being less than the second preset exit power consumption, determining that the GPU exits the second power control state; or, in response to the GPU being in the second power control state and the average power consumption of the GPU within a first preset duration being greater than or equal to the second preset exit power consumption, determining that the GPU continues to be in the second power control state; or, in response to the GPU not being in the second power control state and the average power consumption of the GPU within a first preset duration being greater than or equal to the second preset control power consumption, determining that the GPU enters the second power control state; or, in response to the GPU not being in the second power control state and the average power consumption of the GPU within a first preset duration being less than the second preset control power consumption, determining that the GPU is not in the second power control state.

[0204] As another example of this implementation, it can be determined whether the GPU is in the second power control state based on the average power consumption of the GPU within a first preset time period and the second preset control power consumption.

[0205] In one example, in response to the GPU being in the second power control state and the GPU's average power consumption being less than the second preset control power consumption for fewer than a second preset number of consecutive times, it is determined that the GPU continues to be in the second power control state, wherein the second preset number of consecutive times is greater than 1; or, in response to the GPU being in the second power control state, the GPU's average power consumption within a first preset duration is less than the second preset control power consumption, and the GPU's average power consumption being less than the second preset control power consumption for more than a second preset number of consecutive times, it is determined that the GPU exits the second power control state; or, in response to the GPU not being in the second power control state, and the GPU's average power consumption within a first preset duration is greater than or equal to the second preset control power consumption, it is determined that the GPU enters the second power control state; or, in response to the GPU not being in the second power control state, and the GPU's average power consumption within a first preset duration is less than the second preset control power consumption, it is determined that the GPU is not in the second power control state.

[0206] In another example, in response to the GPU being in the second power control state and the average power consumption of the GPU within a first preset duration being greater than or equal to the second preset control power consumption, it is determined that the GPU continues to be in the second power control state; in response to the GPU being in the second power control state and the average power consumption of the GPU within a first preset duration being less than the second preset control power consumption, it is determined that the GPU exits the second power control state; in response to the GPU not being in the second power control state and the average power consumption of the GPU within a first preset duration being greater than or equal to the second preset control power consumption, it is determined that the GPU enters the second power control state; in response to the GPU not being in the second power control state and the average power consumption of the GPU within a first preset duration being less than the second preset control power consumption, it is determined that the GPU is not in the second power control state.

[0207] As another example of this implementation, regardless of whether the GPU is in the second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption can be directly input into the proportional-integral-derivative controller, and the second candidate operating frequency of the GPU can be output through the proportional-integral-derivative controller.

[0208] In one possible implementation, the first preset control power consumption is greater than the second preset control power consumption, and the first preset exit power consumption is greater than the second preset exit power consumption.

[0209] As an example of this implementation, the first preset exit power consumption is greater than the second preset control power consumption, that is, the first preset control power consumption > the first preset exit power consumption > the second preset exit power consumption > the second preset exit power consumption.

[0210] By adopting this implementation method, it is possible to allow the GPU to have high power consumption in short cycles and control the GPU to have more stable power consumption in long cycles, thereby improving the performance and security of the GPU.

[0211] In this embodiment of the disclosure, the target operating frequency of the GPU can be determined based on a first candidate operating frequency and a second candidate operating frequency. Alternatively, either the first candidate operating frequency or the second candidate operating frequency can be determined as the target operating frequency of the GPU, or a preset calculation (e.g., averaging) can be performed on the first candidate operating frequency and the second candidate operating frequency to obtain the target operating frequency of the GPU.

[0212] In one possible implementation, determining the target operating frequency of the GPU based on the first candidate operating frequency and the second candidate operating frequency includes: determining the smaller value between the first candidate operating frequency and the second candidate operating frequency as the target operating frequency of the GPU.

[0213] In this implementation, the smaller value between the first candidate operating frequency and the second candidate operating frequency is determined as the target operating frequency of the GPU, thereby improving the security of the GPU and the stability of the GPU's operating frequency.

[0214] In this embodiment of the disclosure, after determining the target operating frequency of the GPU, the operating frequency of the GPU can be set to the target operating frequency through the frequency control module.

[0215] In one possible implementation, the method further includes: shutting down the external power supply to the GPU in response to the GPU's temperature being greater than or equal to a preset maximum operating temperature.

[0216] In this implementation, the preset maximum operating temperature can be obtained by testing the temperature threshold when the GPU is shut down.

[0217] In this implementation, the external power supply to the GPU is turned off in response to the GPU's temperature being greater than or equal to a preset maximum operating temperature, thereby controlling the graphics card to shut down and improving the GPU's security.

[0218] As an example of this implementation, the method further includes: illuminating a preset LED (Light Emitting Diode) in response to the GPU's temperature being greater than or equal to a preset maximum operating temperature.

[0219] In this example, a preset LED is lit in response to the GPU's temperature being greater than or equal to a preset maximum operating temperature, serving as an indication that the GPU is shutting down due to overheating, thereby promptly alerting the user.

[0220] The following describes the power consumption control method for GPUs provided in this disclosure through a specific application scenario.

[0221] In this application scenario, the GPU's sampled power consumption within 10ms can be obtained, and this sampled power consumption within 10ms can be filtered to obtain the GPU's current power consumption. Five power consumption values ​​of the GPU within 50ms can be obtained, and the average of these five power consumption values ​​can be calculated to obtain the GPU's average power consumption within 50ms.

[0222] The system can acquire a first preset control power consumption and a first preset exit power consumption, and determine whether the GPU is in the first power consumption control state based on the current power consumption, the first preset control power consumption, and the first preset exit power consumption, wherein the first preset control power consumption is higher than the first preset exit power consumption. Specifically, if the GPU is in the first power consumption control state and the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption has not reached a first preset number, it can be determined that the GPU continues to be in the first power consumption control state, wherein the first preset number is greater than 1; if the GPU is in the first power consumption control state, the current power consumption is less than the first preset exit power consumption, and the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption has reached a first preset number, it can be determined that the GPU exits the first power consumption control state; if the GPU is not in the first power consumption control state and the current power consumption is greater than or equal to the first preset control power consumption, it can be determined that the GPU enters the first power consumption control state; if the GPU is not in the first power consumption control state and the current power consumption is less than the first preset control power consumption, it can be determined that the GPU is not in the first power consumption control state.

[0223] The system can acquire a second preset control power consumption and a second preset exit power consumption, and determine whether the GPU is in the second power consumption control state based on the GPU's average power consumption within the first preset duration, the second preset control power consumption, and the second preset exit power consumption, wherein the second preset control power consumption is higher than the second preset exit power consumption. Specifically, the system can determine that the GPU enters the second power consumption control state if the GPU is not in the second power consumption control state and the GPU's average power consumption within the first preset duration is greater than or equal to the second preset control power consumption; it can determine that the GPU is not in the second power consumption control state if the GPU is not in the second power consumption control state and the GPU's average power consumption within the first preset duration is less than the second preset control power consumption; it can determine that the GPU continues to be in the second power consumption control state if the GPU is in the second power consumption control state and the number of consecutive times the GPU's average power consumption is less than the second preset exit power consumption has not reached a second preset number, wherein the second preset number is greater than 1; and it can determine that the GPU exits the second power consumption control state if the GPU is in the second power consumption control state, the GPU's average power consumption within the first preset duration is less than the second preset exit power consumption, and the number of consecutive times the GPU's average power consumption is less than the second preset exit power consumption has reached a second preset number.

[0224] Among them, the first preset control power consumption > the first preset exit power consumption > the second preset exit power consumption > the second preset exit power consumption.

[0225] In response to the GPU being in the first power control state, the target power consumption, static power consumption, and current operating frequency of the GPU can be obtained, and a current scaling factor can be determined based on the current power consumption, the target power consumption, and the static power consumption. For example, it can be determined based on a = (P set -P static ) / (P current -P static ), determine the current proportionality coefficient a. Where P set P represents the target power consumption. static P represents static power consumption. current This indicates the current power consumption. The product of the current operating frequency and the current scaling factor can be used to determine the first candidate operating frequency.

[0226] In response to the GPU being in a second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption can be input into a proportional-integral-derivative controller, and the second candidate operating frequency of the GPU can be output through the proportional-integral-derivative controller.

[0227] The smaller value between the first candidate operating frequency and the second candidate operating frequency can be determined as the target operating frequency of the GPU. The GPU's operating frequency can then be set to the target operating frequency via the frequency control module.

[0228] Figure 3 This diagram illustrates the operating frequency of a GPU after power consumption control is performed using the power consumption control method for GPUs provided in this embodiment of the present disclosure. Figure 3 In the graph, the horizontal axis represents time, and the vertical axis represents operating frequency. Figure 1 and Figure 3 As can be seen, compared with related technologies, the power consumption control method for GPUs provided in this disclosure can improve the stability of the GPU's operating frequency, thereby making the GPU's performance more stable.

[0229] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0230] In addition, this disclosure also provides a power control device, electronic device, computer-readable storage medium, and computer program product for GPUs. All of the above can be used to implement any of the power control methods for GPUs provided in this disclosure. The corresponding technical solutions and effects can be found in the relevant descriptions in the method section, and will not be repeated here.

[0231] Figure 4 A block diagram of a power control device for a GPU provided in an embodiment of this disclosure is shown. Figure 4 As shown, the power consumption control device for the GPU includes:

[0232] The first acquisition module 41 is used to acquire the current power consumption of the GPU and the average power consumption of the GPU within a first preset time period.

[0233] Acquisition module 42 is used to acquire the target power consumption of the GPU;

[0234] The first determining module 43 is used to determine the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption;

[0235] The second obtaining module 44 is used to input the average power consumption of the GPU within the first preset time period and the target power consumption into the proportional-integral-derivative controller, and output the second candidate operating frequency of the GPU through the proportional-integral-derivative controller;

[0236] The second determining module 45 is used to determine the target operating frequency of the GPU based on the first candidate operating frequency and the second candidate operating frequency.

[0237] In one possible implementation, the target power consumption includes a first target power consumption and a second target power consumption, wherein the first target power consumption is higher than the second target power consumption;

[0238] The first determining module 43 is configured to: determine the first candidate operating frequency of the GPU based on the current power consumption and the first target power consumption;

[0239] The second obtaining module 44 is used to: input the average power consumption of the GPU within the first preset time period and the second target power consumption into the proportional-integral-derivative controller, and output the second candidate operating frequency of the GPU via the proportional-integral-derivative controller.

[0240] In one possible implementation, the first determining module 43 is used to:

[0241] Obtain the static power consumption and current operating frequency of the GPU;

[0242] The current scaling factor is determined based on the current power consumption, the target power consumption, and the static power consumption.

[0243] The first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

[0244] In one possible implementation, the first obtaining module 41 is used to:

[0245] The average power consumption of the GPU within the first preset time period is obtained by averaging the power consumption values ​​of the GPU within the first preset time period.

[0246] In one possible implementation, the first obtaining module 41 is used to:

[0247] In response to the first preset duration being less than or equal to a duration threshold, the average power consumption values ​​of the GPU obtained within the first preset duration are averaged to obtain the average power consumption of the GPU within the first preset duration.

[0248] In one possible implementation, the first obtaining module 41 is used to:

[0249] Obtain the average power consumption of the GPU at the previous time step;

[0250] The average power consumption of the GPU within the first preset time period is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0251] In one possible implementation, the first obtaining module 41 is used to:

[0252] In response to the first preset duration being greater than the duration threshold, the average power consumption of the GPU within the first preset duration is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

[0253] In one possible implementation, the first obtaining module 41 is used to:

[0254] The sampling power consumption of the GPU during a second preset time period is obtained, wherein the second preset time period is less than the first preset time period;

[0255] The sampled power consumption within the second preset time period is filtered to obtain the current power consumption of the GPU.

[0256] In one possible implementation, the second determining module 45 is used to:

[0257] The smaller value between the first candidate operating frequency and the second candidate operating frequency is determined as the target operating frequency of the GPU.

[0258] In one possible implementation, the first determining module 43 is used to:

[0259] In response to the GPU being in a first power control state, a first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

[0260] In one possible implementation, the device further includes:

[0261] The third determining module is used to determine that the GPU enters the first power control state in response to the fact that the GPU is not in the first power control state and the current power consumption is greater than or equal to the first preset control power consumption.

[0262] or,

[0263] The fourth determining module is configured to determine that the GPU is not in the first power control state in response to the GPU not being in the first power control state and the current power consumption being less than the first preset control power consumption.

[0264] In one possible implementation, the device further includes:

[0265] The fifth determining module is configured to determine that the GPU continues to be in the first power control state in response to the fact that the number of consecutive times the power consumption of the GPU is less than the first preset exit power consumption has not reached the first preset number, wherein the first preset number is greater than 1.

[0266] or,

[0267] The sixth determining module is used to determine that the GPU exits the first power control state in response to the GPU being in the first power control state, the current power consumption being less than the first preset exit power consumption, and the number of consecutive times the power consumption of the GPU is less than the first preset exit power consumption reaching the first preset number.

[0268] In one possible implementation, the second obtaining module 44 is used for:

[0269] In response to the GPU being in a second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption are input into a proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller.

[0270] In one possible implementation, the device further includes:

[0271] The seventh determining module is used to determine that the GPU enters the second power control state in response to the fact that the GPU is not in the second power control state and the average power consumption of the GPU in the first preset time period is greater than or equal to the second preset control power consumption.

[0272] or,

[0273] The eighth determining module is used to determine that the GPU is not in the second power control state in response to the GPU not being in the second power control state and the average power consumption of the GPU within the first preset time period being less than the second preset control power consumption.

[0274] In one possible implementation, the device further includes:

[0275] The ninth determining module is configured to determine that the GPU continues to be in the second power control state in response to the fact that the GPU is in the second power control state and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption has not reached the second preset number, wherein the second preset number is greater than 1;

[0276] or,

[0277] The tenth determining module is used to determine that the GPU exits the second power control state in response to the GPU being in the second power control state, the average power consumption of the GPU within the first preset time period being less than the second preset exit power consumption, and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption reaching the second preset number.

[0278] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation and technical effects can be referred to the description of the above method embodiments. For the sake of brevity, they will not be repeated here.

[0279] This disclosure also provides a computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the above-described method. The computer-readable storage medium may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.

[0280] This disclosure also proposes a computer program including computer-readable code, wherein when the computer-readable code is run in an electronic device, a processor in the electronic device executes the above-described method.

[0281] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in an electronic device, the processor in the electronic device executes the above-described method.

[0282] This disclosure also provides an electronic device, including: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to invoke the executable instructions stored in the memory to perform the above-described method.

[0283] Electronic devices can be provided as terminals, servers, or other forms of devices.

[0284] Figure 5 A block diagram of an electronic device 1900 provided in an embodiment of this disclosure is shown. For example, the electronic device 1900 may be provided as a server. (Refer to...) Figure 5 The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and memory resources represented by memory 1932 for storing instructions, such as application programs, that can be executed by the processing component 1922. The application programs stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 1922 is configured to execute instructions to perform the methods described above.

[0285] Electronic device 1900 may also include a power supply component 1926 configured to perform power management of electronic device 1900, a wired or wireless network interface 1950 configured to connect electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). Electronic device 1900 can operate on an operating system stored in memory 1932, such as Microsoft Server operating system (Windows Server). TM Apple's graphical user interface-based operating system (MacOS X) TM ), a multi-user, multi-process computer operating system (Unix) TM Linux is a free and open-source Unix-like operating system. TM ), the open-source Unix-like operating system (FreeBSD) TM (or similar.)

[0286] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by a processing component 1922 of an electronic device 1900 to perform the above-described method.

[0287] This disclosure can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of this disclosure.

[0288] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.

[0289] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0290] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0291] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0292] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0293] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0294] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0295] The computer program product can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0296] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0297] If the technical solution of this disclosure involves personal information, the product applying the technical solution of this disclosure has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this disclosure involves sensitive personal information, the product applying the technical solution of this disclosure has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to indicate that the user has entered the scope of personal information collection and that personal information will be collected. If the user voluntarily enters the collection scope, it is deemed to have consented to the collection of their personal information; or on the personal information processing device, with clear signs / information informing the user of the personal information processing rules, authorization is obtained from the user through pop-up information or by asking the user to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

[0298] The various embodiments of this disclosure have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.

Claims

1. A power consumption control method for GPUs, characterized in that, include: Obtain the current power consumption of the GPU and the average power consumption of the GPU over a first preset time period; Obtain the target power consumption of the GPU; Based on the current power consumption and the target power consumption, the first candidate operating frequency of the GPU is determined; The average power consumption of the GPU within the first preset time period and the target power consumption are input into the proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller; The target operating frequency of the GPU is determined based on the first candidate operating frequency and the second candidate operating frequency.

2. The method according to claim 1, characterized in that, The target power consumption includes a first target power consumption and a second target power consumption, and the first target power consumption is higher than the second target power consumption; Determining the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption includes: determining the first candidate operating frequency of the GPU based on the current power consumption and the first target power consumption; The step of inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a proportional-integral-derivative (PID) controller, and outputting the second candidate operating frequency of the GPU through the PID controller, includes: inputting the average power consumption of the GPU within the first preset time period and the second target power consumption into a PID controller, and outputting the second candidate operating frequency of the GPU through the PID controller.

3. The method according to claim 1 or 2, characterized in that, The step of determining the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption includes: Obtain the static power consumption and current operating frequency of the GPU; The current scaling factor is determined based on the current power consumption, the target power consumption, and the static power consumption. The first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

4. The method according to claim 1 or 2, characterized in that, Obtain the average power consumption of the GPU over a first preset time period, including: The average power consumption of the GPU within the first preset time period is obtained by averaging the power consumption values ​​of the GPU within the first preset time period.

5. The method according to claim 4, characterized in that, The step of averaging the power consumption values ​​of the GPU obtained within the first preset time period to obtain the average power consumption of the GPU within the first preset time period includes: In response to the first preset duration being less than or equal to a duration threshold, the average power consumption values ​​of the GPU obtained within the first preset duration are averaged to obtain the average power consumption of the GPU within the first preset duration.

6. The method according to claim 1 or 2, characterized in that, Obtain the average power consumption of the GPU over a first preset time period, including: Obtain the average power consumption of the GPU at the previous time step; The average power consumption of the GPU within the first preset time period is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

7. The method according to claim 6, characterized in that, Determining the average power consumption of the GPU within the first preset time period based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU includes: In response to the first preset duration being greater than the duration threshold, the average power consumption of the GPU within the first preset duration is determined based on the average power consumption of the GPU at the previous moment and the current power consumption of the GPU.

8. The method according to claim 1 or 2, characterized in that, Obtaining the current power consumption of the GPU includes: The sampling power consumption of the GPU during a second preset time period is obtained, wherein the second preset time period is less than the first preset time period; The sampled power consumption within the second preset time period is filtered to obtain the current power consumption of the GPU.

9. The method according to claim 1 or 2, characterized in that, Determining the target operating frequency of the GPU based on the first candidate operating frequency and the second candidate operating frequency includes: The smaller value between the first candidate operating frequency and the second candidate operating frequency is determined as the target operating frequency of the GPU.

10. The method according to claim 3, characterized in that, Determining the first candidate operating frequency of the GPU based on the current operating frequency and the current scaling factor includes: In response to the GPU being in a first power control state, a first candidate operating frequency of the GPU is determined based on the current operating frequency and the current scaling factor.

11. The method according to claim 10, characterized in that, The method further includes: In response to the fact that the GPU is not in the first power control state and the current power consumption is greater than or equal to the first preset control power consumption, it is determined that the GPU enters the first power control state. or, In response to the fact that the GPU is not in the first power control state and the current power consumption is less than the first preset control power consumption, it is determined that the GPU is not in the first power control state.

12. The method according to claim 10, characterized in that, The method further includes: In response to the GPU being in the first power control state and the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption not reaching the first preset number, it is determined that the GPU will continue to be in the first power control state, wherein the first preset number is greater than 1; or, In response to the GPU being in the first power control state, the current power consumption being less than the first preset exit power consumption, and the number of consecutive times the GPU's power consumption is less than the first preset exit power consumption reaching the first preset number, it is determined that the GPU exits the first power control state.

13. The method according to claim 1 or 2, characterized in that, The step of inputting the average power consumption of the GPU within the first preset time period and the target power consumption into a proportional-integral-derivative (PID) controller, and outputting the second candidate operating frequency of the GPU via the PID controller, includes: In response to the GPU being in a second power control state, the average power consumption of the GPU within the first preset time period and the target power consumption are input into a proportional-integral-derivative controller, and the second candidate operating frequency of the GPU is output through the proportional-integral-derivative controller.

14. The method according to claim 13, characterized in that, The method further includes: In response to the fact that the GPU is not in the second power control state and the average power consumption of the GPU within the first preset time period is greater than or equal to the second preset control power consumption, it is determined that the GPU enters the second power control state. or, In response to the fact that the GPU is not in the second power control state and the average power consumption of the GPU within the first preset time period is less than the second preset control power consumption, it is determined that the GPU is not in the second power control state.

15. The method according to claim 13, characterized in that, The method further includes: In response to the GPU being in the second power control state and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption not reaching the second preset number, it is determined that the GPU continues to be in the second power control state, wherein the second preset number is greater than 1; or, In response to the GPU being in the second power control state, the average power consumption of the GPU within the first preset time period is less than the second preset exit power consumption, and the number of consecutive times the average power consumption of the GPU is less than the second preset exit power consumption reaches the second preset number, it is determined that the GPU exits the second power control state.

16. A power consumption control device for a GPU, characterized in that, include: The first acquisition module is used to acquire the current power consumption of the GPU and the average power consumption of the GPU within a first preset time period. The acquisition module is used to acquire the target power consumption of the GPU; The first determining module is used to determine the first candidate operating frequency of the GPU based on the current power consumption and the target power consumption; The second acquisition module is used to input the average power consumption of the GPU within the first preset time period and the target power consumption into the proportional-integral-derivative controller, and output the second candidate operating frequency of the GPU through the proportional-integral-derivative controller; The second determining module is used to determine the target operating frequency of the GPU based on the first candidate operating frequency and the second candidate operating frequency.

17. An electronic device, characterized in that, include: One or more processors; Memory used to store executable instructions; The one or more processors are configured to invoke executable instructions stored in the memory to perform the method according to any one of claims 1 to 15.

18. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 15.

Citation Information

Patent Citations

  • Apparatus for high efficient real-time platform power management architecture

    CN102473146A

  • Power management for a graphics processing unit or other circuit

    US10114446B1