A processor control method and electronic device
By monitoring the processor's actual performance metrics and adjusting its operating parameters, the problem of excessive power consumption during task processing was solved, achieving a balanced optimization of processing performance and power consumption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SMARTER SILICON (SHANGHAI) TECH CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-30
AI Technical Summary
In graphics processing units (GPUs) or neural network processors, existing technologies struggle to balance task performance with processor power consumption, leading to excessive power consumption or excessive battery drain, especially in artificial intelligence model inference tasks.
By monitoring the processor's actual performance metrics, the desired performance metrics are determined, and the processor's operating parameters, such as voltage and frequency, are adjusted accordingly to ensure that the processor achieves the desired performance metrics in the next task unit. The operating parameters are then optimized by combining predictive models and PID algorithms.
It achieves a reasonable balance between processing performance and power consumption when the processor is running task units, avoiding unreasonable increases in power consumption and optimizing the processor's operating parameter settings.
Smart Images

Figure CN122308201A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a processor control method and an electronic device. Background Technology
[0002] When running tasks on processors such as Graphics Processing Units (GPUs) or Neural Processing Units (NPUs), the appropriate operating parameters, such as the processor frequency, are typically determined based on processor utilization. While this approach ensures task processing performance, it often results in unsuitable operating parameters, leading to high processor power consumption or excessive energy consumption, thus failing to meet expected requirements. In particular, with the increasing demands of artificial intelligence model inference tasks, setting processor operating parameters solely based on processor utilization makes it difficult to reasonably balance inference performance and power consumption. Therefore, how to reasonably balance task processing performance and processor power consumption when running tasks on a processor is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0003] On the one hand, this application provides a processor control method, including:
[0004] In response to the processor initiating the execution of a first task unit of a first task, the processor determines the actual performance metrics of the processor processing the first task unit, wherein the first task includes at least one first task unit;
[0005] Obtain the expected performance index corresponding to the first task unit;
[0006] Based on the actual performance indicators of the first task unit and with the desired performance indicators as the target, the desired operating parameters required by the processor are determined.
[0007] Based on the desired operating parameters, the first target operating parameters for the processor to process the first task unit next are determined.
[0008] In one possible implementation, the processor control method further includes:
[0009] In response to the processor initiating the execution of the first task unit, the second target working parameters corresponding to the first task unit, which were determined before the current moment, are obtained;
[0010] Based on the second target operating parameters, the operating parameters of the processor are adjusted so that the processor processes the first task unit based on the adjusted operating parameters.
[0011] In another possible implementation, obtaining the second target working parameters corresponding to the first task unit determined before the current moment includes:
[0012] Obtain the second target working parameters corresponding to the first task unit from the parameter table, wherein the parameter table stores target working parameters corresponding to at least one task unit, and the first task unit belongs to the at least one task unit;
[0013] The processor control method further includes:
[0014] Based on the first target working parameters, update the target working parameters in the parameter table corresponding to the first task unit.
[0015] In yet another possible implementation, adjusting the processor's operating parameters based on the second target operating parameters includes:
[0016] In response to the presence of the second target working parameter in the parameter table and the processor currently starting or running a second task unit in a second task, a third target working parameter corresponding to the second task unit is obtained from the parameter table, wherein the second task unit belongs to the at least one task unit;
[0017] Based on the second target operating parameters and the third target operating parameters, suitable reference operating parameters for the processor are determined;
[0018] Adjust the processor's operating parameters to the reference operating parameters.
[0019] In another possible implementation, obtaining the second target working parameters corresponding to the first task unit from the parameter table includes:
[0020] Obtain the second target working parameters corresponding to the first task unit and the expected performance index from the parameter table;
[0021] The parameter table stores target operating parameters for at least one task unit under at least one performance metric.
[0022] In another possible implementation, the parameter table also includes: the generation time corresponding to the target working parameter;
[0023] Obtaining the second target working parameters corresponding to the first task unit from the parameter table includes:
[0024] In response to the existence of at least one candidate target working parameter corresponding to the first task unit in the parameter table, a second target working parameter is determined from the at least one candidate target working parameter based on the size relationship of each candidate target working parameter and at least one of the generation time corresponding to each candidate target working parameter.
[0025] The step of updating the target working parameters corresponding to the first task unit in the parameter table based on the first target working parameters includes:
[0026] Based on at least one of the difference between the first target working parameter and the candidate target working parameter and the time difference between the generation time of the candidate target working parameter and the generation time of the first target working parameter, a candidate target working parameter to be updated is determined from the at least one candidate target working parameter.
[0027] Replace the candidate target working parameters to be updated and their generation time with the first target working parameters and their generation time, respectively.
[0028] In yet another possible implementation, the processor control method further includes: determining the current operating parameters currently used by the processor;
[0029] The step of determining the desired operating parameters required by the processor based on the actual performance indicators of the first task unit, with the desired performance indicators as the target, includes:
[0030] With the desired performance index as the target, the desired operating parameters required by the processor are determined based on the actual performance index of the first task unit and the current operating parameters.
[0031] In another possible implementation, determining the desired operating parameters required by the processor based on the actual performance parameters of the first task unit and the current operating parameters, with the desired performance index as the target, includes:
[0032] Determine the performance difference between the actual performance index and the expected performance index of the first task unit;
[0033] Based on the performance index difference and at least one historical performance index difference, the required operating parameter adjustment value for the processor is determined, wherein the historical performance index difference is the historically determined performance index difference.
[0034] Based on the current operating parameters and the adjusted operating parameter values, the desired operating parameters required by the processor are determined.
[0035] In another possible implementation, determining the actual performance metrics of the processor processing the first task unit in response to the processor initiating the execution of the first task unit includes:
[0036] In response to the processor initiating a first task unit of the intelligent model to execute a first task, the actual performance metrics of the processor processing the first task unit are determined.
[0037] In another aspect, this application also provides an electronic device, including: a controller and at least one processor;
[0038] The processor is a first task unit used to start and execute the first task.
[0039] The controller is configured to, in response to the processor initiating the execution of a first task unit of a first task, determine the actual performance metrics of the processor processing the first task unit, wherein the first task includes at least one first task unit; obtain the expected performance metrics corresponding to the first task unit; based on the actual performance metrics of the first task unit and with the expected performance metrics as a target, determine the expected operating parameters required by the processor; and based on the expected operating parameters, determine the first target operating parameters for the processor to process the first task unit next time. Attached Figure Description
[0040] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0041] Figure 1 A schematic diagram illustrating an implementation flow of the processor control method provided in this application;
[0042] Figure 2 A schematic diagram illustrating another implementation flow of the processor control method provided in this application;
[0043] Figure 3 This diagram illustrates the start and end of execution for multiple task units within a single task.
[0044] Figure 4 This is an example diagram illustrating an implementation of the PID algorithm used in this application to determine suitable target operating parameters for a task unit.
[0045] Figure 5 A schematic diagram illustrating another implementation flow of the processor control method provided in this application;
[0046] Figure 6This application maintains the target frequency corresponding to the task unit under each task for various tasks processed by the processor.
[0047] Figure 7 A schematic diagram illustrating another implementation flow of the processor control method provided in this application;
[0048] Figure 8 A schematic diagram illustrating the implementation principle framework for determining suitable operating parameters for processor task execution units provided in this application;
[0049] Figure 9 A schematic diagram of the component architecture of the electronic device provided in this application. Detailed Implementation
[0050] The solution proposed in this application can reasonably determine the appropriate operating parameters for the processor to run the task unit based on the expected performance indicators of each task unit in the task. This allows for reasonable control of the processor's operating parameters during the execution of the task unit, reducing the possibility of excessive power consumption caused by blindly pursuing task processing performance.
[0051] In this context, a task unit is the smallest granular unit that can be scheduled or monitored, derived from a task. Each task unit performs the same type and purpose of operation, but the data objects they need to process may differ. If a task cannot be divided, the entire task can be considered a single task unit.
[0052] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments and is not intended to limit the application. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0053] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0054] like Figure 1The diagram illustrates an implementation flow of the processor control method provided in this application. The method of this embodiment can be applied to electronic devices, such as laptops or desktop computers, or host devices, servers, or device nodes in a distributed system, without limitation.
[0055] The method in this embodiment may include:
[0056] S101, in response to the processor initiating the execution of the first task unit of the first task, determine the actual performance indicators of the processor processing the first task unit.
[0057] The types of tasks mentioned in this application (such as the first task here and the subsequent second task) can be varied and there is no limitation on them.
[0058] In one possible scenario, the task mentioned in this application can be a task that requires processing with the aid of an intelligent model. For example, the task could be a task requiring reasoning using a large language model; a face detection task using a face detection model; or a speech recognition task using a speech recognition model, etc. Accordingly, the first task unit responding to the processor initiating the first task can be: a first task unit responding to the processor initiating an intelligent model to execute the first task.
[0059] In this case, the processor can be a processor capable of running intelligent models, such as a graphics processing unit (GPU), a neural processing unit (NPU), a central processing unit (CPU), or a tensor processing unit (TPU), etc., without any specific restrictions.
[0060] In this application, the first task includes at least one first task unit.
[0061] In this first task, each first task unit performs the same operation; that is, the operation type and purpose of each first task unit are the same, but the data objects processed by each first task unit may be different. Based on this, the first task can be regarded as a task that requires repeating a certain operation at least once, and each repetition of this operation is the execution of a first task unit.
[0062] For example, taking the first task as one that requires the use of a large language model or other Transformer-based models, since the Transformer-based model needs to infer at least one lexical unit with a specific order when processing the first task, each execution of lexical inference is a first task unit for that first task. A lexical unit can be a single character unit output by the model each time; this character unit can be a single character, a string, or a phrase, etc. For example, a lexical unit can also be called a token. It is clear that the operation performed by each first task unit is lexical inference, but because different first task units need to infer different lexical units, the data used for inferring lexical units will differ.
[0063] For example, if the first task is face detection, then the process of performing the first task is to use the face detection model to perform face detection. The entire process of face detection does not involve multiple repetitions of the same operation. Therefore, the first task can be considered to include only one task unit: face detection. That is, the first task itself is a first task unit.
[0064] In this application, the performance metrics of the processor processing the first task unit can be evaluation metrics that can assess the processing performance of the processor in processing the first task unit. For example, the performance metrics may include, but are not limited to, at least one of the following performance metrics: processing time required to process the first task unit, power consumption, power consumption, or heat generation (i.e., temperature rise).
[0065] For ease of distinction, the performance metrics obtained by the processor in actually processing the first task unit are referred to as actual performance metrics. For example, actual performance metrics can be at least one of the following: actual processing time required for the processor to process the first task unit, actual power consumption, actual battery consumption, or actual temperature rise.
[0066] In this application, by monitoring the process of the processor executing the first task, the moment when the processor starts and completes the first task unit can be determined. Furthermore, during the startup and execution of the first task unit, the actual performance metrics of the processor handling the first task unit can be monitored. The specific implementation process is not limited. For example, by calling a specified interface provided by the processor's driver, the startup of the first task unit can be monitored. By calling a performance metrics monitoring program, various performance metrics of the processor, such as those of the NPU, during the execution of the first task unit can be monitored, thus obtaining the actual performance metrics of the processor handling the first task unit.
[0067] S102, obtain the expected performance index corresponding to the first task unit.
[0068] The expected performance metric can be a performance metric required for the processor to handle the first task unit. For example, the expected performance metric can be a performance metric that the user expects the processor to have. The types of expected performance metrics are the same as the types of actual performance metrics. For example, the expected performance metric can include one or more of the following: expected processing time for the processor to handle the first task unit, expected power consumption, expected power consumption, and expected temperature rise.
[0069] There are multiple ways to obtain this expected performance metric, and there are no specific restrictions.
[0070] For example, the expected performance metrics can be user-configured or entered in real time, and are the performance metrics that are expected to be achieved.
[0071] For example, the expected performance metric can be the performance requirement that the processor needs to achieve to process the first task unit, determined based on the user's selected usage mode. The usage mode can be categorized as smooth mode, power-saving mode, or high-efficiency mode, etc., without specific restrictions. The expected performance metric for the first task unit can differ under different usage modes.
[0072] It should be noted that obtaining the expected performance index can be performed after step S101, simultaneously with step S101, or even before step S101; there are no restrictions on this.
[0073] S103, with the desired performance index as the target, and based on the actual performance index of the first task unit, determine the desired operating parameters required by the processor.
[0074] Processor operating parameters are parameters that affect the performance of the processor (such as computational efficiency or energy efficiency). Therefore, by adjusting the operating parameters applied to the processor, the performance of the processor can be changed. For example, processor operating parameters may include, but are not limited to, at least one of voltage and frequency (also known as operating frequency).
[0075] Correspondingly, the expected operating parameters refer to the operating parameters that need to be set for the processor to achieve the expected performance index when the processor executes the first task unit.
[0076] For example, a pre-trained predictive model for predicting operating parameters can be used. Based on this, the actual performance metric and the expected performance metric can be input into the predictive model to obtain the expected operating parameters required for the processor to achieve the expected performance metric. The predictive model can be a neural network model or other machine learning model, and there are no restrictions on its model structure. The predictive model can be trained using at least one sample dataset, with the operating parameters labeled in the sample dataset as the training target. The sample dataset includes the sample actual performance metric and sample expected performance metric of a sample processor.
[0077] Of course, there are other ways to determine the desired operating parameters, and there are no restrictions on this.
[0078] S104, based on the expected operating parameters, determine the first target operating parameters for the processor to process the first task unit next.
[0079] The first target operating parameter is determined based on the expected operating parameter, and is a target operating parameter that ensures the difference between the processor's performance index for processing the first task unit and the expected performance index is less than a set threshold, and that the processor can support. To distinguish it from the target operating parameters for the first task unit determined in other subsequent situations and the target operating parameters for other task units, the target operating parameter currently determined for the first task unit is referred to as the first target operating parameter.
[0080] For example, the first target working parameter can be this desired working parameter.
[0081] For example, if the desired value of the working parameter exceeds the highest value of the working parameter supported by the processor, then the highest working parameter supported by the processor shall be used as the first target working parameter.
[0082] In this application, the first target working parameter is determined as the working parameter suitable for the processor to process the first task unit in the next time. This allows the processor to run with the first target working parameter in the next processing of the first task unit, thereby enabling the processor to achieve the expected performance index in the next processing of the first task unit.
[0083] The processor's next processing unit for the first task can be any first task unit in the first task that the processor processes after the current moment. Based on this, the processor's next processing unit for the first task can be the same task unit as the first task unit monitored for determining the expected working parameters (i.e., the first task unit that has currently completed processing), or it can be the next first task unit after the first task unit that has currently completed processing in the first task.
[0084] For example, if the first task includes multiple first task units, and the first task unit that the processor has currently completed is not the last first task unit in the first task, then the processor's next processing of the first task unit means that the processor processes the next first task unit in the first task (i.e., the next first task unit after the currently completed first task unit); if the first task unit that the processor has currently completed is the last first task unit in the multiple first tasks, then the processor's next processing of the first task unit means that the processor will start the first task again and execute the first first task unit in the first task.
[0085] For example, if the first task includes only one first task unit, then the next time the processor processes the first task unit means that the processor will start and execute that first task unit in the first task next time.
[0086] As can be seen from the above, in response to a processor executing a first task unit, this application determines the actual performance index of the processor processing the first task unit, and uses the expected performance index corresponding to the first task unit as a target, determining the expected operating parameters required by the processor based on the actual performance index. Since these expected operating parameters are the operating parameters that enable the processor to achieve the expected performance index when running the first task, a suitable first target operating parameter can be obtained based on these expected operating parameters. This ensures that the processor can achieve the expected performance index when executing the first task unit again using the first target operating parameter, making the processor's operating parameters more in line with the expected requirements. This avoids unreasonable increases in the processor's operating parameters that could lead to excessive power consumption or other unreasonable situations, thus achieving a reasonable balance between task processing performance and processor power consumption.
[0087] In this application, there are many possible implementations for determining the desired operating parameters with the desired performance index as the objective, and no specific restrictions are imposed.
[0088] In one possible scenario, considering that the operating parameters of the processor when executing the first task unit can directly affect the actual hardware specifications of the processor, in order to more accurately determine the expected operating parameters, the current operating parameters currently used by the processor can also be determined before determining the expected operating parameters.
[0089] For example, in response to the processor initiating the execution of the first task unit, the current operating parameters used for processing are determined.
[0090] For example, considering that the processor's operating parameters usually remain unchanged during the execution of the first task unit, the current operating parameters used by the processor can also be determined when the actual performance indicators of the first task are determined.
[0091] Accordingly, this application takes the expected performance index as the target and determines the expected operating parameters required by the processor based on the actual performance index of the first task unit and the current operating parameters.
[0092] For example, in one implementation, a pre-trained prediction model can be used to predict the desired operating parameters required by the processor based on the actual performance metric, the desired performance metric, and the processor's current operating parameters.
[0093] In another implementation, this application can determine the desired operating parameters by combining the performance difference between the actual performance indicators and the desired performance indicators, as well as the processor's current operating parameters. The following section will combine... Figure 2 This implementation method will be introduced. For example... Figure 2 This illustration shows another implementation flow diagram of the processor control method provided in this application. The method in this embodiment may include:
[0094] S201, in response to the processor initiating the execution of the first task unit of the first task, determines the actual performance indicators of the processor processing the first task unit.
[0095] The first task includes at least one first task unit.
[0096] The actual performance indicators can be found in the previous introduction, and will not be repeated here.
[0097] For ease of understanding, combined with Figure 3 To illustrate, let's take the actual processing time required for the processor to process the first task unit as an example:
[0098] Depend on Figure 3 As can be seen, this task (i.e., the first task) consists of multiple task units (i.e., the first task unit). Each time the processor detects the initiation of a task unit, its start time is recorded. Upon detecting the completion of the task unit, the end time of its completion is obtained. Based on these start and end times, the actual processing time required for the processor to complete the task unit can be calculated.
[0099] certainly, Figure 3 Taking the actual processing time as an example, if the actual performance indicator is power consumption or other indicators, since the start and end times of the processor starting to execute the first task unit can be determined, the relevant performance indicators of the processor can be monitored using specific monitoring tools or programs during the time period of the processor processing the first task unit. The details will not be elaborated further.
[0100] S202, determine the current operating parameters currently used by the processor.
[0101] For example, current operating parameters may include one or more of the processor's current frequency and voltage.
[0102] It is understandable that step S202 can be executed synchronously with step S201, or it can be executed when the execution of the first task unit is detected, without any specific restrictions.
[0103] S203, obtain the expected performance index corresponding to the first task unit.
[0104] For example, actual performance metrics include the actual processing time of the processor in processing the first task unit, while expected performance metrics may include the expected processing time required to process the first task unit.
[0105] For example, if the actual performance metric includes the actual power consumption of the processor when processing the first task unit, the expected performance metric includes the expected time required for the processor to process the first task unit.
[0106] For details on how to achieve the desired performance metrics, please refer to the descriptions in other embodiments, which will not be repeated here.
[0107] S204, determine the performance index difference between the actual performance index and the expected performance index of the first task unit.
[0108] The performance index difference is the difference between the actual performance index and the expected performance index.
[0109] For example, if the actual performance metric is the actual processing time and the expected performance metric is the expected processing time, then the difference between these performance metrics is the time difference between the actual processing time and the expected processing time.
[0110] S205, based on the performance index difference and at least one historical performance index difference, determine the required operating parameter adjustment value for the processor.
[0111] S206, based on the current operating parameters and the operating parameter adjustment values, determine the desired operating parameters required by the processor.
[0112] The desired operating parameter can be the sum of the current operating parameter and its adjustment value.
[0113] Among them, the historical performance index difference is the historically determined performance index difference, that is, the performance index difference between the historical actual performance index before the current moment and the expected performance index.
[0114] Among them, the operating parameter adjustment value is the magnitude of the adjustment required for the processor's operating parameters.
[0115] The desired operating parameter is the current operating parameter plus the adjustment value of that operating parameter. For example, taking the processor's operating parameters, including the processor frequency, as an example, if the desired operating parameter is the desired frequency and the operating parameter adjustment value is the frequency adjustment magnitude, then the desired frequency is the sum of the current frequency and the frequency adjustment magnitude.
[0116] It is understood that each time the processor executes the first task unit, it will determine the appropriate working parameters for the next execution of the first task unit through the scheme of this application. Therefore, the processor will determine the performance index difference between the actual performance index and the expected performance index each time. Based on this, the performance index difference determined before the execution of the first task unit is the historical performance index difference.
[0117] Understandably, historical performance metric differences can reflect the errors in the expected operating parameters determined in the past. Based on this, by combining the current performance metric differences with at least one historical performance metric difference, it is possible to more accurately determine the adjustment value required for the processor's operating parameters, that is, to more accurately determine the adjustment value of the operating parameters.
[0118] In one implementation, this application can determine the adjustment value of the operating parameter based on the performance index difference and the at least one historical performance index difference, using a proportional-integral-derivative algorithm (PID algorithm).
[0119] The PID algorithm measures the error between the "target" and the "current situation" (the difference between the expected performance index and the actual performance index in this application), and calculates the corresponding adjustment amount (i.e., the working parameter adjustment value) based on the current error (i.e. the performance index difference), the historical error accumulation (i.e. at least one historical performance index difference), and the error change trend (such as the change rate corresponding to the most recent historical performance index).
[0120] Understandably, if the first task comprises multiple first task units, then after each first task unit is executed, a performance index difference can be determined and input into the PID algorithm. Based on this, each time the PID algorithm determines an adjustment value for the operating parameters, using the current input performance index difference and historical input performance index differences. By accumulating the performance index differences, this adjustment value for the operating parameters can be continuously optimized. Based on this, the processor's desired operating parameters are continuously adjusted, causing the processor's actual performance index for processing the first task unit based on the desired operating parameters to increasingly approach the desired performance index.
[0121] To facilitate understanding, the implementation process of determining the working parameter adjustment value using the PID algorithm in this application is described below. Figure 4 The actual performance indicator is the actual processing time, the expected performance indicator is the expected processing time, and the processor's operating parameter is the processor frequency, which is used as an example for explanation.
[0122] like Figure 4 It can be seen that after the time capturer captures the start and end times of the first task unit processed by the processor, the actual processing time can be determined. Based on the actual processing time and the expected processing time, the difference between the current processing time and the expected processing time can be obtained. After inputting the current processing time difference into the PID algorithm, the frequency adjustment value can be determined using the PID algorithm. Based on the frequency adjustment value and the frequency currently used by the processor, the expected frequency can be obtained.
[0123] Based on this, the processor can use the desired frequency to process the first task unit next time. In the next processing of the first task unit, the processor will again collect the start and end times of the current processing to obtain the actual processing time. Then, the difference between the actual processing time and the desired processing time is recalculated and input into the PID algorithm. This allows the PID algorithm to continuously accumulate the time differences from each processing and continuously optimize the frequency adjustment value, thereby continuously optimizing the desired frequency. Ultimately, the difference between the actual processing time and the desired processing time of the processor processing the first task unit at the desired frequency is less than a set threshold.
[0124] If the first task only includes one first task unit, the principle of determining the working parameter adjustment value is similar. However, after each execution of the first task, the PID algorithm still needs to be kept running in the background so that after the first task is executed again and the performance index difference of the first task unit is determined, the performance index difference is input into the PID algorithm so that the PID algorithm can continuously accumulate the performance index difference corresponding to the first task unit and continuously optimize the working parameter adjustment value.
[0125] in, Figure 4 This example uses the processing time of the processor to handle the first task unit as a performance metric for ease of description. However, it's understandable that the same principle applies if the processor's performance metric is replaced with the power consumption of the processor handling the first task unit.
[0126] For example, in this application, the start time and end time of the processor executing the first task unit can be determined. Based on this, the electronic device can determine the actual power of the processor during the execution of the first task unit. If the processor power does not change during the execution of the first task unit, the actual power can be multiplied by the actual processing time of the processor executing the first task unit to obtain the actual power consumption of the processor in processing the first task unit.
[0127] If the processor experiences power fluctuations during the execution of the first task unit, the average power can be calculated based on the actual power of the processor at different time points during the execution of the first task unit. Multiplying this average power by the actual processing time yields the actual power consumption of the processor in processing the first task unit.
[0128] Based on this, the power consumption difference between the actual power consumption and the expected power consumption is calculated. This power consumption difference is then input into a PID algorithm, which determines the frequency adjustment value. Based on the frequency adjustment value and the processor's current frequency, the desired frequency can be obtained. Of course, the PID algorithm can also accumulate the power consumption differences obtained from different executions of the first task unit. Based on the accumulated power consumption differences and the currently input power consumption difference, the frequency adjustment value can be continuously optimized.
[0129] Based on this, this application can determine the processor's desired frequency by combining the frequency adjustment value with the processor's current frequency. Of course, other algorithms can also be used to determine this operating parameter adjustment value, without any specific limitations.
[0130] S207, based on the expected operating parameters, determine the first target operating parameters for the processor to process the first task unit next.
[0131] This step can be referred to in the relevant description of the previous embodiments, and will not be repeated here.
[0132] In this embodiment, for the first task unit, the processor's operating parameter adjustment value can be determined by combining at least one historical performance index difference determined before the current moment with at least one currently determined performance index difference. By continuously accumulating the deviation of the performance index difference to optimize the operating parameter adjustment value, the operating parameter adjustment value can be determined more accurately. This can improve the accuracy of the expected operating parameters determined based on the operating parameter adjustment value, and further, based on the expected operating parameters, the suitable target operating parameters for the processor to process the first task unit next time can be determined more reasonably, so that the performance index of the processor to process the first task unit next time reaches or approaches the expected performance index.
[0133] In any of the above embodiments of this application, if suitable target operating parameters for the first task unit have been determined before the processor initiates the execution of the first task unit, then in order to ensure the reasonable operation of the first task unit and to make the actual performance indicators of the processor running the first task unit as close as possible to or reach the expected performance indicators, in response to the processor initiating the execution of the first task unit, this application can also obtain the second target operating parameters corresponding to the first task unit determined before the current moment. Accordingly, the processor's operating parameters can be adjusted based on the second target operating parameters, so that the processor processes the first task unit based on the adjusted operating parameters. For example, the processor's operating parameters can be adjusted to the second target operating parameters.
[0134] Here, the second target working parameter is the target working parameter determined in the previous step that is suitable for the processor to process the first task unit next time. It can be seen that the second target working parameter is also the historical first target working parameter. For ease of distinction, the target working parameter that is suitable for the processor to process the first task unit next time, determined before the execution of the first task unit, is called the second target working parameter.
[0135] For example, consider a first task comprising multiple task units (i.e., multiple first task units). Using the solution of this application, after the processor completes the execution of the first task unit, the solution of this application can determine the suitable first target working parameters for the processor's next execution of the task unit, i.e., the suitable target working parameters 1 for the processor to execute the second task unit. Based on this, when the processor starts the execution of the second task unit, the previously determined historical first target working parameters, i.e., target working parameters 1, can be used as the second target working parameters. The processor is then controlled to run the second task unit based on these second target working parameters.
[0136] Similarly, after obtaining the actual performance metrics of the processor processing the second task unit, based on this application, a first target operating parameter suitable for the processor's next task unit processing can be determined, that is, a target operating parameter 2 suitable for the processor processing the third task unit can be determined. Then, when the processor starts the execution of the third task unit, the previously determined target operating parameter 2 can be used as the current second target operating parameter, and the processor's operating parameters can be set based on this second target operating parameter.
[0137] In one possible implementation, considering that there may be multiple tasks running on the processor, the solution of this application can be adopted for each task unit to determine the suitable target operating parameters for the task unit. Therefore, the electronic device needs to maintain the suitable target operating parameters for different task units in different tasks. Based on this, in order to reasonably maintain the target operating parameters corresponding to different types of task units and facilitate querying and determining the suitable target operating parameters for the first task unit, this application can also maintain the target operating parameters corresponding to different task units through a parameter table. The following section discusses this implementation method in conjunction with... Figure 5 Please provide an explanation.
[0138] like Figure 5 This illustrates another flowchart of the processor control method provided in this application. The method in this embodiment may include:
[0139] S501, in response to the processor starting the execution of the first task unit in the first task, obtain the second target working parameters corresponding to the first task unit from the parameter table.
[0140] The first task includes at least one first task unit.
[0141] The parameter table stores target working parameters corresponding to at least one task unit, and the first task unit belongs to the at least one task unit.
[0142] In this application, the parameter table stores the target operating parameters of various task units determined before the current time. The specific implementation of determining the target operating parameters of any task unit can be similar to the specific implementation of determining the first target operating parameters of the first task unit, and will not be elaborated further. For ease of distinction, the target operating parameters obtained from the parameter table corresponding to the first task unit are referred to as the second target operating parameters. It is evident that the second target operating parameters are historically determined target operating parameters suitable for the processor to process the first task unit.
[0143] In one possible scenario, considering that users' expected performance metrics for the processor processing the same task unit may change over different time periods, the parameter table in this application may store target operating parameters for at least one task unit under at least one performance metric. Specifically, the target operating parameters for the same task unit may differ under different performance metrics within the parameter table.
[0144] Based on this, before obtaining the second target operating parameters, the expected performance index corresponding to the first task can also be obtained. Accordingly, the second target operating parameters corresponding to the first task unit and the expected performance index can be obtained from the parameter table.
[0145] S502, based on the second target operating parameters, adjust the processor's operating parameters so that the processor processes the first task unit based on the adjusted operating parameters.
[0146] By adjusting the processor's operating parameters based on the second target operating parameters, the processor can operate based on the second target operating parameters, thereby making the performance indicators of the processor executing the first task unit as close as possible to the expected performance indicators.
[0147] For example, if the operating parameter is frequency, and the second target operating parameter is the target frequency, then the processor's operating frequency can be adjusted to the target frequency so that the processor runs and processes the first task unit at the target frequency.
[0148] It is understandable that if there is no second target working parameter in the parameter table corresponding to the first task unit (or the first task unit and the expected performance index), then step S502 can be skipped, and the processor can be run according to its current working parameters.
[0149] Understandably, in practical applications, a processor may execute multiple tasks simultaneously, and the expected performance metrics of different tasks may differ, leading to varying requirements for the processor's operating parameters. Therefore, in one possible implementation, to more rationally adjust the processor's operating parameters so that it can meet the operational needs of multiple tasks, if the second target operating parameter exists in the parameter table, and the processor is currently starting or running a second task unit within a second task, a third target operating parameter corresponding to that second task unit can be obtained from the parameter table. Here, the second task is different from the first task, and the second task unit belongs to at least one task unit corresponding to the parameter table.
[0150] Accordingly, a suitable reference operating parameter for the processor can be determined based on the second and third target operating parameters; the processor's operating parameters can then be adjusted to this reference operating parameter. For example, the reference operating parameter can be the larger of the second and third target operating parameters. Alternatively, the weighted average of the second and third target operating parameters can be used as the reference operating parameter.
[0151] S503 determines the actual performance metrics of the processor in processing the first task unit.
[0152] S504, obtain the expected performance indicators corresponding to the first task unit.
[0153] It is understandable that if the expected performance parameter has already been obtained before obtaining the second target working parameter, then there is no need to obtain the expected performance index again here.
[0154] S505, with this desired performance index as the target, determines the desired operating parameters required by the processor based on the actual performance index of the first task unit.
[0155] S506, based on the expected operating parameters, determine the first target operating parameters suitable for the processor to process the first task unit next time.
[0156] The above steps S503 to S506 can be found in the relevant descriptions of other embodiments of this application, and will not be repeated here.
[0157] S507, based on the first target working parameters, update the target working parameters corresponding to the first task unit in the parameter table.
[0158] Updating the target working parameter corresponding to the first task unit in the parameter table can be done by storing the first target working parameter as the target working parameter corresponding to the first task unit.
[0159] For example, if there is no target working parameter corresponding to the first task unit in the parameter table, the first target working parameter can be directly stored as the target working parameter corresponding to the first task unit in the parameter table.
[0160] If a target working parameter corresponding to the first task unit exists in the parameter table, then the target working parameter corresponding to the first task unit can be updated to the first target working parameter.
[0161] In this embodiment, when the processor initiates the execution of a task unit, if the parameter table contains target operating parameters corresponding to that task unit, the processor can be run based on the corresponding target operating parameters, and the task unit can be run with the processor using the target operating parameters, so that the actual performance index of the processor running the task unit can approach the expected performance index. Based on this, when the processor executes a task unit, this application will still redetermine the suitable expected operating parameters for the processor to execute the task unit based on the actual performance index and the expected performance index, and determine the suitable target operating parameters for the processor to execute the task unit next time based on the expected operating parameters. The currently determined target operating parameters are then updated in the parameter table, so that the parameter table can store the latest determined target operating parameters required for various task units to meet the expected performance index, thereby facilitating the processor to run different task units reasonably.
[0162] Specifically, when the parameter table stores target operating parameters for at least one task unit under at least one performance metric, this application can also update the target operating parameters in the parameter table corresponding to the first task unit and the desired performance metric based on the first target operating parameter. For example, the first target operating parameter can be stored as the target operating parameter in the parameter table corresponding to the first task unit and the obtained desired performance parameter. Alternatively, if the parameter table contains historical target operating parameters corresponding to the first task unit and the desired performance parameter, these historical target operating parameters can be replaced with the currently determined target operating parameter.
[0163] It is understandable that in practical applications, the performance of a processor running the same task unit under the same operating parameters may exhibit slight fluctuations. Therefore, in order to more reasonably determine the processor's target operating parameters and ensure that the actual performance of the processor running the task unit more reliably approximates the expected performance, in this application, the parameter table may include: at least one target operating parameter corresponding to each of at least one task unit, and the generation time corresponding to that target operating parameter. In this case, one task unit in the parameter table may correspond to multiple target operating parameters, but the generation times of different target operating parameters are different. The generation time of the target operating parameter is the moment when the processor determines that target operating parameter.
[0164] Accordingly, obtaining the second target working parameter corresponding to the first task unit from the parameter table can be as follows: in response to the existence of at least one candidate target working parameter corresponding to the first task unit in the parameter table, the second target working parameter is determined from the at least one candidate target working parameter based on the size relationship of each candidate target working parameter and at least one of the generation time corresponding to each candidate target working parameter.
[0165] For example, the largest of at least one candidate target working parameter can be determined as the second target working parameter.
[0166] For example, the working parameters of the candidate target generated latest can be determined as the working parameters of the second target.
[0167] For example, the second target working parameter can be determined by sorting at least one candidate target working parameter from largest to smallest, and identifying any candidate target working parameter that is ranked first and whose generation time is less than a set duration from the current time. The set duration can be a threshold value set as needed; for example, the set duration can be twice the actual processing time required for the processor to currently run the first task unit.
[0168] Furthermore, in the case where the parameter table includes at least one target working parameter corresponding to each of at least one task unit and the generation time corresponding to each target working parameter, in order to update the parameter table more reasonably, when updating the parameter table based on the first target working parameter, the candidate target working parameter to be updated can be determined from the at least one candidate target working parameter based on at least one of the difference between the first target working parameter and the candidate target working parameter and the time difference between the generation time of the candidate target working parameter and the generation time of the first target working parameter.
[0169] As mentioned above, the candidate target working parameters are the target working parameters corresponding to the first task unit in the parameter table. For example, they can be the target working parameters corresponding to the first task unit and the expected performance index in the parameter table.
[0170] Correspondingly, the working parameters of the candidate target to be updated and the generation time of the working parameters of the candidate target to be updated can be replaced with the working parameters of the first target and the generation time of the working parameters of the first target, respectively.
[0171] For example, a candidate target working parameter whose generation time differs from the generation time of the first target working parameter by more than a set duration can be identified as a candidate target working parameter to be updated. The set duration can be a duration threshold set as needed, such as twice the processing time required for the processor to run the first task unit.
[0172] For example, candidate target working parameters whose difference from the first target working parameter exceeds a set threshold can be identified as candidate target working parameters to be updated.
[0173] For example, candidate target working parameters whose difference from the first target working parameter exceeds a set threshold and whose time difference with the generation time of the first target working parameter exceeds the set time can be identified as candidate target working parameters to be updated.
[0174] Of course, there are other possible ways to determine the working parameters of candidate targets to be updated, which are not limited here.
[0175] For ease of understanding, the parameter table shows the target operating parameters corresponding to the task units of different tasks, taking the processor's operating parameters as an example, combined with... Figure 6 A brief explanation:
[0176] Depend on Figure 6 As can be seen, in a multitasking scenario, the processor can handle multiple tasks. For example... Figure 6 As shown, the tasks that the processor may handle include large language model inference tasks and face detection tasks.
[0177] For each task, the scheme of this application can determine at least one target frequency suitable for the task unit of the processor to process the task, and store it in a parameter table. Based on this, the parameter table can include at least one target frequency corresponding to each of the at least one task unit. On this basis, each time the processor runs a task unit of a task, it can query the parameter table to see if there is a suitable target frequency for processing the task unit, and control the processor to run the task unit based on the target frequency, so that the actual processing time of the processor processing the task unit can be close to the expected processing time.
[0178] Of course, in order to update the target working parameters corresponding to the task units in the parameter table more reasonably in the future, the parameter table can also include the generation time corresponding to each target working parameter.
[0179] To facilitate understanding of the benefits of generating target operating parameters for each task unit in this application and the processor's subsequent execution of the task unit based on these target operating parameters, an application scenario is provided below:
[0180] The tasks processed by the processor are intelligent model-based tasks. The performance metric for each task unit is the processing time required for the processor to process that task unit. The explanation uses the processor's operating parameters, including its frequency, as an example. For ease of description, we will use an NPU as an example (of course, this also applies to GPUs or other processors).
[0181] Understandably, a higher NPU (or GPU, etc.) operating frequency results in less time for the processor to execute tasks, but also higher power consumption. In many cases, users may not be particularly sensitive to the execution time of individual task units. In such situations, if the NPU's operating frequency is too high, it will inevitably consume more power, leading to wasted resources. Therefore, by combining the expected processing time of the desired task unit with the processor's operating frequency, a more reasonable desired operating frequency for the processor can be determined.
[0182] like Figure 7 This illustration shows another flowchart of the method for determining processing parameters provided in this application. The method in this embodiment may include:
[0183] S701, in response to the execution of the first task unit in the NPU startup intelligent model task, determines the start time of the NPU startup of the first task unit.
[0184] The first task includes at least one first task unit.
[0185] S702, obtain the expected processing time corresponding to the first task unit.
[0186] S703, if there is a historical target operating frequency in the parameter table corresponding to the first task unit and the expected processing time, set the operating frequency of the NPU to the historical target operating frequency so that the NPU processes the first task unit based on the historical target operating frequency.
[0187] It is understandable that if the first task unit is the first task unit of the first task or the first task is the first execution of the NPU, then the parameter table may not contain a historical target operating frequency corresponding to the first task unit and the expected processing time. In this case, the NPU can be kept in the first task unit according to the currently set operating frequency.
[0188] If the first task unit is not the first task unit in the first task, or if the first task is not being executed for the first time, then if the processing time of the first task unit by the NPU has been determined using the scheme of this application before the current moment to be the target operating frequency suitable for the expected processing time, then the parameter table must contain a target operating frequency corresponding to the first task unit and the expected processing time. For ease of distinction, the target operating frequency stored in the parameter table that corresponds to the first task unit is called the historical target operating frequency.
[0189] Based on this, adjusting the NPU's operating frequency to the obtained historical target operating frequency can make the actual processing time of the NPU for the first task unit approach or reach the expected processing time.
[0190] In this application, there are no restrictions on the specific method for adjusting the operating frequency of the NPU. For example, the relevant modules used to implement Dynamic Voltage and Frequency Scaling can be instructed to adjust the operating frequency of the NPU to the historical target operating frequency.
[0191] S704, in response to the NPU completing the processing of the first task unit, determines the end time of the first task unit and the current operating frequency currently used by the NPU.
[0192] The determination of the current operating frequency of the NPU can be performed at any time when the NPU starts the execution of the first task unit, and is not limited to this step S704.
[0193] Specifically, if the NPU's operating frequency has been adjusted to the target historical operating frequency corresponding to the first task unit when the first task unit is started, then the current operating frequency is the target historical operating frequency.
[0194] S705, based on the start time and end time of the first task unit, determine the actual processing time of the first task unit.
[0195] S706, taking the expected processing time as the target, and based on the time difference between the actual processing time and the expected processing time, uses a PID algorithm to determine the frequency adjustment value required by the NPU.
[0196] S707 determines the desired operating frequency required by the NPU based on the frequency adjustment value and the current operating frequency of the NPU.
[0197] S708, using the expected operating frequency as the target operating frequency suitable for the NPU to process the first task unit next time, update the target operating frequency in the parameter table corresponding to the first task unit and the expected processing time.
[0198] The specific implementation of updating the parameter table can be found in the previous introduction, and will not be repeated here.
[0199] Understandably, as in step S703 above, after updating the target operating frequency corresponding to the first task unit and the expected processing time to the parameter table, when the processor executes the first task unit next time, the processor's operating frequency can be set to the target operating frequency determined this time, so that the actual processing time of the processor executing the first task unit next time is close to or reaches the expected processing time.
[0200] Moreover, as the processor continuously processes the first task unit, it can continuously accumulate the time difference between the actual processing time and the expected processing time of different times, and use the PID algorithm to continuously optimize the processor's processing of the first task unit to a suitable expected operating frequency. This makes the determined target operating frequency more and more accurate, and thus makes the actual processing time required by the processor in the first task unit closer and closer to the expected processing time.
[0201] To facilitate a clear and intuitive understanding of the implementation and benefits of this embodiment, combined with... Figure 8 A brief explanation is provided. Figure 8 The schematic diagram of the implementation framework of this embodiment is shown.
[0202] exist Figure 8 Taking the first task processed by the processor as a large-scale model inference task as an example, each task unit of a large-scale language model inference task is a task unit for inferring one token. Therefore, a large-scale model inference task typically includes multiple task units for inferring tokens. Figure 8 The expected processing time for the NPU to process one task unit is the target time.
[0203] When the NPU executes the first token inference in this large model inference task, i.e., when executing the first task unit, the parameter table may not contain a target operating frequency corresponding to this task unit and its target duration. In this case, the processor can execute the first task unit according to its currently set operating frequency. At this time, the actual processing time of the processor for the first task unit differs significantly from the expected processing time.
[0204] However, during the execution of the first task unit by the NPU, the target operating frequency suitable for the processor to process that task unit is determined using the scheme of this application, with the target duration as the objective. Specifically, as follows... Figure 8 It can be seen that, based on the NPU driver interface, the start time of an NPU task unit can be determined, and the end time of that task unit can be obtained. Furthermore, the task unit's completion time can be obtained when the NPU finishes processing it. Based on the start and end times of the task unit, the task's execution time can be calculated.
[0205] Based on the expected processing time of the NPU task unit and the actual processing time of the task unit, the PID algorithm is used to determine the frequency adjustment value. Combining the frequency adjustment value with the current operating frequency of the NPU, the target operating frequency required for the NPU to process the task unit to reach the target processing time can be determined and updated in the parameter table.
[0206] After storing the target operating frequency in the parameter table, when the NPU executes the inference of the second token, i.e., when executing the second task unit, the suitable target operating frequency for the NPU to process the task unit can be obtained from the parameter table. If multiple candidate target operating frequencies exist in the parameter table corresponding to the task unit and the target duration, the target operating frequency can be determined from these candidates, as described in the previous embodiments. Then, the NPU's operating frequency is set to the determined target operating frequency, so that the NPU processes the second task unit based on this target operating frequency, thereby making the actual processing time of the second task unit closer to the target duration.
[0207] However, since the NPU can only obtain the difference between the actual processing time and the target time of the first task unit when it completes the first task unit, and there is no accumulated historical time difference, the accuracy of the frequency adjustment value determined by the PID algorithm is relatively low. This results in a low accuracy of the target operating frequency, and consequently, a large gap between the actual processing time of the NPU for the second task unit based on the target operating frequency and the target time.
[0208] Based on this, during the execution of the second task unit by the NPU, such as Figure 8As shown, this application will still obtain the start and end times of the NPU executing the second task unit and determine the actual processing time required for the NPU to execute the second task unit. Based on the time difference between the actual processing time determined this time and the target time, the frequency adjustment value can be optimized by using the PID algorithm combined with the time difference accumulated when the NPU executes the first task unit, thereby improving the accuracy of the determined frequency adjustment value and the accuracy of the final determined target operating frequency.
[0209] Accordingly, after updating the parameter table using the target operating frequency determined after executing the second task unit, when the NPU processes the third task unit of the large model inference task, the NPU's operating frequency can be adjusted based on the target operating frequency corresponding to that task unit in the parameter table. This makes the actual processing time required by the processor in the third task unit closer to the expected processing time. By repeating this process continuously, the actual processing time of the processor in subsequent task units can get closer and closer to or reach the expected processing time.
[0210] Furthermore, this application also provides an electronic device in its embodiments. For example... Figure 9 As shown, it illustrates a schematic diagram of the composition structure of the electronic device, which includes at least a controller 901 and at least one processor 902;
[0211] The processor 902 is a first task unit used to initiate and execute the first task;
[0212] The controller 901 is configured to, in response to the execution of a first task unit of a first task initiated by the processor, determine the actual performance metrics of the processor processing the first task unit, the first task including at least one first task unit; obtain the expected performance metrics corresponding to the first task unit; determine the expected operating parameters required by the processor based on the actual performance metrics of the first task unit and the expected performance metrics; and determine the first target operating parameters for the processor to process the first task unit next time based on the expected operating parameters.
[0213] For example, the processor can be an NPU or GPU, which is capable of running intelligent models. The controller can be a control module used to manage the processor; for example, the controller can be a CPU.
[0214] It is understood that the specific implementation of the processor and controller can be found in the relevant descriptions of the preceding method embodiments, and will not be repeated here.
[0215] Furthermore, this embodiment may also include a memory 903 and a display unit 904. The memory 903 is used to store the program required by the controller to perform operations. The display unit 904 is used to display the output result of the processor performing the first task.
[0216] Of course, the electronic device can also have more than Figure 9 There are no restrictions on the number of components, whether more or fewer.
[0217] This application also provides a computer program product, including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the processor control methods provided in this application.
[0218] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the processor control methods provided in this application.
[0219] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0220] The face detection tasks involved in this application embodiment all use face image data from legally obtained public datasets or authorized data collection, and do not involve the illegal acquisition or use of personal biometric information.
[0221] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0222] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0223] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A processor control method, comprising: In response to the processor initiating the execution of a first task unit of a first task, the processor determines the actual performance metrics of the processor processing the first task unit, wherein the first task includes at least one first task unit; Obtain the expected performance index corresponding to the first task unit; Based on the actual performance indicators of the first task unit and with the desired performance indicators as the target, the desired operating parameters required by the processor are determined. Based on the desired operating parameters, the first target operating parameters for the processor to process the first task unit next are determined.
2. The processor control method according to claim 1 further includes: In response to the processor initiating the execution of the first task unit, the second target working parameters corresponding to the first task unit, which were determined before the current moment, are obtained; Based on the second target operating parameters, the operating parameters of the processor are adjusted so that the processor processes the first task unit based on the adjusted operating parameters.
3. The processor control method according to claim 2, wherein obtaining the second target working parameters corresponding to the first task unit determined before the current moment includes: Obtain the second target working parameters corresponding to the first task unit from the parameter table, wherein the parameter table stores target working parameters corresponding to at least one task unit, and the first task unit belongs to the at least one task unit; The processor control method further includes: Based on the first target working parameters, update the target working parameters in the parameter table corresponding to the first task unit.
4. The processor control method according to claim 3, wherein adjusting the processor's operating parameters based on the second target operating parameters includes: In response to the presence of the second target working parameter in the parameter table and the processor currently starting or running a second task unit in a second task, a third target working parameter corresponding to the second task unit is obtained from the parameter table, wherein the second task unit belongs to the at least one task unit; Based on the second target operating parameters and the third target operating parameters, suitable reference operating parameters for the processor are determined; Adjust the processor's operating parameters to the reference operating parameters.
5. The processor control method according to claim 3 or 4, wherein obtaining the second target operating parameters corresponding to the first task unit from the parameter table includes: Obtain the second target working parameters corresponding to the first task unit and the expected performance index from the parameter table; The parameter table stores target operating parameters for at least one task unit under at least one performance metric.
6. The processor control method according to claim 3 or 4, wherein the parameter table further includes: The generation time corresponding to the target working parameters; Obtaining the second target working parameters corresponding to the first task unit from the parameter table includes: In response to the existence of at least one candidate target working parameter corresponding to the first task unit in the parameter table, a second target working parameter is determined from the at least one candidate target working parameter based on the size relationship of each candidate target working parameter and at least one of the generation time corresponding to each candidate target working parameter. The step of updating the target working parameters corresponding to the first task unit in the parameter table based on the first target working parameters includes: Based on at least one of the difference between the first target working parameter and the candidate target working parameter and the time difference between the generation time of the candidate target working parameter and the generation time of the first target working parameter, a candidate target working parameter to be updated is determined from the at least one candidate target working parameter. Replace the candidate target working parameters to be updated and their generation time with the first target working parameters and their generation time, respectively.
7. The processor control method according to any one of claims 1 to 4, further comprising: Determine the current operating parameters currently used by the processor; The step of determining the desired operating parameters required by the processor based on the actual performance indicators of the first task unit, with the desired performance indicators as the target, includes: With the desired performance index as the target, the desired operating parameters required by the processor are determined based on the actual performance index of the first task unit and the current operating parameters.
8. The processor control method according to claim 7, wherein determining the desired operating parameters required by the processor based on the actual performance indicators of the first task unit and the current operating parameters, with the desired performance index as the target, includes: Determine the performance difference between the actual performance index and the expected performance index of the first task unit; Based on the performance index difference and at least one historical performance index difference, the required operating parameter adjustment value for the processor is determined, wherein the historical performance index difference is the historically determined performance index difference. Based on the current operating parameters and the adjusted operating parameter values, the desired operating parameters required by the processor are determined.
9. The processor control method according to any one of claims 1 to 4, wherein determining the actual performance indicators of the processor processing the first task unit in response to the processor initiating the execution of the first task unit includes: In response to the processor initiating a first task unit of the intelligent model to execute a first task, the actual performance metrics of the processor processing the first task unit are determined.
10. An electronic device, comprising: Controller and at least one processor; The processor is a first task unit used to start and execute the first task. The controller is configured to determine the actual performance metrics of the processor processing the first task unit in response to the processor initiating the execution of the first task unit of the first task, wherein the first task includes at least one first task unit. Obtain the expected performance index corresponding to the first task unit; based on the actual performance index of the first task unit and using the expected performance index as the target, determine the expected operating parameters required by the processor; based on the expected operating parameters, determine the first target operating parameters for the processor to process the first task unit next time.