Power consumption determination method and device, electronic equipment and readable storage medium

By obtaining the temperature and load information of the heterogeneous computing unit, and using the dynamic power consumption metric model to calculate the power consumption, the problem of power consumption metric accuracy of the heterogeneous computing unit under special operating conditions is solved, and the precise power consumption reflection and model adjustment in complex scenarios is realized.

CN120406704APending Publication Date: 2025-08-01VIVO MOBILE COMM CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510524527.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-24
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, the power consumption measurement method of heterogeneous computing units is insufficient in special operating conditions, and it is difficult to adapt to the differences in high and low temperature environments and heat dissipation conditions. It is difficult to adjust the static model, resulting in insufficient precision in power consumption measurement.

Method used

By acquiring the temperature information and load information of the heterogeneous calculation unit, the working power consumption is determined using the first power consumption metric model, and the total power consumption is calculated in combination with the second power consumption metric model, considering the dynamic relationship between temperature and load, the measurement scheme is adjusted in real time to adapt to complex scenarios.

Benefits of technology

It improves the accuracy of power consumption measurement of heterogeneous computing units, can accurately reflect the real power consumption under special operating conditions such as high temperature and low temperature, reduces the impact of laboratory fixed data deviation, and makes the model easy to adjust.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120406704A_ABST
    Figure CN120406704A_ABST
Patent Text Reader

Abstract

The invention discloses a power consumption determination method and device, electronic equipment and a readable storage medium, and belongs to the technical field of terminals. The power consumption determination method comprises the following steps: acquiring temperature information and load information of a heterogeneous computing unit within a first operation duration; according to the temperature information and a first power consumption measurement model, determining the working power consumption of the heterogeneous computing unit in the first operation duration; the first power consumption measurement model is used for indicating the corresponding relation between the working power consumption of the heterogeneous computing unit and the temperature information; according to the second power consumption measurement model, the working power consumption and the load information, determining the total power consumption of the heterogeneous computing unit in the first operation duration; the second power consumption measurement model is used for indicating the corresponding relation among the total power consumption, the working power consumption and the load information of the heterogeneous computing unit.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of terminals, and particularly relates to a power consumption determination method, apparatus, electronic device, and readable storage medium. Background Art

[0002] The battery life of intelligent terminal devices has always been a pain point that users are concerned about. In intelligent terminal devices, XPUs (Extended Processing Units, heterogeneous computing units) such as CPUs (Central Processing Units), GPUs (Graphics Processing Units), and NPUs (Neural Processing Units) are extremely crucial core components and also the main power-consuming components.

[0003] Currently, the mainstream XPU power consumption measurement method is mainly implemented based on a static power consumption model constructed under laboratory preset conditions. The main implementation steps are as follows: Under the condition of constant junction temperature in the laboratory, measure the instantaneous power consumption values of the XPU in different load states such as idle, light load, and full load, and then form a load-static power consumption correspondence table; count the duration of the XPU in different load states, and based on the above load-static power consumption correspondence table, calculate the total power consumption value through integration.

[0004] However, for the above XPU power consumption measurement scheme, there are the following defects: Under special working conditions, the actual power consumption of the XPU may deviate greatly from the fixed laboratory data, resulting in the above XPU power consumption measurement scheme being unable to accurately reflect the true power consumption of the XPU; The static power consumption model is difficult to adapt to complex scenarios, and environmental factors such as high and low temperature environments and differences in heat dissipation conditions will all lead to inaccurate measurement; Once the static power consumption model is determined, the adjustment operation is troublesome and the model adjustment is difficult. In this way, the accuracy of XPU power consumption measurement is reduced. Summary of the Invention

[0005] The purpose of the embodiments of this application is to provide a power consumption determination method, apparatus, electronic device, and readable storage medium, which can improve the accuracy of heterogeneous computing unit power consumption measurement.

[0006] In a first aspect, an embodiment of the present application provides a power consumption determination method, which includes: obtaining temperature information and load information of a heterogeneous computing unit within a first running duration; determining the working power consumption of the heterogeneous computing unit within the first running duration according to the temperature information and a first power consumption metric model, where the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; determining the total power consumption of the heterogeneous computing unit within the first running duration according to a second power consumption metric model, the working power consumption, and the load information, where the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information.

[0007] In a second aspect, an embodiment of the present application provides a power consumption determination device, which includes: a collection unit for obtaining temperature information and load information of a heterogeneous computing unit within a first running duration; a processing unit for determining the working power consumption of the heterogeneous computing unit within the first running duration according to the temperature information and a first power consumption metric model, where the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; the processing unit is further configured to determine the total power consumption of the heterogeneous computing unit within the first running duration according to a second power consumption metric model, the working power consumption, and the load information, where the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, and the memory stores a program or instruction that can run on the processor. When the program or instruction is executed by the processor, the steps of the power consumption determination method as in the first aspect are implemented.

[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the power consumption determination method as in the first aspect are implemented.

[0010] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the steps of the power consumption determination method as in the first aspect.

[0011] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the power consumption determination method as in the first aspect.

[0012] In the power consumption determination method provided by the embodiments of the present application, temperature information and load information of a heterogeneous computing unit within a first running duration are obtained; according to the temperature information and a first power consumption metric model, the working power consumption of the heterogeneous computing unit within the first running duration is determined; the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; according to a second power consumption metric model, the working power consumption, and the load information, the total power consumption of the heterogeneous computing unit within the first running duration is determined; the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information. Through the above power consumption determination method, on the one hand, the temperature information of the heterogeneous computing unit is considered, which is applicable to special working conditions such as high temperature and low temperature, and can adapt to power consumption measurement in complex scenarios; on the other hand, combined with the first power consumption metric model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and power consumption measurement is performed based on the second power consumption metric model, without worrying about the problem that the actual power consumption of the heterogeneous computing unit deviates greatly from the fixed data in the laboratory, and the true power consumption of the heterogeneous computing unit can also be accurately reflected. In this way, the accuracy of power consumption measurement of the heterogeneous computing unit is improved. Description of the Drawings

[0013] Figure 1 It is one of the schematic flowcharts of the power consumption determination method provided by the embodiments of the present application;

[0014] Figure 2 It is the distribution diagram of the positions of temperature sensors provided by the embodiments of the present application;

[0015] Figure 3 It is one of the schematic diagrams of the principle of the power consumption determination method provided by the embodiments of the present application;

[0016] Figure 4 It is the relationship diagram between the working temperature and power consumption of the heterogeneous computing unit provided by the embodiments of the present application at 300 MHz to 1 GHz;

[0017] Figure 5 It is the relationship diagram between the working temperature and power consumption of the heterogeneous computing unit provided by the embodiments of the present application at 1 GHz to 2 GHz;

[0018] Figure 6 It is the relationship diagram between the working temperature and power consumption of the heterogeneous computing unit provided by the embodiments of the present application at 2 GHz to 3 GHz;

[0019] Figure 7 It is the relationship diagram between the working temperature and power consumption of the heterogeneous computing unit provided by the embodiments of the present application at 3 GHz to 4 GHz;

[0020] Figure 8 It is the second schematic diagram of the principle of the power consumption determination method provided by the embodiments of the present application;

[0021] Figure 9The second flowchart of the power consumption determination method provided by the embodiment of the present application;

[0022] Figure 10 The third flowchart of the power consumption determination method provided by the embodiment of the present application;

[0023] Figure 11 The structural block diagram of the power consumption determination device provided by the embodiment of the present application;

[0024] Figure 12 The structural block diagram of the electronic device provided by the embodiment of the present application;

[0025] Figure 13 The hardware structural schematic diagram of the electronic device provided by the embodiment of the present application.

[0026] Reference numerals:

[0027] 200 Temperature detection module, 202 Heterogeneous computing unit, 204 Sensor module, 206 Temperature reading link, 208 Analog front-end circuit, 210 Analog-to-digital conversion module, 212 Interface module, 214 Temperature sensor. Detailed implementation manners

[0028] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.

[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. generally belong to the same category, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates an "or" relationship between the associated objects before and after.

[0030] Next, in conjunction with the accompanying drawings, the power consumption determination method provided by the embodiments of the present application will be described in detail through specific embodiments and their application scenarios.

[0031] As Figure 1 shown, the embodiment of the present application provides a power consumption determination method, which may include the following S102 to S106:

[0032] S102: Obtain the temperature information and load information of the heterogeneous computing unit within the first running duration.

[0033] The power consumption determination method proposed in the embodiments of this application is executed by an electronic device, which can specifically be intelligent electronic devices such as smartphones, tablets, laptops, and smartwatches, and no specific limitation is made here.

[0034] Among them, the heterogeneous computing unit can specifically be components such as a central processing unit, a graphics processing unit, and a neural network processing unit in the electronic device.

[0035] Further, the above-mentioned first running duration can specifically be a preset calculation period when measuring the power consumption of the heterogeneous computing unit.

[0036] Further, the temperature information of the heterogeneous computing unit can specifically include the operating temperature and the operating environment temperature of the heterogeneous computing unit.

[0037] Further, the load information of the heterogeneous computing unit can specifically be the load ratio of the heterogeneous computing unit, and this load ratio changes with time. The load information of the heterogeneous computing unit is used to reflect the load status of the heterogeneous computing unit.

[0038] Specifically, in the power consumption determination method proposed in the embodiments of this application, when measuring the power consumption of the heterogeneous computing unit, the electronic device can obtain the temperature information and load information of the heterogeneous computing unit in real time within the first running duration.

[0039] Among them, when obtaining the temperature information of the heterogeneous computing unit, as Figure 3 shown, the temperature detection module 200 set in the electronic device can be used to detect the temperature information of the heterogeneous computing unit in real time. The temperature detection module 200 includes a sensor module 204 and a temperature reading link 206.

[0040] Among them, the above-mentioned sensor module 204 includes multiple temperature sensors. The temperature sensor can specifically be a thermistor diode. The thermistor diode utilizes the characteristic that the PN (Positive-Negative, P-type semiconductor - N-type semiconductor) junction voltage changes with temperature, about -2mV / ℃, and converts the voltage value through an ADC (Analog-to-Digital Converter). The temperature sensor can also be a CMOS temperature sensor. The CMOS (Complementary Metal Oxide Semiconductor) temperature sensor is based on the subthreshold characteristic of the transistor and outputs a current or frequency value proportional to the temperature. The temperature sensor can also be a digital sensor, such as a Bandgap sensor, and the digital sensor directly outputs a digital temperature value with high precision.

[0041] In the actual application process, for the specific types of the above temperature sensors, those skilled in the art can select different types of temperature sensors to collect the temperature information of heterogeneous computing units according to factors such as different device hardware conditions, measurement accuracy, and cost requirements, and no specific limitations are made here.

[0042] Further, as Figure 2 shown, in an electronic device, a temperature sensor 214 can be correspondingly set for each heterogeneous computing unit 202, and the temperature sensor 214 is embedded in the hot spot core position of the corresponding heterogeneous computing unit 202.

[0043] In the actual application process, the sensor module 204 can also directly utilize the existing integrated temperature sensors inside the SOC (System on a Chip), and no specific limitations are made here.

[0044] Further, as Figure 3 shown, the temperature reading link 206 includes an analog front-end circuit 208, an analog-to-digital conversion module 210, and an interface module 212.

[0045] Among them, the analog-to-digital conversion module 210 can include a MUX (Multiplexer) and an ADC. The MUX is used to time-divisionally select and connect multiple analog signals to the input end of the ADC, so that one ADC can sequentially sample and convert multiple different analog signals, and there is no need to equip a separate ADC for each analog signal.

[0046] Further, the analog front-end circuit 208 is used to amplify and filter the input information.

[0047] Further, the interface module 212 can specifically be an API (Application Programming Interface) at the software layer, and no specific limitations are made here.

[0048] Specifically, when detecting the temperature information of heterogeneous computing units, as Figure 3 shown, the temperature of different heterogeneous computing units, such as CPU temperature, GPU temperature, and NPU temperature, etc., is collected through the sensor module 204. After the collected information of the sensor module 204 is amplified and filtered by the analog front-end circuit 208, it is input into the analog-to-digital conversion module 210. The analog-to-digital conversion module 210 converts the input analog information into a digital signal and transmits the digital signal to the software layer through a digital interface. Then, the operating system of the electronic device further obtains the temperature information collected by the sensor module 204 through the API at the software layer.

[0049] S104: Determine the operating power consumption of the heterogeneous computing unit within the first operating duration according to the temperature information and the first power consumption metric model.

[0050] Wherein, the first power consumption metric model is used to indicate the corresponding relationship between the operating power consumption of the heterogeneous computing unit and the temperature information.

[0051] Furthermore, the operating power consumption of the heterogeneous computing unit may specifically include the full-load power consumption and the instantaneous power consumption of the heterogeneous computing unit. The full-load power consumption refers to the power consumed by the heterogeneous computing unit in a continuous full-load operating state.

[0052] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when measuring the power consumption of the heterogeneous computing unit, obtain the first power consumption metric model used to indicate the corresponding relationship between the operating power consumption of the heterogeneous computing unit and the temperature information, and based on the temperature information of the heterogeneous computing unit collected in real time, calculate the operating power consumption of the heterogeneous computing unit within the first operating duration in real time through the first power consumption metric model.

[0053] S106: Determine the total power consumption of the heterogeneous computing unit within the first operating duration according to the second power consumption metric model, the operating power consumption, and the load information.

[0054] Wherein, the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the operating power consumption and the load information.

[0055] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when measuring the power consumption of the heterogeneous computing unit, construct the second power consumption metric model, use the operating power consumption of the heterogeneous computing unit calculated in real time through the first power consumption metric model as the input of the second power consumption metric model, and combine the load information of the heterogeneous computing unit to calculate the total power consumption of the heterogeneous computing unit within the first operating duration through the second power consumption metric model.

[0056] It can be understood that the change in the operating temperature of the heterogeneous computing unit will directly affect the power consumption characteristics of the heterogeneous computing unit. The power consumption measurement scheme of the heterogeneous computing unit in the related art does not consider the influence of the operating temperature of the heterogeneous computing unit on the power consumption of the heterogeneous computing unit. When not considering the operating temperature of the heterogeneous computing unit, the dynamic power consumption formula of the heterogeneous computing unit is P = C × V 2 × F × N 3, where P is the dynamic power consumption of the heterogeneous computing unit, C is the equivalent capacitance of the heterogeneous computing unit, C is related to the chip manufacturing process, V is the supply voltage of the heterogeneous computing unit, F is the operating frequency of the heterogeneous computing unit, and N is the number of flipped transistors in the heterogeneous computing unit. However, the change in the operating temperature of the heterogeneous computing unit will trigger the AVS (Adaptive Voltage Scaling) mechanism of the chip to adjust the voltage of the heterogeneous computing unit, thereby changing its dynamic power consumption. Similarly, parameters such as the leakage current and carrier mobility of the heterogeneous computing unit also change with the operating temperature of the heterogeneous computing unit, and the static power consumption of the heterogeneous computing unit is closely related to these factors. Therefore, ignoring the operating temperature of the heterogeneous computing unit will cause the deviation between the actual power consumption of the heterogeneous computing unit under the same load and the fixed data in the laboratory to reach 10% to 40%, reducing the accuracy of the power consumption measurement of the heterogeneous computing unit.

[0057] Therefore, in the power consumption determination method proposed in the embodiments of the present application, a dynamic adjustment scheme for the XPU power consumption model based on temperature factors is provided. By considering the temperature information of the heterogeneous computing unit, combining the first power consumption measurement model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption measurement model. There is no need to worry about the problem of a large deviation between the actual power consumption of the heterogeneous computing unit and the fixed data in the laboratory, and the true power consumption of the heterogeneous computing unit can also be accurately reflected, improving the accuracy of the power consumption measurement of the heterogeneous computing unit.

[0058] The power consumption determination method provided in the embodiments of the present application obtains the temperature information and load information of the heterogeneous computing unit within the first running duration; determines the working power consumption of the heterogeneous computing unit within the first running duration according to the temperature information and the first power consumption measurement model; the first power consumption measurement model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; determines the total power consumption of the heterogeneous computing unit within the first running duration according to the second power consumption measurement model, the working power consumption, and the load information; the second power consumption measurement model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information. Through the above power consumption determination method, on the one hand, the temperature information of the heterogeneous computing unit is considered, which is applicable to special working conditions such as high temperature and low temperature and can adapt to the power consumption measurement in complex scenarios; on the other hand, by combining the first power consumption measurement model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption measurement model. There is no need to worry about the problem of a large deviation between the actual power consumption of the heterogeneous computing unit and the fixed data in the laboratory, and the true power consumption of the heterogeneous computing unit can also be accurately reflected, and the model is easy to adjust. In this way, the accuracy and convenience of the power consumption measurement of the heterogeneous computing unit are improved.

[0059] In an embodiment of the present application, the temperature information includes the operating temperature of the heterogeneous computing unit, and the operating power consumption includes the full-load power consumption of the heterogeneous computing unit that changes with the operating temperature. Specifically, the power consumption determination method may further include the following S108:

[0060] S108: According to the operating frequency of the heterogeneous computing unit, search for a first power consumption metric model corresponding to the operating frequency from a preset model library.

[0061] Among them, the first power consumption metric model is used to indicate the correspondence between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information.

[0062] It can be understood that as the operating temperature of the heterogeneous computing unit increases, the static power consumption of the heterogeneous computing unit increases, and the change in the operating temperature of the heterogeneous computing unit will also trigger the AVS mechanism of the chip to adjust the dynamic voltage, resulting in a change in the dynamic power consumption of the heterogeneous computing unit. Therefore, through laboratory tests, a linear relationship model between the full-load power consumption and the operating temperature of different heterogeneous computing units at different frequencies can be determined and pre-stored in the preset model library for subsequent retrieval and use.

[0063] For example, taking the CPU as an example, as Figure 4 、 Figure 5 、 Figure 6 and Figure 7 shown, record the correspondence between the operating temperature of the CPU and the power consumption increment and the increment percentage within the frequency ranges of 300 MHz to 1 GHz, 1 GHz to 2 GHz, 2 GHz to 3 GHz, and 3 GHz to 4 GHz, respectively. Among them, in Figures 4 to 7 , the abscissa is the operating temperature of the CPU, the left ordinate represents the power consumption increment of the CPU, the right ordinate represents the increment percentage of the CPU power consumption, the bar chart represents the power consumption increment, and the line chart represents the increment percentage, Figures 4 to 7 showing the change in the power consumption of the CPU at different operating temperatures within different frequency ranges. On this basis, as shown in Table 1 below, through data fitting, based on the recorded data, determine the linear relationship formula between the full-load power consumption of the CPU at different operating frequencies and the operating temperature T j .

[0064] Table 1

[0065]

[0066] Specifically, in the power consumption determination method proposed in the embodiments of the present application, a linear relationship model between the full-load power consumption and the operating temperature of the heterogeneous computing unit at different operating frequencies is stored in the preset model library. When measuring the power consumption of the heterogeneous computing unit, the operating frequency of the heterogeneous computing unit is obtained, and then the linear relationship model corresponding to the operating frequency is searched from the preset model library to obtain the first power consumption measurement model, so as to calculate the full-load power consumption of the heterogeneous computing unit within the first operating duration in real time through the first power consumption measurement model for subsequent use.

[0067] In the above embodiments provided by the present application, the temperature information includes the operating temperature of the heterogeneous computing unit, and the operating power consumption includes the full-load power consumption of the heterogeneous computing unit changing with the operating temperature. According to the operating frequency of the heterogeneous computing unit, the first power consumption measurement model corresponding to the operating frequency is searched from the preset model library; wherein, the first power consumption measurement model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information. In this way, by calling the preset model for calculation, the calculation amount in the power consumption measurement process is reduced.

[0068] In the embodiments of the present application, the calculation formula of the first power consumption measurement model is:

[0069]

[0070] wherein, T j represents the operating temperature of the heterogeneous computing unit, with the unit of °C, m i represents the first influence coefficient of the operating temperature at the operating frequency f i with the unit of W / °C, P base,i represents the static power consumption of the heterogeneous computing unit at the operating frequency f i with the unit of W, represents the full-load power consumption of the heterogeneous computing unit changing with the operating temperature at the operating frequency f i with the unit of W.

[0071] Furthermore, the calculation formula of the second power consumption measurement model is:

[0072]

[0073] wherein, T represents the first operating duration, P idle represents the idle power consumption of the heterogeneous computing unit at the operating frequency f i L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers.

[0074] In the above embodiments provided by the present application, the calculation formula of the first power consumption measurement model is: The calculation formula of the second power consumption measurement model is: wherein, Tj represents the working temperature of the heterogeneous computing unit, m i represents the first influence coefficient at the working frequency f i under the condition, P base,i represents the static power consumption of the heterogeneous computing unit at the working frequency f i under the condition, represents the full-load power consumption of the heterogeneous computing unit changing with the working temperature at the working frequency f i under the condition, T represents the first running duration, P idle represents the idle power consumption of the heterogeneous computing unit at the working frequency f i under the condition, L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers. In this way, considering the working temperature of the heterogeneous computing unit, combining the first power consumption measurement model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption measurement model, ensuring the accuracy of the power consumption measurement.

[0075] In summary, as Figure 9 shown, the power consumption determination method proposed in the embodiment of the present application may specifically include the following S302 to S310:

[0076] S302: Detect the working temperature of each XPU in real time.

[0077] S304: Read the detected working temperature of the XPU.

[0078] S306: Query the corresponding first power consumption measurement model in the preset model library according to the working frequency of the XPU.

[0079] S308: Collect the load information of the XPU in each calculation cycle.

[0080] S310: Calculate the total power consumption of the XPU in each calculation cycle based on the working temperature, the first power consumption measurement model, and the load information.

[0081] Among them, after S310 is executed, S302 is continued to be executed, and so on in a loop.

[0082] Specifically, in the power consumption determination method proposed in the embodiments of the present application, the working temperature of the XPU is detected in real time according to a preset calculation period, and in combination with the linear relationship model of the working temperature, working frequency, and full-load power consumption of the XPU obtained through a large number of data samplings in the laboratory, the first power consumption metric model is searched. Then, based on the real-time working temperature of the XPU and the output value of the first power consumption metric model, the full-load power consumption input to the second power consumption metric model is dynamically updated, that is, the XPU base power consumption parameter in the second power consumption metric model is dynamically adjusted. Furthermore, in combination with the load information and running duration of the XPU, the total power consumption of the XPU is output more accurately through the second power consumption metric model. Finally, the metric model accuracy is improved by the change in the junction temperature. In this way, considering the working temperature of the XPU, a power consumption metric model is established, and the power consumption metric result can change with the change in the working temperature of the XPU, improving the accuracy of power consumption measurement and reducing the power consumption measurement error from ±20% of the traditional method to within ±5%.

[0083] In the embodiments of the present application, the temperature information includes the working temperature and the working environment temperature of the heterogeneous computing unit, and the working power consumption includes the instantaneous power consumption of the heterogeneous computing unit changing with the working temperature and the working environment temperature. On this basis, the above power consumption determination method may specifically further include the following S110 to S114:

[0084] S110: Obtain the current-voltage information of the heterogeneous computing unit within the first running duration.

[0085] Among them, the current-voltage information of the heterogeneous computing unit may specifically include the power supply voltage value and the power supply current value of the heterogeneous computing unit.

[0086] Furthermore, the current-voltage information of the heterogeneous computing unit is used to calculate the actual instantaneous power consumption of the heterogeneous computing unit.

[0087] S112: Construct a third power consumption metric model.

[0088] Among them, the third power consumption metric model is used to indicate the corresponding relationship between the instantaneous power consumption of the heterogeneous computing unit and the working temperature and the working environment temperature.

[0089] S114: Train the third power consumption metric model according to the working temperature, the working environment temperature, and the current-voltage information to update the model parameters of the third power consumption metric model and obtain the first power consumption metric model.

[0090] It can be understood that the working temperature of the heterogeneous computing unit mainly affects the dynamic power consumption of the heterogeneous computing unit, and has a relatively small impact on the static power consumption of the heterogeneous computing unit. In order to make the above first power consumption metric model and second power consumption metric model applicable to a more complex environment, other factors need to be considered. Further, the establishment of the first power consumption metric model mainly relies on a large amount of experimental data in the laboratory. Under the influence of various factors, the amount of experiments is large, which increases the labor cost.

[0091] Therefore, in the power consumption determination method proposed in the embodiments of the present application, when measuring the power consumption of the heterogeneous computing unit, the working environment temperature and current-voltage information of the heterogeneous computing unit within the first running duration are also collected in real time. On this basis, when determining the above first power consumption metric model, a third power consumption metric model is constructed to indicate the correspondence between the instantaneous power consumption of the heterogeneous computing unit and the working temperature and the working environment temperature, and the third power consumption metric model is deployed in the operating system of the electronic device. The third power consumption metric model is an initial model. Further, according to the working temperature, working environment temperature and current-voltage information of the heterogeneous computing unit, the third power consumption metric model is trained to update the model parameters of the third power consumption metric model, so as to obtain the first power consumption metric model, and the instantaneous power consumption of the heterogeneous computing unit within the first running duration is calculated in real time through the first power consumption metric model for subsequent use.

[0092] In the above embodiments provided by the present application, the temperature information includes the working temperature and the working environment temperature of the heterogeneous computing unit, the working power consumption includes the instantaneous power consumption of the heterogeneous computing unit changing with the working temperature and the working environment temperature, and the current-voltage information of the heterogeneous computing unit within the first running duration is obtained; a third power consumption metric model is constructed, and the third power consumption metric model is used to indicate the correspondence between the instantaneous power consumption of the heterogeneous computing unit and the working temperature and the working environment temperature; according to the working temperature, the working environment temperature and the current-voltage information, the third power consumption metric model is trained to update the model parameters of the third power consumption metric model, so as to obtain the first power consumption metric model. In this way, it is not necessary to rely on experimental data, an initial model for power consumption measurement is constructed and deployed, and then based on an online learning mechanism, combined with the multi-dimensional operating conditions information of the heterogeneous computing unit, the initial model is optimized and trained to obtain the first power consumption metric model, so that the first power consumption metric model can be applicable to a more complex environment and the labor cost of model construction is reduced.

[0093] In the embodiments of the present application, the calculation formula of the third power consumption metric model is:

[0094]

[0095] where T j represents the working temperature of the heterogeneous computing unit, and m i represents the working temperature at the working frequency fi The first influence coefficient under T ambient represents the working environment temperature of the heterogeneous computing unit, n i represents the second influence coefficient under the working environment temperature at the working frequency f i represents the instantaneous power consumption of the heterogeneous computing unit changing with the working temperature and the working environment temperature at the working frequency f i

[0096] The calculation formula of the second power consumption measurement model is:

[0097]

[0098] Among them, T represents the first running duration, P idle represents the idle power consumption of the heterogeneous computing unit at the working frequency f i L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers.

[0099] In the above embodiments provided by the present application, the calculation formula of the third power consumption measurement model is: The calculation formula of the second power consumption measurement model is: Among them, T j represents the working temperature of the heterogeneous computing unit, m i represents the first influence coefficient under the working temperature at the working frequency f i T ambient represents the working environment temperature of the heterogeneous computing unit, n i represents the second influence coefficient under the working environment temperature at the working frequency f i represents the instantaneous power consumption of the heterogeneous computing unit changing with the working temperature and the working environment temperature at the working frequency f, T represents the first running duration, P i represents the idle power consumption of the heterogeneous computing unit at the working frequency f idle represents the idle power consumption of the heterogeneous computing unit at the working frequency f i L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers. In this way, considering the working temperature and the working environment temperature of the heterogeneous computing unit, combining the first power consumption measurement model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption measurement model, ensuring the accuracy of the power consumption measurement.

[0100] In the embodiments of the present application, the model parameters include the first influence coefficient and the second influence coefficient. The steps of training the third power consumption measurement model according to the working temperature, the working environment temperature, and the current and voltage information may specifically include the following S116 to S126:​​​

[0101] S116: Initialize the first influence coefficient and the second influence coefficient.

[0102] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when training the third power consumption metric model, the first influence coefficient and the second influence coefficient of the third power consumption metric model are initialized, and an initial value is assigned to each of the first influence coefficient and the second influence coefficient.

[0103] S118: Input the operating temperature and the ambient temperature into the third power consumption metric model to obtain a model prediction value.

[0104] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when training the third power consumption metric model, for each training round, that is, for each group of samples, that is, for each group of operating temperature and ambient temperature, the operating temperature and the ambient temperature are input into the third power consumption metric model to obtain the model prediction value for each training round.

[0105] S120: Calculate the true value of the sample according to the current-voltage information.

[0106] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when training the third power consumption metric model, for each training round, that is, for each group of samples, that is, for each group of operating temperature and ambient temperature, the true value of the sample for each training round is calculated according to the current-voltage information of the heterogeneous computing unit collected at the same time as this group of samples.

[0107] S122: Construct the loss function of the third power consumption metric model.

[0108] Wherein, the loss function is used to measure the error value between the model prediction value and the true value of the sample.

[0109] Furthermore, the above loss function can specifically be constructed using the mean square error, that is, the above loss function can be specifically as follows:

[0110]

[0111] Wherein, J(m i ,n i ) represents the function value of the loss function, m i represents the first influence coefficient of the operating temperature at the operating frequency f i , n i represents the second influence coefficient of the ambient temperature at the operating frequency f i , z represents the number of samples, h (k) (m i ,n i ) represents the model prediction value corresponding to the kth group of samples, y(k) denotes the true value of the samples corresponding to the k-th group, where k is an ordinal number.

[0112] In the actual application process, the above loss function can also adopt other forms. Those skilled in the art can select the specific form of the above loss function according to the actual situation, and no specific limitation is made here.

[0113] S124: Determine the error value between the model prediction value and the true value of the sample according to the loss function, the model prediction value, and the true value of the sample.

[0114] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when training the third power consumption metric model, for each training round, after obtaining the corresponding model prediction value and the true value of the sample, the model prediction value and the true value of the sample are used as the function inputs of the loss function, and the error value between the model prediction value and the true value of the sample is calculated.

[0115] S126: When the error value does not converge, update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm until the error value converges.

[0116] Specifically, in the power consumption determination method proposed in the embodiments of the present application, when training the third power consumption metric model, for each training round, when the calculated error value does not converge, update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm, and perform the next round of model training based on the updated first influence coefficient and the second influence coefficient until the calculated error value converges, end the training, and obtain the first power consumption metric model.

[0117] Among them, the principle of the gradient descent algorithm is as Figure 8 shown, Figure 8 is a three-dimensional graph, the horizontal axis is the first influence coefficient m i , the vertical axis is the second influence coefficient n i , and the vertical axis is the function value J(m i ,n i ) of the loss function. The surface of the three-dimensional graph presents a fluctuating colored curved surface, and there is a path composed of broken lines with crosses. This path starts from a certain point on the curved surface and gradually extends to the area with a lower function value of the loss function. Among them, Figure 8 the color change in Figure 8 represents the change in the function value of the loss function. The color changes from cold color to warm color, indicating that the function value of the loss function changes from low to high. Based on Figure 8 the principle shown, calculate the gradient of the loss function at the current parameter position, that is, the direction in which the function changes fastest, and then update the first influence coefficient and the second influence coefficient along the opposite direction of the gradient to gradually reduce the function value of the loss function, minimize the loss function, and obtain the optimal first influence coefficient and the second influence coefficient.

[0118] In the actual application process, the first gradient of the first influence coefficient and the second gradient of the second influence coefficient can be calculated according to the following formula:

[0119]

[0120] where represents the first gradient, represents the working temperature in the k-th group of samples, represents the second gradient, represents the working ambient temperature in the k-th group of samples.

[0121] On this basis, the first influence coefficient and the second influence coefficient can be updated according to the following formula:

[0122]

[0123] where ":=" means assigning the data on the right side of the formula to the data on the left side, and α represents the learning rate.

[0124] It can be understood that the instantaneous power consumption collects the instantaneous value, that is, the power consumption at a certain time point, and it cannot measure and describe the power consumption situation within a period, that is, within a certain time period. If we want to describe the power consumption situation within a period through the instantaneous power consumption, a very high sampling frequency is required, which will have a certain negative impact on power consumption, performance, cost, etc. Once the sampling frequency is not high enough, the collected instantaneous power consumption is difficult to reflect the real power consumption change, especially in the scenario where the power consumption change fluctuates greatly.

[0125] In the power consumption determination method proposed in the embodiment of the present application, the optimal first influence coefficient and second influence coefficient obtained based on the gradient descent algorithm can minimize the error between the instantaneous power consumption output by the first power consumption measurement model and the real instantaneous power consumption of the heterogeneous computing unit, that is, make the instantaneous power consumption output by the first power consumption measurement model approach the real instantaneous power consumption of the heterogeneous computing unit. In this way, in the scenario where the power consumption change fluctuates greatly, the power consumption change within a period can also be described according to the influencing factors, so as to more accurately measure the power consumption of the heterogeneous computing unit.

[0126] In the above embodiments provided by the present application, the model parameters include a first influence coefficient and a second influence coefficient. Initialize the first influence coefficient and the second influence coefficient; input the operating temperature and the operating environment temperature into the third power consumption measurement model to obtain a model prediction value; calculate the sample true value according to the current-voltage information; construct a loss function of the third power consumption measurement model; determine the error value between the model prediction value and the sample true value according to the loss function, the model prediction value, and the sample true value; when the error value does not converge, update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm until the error value converges. In this way, an initial model for power consumption measurement is constructed and deployed, and then based on the online learning mechanism, combined with the multi-dimensional operating conditions information of the heterogeneous computing unit, the initial model is optimized and trained to obtain the first power consumption measurement model, so that the first power consumption measurement model can be applied to a more complex environment, further improving the accuracy of power consumption measurement, and without relying on experimental data, reducing the labor cost of model construction.

[0127] In summary, as Figure 10 shown, the power consumption determination method proposed in the embodiments of the present application may specifically further include the following S402 to S414:

[0128] S402: Real-time detect the operating temperature, current-voltage information, and operating environment temperature of each XPU.

[0129] S404: Read the operating temperature and the operating environment temperature of the detected XPU.

[0130] S406: Based on the operating temperature and the operating environment temperature of the XPU, establish a third power consumption measurement model.

[0131] S408: Deploy the third power consumption measurement model in the operating system of the electronic device.

[0132] S410: Based on the online learning mechanism and the gradient descent algorithm, optimize the model parameters of the third power consumption measurement model according to the operating temperature, current-voltage information, and operating environment temperature of the XPU to obtain the first power consumption measurement model.

[0133] S412: Collect the load information of the XPU in each calculation cycle.

[0134] S414: Calculate the total power consumption of the XPU in each calculation cycle based on the operating temperature, the operating environment temperature, the first power consumption measurement model, and the load information.

[0135] Wherein, after S414 is executed, S402 is continued to be executed, and so on in a loop.

[0136] Specifically, in the power consumption determination method proposed in the embodiments of the present application, based on the working environment temperature compensation mechanism and the online learning mechanism, the accuracy of XPU power consumption measurement is self-calibrated: the working temperature, working environment temperature, and current and voltage information of the XPU are collected in real time according to a preset calculation period. Based on the working temperature and working environment temperature of the XPU, a third power consumption measurement model is established and deployed. For each set of working temperature and working environment temperature, the true instantaneous power consumption is determined based on the corresponding current and voltage information, and the instantaneous power consumption output by the third power consumption measurement model is obtained. Then, through the online learning mechanism, the true instantaneous power consumption and the instantaneous power consumption output by the model are compared, and the gradient descent algorithm is used to update the model parameters of the third power consumption measurement model to minimize the error between the true instantaneous power consumption and the instantaneous power consumption output by the model, obtaining the first power consumption measurement model. Then, in combination with the working temperature, working environment temperature, and load information of the XPU, the total power consumption of the XPU is calculated. In this way, automatic calibration of the model parameters is achieved, and there is no need for manual parameter adjustment.

[0137] Therefore, the power consumption determination method proposed in the embodiments of the present application solves the pain points of small influencing factors in the process of XPU power consumption measurement and the inability of the model to adapt to dynamic environments, improves the accuracy of XPU power consumption measurement, empowers the operating system of electronic devices, makes the operating system more intelligent and efficient, and thus enables better energy efficiency optimization and thermal management decisions.

[0138] In the power consumption determination method provided by the embodiments of the present application, the execution subject may be a power consumption determination device. In the embodiments of the present application, taking the power consumption determination device executing the above power consumption determination method as an example, the power consumption determination device provided by the embodiments of the present application is described.

[0139] As Figure 11 shown, the embodiments of the present application provide a power consumption determination device 500, which may include the following acquisition unit 502 and processing unit 504.

[0140] The acquisition unit 502 is configured to obtain the temperature information and load information of the heterogeneous computing unit within the first operation duration.

[0141] The processing unit 504 is configured to determine the working power consumption of the heterogeneous computing unit within the first operation duration according to the temperature information and the first power consumption measurement model; the first power consumption measurement model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information.

[0142] The processing unit 504 is further configured to determine the total power consumption of the heterogeneous computing unit within the first operation duration according to the second power consumption measurement model, the working power consumption, and the load information; the second power consumption measurement model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information.

[0143] The power consumption determination device 500 provided by the embodiment of the present application acquires the temperature information and load information of the heterogeneous computing unit within the first running duration; determines the working power consumption of the heterogeneous computing unit within the first running duration according to the temperature information and the first power consumption metric model, where the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; determines the total power consumption of the heterogeneous computing unit within the first running duration according to the second power consumption metric model, the working power consumption, and the load information, where the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information. Through the above power consumption determination device 500, on the one hand, the temperature information of the heterogeneous computing unit is considered, which is applicable to special working conditions such as high temperature and low temperature, and can adapt to power consumption measurement in complex scenarios; on the other hand, combined with the first power consumption metric model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption metric model, without worrying about the problem that the actual power consumption of the heterogeneous computing unit deviates greatly from the fixed data in the laboratory, and can accurately reflect the true power consumption of the heterogeneous computing unit, and the model is easy to adjust. In this way, the accuracy and convenience of the power consumption measurement of the heterogeneous computing unit are improved.

[0144] In the embodiment of the present application, the temperature information includes the working temperature of the heterogeneous computing unit, the working power consumption includes the full-load power consumption of the heterogeneous computing unit changing with the working temperature, and the processing unit 504 is further configured to: find the first power consumption metric model corresponding to the working frequency from the preset model library according to the working frequency of the heterogeneous computing unit; where the first power consumption metric model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information.

[0145] In the above embodiment provided by the present application, the temperature information includes the working temperature of the heterogeneous computing unit, the working power consumption includes the full-load power consumption of the heterogeneous computing unit changing with the working temperature, and the first power consumption metric model corresponding to the working frequency is found from the preset model library according to the working frequency of the heterogeneous computing unit; where the first power consumption metric model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information. In this way, the preset model is called for operation, reducing the calculation amount in the power consumption measurement process.

[0146] In the embodiment of the present application, the calculation formula of the first power consumption metric model is: The calculation formula of the second power consumption metric model is: Where, T j represents the working temperature of the heterogeneous computing unit, m i represents the first influence coefficient of the working temperature at the working frequency f i , P base,i represents the static power consumption of the heterogeneous computing unit at the working frequency f i , Indicates the full-load power consumption of the heterogeneous computing unit varying with the operating temperature at the operating frequency f i where T represents the first operating duration, and P idle Indicates the idle power consumption of the heterogeneous computing unit at the operating frequency f i where L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers.

[0147] For the above embodiments provided by the present application, the calculation formula of the first power consumption metric model is: The calculation formula of the second power consumption metric model is: where T j represents the operating temperature of the heterogeneous computing unit, and m i represents the first influence coefficient at the operating temperature under the operating frequency f i where P base,i represents the static power consumption of the heterogeneous computing unit at the operating frequency f i where represents the full-load power consumption of the heterogeneous computing unit varying with the operating temperature at the operating frequency f i where T represents the first operating duration, and P idle represents the idle power consumption of the heterogeneous computing unit at the operating frequency f i where L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers. In this way, considering the operating temperature of the heterogeneous computing unit, combining the first power consumption metric model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption metric model, ensuring the accuracy of the power consumption measurement.

[0148] In the embodiments of the present application, the temperature information includes the operating temperature of the heterogeneous computing unit and the operating environment temperature, the operating power consumption includes the instantaneous power consumption of the heterogeneous computing unit varying with the operating temperature and the operating environment temperature, and the acquisition unit 502 is further configured to: obtain the current-voltage information of the heterogeneous computing unit within the first operating duration; the processing unit 504 is further configured to: construct a third power consumption metric model, where the third power consumption metric model is used to indicate the corresponding relationship between the instantaneous power consumption of the heterogeneous computing unit and the operating temperature and the operating environment temperature; and train the third power consumption metric model according to the operating temperature, the operating environment temperature, and the current-voltage information to update the model parameters of the third power consumption metric model, so as to obtain the first power consumption metric model.

[0149] In the above embodiments provided by the present application, the temperature information includes the operating temperature and the operating environment temperature of the heterogeneous computing unit, the operating power consumption includes the instantaneous power consumption of the heterogeneous computing unit varying with the operating temperature and the operating environment temperature, and the current-voltage information of the heterogeneous computing unit within the first operating duration is obtained; a third power consumption metric model is constructed, and the third power consumption metric model is used to indicate the corresponding relationship between the instantaneous power consumption of the heterogeneous computing unit and the operating temperature and the operating environment temperature; according to the operating temperature, the operating environment temperature, and the current-voltage information, the third power consumption metric model is trained to update the model parameters of the third power consumption metric model, and a first power consumption metric model is obtained. In this way, without relying on experimental data, an initial model for power consumption measurement is constructed and deployed, and then based on an online learning mechanism, combined with the multi-dimensional operating condition information of the heterogeneous computing unit, the initial model is optimized and trained to obtain a first power consumption metric model, so that the first power consumption metric model can be applied to a more complex environment and the labor cost of model construction is reduced.

[0150] In the embodiments of the present application, the calculation formula of the third power consumption metric model is: The calculation formula of the second power consumption metric model is: where, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient of the operating temperature at the operating frequency f i , T ambient represents the operating environment temperature of the heterogeneous computing unit, n i represents the second influence coefficient of the operating environment temperature at the operating frequency f i , represents the instantaneous power consumption of the heterogeneous computing unit varying with the operating temperature and the operating environment temperature at the operating frequency f i , T represents the first operating duration, P idle represents the idle power consumption of the heterogeneous computing unit at the operating frequency f i , L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinals.

[0151] In the above embodiments provided by the present application, the calculation formula of the third power consumption metric model is: The calculation formula of the second power consumption metric model is: where, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient of the operating temperature at the operating frequency f i , T ambient represents the operating environment temperature of the heterogeneous computing unit, n i represents the second influence coefficient of the operating environment temperature at the operating frequency f i , Indicates the instantaneous power consumption of the heterogeneous computing unit varying with the operating temperature and the ambient temperature at the operating frequency f i where T represents the first running duration, and P idle Indicates the idle power consumption of the heterogeneous computing unit at the operating frequency f i where L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinals. In this way, considering the operating temperature and the ambient temperature of the heterogeneous computing unit, combining the first power consumption measurement model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption measurement model, ensuring the accuracy of the power consumption measurement.

[0152] In the embodiment of the present application, the model parameters include a first influence coefficient and a second influence coefficient. The processing unit 504 is specifically configured to: initialize the first influence coefficient and the second influence coefficient; input the operating temperature and the ambient temperature into the third power consumption measurement model to obtain a model prediction value; calculate a sample true value according to the current-voltage information; construct a loss function of the third power consumption measurement model; determine an error value between the model prediction value and the sample true value according to the loss function, the model prediction value, and the sample true value; and update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm until the error value converges when the error value does not converge.

[0153] In the above embodiment provided by the present application, the model parameters include a first influence coefficient and a second influence coefficient. Initialize the first influence coefficient and the second influence coefficient; input the operating temperature and the ambient temperature into the third power consumption measurement model to obtain a model prediction value; calculate a sample true value according to the current-voltage information; construct a loss function of the third power consumption measurement model; determine an error value between the model prediction value and the sample true value according to the loss function, the model prediction value, and the sample true value; and update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm until the error value converges when the error value does not converge. In this way, an initial model for power consumption measurement is constructed and deployed, and then based on the online learning mechanism, combined with the multi-dimensional working condition information of the heterogeneous computing unit, the initial model is optimized and trained to obtain the first power consumption measurement model, so that the first power consumption measurement model can be applied to a more complex environment, further improving the accuracy of the power consumption measurement, and without relying on experimental data, reducing the labor cost of model construction.

[0154] The power consumption determination device 500 in the embodiments of the present application may be an electronic device or a component in an electronic device, such as an integrated circuit or a chip. The electronic device may be a terminal or other devices other than terminals. Exemplarily, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a Mobile Internet Device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. It may also be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc. The embodiments of the present application do not make specific limitations.

[0155] The power consumption determination device 500 in the embodiments of the present application may be a device with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems. The embodiments of the present application do not make specific limitations.

[0156] The power consumption determination device 500 provided in the embodiments of the present application can implement Figure 1 , Figure 9 and Figure 10 each process implemented by the method embodiments. To avoid repetition, it will not be elaborated here.

[0157] Optionally, as Figure 12 shown, the embodiments of the present application further provide an electronic device 600, including a processor 602 and a memory 604. A program or instruction that can run on the processor 602 is stored on the memory 604. When the program or instruction is executed by the processor 602, it implements each step of the above-mentioned power consumption determination method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0158] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0159] Figure 13 It is a schematic diagram of the hardware structure of an electronic device for implementing the embodiments of the present application.

[0160] The electronic device 700 includes, but is not limited to, components such as a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710.

[0161] Those skilled in the art can understand that the electronic device 700 may further include a power source (such as a battery) for supplying power to each component. The power source can be logically connected to the processor 710 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. Figure 13 The structure of the electronic device shown does not limit the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0162] Among them, the sensor 705 is used to obtain the temperature information and load information of the heterogeneous computing unit during the first operation duration.

[0163] The processor 710 is used to determine the working power consumption of the heterogeneous computing unit during the first operation duration according to the temperature information and the first power consumption metric model; the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information.

[0164] The processor 710 is further used to determine the total power consumption of the heterogeneous computing unit during the first operation duration according to the second power consumption metric model, the working power consumption, and the load information; the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption, the load information.

[0165] In an embodiment of the present application, temperature information and load information of a heterogeneous computing unit within a first operating duration are obtained; according to the temperature information and a first power consumption metric model, the operating power consumption of the heterogeneous computing unit within the first operating duration is determined; the first power consumption metric model is used to indicate the corresponding relationship between the operating power consumption of the heterogeneous computing unit and the temperature information; according to a second power consumption metric model, the operating power consumption, and the load information, the total power consumption of the heterogeneous computing unit within the first operating duration is determined; the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the operating power consumption and the load information. In an embodiment of the present application, on the one hand, the temperature information of the heterogeneous computing unit is considered, which is applicable to special working conditions such as high temperature and low temperature, and can adapt to power consumption measurement in complex scenarios; on the other hand, combined with the first power consumption metric model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and power consumption measurement is performed based on the second power consumption metric model, without worrying about the problem that the actual power consumption of the heterogeneous computing unit deviates greatly from the fixed data in the laboratory, and can accurately reflect the true power consumption of the heterogeneous computing unit, and the model is easy to adjust. In this way, the accuracy and convenience of power consumption measurement of the heterogeneous computing unit are improved.

[0166] Optionally, the temperature information includes the operating temperature of the heterogeneous computing unit, and the operating power consumption includes the full-load power consumption of the heterogeneous computing unit that varies with the operating temperature. The processor 710 is specifically configured to: according to the operating frequency of the heterogeneous computing unit, search in a preset model library for a first power consumption metric model corresponding to the operating frequency; wherein, the first power consumption metric model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information.

[0167] In the above embodiment provided by the present application, the temperature information includes the operating temperature of the heterogeneous computing unit, and the operating power consumption includes the full-load power consumption of the heterogeneous computing unit that varies with the operating temperature. According to the operating frequency of the heterogeneous computing unit, search in a preset model library for a first power consumption metric model corresponding to the operating frequency; wherein, the first power consumption metric model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information. In this way, by calling a preset model for calculation, the calculation amount in the power consumption measurement process is reduced.

[0168] Optionally, the calculation formula of the first power consumption metric model is: The calculation formula of the second power consumption metric model is: wherein, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient of the operating temperature at the operating frequency f i , P base,i represents the static power consumption of the heterogeneous computing unit at the operating frequency f i , represents the heterogeneous computing unit at the operating frequency f iThe full-load power consumption that varies with the working temperature, T represents the first running duration, P idle represents the idle power consumption of the heterogeneous computing unit at the working frequency f i L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers.

[0169] In the above embodiments provided by the present application, the calculation formula of the first power consumption metric model is: The calculation formula of the second power consumption metric model is: wherein, T j represents the working temperature of the heterogeneous computing unit, m i represents the first influence coefficient at the working temperature under the working frequency f i P base,i represents the static power consumption of the heterogeneous computing unit at the working frequency f i represents the full-load power consumption that varies with the working temperature of the heterogeneous computing unit at the working frequency f i T represents the first running duration, P idle represents the idle power consumption of the heterogeneous computing unit at the working frequency f i L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinal numbers. In this way, considering the working temperature of the heterogeneous computing unit, combining the first power consumption metric model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption metric model, ensuring the accuracy of the power consumption measurement.

[0170] Optionally, the temperature information includes the working temperature and the working environment temperature of the heterogeneous computing unit, the working power consumption includes the instantaneous power consumption of the heterogeneous computing unit that varies with the working temperature and the working environment temperature, and the sensor 705 is further configured to: obtain the current and voltage information of the heterogeneous computing unit within the first running duration; the processor 710 is further configured to: construct a third power consumption metric model, where the third power consumption metric model is used to indicate the corresponding relationship between the instantaneous power consumption of the heterogeneous computing unit and the working temperature and the working environment temperature; train the third power consumption metric model according to the working temperature, the working environment temperature, and the current and voltage information to update the model parameters of the third power consumption metric model, and obtain the first power consumption metric model.

[0171] ​In the above embodiments provided by the present application, the temperature information includes the operating temperature and the operating environment temperature of the heterogeneous computing unit, the operating power consumption includes the instantaneous power consumption of the heterogeneous computing unit that varies with the operating temperature and the operating environment temperature, and the current-voltage information of the heterogeneous computing unit within the first operating duration is obtained; a third power consumption metric model is constructed, and the third power consumption metric model is used to indicate the corresponding relationship between the instantaneous power consumption of the heterogeneous computing unit and the operating temperature and the operating environment temperature; according to the operating temperature, the operating environment temperature, and the current-voltage information, the third power consumption metric model is trained to update the model parameters of the third power consumption metric model, and a first power consumption metric model is obtained. In this way, without relying on experimental data, an initial model for power consumption measurement is constructed and deployed, and then based on an online learning mechanism, combined with the multi-dimensional operating condition information of the heterogeneous computing unit, the initial model is optimized and trained to obtain a first power consumption metric model, so that the first power consumption metric model can be applied to a more complex environment and the labor cost of model construction is reduced.

[0172] Optionally, the calculation formula of the third power consumption metric model is: The calculation formula of the second power consumption metric model is: where, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient of the operating temperature at the operating frequency f i , T ambient represents the operating environment temperature of the heterogeneous computing unit, n i represents the second influence coefficient of the operating environment temperature at the operating frequency f i . represents the instantaneous power consumption of the heterogeneous computing unit that varies with the operating temperature and the operating environment temperature at the operating frequency f i , T represents the first operating duration, P idle represents the idle power consumption of the heterogeneous computing unit at the operating frequency f i , L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinals.

[0173] In the above embodiments provided by the present application, the calculation formula of the third power consumption metric model is: The calculation formula of the second power consumption metric model is: where, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient of the operating temperature at the operating frequency f i , T ambient represents the operating environment temperature of the heterogeneous computing unit, n i represents the second influence coefficient of the operating environment temperature at the operating frequency f i . Indicates the instantaneous power consumption of the heterogeneous computing unit changing with the operating temperature and the ambient temperature at the operating frequency f i where T represents the first running duration, and P idle Indicates the idle power consumption of the heterogeneous computing unit at the operating frequency f i where L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinals. In this way, considering the operating temperature and the ambient temperature of the heterogeneous computing unit, combining the first power consumption measurement model and the actual working conditions of the heterogeneous computing unit, the measurement scheme is adjusted in real time, and the power consumption is measured based on the second power consumption measurement model, ensuring the accuracy of the power consumption measurement.

[0174] Optionally, the model parameters include a first influence coefficient and a second influence coefficient. The processor 710 is specifically configured to: initialize the first influence coefficient and the second influence coefficient; input the operating temperature and the ambient temperature into a third power consumption measurement model to obtain a model prediction value; calculate a sample true value according to the current-voltage information; construct a loss function of the third power consumption measurement model; determine an error value between the model prediction value and the sample true value according to the loss function, the model prediction value, and the sample true value; and update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm until the error value converges when the error value does not converge.

[0175] In the above embodiments provided by the present application, the model parameters include a first influence coefficient and a second influence coefficient. The first influence coefficient and the second influence coefficient are initialized; the operating temperature and the ambient temperature are input into a third power consumption measurement model to obtain a model prediction value; a sample true value is calculated according to the current-voltage information; a loss function of the third power consumption measurement model is constructed; an error value between the model prediction value and the sample true value is determined according to the loss function, the model prediction value, and the sample true value; and the first influence coefficient and the second influence coefficient are updated based on the gradient descent algorithm until the error value converges when the error value does not converge. In this way, an initial model for power consumption measurement is constructed and deployed, and then based on an online learning mechanism, combined with the multi-dimensional working condition information of the heterogeneous computing unit, the initial model is optimized and trained to obtain a first power consumption measurement model, enabling the first power consumption measurement model to be applicable to a more complex environment, further improving the accuracy of the power consumption measurement, and not relying on experimental data, reducing the labor cost of model construction.

[0176] It should be understood that in the embodiments of the present application, the input unit 704 may include a Graphics Processing Unit (GPU) 7041 and a microphone 7042. The GPU 7041 processes the image data of static pictures or videos obtained by an image capturing device (such as a camera) in the video capturing mode or the image capturing mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also referred to as a touch screen. The touch panel 7071 may include two parts: a touch detection device and a touch controller. The other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.

[0177] The memory 709 can be used to store software programs and various data. The memory 709 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area can store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 709 can include a volatile memory or a non-volatile memory, or the memory 709 can include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 709 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.

[0178] The processor 710 may include one or more processing units; optionally, the processor 710 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor may not be integrated into the processor 710 either.

[0179] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above-mentioned power consumption determination method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0180] Among them, the processor is the processor in the electronic device in the above-mentioned embodiment. The readable storage medium includes computer-readable storage media, such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs, etc.

[0181] The embodiment of the present application further provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run a program or instruction to implement each process of the above-mentioned power consumption determination method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0182] It should be understood that the chip mentioned in the embodiment of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.

[0183] The embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement each process of the above-mentioned power consumption determination method embodiment and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.

[0184] It should be noted that in this text, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, article or device comprising such element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, but may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0185] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present application.

[0186] The embodiments of the present application have been described above with reference to the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them fall within the protection scope of the present application.

Claims

1. A power consumption determination method, characterized in that, Including: Obtain the temperature information and load information of the heterogeneous computing unit within the first running duration; Determine the working power consumption of the heterogeneous computing unit within the first running duration according to the temperature information and the first power consumption metric model; the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; Determine the total power consumption of the heterogeneous computing unit within the first running duration according to the second power consumption metric model, the working power consumption, and the load information; The second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption, load information.

2. The power consumption determination method according to claim 1, characterized in that The temperature information includes the working temperature of the heterogeneous computing unit, and the working power consumption includes the full-load power consumption of the heterogeneous computing unit varying with the working temperature. The method further includes: Search for the first power consumption metric model corresponding to the working frequency from a preset model library according to the working frequency of the heterogeneous computing unit; Wherein, the first power consumption metric model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information.

3. The power consumption determination method according to claim 1, wherein The calculation formula of the first power consumption metric model is: The calculation formula of the second power consumption metric model is: Among them, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient at the operating frequency f i under which, P base,i represents the static power consumption of the heterogeneous computing unit at the operating frequency f i under which, represents the full-load power consumption of the heterogeneous computing unit changing with the operating temperature at the operating frequency f i under which, T represents the first operating duration, P idle represents the idle power consumption of the heterogeneous computing unit at the operating frequency f i under which, L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinals.

4. The power consumption determination method according to claim 1, wherein The temperature information includes the working temperature and the working environment temperature of the heterogeneous computing unit, and the working power consumption includes the instantaneous power consumption of the heterogeneous computing unit varying with the working temperature and the working environment temperature. The method further includes: Obtain the current-voltage information of the heterogeneous computing unit within the first running duration; Construct a third power consumption metric model, which is used to indicate the corresponding relationship between the instantaneous power consumption of the heterogeneous computing unit and the working temperature, working environment temperature; Train the third power consumption metric model according to the working temperature, the working environment temperature, and the current-voltage information to update the model parameters of the third power consumption metric model, and obtain the first power consumption metric model.

5. The power consumption determination method according to claim 4, wherein The calculation formula of the third power consumption metric model is: The calculation formula of the second power consumption metric model is: Among them, T j represents the operating temperature of the heterogeneous computing unit, m i represents the first influence coefficient at the operating temperature under the operating frequency f i T ambient represents the operating ambient temperature of the heterogeneous computing unit, n i represents the second influence coefficient at the operating ambient temperature under the operating frequency f i represents the instantaneous power consumption of the heterogeneous computing unit changing with the operating temperature and the operating ambient temperature under the operating frequency f i T represents the first running duration, P idle represents the idle power consumption of the heterogeneous computing unit under the operating frequency f i L(t) represents the load ratio of the heterogeneous computing unit, t represents time, E represents the total power consumption of the heterogeneous computing unit, and both i and j are ordinals.​ 6. The power consumption determination method according to claim 5, wherein The model parameters include the first influence coefficient and the second influence coefficient. Training the third power consumption metric model according to the working temperature, the working environment temperature, and the current-voltage information includes: Initialize the first influence coefficient and the second influence coefficient; Input the working temperature and the working environment temperature into the third power consumption metric model to obtain a model prediction value; Calculate a sample true value according to the current-voltage information; Construct a loss function of the third power consumption metric model; Determine the error value between the model prediction value and the sample true value according to the loss function, the model prediction value, and the sample true value; In the case that the error value does not converge, update the first influence coefficient and the second influence coefficient based on the gradient descent algorithm until the error value converges.

7. A power consumption determination device, characterized in that, Including: An acquisition unit, configured to obtain the temperature information and load information of the heterogeneous computing unit within the first running duration; A processing unit, configured to determine the working power consumption of the heterogeneous computing unit within the first running duration according to the temperature information and a first power consumption metric model; the first power consumption metric model is used to indicate the corresponding relationship between the working power consumption of the heterogeneous computing unit and the temperature information; The processing unit is further configured to determine the total power consumption of the heterogeneous computing unit within the first running duration according to a second power consumption metric model, the working power consumption, and the load information; the second power consumption metric model is used to indicate the corresponding relationship between the total power consumption of the heterogeneous computing unit and the working power consumption and the load information.

8. The power consumption determination device according to claim 7, wherein The temperature information includes the working temperature of the heterogeneous computing unit, the working power consumption includes the full-load power consumption of the heterogeneous computing unit varying with the working temperature, and the processing unit is further configured to: Search for a first power consumption metric model corresponding to the working frequency from a preset model library according to the working frequency of the heterogeneous computing unit; Wherein, the first power consumption metric model is used to indicate the corresponding relationship between the full-load power consumption of the heterogeneous computing unit at different times and the temperature information.

9. An electronic device, characterized in that, Comprising a processor and a memory, the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the power consumption determination method according to any one of claims 1 to 6 are implemented.

10. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, the steps of the power consumption determination method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Power determination method, switch, storage medium and program product

    CN121217492A