Frequency control method and device, electronic equipment and storage medium
By obtaining the load information of the GPU and inputting it to the model to determine the appropriate GPU frequency, the problem of inaccurate GPU frequency adjustment in the prior art is solved, and lower electronic device power consumption and better performance matching are achieved.
Patent Information
- Application Number
- CN202411665778.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-11
AI Technical Summary
When adjusting the GPU frequency, it is difficult for the prior art to accurately match the dynamic performance requirements of the application, resulting in an increase in power consumption of electronic devices.
By obtaining the load information of the image to be drawn in the graphics processor GPU, input it to the model to determine the most suitable GPU frequency, and controlling the GPU to draw the image based on the frequency.
It effectively avoids over-performance or insufficient performance, reduces power consumption of electronic devices, and improves performance matching.
Smart Images

Figure CN119597472A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and specifically relates to a frequency control method, device, electronic device and storage medium. Background Art
[0002] With the development of electronic devices, electronic devices are becoming more and more integrated into people's lives, but the development of electronic devices is always restricted by battery capacity, so low-power technology is very important to improve the availability of electronic devices.
[0003] Currently, a graphics processing unit (GPU) driver can select a GPU frequency for an application based on the application name. However, an application's performance requirements for the GPU are constantly changing. Therefore, if a frequency is fixed for an application, there may still be excess or insufficient performance, resulting in increased power consumption of electronic devices. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a frequency control method, device, electronic device and storage medium, which can reduce the power consumption of the electronic device.
[0005] In a first aspect, an embodiment of the present application provides a frequency control method, the method comprising: obtaining first load information of an image to be drawn in a GPU, the first load information being used to characterize the load condition of the GPU when drawing the image to be drawn; inputting the first load information into a first model to obtain a first GPU frequency output by the first model, the first GPU frequency being determined by the first model based on the first load information; and controlling the GPU to draw the image to be drawn based on the first GPU frequency.
[0006] In a second aspect, an embodiment of the present application provides a frequency control device, which includes: an acquisition module, a processing module, and a control module. The acquisition module is used to acquire first load information of an image to be drawn in the GPU, and the first load information is used to characterize the load condition of the GPU when drawing the image to be drawn. The processing module is used to input the first load information acquired by the acquisition module into the first model to obtain a first GPU frequency output by the first model, and the first GPU frequency is determined by the first model according to the first load information. The control module is used to control the GPU to draw the image to be drawn based on the first GPU frequency processed by the processing module.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer program / program product, wherein the computer program / program product is stored in a storage medium, and the program / program product is executed by at least one processor to implement the method described in the first aspect.
[0011] In an embodiment of the present application, first load information of an image to be drawn in a graphics processor GPU is obtained, and the first load information is used to characterize the load condition of the GPU when drawing the image to be drawn; the first load information is input into a first model to obtain a first GPU frequency output by the first model, and the first GPU frequency is determined by the first model according to the first load information; and the GPU is controlled to draw the image to be drawn based on the first GPU frequency. In this solution, before drawing each image, the electronic device can first determine the most suitable GPU frequency for the image to be drawn according to the actual load information of the image to be drawn, so that the GPU draws the image to be drawn based on the most suitable GPU frequency for the image to be drawn, thereby avoiding the problem of excess or insufficient performance when drawing the image to be drawn, which leads to increased power consumption of the electronic device. Thereby reducing the power consumption of the electronic device. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 This is one of the flow charts of a frequency control method provided in an embodiment of the present application;
[0013] Figure 2 is a schematic diagram of an example of adjusting GPU frequency provided in an embodiment of the present application;
[0014] Figure 3 This is a second flow chart of a frequency control method provided in an embodiment of the present application;
[0015] Figure 4 This is a third flow chart of a frequency control method provided in an embodiment of the present application;
[0016] Figure 5 is a structural schematic diagram of a frequency control device provided in an embodiment of the present application;
[0017] Figure 6 This is one of the hardware structure diagrams of an electronic device provided in an embodiment of the present application;
[0018] Figure 7 This is the second schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0020] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0021] The terms "at least one (item)", "at least one of" and the like in the specification and claims of the present application refer to any one, any two or a combination of more than two of the objects included therein. For example, at least one (item) of a, b, and c can be represented by: "a", "b", "c", "a and b", "a and c", "b and c" and "a, b and c", where a, b, and c can be single or multiple. Similarly, "at least two (items)" refers to two or more, and its meaning is similar to that of "at least one (item)".
[0022] The frequency control method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0023] The frequency control method in the embodiment of the present application can be applied to the scenario of adjusting the GPU frequency.
[0024] With the development of Internet technology, electronic devices are becoming more and more integrated into people's lives, but their development is always restricted by battery capacity, so low-power technology is very important to improve the availability of electronic devices. According to the following formula 1 (dynamic power consumption formula), when the capacitance (C) is constant, the dynamic power consumption (P) is proportional to the operating frequency (f). Therefore, the power consumption of electronic devices can be reduced by adjusting the GPU frequency.
[0025] P=λCV^2fFormula 1
[0026] There are currently three common strategies for adjusting GPU frequency. The first is to add performance mode options in the system settings, such as low power, normal, and high performance modes. The user decides the GPU operating mode, but due to lack of understanding of the application, it is generally difficult to make the right choice; the second is for the GPU driver to select the GPU frequency based on the name of the application, but an application's performance requirements for the GPU are constantly changing. If a frequency is fixed for an application, there will still be excess or insufficient performance; the third is to dynamically adjust the frequency according to the GPU load, such as the Ondemand strategy: sample and analyze the system load at fine-grained time intervals and adjust the frequency accordingly.
[0027] However, both fixed frequency and dynamic frequency modulation rely on empirical values. The empirical values of the first and second methods are the best recommended values after long-term experiments, and the empirical values of the third method are based on the results of previous fine-grained sampling. The empirical values are based on historical data and past observations. Although they can provide a certain reference, they cannot fully reflect the current actual situation and may have large deviations.
[0028] In the frequency control method, device, electronic device and storage medium provided in the embodiments of the present application, the first load information of the image to be drawn in the graphics processor GPU is obtained, and the first load information is used to characterize the load condition of the GPU when drawing the image to be drawn; the first load information is input into the first model to obtain the first GPU frequency output by the first model, and the first GPU frequency is determined by the first model according to the first load information; the GPU is controlled to draw the image to be drawn based on the first GPU frequency. In this scheme, before drawing each drawn image, the electronic device can first determine the most suitable GPU frequency for the image to be drawn according to the actual load information of the image to be drawn, so that the GPU draws the image to be drawn based on the GPU frequency that is most suitable for the image to be drawn, thereby avoiding the problem of excessive or insufficient performance when drawing the image to be drawn, which leads to increased power consumption of the electronic device. Thereby reducing the power consumption of the electronic device.
[0029] The execution subject of the frequency control method provided in the embodiment of the present application may be a frequency control device, which may be an electronic device, or a functional module or entity in an electronic device. The technical solution provided in the embodiment of the present application is described below using an electronic device as an example.
[0030] The present application provides a frequency control method. Figure 1 FIG. 1 is a flow chart of a frequency control method provided by an embodiment of the present application, which can be applied to electronic devices. Figure 1As shown, the frequency control method provided in the embodiment of the present application may include the following steps 201 to 203.
[0031] Step 201: The electronic device obtains first load information of an image to be drawn in a GPU.
[0032] In the embodiment of the present application, the first load information is used to characterize the load condition of the GPU when drawing the image to be drawn.
[0033] In some embodiments of the present application, the first load information may also be used to characterize the workload of the GPU when drawing the image to be drawn.
[0034] In some embodiments of the present application, the electronic device may determine a data item that can represent the load in the user-mode drive (ie, the first load information mentioned above), and it may also be understood that the first load information includes multiple data items that can represent the load.
[0035] In some embodiments of the present application, the first load information includes at least one of the following: graphics rendering information, multi-threaded computing information, resource conversion information, and bandwidth optimization information.
[0036] In some embodiments of the present application, GPU processing mainly includes two aspects: graphics rendering and general computing. In graphics rendering, there is a special scenario that uses a fixed shader or directly changes the memory layout of resources through hardware. In order to improve performance, the driver has more or less some optimizations in the process of implementing the Application Programming Interface (API). Therefore, the data items that can represent the load can be roughly divided into four categories: graphics rendering (graphic), multi-threaded computing (compute), resource conversion (transform) and bandwidth optimization (optimize). It should be noted that this application takes the vulkan API as an example.
[0037] For example, in comparison with the GPU hardware module, the graphics process involves vertex processing, sampling, calculation, loading and storage, etc. A draw can trigger a rendering process, but multiple draws can share pipelines and render targets, so the data items that can represent the load in graphics are mainly those shown in Table 1, among which clear and resolve are special scenarios in graphics), as shown in Table 1:
[0038] Table 1
[0039]
[0040] Among them, rt in Table 1 can be understood as the rendering target (render target)
[0041] Compute mainly enables multi-threaded parallel computing, so it will count the number of groups (group_count) and the number of threads (thread_count). It will also involve sampling and calculation, so there are resource_XX and shader complexity. The data items that can represent the load in Compute are mainly shown in Table 2, which is as follows:
[0042] Table 2
[0043]
[0044] Transform is a conversion between resource buffer, image or both. The shader involved is determined by the driver and is fixed (or there is no shader, directly implemented by hardware), so the main factors affecting the load are the resource size and the number of corresponding instructions. The data items that can represent the load in Transform are mainly shown in Table 3, which is as follows:
[0045] Table 3
[0046]
[0047] The data items that can represent the load in optimize are mainly those shown in Table 4, which is as follows:
[0048] Table 4
[0049] Fields meaning crc_size No need to repeat the rt size Readback_size The size of data read directly from cache instead of DDR …… Other feature-related items that need to be adjusted for the application
[0050] Step 202: The electronic device inputs first load information into a first model to obtain a first GPU frequency output by the first model.
[0051] In an embodiment of the present application, the first GPU frequency is determined by a first model according to first load information.
[0052] In some embodiments of the present application, the first load information is positively correlated with the first GPU frequency.
[0053] In some embodiments of the present application, the above-mentioned first model can be a multi-layer perceptron (MLP) model, or it can be other models with the same function, which is not limited in the embodiments of the present application.
[0054] In some embodiments of the present application, the first GPU frequency may be understood as the GPU frequency that is most suitable for the GPU to use when drawing the image to be drawn.
[0055] In some embodiments of the present application, a user-mode driver in an electronic device may input first load information into a first model to obtain a first GPU frequency output by the first model.
[0056] In some embodiments of the present application, the data items that can represent the load and are included in the first load information may be referred to as features of the model.
[0057] Step 203: The electronic device controls the GPU to draw the image to be drawn based on the first GPU.
[0058] In some embodiments of the present application, the electronic device controlling the GPU to draw the image to be drawn based on the first GPU can also be understood as: the electronic device adjusts the GPU frequency of the GPU to the first GPU frequency, so that the GPU draws the image to be drawn based on the first GPU.
[0059] In some embodiments of the present application, a user-state driver in an electronic device may transmit a first GPU frequency output by a first model to a kernel-state driver, and the kernel-state driver controls the GPU to draw an image to be drawn based on the first GPU frequency.
[0060] In some embodiments of the present application, Figure 2 As shown, it is an example diagram of the various modules in the electronic device cooperating to adjust the GPU frequency of the GPU. Specifically, the user-state driver in the electronic device can perform the following steps: 1. Count the first load information of the image to be drawn; 2. Call the first model (model), pass the first load information (input data) counted into the first model, and obtain the first GPU frequency (predict value) output by the first model; 3. Pass the predicted first GPU frequency to the kernel-state driver. For the shader_scores in the first load information, it is obtained by the user-state driver through the compiler. Specifically, the user-state driver can pass the counted shader file to the compiler, and the compiler can calculate the shader_scores based on the shader file (different instructions such as texture, loadStore, etc. have different scores), and pass the shader_scores to the user-state driver. The kernel-state driver can set the GPU frequency of the GPU to the first GPU frequency. In addition, the user-state driver, the kernel-state driver, and the compiler are operated by the central processing unit (CPU), and the first model is operated by the neural network processor (NPU). The additional overhead of the CPU includes: statistics of the first load information, the compiler's newly added function for scoring shaders, and scheduling between modules. The additional overhead of the NPU includes the operation of the first model.
[0061] In the frequency control method provided in the embodiment of the present application, before drawing each image, the electronic device can first determine the GPU frequency that is most suitable for the image to be drawn according to the actual load information of the image to be drawn, so that the GPU draws the image to be drawn based on the GPU frequency that is most suitable for the image to be drawn, thereby avoiding the problem of excessive or insufficient performance when drawing the image to be drawn, which leads to increased power consumption of the electronic device. Thus, the power consumption of the electronic device is reduced.
[0062] In some embodiments of the present application, Figure 1 ,like Figure 3 As shown, before the above step 201, the frequency control method provided in the embodiment of the present application also includes the following step 301.
[0063] Step 301: The electronic device trains a preset model based on N training samples to obtain a first model.
[0064] In an embodiment of the present application, each training sample corresponds to a drawing image, and the training sample includes: the drawing time of the drawing image corresponding to the training sample, the proportion of GPU working time when drawing the drawing image corresponding to the training sample, the load of the GPU when drawing the drawing image corresponding to the training sample, and the second load information of the drawing image corresponding to the training sample.
[0065] In the embodiment of the present application, the second load information is used to characterize the load condition of the GPU when drawing an image corresponding to a training sample.
[0066] In some embodiments of the present application, the second load information may also be used to characterize the workload of the GPU when drawing an image corresponding to a training sample.
[0067] In the embodiments of the present application, N is an integer greater than 1.
[0068] In some embodiments of the present application, each training sample corresponds to a rendering image, which can also be understood as: each training sample corresponds to a frame of rendering results.
[0069] In some embodiments of the present application, the above-mentioned preset model may be an MLP model.
[0070] In some implementations of the present application, the MLP model may be composed of an input layer, at least one hidden layer and an output layer. Each hidden layer is composed of an adjustable number of neurons, which are nonlinearly transformed by a ReLU function.
[0071] Exemplarily, the weights of the above MLP model can be initialized with a normal distribution with a mean of 0 and a standard deviation of 0.01, and the bias is initialized to zero. The loss function can use categorical cross entropy loss (categorical_crossentropy), the optimizer can use the Adam optimizer, and the learning rate is set to 0.01. The output layer can use a softmax activation function to output the probability distribution of each discrete target value.
[0072] In some embodiments of the present application, the electronic device can train a preset model based on N training samples until the difference between the GPU frequency predicted by the model and the predetermined GPU frequency corresponding to the input load information is within a preset range, thereby obtaining a trained first model.
[0073] In this way, since the electronic device can train the preset model based on N training samples to obtain the first model, when the load information of the image to be drawn is input into the first model, the GPU frequency corresponding to the load information output by the first model can be obtained, so that when drawing the image to be drawn, the GPU frequency that is most suitable for the image to be drawn can be used to draw the image to be drawn, thereby avoiding an increase in power consumption of the electronic device.
[0074] In some embodiments of the present application, "the electronic device trains the preset model based on N training samples" in the above step 301 can be specifically implemented through the following steps 301a to 301e.
[0075] Step 301a, in the process of drawing the i-th drawing image corresponding to the i-th training sample among N training samples based on the second CPU frequency, the electronic device obtains the drawing time of the i-th drawing image, the proportion of the GPU working time when drawing the i-th drawing image, the load of the GPU when drawing the i-th drawing image, and the third load information.
[0076] In the embodiment of the present application, the third load information is used to characterize the load condition of the GPU when drawing the i-th drawing image.
[0077] In some embodiments of the present application, the electronic device can run the GPU based on the second CPU frequency, and then when the GPU is running and drawing the i-th drawing image, obtain the drawing time of the i-th drawing image, the proportion of the GPU working time when drawing the i-th drawing image, the GPU load when drawing the i-th drawing image, and third load information.
[0078] In an embodiment of the present application, the second GPU frequency is the GPU frequency adjusted for the GPU frequency of the i-1th drawing image predicted by the preset model, and the i-1th drawing image is the drawing image corresponding to the i-1th training sample among the N training samples.
[0079] It can be understood that after the electronic device obtains the GPU frequency of the i-1th drawing image predicted by the preset model and adjusts the predicted GPU frequency of the i-1th drawing image to obtain the second GPU frequency, it can run the GPU at the second GPU frequency, and then run the GPU at the second GPU frequency to obtain the above-mentioned relevant information of the i-th drawing image (i.e., the drawing time of the i-th drawing image, the proportion of the GPU working time when drawing the i-th drawing image, the GPU load when drawing the i-th drawing image, and the third load information) during the process of drawing the i-th drawing image.
[0080] It should be noted that the detailed steps for the electronic device to adjust the predicted GPU frequency of the i-1th drawing image can be referred to the description of adjusting the predicted third GPU frequency of the i-th drawing image to obtain the fifth GPU frequency in the following embodiment, which will not be repeated here.
[0081] In some embodiments of the present application, the electronic device may run the GPU at a preset initial GPU frequency, and in the process of drawing the first drawing image corresponding to the first training sample, obtain the drawing time of the first drawing image, the proportion of the GPU working time when drawing the first drawing image, the GPU load when drawing the first drawing image, and information used to characterize the GPU load when drawing the first drawing image, and then after obtaining the GPU frequency of the first drawing image predicted by the preset model, adjust the predicted GPU frequency of the first drawing image to obtain the adjusted GPU frequency, and then run the GPU at the adjusted GPU frequency, and in the process of drawing the second drawing image corresponding to the second training sample, obtain the drawing time of the second drawing image, the proportion of the GPU working time when drawing the second drawing image, the GPU load when drawing the second drawing image, and information used to characterize the GPU load when drawing the second drawing image. It should be noted that the steps of obtaining relevant information of the drawing images corresponding to other training samples are similar and will not be repeated here.
[0082] Step 301b: The electronic device obtains a third CPU frequency based on the third load information.
[0083] In an embodiment of the present application, the third CPU frequency is the GPU frequency of the i-th drawn image predicted by the preset model.
[0084] In some embodiments of the present application, the third GPU frequency may also be understood as: an inaccurate GPU frequency predicted by the first model during the training phase.
[0085] Step 301c: The electronic device determines a fourth GPU frequency based on the drawing time of the ith drawing image, the proportion of the GPU working time when drawing the ith drawing image, and the GPU load when drawing the ith drawing image.
[0086] In an embodiment of the present application, the fourth GPU frequency is a predetermined GPU frequency corresponding to the third load information.
[0087] In some embodiments of the present application, the fourth GPU frequency may also be understood as: an expected theoretical GPU frequency, or a GPU frequency (target) predicted by an expected model.
[0088] In some embodiments of the present application, the above step 301c can be specifically implemented through the following steps 401 and 402.
[0089] Step 401: The electronic device determines a first working time of the GPU when drawing the i-th drawing image based on the drawing time of the i-th drawing image and the proportion of the working time of the GPU when drawing the i-th drawing image.
[0090] In some embodiments of the present application, the electronic device may determine the first working time of the GPU when drawing the i-th drawing image by the following formula 2:
[0091] T working =T*α Formula 2
[0092] Wherein, T is the drawing time of the i-th drawing image, and α is the proportion of GPU working time when drawing the i-th drawing image.
[0093] Exemplarily, T can be obtained by recording in a user-mode driver, and ɑ can be obtained by calling a kernel-mode driver.
[0094] Step 402: The electronic device determines a fourth GPU frequency based on the first working duration and the load of the GPU when drawing the i-th drawing image.
[0095] In some embodiments of the present application, the electronic device may determine the fourth GPU frequency by the following formula 3:
[0096]
[0097] Among them, gpu_counter is the GPU load when drawing the i-th image, T working The first working time.
[0098] Step 301d: The electronic device determines a first loss function based on the third GPU frequency and the fourth GPU frequency.
[0099] In an embodiment of the present application, the first loss function is used to characterize the difference between the third GPU frequency and the fourth GPU frequency.
[0100] In some embodiments of the present application, the first loss function may be a categorical cross entropy loss (categorical_crossentropy) function.
[0101] Step 301e: The electronic device trains the preset model based on the first loss function.
[0102] In some embodiments of the present application, the electronic device may continue to train the preset model based on the training samples when the first loss function is less than the first preset threshold.
[0103] In some embodiments of the present application, the electronic device can complete the training of the preset model and obtain the first model when the first loss function is greater than or equal to the first preset threshold.
[0104] It can be understood that when the first loss function is greater than or equal to the first preset threshold, it represents that the difference between the GPU frequency predicted by the model and the predetermined GPU frequency corresponding to the input load information is within the preset range, so that the model training can be stopped to obtain the trained first model.
[0105] It can be understood that after the preset model is trained to obtain the first model, when the third load information is input into the first model, the first model will output the fourth GPU frequency, or a GPU frequency that is close to the fourth GPU frequency.
[0106] It can be understood that during the training stage, the third GPU frequency predicted by the preset model based on the input third load information may not be accurate. Therefore, after the preset model prediction is completed, the first loss function can be determined based on the predetermined GPU frequency (i.e., the fourth GPU frequency) corresponding to the third load information and the predicted third GPU frequency, and then the preset model is trained based on the first loss function until the output of the model meets expectations.
[0107] In this way, since the electronic device can train the preset model based on N training samples and establish the relationship between the load information and the GPU frequency, until the difference between the GPU frequency predicted by the preset model and the predetermined GPU frequency corresponding to the input load information is within a preset range, when the load information of the image to be drawn is input into the trained first model, the optimal GPU frequency that can be used when drawing the image to be drawn output by the first model can be obtained, so that when drawing the image to be drawn, the optimal GPU frequency can be used to draw the image to be drawn, thereby avoiding an increase in power consumption of the electronic device.
[0108] In some embodiments of the present application, the frequency control method provided in the embodiments of the present application may further include the following steps 501 and 502.
[0109] Step 501: The electronic device determines a first adjustment value based on a fourth GPU frequency and a second GPU frequency.
[0110] In some embodiments of the present application, the electronic device may determine the gear corresponding to the fourth GPU frequency by the following formula 4:
[0111]
[0112] Among them, fi is the fourth GPU frequency, flow is the second GPU frequency, and each Δf is a gear.
[0113] In some embodiments of the present application, the electronic device may determine the first range based on the gear corresponding to the fourth GPU frequency, and then use any value in the first range as the first adjustment value.
[0114] Exemplarily, when the gear corresponding to the fourth GPU frequency is 1, the first range can be [0,4); when the gear corresponding to the fourth GPU frequency is 2, the first range can be [4,8); when the gear corresponding to the fourth GPU frequency is 3, the first range can be [8,12); and so on.
[0115] For example, when the first range is [0, 4), 2 in the first range may be used as the first adjustment value.
[0116] Step 502: The electronic device adjusts the third GPU frequency based on the first adjustment value and the first working duration to obtain a fifth GPU frequency.
[0117] In an embodiment of the present application, the fifth GPU frequency is the GPU frequency adjusted from the GPU frequency of the i-th drawing image predicted by the preset model, and the first working duration is the working duration of the GPU when drawing the i-th drawing image.
[0118] In some embodiments of the present application, when the first operating duration is less than the second preset threshold, the electronic device may subtract the first adjustment value from the third GPU frequency to obtain a fifth GPU frequency.
[0119] In some embodiments of the present application, when the first operating duration is greater than the second preset threshold, the electronic device may add the third GPU frequency to the first adjustment value to obtain a fifth GPU frequency.
[0120] In some embodiments of the present application, the second preset threshold is determined based on a first frame rate, where the first frame rate is a frame rate used by the electronic device when historically drawing the first drawing image.
[0121] Exemplarily, when the first frame rate is 60 fps, the second preset threshold may be 16.6 ms.
[0122] For example, the third GPU frequency is A, the first adjustment value is 2, and when the first working duration is less than 16.6 ms, the electronic device can obtain the fifth GPU frequency as: A-2.
[0123] In some embodiments of the present application, the electronic device may adjust the predicted GPU frequency of the i-th drawn image to obtain a fifth GPU frequency when the first loss function is less than a first preset threshold, and then run the GPU at the fifth GPU frequency to continue training the preset model based on the training samples.
[0124] In some embodiments of the present application, after obtaining the fifth GPU frequency, the electronic device may operate the GPU at the fifth GPU frequency, and then, in the process of operating the GPU at the fifth GPU frequency and drawing the i+1th drawing image corresponding to the i+1th training sample among the N training samples, obtain relevant information of the i+1th drawing image (drawing time of the i+1th drawing image, proportion of GPU working time when drawing the i+1th drawing image, load of the GPU when drawing the i+1th drawing image, and fourth load information), where the fourth load information is used to characterize the load condition of the GPU when drawing the i+1th drawing image;
[0125] Then, the electronic device can obtain the GPU frequency of the i+1th drawing image predicted by the preset model based on the fourth load information, and then determine the sixth GPU frequency based on the drawing time of the i+1th drawing image, the proportion of the GPU working time when drawing the i+1th drawing image, and the load of the GPU when drawing the i+1th drawing image, where the sixth GPU frequency is the predetermined GPU frequency corresponding to the fourth load information;
[0126] Then, the electronic device may determine a second loss function based on the predicted GPU frequency of the i+1th drawn image and the sixth GPU frequency, where the second loss function is used to characterize the difference between the predicted GPU frequency of the i+1th drawn image and the sixth GPU frequency;
[0127] Then, when the second loss function is less than the first preset threshold, the electronic device can adjust the predicted GPU frequency of the i+1th drawing image to obtain the seventh GPU frequency (specifically, the electronic device can determine the second adjustment value based on the sixth GPU frequency and the fifth GPU frequency, and then the electronic device adjusts the predicted GPU frequency of the i+1th drawing image based on the second adjustment value and the working time of the GPU when drawing the i+1th drawing image to obtain the seventh GPU frequency).
[0128] Then, the electronic device can run the GPU at the seventh GPU frequency, that is, continue to train the preset model based on the training samples, ..., until the difference between the GPU frequency predicted by the model and the predetermined GPU frequency corresponding to the input load information is within the preset range, so that the training model can be stopped to obtain the trained first model.
[0129] In some embodiments of the present application, after the preset model predicts the GPU frequency of the first drawing image corresponding to the first training sample, the electronic device can determine a third adjustment value based on the predetermined GPU frequency corresponding to the fifth load information and the preset initial GPU frequency, and then adjust the predicted GPU frequency of the first drawing image based on the third adjustment value and the working time of the GPU when drawing the first drawing image to obtain an adjusted GPU frequency.
[0130] In some examples, the fifth load information is used to characterize the load condition of the GPU when drawing the first drawing image.
[0131] In the embodiments of the present application, the value (target) predicted by the expected model set in the present application needs to be constantly adjusted, which is different from the usual machine learning, which is clear. When the preset model is trained (the kernel state driver allows the electronic device to run at the adjusted predicted GPU frequency), all data needs to be recorded at the same time, including the drawing time T of each drawn image, load information, GPU frequency predicted by the model, etc. Taking the 60fps scene as an example, if there are dropped frames in the recorded data (GPU working time>16.6), the target determined in the previous round needs to be adjusted, and the adjusted data is fed to the model to continue training, and then the model is run, the data is recorded, and the model is trained again, and so on. The cycle is repeated many times until the recorded data basically meets expectations.
[0132] In some embodiments of the present application, Figure 4 As shown, the frequency control method provided in the embodiment of the present application may include the following steps S1 to S5.
[0133] S1. The electronic device trains a preset model based on N training samples.
[0134] S2. When the preset model meets expectations, the electronic device completes the training of the preset model to obtain a first model.
[0135] S3. The electronic device obtains first load information of an image to be drawn in the GPU.
[0136] S4. The electronic device inputs the first load information into the first model to obtain the first GPU frequency output by the first model.
[0137] S5. The electronic device controls the GPU to draw the image to be drawn based on the first GPU frequency.
[0138] It should be noted that for the relevant description of step S1 to step S5, reference can be made to the contents of the above embodiment, which will not be repeated here.
[0139] In the embodiments of the present application, the scheme of the present application can achieve the following effects: 1. Adaptability: The electronic device can adjust the GPU frequency in real time based on the load information of the image to be drawn to adapt to different workloads and environmental conditions without relying on previous data, thereby providing more flexible and real-time performance optimization. The load information of the previously drawn image will be used when training data, but the model does not need to rely on previous data when used. 2. Accuracy: The model can accurately predict the optimal GPU frequency through deep learning and data analysis, which is more accurate than traditional methods. 3. Power saving: The GPU frequency prediction method using the model is based on the load information of the image to be drawn, which can more accurately match the current rendering requirements, thereby reducing resource usage when high performance is not required, and saving power consumption.
[0140] In an embodiment of the present application, the electronic device can also train a preset model so that dynamic power management, temperature control, etc. can be achieved through the first model.
[0141] It should be noted that the above-mentioned method embodiments, or various possible implementation methods in each method embodiment, can be executed separately, or, under the premise that there is no contradiction, can also be executed in combination with each other. The specific implementation can be determined according to actual usage requirements, and the embodiments of the present application do not limit this.
[0142] It should be noted that the frequency control method provided in the embodiment of the present application can be executed by a frequency control device. In the embodiment of the present application, the frequency control device provided in the embodiment of the present application is described by taking the frequency control method executed by the frequency control device as an example.
[0143] Figure 5 A possible structural diagram of a frequency control device involved in an embodiment of the present application is shown. Figure 5 As shown, the frequency control device 70 may include: an acquisition module 71 , a processing module 72 and a control module 73 .
[0144] The acquisition module 71 is used to acquire first load information of the image to be drawn in the GPU, and the first load information is used to represent the load condition of the GPU when drawing the image to be drawn.
[0145] The processing module 72 is used to input the first load information obtained by the obtaining module 71 into the first model to obtain the first GPU frequency output by the first model, where the first GPU frequency is determined by the first model according to the first load information.
[0146] The control module 73 is used to control the GPU to draw the image to be drawn based on the first GPU frequency obtained by the processing module 72.
[0147] The embodiment of the present application provides a frequency control device, because before drawing each image, the electronic device can first determine the GPU frequency that is most suitable for the image to be drawn according to the actual load information of the image to be drawn, so that the GPU draws the image to be drawn based on the GPU frequency that is most suitable for the image to be drawn, thereby avoiding the problem of excessive or insufficient performance when drawing the image to be drawn, which leads to increased power consumption of the frequency control device. Therefore, the power consumption of the frequency control device is reduced.
[0148] In a possible implementation manner, the first load information includes at least one of the following: graphics rendering information, multi-threaded computing information, resource conversion information, and bandwidth optimization information.
[0149] In a possible implementation, the processing module 72 is further used to train the preset model based on N training samples to obtain a first model before the acquisition module 71 acquires the first load information of the image to be drawn in the GPU; wherein each training sample corresponds to a drawn image, and the training sample includes: the drawing time of the drawing image corresponding to the training sample, the proportion of the GPU working time when drawing the drawing image corresponding to the training sample, the load of the GPU when drawing the drawing image corresponding to the training sample, and the second load information of the drawing image corresponding to the training sample, the second load information is used to characterize the load condition of the GPU when drawing the drawing image corresponding to the training sample, and N is an integer greater than 1.
[0150] In a possible implementation, the processing module 72 is specifically used to obtain the drawing time of the i-th drawing image, the proportion of GPU working time when drawing the i-th drawing image, the load of the GPU when drawing the i-th drawing image, and the third load information during the process of drawing the i-th drawing image corresponding to the i-th training sample among the N training samples based on the second CPU frequency, wherein the third load information is used to characterize the load condition of the GPU when drawing the i-th drawing image, the second GPU frequency is the GPU frequency adjusted from the GPU frequency of the i-1-th drawing image predicted by the preset model, and the i-1-th drawing image is the i-1-th training sample among the N training samples. corresponding drawing image; and based on the third load information, obtaining a third CPU frequency, the third CPU frequency being the GPU frequency of the i-th drawing image predicted by the preset model; and based on the drawing time of the i-th drawing image, the proportion of the GPU working time when drawing the i-th drawing image, and the load of the GPU when drawing the i-th drawing image, determining a fourth GPU frequency, the fourth GPU frequency being the predetermined GPU frequency corresponding to the third load information; and based on the third GPU frequency and the fourth GPU frequency, determining a first loss function, the first loss function being used to characterize the difference between the third GPU frequency and the fourth GPU frequency; and training the preset model based on the first loss function.
[0151] In one possible implementation, the processing module 72 is specifically used to determine a first working time of the GPU when drawing the i-th drawing image based on the drawing time of the i-th drawing image and the proportion of the GPU working time when drawing the i-th drawing image; and determine a fourth GPU frequency based on the first working time and the load of the GPU when drawing the i-th drawing image.
[0152] In one possible implementation, the processing module 72 is further used to determine a first adjustment value based on the fourth GPU frequency and the second GPU frequency; and adjust the third GPU frequency based on the first adjustment value and the first working duration to obtain a fifth GPU frequency, where the fifth GPU frequency is the GPU frequency adjusted for the GPU frequency of the i-th drawing image predicted by a preset model, and the first working duration is the working duration of the GPU when drawing the i-th drawing image.
[0153] The frequency control device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (Augmented Reality, AR) / virtual reality (Virtual Reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (Ultra-Mobile Personal Computer, UMPC), a netbook or a personal digital assistant (Personal Digital Assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (Personal Computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0154] The frequency control device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0155] The frequency control device provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0156] Alternatively, if Figure 6 As shown, an embodiment of the present application also provides an electronic device 900, including a processor 901 and a memory 902, wherein the memory 902 stores programs or instructions that can be executed on the processor 901, and when the program or instructions are executed by the processor 901, the various steps of the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0157] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0158] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0159] The electronic device 100 includes but is not limited to components such as a radio frequency unit 101, a network module 102, an audio output unit 103, an input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, and a processor 110.
[0160] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 7 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0161] Among them, the processor 110 is used to obtain first load information of the image to be drawn in the GPU, the first load information is used to characterize the load condition of the GPU when drawing the image to be drawn; and input the first load information into the first model to obtain a first GPU frequency output by the first model, the first GPU frequency is determined by the first model according to the first load information; and control the GPU to draw the image to be drawn based on the first GPU frequency obtained by processing the processing module 72.
[0162] The embodiment of the present application provides an electronic device, because before drawing each image, the electronic device can first determine the GPU frequency that is most suitable for the image to be drawn according to the actual load information of the image to be drawn, so that the GPU draws the image to be drawn based on the GPU frequency that is most suitable for the image to be drawn, thereby avoiding the problem of excessive or insufficient performance when drawing the image to be drawn, which leads to increased power consumption of the electronic device. Therefore, the power consumption of the electronic device is reduced.
[0163] In some embodiments of the present application, the above-mentioned first load information includes at least one of the following: graphics rendering information, multi-threaded computing information, resource conversion information, and bandwidth optimization information.
[0164] In some embodiments of the present application, the processor 110 is further used to train a preset model based on N training samples to obtain a first model before obtaining first load information of an image to be drawn in the GPU; wherein each training sample corresponds to a drawn image, and the training sample includes: the drawing time of the drawn image corresponding to the training sample, the proportion of GPU working time when drawing the drawing image corresponding to the training sample, the load of the GPU when drawing the drawing image corresponding to the training sample, and second load information of the drawing image corresponding to the training sample, the second load information is used to characterize the load condition of the GPU when drawing the drawing image corresponding to the training sample, and N is an integer greater than 1.
[0165] In some embodiments of the present application, the processor 110 is specifically used to obtain the drawing time of the i-th drawing image, the proportion of GPU working time when drawing the i-th drawing image, the load of the GPU when drawing the i-th drawing image, and the third load information during the process of drawing the i-th drawing image corresponding to the i-th training sample among N training samples based on the second CPU frequency, wherein the third load information is used to characterize the load condition of the GPU when drawing the i-th drawing image, the second GPU frequency is the GPU frequency adjusted from the GPU frequency of the i-1-th drawing image predicted by the preset model, and the i-1-th drawing image is the i-1-th training sample corresponding to the N training samples. a drawing image; and based on the third load information, obtaining a third CPU frequency, the third CPU frequency being the GPU frequency of the i-th drawing image predicted by the preset model; and based on the drawing time of the i-th drawing image, the proportion of the GPU working time when drawing the i-th drawing image, and the load of the GPU when drawing the i-th drawing image, determining a fourth GPU frequency, the fourth GPU frequency being the predetermined GPU frequency corresponding to the third load information; and based on the third GPU frequency and the fourth GPU frequency, determining a first loss function, the first loss function being used to characterize the difference between the third GPU frequency and the fourth GPU frequency; and training the preset model based on the first loss function.
[0166] In some embodiments of the present application, the processor 110 is specifically used to determine a first working duration of the GPU when drawing the i-th drawing image based on the drawing duration of the i-th drawing image and the proportion of the GPU working time when drawing the i-th drawing image; and determine a fourth GPU frequency based on the first working duration and the load of the GPU when drawing the i-th drawing image.
[0167] In some embodiments of the present application, the processor 110 is further used to determine a first adjustment value based on the fourth GPU frequency and the second GPU frequency; and adjust the third GPU frequency based on the first adjustment value and the first working duration to obtain a fifth GPU frequency, wherein the fifth GPU frequency is the GPU frequency adjusted from the GPU frequency of the i-th drawing image predicted by a preset model, and the first working duration is the working duration of the GPU when drawing the i-th drawing image.
[0168] The electronic device provided in the embodiment of the present application can implement each process implemented in the above method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0169] The beneficial effects of various implementations in this embodiment can be specifically referred to the beneficial effects of the corresponding implementations in the above method embodiment. To avoid repetition, they will not be described again here.
[0170] It should be understood that in the embodiment of the present application, the input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, and the graphics processor 1041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 107 includes a touch panel 1071 and at least one of other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0171] The memory 109 can be used to store software programs and various data. The memory 109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 109 may include a volatile memory or a non-volatile memory, or the memory 109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0172] The processor 110 may include one or more processing units; optionally, the processor 110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 110.
[0173] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0174] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0175] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0176] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0177] An embodiment of the present application provides a computer program / program product, which is stored in a storage medium. The program / program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0178] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0179] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0180] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A frequency control method, characterized in that: The method comprises: Acquire first load information of an image to be drawn in a graphics processor (GPU), wherein the first load information is used to characterize a load condition of the GPU when drawing the image to be drawn; Inputting the first load information into a first model to obtain a first GPU frequency output by the first model, where the first GPU frequency is determined by the first model according to the first load information; The GPU is controlled to draw the image to be drawn based on the first GPU frequency.
2. The method according to claim 1, characterized in that The first load information includes at least one of the following: graphics rendering information, multi-threaded computing information, resource conversion information, and bandwidth optimization information.
3. The method according to claim 1, characterized in that Before obtaining first load information of an image to be drawn in the GPU, the method further includes: Based on N training samples, the preset model is trained to obtain the first model; Among them, each training sample corresponds to a drawing image, and the training sample includes: the drawing time of the drawing image corresponding to the training sample, the proportion of GPU working time when drawing the drawing image corresponding to the training sample, the load of the GPU when drawing the drawing image corresponding to the training sample, and the second load information of the drawing image corresponding to the training sample, the second load information is used to characterize the load condition of the GPU when drawing the drawing image corresponding to the training sample, and N is an integer greater than 1.
4. The method according to claim 3, characterized in that The step of training the preset model based on the N training samples includes: In the process of drawing an i-th drawing image corresponding to an i-th training sample among the N training samples based on the second CPU frequency, obtaining a drawing time of the i-th drawing image, a proportion of the GPU working time when drawing the i-th drawing image, a load of the GPU when drawing the i-th drawing image, and third load information, wherein the third load information is used to characterize the load condition of the GPU when drawing the i-th drawing image, the second GPU frequency is a GPU frequency adjusted from the GPU frequency of the i-1-th drawing image predicted by the preset model, and the i-1-th drawing image is a drawing image corresponding to the i-1-th training sample among the N training samples; Based on the third load information, a third CPU frequency is obtained, where the third CPU frequency is the GPU frequency of the i-th drawn image predicted by the preset model; Determine a fourth GPU frequency based on a drawing time of the i-th drawing image, a proportion of the GPU working time when drawing the i-th drawing image, and a load of the GPU when drawing the i-th drawing image, where the fourth GPU frequency is a predetermined GPU frequency corresponding to the third load information; Determine a first loss function based on the third GPU frequency and the fourth GPU frequency, wherein the first loss function is used to characterize a difference between the third GPU frequency and the fourth GPU frequency; Based on the first loss function, the preset model is trained.
5. The method according to claim 4, characterized in that The determining of the fourth GPU frequency based on the drawing time of the i-th drawing image, the proportion of the GPU working time when drawing the i-th drawing image, and the load of the GPU when drawing the i-th drawing image includes: Determine a first working time of the GPU when drawing the i-th drawing image based on the drawing time of the i-th drawing image and the proportion of the working time of the GPU when drawing the i-th drawing image; The fourth GPU frequency is determined based on the first working time and the load of the GPU when drawing the i-th drawing image.
6. The method according to claim 4 or 5, characterized in that: The method further comprises: Determining a first adjustment value based on the fourth GPU frequency and the second GPU frequency; Based on the first adjustment value and the first working time, the third GPU frequency is adjusted to obtain a fifth GPU frequency, wherein the fifth GPU frequency is the GPU frequency after adjusting the GPU frequency of the i-th drawing image predicted by the preset model, and the first working time is the working time of the GPU when drawing the i-th drawing image.
7. A frequency control device, characterized in that: The device comprises: an acquisition module, a processing module and a control module; An acquisition module, used for acquiring first load information of an image to be drawn in a graphics processor GPU, wherein the first load information is used for representing a load condition of the GPU when drawing the image to be drawn; The processing module is configured to input the first load information acquired by the acquisition module into a first model to obtain a first GPU frequency output by the first model, where the first GPU frequency is determined by the first model according to the first load information; The control module is used to control the GPU to draw the image to be drawn based on the first GPU frequency obtained by the processing module.
8. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the frequency control method according to any one of claims 1 to 6 are implemented.
9. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the frequency control method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product is stored in a storage medium, and the program product is executed by at least one processor to implement the steps of the frequency control method according to any one of claims 1 to 6.