Energy consumption management method and device, electronic equipment and storage medium
By sensing the application scenarios and operating status of electronic devices in real time, selecting appropriate energy consumption prediction models, and adjusting computing resource allocation parameters, the problem of energy consumption management of electronic devices being unable to adapt to dynamic changes is solved, and energy consumption optimization and performance assurance are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- RDA MICROELECTRONICS SHANGHAICO LTD
- Filing Date
- 2026-04-10
- Publication Date
- 2026-06-16
AI Technical Summary
In existing technologies, the energy management methods of electronic devices are difficult to adapt to dynamically changing scenario requirements, resulting in insufficient energy optimization effects.
By acquiring the operating status data of electronic devices, generating state feature vectors, determining the current application scenario, selecting a suitable energy consumption prediction model (such as stochastic gradient descent prediction model and adaptive moment estimation prediction model), and adjusting computing resource allocation parameters, including frequency, memory allocation, and task scheduling, based on the energy consumption prediction value.
It achieves energy consumption prediction and adaptive allocation of computing resources based on application scenarios, effectively reducing the energy consumption of electronic devices while ensuring model inference performance.
Smart Images

Figure CN122220107A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic equipment technology, and in particular to an energy management method, apparatus, electronic device and storage medium. Background Technology
[0002] With the widespread application of artificial intelligence (AI) technology, energy management has become an important aspect of improving the performance of electronic devices and the user experience.
[0003] In related technologies, the energy management methods of electronic devices usually adopt fixed rules or static configurations, which are difficult to adapt to dynamically changing scenario requirements, resulting in insufficient energy optimization effects. Summary of the Invention
[0004] This application provides an energy management method, apparatus, electronic device, and storage medium, which can solve the technical problem that energy management methods in related technologies are difficult to adapt to dynamically changing scenario requirements.
[0005] In a first aspect, this application provides an energy consumption management method, which includes:
[0006] Acquire the operating status data of electronic devices, and generate a status feature vector based on the operating status data;
[0007] Determine the current application scenario of the electronic device, and select an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario; the candidate energy consumption prediction models include stochastic gradient descent prediction model and adaptive moment estimation prediction model.
[0008] Based on the above state feature vector, the energy consumption of electronic devices within a preset time period is predicted using an energy consumption prediction model.
[0009] Based on the above energy consumption values, adjust the computing resource allocation parameters of the electronic devices.
[0010] In some implementations, the selection of an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario includes:
[0011] When the above application scenario is the first application scenario, the stochastic gradient descent prediction model is selected as the energy consumption prediction model; when the above application scenario is the second application scenario, the adaptive moment estimation prediction model is selected as the energy consumption prediction model.
[0012] In the first application scenario, the load on the electronic device is less than a preset load threshold, and / or the electronic device is not currently running a model inference task; in the second application scenario, the load on the electronic device is greater than or equal to the load threshold, and / or the electronic device is currently running a model inference task.
[0013] In some implementations, the computing resource allocation parameters of the electronic device are adjusted based on the energy consumption value, including:
[0014] The frequency of the computing unit is adjusted according to the current frequency and energy consumption of the computing unit of the electronic device and the maximum energy consumption of the electronic device; and / or, the scheduling method of each task is adjusted according to the energy consumption of each task currently running in the electronic device within a preset time period and the priority of each task; wherein, the energy consumption of each task within the preset time period is determined based on the resource utilization rate of each task and the aforementioned energy consumption value.
[0015] In some embodiments, the above method further includes:
[0016] Acquire historical operating status data and historical energy consumption values of electronic devices;
[0017] Based on historical operating status data and historical energy consumption values, the model to be trained is trained to generate a stochastic gradient descent prediction model and an adaptive moment estimation prediction model.
[0018] In some embodiments, the above method further includes:
[0019] Monitor the performance parameters and user feedback information of electronic devices;
[0020] Based on the performance parameters of the electronic device and user feedback, adjust the parameters of the stochastic gradient descent prediction model and the adaptive moment estimation prediction model, and / or adjust the computational resource allocation parameters.
[0021] In some implementations, the above-mentioned operational status data includes at least one of the following:
[0022] The utilization rate of computing units, memory usage, battery status data, and network bandwidth usage; the aforementioned computing units include at least one of a central processing unit, a graphics processing unit, and an embedded neural network processor.
[0023] Secondly, embodiments of this application provide an energy management device, the device comprising:
[0024] The acquisition module is used to acquire the operating status data of the electronic device and generate a status feature vector based on the operating status data.
[0025] The selection module is used to determine the current application scenario of the electronic device and select an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario. The candidate energy consumption prediction models include stochastic gradient descent prediction model and adaptive moment estimation prediction model.
[0026] The prediction module is used to predict the energy consumption of electronic devices within a preset time period based on the state feature vector and the energy consumption prediction model.
[0027] The processing module is used to adjust the computing resource allocation parameters of electronic devices based on energy consumption values.
[0028] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0029] The memory stores the instructions that the computer executes;
[0030] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0031] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0032] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0033] Sixthly, embodiments of this application provide a chip including at least one processor for executing program instructions to perform the above-described energy management method.
[0034] The energy management method, apparatus, electronic device, and storage medium provided in this application embodiment can accurately select an energy consumption prediction model suitable for the current application scenario by determining the current application scenario of the electronic device. At the same time, by collecting the operating status data of the electronic device in real time, energy consumption prediction based on the application scenario can be realized based on the operating status data and the energy consumption prediction model. Furthermore, the computing resource allocation parameters can be adaptively adjusted based on the predicted energy consumption value, thereby effectively reducing the energy consumption of the electronic device while ensuring the model inference performance. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0036] Figure 1 This is a flowchart illustrating an energy management method provided in an embodiment of this application;
[0037] Figure 2 This is a schematic diagram of a sub-process of an energy management method provided in an embodiment of this application;
[0038] Figure 3 This is a schematic diagram of the structure of an energy management device provided in the embodiments of this application;
[0039] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0040] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0041] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0042] In this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0043] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with essentially the same function and purpose. For example, the first sub-buffer and the second sub-buffer are merely used to distinguish different sub-buffers and do not limit their order. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0044] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following associated objects have an "or" relationship.
[0045] The electronic devices in this application embodiment may include handheld devices, vehicle-mounted devices, etc., with wireless communication capabilities. For example, some electronic devices include: mobile phones, tablets, PDAs, laptops, mobile internet devices (MIDs), virtual reality (VR) devices, augmented reality (AR) devices, wireless terminal devices in industrial control, wireless terminal devices in self-driving, wireless terminal devices in remote medical surgery, wireless terminal devices in smart grids, wireless terminal devices in transportation safety, wireless terminal devices in smart cities, wireless terminal devices in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to wireless modems, in-vehicle devices, wearable devices, terminal devices in 5G networks, or future evolution of public land mobile communication networks. Terminal devices in a network (PLMN), etc., are not limited in this embodiment.
[0046] By way of example and not limitation, in this embodiment, the electronic device may also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that are intelligently designed and developed using wearable technology, such as glasses, gloves, watches, clothing, and shoes.
[0047] In this embodiment of the application, the device used to implement the function of the electronic device can be a terminal device; or it can be a device that enables the electronic device to implement the function, such as a chip system, which can be installed in the electronic device.
[0048] With the rapid development of artificial intelligence (AI) technology, electronic devices are gradually becoming the carriers for complex models such as large language models (LLM), image recognition, and speech processing.
[0049] In practical applications, the energy consumption problem of model inference tasks is becoming increasingly prominent, and electronic devices face severe energy consumption challenges when running model inference tasks.
[0050] Taking smartphones as an example, users' needs vary significantly in different scenarios. In standby mode, the device needs to maintain low power consumption to extend battery life; while when running high-load model inference tasks (such as real-time video analysis, game rendering, or speech recognition), computing resources need to be dynamically allocated to ensure performance.
[0051] Furthermore, in edge computing scenarios, devices need to handle complex model inference tasks with limited energy supply, such as real-time image recognition in industrial quality inspection or environmental perception tasks in autonomous driving.
[0052] In related technologies, the energy consumption management methods for electronic devices mainly adopt the following two approaches:
[0053] Static or semi-static resource allocation strategies: These strategies allocate resources through preset rules (such as fixed frequency or memory allocation ratio) or simple threshold judgments based on historical data (such as "reduce frequency when CPU utilization is >80%)". While these solutions are low-cost to implement, they lack adaptability to real-time changes in scenarios. For example, they cannot adjust resources promptly when AI task loads surge, leading to performance bottlenecks or energy waste.
[0054] Energy consumption prediction based on simple machine learning models: Some solutions use models such as linear regression and decision trees to predict energy consumption and combine them with fixed rules for resource scheduling. For example, a model is trained using historical data to predict the energy consumption of a specific AI task, and then a resource allocation strategy is set based on the prediction results. However, such models have limited accuracy when dealing with high-dimensional, nonlinear energy consumption prediction problems (such as the coordinated scheduling of multiple heterogeneous computing resources) and are difficult to adapt to dynamically changing operating environments (such as temperature fluctuations and battery aging).
[0055] In summary, there is an urgent need for an intelligent solution that can sense changes in application scenarios in real time and dynamically adjust resource allocation to optimize the energy consumption of electronic devices, so as to meet the energy efficiency balance requirements of electronic devices in multiple scenarios, improve user experience and battery life.
[0056] To address the aforementioned technical issues, this application provides an energy management method that, by real-time sensing of the application scenarios of electronic devices and combining the operating status data of the electronic devices, enables scenario-based energy consumption prediction and adaptive allocation of computing resources. This effectively reduces the energy consumption of electronic devices while ensuring model inference performance.
[0057] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0058] The technical solution provided in this application can be applied to energy management scenarios when electronic devices are running LLM or other complex AI models.
[0059] Optionally, the aforementioned computing resources may include, but are not limited to, heterogeneous computing resources such as CPUs, graphics processing units (GPUs), and embedded neural network processing units (NPUs), as well as memory and bandwidth.
[0060] like Figure 1 As shown, Figure 1 This is a flowchart illustrating an energy management method provided in an embodiment of this application.
[0061] In some embodiments, the above energy management method includes:
[0062] S101. Obtain the operating status data of the electronic device, and generate a status feature vector based on the operating status data.
[0063] Optionally, the above-mentioned operating status data includes at least one of the following: computing unit utilization, memory occupancy, battery status data, network bandwidth utilization, and network status data.
[0064] Optionally, the aforementioned computing unit may include at least one of a CPU, GPU, and NPU.
[0065] The utilization rate of computing units reflects the real-time load on computing resources and can be used as a basis for adjusting the frequency of computing units. For example, when the CPU utilization rate is greater than 70%, the CPU frequency can be increased to improve CPU performance, and when the CPU utilization rate is less than 30%, the CPU frequency can be decreased to reduce the power consumption of electronic devices.
[0066] Memory utilization can be used to guide memory allocation and reclamation strategies. For example, when memory utilization is greater than 80%, garbage collection or memory compaction can be triggered to release idle memory; memory-intensive tasks (such as large model inference) can pre-allocate large memory blocks to avoid performance degradation caused by frequent allocation.
[0067] Optionally, battery status data may include remaining battery power, charging status, remaining battery life, and power consumption data.
[0068] Battery status data can be used to select resource allocation strategies. For example, when the battery is low (e.g., <20%), a power-saving mode can be triggered to reduce the frequency of computing units and limit the concurrency of background tasks, thereby extending the battery life of electronic devices; while when charging, more computing resources can be released for high-performance tasks.
[0069] Network bandwidth utilization can be used to optimize network resource allocation and traffic shaping. For example, a fixed bandwidth (e.g., 100Mbps) can be reserved for critical tasks (such as video conferencing), while the remaining bandwidth can be dynamically allocated for non-critical tasks (such as file downloads). Alternatively, a token bucket algorithm can be used to limit bursts of traffic from non-critical tasks to prevent them from preempting bandwidth for critical tasks.
[0070] Optionally, operational status data can be collected through the electronic device's built-in Application Programming Interface (API), monitoring tools, or hardware sensors.
[0071] In this embodiment of the application, by collecting real-time operating status data of electronic devices, the resource status of electronic devices can be dynamically perceived, providing basic data support for subsequent prediction of the energy consumption of electronic devices.
[0072] S102. Determine the current application scenario of the electronic device, and select an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario.
[0073] Optionally, the above candidate energy consumption prediction models include the Stochastic Gradient Descent (SGD) prediction model and the Adaptive Moment Estimation (Adam) prediction model.
[0074] In some implementations, the above-mentioned candidate energy consumption prediction models may also include Adagrad prediction models, root mean square propagation (RMSProp) prediction models, etc., and no limitation is made in the embodiments of this application.
[0075] In some implementations, pre-trained machine learning models (such as classifiers) can be used to determine the current application scenario of an electronic device, such as standby scenario, video playback scenario, communication scenario, gaming scenario, etc.
[0076] In some implementations, a pre-trained machine learning model can be used to determine the task type of the electronic device currently running, such as model inference, network requests, user interface (UI) refresh, etc.
[0077] In some implementations, an energy consumption prediction model can be selected from the multiple candidate energy consumption prediction models based on the application scenario and / or the task type described above.
[0078] In some implementations, energy consumption prediction models corresponding to application scenarios and / or task types can be determined based on predefined rules. For example:
[0079] For standby scenarios, the SGD prediction model (prioritizing low computational overhead) or the Adagrad prediction model is recommended.
[0080] The game scene corresponds to the Adam prediction model (prioritizing high accuracy and fast convergence) or the RMSProp prediction model.
[0081] AI inference scenarios correspond to the Adam prediction model (adapting to non-stationary data and improving inference accuracy) or the RMSProp prediction model;
[0082] Hybrid scenarios (such as games + AI reasoning) correspond to dynamic weight fusion (such as the weighted average of SGD + Adam, or adjusting weights through reinforcement learning).
[0083] Optionally, the weights of the prediction model can be adjusted in real time through Bayesian optimization, reinforcement learning, or online learning. For example, in a video playback scenario, if a sudden increase in CPU load is detected, the weights of the Adam prediction model can be increased to improve prediction accuracy.
[0084] Optionally, when the application scenario of electronic devices changes, the above energy consumption prediction model can be switched according to the latest application scenario of the electronic devices.
[0085] For example, an electronic device uses the SGD prediction model to predict energy consumption in a standby scenario. When the electronic device switches from a standby scenario to a gaming scenario, it can switch to the Adam prediction model to predict the energy consumption value of the electronic device.
[0086] It should be noted that there is no sequential relationship between the above steps S101 and S102. In some embodiments, S102 can be executed first, followed by S101; or steps S101 and S102 can be executed simultaneously.
[0087] S103. Based on the state feature vector, use the energy consumption prediction model to predict the energy consumption value of the electronic device within a preset time period.
[0088] In some implementations, the aforementioned state feature vector can be used as the input to the energy consumption prediction model, and the output of the energy consumption prediction model can be used as the energy consumption value of the electronic device within a preset time period.
[0089] S104. Adjust the computing resource allocation parameters of the electronic equipment according to the energy consumption value.
[0090] In some implementations, the voltage frequency, memory allocation method, and / or task scheduling of heterogeneous computing resources (such as CPU, GPU, NPU) can be adjusted based on the predicted energy consumption of electronic devices within a preset time period.
[0091] For example, the frequency of the CPU / GPU / NPU can be adjusted based on the predicted energy consumption value. For instance, if the predicted energy consumption value is greater than a set threshold, the CPU frequency can be reduced (e.g., from 2.0GHz to 1.5GHz) to reduce dynamic energy consumption; if the predicted energy consumption value is lower than the set threshold, the CPU frequency can be increased to improve performance.
[0092] For example, memory allocation can be adjusted based on predicted energy consumption values. For instance, in low-energy-consumption scenarios, memory usage can be reduced to decrease memory refresh power consumption; in high-energy-consumption scenarios, memory capacity can be expanded to avoid frequent page swapping.
[0093] For example, tasks can be dynamically allocated to different cores based on the predicted energy consumption values. For instance, in low-energy-consumption scenarios, a multi-core CPU can shut down some cores (such as reducing from 8 cores to 4 cores) to reduce static power consumption; in high-energy-consumption scenarios, all cores can be activated to improve parallel processing capabilities.
[0094] The energy management method provided in this application embodiment can accurately select an energy consumption prediction model suitable for the current application scenario by determining the current application scenario of the electronic device. At the same time, by collecting the operating status data of the electronic device in real time, it can realize energy consumption prediction based on the application scenario based on the operating status data and the energy consumption prediction model. Then, it can adaptively adjust the computing resource allocation parameters based on the predicted energy consumption value, effectively reducing the energy consumption of the electronic device while ensuring the model inference performance.
[0095] In some embodiments, the selection of an energy consumption prediction model from multiple candidate energy consumption prediction models according to the application scenario includes:
[0096] When the application scenario is the first application scenario, the SGD prediction model is selected as the energy consumption prediction model; when the application scenario is the second application scenario, the Adam prediction model is selected as the energy consumption prediction model.
[0097] Alternatively, the Adagrad prediction model can be selected when the application scenario is the first application scenario, and the RMSProp prediction model can be selected when the application scenario is the second application scenario. No restrictions are imposed in this application embodiment.
[0098] In the first application scenario, the load on the electronic device is less than the load threshold, and / or the electronic device is not currently running a model inference task; in the second application scenario, the load on the electronic device is greater than or equal to the load threshold, and / or the electronic device is currently running a model inference task.
[0099] For example, the first application scenario can also be called a low-load scenario, where the load on the electronic device is less than a preset threshold (e.g., CPU utilization < 30%, memory usage < 50%, network bandwidth < 100Mbps). Typical scenarios include standby, lightweight background tasks (e.g., music playback, push notifications), and ordinary applications that are not model inference (e.g., document editing, web browsing).
[0100] The second application scenario can also be called a high-load scenario, where the load on electronic devices is greater than or equal to a preset threshold. Typical scenarios include games, video rendering, AI inference (such as image recognition and speech processing), large file transfers, and high-concurrency network requests.
[0101] For low-load scenarios and non-model inference tasks, where computing resources are sufficient, it is necessary to prioritize minimizing computational overhead. The SGD prediction model updates parameters iteratively using single samples, resulting in low computational complexity and small memory footprint, making it suitable for mobile devices with limited computing resources.
[0102] For high-load scenarios, due to the high load of electronic devices and drastic data changes (such as sudden loads in gaming scenarios and frame rate fluctuations in video rendering), the Adam prediction model, by adaptively adjusting the learning rate of each parameter (based on first-order and second-order moment estimation), has stronger robustness to non-stationary data, faster convergence speed, and higher accuracy.
[0103] For low-load scenarios with model inference tasks, model inference tasks (such as AI inference) usually involve high computational load and high memory usage, and the data has non-stationary characteristics (such as the inference load changing with the input data). The adaptive learning rate of the Adam prediction model can better handle this complexity and improve prediction accuracy.
[0104] The energy management method provided in this application embodiment can accurately select a suitable energy consumption prediction model based on the current application scenario of the electronic device, and realize energy consumption prediction based on the application scenario.
[0105] like Figure 2 As shown, Figure 2 This is a schematic diagram of a sub-process of an energy management method provided in an embodiment of this application.
[0106] In some embodiments, the above energy management method further includes:
[0107] S201. Obtain historical operating status data and historical energy consumption values of electronic devices.
[0108] For example, historical operating status data of electronic devices at multiple points in time can be obtained, and after normalization and feature extraction, a status feature vector for each point in time can be generated.
[0109] Furthermore, the energy consumption values of electronic devices within a preset time period after each time point can be obtained. Based on the state feature vectors at each time point and the energy consumption values within a preset time period after each time point, multiple training samples can be generated, such as (x i y i ); where x i y represents the state feature vector at time point i. i This represents the energy consumption value within a preset duration after time point i.
[0110] S202. Based on historical operating status data and historical energy consumption values, train the model to be trained to generate a stochastic gradient descent prediction model and an adaptive moment estimation prediction model.
[0111] In some implementations, the training process for an SGD prediction model may include:
[0112] (1) Initialize parameters .
[0113] Optional, Small random numbers can be used, such as a Gaussian distribution with a mean of 0 and a standard deviation of 0.01.
[0114] (2) Calculate a single sample (x) i y i gradient of ) :
[0115] ;
[0116] The current parameters can be calculated based on a loss function, such as mean-square error (MSE). The gradient.
[0117] (3) Update parameters :
[0118] ;
[0119] in, This represents the learning rate, which controls the step size for each update.
[0120] In some implementations, the parameter θ can be adjusted according to the learning rate α, and the update can be stopped when a preset number of iterations (such as 1000 times) is reached, or the gradient change is less than a threshold, or the loss function value L(θ) no longer decreases significantly.
[0121] Among them, learning rate It can be dynamically adjusted (e.g., initially large, then gradually decreasing) to balance convergence speed and stability.
[0122] In some implementations, the training process for the Adam prediction model may include:
[0123] (1) Initialize parameters First-order momentum (mean) m0 and second-order momentum (uncentered variance) v0.
[0124] in, It can be initialized randomly, such as with a small random number or zero).
[0125] Hyperparameters include:
[0126] Learning rate α (default: 0.001);
[0127] First-order momentum decay rate β1 (default: 0.9);
[0128] Second-order momentum decay rate β2 (default: 0.999).
[0129] Numerical stability constant ϵ (default: 10−8, to prevent division by zero).
[0130] Time step t=0.
[0131] (2) Calculate a single sample (x) i y i The gradient gt of )
[0132] ;
[0133] For example, assuming the loss function is MSE, then:
[0134] ;
[0135] (3) Update the first-order momentum estimate m t and second-order momentum estimation v t :
[0136] ;
[0137] ;
[0138] (4) Calculate deviation correction:
[0139] ;
[0140] ;
[0141] (5) Update parameter θ:
[0142] ;
[0143] In some implementations, the maximum number of iterations T is reached, or the gradient norm is less than a specified threshold, or the loss function value L(θ) is reached. t When the convergence condition is met, updates will stop.
[0144] The energy management method provided in this application embodiment can train and generate an energy consumption prediction model based on the historical operating status data and historical energy consumption values of electronic devices. This allows for accurate prediction of the energy consumption of electronic devices within a preset time period based on the operating status data of the electronic devices. Furthermore, it enables adaptive adjustment of computing resource allocation parameters based on the predicted energy consumption values, effectively reducing the energy consumption of electronic devices while ensuring the inference performance of the model.
[0145] In some embodiments, the computing resource allocation parameters of electronic devices can be dynamically adjusted based on the predicted energy consumption value, including adjusting the frequency, memory allocation, and task scheduling of heterogeneous computing resources such as CPU, GPU, and NPU.
[0146] In some implementations, the frequency of the computing unit can be adjusted based on the current frequency of the computing unit of the electronic device, the predicted energy consumption value, and the maximum energy consumption value of the electronic device.
[0147] For example, the frequencies of heterogeneous computing units such as CPU, GPU, and NPU are detected in real time, and the frequencies of these computing units are adjusted based on the current frequency of the computing units and the predicted power consumption value.
[0148] Optionally, the frequency of the above computing units can be adjusted in the following ways:
[0149] ;
[0150] Among them, f new f represents the frequency after adjustment of the computing unit. current P represents the current frequency of the computing unit. predicted P represents the predicted power consumption value. max This indicates the maximum power consumption of the electronic device.
[0151] In some embodiments, the scheduling method of each task can be adjusted based on the energy consumption of each task currently running on the electronic device within a preset time period and the priority of each task.
[0152] The energy consumption of each task within the preset time period can be determined based on the resource occupancy rate of each task and the predicted energy consumption value mentioned above.
[0153] For example, suppose the tasks currently being performed by the electronic device include {T1, T2, ..., T...} n If so, tasks can be dynamically scheduled according to the following scheduling strategy:
[0154] ;
[0155] Among them, U i Represents task T i priority, E i Represents task T i Predicted energy consumption, T priority This indicates the task that is scheduled with priority.
[0156] In some implementations, the scheduling order of the above tasks can be adjusted according to the tasks with determined priority.
[0157] In some embodiments, the computing resource allocation parameters of an electronic device can be adjusted based on the predicted energy consumption and the total latency of the various tasks currently running on the electronic device.
[0158] The following objective function can be used to balance the energy consumption and performance of electronic devices:
[0159] ;
[0160] Among them, E total It is the total energy consumption of electronic devices, D total This is the total delay mentioned above. It is the weighting coefficient.
[0161] In some embodiments, under high-energy-consumption scenarios, Dynamic Voltage and Frequency Scaling (DVFS) technology can be used to reduce the frequency of heterogeneous computing resources such as CPUs, GPUs, and NPUs, and dynamically allocate tasks based on energy consumption predictions. Additionally, high-energy-consumption tasks can be migrated to lower-power cores or devices.
[0162] In low-power scenarios, DVFS technology can be used to increase the frequency of heterogeneous computing resources such as CPU, GPU, and NPU, thereby optimizing resource utilization. Additionally, it can merge multiple low-priority tasks to improve resource utilization.
[0163] The energy management method provided in this application can adaptively adjust the computing resource allocation parameters according to the predicted energy consumption value, thereby effectively reducing the energy consumption of electronic devices while ensuring the model inference performance.
[0164] In some embodiments, the above method further includes:
[0165] Monitor the performance parameters of electronic devices and user feedback information; adjust the parameters of the stochastic gradient descent prediction model and the adaptive moment estimation prediction model, and / or adjust the computational resource allocation parameters based on the performance parameters of electronic devices and user feedback information.
[0166] The energy management method provided in this application introduces a feedback and adaptive optimization mechanism, which can continuously adjust the optimization strategy according to the actual operating conditions, thereby further improving the performance of electronic devices and the level of intelligence in energy management.
[0167] In some embodiments, this application also provides an energy management device. (Refer to...) Figure 3 , Figure 3 This is a schematic diagram of an energy management device provided in an embodiment of this application. The energy management device 30 may include:
[0168] The acquisition module 301 is used to acquire the operating status data of the electronic device and generate a status feature vector based on the operating status data.
[0169] Selection module 302 is used to determine the current application scenario of the electronic device and select an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario; the candidate energy consumption prediction models include stochastic gradient descent prediction model and adaptive moment estimation prediction model.
[0170] The prediction module 303 is used to predict the energy consumption of electronic devices within a preset time period based on the state feature vector and the energy consumption prediction model.
[0171] The processing module 304 is used to adjust the computing resource allocation parameters of the electronic device according to the energy consumption value.
[0172] In some implementations, the selection module 302 is used for:
[0173] When the above application scenario is the first application scenario, the stochastic gradient descent prediction model is selected as the energy consumption prediction model; when the above application scenario is the second application scenario, the adaptive moment estimation prediction model is selected as the energy consumption prediction model.
[0174] In the first application scenario, the load on the electronic device is less than a preset load threshold, and / or the electronic device is not currently running a model inference task; in the second application scenario, the load on the electronic device is greater than or equal to the load threshold, and / or the electronic device is currently running a model inference task.
[0175] In some implementations, the processing module 304 is used to:
[0176] The frequency of the computing unit is adjusted according to the current frequency and energy consumption of the computing unit of the electronic device and the maximum energy consumption of the electronic device; and / or, the scheduling method of each task is adjusted according to the energy consumption of each task currently running in the electronic device within a preset time period and the priority of each task; wherein, the energy consumption of each task within the preset time period is determined based on the resource utilization rate of each task and the aforementioned energy consumption value.
[0177] In some embodiments, the above-described apparatus further includes a pre-training module for:
[0178] Acquire historical operating status data and historical energy consumption values of electronic devices;
[0179] Based on historical operating status data and historical energy consumption values, the model to be trained is trained to generate a stochastic gradient descent prediction model and an adaptive moment estimation prediction model.
[0180] In some implementations, the processing module 304 is further configured to:
[0181] Monitor the performance parameters and user feedback information of electronic devices;
[0182] Based on the performance parameters of the electronic device and user feedback, adjust the parameters of the stochastic gradient descent prediction model and the adaptive moment estimation prediction model, and / or adjust the computational resource allocation parameters.
[0183] In some implementations, the above-mentioned operational status data includes at least one of the following:
[0184] The utilization rate of computing units, memory usage, battery status data, and network bandwidth usage; the aforementioned computing units include at least one of a central processing unit, a graphics processing unit, and an embedded neural network processor.
[0185] The energy management device provided in this application embodiment can execute the energy management method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0186] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the electronic device 40 further includes a communication interface 403. The processor 401, memory 402, and communication interface 403 are connected via a bus.
[0187] In the specific implementation process, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to execute the above-mentioned energy management method.
[0188] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0189] In the above embodiments, it should be understood that the processor can be a CPU, or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules within the processor.
[0190] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0191] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0192] This application also provides a chip including at least one processor for executing program instructions to perform the above-described energy management method.
[0193] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described energy management method.
[0194] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described energy management method.
[0195] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0196] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside within an ASIC. Alternatively, the processor and the readable storage medium can exist as discrete components in a device.
[0197] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0198] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
Claims
1. An energy consumption management method, characterized in that, The method includes: Acquire the operating status data of the electronic device, and generate a status feature vector based on the operating status data; The current application scenario of the electronic device is determined, and an energy consumption prediction model is selected from multiple candidate energy consumption prediction models based on the application scenario; the candidate energy consumption prediction models include stochastic gradient descent prediction model and adaptive moment estimation prediction model. Based on the state feature vector, the energy consumption value of the electronic device is predicted within a preset time period using the energy consumption prediction model. The computing resource allocation parameters of the electronic device are adjusted based on the energy consumption value.
2. The method according to claim 1, characterized in that, The step of selecting an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario includes: When the application scenario is the first application scenario, the stochastic gradient descent prediction model is selected as the energy consumption prediction model; When the application scenario is the second application scenario, the adaptive moment estimation prediction model is selected as the energy consumption prediction model; In the first application scenario, the load of the electronic device is less than a preset load threshold, and / or the electronic device is not currently running a model inference task; in the second application scenario, the load of the electronic device is greater than or equal to the load threshold, and / or the electronic device is currently running a model inference task.
3. The method according to claim 1, characterized in that, The step of adjusting the computing resource allocation parameters of the electronic device based on the energy consumption value includes: Adjust the frequency of the computing unit based on the current frequency of the computing unit of the electronic device, the energy consumption value, and the maximum energy consumption value of the electronic device; and / or, Based on the energy consumption of each task currently running in the electronic device within a preset time period and the priority of each task, the scheduling method of each task is adjusted; wherein, the energy consumption of each task within the preset time period is determined based on the resource occupancy rate of each task and the energy consumption value.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Obtain the historical operating status data and historical energy consumption values of the electronic device; Based on the historical operating status data and the historical energy consumption value, the model to be trained is trained to generate the stochastic gradient descent prediction model and the adaptive moment estimation prediction model.
5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Monitor the performance parameters and user feedback information of the electronic device; Based on the performance parameters of the electronic device and user feedback information, adjust the parameters of the stochastic gradient descent prediction model and the adaptive moment estimation prediction model, and / or adjust the computational resource allocation parameters.
6. The method according to claim 1, characterized in that, The operational status data includes at least one of the following: The computing unit utilization rate, memory occupancy rate, battery status data, and network bandwidth utilization rate; the computing unit includes at least one of a central processing unit, a graphics processing unit, and an embedded neural network processor.
7. An energy management device, characterized in that, The device includes: The acquisition module is used to acquire the operating status data of the electronic device and generate a status feature vector based on the operating status data. The selection module is used to determine the current application scenario of the electronic device, and select an energy consumption prediction model from multiple candidate energy consumption prediction models based on the application scenario; the candidate energy consumption prediction models include stochastic gradient descent prediction model and adaptive moment estimation prediction model. The prediction module is used to predict the energy consumption value of the electronic device within a preset time period based on the state feature vector and the energy consumption prediction model. The processing module is used to adjust the computing resource allocation parameters of the electronic device based on the energy consumption value.
8. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the energy management method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the energy management method as described in any one of claims 1-6.
10. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the energy management method as described in any one of claims 1-6.