Frequency modulation method, training method of frequency regulation neural network and electronic device

Through frequency adjustment neural network and reinforcement learning technology, the CPU frequency of electronic devices is adjusted, which solves the problems of fast power consumption, severe heat generation and lag in electronic devices when running game applications, and achieves the balance between game performance and power consumption, improving users Experience.

CN117130769BActive Publication Date: 2024-09-06HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310210010.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-25
Publication Date
2024-09-06
Estimated Expiration
2043-02-25

AI Technical Summary

Technical Problem

When running game applications, existing electronic devices often consume fast power, severe heat, and stutter due to hardware resource limitations, making it difficult to reasonably adjust the CPU frequency to improve game performance.

Method used

The frequency adjustment neural network is adopted to obtain system status information such as load and frame rate, adjust the CPU frequency to balance performance and energy consumption, and combine reinforcement learning training to obtain a frequency adjustment neural network that matches the application requirements.

Benefits of technology

On the premise of ensuring gaming performance, minimize CPU power consumption, improve user experience, and achieve fine adjustment of CPU frequency and load balancing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117130769B
    Figure CN117130769B
Patent Text Reader

Abstract

The present application provides a frequency modulation method, a training method for a frequency regulation neural network, and an electronic device, and relates to the field of artificial intelligence. The method is used to balance the frequency and energy consumption of the CPU under the premise of ensuring the performance of a preset application. The method includes: for any target CPU cluster, obtaining system status information, the system status information includes a first load, a second load, a third load, and a frame rate of a preset application, wherein the first load is the sum of the loads of all threads, the second load is the sum of the loads of threads that are bound to the target CPU cluster, and the third load is the load of the target CPU cluster; inputting the system status information into the frequency regulation neural network corresponding to the target CPU cluster, obtaining the target operating frequency output by the frequency regulation neural network corresponding to the target CPU cluster; setting the operating frequency of the target CPU cluster to the target operating frequency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a frequency modulation method, a training method for a frequency regulation neural network, and an electronic device. Background Art

[0002] As electronic devices become more powerful, more and more applications are installed in them. Take game applications as an example. With the improvement of game image quality, the richness of game play and game scenes, higher requirements are placed on the performance of electronic devices.

[0003] At present, when electronic devices run game applications, they often have problems such as fast power consumption, severe heat generation, and lag. This is all due to the limitations of the system resources (e.g., hardware resources) of the electronic device. For example, in order to ensure the smoothness of the game, the electronic device can run at the highest frequency of the central processing unit (CPU), but if the CPU runs at the highest frequency for a long time, it will cause the temperature of the electronic device to be too high. Therefore, the electronic device must reduce the frequency of the CPU to reduce the temperature, but after the CPU frequency is reduced, the smoothness of the game will decrease, affecting the user's gaming experience.

[0004] Therefore, how to reasonably adjust the CPU frequency and improve game performance becomes a problem that needs to be considered. Summary of the invention

[0005] The embodiments of the present application provide a frequency modulation method, a training method for a frequency regulation neural network, and an electronic device, which are used to balance the frequency and energy consumption of a CPU while ensuring the performance of a preset application.

[0006] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0007] In a first aspect, the present application provides a frequency modulation method, wherein an electronic device runs a preset application, the preset application includes multiple threads, the multiple threads include a thread that is bound to a CPU cluster of the electronic device, the CPU cluster of the electronic device includes a target CPU cluster corresponding to a frequency regulation neural network, and the frequency regulation neural network is used to adjust the operating frequency of the target CPU cluster corresponding to the frequency regulation neural network. The method includes: for any target CPU cluster, obtaining system status information, the system status information includes a first load, a second load, a third load and a frame rate of the preset application, wherein the first load is the sum of the loads of all threads, the second load is the sum of the loads of the threads that are bound to the target CPU cluster, and the third load is the load of the target CPU cluster; inputting the system status information into the frequency regulation neural network corresponding to the target CPU cluster, obtaining a target operating frequency output by the frequency regulation neural network corresponding to the target CPU cluster; and setting the operating frequency of the target CPU cluster to the target operating frequency.

[0008] It can be understood that since different CPU clusters have different frequency adjustment neural networks, and at the same time combining the load conditions of each CPU cluster itself and the load conditions of the threads bound to the CPU cluster, adjusting the operating frequency of the corresponding CPU cluster can balance the CPU power consumption while ensuring the performance of the CPU cluster.

[0009] In one possibility provided in the first aspect, obtaining system status information includes: at a first moment, obtaining system status information of n frames before the first moment, the system status information of the n frames before the first moment including a first load corresponding to each frame in the first n frames, a second load corresponding to each frame in the first n frames, a third load corresponding to each frame in the first n frames, and a frame rate of each frame in the first n frames, n≥1; setting the operating frequency of the target CPU cluster to the target operating frequency, including: setting the operating frequency of the target CPU cluster during a frame after the first moment to the target operating frequency.

[0010] That is to say, the present application can adjust the operating frequency of the target CPU cluster in the current frame based on the operating conditions (including load and FPS) of the target CPU cluster in the previous frame or previous frames, thereby achieving more precise frequency regulation at the frame granularity.

[0011] In one possibility provided in the first aspect, the first moment is the moment when any frame ends.

[0012] In one possibility provided in the first aspect, the preset application is a game application.

[0013] In one possibility provided in the first aspect, the load is CPU utilization.

[0014] In a second aspect, the present application provides a training method for a frequency regulation neural network, which is used to train and obtain a frequency regulation neural network corresponding to a target CPU cluster of an electronic device, wherein the electronic device runs a preset application, the preset application includes multiple threads, the multiple threads include a thread that is bound to the CPU cluster of the electronic device, the CPU cluster of the electronic device includes a target CPU cluster corresponding to the frequency regulation neural network, and the frequency regulation neural network is used to adjust the operating frequency of the target CPU cluster corresponding to the frequency regulation neural network. The method includes: for any target CPU cluster, according to data obtained by interacting with the target CPU cluster through a reinforcement learning network model corresponding to the target CPU cluster, obtaining training data of the reinforcement learning network model corresponding to the target CPU cluster; using the training data, performing reinforcement learning training on the reinforcement learning network model corresponding to the target CPU cluster to obtain the frequency regulation neural network corresponding to the target CPU cluster; wherein the frequency regulation neural network corresponding to the target CPU cluster is input with system state information, and the output of the frequency regulation neural network corresponding to the target CPU cluster is the operating frequency of the target CPU cluster, and the system state information includes a first load, a second load, a third load, and a frame rate of the preset application, wherein the first load is the sum of the loads of all threads, the second load is the sum of the loads of the threads that are bound to the target CPU cluster, and the third load is the load of the target CPU cluster.

[0015] It can be understood that by training the frequency adjustment neural network corresponding to each CPU cluster in combination with the load of each CPU cluster and the load of the threads bound to the CPU cluster, a frequency adjustment neural network matching the actual situation of each CPU cluster can be obtained. At the same time, the frequency adjustment neural network is trained for the application so that the adjusted CPU frequency is more in line with the application requirements.

[0016] In one possibility provided in the second aspect, the training data includes multiple samples, each sample includes a state, an action and a reward, and the training data of the reinforcement learning network model corresponding to the target CPU cluster is obtained according to the data obtained by the interaction between the reinforcement learning network model and the target CPU cluster, including: obtaining system state information at a first moment, using the system state information as the state, the system state information including a first load corresponding to each frame in the first n frames before the first moment, a second load corresponding to each frame in the first n frames, an average of a third load corresponding to each frame in the first n frames, and a frame rate in the first n frames and a frame rate corresponding to each frame in the first n frames, n≥1; inputting the state into the reinforcement learning network model corresponding to the target CPU cluster, obtaining the target operating frequency, and using the target operating frequency as the state; setting the operating frequency of the target CPU cluster during the next frame after the first moment to the target operating frequency; obtaining the frame rate of the preset application during the next frame after the first moment and the power consumption of the target CPU cluster, and calculating the reward.

[0017] In one possibility provided in the second aspect, the frame rate, power consumption and reward satisfy:

[0018]

[0019] Among them, rt is the reward, fpst is the frame rate, FPS is the preset target frame rate, Δ is the preset difference, P(ft) is the power consumption, and is a parameter related to the frequency ft of the target CPU cluster.

[0020] Thus, when the actual detected frame rate fpst is lower than the target frame rate FPS, the frame rate difference (i.e. the difference between fpst and the target frame rate FPS) dominates the reward, and its purpose is to increase the CPU frequency to increase the frame rate. Otherwise, the reward is the power consumption overhead, and its purpose is to reduce the CPU frequency to reduce the CPU power consumption, so as to achieve a balance between application performance and CPU power consumption.

[0021] In one possibility provided in the second aspect, the method also includes: obtaining a tracking file, the tracking file including the frame length of multiple frames, the running time of multiple threads in the multiple frames, the threads awakened by each thread, and the threads waited for by each thread; determining the dependency between threads based on the threads awakened by each thread and the threads waited for by each thread in the tracking file, the dependency is used to indicate whether the threads are executed serially or in parallel; determining the type of thread based on the CPU utilization of the thread, the type including a first type and a second type, the CPU utilization of the first type of thread is higher than the CPU utilization of the second type of thread; establishing a binding relationship between each thread and a CPU cluster based on the type and dependency of the thread, and the CPU clusters bound to multiple threads are the same or different.

[0022] In one possibility provided in the second aspect, a binding relationship between each thread and a CPU cluster is established respectively according to the type and dependency of the thread, the CPU clusters to which the multiple threads are bound are the same or different, and the one or more CPU clusters include a first CPU cluster and a second CPU cluster, including: dividing two threads executed in parallel in the first type of threads into two different thread groups, and dividing two threads executed serially in the first type of threads into the same thread group to obtain two thread groups; establishing a binding relationship between one of the two thread groups and the first CPU cluster, establishing a binding relationship between the other thread group in the two thread groups and the second CPU cluster, and establishing a binding relationship between the second type of threads and the second CPU cluster.

[0023] In this way, not only can heavy-load threads be executed in parallel to improve task processing efficiency, but the second CPU cluster can also share the tasks of the first CPU cluster to achieve load balancing.

[0024] In one possibility provided by the second aspect, the operating frequency supported by the first CPU cluster is higher than the operating frequency supported by the second CPU cluster, thereby satisfying the CPU frequency requirement of the heavy-load thread.

[0025] In one possibility provided in the second aspect, if the CPU utilization of the thread in at least k frames among multiple frames is greater than or equal to a first threshold, the thread is a first type of thread, k≥1; if the CPU utilization of the thread in less than k frames among multiple frames is greater than or equal to a second threshold, the thread is a second type of thread.

[0026] In one possibility provided in the second aspect, the preset application is a game application.

[0027] In a third aspect, the present application provides an electronic device, comprising: a memory and a processor; the processor is coupled to the memory; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by the processor, the electronic device executes any possible method as in the first aspect or the second aspect.

[0028] In a fourth aspect, the present application provides a computer-readable storage medium, comprising computer instructions; when the computer instructions are executed on an electronic device, the electronic device executes any possible method of the first aspect or the second aspect.

[0029] In a fifth aspect, the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the method of the first aspect, the second aspect, and any possible design thereof.

[0030] In a sixth aspect, the present application provides a chip system, which includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected by lines. The above chip system can be applied to a terminal device including a communication module and a memory. The interface circuit is used to receive a signal from the memory of the terminal device and send the received signal to the processor, where the signal includes a computer instruction stored in the memory. When the processor executes the computer instruction, the terminal device can execute the method of the first aspect, the second aspect and any possible design thereof.

[0031] Among them, the technical effects brought about by any design method in the third to sixth aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of a game scene provided in an embodiment of the present application;

[0033] Figure 2A schematic diagram of the interaction between an intelligent agent and the environment provided for related technologies;

[0034] Figure 3 A schematic diagram of the interaction between an intelligent agent and an environment provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of a system architecture 100 provided in an embodiment of the present application;

[0036] Figure 5 A flow chart of a method for training a frequency-regulated neural network provided in an embodiment of the present application Figure 1 ;

[0037] Figure 6 A schematic diagram of a thread grouping process provided in an embodiment of the present application;

[0038] Figure 7 A schematic diagram of a frequency-adjusted neural network training method provided in an embodiment of the present application;

[0039] Figure 8 A flow chart of a method for training a frequency-regulated neural network provided in an embodiment of the present application Figure 2 ;

[0040] Fig. 9 A flow chart of a frequency modulation method provided in an embodiment of the present application Figure 1 ;

[0041] Fig.10 A schematic diagram of the structure of an execution device 1000 provided in an embodiment of the present application;

[0042] Fig.11 A schematic diagram of the structure of a training device 1100 provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in a "or" relationship.

[0044] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0045] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.

[0046] The frequency modulation method provided in the embodiment of the present application can be applied to scenarios where the CPU frequency needs to be adjusted, such as gaming scenarios, video call scenarios, video watching scenarios, etc. It can be understood that the higher the CPU frequency in an electronic device, the stronger the computing processing capability that the CPU can provide, thereby improving the performance of the device; the lower the CPU frequency, the more limited the computing processing capability that the CPU can provide, thereby reducing the power consumption of the device and avoiding excessive temperature of the device.

[0047] Specifically, if Figure 1 As shown, the frequency modulation method of the embodiment of the present application can be applied in the game scene, and the electronic device can increase the CPU frequency to meet the requirements of smooth game operation and high frame rate (frame per second, FPS); and the electronic device can reduce the power consumption of the device and reduce the heating by reducing the CPU frequency. That is, in the game scene, the electronic device can balance the game performance and power consumption by adjusting the CPU frequency.

[0048] In some related technologies, in the above scenario of adjusting CPU frequency, the scheduler of the electronic device, such as energy aware scheduling (EAS), completely fair scheduler (CFS), power governor, etc., selects the corresponding CPU frequency based on the CPU load measured in the historical window. The higher the CPU load, the higher the CPU frequency, so as to meet the computing power requirements.

[0049] However, the frequency modulation scheme provided by related technologies adjusts the CPU frequency based on the CPU load, and the CPU load reflects the resource utilization of the entire device. As a result, although this frequency modulation scheme can meet the computing power requirements, complete tasks quickly, and improve system throughput, it cannot guarantee the performance of specific applications and cannot guarantee the optimal energy efficiency ratio.

[0050] In response to the above problems, the present application provides a training method and a frequency modulation method for a frequency regulation neural network, which can minimize CPU power consumption and enhance the user experience when using specific applications while ensuring the running performance of preset applications (such as game applications, video applications, etc.).

[0051] The present application provides a training method and a frequency modulation method for a frequency regulation neural network, which relates to the field of artificial intelligence, and can be specifically applied to optimize CPU scheduling and frequency regulation mechanisms, and to symbolize and formalize intelligent information modeling, extraction, preprocessing, training, etc. of training data (such as CPU utilization, FPS, operating frequency, and power consumption in this application), and finally obtain a trained frequency regulation neural network (i.e., a neural network for regulating frequency); and the frequency modulation method provided in the embodiment of the present application can use the above-mentioned trained frequency regulation neural network, input input data (such as CPU utilization in this application, FPS of game applications) into the trained frequency regulation neural network, and obtain output data (such as operating frequency in this application). It should be noted that the training method and the frequency modulation method of the frequency regulation neural network provided in the embodiment of the present application are inventions based on the same concept, and can also be understood as two parts in a system, or two stages of an overall process: such as a network training stage and a network application stage.

[0052] In order to better understand the embodiments of the present application, the following briefly introduces the reinforcement learning involved in the embodiments of the present application:

[0053] Reinforcement learning (RL) is used to describe and solve the problem of how an agent learns strategies to maximize rewards or achieve specific goals during its interaction with the environment. A common model for reinforcement learning is the Markov decision process (MDP). MDP is a mathematical model for analyzing decision problems. Reinforcement learning is a process in which an agent learns by trial and error, and the reward obtained by interacting with the environment through actions guides the behavior, with the goal of maximizing the reward for the agent. In reinforcement learning, the reinforcement signal (i.e., reward) provided by the environment evaluates the quality of the action, rather than telling the reinforcement learning system how to generate the correct action. Since the external environment provides little information, the agent must learn through its own experience. In this way, the agent acquires knowledge in an action-evaluation (i.e., reward) environment and improves the action plan to adapt to the environment. Common reinforcement learning algorithms include DQN (Deep Q Network), Q-learning, policy gradient, actor-critic, etc.

[0054] like Figure 2As shown in the figure, reinforcement learning mainly includes five elements: agent, environment, state, action and reward. Among them, the state is a description of the environment, and the state will change after the agent takes an action. The action is a description of the agent's behavior and is the result of the agent's decision. In other words, the input of the agent is the state and the output is the action. The reward (positive or negative) is calculated by the agent based on the feedback from the environment after the agent takes an action. The training process of reinforcement learning is: through multiple interactions between the agent and the environment, the action, state, and reward of each interaction are obtained; these multiple groups (action, state, reward) are used as training data to train the agent once. Using the above process, the agent is trained for the next round until the convergence condition is met.

[0055] As an example, the process of obtaining the action, status, and reward of an interaction is as follows: Figure 2 As shown, the current state of the environment s t Input to the agent, the agent outputs action a t , according to the environment in action a t The relevant performance indicators under the action calculate the reward r of this interaction t , so far we get the action a of this interaction t , status t And reward r t . Record the action of this interaction a t , status t And reward r t , for subsequent training of the agent. At the same time, record the environment in action a t The next state s under the action t+1 , in order to realize the next interaction between the agent and the environment.

[0056] Corresponding to this embodiment, Figure 3 As shown, the agent may be a frequency regulator, and the environment may be a CPU running a preset application. The CPU includes a plurality of CPU clusters. The frequency regulator may include a plurality of frequency regulation neural networks. Each frequency regulation neural network may correspond to a CPU cluster, and is used to adjust the operating frequency of the corresponding CPU cluster. It should be noted that the number of CPU clusters is greater than or equal to the number of frequency regulation neural networks.

[0057] The processing capabilities of multiple CPU clusters can be the same or different. A processor having multiple CPU clusters with different processing capabilities is called a heterogeneous multi-core processor. The frequencies supported by each CPU cluster in a heterogeneous multi-core processor can be different.

[0058] The preset application may be a game application, a video application, an office application, etc., which is not specifically limited here. This embodiment mainly takes the preset application as a game application as an example for explanation.

[0059] The state includes at least three of the following: the load of each CPU cluster, the load of each thread in the game application, and the frame rate of the game application. The load of the CPU cluster includes the CPU utilization of the CPU cluster, and the load of the thread includes the CPU utilization of the thread.

[0060] In this embodiment, the action includes the operating frequency of the CPU cluster. It should be understood that the CPU cluster can support a variety of frequencies, such as 800MHz, 1GHz, 1.2GHz, etc. Correspondingly, the action set also includes a corresponding plurality of actions. The agent receives the current state s t After that, the current state s can be determined from the frequencies of various CPU clusters (i.e., action sets). t The frequency of the corresponding CPU cluster (i.e., action) increases the probability of the agent obtaining a positive reward.

[0061] And, the reward is a function of the application performance parameters and the power consumption parameters of the CPU cluster. That is, the reward parameters used to calculate the reward include the application performance parameters and the power consumption parameters of the CPU cluster. In this way, the application performance (such as game frame rate, picture clarity, etc.) and the power consumption of the CPU cluster can be balanced in the reward. It should be understood that the essence of the environment's feedback reward to the agent is: the environment feeds back the reward parameters to the agent. Subsequently, the agent needs to calculate the reward based on the reward parameters and update the decision-making strategy accordingly.

[0062] It should be noted that the above-mentioned frequency regulator and CPU can be integrated into an electronic device, or can be respectively arranged in different electronic devices, and transmit data (such as the load of the above-mentioned CPU, the load of each thread in the game application, the frame rate of the game application, the CPU frequency, etc.) through the input / output (I / O) interface between the two electronic devices.

[0063] The following description will take as an example a case where a frequency regulator and a CPU are integrated in the same electronic device, and a game application is installed in the electronic device.

[0064] The method provided in this embodiment may include two stages, namely a model training stage and a model application stage.

[0065] In the model training stage, the embodiment of the present application provides a training method for a frequency regulation neural network, which can first divide the threads of the game application into multiple thread groups according to the thread load, and bind the multiple thread groups to different CPU clusters, so that different thread groups run on different CPU clusters. Then, for different CPU clusters, the CPU utilization of the CPU cluster, the total load of the threads bound to the CPU cluster, the total load of all threads, and the game frame rate are used as states, the frequency of the CPU cluster is used as an action, and the reward is calculated, so as to train the reinforcement learning model and obtain multiple converged reinforcement learning models (i.e., frequency regulation neural networks), which correspond to different CPU clusters.

[0066] In the model application stage, the embodiment of the present application provides a frequency adjustment method, which inputs the load of the corresponding CPU cluster in the first n frames, the total load of the thread group bound to the CPU cluster in the first n frames, the total load of all thread groups in the first n frames, and the game frame rate in the first n frames into each frequency adjustment neural network. The frequency adjustment neural network can output the CPU frequency for adjusting the operating frequency of the corresponding CPU cluster in the next frame.

[0067] The following describes the method provided by this application from the model training stage and the model application stage:

[0068] See also Figure 4 , is a system architecture 100 provided in an embodiment of the present application. Figure 4 As shown, the data acquisition device 160 is used to collect training data. The training data in the embodiment of the present application includes: the CPU utilization of each thread, the CPU utilization of each CPU cluster, FPS, CPU frequency and other parameters; and the training data is stored in the database 130, and the training device 120 obtains the target model / rule 101 based on the training data maintained in the database 130. The following will describe in more detail how the training device 120 obtains the target model / rule 101 based on the training data. The target model / rule 101 can be used to implement the frequency modulation method provided in the embodiment of the present application, that is, the CPU utilization of each thread, the CPU utilization of each CPU cluster, and the FPS are input into the target model / rule 101 to obtain the CPU frequency. The target model / rule 101 in the embodiment of the present application can specifically be a frequency regulation neural network (i.e., a reinforcement learning model for regulating the CPU frequency).

[0069] The target model / rule 101 trained by the training device 120 can be applied to different systems or devices, such as Figure 4 The execution device 110 shown in the figure may be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, AR / VR, a vehicle terminal, etc., or a server or a cloud. Figure 4 In the embodiment, the execution device 110 is configured with an I / O interface 112 for data interaction with an external device. The user can input data to the I / O interface 112 through the client device 140. The input data may include: CPU utilization of each thread, CPU utilization of each CPU cluster, FPS, etc. in the embodiment of the application.

[0070] The preprocessing module 113 is used to preprocess the input data received by the I / O interface 112 . In this embodiment, the preprocessing module 113 can be used to perform smoothing operations on the input data.

[0071] During the process of the computing module 111 of the execution device 110 performing calculations and other related processing, the execution device 110 can call data, codes, etc. in the data storage system 150 for corresponding processing, and can also store data, instructions, etc. obtained from the corresponding processing into the data storage system 150.

[0072] Finally, the I / O interface 112 returns the processing result, such as the CPU frequency obtained above, to the client device 140 for providing to the user.

[0073] It is worth noting that the training device 120 can generate corresponding target models / rules based on different training data for different goals or tasks, and the corresponding target models / rules can be used to achieve the above goals or complete the above tasks, thereby providing the user with the desired results. Figure 4 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 4 In the embodiment, the data storage system 150 is an external memory relative to the execution device 110. In other cases, the data storage system 150 may also be placed in the execution device 110. For another example, the client device 140 and the execution device 110 may be the same device.

[0074] The model training stage described above is first described below with reference to the accompanying drawings.

[0075] Figure 5 The flow chart of a training method for a frequency-adjusted neural network provided in an embodiment of the present application is shown. Figure 1 , which can be applied to Figure 4 The training device 120 in FIG. 1 specifically illustrates the process of the training device 120 dividing the threads of the game application into multiple thread groups and establishing a binding relationship between the threads and the CPU cluster. Figure 5 As shown, the training method of the frequency regulation neural network includes:

[0076] S510, obtaining a trace file of the game application.

[0077] The trace file mainly includes information such as the frame length of each frame, the start and end time of each frame, the CPU utilization of each CPU cluster in each frame, the frequency of each CPU cluster in each frame, the name of the thread related to the game application, which CPU cluster each thread is executed by, the running time of each thread in each frame, the start and end time of each thread, the object awakened by each thread, the waiting time of each thread, and the object (i.e., another thread) during the running of the game application. Among them, the threads related to the running of the game application include multiple threads of the game application itself, as well as other threads involved in the running of the game, i.e., threads that do not belong to the game application.

[0078] S520, analyzing the trace file to determine dependencies between multiple target application threads.

[0079] The target application thread refers to a plurality of threads included in the game application itself.

[0080] In this embodiment, the dependency relationship can be determined based on the wake-up object and wait object of the thread, and is used to indicate whether the two threads are executed serially or in parallel. For example, taking thread A and thread B as an example, if thread A can wake up thread B, but thread B cannot wake up thread A, it indicates that thread B depends on thread A; if thread A can wake up thread B, and thread B can also wake up thread A, it indicates that thread A and thread B are dependent on each other; if thread A and thread B are executed independently, and there is no situation of waking up and being awakened, it indicates that thread A and thread B are independent of each other.

[0081] When thread B depends on thread A, the electronic device must execute thread A first, and then thread A wakes up thread B, that is, the electronic device cannot execute thread A and thread B at the same time, and thread A and thread B are executed serially. When thread A and thread B are dependent on each other or independent of each other, it does not matter whether the electronic device executes thread A or thread B first, and the two can be executed in parallel.

[0082] by For example, the game has 120 pairs of training equipment. By analyzing the game's trace file, we can get the following Figure 6 The diagram of some thread dependencies is shown in Figure 1. Figure 6As shown in the figure, the threads related to the running of the game include: unityGfx (rendering thread), unityMain (logic thread), worker, worker2, surfaceFlinger (inter-process rendering), Audio, Network, input and other threads. Among them, unityGfx thread, unityMain thread, worker thread and worker2 thread are The game's own threads, surfaceFlinger thread, Audio thread, Network thread and input thread are running Other threads involved in the game process. Among them, the unityGfx thread and the unityMain thread can wake up each other and can be parallel; the woker2 thread can only be woken up by the unityGfx thread, and the two can only be serial.

[0083] S530 , determining the type of the corresponding target application thread according to the CPU utilization of each target application thread, and grouping the target application threads of the same type into the same group.

[0084] The CPU utilization of the target application thread is the load of the target application thread, which is the proportion of the running time of the target application thread in a frame. For example, if the frame length of a frame is 12ms, and the running time of the unityMain thread in the frame time is 6ms, then the CPU utilization of the unityMain thread in the frame is 50%.

[0085] In this embodiment, the types of target application threads may include light-load threads and heavy-load threads. The training device 120 may determine each target application thread as a light-load thread or a heavy-load thread according to its CPU utilization in multiple frames. The CPU utilization of the heavy-load thread is higher than the CPU utilization of the light-load thread group. In addition, the training device 120 may also classify all light-load threads into the light-load thread group and classify all heavy-load threads into the heavy-load thread group.

[0086] In an optional implementation, take the training device 120 obtaining the CPU utilization of the target application thread in k consecutive frames as an example. If the target application thread has a CPU utilization greater than or equal to the first threshold for more than m frames in the k consecutive frames, the thread is determined to be a heavy-load thread and is divided into a heavy-load thread group; otherwise, the thread is determined to be a light-load thread and is divided into a light-load thread group. Wherein, k and m are positive integers, and m is less than k.

[0087] For example, k=10, m=6, and the first threshold is 50%. If the CPU utilization of the target application thread obtained by the training device 120 in 10 frames is divided into: 30%, 55%, 45%, 65%, 60%, 61%, 58%, 70%, 20%, and 25%, then because the CPU utilization of the thread exceeds 50% in 6 frames within 10 frames, the training device 120 determines that it is a heavy-load thread.

[0088] In another optional embodiment, the training device 120 may calculate the average CPU utilization of each target application thread within k frames. If the average CPU utilization is greater than or equal to a first threshold, the thread is determined to be a heavy-load thread and is divided into a heavy-load thread group; if the average CPU utilization is less than the first threshold, the thread is determined to be a light-load thread and is divided into a light-load thread group.

[0089] Optionally, the training device 120 may further divide other threads involved in the game running process into a group, such as other thread groups. Alternatively, the training device 120 may divide threads whose CPU utilization is greater than or equal to the second threshold among other threads involved in the game running process into a lightly loaded thread group.

[0090] For example, Figure 6 As shown, the training device 120 divides unityGfx and unityMain into the heavy-load thread group, divides worker, worker2 and surfaceFlinger into the light-load thread group, and divides Audio, Network and input into other thread groups.

[0091] It should be noted that the above grouping is only an example, and the training device 120 can also divide the target application threads into more thread groups, such as 4, 5, 6, etc., without specific limitation here.

[0092] S540: Establish a binding relationship between each target application thread and a CPU cluster according to the type and dependency relationship of the target application thread.

[0093] After the binding relationship between the target application thread and the CPU cluster is established, the target application thread can be executed by the corresponding CPU cluster.

[0094] In this embodiment, for heavy-loaded threads, the training device 120 can divide all heavy-loaded threads into two groups of threads based on dependencies. Specifically, the training device 120 divides the two heavy-loaded threads that can be executed in parallel into two thread groups, and divides the two heavy-loaded threads that can only be executed serially into the same group, thus obtaining two groups of threads. Then, the training device 120 can establish a binding relationship between one of the two groups of threads and the first CPU cluster, and establish a binding relationship between the other group of threads in the two groups of threads and the second CPU cluster. In this way, not only can the heavy-loaded threads be executed in parallel, improving the task processing efficiency; the second CPU cluster can also share the tasks of the first CPU cluster to achieve load balancing.

[0095] In addition, for light-load threads, the training device 120 may establish a binding relationship between all light-load threads and the second CPU cluster.

[0096] In an optional implementation, the first CPU cluster and the second CPU cluster are large cores and medium cores respectively, that is, the frequencies supported by the first CPU cluster and the second CPU cluster decrease in sequence, thus meeting the CPU frequency requirements of heavy-load threads.

[0097] For example, Figure 6 As shown, considering that unityGfx and unityMain can be executed in parallel, the training device 120 binds unityGfx to the first CPU cluster, and binds unityMain, woker, worker2 and surfaceFlinger to the second CPU cluster.

[0098] In an optional implementation, the training device 120 may not need to determine the dependencies between the multiple target application threads, that is, it is not necessary to execute S520. In this case, the training device 120 may establish a binding relationship between all heavy-load threads and the first CPU cluster, and establish a binding relationship between all light-load threads and the second CPU cluster, that is, the light / heavy-load threads are run in isolation.

[0099] Optionally, for threads in other thread groups, the electronic device may establish a binding relationship between all threads in the group and the third CPU cluster or the second CPU cluster.

[0100] After establishing the binding relationship between the target application thread and the CPU cluster, the training device 120 can train the reinforcement learning model for different CPU clusters. In this embodiment, the first frequency adjustment neural network and the second frequency adjustment neural network can be trained for the first CPU cluster and the second CPU cluster, respectively. The first frequency adjustment neural network is used to adjust the operating frequency of the first CPU cluster, and the second frequency adjustment neural network is used to adjust the operating frequency of the second CPU cluster.

[0101] It should be noted that the process of training the first frequency regulation neural network and the process of training the second frequency regulation neural network are the same, the difference is that the input state values ​​and output actions of both are related to their corresponding CPU clusters.

[0102] Specifically, Figure 7 As shown, for the first CPU cluster, the information that can characterize the game running load and the current execution environment can be input into the first frequency adjustment neural network as state values, and the first frequency is output after the decision of the first frequency adjustment neural network. Among them, the information that can characterize the game running load includes CPU utilization 1 and CPU utilization 2. CPU utilization 1 is the sum of the CPU utilization of all target application threads bound to the first CPU cluster, and CPU utilization 2 is the sum of the CPU utilization of all target application threads. The current execution environment can be characterized by FPS and CPU utilization 3, and CPU utilization 3 is the CPU utilization of the first CPU cluster. After the first frequency is applied to the first CPU cluster, the power consumption 1 of the first CPU cluster and the game frame rate are observed as a reward. In this way, the first frequency adjustment neural network is trained with data samples composed of state, action and reward until the first frequency adjustment neural network converges.

[0103] For the second CPU cluster, CPU utilization 4, CPU utilization 2, CPU utilization 5 and FPS can be used as state values, the frequency of the second CPU cluster can be used as an action, and the rewards calculated by the power consumption 2 of the second CPU cluster and the game frame rate can be used as data samples to train the second frequency adjustment neural network. Among them, CPU utilization 5 is the CPU utilization of the second CPU cluster, and CPU utilization 4 is the sum of the CPU utilizations of all target application threads bound to the second CPU cluster.

[0104] Figure 8 The flow chart of a training method for a frequency-adjusted neural network provided in an embodiment of the present application is shown. Figure 2 , which can be applied to Figure 4 The training device 120 in the embodiment specifically illustrates the process of training the frequency adjustment neural network by the training device 120. Figure 8 As shown, the training method of the frequency regulation neural network includes:

[0105] S810, at time t, obtain system state value s t .

[0106] Among them, time t is when the game thread queue buffer is executed, that is, the time when the rendered frame image is put back into the data buffer (buffer queue), which can be simply understood as the end time of a frame, or the first time. tIt includes the frame rate of the game application in each frame within the first n frames, the CPU utilization of the target CPU cluster in each frame within the first n frames, the sum of the CPU utilization of all target application threads bound to the target CPU cluster in each frame within the first n frames, and the sum of the CPU utilization of all target application threads in each frame within the first n frames.

[0107] The first n frames refer to the first n frames at time t. For example, if time t is the end time of the i-th frame, the first n frames include the in-th frame to the i-th frame. n is an integer greater than or equal to 1, such as 1, 2, 3, etc., and is not specifically limited here.

[0108] Exemplarily, n is 3, and the training device 120 can obtain, at the end of a frame, the CPU utilization of the target CPU cluster in each frame in the three frames before that moment (which may be called the third load), the sum of the CPU utilization of all target application threads bound to the target CPU cluster in each frame (which may be called the second load), the sum of the CPU utilization of all target application threads in each frame (which may be called the first load), and the game frame rate of each frame.

[0109] In an optional implementation, the training device 120 may smooth the frame rate and CPU utilization to obtain the system state value s t .

[0110] The target CPU cluster may be the first CPU cluster or the second CPU cluster. Figure 6 For example, the sum of the CPU utilizations of all target application threads bound to the first CPU cluster is the CPU utilization of unityGfx. The sum of the CPU utilizations of all target application threads bound to the second CPU cluster is the sum of the CPU utilizations of unityMain, worker, and worker2. The sum of the CPU utilizations of all target application threads is the sum of the CPU utilizations of unityGfx, unityMain, woker, woker2, etc.

[0111] S820, the system status value s t Input the DQN network and get the target operating frequency a t .

[0112] Specifically, the DQN network can select the operating frequency of the target CPU cluster in the next frame from the adjustable range of the CPU frequency of the target CPU cluster as the output, that is, the target operating frequency a is obtained. t .

[0113] S830, setting the operating frequency of the target CPU cluster to the target operating frequency a t.

[0114] For example, if the target CPU cluster is the first CPU cluster, the operating frequency of the first CPU cluster is set to the target operating frequency a t ; If the target CPU cluster is the second CPU cluster, set the operating frequency of the second CPU cluster to the target operating frequency a t .

[0115] Specifically, the training device 120 may set the operating frequency of the target CPU cluster in the current frame to the target operating frequency a t . The current frame can be understood as the frame after time t. Exemplarily, the training device 120 sequentially obtains the 1st frame, the 2nd frame, the 3rd frame, the 4th frame... If the t moment is the moment when the 3rd frame ends, the first 3 frames at time t can be the 1st frame, the 2nd frame, and the 3rd frame, and the frame after time t is the 4th frame, that is, the training device 120 can use the load and FPS during the 1st frame, the 2nd frame, and the 3rd frame to predict the operating frequency of the target CPU cluster during the 4th frame.

[0116] S840: At time t+1, obtain the game frame rate and the power consumption of the target CPU cluster.

[0117] The time t+1 can be understood as the end time of the current frame.

[0118] S850, based on the game frame rate at time t+1 and the power consumption of the target CPU cluster, calculate the reward r t+1 , and according to the reward r t+1 Update the DQN network.

[0119] As an example, the reward r is obtained according to the following piecewise function:

[0120]

[0121] Among them, C f is a constant, fps t is the game frame rate at time t, FPS is the preset target frame rate, P(f t ) is the power consumption, and is the frequency f of the target CPU cluster t Related parameters.

[0122] According to the above piecewise function, we can know that when the actual detected frame rate fps t When the frame rate is lower than the target FPS, the frame rate difference (i.e. fps t The difference between the target frame rate and the target frame rate FPS) dominates the reward, and its purpose is to increase the CPU frequency to increase the frame rate. Otherwise, the reward is the power consumption overhead, and its purpose is to reduce the CPU frequency to reduce CPU power consumption.

[0123] S860: Determine whether the DQN network has converged.

[0124] In an optional implementation, a loss function of the DQN network may be calculated. If the loss function is less than a threshold, the DQN network converges; if the loss function is greater than the threshold, the DQN network does not converge.

[0125] Among them, the loss function of the DQN network satisfies the formula:

[0126]

[0127] Among them, γ is a preset constant, Q(s t , a t θ - ) is the Q function, which is a function with θ as a variable. It takes the state st and action at as input and outputs the corresponding Q value. It refers to the maximum value of the Q function, which can be determined based on all the actions and states collected so far.

[0128] It should be noted that the above-mentioned updating of the DQN network based on rewards actually means updating the value of θ in the loss function. The maximum Q value is obtained by continuously updating the value of θ.

[0129] S870, when the DQN network converges, the output frequency adjusts the neural network.

[0130] It should be noted that DQN contains two neural networks, one is the Q network and the other is the target neural network (i.e., the frequency regulation neural network of the present application). The structure of the target neural network is the same as that of the Q network, and the initial weights are also the same. When the Q network converges, the parameters of the Q network are synchronized to the target neural network to obtain the frequency regulation neural network.

[0131] It should be noted that in S840, the training device 120 can also obtain the state value s at time t+1. t+1 When the QDN network does not converge, the training device 120 can set the state value s t+1 Re-enter the DQN network and follow Figure 8 The process shown continues to train the DQN network until the DQN network converges.

[0132] In addition, during the training process, the training device 120 can collect (s t , a t , r t ) as training samples to accumulate training data and train other models.

[0133] The model application stage of this application will be further described below.

[0134] Fig. 9A flow chart of a frequency modulation method provided in an embodiment of the present application is shown, which can be applied to Figure 4 The execution device 110 in FIG. Fig. 9 As shown, the frequency modulation method includes:

[0135] S910, at the first moment, obtain the game frame rate of each frame in the first n frames of the first moment, the CPU utilization of the target CPU cluster in each frame, the sum of the CPU utilization of all target application threads bound to the target CPU cluster in each frame, and the sum of the CPU utilization of all target application threads in each frame as the system status value.

[0136] S920, input the system state value into the frequency adjustment neural network corresponding to the target CPU cluster to obtain the target operating frequency.

[0137] S930: Set the operating frequency of the target CPU cluster during a frame subsequent to the first moment as the target operating frequency.

[0138] It should be noted that before executing the frequency modulation method provided in this embodiment, the training device 110 not only needs to transplant the above-mentioned frequency regulation neural network into the execution device 110, but also needs to establish the binding relationship between each thread in the game application and the corresponding CPU cluster in advance according to the method in the training device 120.

[0139] In this embodiment, on the one hand, a frequency adjustment neural network is trained for an application and used to determine the CPU frequency when the application is running. In this way, the application is used as the granularity, so that the adjusted CPU frequency is more in line with the needs of the application. On the other hand, the rewards in the reinforcement learning process balance the application performance and CPU power consumption, not just the CPU power consumption. In this way, the CPU frequency determined by the frequency adjustment neural network can balance the application performance and CPU power consumption, which is more reasonable.

[0140] In addition, this application uses the system status values ​​of the previous few frames as input to obtain the CPU operating frequency of the current frame, thereby achieving frequency adjustment in frames, which is more accurate.

[0141] Next, an execution device provided by an embodiment of the present application is introduced. Fig.10 , Fig.10 This is a schematic diagram of a structure of an execution device provided in an embodiment of the present application. The execution device 1000 can be specifically embodied as a mobile phone, a tablet, a laptop computer, a smart wearable device, a server, etc., which is not limited here. Among them, the execution device 1000 can be used to implement Fig. 9 The frequency adjustment function in the corresponding embodiment. Specifically, the execution device 1000 includes: a receiver 1001, a transmitter 1002, a processor 1003 and a memory 1004 (wherein the number of the processor 1003 in the execution device 1000 can be one or more, Fig.10 In the example of FIG. 1003 , the processor 1003 may include an application processor 10031 and a communication processor 10032. In some embodiments of the present application, the receiver 1001, the transmitter 1002, the processor 1003 and the memory 1004 may be connected via a bus or other means.

[0142] The memory 1004 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1003. A portion of the memory 1004 may also include a non-volatile random access memory (NVRAM). The memory 1004 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.

[0143] The processor 1003 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.

[0144] The frequency modulation method disclosed in the above embodiment of the present application can be applied to the processor 1003, or implemented by the processor 1003. The processor 1003 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 1003. The above processor 1003 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 1003 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or a combination of hardware and software modules in the decoding processor to execute. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1004, and the processor 1003 reads the information in the memory 1004 and completes the steps of the above method in combination with its hardware.

[0145] The receiver 1001 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 1002 can be used to output digital or character information through the first interface; the transmitter 1002 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1002 can also include a display device such as a display screen.

[0146] In one embodiment of the present application, the processor 1003 is configured to execute Figure 4 The frequency modulation method is executed by the execution device in the corresponding embodiment.

[0147] The present application also provides a training device. Fig.11 , Fig.111 is a schematic diagram of the structure of a training device 1100 provided in an embodiment of the present application. Specifically, the training device 1100 is implemented by one or more servers. The training device 1100 may have relatively large differences due to different configurations or performances. It may include one or more central processing units (CPU) 1111 (for example, one or more processors) and memory 1132, and one or more storage media 1130 (for example, one or more mass storage devices) storing application programs 1142 or data 1144. Among them, the memory 1132 and the storage medium 1130 can be short-term storage or permanent storage. The program stored in the storage medium 1130 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processing unit 1111 can be configured to communicate with the storage medium 1130 to execute a series of instruction operations in the storage medium 1130 on the training device 1100.

[0148] The training device 1100 may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input and output interfaces 1158; or, one or more operating systems 1141, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0149] In the embodiment of the present application, the central processing unit 1111 is used to execute the steps related to the frequency adjustment neural network training method in the above embodiment.

[0150] Also provided in an embodiment of the present application is a computer program product which, when executed on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0151] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0152] The execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may execute the computer execution instructions stored in the storage unit so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0153] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.

[0154] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0155] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0156] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.

Claims

1. A frequency modulation method, It is characterized in that Applied to an electronic device, the electronic device runs a preset application, the preset application includes multiple threads, the multiple threads include a thread that has a binding relationship with a CPU cluster of the electronic device, the CPU cluster of the electronic device includes a target CPU cluster corresponding to a frequency adjustment neural network, the frequency adjustment neural network is used to adjust the operating frequency of the target CPU cluster corresponding to the frequency adjustment neural network, the method includes: For any target CPU cluster, obtaining system status information, the system status information including a first load, a second load, a third load, and a frame rate of the preset application, wherein the first load is the sum of the loads of all threads, the second load is the sum of the loads of the threads that are bound to the target CPU cluster, and the third load is the load of the target CPU cluster; Inputting the system status information into the frequency adjustment neural network corresponding to the target CPU cluster, and obtaining the target operating frequency output by the frequency adjustment neural network corresponding to the target CPU cluster; Setting the operating frequency of the target CPU cluster to the target operating frequency; The reward of the frequency-adjusted neural network during training satisfies the following relationship: ; Among them, r t For the reward, fps t is the frame rate of the preset application running in the next frame at the first moment during the training process, FPS is the preset target frame rate, Δ is the preset difference, P(f t ) is the power consumption of the target CPU cluster during the training process, and is the frequency f of the target CPU cluster t Related parameters; the first moment is the moment of acquiring system status information during the training process; When the fps t When the difference with the FPS is less than the Δ, the reward is used to increase the target operating frequency output by the frequency regulation neural network; When the fps t When the difference with the FPS is greater than or equal to the Δ, the reward is used to reduce the target operating frequency output by the frequency regulation neural network.

2. The method according to claim 1, It is characterized in that The obtaining of system status information includes: At a first moment, obtaining system status information of n frames before the first moment, the system status information of n frames before the first moment including a first load corresponding to each frame in the first n frames, a second load corresponding to each frame in the first n frames, a third load corresponding to each frame in the first n frames, and a frame rate of each frame in the first n frames, where n≥1; The step of setting the operating frequency of the target CPU cluster to the target operating frequency includes: The operating frequency of the target CPU cluster during a frame subsequent to the first moment is set as the target operating frequency.

3. The method according to claim 1 or 2, It is characterized in that The first moment is the moment when any frame ends.

4. The method according to claim 1 or 2, It is characterized in that The preset application is a game application.

5. The method according to claim 1 or 2, It is characterized in that The load is CPU utilization.

6. A training method for a frequency-regulated neural network, It is characterized in that A method for training a frequency adjustment neural network corresponding to a target CPU cluster of an electronic device, wherein the electronic device runs a preset application, the preset application includes a plurality of threads, the plurality of threads include a thread that has a binding relationship with the CPU cluster of the electronic device, the CPU cluster of the electronic device includes a target CPU cluster corresponding to the frequency adjustment neural network, and the frequency adjustment neural network is used to adjust the operating frequency of the target CPU cluster corresponding to the frequency adjustment neural network, the method comprising: For any target CPU cluster, obtaining training data of the reinforcement learning network model corresponding to the target CPU cluster according to data obtained by interaction between the reinforcement learning network model corresponding to the target CPU cluster and the target CPU cluster; Using the training data, performing reinforcement learning training on the reinforcement learning network model corresponding to the target CPU cluster to obtain a frequency adjustment neural network corresponding to the target CPU cluster; The frequency adjustment neural network corresponding to the target CPU cluster is input with system status information, and the output of the frequency adjustment neural network corresponding to the target CPU cluster is the operating frequency of the target CPU cluster. The system status information includes a first load, a second load, a third load, and a frame rate of the preset application, wherein the first load is the sum of the loads of all threads, the second load is the sum of the loads of threads that are bound to the target CPU cluster, and the third load is the load of the target CPU cluster. Wherein, obtaining the training data of the reinforcement learning network model corresponding to the target CPU cluster according to the data obtained by the interaction between the reinforcement learning network model corresponding to the target CPU cluster and the target CPU cluster includes: Obtaining a frame rate of the preset application during a subsequent frame at the first moment and power consumption of the target CPU cluster, and calculating a reward; The frame rate, the power consumption and the reward satisfy: ; Among them, r t For the reward, fps t is the frame rate, FPS is the preset target frame rate, Δ is the preset difference, P(f t ) is the power consumption, and is the frequency f of the target CPU cluster t The first time is the time of acquiring the system status information; When the fps t When the difference with the FPS is less than the Δ, the reward is used to increase the operating frequency of the target CPU cluster; When the fps t When the difference with the FPS is greater than or equal to the Δ, the reward is used to reduce the operating frequency of the target CPU cluster.

7. The method according to claim 6, It is characterized in that The training data includes a plurality of samples, each sample includes a state, an action and a reward, and the training data of the reinforcement learning network model corresponding to the target CPU cluster is obtained by interacting with the target CPU cluster according to the reinforcement learning network model corresponding to the target CPU cluster, and further includes: Acquire system status information at a first moment, and use the system status information as the state, wherein the system status information includes a first load corresponding to each frame in first n frames at the first moment, a second load corresponding to each frame in the first n frames, an average of a third load corresponding to each frame in the first n frames, a frame rate in the first n frames, and a frame rate corresponding to each frame in the first n frames, where n≥1; Input the state into the reinforcement learning network model corresponding to the target CPU cluster, obtain the target operating frequency, and use the target operating frequency as the state; The operating frequency of the target CPU cluster during a frame subsequent to the first moment is set as the target operating frequency.

8. The method according to claim 6 or 7, It is characterized in that The method further comprises: Obtaining a trace file, wherein the trace file includes frame lengths of multiple frames, running lengths of the multiple threads in the multiple frames, threads awakened by each thread, and threads waited for by each thread; Determine dependencies between threads according to threads awakened by each thread and threads waited for by each thread in the tracking file, wherein the dependencies are used to indicate whether the threads are executed serially or in parallel; Determining a type of the thread according to a CPU utilization of the thread, the type comprising a first type and a second type, the CPU utilization of the first type of thread being higher than the CPU utilization of the second type of thread; According to the types of the threads and the dependencies, a binding relationship between each thread and a CPU cluster is established respectively, and the CPU clusters to which the multiple threads are bound are the same or different.

9. The method according to claim 8, It is characterized in that According to the type of the thread and the dependency relationship, a binding relationship between each of the threads and a CPU cluster is established respectively, the CPU clusters to which the multiple threads are bound are the same or different, and the one or more CPU clusters include a first CPU cluster and a second CPU cluster, including: Dividing two threads executed in parallel among the first type of threads into two different thread groups, and dividing two threads executed serially among the first type of threads into the same thread group, thereby obtaining two thread groups; A binding relationship is established between one of the two thread groups and the first CPU cluster, a binding relationship is established between the other of the two thread groups and the second CPU cluster, and a binding relationship is established between the second type of threads and the second CPU cluster.

10. The method according to claim 9, It is characterized in that An operating frequency supported by the first CPU cluster is higher than an operating frequency supported by the second CPU cluster.

11. The method according to claim 9, It is characterized in that If there are at least k frames in the multiple frames in which the CPU utilization of the thread is greater than or equal to the first threshold, the thread is a thread of the first type, k≥1; If the CPU utilization of the thread in less than k frames in the multiple frames is greater than or equal to a second threshold, the thread is a thread of the second type.

12. The method according to claim 6 or 7, It is characterized in that The preset application is a game application.

13. An electronic device, It is characterized in that The electronic device comprises: a memory and a processor; the processor is coupled to the memory; wherein the memory is used to store computer program code, the computer program code comprises computer instructions; when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1-12.

14. A computer-readable storage medium, It is characterized in that The method comprises computer instructions; when the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 12.