Processor frequency modulation method, device, equipment and computer program product
By using targeted load tracing, the processor utilization and target operating frequency are determined based on the attributes of the tasks running in the processor cluster. This solves the problem of inaccurate load tracing in multi-core processor frequency tuning and achieves the effect of reducing power consumption while ensuring performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-12-27
- Publication Date
- 2026-06-30
Smart Images

Figure CN122309103A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of processors, and in particular to a processor frequency modulation method, apparatus, device, and computer program product. Background Technology
[0002] As applications become more complex, more and more terminals are being configured with multicore CPUs to improve the performance of the terminals when running applications.
[0003] Typically, multi-core processors are divided into multiple processor clusters, each containing at least one processor. During terminal operation, the processors within a cluster can be uniformly frequency-adjusted based on the real-time load. Summary of the Invention
[0004] This application provides a processor frequency modulation method, apparatus, device, and computer program product. The technical solution is as follows:
[0005] On one hand, embodiments of this application provide a processor frequency modulation method, the method comprising:
[0006] Based on the task attributes of the tasks running in the processor cluster, load tracing is performed on each processor in the processor cluster to obtain the processor utilization of each processor. The processor cluster contains at least one processor, and different task attributes correspond to different load tracing methods.
[0007] The target operating frequency of the processor cluster is determined based on the processor utilization of each processor in the processor cluster.
[0008] The operating frequency of each processor in the processor cluster is adjusted to the target operating frequency.
[0009] On the other hand, embodiments of this application provide a processor frequency modulation device, the device comprising:
[0010] The load tracing module is used to perform load tracing on each processor in the processor cluster based on the task attributes of the tasks running in the processor cluster, and to obtain the processor utilization of each processor. The processor cluster contains at least one processor, and different task attributes correspond to different load tracing methods.
[0011] A frequency modulation module is used to determine the target operating frequency of the processor cluster based on the processor utilization rate of each processor in the processor cluster;
[0012] The frequency modulation module is also used to adjust the operating frequency of each processor in the processor cluster to the target operating frequency.
[0013] On the other hand, embodiments of this application provide a computer device including a processor and a memory, wherein the memory stores at least one computer instruction, which is loaded and executed by the processor to implement the processor frequency modulation method as described above.
[0014] On the other hand, embodiments of this application provide a computer-readable storage medium storing at least one computer instruction, which is executed by a processor to implement the processor frequency modulation method as described above.
[0015] On the other hand, embodiments of this application provide a computer program product, the computer program product including computer instructions stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the processor frequency modulation method as described above.
[0016] In this embodiment, instead of using a uniform load tracing method, the processor utilization is determined based on the task attributes of the tasks running by the processor cluster. A load tracing method matching these task attributes is used to perform load tracing on each processor in the cluster, obtaining the processor utilization of each individual processor. The target operating frequency of the processor cluster is then determined based on the processor utilization of each processor. Using a targeted load tracing method based on task attributes improves the accuracy of the determined processor utilization, thereby contributing to the accuracy of the target operating frequency determined based on processor utilization. Furthermore, frequency adjustment of the processor cluster based on this target operating frequency reduces power consumption while maintaining performance. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of a processor cluster in a multi-core processor, illustrating an exemplary embodiment of this application;
[0018] Figure 2 A flowchart illustrating a processor frequency modulation method provided in an exemplary embodiment of this application is shown;
[0019] Figure 3 This is a schematic diagram illustrating a processor periodically executing rendering tasks, as shown in an exemplary embodiment of this application.
[0020] Figure 4 This is a schematic diagram illustrating load tracing according to a fixed window, as shown in an exemplary embodiment of this application;
[0021] Figure 5This is a schematic diagram illustrating a rendering task and the allocation of rendering critical tasks in an exemplary embodiment of this application;
[0022] Figure 6 This is an exemplary embodiment of the present application illustrating an implementation of determining a variable load tracking window based on the starting point of adjacent frames;
[0023] Figure 7 This is an exemplary embodiment of the present application illustrating an implementation of determining a variable load tracking window based on adjacent queue buffer time points;
[0024] Figure 8 This is a flowchart illustrating the process of determining the target operating frequency of a processor cluster, as shown in an exemplary embodiment of this application;
[0025] Figure 9 This is a schematic diagram illustrating an ideal stable load scenario in an exemplary embodiment of this application;
[0026] Figure 10 This is a flowchart illustrating the process of determining the expected operating frequency of a processor performing a rendering-critical task, as shown in an exemplary embodiment of this application.
[0027] Figure 11 This is a schematic diagram illustrating an implementation of a single-frame compensation process in an exemplary embodiment of this application;
[0028] Figure 12 This is a schematic diagram illustrating an embodiment of the processor frequency modulation process in a rendering scene, as shown in an exemplary embodiment of this application.
[0029] Figure 13 A structural block diagram of a processor frequency modulation device provided in another exemplary embodiment of this application is shown;
[0030] Figure 14 A structural block diagram of a computer device provided in an exemplary embodiment of this application is shown. Detailed Implementation
[0031] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0032] In this article, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0033] For ease of understanding, the terms used in the embodiments of this application will be explained below.
[0034] Utilization includes processor utilization and task utilization. Processor utilization represents the workload of the processor, while task utilization represents the workload of the task (the demand on processor computing power).
[0035] Multi-core processors typically include multiple processors with different computing capacities, such as large cores, medium cores, and small cores (with decreasing computing power in that order). For a given processor, the computing power it outputs varies depending on its operating frequency. To normalize these computing powers, the computing power output of a large core at its highest operating frequency is usually defined as 1024, and the computing power of medium and small cores (referring to their output at their highest operating frequencies) is also based on the large core's computing power. For example, when the large core's computing power is 1024 and its highest operating frequency is 3GHz, and the small core's computing power is 256 and its highest operating frequency is 2GHz, then for the small core, when it runs at 1GHz, its output computing power is (1GHz / 2GHz*256) = 128; for the large core, when it runs at 1GHz, its output computing power is (1GHz / 3GHz*1024) = 341.33.
[0036] When calculating processor utilization or task utilization within a statistical window, the task execution time needs to be normalized to the maximum computing power processor to obtain the normalized execution time of the task executed by the maximum computing power processor at its highest operating frequency.
[0037] Load tracking refers to the process of dynamically determining processor utilization during processor operation. Common load tracking methods include PELT (Per-Entity Load Tracking) and WALT (Window Assisted Load Tracking).
[0038] Target load, also known as the busy-idle ratio, refers to the proportion of the processor's running time to the sum of its running and idle times. When adjusting the processor frequency based on processor utilization, the goal is to maintain the target load by adjusting the processor's operating frequency. Specifically, under the same target load, the higher the processor utilization, the higher the required operating frequency; conversely, the lower the processor utilization, the lower the required operating frequency.
[0039] In multi-core processors, processors are organized in clusters, with each cluster containing one or more processors. (Illustrative example, such as...) Figure 1As shown, the 8-core processor is organized into 3 processor clusters. The first processor cluster includes CPU0, CPU1, CPU2 and CPU3, the second processor cluster includes CPU4, CPU5 and CPU6, and the third processor cluster includes CPU7.
[0040] In a processor cluster, all CPUs are uniformly frequency-adjusted and operate at the same working frequency. In related technologies, when adjusting the frequency of a processor cluster, the system kernel performs load tracking on each processor in the cluster to obtain the processor utilization of each processor. The maximum processor utilization in the cluster is then determined as the utilization of the processor cluster. Subsequently, through a linear mapping relationship, the utilization of the processor cluster is mapped to the processor's working frequency.
[0041] In related technologies, the system kernel determines processor utilization using a unified load tracing method for different processor clusters. For example, the system kernel uses PELT or WALT to perform load tracing on the processor.
[0042] Considering the richness of tasks run by the processor and the unique characteristics of each task, to improve the accuracy of processor frequency adjustment when running different tasks, in this embodiment, the system kernel does not use a uniform load tracing method. Instead, it uses a load tracing method suitable for the task attributes of the tasks running in the processor cluster to perform load tracing on the processors in that cluster, obtaining the processor utilization of each processor and improving the accuracy of the determined processor utilization. Furthermore, based on the processor utilization of each processor in the cluster, the system kernel comprehensively determines the target operating frequency of the processor cluster and performs uniform frequency adjustment on the processors in the cluster based on this target operating frequency. Because the accuracy of the determined processor utilization is improved, the final determined target operating frequency can reduce processor power consumption while ensuring task performance.
[0043] In the following embodiments, the processor frequency modulation method is used as an example to describe a computer device with a multi-core processor. This computer device can be a smartphone, tablet, wearable device, personal computer, etc., and this application does not limit this. Furthermore, for ease of explanation, the following embodiments use the system kernel performing processor frequency modulation as an example.
[0044] Please refer to Figure 2 The diagram illustrates a flowchart of a processor frequency modulation method provided in an exemplary embodiment of this application. The method may include the following steps.
[0045] Step 201: Based on the task attributes of the tasks running in the processor cluster, perform load tracing on each processor in the processor cluster to obtain the processor utilization of each processor. The processor cluster contains at least one processor, and different task attributes correspond to different load tracing methods.
[0046] The task attribute can be the task type, task name, task group (e.g., task groups are divided according to user experience related and non-user experience related), etc., and this application embodiment does not limit this.
[0047] In one possible implementation, when running tasks with multiple task attributes in a processor cluster, the system kernel determines the task attribute of the task with the largest proportion among the tasks run by the processor cluster as the task attribute of the task run by the processor cluster.
[0048] In another possible implementation, when the system kernel performs task scheduling, it schedules tasks with the same task attributes to the same processor cluster based on task attributes. Accordingly, the system kernel determines the task attributes of the tasks running in the processor cluster based on the task attributes used in the task scheduling process.
[0049] In some embodiments, the system kernel pre-sets a correspondence between task attributes and load tracing methods, thereby determining the appropriate load tracing method for each processor cluster based on this correspondence. Specifically, for processor clusters running tasks with specific task attributes, the accuracy of processor utilization obtained by using the specific load tracing method corresponding to that specific task attribute in the correspondence is higher than the accuracy of processor utilization obtained by using other load tracing methods.
[0050] For multiple processors in a processor cluster, the computer device performs load tracking on different processors using a unified load tracking method to obtain the processor utilization of each processor.
[0051] Step 202: Determine the target operating frequency of the processor cluster based on the processor utilization of each processor in the processor cluster.
[0052] When a processor cluster contains a single processor, the system kernel determines the target operating frequency of the processor cluster based on the processor utilization of that single processor. The target operating frequency is positively correlated with the processor utilization.
[0053] When a processor cluster contains multiple processors, the system kernel determines the target operating frequency of the processor cluster based on the processor utilization of the multiple processors.
[0054] Optionally, the system kernel can determine the expected operating frequency of each processor based on its individual processor utilization, and then combine these expected operating frequencies to determine the target operating frequency of the processor cluster. Alternatively, the system kernel can determine the processor utilization of the processor cluster based on the individual processor utilization, and then determine the target operating frequency of the processor cluster based on that processor utilization.
[0055] In some embodiments, the system kernel determines the target operating frequency of the processor cluster based on the processor utilization of each processor and the target load. The target load can be the target load of the processor cluster itself, or the target load of different processors within the processor cluster.
[0056] Step 203: Adjust the operating frequency of each processor in the processor cluster to the target operating frequency.
[0057] Furthermore, based on the target operating frequency, the system kernel performs unified frequency tuning on each processor in the processor cluster, that is, adjusts each processor in the processor cluster to the target operating frequency.
[0058] It should be noted that the above steps are executed cyclically during task execution, meaning the system kernel needs to perform load tracing and processor frequency adjustment in real time. For example, the system kernel performs processor frequency adjustment on a window-by-window basis.
[0059] In summary, in this embodiment, the processor utilization is not determined using a uniform load tracing method. Instead, it is based on the task attributes of the tasks running by the processor cluster, employing a load tracing method that matches those task attributes to perform load tracing on each processor in the cluster, thereby obtaining the processor utilization of each processor. The target operating frequency of the processor cluster is then determined based on the processor utilization of each processor. Using a targeted load tracing method based on task attributes improves the accuracy of the determined processor utilization, which in turn helps improve the accuracy of the target operating frequency determined based on processor utilization. Furthermore, frequency adjustment of the processor cluster based on this target operating frequency reduces power consumption while maintaining performance.
[0060] Load tracing process in rendering scene
[0061] Since frequent frequency adjustments increase the overhead of the system kernel, in some embodiments, the system kernel performs load tracing on a per-window basis, thereby adjusting the frequency during window rollover, which reduces the number of frequency adjustments and lowers the frequency adjustment overhead of the system kernel.
[0062] During computer operation, there are many stable load scenarios, such as game scenarios, video playback scenarios, camera preview scenarios, and other rendering-related scenarios. Tasks in these stable load scenarios usually have specific cycles. For example, in a game scenario, the rendering thread completes rendering tasks according to the set frame rate (such as 60Hz, 120Hz), and the load brought by these rendering tasks is periodically applied to the processor.
[0063] In scenarios with stable workloads, the entire rendering task is completed by multiple tasks in a pipeline manner. For example... Figure 3 As shown, the rendering pipeline includes the logic thread unityMain and the rendering thread unityGfx, and the load of the entire system follows a periodic pattern that varies with the logic thread and the rendering thread.
[0064] Although processor utilization remains relatively stable during each frame rendering task, rendering tasks do not run on the processor in a strictly cyclical manner due to factors such as processor operating frequency and the execution status of logical threads. Therefore, in a rendering scene, if the system kernel determines a fixed-size load tracing window based on the frame rate and performs load tracing within that window, the accuracy of the obtained processor utilization will be low. Figure 4 As shown, when using a fixed-size load tracing window for load tracing, the processor utilization of the processor in the (n-2)th window is very low, while the processor utilization of the processor in the subsequent (n-1)th window increases rapidly.
[0065] To improve the accuracy of load tracing, in this embodiment, based on whether the task is related to rendering, the system kernel divides the task into non-rendering tasks and rendering tasks (i.e., the task attributes include non-rendering tasks and rendering tasks), and schedules the non-rendering tasks and rendering tasks to different processor clusters to achieve isolation between non-rendering tasks and rendering tasks.
[0066] In an illustrative example, when a multi-core processor comprises four processor clusters, and processor cluster 1 (small core cluster) includes CPU0 and CPU1, processor cluster 2 (medium core cluster) includes CPU2, CPU3 and CPU4, processor cluster 3 (medium core cluster) includes CPU5 and CPU6, and processor cluster 4 (large core cluster) includes CPU7, the system kernel can schedule rendering tasks to processor clusters 2 and 4, and schedule non-rendering tasks to processor clusters 1 and 3.
[0067] For non-rendering tasks and rendering tasks, the system kernel employs different load tracing methods to perform load tracing for running non-rendering tasks and running rendering tasks. In one possible implementation, in a rendering scenario, the system kernel performs load tracing for each processor in a processor cluster based on the task attributes of the tasks running in the processor cluster. This can include the following two methods:
[0068] Method 1: In a rendering scenario, when the task running in the processor cluster is a non-rendering task, the system kernel performs load tracking on each processor in the processor cluster based on a fixed load tracking window.
[0069] Among them, rendering tasks are tasks related to rendering, and in a rendering scenario, the execution results of rendering tasks are perceived by the user; non-rendering tasks are tasks unrelated to rendering, and in a rendering scenario, the execution results of non-rendering tasks are not easily perceived by the user.
[0070] For processor clusters running non-rendering tasks, the system kernel uses a fixed load tracing window to perform load tracing on each processor in the cluster. The fixed load tracing window refers to a window with a fixed time span. For example, this fixed load tracing window can be 1024µs.
[0071] In some embodiments, the system kernel can determine the processor utilization based on the normalized runtime of the processor within the fixed load tracking window.
[0072] Method 2: In a rendering scenario, when the task running in the processor cluster is a rendering task, the system kernel performs load tracking on each processor in the processor cluster based on a variable load tracking window to obtain the processor utilization of each processor.
[0073] To improve the accuracy of load tracing for processor clusters running rendering tasks, the system kernel does not use a fixed load tracing window for load tracing. Instead, it uses a variable load tracing window based on the periodic execution characteristics of rendering tasks. In other words, the system kernel can perform load tracing in different load tracing rounds based on windows with different time spans.
[0074] When rendering tasks are run on processor clusters, the specific rendering tasks executed by different processor clusters may differ. For example, the system kernel may assign rendering tasks related to rendering data preparation to one processor cluster and rendering tasks related to rendering operations to another processor cluster.
[0075] To improve the accuracy of load tracing, in one possible implementation, for different processor clusters performing different rendering tasks, the system kernel determines a variable load tracing window based on the task type of the rendering-critical task running in the processor cluster, and then performs load tracing on each processor in the processor cluster within the variable load tracing window to obtain the processor utilization of each processor.
[0076] In some embodiments, when allocating tasks, the system kernel assigns different rendering-critical tasks to different processor clusters to improve task execution quality and efficiency.
[0077] Optionally, the rendering critical task refers to the task corresponding to the critical thread during the rendering process.
[0078] Optionally, the rendering critical task may include tasks that prepare rendering data and tasks that perform rendering operations. Illustratively, in the Unity engine, the rendering critical task that prepares rendering data may include the UnityMain task, and the rendering critical task that performs rendering operations may include the UnityGFX task.
[0079] Indicative, such as Figure 5 As shown, the system kernel assigns rendering tasks containing UnityMain tasks to processor cluster 2, and rendering tasks containing UnityGfx tasks to processor cluster 4.
[0080] How to determine the variable load tracking window
[0081] The system kernel determines the variable load trace window differently depending on the rendering critical task. When the rendering critical task includes tasks that prepare rendering data and tasks that perform rendering operations, determining the variable load trace window can include the following two cases:
[0082] Case 1: When the rendering critical task running in the processor cluster is the first rendering critical task, the system kernel determines the time window between the start of adjacent frames as a variable load tracking window. The first rendering critical task refers to the task used to prepare rendering data.
[0083] In some embodiments, the first rendering critical task serves as the main thread in the rendering process, responsible for handling logic, updating objects, processing input, and other operations. It needs to be executed before each frame's rendering operation. Therefore, when determining the processor utilization when preparing rendering data for a single frame, the processor utilization obtained by load tracking with frames as the time window is more accurate and can more realistically reflect the processor's load when preparing rendering data for a single frame.
[0084] Therefore, in this embodiment, the system kernel can identify the frame start point and determine the time window between adjacent frame start points as the variable load tracking window for load tracking of the first rendering critical task. It should be noted that in a rendering scenario with a specific frame rate, the time window between adjacent frame start points will differ (usually fluctuating around the standard single frame duration corresponding to the frame rate), and correspondingly, the variable load tracking window for load tracking of the first rendering critical task changes dynamically.
[0085] Optionally, the system kernel can identify the frame start point by hooking (capturing) the frame start point signal, or it can identify the frame start point in other ways. This embodiment does not limit this.
[0086] In an illustrative example, in Figure 5 On the basis of, such as Figure 6 As shown, for processor cluster 2 running the UnityMain task, a rendering-critical task, the system kernel determines the time window between the start of adjacent frames as a variable load tracking window, and performs load tracking on CPUs 2, 3, and 4 within the variable load tracking window to obtain the processor utilization of CPUs 2, 3, and 4 within the variable load tracking window.
[0087] Scenario 2: When the rendering critical task running in the processor cluster is the second rendering critical task, the system kernel determines the time window between adjacent queue buffer time points as the variable load tracking window. The second rendering critical task refers to the task used to perform rendering operations.
[0088] In some embodiments, the second rendering critical task, as the task performing rendering operations, is typically executed when a queue buffer is needed. Therefore, when determining processor utilization during the rendering of a single frame, the processor utilization obtained by load tracking with the queue buffer as the time window is more accurate and can more realistically reflect the processor load when performing rendering operations.
[0089] Therefore, in this embodiment, the system kernel can identify queue buffer time points and determine the time window between adjacent queue buffer time points as a variable load tracking window for load tracking of the second rendering critical task. It should be noted that in a rendering scenario with a specific frame rate, the time window between adjacent queue buffer time points will differ (usually fluctuating around the standard single frame duration corresponding to the frame rate), and correspondingly, the variable load tracking window for load tracking of the second rendering critical task changes dynamically.
[0090] Optionally, the system kernel can determine the queue buffer time point by recognizing the falling or rising edge of vsyn-sf (surfaceFlinger), or it can use other methods to recognize the queue buffer time point. This embodiment does not limit this.
[0091] In an illustrative example, in Figure 5 On the basis of, such as Figure 7 As shown, for processor cluster 4 running the UnityGfx task, a rendering-critical task, the system kernel determines the time window between adjacent queue buffer time points as the variable load tracing window, and performs load tracing on CPU 7 within the variable load tracing window to obtain the processor utilization of CPU 7 within the variable load tracing window.
[0092] It should be noted that the above embodiments are only illustrated using the first and second rendering critical tasks as examples. The rendering scene can be further subdivided into other rendering critical tasks, and the determination method of the variable load tracking window can be specifically set for the task type of the rendering critical task (such as determining the variable load tracking window based on other time points in the rendering process). The embodiments of this application do not limit the specific rendering critical tasks and the specific determination method of the variable load tracking window.
[0093] In related technologies, the system kernel does not distinguish task attributes when scheduling tasks, but instead adopts a uniform scheduling strategy to allocate tasks to different processors in the processor cluster. However, in this embodiment, in order to further improve the accuracy of load tracing, in addition to isolating rendering tasks and non-rendering tasks at the processor cluster level, the system kernel needs to isolate rendering-critical tasks and non-rendering-critical tasks at the processor level based on task attributes.
[0094] In one possible implementation, when the processor cluster contains at least two processors, the system kernel schedules rendering-critical tasks and non-rendering-critical tasks in the rendering task to different processors to ensure that rendering-critical tasks are executed only on the same processor.
[0095] Indicative, such as Figure 5 As shown, the system kernel assigns the UnityMain rendering-critical task to CPU2 in processor cluster 2, while other non-rendering-critical tasks (threads A, B, C, and D) are assigned to CPUs 3 and 4 in processor cluster 2. Since processor cluster 4 contains only a single processor, the system kernel assigns the UnityGfx task to CPU7 in processor cluster 4.
[0096] In this embodiment, the system kernel isolates non-rendering and rendering tasks by assigning them to different processor clusters. Subsequently, a variable load tracing window is used for load tracing of rendering tasks, improving the accuracy of load tracing on the processors running the rendering tasks. This helps ensure the quality of rendering task execution and enhances the user experience in the rendering scene. Furthermore, since the system kernel only performs frequency adjustment during window rollover, it helps reduce the number of frequency adjustments and lower the frequency adjustment overhead of the system content.
[0097] Furthermore, by further subdividing rendering-critical tasks into non-rendering-critical tasks and determining a variable load tracking window based on the task characteristics of rendering-critical tasks, the processor load determined by this variable load tracking window can more realistically reflect the actual load of the processor when executing rendering-critical tasks, thereby improving the accuracy of the subsequently determined target operating frequency. Moreover, isolating rendering-critical and non-rendering-critical tasks by processor, allowing rendering-critical tasks to run on dedicated processors, helps improve the task execution quality of rendering-critical tasks.
[0098] Target load of processor cluster
[0099] In related technologies, different processor clusters of multi-core processors are configured with a uniform target load, meaning that the frequency modulation tendency of different processor clusters remains consistent, making it impossible to balance performance and power consumption. However, in this embodiment, during a rendering scenario, the system kernel allocates rendering tasks and non-rendering tasks to different processor clusters. Since rendering tasks have a greater impact on user experience than non-rendering tasks, the system kernel can set different target loads for different processor clusters to achieve different frequency modulation tendencies in order to balance performance and power consumption during rendering.
[0100] In one possible implementation, the system kernel sets the target load for each processor cluster based on the task attributes of the tasks running on that cluster, where different task attributes correspond to different target loads. Accordingly, when determining the target operating frequency of a processor cluster, the system kernel determines the target operating frequency of the processor cluster based on the processor utilization of each processor in the cluster and the target load corresponding to the processor cluster.
[0101] In some embodiments, the system kernel may use the same method as determining the load tracing method to distinguish processor clusters with different task attributes, and set the target load corresponding to each processor cluster based on the correspondence between task attributes and target load.
[0102] For processor clusters with different target loads, the system kernel's frequency adjustment tendency differs depending on the processor utilization. Specifically, the higher the target load of a processor cluster, the more conservative the system kernel tends to increase the frequency to reduce power consumption, resulting in a lower target operating frequency. Conversely, the lower the target load of a processor cluster, the more timely the system kernel tends to increase the frequency to ensure performance, resulting in a higher target operating frequency.
[0103] In some embodiments, the system kernel sets a target load for a processor cluster based on whether the task running on the processor cluster is related to rendering.
[0104] In one possible implementation, in a rendering scenario, if the task running on the processor cluster is a non-rendering task, the system kernel sets the processor cluster as the first target load.
[0105] In a rendering scenario, when the task running on the processor cluster is a rendering task, the system kernel sets the processor cluster as the second target load, which is less than the first target load.
[0106] Since the results of rendering tasks directly affect the user experience in a rendering scenario, while the results of non-rendering tasks have a smaller impact on the user experience, in order to ensure the performance of the processor clusters running rendering tasks, the system kernel sets a larger first target load for the processor clusters running non-rendering tasks, conservatively increases the frequency of the processor clusters, and reduces the operating power consumption of the processor clusters; and sets a smaller second target load for the processor clusters running rendering tasks, so as to increase the frequency in a timely manner when the processor utilization is improved, thus ensuring the performance of rendering tasks.
[0107] In an illustrative example, the system kernel sets a target load of 80% for processor clusters running non-rendering tasks and 50% for processor clusters running rendering tasks.
[0108] In other possible implementations, in a rendering scenario, the system kernel can further subdivide the rendering tasks and set different target loads for different subdivision types of rendering tasks, thereby setting different target loads for different processor clusters running different subdivision types of rendering tasks.
[0109] Optionally, different target loads can be set for different sub-types of rendering tasks based on their importance and / or complexity. For example, the target load can be negatively correlated with importance and workload; that is, the higher the importance and complexity of the rendering tasks run by the processor cluster, the smaller the target load should be set for that processor cluster to ensure the performance of important and complex rendering tasks. Conversely, the lower the importance and complexity of the rendering tasks run by the processor cluster, the larger the target load should be set for that processor cluster to reduce the power consumption of the processor cluster.
[0110] Optionally, different target loads can be set for rendering critical tasks of different task types, thereby setting the target load for the processor cluster based on the rendering critical tasks running by the processor cluster. (Illustrative example, such as...) Figure 5 As shown, the system kernel runs the rendering critical task UnityMain based on processor cluster 2, with a target load of 60% for processor cluster 2, and the rendering critical task UnityGfx based on processor cluster 4, with a target load of 50% for processor cluster 5.
[0111] Of course, in addition to setting the target load of processor clusters based on whether it is related to rendering, the importance and complexity of the task, and the task type of rendering-critical tasks, the system kernel can also set different target loads for different processor clusters running different tasks based on other task attributes. This application embodiment does not constitute a limitation in this regard.
[0112] In this embodiment, the system kernel sets target loads for different processor clusters based on the task attributes of the tasks running in the processor clusters, taking into account both the performance and power consumption of different processor clusters during processor frequency adjustment. In the rendering scenario, by setting a smaller target load for processor clusters running rendering tasks, the execution quality of rendering tasks that affect user experience is ensured; by setting a larger target load for processors running non-rendering tasks, the power consumption of processor clusters running tasks unrelated to user experience is reduced.
[0113] Determine the target operating frequency of the processor cluster
[0114] In some embodiments, for a processor cluster running non-rendering tasks, the system kernel determines the processor utilization of the processor cluster based on the processor utilization of each processor in the processor cluster (for example, determining the processor utilization of each processor as the processor utilization of the processor cluster), and then determines the target operating frequency of the processor cluster based on the processor utilization of the processor cluster.
[0115] In other embodiments, for a processor cluster running rendering tasks, the system kernel can determine the expected operating frequencies of the processors running rendering-critical tasks and non-rendering-critical tasks, thereby determining the target operating frequency of the processor cluster based on the expected operating frequencies of each processor.
[0116] like Figure 8 As shown, the system kernel can determine the target operating frequency of a processor cluster by including the following steps:
[0117] Step 801: Determine the first desired operating frequency of the first processor based on the first processor utilization of the first processor running the rendering critical task in the processor cluster.
[0118] In rendering scenarios with stable loads, rendering-critical tasks are expected to complete their operations at a stable frame rate. For example, UnityGFX tasks in the Unity engine expect to complete queue buffering operations at a stable frame rate.
[0119] Indicative, such as Figure 9As shown, when the frame rate in the rendering scene is 60Hz, the UnityGfx task expects to stably generate buffered frames at 16.67ms intervals and submit them to SurfaceFlinger for consumption. Similarly, the consumption time of the buffered frames is also a fixed 16.67ms interval (refer to the rising or falling edge of vsync-sf). In an ideal stable load scenario, the load of each frame is equal, and the processor's operating frequency will remain constant without adjustment. However, in reality, the load of different frames fluctuates, meaning the duration for the UnityGfx task to generate buffered frames may be greater than or less than 16.67ms.
[0120] In one possible implementation, the system kernel aims to execute rendering-critical tasks at a stable frame rate and determines a first desired operating frequency of the first processor based on the first processor utilization of the first processor running the rendering-critical tasks.
[0121] When performing rendering-critical tasks at a stable frame rate, the duration of the variable load tracking window remains stable (consistent with the single frame duration corresponding to the frame rate). If the historical variable load tracking window duration is too long, it is necessary to increase the processor's operating frequency to improve the processing speed of the rendering-critical tasks and shorten the duration of the variable load tracking window in the next frame; conversely, if the historical variable load tracking window duration is too short, it is possible to reduce the processor's operating frequency to reduce power consumption. Therefore, in one possible implementation, the system kernel can estimate the expected completion time of the rendering-critical tasks in the next frame and, in conjunction with processor utilization, expected completion time, and target load, determine the expected operating frequency of the processor in the next frame. Optionally, such as... Figure 10 As shown, the process may include the following sub-steps:
[0122] Step 801A: Determine the expected variable load tracking window duration for the next frame based on the historical variable load tracking window duration.
[0123] In one possible implementation, during processor scheduling, for processors running rendering-critical tasks, the system records the duration of the variable load tracing window used each time load tracing is performed on the rendering-critical task. By analyzing the historical duration of the variable load tracing window, it can be determined whether stable rendering should be performed according to the expected frame rate of the current rendering scene.
[0124] For illustration purposes, if the rendering critical task is the first rendering critical task, the duration of the historical variable load tracking window is the duration of the time window between the start points of adjacent historical frames; if the rendering critical task is the second rendering critical task, the duration of the historical variable load tracking window is the duration of the time window between adjacent historical queue buffer time points.
[0125] To determine whether to speed up the rendering task execution (shorten the expected variable load tracking window for the next frame) or slow down the rendering task execution (extend the expected variable load tracking window for the next frame), in one possible implementation, the system kernel determines the single-frame rendering duration based on the rendering frame rate of the rendering scene, and then determines the expected variable load tracking window duration for the rendering critical task in the next frame based on the duration difference between the single-frame rendering duration and the historical variable load tracking window duration.
[0126] The single-frame rendering time is the reciprocal of the rendering frame rate. For example, when the rendering frame rate is 60Hz, the single-frame rendering time is 16.67ms, and when the rendering frame rate is 120Hz, the single-frame rendering time is 8.33ms.
[0127] Specifically, when the single-frame rendering time is less than the historical variable load tracking window time (indicating that the rendering task is executing slowly), it is desirable that the variable load tracking window time be less than the single-frame rendering time (i.e., the rendering task execution speed needs to be accelerated); when the single-frame rendering time is greater than the historical variable load tracking window time (indicating that the rendering task is executing quickly), it is desirable that the variable load tracking window time be greater than the single-frame rendering time (i.e., the rendering task execution speed can be appropriately slowed down).
[0128] In one possible implementation, the system kernel can determine the expected variable load tracking window duration for the next frame by summing the single-frame rendering duration and the duration difference. For example, when the single-frame rendering duration is n1 and the historical variable load tracking window duration is n2, the expected variable load tracking window duration for the next frame is n1 + (n1 - n2).
[0129] In an illustrative example, such as Figure 11 As shown, when the rendering time of a single frame is 16ms, if the variable load tracking window corresponding to the (n+1)th frame is 20ms, the system kernel determines that the time difference is -4ms, and thus determines the expected variable load tracking window time of the next frame as 16ms + (-4ms) = 12ms, which means that the queue buffering speed of the next frame needs to be accelerated.
[0130] In another illustrative example, when the single-frame rendering time is 16ms, if the variable load tracking window corresponding to the (n+1)th frame is 13ms, the system kernel determines the time difference to be +3ms, thus determining the expected variable load tracking window time for the next frame to be 16ms + (+3ms) = 19ms, which means that the queue buffering speed for the next frame needs to be slowed down.
[0131] When the difference between the historical variable load tracking window duration and the single-frame rendering duration is large (i.e., the rendering task is executing too fast or too slow), performing rendering speed compensation in the next frame may cause frame rate fluctuations and excessive frequency adjustments. Therefore, to improve frame rate stability, when the duration difference is large, the system kernel can perform rendering speed compensation over multiple frames.
[0132] In one possible implementation, if the duration difference is less than a difference threshold, the system kernel determines the expected variable load tracking window duration for rendering critical tasks in the next frame based on the duration difference and the single-frame rendering duration.
[0133] If the duration difference is greater than the difference threshold, the system kernel determines the single-frame compensation duration based on the duration difference and the number of compensation frames. Then, based on the single-frame compensation duration and the single-frame rendering duration, it determines the expected variable load tracking window duration for rendering critical tasks in the next frame.
[0134] The difference threshold can be a fixed value or a dynamic value set based on the rendering frame rate. For example, when the current rendering frame rate is 60Hz, the difference threshold can be set to 6ms, while when the current rendering frame rate is 120Hz, the difference threshold can be set to 4ms. This application does not limit the specific setting method of the difference threshold.
[0135] Optionally, the number of compensation frames can be a preset value, or it can be a dynamic value. For example, the number of compensation frames can be 2 frames or 3 frames.
[0136] Optionally, the system kernel determines (duration difference / number of compensation frames) as the single-frame compensation duration, meaning that when performing multi-frame compensation, the compensation duration of each single frame is the same. Alternatively, the compensation durations of each single frame may be different, as long as the sum of the compensation durations of the single frames equals the duration difference.
[0137] In some embodiments, the system kernel determines the single-frame rendering duration and single-frame compensation duration as the expected variable load tracking window duration for the next frame.
[0138] In an illustrative example, when the rendering time of a single frame is 16ms, if the variable load tracking window corresponding to the nth frame is 22ms, the system kernel determines that the duration difference is -6ms and that compensation needs to be performed within 2 frames. That is, the expected variable load tracking window durations for the (n+1)th and (n+2)th frames are determined to be 16ms + (-3ms) = 13ms.
[0139] Step 801B: Based on at least one first processor utilization rate determined during the historical rendering process, determine the estimated processor utilization rate of the first processor in the next frame.
[0140] In one possible implementation, the system kernel determines the estimated processor utilization of the first processor in the next frame based on the first processor utilization of the first processor in the current variable load tracking window (i.e., during the current rendering process).
[0141] In another possible implementation, the system kernel determines the estimated processor utilization of the first processor in the next frame based on the n first processor utilizations of the first processor under n historical variable load tracking windows (i.e., the historical n-frame rendering process).
[0142] Optionally, the system kernel determines the estimated processor utilization as the average of the n first processor utilizations, or the system kernel performs a weighted calculation on the n first processor utilizations to obtain the estimated processor utilization. This application does not limit the specific method for estimating processor utilization.
[0143] Step 801C: Based on the expected variable load tracking window duration, estimated processor utilization, target load corresponding to the processor cluster, and the highest operating frequency of the first processor, determine the first expected operating frequency of the first processor.
[0144] Specifically, the first expected operating frequency is negatively correlated with the expected variable load tracking window duration, positively correlated with the estimated processor utilization, and negatively correlated with the target load. In other words, the shorter the expected variable load tracking window duration for the next frame, the higher the expected operating frequency of the first processor in the next frame, meaning that the execution speed of rendering critical tasks needs to be accelerated by increasing the operating frequency; the higher the estimated processor utilization in the next frame, the higher the expected operating frequency of the first processor in the next frame, in order to meet the processor's target load requirements; the smaller the target load of the processor cluster, the higher the expected operating frequency of the first processor also needs to be to ensure the processor's idle ratio.
[0145] In one possible implementation, the first desired operating frequency of the first processor can be calculated using the following formula:
[0146] Fnext=(Utility_next*Fmax) / (Tnext*Target load)
[0147] Where Fnext is the first expected operating frequency, Utility_next is the estimated processor utilization of the first processor in the next frame, Fmax is the highest operating frequency of the first processor, Tnext is the expected variable load tracking window duration for the next frame, and Target load is the target load of the processor cluster.
[0148] Step 802: Determine the second desired operating frequency of the second processor based on the second processor utilization of the second processor running non-rendering critical tasks in the processor cluster.
[0149] In one possible implementation, for a second processor running non-rendering-critical tasks, the system kernel can determine the second desired operating frequency of the second processor based on the estimated processor utilization of the second processor, the target load corresponding to the processor cluster, the highest operating frequency of the second processor, and the single-frame rendering duration.
[0150] The method for determining the estimated processor utilization of the second processor is similar to the method for determining the estimated processor utilization of the first processor, and will not be described in detail here.
[0151] Among them, the second expected operating frequency is negatively correlated with the single-frame rendering time, positively correlated with the estimated processor utilization, and negatively correlated with the target load.
[0152] In one possible implementation, the first desired operating frequency of the first processor can be calculated using the following formula:
[0153] F'next=(Utility_next'*Fmax') / (T*Target load)
[0154] Where F'next is the second expected operating frequency, Utility_next' is the estimated processor utilization of the second processor in the next frame, Fmax' is the highest operating frequency of the second processor, T is the single-frame rendering duration, and Target load is the target load of the processor cluster.
[0155] In other possible implementations, for different processors within a unified processor cluster, the system kernel can configure different target loads for different processors, wherein the target load configured for a processor is not less than the target load configured for the processor cluster. Optionally, the system kernel can configure a smaller target load for processors running rendering-critical tasks and a larger target load for processors running non-rendering-critical tasks, thereby improving the performance of rendering-critical tasks. Accordingly, when determining the desired operating frequency of different processors, the system kernel determines the desired operating frequency of the processor based on the target load corresponding to each processor.
[0156] Step 803: Determine the target operating frequency of the processor cluster based on the first desired operating frequency and the second desired operating frequency.
[0157] After determining the desired operating frequency of each processor in the processor cluster, the system kernel can determine the target operating frequency of the processor cluster based on the desired operating frequency according to a preset strategy.
[0158] In some embodiments, the preset strategy may include at least one of the following:
[0159] Strategy 1: Determine the maximum value between the first desired operating frequency and the second desired operating frequency as the target operating frequency of the processor cluster.
[0160] To ensure the performance of various rendering tasks within the processor cluster, the system kernel can determine the maximum value between the first desired operating frequency and the second desired operating frequency as the target operating frequency of the processor cluster.
[0161] For example, when a processor cluster contains 3 processors, and the first expected operating frequency of the processor running rendering-critical tasks is 2GHz, and the second expected operating frequency of the processors running non-rendering-critical tasks is 1.5GHz, the system kernel will set the target operating frequency of the processor cluster to 2GHz.
[0162] Strategy 2: Determine the average of the first and second desired operating frequencies as the target operating frequency of the processor cluster.
[0163] To balance performance and power consumption, the system kernel can determine the target operating frequency of the processor cluster by taking the average of the expected operating frequencies of each processor in the cluster. Optionally, this average can be a simple arithmetic mean or a weighted arithmetic mean. When using a weighted arithmetic mean, the weight corresponding to the first expected operating frequency is greater than the weight corresponding to the second expected operating frequency, thus prioritizing the performance of rendering critical tasks.
[0164] For example, when a processor cluster contains 3 processors, and the first expected operating frequency of the processor running rendering-critical tasks is 2GHz, and the second expected operating frequency of the processors running non-rendering-critical tasks is 1.5GHz, the system kernel will determine the target operating frequency of the processor cluster as 2*0.8+1.5*0.1+1.5*0.1=1.9GHz.
[0165] Strategy 3: Determine the average of the second desired operating frequency; the maximum value between the first desired operating frequency and the average value is determined as the target operating frequency of the processor cluster.
[0166] Since there may be multiple processors running non-rendering-critical tasks, and the second expected operating frequencies of different processors may differ, the system kernel can first calculate the average of the second expected operating frequencies (i.e., comprehensively evaluate the expected operating frequencies of processors running non-rendering-critical tasks), and then determine the maximum value between the average and the first expected operating frequency as the target operating frequency of the processor cluster, thus ensuring the running performance of various rendering tasks.
[0167] For example, when a processor cluster contains 3 processors, and the first desired operating frequency of the processor running rendering-critical tasks is 2GHz, and the second desired operating frequencies of the processors running non-rendering-critical tasks are 1.5GHz and 1.7GHz respectively, since the maximum value between the average of the second desired operating frequency of 1.6GHz and the first desired operating frequency of 2GHz is 2GHz, the system kernel determines the target operating frequency of the processor cluster to be 2GHz.
[0168] Of course, the system kernel may also determine the target operating frequency of the processor cluster based on other strategies besides those mentioned above, and the embodiments of this application do not constitute a limitation in this regard.
[0169] In this embodiment, the system kernel performs rendering time compensation when rendering is too fast or too slow based on the relationship between the historical variable load tracking window duration and the single frame rendering duration. This enables rendering-critical tasks to be executed stably according to the frame rate, forming a frequency modulation closed-loop control and improving the stability of the frame rate in the rendering scene.
[0170] Furthermore, during compensation, the system kernel employs a multi-frame compensation method to avoid excessive frequency adjustment caused by single-frame compensation, thus ensuring the stability of the processor's frequency adjustment process.
[0171] In one embodiment, such as Figure 12 As shown, in a rendering scenario, the system kernel allocates rendering tasks and non-rendering tasks to different processor clusters based on task attributes, thus isolating rendering and non-rendering tasks. For processor clusters running rendering tasks, the system kernel further isolates rendering-critical tasks and non-rendering-critical tasks.
[0172] When adjusting the frequency of processor clusters running rendering tasks, the system kernel determines a variable load tracing window based on the task type of rendering-critical tasks. Within this window, load tracing is performed separately for rendering-critical and non-rendering-critical tasks. Specifically, when tracing the load of processors running rendering-critical tasks, the system kernel aims for a stable frame rate and determines the first expected operating frequency for the next frame by predicting the processor utilization and expected runtime (involving a compensation process). When tracing the load of processors running non-rendering-critical tasks, the system kernel determines the second expected operating frequency for the next frame based on the processor utilization and single-frame rendering duration. By combining the first and second expected operating frequencies, the system kernel determines the target operating frequency for the processor cluster running rendering tasks, thus completing the frequency adjustment.
[0173] When adjusting the frequency of processor clusters running non-rendering tasks, the system kernel performs load tracking on the non-rendering tasks running on each processor based on a fixed load tracking window. Based on the maximum processor load in each processor, the target operating frequency of the processor cluster running non-rendering tasks is determined, and then the frequency adjustment is completed.
[0174] Furthermore, the system kernel sets a smaller target load for processor clusters running rendering tasks, improving the timeliness of processor cluster frequency adjustment and ensuring the running quality of rendering tasks; it sets a larger target load for processor clusters running non-rendering tasks, conservatively adjusting the frequency of processor clusters, and reducing the operating power consumption of processor clusters without affecting the user experience.
[0175] Please refer to Figure 13 This illustration shows a structural block diagram of a processor frequency modulation device provided in an exemplary embodiment of this application. The device includes:
[0176] The load tracing module 1301 is used to perform load tracing on each processor in the processor cluster based on the task attributes of the tasks running in the processor cluster, and to obtain the processor utilization of each processor. The processor cluster contains at least one processor, and different task attributes correspond to different load tracing methods.
[0177] Frequency modulation module 1302 is used to determine the target operating frequency of the processor cluster based on the processor utilization rate of each processor in the processor cluster;
[0178] The frequency modulation module 1302 is also used to adjust the operating frequency of each processor in the processor cluster to the target operating frequency.
[0179] Optionally, in the process of performing load tracking on each processor in the processor cluster based on the task attributes of the tasks running in the processor cluster to obtain the processor utilization of each processor, the load tracking module 1301 is used to:
[0180] In a rendering scenario, when the task running in the processor cluster is a non-rendering task, load tracking is performed on each processor in the processor cluster based on a fixed load tracking window.
[0181] In a rendering scenario, when the task running in the processor cluster is a rendering task, load tracking is performed on each processor in the processor cluster based on a variable load tracking window to obtain the processor utilization of each processor.
[0182] Optionally, in the process of performing load tracking on each processor in the processor cluster based on a variable load tracking window to obtain the processor utilization of each processor, the load tracking module 1301 is used to:
[0183] When the task being run by the processor cluster is the rendering task, the variable load tracking window is determined based on the task type of the rendering critical task running in the processor cluster;
[0184] Load tracking is performed on each processor in the processor cluster within the variable load tracking window to obtain the processor utilization of each processor.
[0185] Optionally, during the process of determining the variable load tracing window based on the task type of the rendering-critical task running in the processor cluster, the load tracing module 1301 is used to:
[0186] When the rendering critical task running in the processor cluster is the first rendering critical task, the time window between the start points of adjacent frames is determined as the variable load tracking window, and the first rendering critical task refers to the task used to prepare rendering data.
[0187] When the rendering critical task running in the processor cluster is the second rendering critical task, the time window between adjacent queue buffer time points is determined as the variable load tracking window, and the second rendering critical task refers to the task used to perform rendering operations.
[0188] Optionally, the first rendering critical task is the UnityMain task, and the second rendering critical task is the UnityGFX task.
[0189] Optionally, the device further includes a scheduling module for:
[0190] In the case where the processor cluster contains at least two processors, the rendering critical tasks and non-rendering critical tasks in the rendering task are scheduled to different processors.
[0191] Optionally, the scheduling module is also used for:
[0192] The non-rendering tasks and the rendering tasks are scheduled to different processor clusters.
[0193] Optionally, in determining the target operating frequency of the processor cluster based on the processor utilization of each processor in the processor cluster, the frequency modulation module 1302 is used to:
[0194] Based on the first processor utilization of the first processor running the rendering critical task in the processor cluster, the first desired operating frequency of the first processor is determined.
[0195] The second desired operating frequency of the second processor is determined based on the second processor utilization rate of the second processor running non-rendering critical tasks in the processor cluster.
[0196] The target operating frequency of the processor cluster is determined based on the first desired operating frequency and the second desired operating frequency.
[0197] Optionally, in determining the first desired operating frequency of the first processor based on the first processor utilization rate of the first processor running the rendering-critical task in the processor cluster, the frequency modulation module 1302 is used to:
[0198] Based on the historical variable load tracking window duration, determine the expected variable load tracking window duration for the next frame;
[0199] Based on at least one of the first processor utilization rates determined during the historical rendering process, the estimated processor utilization rate of the first processor in the next frame is determined.
[0200] Based on the expected variable load tracking window duration, the estimated processor utilization, the target load corresponding to the processor cluster, and the highest operating frequency of the first processor, a first expected operating frequency of the first processor is determined. The first expected operating frequency is negatively correlated with the expected variable load tracking window duration, positively correlated with the estimated processor utilization, and negatively correlated with the target load.
[0201] Optionally, in the process of determining the expected variable load tracking window duration for the next frame based on the historical variable load tracking window duration, the load tracking module 1301 is used to:
[0202] Determine the rendering duration of a single frame based on the rendering frame rate of the rendering scene.
[0203] Based on the duration difference between the single-frame rendering duration and the historical variable load tracking window duration, the expected variable load tracking window duration in the next frame is determined.
[0204] Wherein, if the single-frame rendering duration is less than the historical variable load tracking window duration, the expected variable load tracking window duration is less than the single-frame rendering duration; if the single-frame rendering duration is greater than the historical variable load tracking window duration, the expected variable load tracking window duration is greater than the single-frame rendering duration.
[0205] Optionally, in determining the expected variable load tracking window duration for the rendering critical task in the next frame based on the duration difference between the single-frame rendering duration and the historical variable load tracking window duration, the load tracking module 1301 is used to:
[0206] If the duration difference is less than the difference threshold, the expected variable load tracking window duration of the rendering critical task in the next frame is determined based on the duration difference and the single frame rendering duration.
[0207] If the duration difference is greater than the difference threshold, the single-frame compensation duration is determined based on the duration difference and the number of compensation frames; the expected variable load tracking window duration of the rendering critical task in the next frame is determined based on the single-frame compensation duration and the single-frame rendering duration.
[0208] Optional, the frequency modulation module 1302 is used for:
[0209] The maximum value between the first desired operating frequency and the second desired operating frequency is determined as the target operating frequency of the processor cluster;
[0210] The average of the first desired operating frequency and the second desired operating frequency is determined as the target operating frequency of the processor cluster;
[0211] Determine the average of the second desired operating frequency; determine the maximum value between the first desired operating frequency and the average value as the target operating frequency of the processor cluster.
[0212] Optionally, the device further includes a setting module for:
[0213] Based on the task attributes of the tasks running in the processor cluster, the target load corresponding to the processor cluster is set, wherein different task attributes correspond to different target loads;
[0214] The frequency modulation module 1302 is used for:
[0215] The target operating frequency of the processor cluster is determined based on the processor utilization of each processor in the processor cluster and the target load corresponding to the processor cluster.
[0216] Optionally, the setting module is used for:
[0217] In a rendering scenario, if the task running on the processor cluster is a non-rendering task, the processor cluster is set as the first target load.
[0218] In a rendering scenario, if the task running on the processor cluster is a rendering task, the processor cluster is set as a second target load, which is less than the first target load.
[0219] In summary, in this embodiment, the processor utilization is not determined using a uniform load tracing method. Instead, it is based on the task attributes of the tasks running by the processor cluster, employing a load tracing method that matches those task attributes to perform load tracing on each processor in the cluster, thereby obtaining the processor utilization of each processor. The target operating frequency of the processor cluster is then determined based on the processor utilization of each processor. Using a targeted load tracing method based on task attributes improves the accuracy of the determined processor utilization, which in turn helps improve the accuracy of the target operating frequency determined based on processor utilization. Furthermore, frequency adjustment of the processor cluster based on this target operating frequency reduces power consumption while maintaining performance.
[0220] See Figure 14 , Figure 14 This is a schematic diagram of the structure of a computer device provided in an exemplary embodiment of this application. The computer device may include one or more of the following components: a processor 1410 and a memory 1420.
[0221] Optionally, the processor 1410 connects various parts within the electronic device using various interfaces and lines. It performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1420, and by calling data stored in the memory 1420. Optionally, the processor 1410 can be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 1410 can integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Neural-network Processing Unit (NPU), and baseband chip. Specifically, the CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for the touchscreen display; the NPU implements artificial intelligence (AI) functions; and the baseband chip handles wireless communication. It is understandable that the aforementioned baseband chip may not be integrated into the processor 1410, but may be implemented as a separate chip.
[0222] In this embodiment, the processor 1410 is a multi-core processor, and the processors are organized according to processor clusters.
[0223] The memory 1420 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 1420 may include a non-transitory computer-readable storage medium. The memory 1420 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 1420 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function, instructions for implementing the various method embodiments described below, etc.; the data storage area may store data created according to the use of the electronic device, etc.
[0224] In addition, those skilled in the art will understand that the structure of the computer device shown in the above figures does not constitute a limitation on the computer device. The computer device may include more (e.g., screen, communication components, display components) or fewer components than shown, or combine certain components, or have different component arrangements.
[0225] This application provides a computer-readable storage medium storing at least one computer instruction, which is executed by a processor to implement the processor frequency modulation method as described in the above embodiments.
[0226] On the other hand, embodiments of this application provide a computer program product, the computer program product including computer instructions stored in a computer-readable storage medium; a processor reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to implement the processor frequency modulation method as described in the above embodiments.
[0227] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0228] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A processor frequency modulation method, characterized in that, The method includes: Based on the task attributes of the tasks running in the processor cluster, load tracing is performed on each processor in the processor cluster to obtain the processor utilization of each processor. The processor cluster contains at least one processor, and different task attributes correspond to different load tracing methods. The target operating frequency of the processor cluster is determined based on the processor utilization of each processor in the processor cluster. The operating frequency of each processor in the processor cluster is adjusted to the target operating frequency.
2. The method according to claim 1, characterized in that, The process of tracking the load of each processor in the processor cluster based on the task attributes of the tasks running in the processor cluster to obtain the processor utilization of each processor includes: In a rendering scenario, when the task running in the processor cluster is a non-rendering task, load tracking is performed on each processor in the processor cluster based on a fixed load tracking window. In a rendering scenario, when the task running in the processor cluster is a rendering task, load tracking is performed on each processor in the processor cluster based on a variable load tracking window to obtain the processor utilization of each processor.
3. The method according to claim 2, characterized in that, The step of performing load tracking on each processor in the processor cluster based on a variable load tracking window to obtain the processor utilization of each processor includes: When the task being run by the processor cluster is the rendering task, the variable load tracking window is determined based on the task type of the rendering critical task running in the processor cluster; Load tracking is performed on each processor in the processor cluster within the variable load tracking window to obtain the processor utilization of each processor.
4. The method according to claim 3, characterized in that, Determining the variable load tracing window based on the task type of the rendering-critical tasks running in the processor cluster includes: When the rendering critical task running in the processor cluster is the first rendering critical task, the time window between the start points of adjacent frames is determined as the variable load tracking window, and the first rendering critical task refers to the task used to prepare rendering data. When the rendering critical task running in the processor cluster is the second rendering critical task, the time window between adjacent queue buffer time points is determined as the variable load tracking window, and the second rendering critical task refers to the task used to perform rendering operations.
5. The method according to claim 4, characterized in that, The first rendering critical task is the UnityMain task, and the second rendering critical task is the UnityGFX task.
6. The method according to claim 3, characterized in that, The method includes: In the case where the processor cluster contains at least two processors, the rendering critical tasks and non-rendering critical tasks in the rendering task are scheduled to different processors.
7. The method according to claim 2, characterized in that, The method further includes: The non-rendering tasks and the rendering tasks are scheduled to different processor clusters.
8. The method according to claim 3, characterized in that, Determining the target operating frequency of the processor cluster based on the processor utilization of each processor in the processor cluster includes: Based on the first processor utilization of the first processor running the rendering critical task in the processor cluster, the first desired operating frequency of the first processor is determined. The second desired operating frequency of the second processor is determined based on the second processor utilization rate of the second processor running non-rendering critical tasks in the processor cluster. The target operating frequency of the processor cluster is determined based on the first desired operating frequency and the second desired operating frequency.
9. The method according to claim 8, characterized in that, Determining the first desired operating frequency of the first processor based on the first processor utilization of the first processor running the rendering-critical task in the processor cluster includes: Based on the historical variable load tracking window duration, determine the expected variable load tracking window duration for the next frame; Based on at least one of the first processor utilization rates determined during the historical rendering process, the estimated processor utilization rate of the first processor in the next frame is determined. Based on the expected variable load tracking window duration, the estimated processor utilization, the target load corresponding to the processor cluster, and the highest operating frequency of the first processor, a first expected operating frequency of the first processor is determined. The first expected operating frequency is negatively correlated with the expected variable load tracking window duration, positively correlated with the estimated processor utilization, and negatively correlated with the target load.
10. The method according to claim 9, characterized in that, The step of determining the expected variable load tracking window duration for the next frame based on historical variable load tracking window durations includes: Determine the rendering duration of a single frame based on the rendering frame rate of the rendering scene. Based on the duration difference between the single-frame rendering duration and the historical variable load tracking window duration, the expected variable load tracking window duration in the next frame is determined. Wherein, if the single-frame rendering duration is less than the historical variable load tracking window duration, the expected variable load tracking window duration is less than the single-frame rendering duration; if the single-frame rendering duration is greater than the historical variable load tracking window duration, the expected variable load tracking window duration is greater than the single-frame rendering duration.
11. The method according to claim 10, characterized in that, Determining the expected variable load tracking window duration for the rendering critical task in the next frame based on the duration difference between the single-frame rendering duration and the historical variable load tracking window duration includes: If the duration difference is less than the difference threshold, the expected variable load tracking window duration of the rendering critical task in the next frame is determined based on the duration difference and the single frame rendering duration. If the duration difference is greater than the difference threshold, the single-frame compensation duration is determined based on the duration difference and the number of compensation frames; the expected variable load tracking window duration of the rendering critical task in the next frame is determined based on the single-frame compensation duration and the single-frame rendering duration.
12. The method according to claim 8, characterized in that, Determining the target operating frequency of the processor cluster based on the first desired operating frequency and the second desired operating frequency includes at least one of the following: The maximum value between the first desired operating frequency and the second desired operating frequency is determined as the target operating frequency of the processor cluster; The average of the first desired operating frequency and the second desired operating frequency is determined as the target operating frequency of the processor cluster; Determine the average of the second desired operating frequency; determine the maximum value between the first desired operating frequency and the average value as the target operating frequency of the processor cluster.
13. The method according to any one of claims 1 to 12, characterized in that, The method further includes: Based on the task attributes of the tasks running in the processor cluster, the target load corresponding to the processor cluster is set, wherein different task attributes correspond to different target loads; Determining the target operating frequency of the processor cluster based on the processor utilization of each processor in the processor cluster includes: The target operating frequency of the processor cluster is determined based on the processor utilization of each processor in the processor cluster and the target load corresponding to the processor cluster.
14. The method according to claim 13, characterized in that, The step of setting the target load corresponding to the processor cluster based on the task attributes of the task running the task based on the processor cluster includes: In a rendering scenario, if the task running on the processor cluster is a non-rendering task, the processor cluster is set as the first target load. In a rendering scenario, if the task running on the processor cluster is a rendering task, the processor cluster is set as a second target load, which is less than the first target load.
15. A processor frequency modulation device, characterized in that, The device includes: The load tracing module is used to perform load tracing on each processor in the processor cluster based on the task attributes of the tasks running in the processor cluster, and to obtain the processor utilization of each processor. The processor cluster contains at least one processor, and different task attributes correspond to different load tracing methods. A frequency modulation module is used to determine the target operating frequency of the processor cluster based on the processor utilization rate of each processor in the processor cluster; The frequency modulation module is also used to adjust the operating frequency of each processor in the processor cluster to the target operating frequency.
16. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer instruction, the at least one computer instruction being loaded and executed by the processor to implement the processor frequency modulation method as described in any one of claims 1 to 14.
17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer instruction, which is executed by a processor to implement the processor frequency modulation method as described in any one of claims 1 to 14.
18. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; the processor reads the computer instructions from the computer-readable storage medium and executes the computer instructions to implement the processor frequency modulation method as described in any one of claims 1 to 14.