A power consumption simulation method, device, storage medium and electronic equipment
By optimizing GPU power consumption simulation through a dynamic simulation client and adjusting control parameters using particle swarm optimization algorithms, the stability of GPU power consumption in different scenarios was solved, achieving reasonable control and efficient management of power consumption.
Patent Information
- Application Number
- CN202311177616.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-12
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-09-12
AI Technical Summary
Existing technologies cannot guarantee that GPU power consumption remains within a reasonable range under different scenarios, and fail to effectively consider the impact of operating frequency and voltage on actual power consumption.
The power consumption of the chip is dynamically simulated by a simulation client to obtain the target power consumption, determine the initial control parameters, adjust the operating frequency and voltage to obtain the target control parameters, optimize the power consumption simulation process, and use optimization algorithms such as particle swarm optimization to iteratively adjust the control parameters.
It achieves stable control of GPU power consumption in different scenarios, ensuring that power consumption is always within a reasonable range, saving manual adjustment time and improving the efficiency and accuracy of chip performance analysis.
Smart Images

Figure CN117113892B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, storage medium and electronic device for power consumption simulation. Background Technology
[0002] With the development of science and technology, chip technology continues to evolve. Among them, the Graphics Processing Unit (GPU), as a chip that processes graphics and image data, is widely used in a variety of scenarios.
[0003] Generally, GPU power consumption simulation is pre-silicon simulation. When the GPU is actually running, the actual power consumption of the GPU can be determined based on the data from the pre-silicon simulation.
[0004] However, the actual power consumption of a GPU is related to its operating frequency and voltage during actual operation. In the process of determining the actual power consumption of a GPU using data from pre-silicon simulation, the impact of the GPU's operating frequency and voltage on the actual power consumption under different scenarios is not considered. Therefore, it is difficult to ensure that the GPU's power consumption remains within a reasonable range under different scenarios.
[0005] Based on this, this application specification provides a method for power consumption simulation. Summary of the Invention
[0006] This specification provides a method, apparatus, storage medium, and electronic device for power consumption simulation, to at least partially solve the aforementioned problems existing in the prior art.
[0007] The following technical solution is adopted in this specification:
[0008] This specification provides a method for power consumption simulation, the method comprising:
[0009] In response to power consumption simulation commands, the target power consumption of the chip is obtained;
[0010] Based on the target power consumption, determine the initial control parameters of the chip;
[0011] The operating frequency of the chip is simulated based on the initial control parameters to obtain the simulated operating frequency of the chip under the initial control parameters.
[0012] The simulated power consumption of the chip is obtained based on the simulated operating frequency.
[0013] Based on the simulated power consumption and the target power consumption, the initial control parameters are adjusted to obtain the target control parameters;
[0014] Based on the target control parameters, the target operating frequency of the chip is determined, and the power consumption simulation results of the chip at the target operating frequency are determined.
[0015] Optionally, the initial control parameters are in multiple sets, each set including one or more control parameters;
[0016] The operating frequency of the chip is simulated based on the initial control parameters to obtain the simulated operating frequency of the chip under the initial control parameters, specifically including:
[0017] The operating frequency of the chip is simulated based on each set of initial control parameters to obtain the simulated operating frequency of the chip under each set of initial control parameters.
[0018] Based on the simulated operating frequency, the simulated power consumption of the chip is obtained, specifically including:
[0019] Based on the obtained simulation operating frequencies, the simulated power consumption of the chip is obtained.
[0020] Optionally, when the initial control parameters are determined to be a set, the method further includes:
[0021] Based on the initial control parameters, multiple new sets of initial control parameters are generated.
[0022] Optionally, the initial control parameters are adjusted to obtain the target control parameters, specifically including:
[0023] Based on the simulated power consumption and the target power consumption, determine the intermediate group control parameters in each group of initial control parameters;
[0024] Based on the intermediate group control parameters, adjust the other initial control parameters in each group of initial control parameters;
[0025] The adjusted initial control parameters of other groups and the intermediate group control parameters are used as the new initial control parameters for each group, and the intermediate group control parameters are redefined until the preset conditions are met.
[0026] The final determined intermediate group control parameters are used as the target control parameters.
[0027] Optionally, determining the intermediate group of control parameters in each group of initial control parameters specifically includes:
[0028] The evaluation values of the simulated power consumption of the chip under each set of initial control parameters are determined respectively;
[0029] Based on the evaluation values, intermediate group control parameters are determined from the initial control parameters of each group.
[0030] Optionally, adjusting other groups of initial control parameters in each group of initial control parameters specifically includes:
[0031] Based on the number of times the intermediate group control parameters have been determined, determine the adjustment weights;
[0032] The current adjustment step size is determined based on the adjustment weights and the adjustment step size of the previous adjustment of the initial control parameters of other groups.
[0033] Based on the current adjustment step size, adjust the initial control parameters of the other groups.
[0034] Optionally, the current adjustment step size is determined based on the adjustment weights and the adjustment step size of the previous adjustment of the initial control parameters of other groups, specifically including:
[0035] Determine the first difference between the current control parameters of each other group and the current control parameters of the intermediate group;
[0036] Determine the optimal group control parameters from the intermediate group control parameters obtained each time;
[0037] Determine the second difference between the current control parameters of each other group and the control parameters of the optimized group;
[0038] The current adjustment step size is determined based on the first difference, the second difference, the adjustment weight, and the adjustment step size of the previous adjustment of the initial control parameters of other groups.
[0039] Optionally, determining the power consumption simulation results of the chip at the target operating frequency specifically includes:
[0040] Determine the target voltage based on the target operating frequency;
[0041] Based on the target operating frequency and the target voltage, determine the power consumption simulation results of the chip at the target operating frequency.
[0042] This specification provides a power consumption simulation apparatus, including:
[0043] The simulation response module is used to respond to power consumption simulation commands and obtain the target power consumption of the chip.
[0044] The first determining module is used to determine the initial control parameters of the chip based on the target power consumption;
[0045] The frequency simulation module is used to simulate the operating frequency of the chip according to the initial control parameters, and obtain the simulated operating frequency of the chip under the initial control parameters.
[0046] The power consumption simulation module is used to obtain the simulated power consumption of the chip based on the simulated operating frequency.
[0047] The parameter optimization module is used to adjust the initial control parameters according to the simulated power consumption and the target power consumption to obtain the target control parameters;
[0048] The result determination module is used to determine the target operating frequency of the chip based on the target control parameters, and to determine the power consumption simulation results of the chip at the target operating frequency.
[0049] Optionally, the initial control parameters are in multiple sets, each set including one or more control parameters;
[0050] The frequency simulation module is specifically used to simulate the operating frequency of the chip according to each set of initial control parameters, and obtain the simulated operating frequency of the chip under each set of initial control parameters.
[0051] The power consumption simulation module is specifically used to obtain the simulated power consumption of the chip based on the obtained simulated operating frequencies.
[0052] Optionally, the frequency simulation module is further configured to generate multiple new sets of initial control parameters based on the initial control parameters when the initial control parameters are determined to be a set.
[0053] Optionally, the parameter optimization module is specifically used to: determine the intermediate group control parameters in each group of initial control parameters based on the simulated power consumption and the target power consumption; adjust the other groups of initial control parameters in each group of initial control parameters based on the intermediate group control parameters; use the adjusted other groups of initial control parameters and the intermediate group control parameters as new initial control parameters for each group, and redetermine the intermediate group control parameters until the preset conditions are met; and use the finally determined intermediate group control parameters as the target control parameters.
[0054] Optionally, the parameter optimization module is specifically used to determine the evaluation value of the simulated power consumption of the chip under each set of initial control parameters; and to determine the intermediate group control parameters from each set of initial control parameters based on the evaluation value.
[0055] Optionally, the parameter optimization module is specifically used to: determine the adjustment weight based on the number of times the intermediate group control parameters have been determined; determine the current adjustment step size based on the adjustment weight and the adjustment step size of the previous adjustment of the initial control parameters of other groups; and adjust the current initial control parameters of other groups based on the current adjustment step size.
[0056] Optionally, the parameter optimization module is specifically used to: determine the first difference between the current control parameters of each other group and the current control parameters of the intermediate group; determine the optimized group control parameters from the intermediate group control parameters obtained each time; determine the second difference between the current control parameters of each other group and the optimized group control parameters; and determine the current adjustment step size based on the first difference, the second difference, the adjustment weight, and the adjustment step size of the previous adjustment of the initial control parameters of other groups.
[0057] Optionally, the result determination module is specifically used to: determine the target voltage based on the target operating frequency; and determine the power consumption simulation result of the chip at the target operating frequency based on the target operating frequency and the target voltage.
[0058] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method for power consumption simulation.
[0059] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-described method for power consumption simulation.
[0060] The above-mentioned technical solutions adopted in this specification can achieve the following beneficial effects:
[0061] As can be seen from the power consumption simulation method provided in this specification, by simulating the chip's power consumption, the target control parameters and target operating frequency under the target power consumption can be determined. The target control parameters can be applied to scenarios consistent with the target power consumption, and a wide range of target control parameters can be determined under different target power consumptions, ensuring that the chip's power consumption is always maintained within a reasonable range. Furthermore, unlike other methods that do not consider the impact of actual chip power consumption during operation (such as pre-silicon simulation), this method dynamically simulates the chip's actual power consumption based on the target power consumption to determine the target control parameters. That is, based on the simulated power consumption obtained from simulating the chip, the target control parameters are dynamically determined, so that the chip's actual power consumption under the determined target control parameters can stabilize to the expected target power consumption. Attached Figure Description
[0062] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and their descriptions, serving to explain this specification and do not constitute an undue limitation thereof.
[0063] In the picture:
[0064] Figure 1This is a flowchart illustrating a power consumption simulation method described in this specification.
[0065] Figure 2 This is a schematic diagram of the operation of the simulation client provided in this manual;
[0066] Figure 3 This is a power consumption simulation diagram provided in this manual;
[0067] Figure 4 This is a flowchart illustrating the particle swarm optimization algorithm provided in this manual.
[0068] Figure 5 A schematic diagram of a power consumption simulation device provided in this specification;
[0069] Figure 6 The corresponding information provided in this specification Figure 1 A schematic diagram of an electronic device. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0071] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0072] Figure 1 This is a flowchart illustrating a power consumption simulation method provided in this specification, which may specifically include the following steps:
[0073] S100: Responds to power consumption simulation commands to obtain the target power consumption of the chip.
[0074] Since the power consumption of a chip is related to its operating frequency and voltage during actual operation, this specification provides a power consumption simulation method. This method can dynamically simulate the actual power consumption of the chip during its actual operation to obtain better control parameters, i.e., target control parameters, thereby ensuring that the power consumption of the chip remains within a reasonable range under different scenarios.
[0075] The execution subject of the technical solution in this specification can be any computing device with computing capabilities, such as a server or terminal. The chip can be a GPU, MCU, etc. For ease of description, this specification uses a simulation client as the execution subject and a GPU as the chip.
[0076] Generally, the power consumption of a GPU can be calculated using the formula... Calculate, where, For the dynamic power consumption of the GPU, C eff This can be approximated as the chip's reversal rate, and is also equivalent to the current GPU utilization rate, V. dd f is the current operating voltage of the GPU. clock V is the current operating frequency of the GPU. dd ×I peak For the static power consumption of the GPU, I peak This is the leakage current.
[0077] Typically, in a given scenario, or when the GPU utilization is determined (i.e., the target power consumption P of the GPU is given), and in a given scenario, C... eff with I peak It is also known, and V dd with f clock There is a certain relationship; in other words, it can be determined based on f. clock Determine V dd Then, it can be done by adjusting f. clock Controlling the actual power consumption of the GPU in a given scenario. In one or more embodiments of this specification, the control parameter is the control of f. clock The parameters to be adjusted, the target control parameters are those that enable the actual power consumption of the GPU to stabilize at the target power consumption in accordance with expectations. In this case, meeting expectations can mean meeting expectations in terms of time, that is, the target control parameters can enable the GPU to stabilize at the target power consumption faster, or it can mean meeting expectations in terms of power consumption change, that is, the difference between the actual power consumption of the GPU and the target power consumption before stabilizing at the target power consumption meets expectations, etc. This manual does not impose any specific restrictions.
[0078] In one or more embodiments of this specification, in order to determine the target control parameters of the chip under different scenarios, the power consumption of the GPU can be simulated. The simulation client can then respond to the simulation command and first obtain the target power consumption of the GPU.
[0079] It should be noted that the simulation client should have the capability to simulate GPU power consumption in real time. In one or more embodiments of this specification, in order to achieve dynamic simulation of GPU power consumption on the simulation client, the code running inside the GPU can be pre-compiled into a dynamic library, and the dynamic library can be called. The simulation client can then dynamically modify the GPU utilization, i.e., simulate different scenarios to simulate GPU power consumption in real time, thereby determining the expected control parameters for the GPU at that utilization level (i.e., in that scenario), and determining the GPU's operating frequency under those expected control parameters. Of course, other methods can also be used to implement the simulation client's simulation of GPU power consumption; this specification does not impose specific limitations on this.
[0080] like Figure 2 The diagram shown is a schematic representation of the operation of the simulation client provided in this application specification. Figure 2 As can be seen, the GPU power consumption model in this simulation client can run based on initial control parameters and can dynamically simulate GPU power consumption. In other words, it can obtain GPU operating parameters in real time and call GPU code dynamic libraries, thereby adjusting the initial control parameters based on optimization algorithms. The adjusted control parameters are then fed to the GPU power consumption model, allowing the power consumption model to obtain GPU operating parameters again under the adjusted initial control parameters. This enables continuous iterative optimization of the control parameters, ultimately yielding the optimal control parameters.
[0081] Furthermore, in one or more embodiments of this specification, the System Management Control (SMC) in the simulation client can save the power consumption information of the GPU within a preset time period, so that when performing power consumption simulation on the GPU, the saved power consumption information of the GPU within the preset time period can be referenced to provide support for the current GPU power consumption simulation based on historical power consumption simulation information.
[0082] It should be noted that, in one or more embodiments of this specification, the effect of temperature on the power consumption of the GPU is not considered.
[0083] S102: Determine the initial control parameters of the chip based on the target power consumption.
[0084] In one or more embodiments of this specification, after obtaining the target power consumption, the simulation client can determine the initial control parameters of the chip. These initial control parameters are a rough control parameter that stabilizes the actual power consumption of the GPU to the target power consumption. In other words, the effect of using the initial control parameters to control the power consumption of the GPU is worse than that of using the ideal control parameters, i.e., the target control parameters.
[0085] S104: Simulate the operating frequency of the chip according to the initial control parameters to obtain the simulated operating frequency of the chip under the initial control parameters.
[0086] S106: Based on the simulated operating frequency, obtain the simulated power consumption of the chip.
[0087] Since the control parameters indirectly adjust the chip's simulated power consumption by adjusting the GPU's operating frequency, the simulation client can simulate the GPU's operating frequency based on the initial control parameters to obtain the GPU's simulated operating frequency under those initial control parameters, and then determine the GPU's simulated power consumption based on the simulated operating frequency.
[0088] In one or more embodiments of this specification, when the initial control parameters are used to simulate the power consumption of the GPU, or when the initial control parameters are used to control the power consumption of the GPU, that is, when the initial control parameters are used to stabilize the power consumption of the GPU to the target power consumption, the change in power consumption is not an instantaneous process. For example, if the target power consumption is 10W, under the control of the initial control parameters, the actual power consumption of the GPU does not jump directly and stabilize to 10W, but fluctuates first and then stabilizes to 10W. In other words, the initial control parameters stabilize the actual power consumption of the GPU to the target power consumption within a certain time period.
[0089] like Figure 3 The diagram shown is a power consumption simulation diagram provided in this manual. It can be seen that under the control parameter X, the power consumption of the GPU stabilizes at 235000 after a period of time.
[0090] Therefore, when evaluating the control effect of the control parameters that stabilize the actual power consumption of the GPU to the target power consumption, there can be multiple evaluation criteria, such as the time it takes for the actual power consumption of the GPU to stabilize to the target power consumption, and the difference between the actual power consumption of the GPU before stabilizing to the target power consumption and the target power consumption, as described in step S100 above. This specification does not impose any specific limitations.
[0091] This is precisely why ideal control parameters, or target control parameters, exist. That is, because stabilizing the GPU's actual power consumption to the target power consumption using initial control parameters is not instantaneous but rather a process of power consumption variation, when using control parameters to stabilize the GPU's actual power consumption to the target power consumption, the time and magnitude of the entire power consumption variation process must be considered. Therefore, there must exist at least one target control parameter that ensures the time and / or the magnitude of power consumption variation during which the GPU's actual power consumption stabilizes to the target power consumption meet expectations.
[0092] It should be noted that the expected control parameters in step S100 and the ideal control parameters in step S102 are both target control parameters. Furthermore, which effect is better when the actual power consumption of the GPU stabilizes to the target power consumption (e.g., shorter time, smaller power fluctuations) depends on specific requirements. That is, under what specific objectives are the target control parameters determined? This specification does not impose specific limitations on this, but the overall effect achieved by the target control parameters in stabilizing the actual power consumption of the GPU to the target power consumption is better than that achieved by the initial control parameters.
[0093] S108: Adjust the initial control parameters according to the simulated power consumption and the target power consumption to obtain the target control parameters.
[0094] Therefore, the simulation client can optimize the initial control parameters based on the simulated power consumption and the target power consumption to obtain the target control parameters.
[0095] It should be noted that many optimization algorithms can be used to optimize the initial control parameters, such as Particle Swarm Optimization (PSO) and Simulated Annealing (SA), etc., and this specification does not impose specific limitations on them. It is understood that, typically, the adjustment of initial control parameters cannot be completed in one step. Therefore, in one implementation, the adjustment of initial control parameters can be divided into multiple rounds, performed iteratively. Specifically, this application does not limit the specific method of adjusting the initial control parameters. For example, in each round of adjustment, a set of initial control parameters can be adjusted. After adjustment, the simulated power consumption can be obtained again using the adjusted initial control parameters, and a new round of adjustment can begin based on the new simulated power consumption and the target power consumption, until certain conditions are met. Then, the adjusted initial control parameters are determined as the target control parameters. Alternatively, to improve adjustment efficiency, when using adjustment algorithms such as PSO, multiple initial control parameters can be adjusted in each round.
[0096] S110: Based on the target control parameters, determine the target operating frequency of the chip, and determine the power consumption simulation results of the chip at the target operating frequency.
[0097] After determining the target control parameters, the simulation client can determine the target operating frequency of the GPU and perform power consumption simulations at that target operating frequency. When determining the power consumption simulation results, the simulation client can determine the target voltage at the target operating frequency, and then determine the power consumption simulation results based on the target voltage and the target operating frequency.
[0098] When determining the target voltage based on the target operating frequency, a frequency-to-voltage converter can be used to obtain the target voltage by transforming the target operating frequency. Alternatively, other existing and mature methods can be used to determine the target voltage based on the operating frequency. This manual does not impose specific restrictions on this method, as long as the operating voltage can be obtained from the operating frequency.
[0099] It should be noted that, in one or more embodiments of this specification, the power consumption simulation result refers to a schematic diagram of the power consumption simulation curve change of the chip under the action of control parameters by the simulation client.
[0100] based on Figure 1 The power consumption simulation method provided in this specification simulates the chip's power consumption to determine the target control parameters and target operating frequency under the target power consumption. The target control parameters can be applied to scenarios consistent with the target power consumption, allowing for the determination of target control parameters under different target power consumptions, ensuring that the chip's power consumption remains within a reasonable range. Furthermore, unlike other methods (such as pre-silicon simulation) that do not consider the impact of actual chip power consumption during operation, this method dynamically simulates the chip's actual power consumption based on the target power consumption. That is, based on the simulated power consumption obtained from the chip simulation, the target control parameters are dynamically determined, allowing the chip's actual power consumption under the determined target control parameters to stabilize towards the expected target power consumption, thus saving time spent manually adjusting the control parameters.
[0101] Furthermore, in one or more embodiments of this specification, the aforementioned control parameters may be PID parameters, that is, a PID control algorithm is used to adjust the operating frequency of the GPU, i.e., the PID parameters are used to adjust the operating frequency of the GPU. The PID control algorithm calculates the control increment using proportional, integral, and derivative terms to achieve control of the controlled variable.
[0102] Furthermore, in step S102 above, the initial control parameters are in multiple sets, each set including one or more control parameters; that is, in this specification, each set of control parameters can be one or more of P, I, and D. Then, in step S104 above, the simulation client can simulate the GPU's operating frequency based on each set of initial control parameters, obtaining the simulated operating frequency of the GPU under each initial set of control parameters. Then, in step S106 above, the simulation client can obtain the simulated power consumption of the GPU based on the obtained simulated operating frequencies.
[0103] Of course, in one or more embodiments of this specification, the initial control parameters can also be a set. That is, when the simulation client determines that the initial control parameters are not multiple sets, multiple new sets of initial control parameters are generated based on the initial control parameters. Or, in other words, when simulating the chip's operating frequency based on the initial control parameters to obtain the simulated operating frequency of the chip under the initial control parameters, other sets of control parameters must first be generated based on the initial control parameter set. This specification does not limit the specific method of generation. For example, a preset interval value can be determined, and for each control parameter in the initial control parameter set, control parameters whose distance from that control parameter is within the preset interval value can be determined. The control parameters whose distance from each control parameter in the initial control parameter set is within the preset interval value are used as other sets of control parameters. Then, the initial control parameter set and the generated other sets of control parameters can be used as each set of initial control parameters, so that the chip's operating frequency can be simulated based on each set of initial control parameters, and the simulated operating frequency of the chip under each set of initial control parameters can be obtained. Finally, based on the obtained simulated operating frequencies, the simulated power consumption of the chip can be obtained. In other words, this specification does not limit the number of initial control parameters.
[0104] Therefore, in one or more embodiments of this specification, a particle swarm optimization algorithm can be used when adjusting the initial control parameters to obtain the target control parameters. Specifically, the simulation client can first determine the intermediate group control parameters in each group of initial control parameters based on the simulation power consumption and the target power consumption, and then adjust the other groups of initial control parameters in each group based on the intermediate group control parameters. Then, the adjusted other groups of initial control parameters and the intermediate group control parameters are used again as the initial control parameters for each group, and the intermediate group control parameters are redefined until the preset conditions are met. Finally, the finally determined intermediate group control parameters are used as the target control parameters.
[0105] like Figure 4 The above is a flowchart illustrating the particle swarm optimization algorithm provided in this specification.
[0106] S300: Determine the intermediate group control parameters in each group of initial control parameters.
[0107] S302: Determine whether the preset conditions are met. If yes, proceed to step S308; otherwise, proceed to step S304.
[0108] S304: Based on the intermediate group control parameters, adjust the initial control parameters of other groups in the initial control parameters of each group.
[0109] S306: Use the adjusted initial control parameters of other groups and the intermediate group control parameters as the initial control parameters of each group again, and execute step S300.
[0110] S308: Use the current intermediate group control parameters as the target control parameters.
[0111] Obviously, based on Figure 4 As shown in the flowchart, determining the target control parameters is an iterative process. The underlying principle is to move from local optimization to global optimization, that is, to continuously determine the optimal initial control parameters (intermediate control parameters) from the initial control parameters. In one or more embodiments of this specification, the intermediate set of control parameters refers to the optimal set of initial control parameters among the current sets of initial control parameters; or, in other words, the intermediate set of control parameters refers to a set of local target control parameters among the current sets of initial control parameters—the set of parameters that allows the GPU's actual power consumption to be better stabilized at the target power consumption. Therefore, the simulation client can first determine the intermediate set of control parameters among the current sets of initial control parameters.
[0112] Furthermore, the initial control parameters of other groups can be adjusted based on the intermediate group control parameters, so that the initial control parameters of other groups are closer to the intermediate group control parameters. Then all the current initial control parameters of each group have been locally optimized, optimized to the adjusted initial control parameters of each group and the intermediate group control parameters. Obviously, the adjusted initial control parameters of each group and the intermediate group control parameters are better at stabilizing the actual power consumption of the GPU to the target power consumption than the unoptimized current initial control parameters.
[0113] Finally, the adjusted initial control parameters and intermediate control parameters of each group can be used as the initial control parameters for the next optimization. This process is repeated iteratively to optimize the intermediate control parameters until the preset conditions are met. The final determined intermediate control parameters are then the target control parameters.
[0114] It should be noted that the optimal set of control parameters among the local target control parameter groups, or the initial control parameters in each group, is consistent with the target control parameters in terms of optimization objective.
[0115] Furthermore, during the iterative process of optimizing the initial control parameters of each group, the iteration stops when a preset condition is met. This preset condition can be that the actual number of iterations reaches a preset number of iterations, or that the intermediate group control parameters obtained in the current iteration are within a preset numerical range.
[0116] In one or more embodiments of this specification, when the GPU's operating frequency is adjusted using a PID control algorithm, the simulation client can obtain the incremental operating frequency under the control of the PID parameters according to the formula INC = P * error i * I * error j + D * error m, where INC is the incremental power consumption, error i is the difference between the target power consumption and the current actual power consumption, error j is equal to the error i in the previous iteration, and error m is the error j in the previous iteration. Then, the simulation client can obtain the current GPU operating frequency based on the incremental operating frequency INC.
[0117] Furthermore, in order to further optimize the determined target control parameters, in step S300 above, when determining the intermediate control parameters among the initial control parameters, the evaluation value of the simulated power consumption of the GPU under each initial control parameter can be determined, so as to determine the intermediate control parameters from each initial control parameter based on the evaluation value.
[0118] The evaluation value can be determined based on the multi-dimensional evaluation criteria in step S106 above. In one or more embodiments of this specification, the evaluation criteria include at least: the time it takes for the simulated power consumption corresponding to the initial control parameters to stabilize to the target power consumption, the difference between the simulated power consumption corresponding to the initial control parameters and the target power consumption, and the simulation operating frequency error generated when using the initial control parameters to determine the simulated power consumption.
[0119] In one or more embodiments of this specification, the evaluation value can be expressed using the formula: This indicates that, where sum represents the cumulative error during the process of stabilizing the actual power consumption to the target power consumption using the initial control parameters, and ΔW represents the maximum difference between the actual power consumption and the target power consumption during the same process. For example: in Figure 3 In this context, ΔW is 25000, and t represents the time it takes for the actual power consumption to stabilize to the target power consumption using the initial control parameters. For example: Figure 3 In this context, t is 44, and a, b, and c represent the weights of sum, ΔW, and t, respectively. These weights can be set according to specific needs, and this manual does not impose any restrictions on them.
[0120] In addition, in step S304 above, when adjusting the initial control parameters of other groups in each group based on the intermediate group control parameters, the adjustment weight can be determined based on the number of times the intermediate group control parameters have been determined, and the current adjustment step size can be determined based on the adjustment weight and the adjustment step size of the previous adjustment of the initial control parameters of other groups, so as to adjust the current initial control parameters of other groups according to the determined current adjustment step size.
[0121] The simulation client can also determine the first difference between the current control parameters of each other group and the current control parameters of the intermediate group, then determine the control parameters of the optimized group from the intermediate group control parameters obtained each time, and determine the second difference between the current control parameters of each other group and the control parameters of the optimized group. Then, based on the first difference, the second difference, the adjustment weight, and the adjustment step size of the previous adjustment of the initial control parameters of other groups, the current adjustment step size can be determined.
[0122] In this specification, when making the initial control parameters of other groups closer to the control parameters of the intermediate group, that is, when optimizing the initial control parameters of other groups based on the locally optimal control parameters, the following formula can be used: Current adjustment step size = Previous adjustment step size * Weight + Learning rate x * Random number A * First difference + Learning rate y * Random number B *
[0123] The second difference is represented as follows: the learning rate is a preset value, the random number can be a number between 0 and 1, the previous adjustment step size is the adjustment step size of the previous iteration in the current iteration, the first difference is the difference between the current control parameters of each other group and the current control parameters of the intermediate group, and the second difference refers to the difference between the current control parameters of each other group and the control parameters of the optimization group. In one or more embodiments of this specification, this difference can be the numerical difference between the control parameters.
[0124] It should be noted that the optimized control parameters are the optimal set of control parameters among the intermediate control parameters determined throughout the entire iteration process; that is, the optimal intermediate control parameters in all current iterations. In one or more embodiments of this specification, the optimized control parameters can be selected from the intermediate control parameters based on the aforementioned evaluation values.
[0125] In one or more embodiments of this specification, the improvement to the particle swarm optimization algorithm is reflected in: determining the adjustment weight based on the number of times the intermediate group control parameters have been determined. Specifically, since the optimization degree of each initial control parameter group is different in each iteration, obviously, the more iterations, the better the initial control parameters, and the better the intermediate group control parameters obtained based on the initial control parameters, or in other words, closer to the target control parameters. Therefore, in each iteration, in order to make the adjustment effect of other initial control parameters better, the adjustment step size should be negatively correlated with the number of iterations. That is, as the number of iterations increases, the adjustment step size should be shortened. This will allow each initial control parameter group to better approximate the target control parameters, thereby improving the accuracy of the determined target control parameters.
[0126] Furthermore, the change in the adjustment step size with the number of iterations is reflected in the following: the weights change with the number of iterations, specifically, the weights decrease as the number of iterations increases, meaning the weights of the previous adjustment step size, upon which the current adjustment step size is based, decrease. Specifically, this can be illustrated using the formula... Where u refers to the current iteration number, maxrepeat refers to the maximum iteration number, and the initial weight value can be set to 1.2.
[0127] Since intermediate group control parameters can be determined in each iteration, in one or more embodiments of this specification, the number of iterations is also the number of times the intermediate group control parameters are determined.
[0128] This specification describes how target control parameters are dynamically determined based on the simulated power consumption obtained from chip simulation. This ensures that the actual power consumption of the chip under these determined target control parameters stabilizes towards the expected target power consumption. Furthermore, the parameter weights in the particle swarm optimization algorithm are dynamically determined, ensuring that the actual power consumption of the chip under these determined target control parameters stabilizes towards the expected target power consumption. Moreover, the stability of the GPU chip can be pre-studied using a simulation client before the GPU chip manufacturing project begins, avoiding situations where debugging and development can only begin after the GPU PCB layout is completed. This shortens the project development cycle and makes the positioning and analysis of GPU performance more efficient and accurate.
[0129] Furthermore, in one or more embodiments of this specification, the simulation client may perform different operations based on different real-world conditions during simulation.
[0130] During the power consumption simulation of the GPU, when the simulation client first uses the PID parameters to adjust the GPU's operating frequency, the current operating frequency can be used as the incremental PID, i.e., the incremental operating frequency, and the initial control parameters at the current operating frequency can be used as the initial control parameters.
[0131] The initial control parameters can then be optimized to obtain the target control parameters and the incremental operating frequency, and the target operating frequency can be determined.
[0132] When exiting power consumption control, the simulation client can clear error values, restore default values, and set the maximum operating frequency for the given scenario.
[0133] Once the simulation client completes a GPU power consumption simulation, that is, after determining the target control parameters for a given scenario, it can skip the current power consumption control.
[0134] The simulation client can also switch the target power consumption value, which allows the initial control parameters to be changed and optimized to obtain the target control parameters and incremental operating frequency under the target power consumption, and then determine the target operating frequency.
[0135] Furthermore, when the simulation client determines that the current power consumption of the GPU differs too much from the target power consumption, it indicates that the current initial control parameters are not well selected. In this case, the initial control parameters can be changed to select other initial control parameters.
[0136] Based on the power consumption simulation method described above, this specification also provides a corresponding schematic diagram of a device for power consumption simulation, as shown in the embodiments. Figure 5 As shown.
[0137] Figure 5 This is a schematic diagram of an apparatus for power consumption simulation provided in an embodiment of this specification. The apparatus includes:
[0138] The simulation response module 400 is used to respond to power consumption simulation commands and obtain the target power consumption of the chip.
[0139] The first determining module 402 is used to determine the initial control parameters of the chip based on the target power consumption;
[0140] The frequency simulation module 404 is used to simulate the operating frequency of the chip according to the initial control parameters, and obtain the simulated operating frequency of the chip under the initial control parameters.
[0141] The power consumption simulation module 406 is used to obtain the simulated power consumption of the chip based on the simulated operating frequency.
[0142] The parameter optimization module 408 is used to adjust the initial control parameters according to the simulated power consumption and the target power consumption to obtain the target control parameters;
[0143] The result determination module 410 is used to determine the target operating frequency of the chip based on the target control parameters, and to determine the power consumption simulation results of the chip at the target operating frequency.
[0144] Optionally, the initial control parameters are in multiple sets, each set including one or more control parameters;
[0145] The frequency simulation module 404 is specifically used to simulate the operating frequency of the chip according to each set of initial control parameters, and obtain the simulated operating frequency of the chip under each set of initial control parameters.
[0146] The power consumption simulation module 406 is specifically used to obtain the simulated power consumption of the chip based on the obtained simulated operating frequencies.
[0147] Optionally, the frequency simulation module 404 is further configured to generate multiple new sets of initial control parameters based on the initial control parameters when the initial control parameters are determined to be a set.
[0148] Optionally, the parameter optimization module 408 is specifically used to: determine the intermediate group control parameters in each group of initial control parameters based on the simulated power consumption and the target power consumption; adjust the other group initial control parameters in each group of initial control parameters based on the intermediate group control parameters; use the adjusted other group initial control parameters and the intermediate group control parameters as new initial control parameters for each group, and redetermine the intermediate group control parameters until the preset conditions are met; and use the finally determined intermediate group control parameters as the target control parameters.
[0149] Optionally, the parameter optimization module 408 is specifically used to determine the evaluation value of the simulated power consumption of the chip under each set of initial control parameters; and to determine the intermediate group control parameters from the initial control parameters based on the evaluation value.
[0150] Optionally, the parameter optimization module is specifically used to: determine the adjustment weight based on the number of times the intermediate group control parameters have been determined; determine the current adjustment step size based on the adjustment weight and the adjustment step size of the previous adjustment of the initial control parameters of other groups; and adjust the current initial control parameters of other groups based on the current adjustment step size.
[0151] Optionally, the parameter optimization module is specifically used to: determine the first difference between the current control parameters of each other group and the current control parameters of the intermediate group; determine the optimized group control parameters from the intermediate group control parameters obtained each time; determine the second difference between the current control parameters of each other group and the optimized group control parameters; and determine the current adjustment step size based on the first difference, the second difference, the adjustment weight, and the adjustment step size of the previous adjustment of the initial control parameters of other groups.
[0152] Optionally, the result determination module 410 is specifically used to: determine the target voltage based on the target operating frequency; and determine the power consumption simulation result of the chip at the target operating frequency based on the target operating frequency and the target voltage.
[0153] This specification also provides a computer-readable storage medium storing a computer program that can be used to execute the power consumption simulation method described above.
[0154] Based on the power consumption simulation method described above, the embodiments in this specification also propose... Figure 6The diagram shows a schematic structural representation of the electronic device. Figure 6 At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to implement the power consumption simulation method described above.
[0155] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0156] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0157] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0158] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0159] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0160] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0161] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will 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 program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0162] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0163] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0164] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0165] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0166] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0167] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0168] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0169] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0170] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0171] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this application.
Claims
1. A method for power consumption simulation, characterized in that, The method includes: In response to power consumption simulation commands, the target power consumption of the chip is obtained; Based on the target power consumption, determine the initial control parameters of the chip; The operating frequency of the chip is simulated based on the initial control parameters to obtain the simulated operating frequency of the chip under the initial control parameters. The simulated power consumption of the chip is obtained based on the simulated operating frequency. Based on the simulated power consumption and the target power consumption, the initial control parameters are adjusted to obtain the target control parameters; Based on the target control parameters, the target operating frequency of the chip is determined, and the power consumption simulation results of the chip at the target operating frequency are determined.
2. The method as described in claim 1, characterized in that, The initial control parameters are in multiple sets, each set including one or more control parameters; The operating frequency of the chip is simulated based on the initial control parameters to obtain the simulated operating frequency of the chip under the initial control parameters, specifically including: The operating frequency of the chip is simulated based on each set of initial control parameters to obtain the simulated operating frequency of the chip under each set of initial control parameters. Based on the simulated operating frequency, the simulated power consumption of the chip is obtained, specifically including: Based on the obtained simulation operating frequencies, the simulated power consumption of the chip is obtained.
3. The method as described in claim 1, characterized in that, When the initial control parameters are determined to be a set, the method further includes: Based on the initial control parameters, multiple new sets of initial control parameters are generated.
4. The method as described in claim 2 or 3, characterized in that, The initial control parameters are adjusted to obtain the target control parameters, specifically including: Based on the simulated power consumption and the target power consumption, determine the intermediate group control parameters in each group of initial control parameters; Based on the intermediate group control parameters, adjust the other initial control parameters in each group of initial control parameters; The adjusted initial control parameters of other groups and the intermediate group control parameters are used as the new initial control parameters for each group, and the intermediate group control parameters are redefined until the preset conditions are met. The final determined intermediate group control parameters are used as the target control parameters.
5. The method as described in claim 4, characterized in that, Determining the intermediate group control parameters in each group of initial control parameters specifically includes: The evaluation values of the simulated power consumption of the chip under each set of initial control parameters are determined respectively; Based on the evaluation values, intermediate group control parameters are determined from the initial control parameters of each group.
6. The method as described in claim 4, characterized in that, Adjusting other initial control parameters in each group of initial control parameters specifically includes: Based on the number of times the intermediate group control parameters have been determined, determine the adjustment weights; The current adjustment step size is determined based on the adjustment weights and the adjustment step size of the previous adjustment of the initial control parameters of other groups. Based on the current adjustment step size, adjust the initial control parameters of the other groups.
7. The method as described in claim 6, characterized in that, Based on the adjustment weights and the adjustment step size of the previous adjustment of the initial control parameters of other groups, the current adjustment step size is determined, specifically including: Determine the first difference between the current control parameters of each other group and the current control parameters of the intermediate group; Determine the optimal group control parameters from the intermediate group control parameters obtained each time; Determine the second difference between the current control parameters of each other group and the control parameters of the optimized group; The current adjustment step size is determined based on the first difference, the second difference, the adjustment weight, and the adjustment step size of the previous adjustment of the initial control parameters of other groups.
8. The method as described in claim 1, characterized in that, Determining the power consumption simulation results of the chip at the target operating frequency specifically includes: Determine the target voltage based on the target operating frequency; Based on the target operating frequency and the target voltage, determine the power consumption simulation results of the chip at the target operating frequency.
9. A power consumption control device, characterized in that, The device specifically includes: The simulation response module is used to respond to power consumption simulation commands and obtain the target power consumption of the chip. The first determining module is used to determine the initial control parameters of the chip based on the target power consumption; The frequency simulation module is used to simulate the operating frequency of the chip according to the initial control parameters, and obtain the simulated operating frequency of the chip under the initial control parameters. The power consumption simulation module is used to obtain the simulated power consumption of the chip based on the simulated operating frequency. The parameter optimization module is used to adjust the initial control parameters according to the simulated power consumption and the target power consumption to obtain the target control parameters; The result determination module is used to determine the target operating frequency of the chip based on the target control parameters, and to determine the power consumption simulation results of the chip at the target operating frequency.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1-8.
11. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of claims 1-8.
Citation Information
Patent Citations
Method and device for setting working frequency of chip
CN112882819A
SLAM-oriented GPU power consumption control method
CN115576410A