Task scheduling method and device, electronic equipment and medium
Patent Information
- Application Number
- CN202610956604.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-08-18
AI Technical Summary
[0003]本申请实施例的目的是提供一种任务调度方法、装置、电子设备及介质,用以解决无法实现任务执行路径的最优调整的问题
[0016] In embodiments of this application, the execution characteristics of a first task on the CPU are converted into execution characteristics on a heterogeneous subsystem to be evaluated based on feature adaptation parameters. These execution characteristics are then used to predict the total energy consumption of the first task on the heterogeneous subsystem. Based on the total energy consumption and the energy consumption of the first task on the CPU, a scheduling strategy for the first task is determined. This scheme enables the system scheduler to make forward-looking judgments during the execution of the first task, determining the optimal adjustment strategy based on the task's compatibility with the heterogeneous subsystem and its energy consumption. For example, it can automatically distribute highly compatible tasks to the heterogeneous subsystem and retain less compatible tasks on the CPU, thereby achieving full SoC-level energy consumption optimization while ensuring system smoothness.
Smart Images

Figure CN122593957A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of communication technology, specifically relating to a task scheduling method, apparatus, electronic device, and medium. Background Technology
[0002] With the diversification of computing demands, modern System-on-Chips (SoCs) integrate multiple heterogeneous subsystems, including a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a Neural Network Processing Unit (NPU). The energy efficiency of different tasks varies significantly across these subsystems. To achieve optimal energy efficiency, it's necessary to determine the task's execution path—whether it runs on the CPU or is offloaded to the GPU or NPU. This path determination requires specialized power consumption assessments for each heterogeneous subsystem. Existing heterogeneous power consumption assessment schemes typically rely heavily on historical runtime data or offline calibration, representing a post-hoc analysis. This prevents the system from predicting power consumption trajectories under different migration decisions before task scheduling, based on real-time workload characteristics, hardware status (such as temperature and voltage drop), and system environment, thus hindering optimal adjustments. Summary of the Invention
[0003] The purpose of this application is to provide a task scheduling method, apparatus, electronic device, and medium to solve the problem of being unable to achieve optimal adjustment of task execution paths.
[0004] In a first aspect, embodiments of this application provide a task scheduling method, including:
[0005] Based on the feature adaptation parameters of the first task, the first execution characteristics of the first task on the central processing unit (CPU) are converted into the second execution characteristics of the first task on the heterogeneous subsystem; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem.
[0006] Based on the feature adaptation parameters and the second execution feature, predict the total energy consumption of the first task running on the heterogeneous subsystem;
[0007] Based on the total energy consumption and the energy consumption of the first task running on the CPU, a scheduling strategy for the first task is determined.
[0008] Secondly, embodiments of this application provide a task scheduling apparatus, including:
[0009] The first processing module is configured to convert the first execution characteristics of the first task on the central processing unit (CPU) into the second execution characteristics of the first task on the heterogeneous subsystem based on the feature adaptation parameters of the first task; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem.
[0010] The prediction module is used to predict the total energy consumption of the first task running on the heterogeneous subsystem based on the feature adaptation parameters and the second execution feature.
[0011] The scheduling module is used to determine the scheduling strategy for the first task based on the total energy consumption and the energy consumption of the first task running on the CPU.
[0012] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0013] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0014] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.
[0015] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.
[0016] In embodiments of this application, the execution characteristics of a first task on the CPU are converted into execution characteristics on a heterogeneous subsystem to be evaluated based on feature adaptation parameters. These execution characteristics are then used to predict the total energy consumption of the first task on the heterogeneous subsystem. Based on the total energy consumption and the energy consumption of the first task on the CPU, a scheduling strategy for the first task is determined. This scheme enables the system scheduler to make forward-looking judgments during the execution of the first task, determining the optimal adjustment strategy based on the task's compatibility with the heterogeneous subsystem and its energy consumption. For example, it can automatically distribute highly compatible tasks to the heterogeneous subsystem and retain less compatible tasks on the CPU, thereby achieving full SoC-level energy consumption optimization while ensuring system smoothness. Attached Figure Description
[0017] Figure 1This is one of the flowcharts illustrating the task scheduling method according to an embodiment of this application;
[0018] Figure 2 This is a schematic diagram of the operation flow of the PGO-like mechanism in an embodiment of this application;
[0019] Figure 3 This is a second flowchart illustrating the task scheduling method according to an embodiment of this application;
[0020] Figure 4 This is a schematic diagram of the structure of the task scheduling device according to an embodiment of this application;
[0021] Figure 5 This is one of the structural schematic diagrams of the electronic device according to an embodiment of this application;
[0022] Figure 6 This is the second schematic diagram of the structure of the electronic device in the embodiment of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0024] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0025] The task scheduling method, apparatus, electronic device, and medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0026] like Figure 1 As shown in the figure, this application provides a task scheduling method, including:
[0027] Step 101: Based on the feature adaptation parameters of the first task, convert the first execution feature of the first task on the central processing unit (CPU) into the second execution feature of the first task on the heterogeneous subsystem; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem.
[0028] Step 102: Based on the feature adaptation parameters and the second execution feature, predict the total energy consumption of the first task running on the heterogeneous subsystem;
[0029] Step 103: Based on the total energy consumption and the energy consumption of the first task running on the CPU, determine the scheduling strategy for the first task.
[0030] In this embodiment, the first task can be understood as a task that can run on the heterogeneous subsystem to be evaluated, and this task can also be understood as an algorithm. The heterogeneous subsystem can be understood as other systems in a SoC that are different from the CPU, such as GPU, NPU, MediaTek Vision Processing Unit (MVPU), Compute Digital Signal Processor (CDSP), etc. The feature adaptation parameters can be represented as feature scores for each aspect of the first task. The feature adaptation parameters characterize the adaptation of the first task on the heterogeneous subsystem.
[0031] The first task is run on the CPU, and a first execution characteristic is collected, such as the sampled value of the Performance Monitoring Counter (PMC) when the first task is executed on the CPU. The first execution characteristic is then equivalently transformed according to the feature adaptation parameters of the first task to obtain a second execution characteristic of the first task on a heterogeneous subsystem, such as the sampled value of the PMC when the first task is executed on the heterogeneous subsystem. Here, the heterogeneous subsystem can be any heterogeneous subsystem to be evaluated.
[0032] Based on the feature adaptation parameters of the first task and the second execution characteristics of the first task on the heterogeneous subsystem to be evaluated, the total energy consumption of the first task running on the heterogeneous subsystem is predicted. By comparing this total energy consumption with the energy consumption of the first task running on the CPU, the scheduling strategy of the first task can be determined. The scheduling strategy of the first task can be understood as deciding whether to migrate the first task, such as deciding whether to execute the first task on the CPU or on the target heterogeneous subtask based on energy efficiency advantages, thereby achieving adjustment based on optimal energy efficiency.
[0033] In the embodiments of this application, the execution characteristics of a first task on the CPU are converted into execution characteristics on the heterogeneous subsystem to be evaluated based on feature adaptation parameters. These execution characteristics are then used to predict the total energy consumption of the first task on the heterogeneous subsystem. Based on the total energy consumption and the energy consumption of the first task on the CPU, a scheduling strategy for the first task is determined. This scheme enables the system scheduler to make forward-looking judgments during the execution of the first task, determining the optimal adjustment strategy based on the task's compatibility with the heterogeneous subsystem and its energy consumption. For example, it can automatically distribute highly compatible tasks to the heterogeneous subsystem and retain less compatible tasks on the CPU, thereby achieving full SoC-level energy consumption optimization while ensuring system smoothness.
[0034] In some embodiments, predicting the total energy consumption of the first task running on the heterogeneous subsystem based on the feature adaptation parameters and the second execution feature includes:
[0035] Based on the second execution feature and the pre-trained model parameters corresponding to the heterogeneous subsystem, predict the real-time power consumption of the first task running on the heterogeneous subsystem;
[0036] Based on the feature adaptation parameters, predict the execution time of the first task on the heterogeneous subsystem;
[0037] Based on the real-time power consumption and the execution time, the total energy consumption of the first task running on the heterogeneous subsystem is determined.
[0038] In this embodiment, the real-time power consumption of the first task running on the heterogeneous subsystem is predicted based on the second execution characteristics of the first task on the heterogeneous subsystem and the pre-trained model parameters corresponding to the heterogeneous subsystem. The pre-trained model parameters are parameters obtained by training a linear model on the heterogeneous subsystem offline. The pre-trained model parameters are model input parameters obtained by training a linear model using data samples offline. Before evaluating the heterogeneous subsystem or analyzing the task scheduling strategy, the power consumption characteristics of each heterogeneous subsystem at different frequencies are quantified through data sample training and stored in a look-up table (LUT). In the online prediction stage, the real-time power consumption of the first task running on the heterogeneous subsystem can be predicted based on the transformed second execution characteristics and the pre-trained model parameters retrieved from the look-up table (LUT).
[0039] Based on the feature adaptation parameters of the first task, the execution time of the first task on the heterogeneous subsystem can also be predicted. It should be noted that there is no restriction on the order of predicting real-time power consumption and execution time; that is, the real-time power consumption of the first task running on the heterogeneous subsystem can be obtained first, or the execution time can be obtained first, or both can be obtained simultaneously. Based on the predicted real-time power consumption and execution time of the first task on the heterogeneous subsystem, the total energy consumption of the first task running on the heterogeneous subsystem can be calculated.
[0040] In some embodiments, the method further includes: training a linear model for multiple heterogeneous subsystems contained in a system-on-a-chip (SoC) based on sample data, and obtaining pre-trained model parameters for each heterogeneous subsystem at different frequencies.
[0041] In this embodiment, before making scheduling decisions for the first task or evaluating heterogeneous subsystems, offline training is required to obtain linear models and pre-trained model parameters corresponding to each heterogeneous subsystem. This process involves training with data samples to quantify the power consumption characteristics of each hardware heterogeneous subsystem at different frequencies and storing them in a lookup table (LUT) for use during online evaluation.
[0042] Optionally, the step of training linear models based on sample data for multiple heterogeneous subsystems contained in a system-on-a-chip (SoC) to obtain pre-trained model parameters for each heterogeneous subsystem at different frequencies includes:
[0043] A frequency state space is defined for each heterogeneous subsystem included in the SoC, and the frequency state space corresponding to each heterogeneous subsystem includes at least one frequency.
[0044] For each of the heterogeneous subsystems, activity data of the hardware performance counter (PMC) under different frequency state spaces and power consumption of the heterogeneous subsystems are collected to form sample data.
[0045] Based on the sample data, a correlation analysis is performed to determine the PMC set; this PMC set is a set of PMCs that are most correlated with power consumption and are mutually compatible.
[0046] Model training is performed based on the PMC sample values in the PMC set to obtain a pre-trained linear model and pre-trained model parameters for each heterogeneous subsystem at each frequency.
[0047] In this embodiment, the SoC is first divided into multiple heterogeneous subsystems, for example... Define an adjustable dynamic voltage and frequency scaling (DVFS) frequency state space for each heterogeneous subsystem, denoted as: Each heterogeneous subsystem has its own corresponding... It contains one or more frequency states.
[0048] For each heterogeneous subsystem, at different frequencies The following collects activity data from the hardware performance counter (PMC) (such as...). Simultaneously, the actual power consumption (mA) of the heterogeneous subsystem is collected to form sample data. This step can be evaluated using typical routines under the heterogeneous subsystem. Based on the sample data, correlation coefficient analysis is performed to select the PMC set that has the highest correlation with power consumption and is mutually compatible. Using this PMC set The sample data in the model is used for training to obtain the linear model and pre-trained model parameters corresponding to each heterogeneous subsystem.
[0049] There are many methods for correlation analysis, and this application does not limit them. The following is an example of a correlation analysis method: After the original data is normalized, the correlation between the data is calculated by the Pearson correlation coefficient. The coefficient that is strongly correlated with power consumption is selected. Among the two PMC events with extremely high correlation, only the PMC event with the larger correlation coefficient r with power consumption is retained.
[0050] For a set of sample data The formula for calculating the correlation coefficient r is as follows:
[0051] ;
[0052] in, For the sample size, For the i-th sample value, , Let x and y be the average values. It is PMC activity data or sampled values. It is the power consumption of the heterogeneous subsystem.
[0053] For example: during the offline training phase, targeting a specific frequency point of the GPU in a heterogeneous subsystem. :
[0054] Candidate Pool: The system exposes 200 PMC events, such as active cycles, memory stop times, and floating-point operations (FP32_Instr). These 200 PMC events constitute the collected PMC activity data.
[0055] Correlation filtering: By running different loads, it was found that the Pearson correlation coefficient r values between Active_Cycles and FP32_Instr and power consumption were both greater than 0.85, and were therefore selected first.
[0056] Compatibility redundancy removal: The autocorrelation r between the total number of instructions (Total_Instr) and FP32_Instr was found to be extremely high (>0.95). Considering that the GPU of this subsystem is often used for AI computing, FP32_Instr, which is more sensitive to power consumption fluctuations, was retained.
[0057] Hardware mapping: Confirm that the selected 4-6 PMC events can be simultaneously filled into the performance monitoring register of this architecture, ultimately forming a PMC set. .
[0058] For each frequency of each heterogeneous subsystem d (d is the identifier of the heterogeneous subsystem) Training independent linear models:
[0059] ;
[0060] in, It is a linear model obtained through training; This is static power consumption (which can reflect leakage current). For set The performance counter PMC sample value in the middle, These are the weighting coefficients (which can be obtained through training with non-negative least squares NNLS). This is the normalized sampling period.
[0061] The trained model parameters can be stored in a two-dimensional mapping table. The final result is shown in Table 1 below:
[0062] Table 1:
[0063]
[0064] Based on the pre-trained linear model and its parameters, the pre-trained model parameters corresponding to the heterogeneous subsystem can be directly obtained by looking up the table during subsequent online evaluation.
[0065] In some embodiments, static and dynamic analyses are performed on the first task to obtain feature adaptation parameters for the first task, including:
[0066] Static analysis is performed on the first task to obtain its vectorized score and parallel availability score.
[0067] The first task is dynamically analyzed to obtain its arithmetic density score and logical suggestion score.
[0068] The adaptation score between the first task and the heterogeneous subsystem is determined based on the vectorization score, the parallel availability score, the arithmetic density score, and the logical suggestion score.
[0069] The feature adaptation parameters of the first task include one or more of the vectorization score, the parallel availability score, the arithmetic density score, the logical suggestion score, and the adaptation score.
[0070] In this embodiment, static and dynamic analyses are performed on the first task to obtain feature adaptation parameters. These feature adaptation parameters characterize the compatibility of the first task with the heterogeneous subsystem. Optionally, runtime data from the Profile-Guided Optimization (PGO) mechanism can be used to analyze and obtain a vectorized score (represented as...) during the static compilation of the first task. ) and parallel availability score (represented as For the first task, the instrumented compiled algorithm is run, and the arithmetic density score (represented as...) is dynamically obtained during the algorithm's execution (i.e., during task execution). ) and logical suggestion score (represented as ).
[0071] The operation flow of the PGO-like mechanism is as follows: Figure 2 As shown, algorithm test cases are input into the compiler, such as input example 1, input example 2, and input example 3. After processing by the source bin, profile data is output, such as profile1.data, profile2.data, and profile3.data. The compiler analyzes the output profile data to derive the algorithm's vectorized score. and parallel availability score .
[0072] The Runner module uses source code to instrument and compile source bins. It then collects dynamic parameter arithmetic density scores in real time through the CPU's hardware performance counter (PMC). Logical suggestion score .
[0073] In some embodiments, the data obtained by static analysis of the first task includes at least one of the following:
[0074] 1) Vectorized score The compiler analyzes the proportion of loop instructions in the code that can be processed using vectorized Single Instruction Multiple Data (SIMD). This parameter directly determines the algorithm's basic performance on systems with strong vector capabilities, such as MVPU or CDSP.
[0075] 2) Instruction Mix Ratio: Used to calculate the static ratio of arithmetic operations (floating-point / fixed-point), logic control, and memory access instructions in the code.
[0076] 3) Parallel availability score Used to evaluate the density of data dependencies in the code and estimate the parallel availability of the code. A value close to 1 indicates that there are very few dependencies between instructions, supporting multi-core parallelism or Very Long Instruction Word (VLIW) padding.
[0077] 4) Static memory access mode: used to analyze whether memory access addresses are contiguous (Stride) and predict their movement efficiency on heterogeneous system dedicated memory (such as local memory).
[0078] In some embodiments, the data obtained by dynamically analyzing the first task is collected in real time by the execution (Runner) module through the CPU's PMC, reflecting the actual performance of the algorithm under actual input data. The data obtained by dynamically analyzing the first task includes at least one of the following:
[0079] Arithmetic density score For example, the arithmetic density score is calculated using the number of PMC arithmetic instructions (Arithmetic_PMCs) and the number of PMC memory access instructions (Memory_Access_PMCs). A score close to 1 indicates "computation-intensive" and close to 0 indicates "memory-intensive". For a given task, the higher its computational proportion, the better it can offset the data transfer overhead of migrating heterogeneous systems.
[0080] Logical suggestion score This can be understood as the reciprocal of the branch penalty. A logic suggestion score close to 1 indicates very few branches or very predictable branches (linear execution); a score close to 0 indicates complex logic jumps, which will generate a large number of pipeline bubbles.
[0081] Cache miss rate and memory access characteristics: This characteristic represents the locality of an algorithm as observed through the L1 / L2 cache miss rate. Algorithms with poor locality may make the memory bus a bottleneck.
[0082] Normalized vector PMC combination (represented as) ): Used to observe the actual frequency of vector instruction execution triggered on the CPU. It can be used as a confidence factor to verify whether the vectorization potential of static analysis is triggered in actual operation.
[0083] Function execution time percentage: Determine the power consumption weight of the function in the entire program execution to ensure that optimization focuses on "hot functions".
[0084] In this embodiment, after obtaining vectorization score, parallel availability score, arithmetic density score, and logical suggestion score by static and dynamic analysis of runtime data through the compiler, the adaptation score between the first task and the heterogeneous subsystem can be calculated.
[0085] In some embodiments, determining the fit score between the first task and the heterogeneous subsystem based on the vectorization score, the parallel availability score, the arithmetic density score, and the logical suggestion score includes:
[0086] Based on the vectorization score, the parallel availability score, the arithmetic density score, and the logical suggestion score, as well as the weights of each score, the fit score between the first task and the heterogeneous subsystem is determined; the fit score is then calibrated based on a confidence factor to obtain a calibrated fit score.
[0087] The vectorization score, the parallel availability score, the arithmetic density score, and the logical proposal score can be considered as feature adaptor scores. The adaptability score between the first task and the heterogeneous subsystem can be expressed as... Calculate the fit score. The formula is as follows:
[0088] ;
[0089] in, Represents the vectorized score. Represents the arithmetic density score. Indicates the parallel availability score. Indicates the score for logical suggestions; , , , These are the weights for the vectorization score, arithmetic density score, parallel availability score, and logical suggestion score, respectively. This represents the calculated fit score between the first task and the heterogeneous subsystem.
[0090] The formula for calibrating the fit score based on the confidence factor is as follows:
[0091] ;
[0092] in, This indicates the calibration fit score; The confidence factor can be a combination of normalized vectors PMC obtained from the dynamic analysis of the first task.
[0093] Among them, static data ( , This determines the upper limit of the fit score.
[0094] Dynamic data ( , This determines the actual landing point of the fitting score.
[0095] Confidence factor ( This is used to calibrate the final score, ensuring that predictions are not distorted due to compiler over-optimization or runtime data bias.
[0096] Among them, weight , , , Determined by offline calibration or policy selection, for example, GPUs place more emphasis on... and ,but and The weight of [a certain factor] is greater, and no specific restrictions are made here.
[0097] In some embodiments, converting the first execution characteristics of the first task on the central processing unit (CPU) into a second execution characteristic of the first task on a heterogeneous subsystem based on the feature adaptation parameters of the first task includes:
[0098] Based on the correction function composed of the feature adaptation parameters and the architecture scaling factor, the first execution feature of the first task on the CPU is equivalently transformed to obtain the second execution feature of the first task on the heterogeneous subsystem; wherein, the architecture scaling factor is the architecture scaling factor between the CPU and the heterogeneous subsystem.
[0099] In this embodiment, since the online phase algorithm runs on the CPU, it cannot directly obtain the PMC sampling values of the heterogeneous subsystem. Therefore, it is necessary to utilize the obtained feature adaptation parameters (i.e., adaptation scores). The equivalent conversion is performed on the CPU and related sub-scores. Given the significant differences in architectural design between the CPU and the heterogeneous subsystem, such as pipeline width and SIMD width, the conversion formula is as follows:
[0100] ;
[0101] in, It is the transformed second execution characteristic, which can be understood as the sampled value of PMC when the first task is executed on a heterogeneous subsystem; It is the first execution characteristic, which can be understood as the sampled value of PMC when the first task is executed on the CPU; It is a correction function composed of feature adaptation parameters and the architecture scaling factor, and is a dynamic correction function based on feature adaptor sub-scores; The feature fitter score represents at least one of the following: vectorization score, parallel availability score, arithmetic density score, and logical proposal score. This represents the architecture scaling factor.
[0102] It should be noted that the form of the correction function differs for different tasks. For example, the corresponding correction function differs for computationally intensive tasks and memory-intensive tasks. The specific form of the correction function is not limited here. The following uses computational feature transformation as an example to illustrate the feature transformation process.
[0103] For computationally intensive PMCs (such as ALU_ACTIVE_CYCLES) with heterogeneous subsystems that are MVPU / CDSP:
[0104] Input: CPU floating-point / vector operations PMC ( Vectorized score obtained from compiler static analysis .
[0105] The conversion logic is as follows:
[0106] Architecture scaling: If the CPU is a 128-bit SIMD and the CDSP is a 1024-bit Tensor Core, the base scaling factor is 0.125 (because heterogeneous systems can complete the same amount of computation in fewer cycles).
[0107] The equivalent conversion formula is as follows:
[0108] ;
[0109] in, This represents the PMC sample value of the first task on the CPU before the conversion, i.e., the first execution characteristic; This represents the PMC sample value of the first task after conversion on the CDSP, i.e., the second execution characteristic. The calculated base scaling factor, This indicates the width of the CPU pipeline or the SIMD width. This indicates the width of the pipeline or the SIMD width of the heterogeneous subsystem CDSP; for The calculated transformation coefficient can be understood as the architecture sensitivity gain coefficient, used to quantify the degree of vectorizability. The amplification effect on the kernel execution efficiency or activity of heterogeneous subsystems. Among them, The higher the value, the more saturated the heterogeneous computing units that can be triggered after the first task migrates to the heterogeneous subsystem, and the higher the equivalent activity intensity.
[0110] In some embodiments, predicting the real-time power consumption of the first task running on the heterogeneous subsystem based on the second execution characteristics and the pre-trained model parameters corresponding to the heterogeneous subsystem includes:
[0111] The second execution feature and the pre-trained model parameters are input into the pre-trained linear model to obtain the real-time power consumption of the first task running on the heterogeneous subsystem.
[0112] The linear model is used to calculate the real-time power consumption of the task running on the heterogeneous subsystem; the pre-trained model parameters include: weight coefficients for static power consumption and PMC sample values.
[0113] In this embodiment, after obtaining the second execution characteristics of the first task running on the heterogeneous subsystem, the pre-trained model parameters corresponding to the heterogeneous subsystem can be obtained by looking up a table (Table 1). For example, the online prediction module first determines the parameters based on the heterogeneous subsystem to be evaluated (such as MVPU or CDSP) and the system's preset DVFS frequency point. Two-dimensional indexing is performed in the LUT table for location. The location parameters are: the input heterogeneous subsystem identifier d and the target frequency. Extract the model parameters for that specific state from the LUT table. The extracted content includes: obtaining the frequency point. Corresponding static power consumption and the set of weight coefficients corresponding to each highly correlated PMC. .
[0114] After extracting relevant parameters and determining the transformed second execution feature, the online module executes the linear model trained in the offline phase:
[0115] ;
[0116] This represents the calculated real-time power consumption of the first task running on the heterogeneous subsystem; Indicates static power consumption; Indicates the second execution characteristic; This represents the weighting coefficient of the second execution characteristic, which is the weighting coefficient corresponding to the PMC sample value on the heterogeneous subsystem. The calculation result represents the weighting coefficient if the current task is migrated to the heterogeneous subsystem d and at a certain frequency... Under these conditions, its expected real-time power consumption .
[0117] In some embodiments, predicting the execution time of the first task on the heterogeneous subsystem based on the feature adaptation parameters includes:
[0118] Predict the speedup ratio of the heterogeneous subsystem based on the feature adaptation parameters;
[0119] Based on the execution time of the first task on the CPU, the speedup ratio, and the fixed overhead, the execution time of the first task on the heterogeneous subsystem is predicted, where the fixed overhead is the fixed time consumption value of the first task when running on the heterogeneous subsystem.
[0120] In this embodiment, the formula for predicting the speedup ratio of the heterogeneous subsystem based on the feature adaptation parameters is as follows:
[0121] ;
[0122] in, This represents the fit score between the first task and the heterogeneous subsystem, which is the calibrated fit score. This represents the maximum speedup of the heterogeneous subsystem under ideal conditions, and is related to the architecture design. It is the calculated speedup ratio.
[0123] Based on the execution time of the first task on the CPU, the speedup ratio, and the fixed overhead, the formula for predicting the execution time of the first task on the heterogeneous subsystem is as follows:
[0124] ;
[0125] in, It is the predicted execution time of the first task on the heterogeneous subsystem; It is the execution time of the first task on the CPU; These are fixed overheads, such as fixed time consumption caused by data transmission time, startup delay time, etc.
[0126] In some embodiments, determining the total energy consumption of the first task running on the heterogeneous subsystem based on the real-time power consumption and the execution time includes: calculating the product of the real-time power consumption and the execution time to obtain the total energy consumption of the first task running on the heterogeneous subsystem.
[0127] In this embodiment, real-time power consumption is obtained. and the execution time Next, the total energy consumption of the first task running on the heterogeneous subsystem is calculated using the following formula:
[0128] ;
[0129] in, This represents the total energy consumption calculated for the first task to run on the heterogeneous subsystem.
[0130] Optionally, energy prediction can also be performed for this first task, using the following formula:
[0131] ; It is the energy consumption after deducting fixed costs.
[0132] The system according to By comparing the actual power consumption of the first task running on the CPU, an analysis report can be generated to determine whether to trigger heterogeneous delivery during operation and to select the optimal energy-efficient frequency for the system.
[0133] In some embodiments, a scheduling policy for the first task is determined based on the total energy consumption and the energy consumption of the first task running on the CPU, including:
[0134] Based on the total energy consumption and the energy consumption of the first task running on the CPU, determine the energy efficiency improvement ratio of the first task in the heterogeneous subsystem;
[0135] If the energy efficiency improvement ratio is greater than the first threshold, and the execution time of the first task on the heterogeneous subsystem meets the requirements of the Service Level Agreement (SLA), then it is determined that the first task is migrated to the heterogeneous subsystem for execution.
[0136] If the energy efficiency improvement ratio is less than or equal to the first threshold, and / or the execution time of the first task on the heterogeneous subsystem does not meet the performance SLA requirements, then it is determined that the first task is executed on the CPU.
[0137] In this embodiment, in actual use, the total energy consumption of the first task obtained from the aforementioned steps running on the heterogeneous subsystem is used as the scheduling decision input, for example:
[0138] Data input integration: based on predicted real-time power consumption and execution time As the core input, combined with the baseline energy consumption of the current primary task executing on the CPU. Conduct energy consumption assessments and calculate energy efficiency improvement ratios. :
[0139] ;
[0140] Simultaneously verify execution time Does it meet the constraints of the Performance Service Level Agreement (SLA) for the current application scenario?
[0141] Dynamic decision-making logic: The system classifies and determines decisions based on a preset decision threshold, namely the first threshold Γ.
[0142] Decision Offload: If ESR > Γ, and If the SLA performance requirements are met, it is determined that migrating the first task to the heterogeneous subsystem has energy efficiency advantages.
[0143] Maintain: If ESR ≤ Γ, and / or If the performance threshold is exceeded, i.e. the performance SLA requirement is not met, then the migration benefit of the first task is deemed insufficient, and the first task will continue to run on the CPU.
[0144] In some embodiments, after the first task is actually migrated to run on a heterogeneous subsystem, the system can compare the deviation between the "predicted power consumption" and the "actual power consumption" in real time, and automatically correct the weight coefficient w and gain coefficient σ in the offline LUT online through methods such as gradient descent, so as to realize the ability of the model accuracy to continuously evolve as the usage time increases.
[0145] The execution process of the task scheduling method provided in this application embodiment is as follows: Figure 3 As shown, it includes two phases: an offline training phase and an online prediction phase;
[0146] The offline training phase involves training with data samples to quantify the power consumption characteristics of each heterogeneous hardware subsystem at different frequencies and storing them in a lookup table (LUT).
[0147] Specifically, the offline training phase may include:
[0148] Step 301: Preliminary preparations and subsystem division.
[0149] In this step, the SoC is divided into multiple heterogeneous subsystems. Define an adjustable DVFS (Dynamic Voltage Frequency Regulation) frequency state space for each heterogeneous subsystem. .
[0150] Step 302: Screening of highly relevant PMC sets.
[0151] In this step, different frequency state spaces The following collects activity data from hardware performance counters (PMCs), such as... The system also collects the actual power consumption (mA) of heterogeneous subsystems simultaneously; through correlation coefficient analysis, it selects the PMC set that has the highest correlation with power consumption and is mutually compatible. .
[0152] Step 303: Linear modeling and lookup table (LUT) generation.
[0153] For each frequency of each heterogeneous subsystem d Training independent linear models:
[0154] ;
[0155] The trained model parameters can be stored in a two-dimensional mapping table. The final result is shown in Table 1.
[0156] The core of the online prediction phase is to map the execution characteristics of the first task on the CPU to the expected returns on the heterogeneous subsystem using functions as the granularity. This includes the following steps:
[0157] Step 304: Function-level feature profiling, including: static and dynamic analysis of the first task;
[0158] Among them, the vectorized score is obtained from static compile-time analysis. and parallel availability score Run the compiled algorithm with instrumentation to dynamically obtain the arithmetic density score. Logical suggestion score .
[0159] Step 305: Calculate the fit score between the first task and the heterogeneous subsystem:
[0160] ;
[0161] The fit score is calibrated based on the confidence factor:
[0162] .
[0163] Step 306: Index positioning to determine the heterogeneous subsystem and frequency status.
[0164] In this step, the online prediction module determines the heterogeneous subsystem to be evaluated (such as an MVPU or CDSP) and the system's preset DVFS frequency point. Two-dimensional indexing is used to locate the LUT table.
[0165] The positioning parameters are: input heterogeneous subsystem identifier d and target frequency. Extract the model parameters for that specific state from the LUT table.
[0166] The extracted content is: obtain this frequency point. Corresponding static power consumption and the set of weight coefficients corresponding to each highly correlated PMC. .
[0167] Step 307: Input feature mapping, transforming CPU features into equivalent activity intensity, which can be understood as transforming the first execution feature of the first task on the CPU into an equivalent second execution feature in the heterogeneous subsystem.
[0168] The conversion formula is as follows:
[0169] .
[0170] Step 308: Heterogeneous power consumption prediction.
[0171] In this step, based on the relevant parameters extracted from the LUT table and the transformed second execution features, the online module executes the linear model trained in the offline stage:
[0172] .
[0173] Step 309: Heterogeneous performance (execution time) prediction.
[0174] In this step, the speedup ratio of the heterogeneous subsystem is predicted based on the feature adaptation parameters of the first task:
[0175] ;
[0176] Predicting heterogeneous execution time :
[0177] .
[0178] Step 310: Integrated energy assessment and decision support.
[0179] Calculate Then, combined with the predicted heterogeneous execution time Calculate the total energy consumption :
[0180] .
[0181] Predictive feedback: The system based on By comparing the actual power consumption of the first task running on the CPU, an analysis report can be generated to determine whether to trigger heterogeneous delivery during operation and to select the optimal energy-efficient frequency for the system.
[0182] Step 311: Real-time heterogeneous task scheduling decision: including scheduling tasks to heterogeneous subsystems or keeping tasks on the CPU.
[0183] Among them, the predicted real-time power consumption and execution time As the core input, combined with the baseline energy consumption of the current primary task executing on the CPU. Conduct energy consumption assessments and calculate energy efficiency improvement ratios. :
[0184] ;
[0185] Simultaneously verify execution time Does it meet the constraints of the Performance Service Level Agreement (SLA) for the current application scenario?
[0186] Dynamic decision-making logic: The system classifies and determines decisions based on a preset decision threshold, namely the first threshold Γ.
[0187] Decision Offload: If ESR > Γ, and If the SLA performance requirements are met, it is determined that migrating the first task to the heterogeneous subsystem has energy efficiency advantages.
[0188] Maintain: If ESR ≤ Γ, and / or If the performance threshold is exceeded, i.e. the performance SLA requirement is not met, then the migration benefit of the first task is deemed insufficient, and the first task will continue to run on the CPU.
[0189] This application enables fine-grained system-level dynamic scheduling. Based on function-level feature data (such as vectorization ratio and arithmetic density) provided by a PGO-like mechanism, heterogeneous adaptation scores can be generated in real time. This allows the system scheduler to make proactive judgments at runtime, automatically assigning high-adaptability tasks to heterogeneous cores and retaining low-adaptability tasks on the CPU, thereby achieving full SoC-level power consumption optimization while ensuring system smoothness. The task scheduling method provided in this application has high architectural versatility and scalability. The weight allocation strategy (α, β, γ, δ) can be flexibly configured for different hardware characteristics and is not dependent on a specific instruction set architecture. Whether it is an MVPU for multimedia, a CDSP for signal processing, or a general-purpose GPU, it can be adapted by generating corresponding lookup tables (LUTs) through offline calibration, and has good industrial portability value.
[0190] The task scheduling method provided in this application can be executed by a task scheduling device. This application uses the execution of the task scheduling method by a task scheduling device as an example to illustrate the task scheduling device provided in this application.
[0191] like Figure 4 As shown, this application embodiment provides a task scheduling device 400, including:
[0192] First processing module 410, configured to convert the first execution characteristics of the first task on the central processing unit (CPU) into the second execution characteristics of the first task on the heterogeneous subsystem according to the feature adaptation parameters of the first task; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem.
[0193] Prediction module 420 is used to predict the total energy consumption of the first task running on the heterogeneous subsystem based on the feature adaptation parameters and the second execution feature;
[0194] The scheduling module 430 is used to determine the scheduling strategy of the first task based on the total energy consumption and the energy consumption of the first task running on the CPU.
[0195] In some embodiments, the prediction module includes:
[0196] The first prediction unit is used to predict the real-time power consumption of the first task running on the heterogeneous subsystem based on the second execution feature and the pre-trained model parameters corresponding to the heterogeneous subsystem.
[0197] The second prediction unit is used to predict the execution time of the first task on the heterogeneous subsystem based on the feature adaptation parameters.
[0198] The first processing unit is configured to determine the total energy consumption of the first task running on the heterogeneous subsystem based on the real-time power consumption and the execution time.
[0199] In some embodiments, the apparatus further includes:
[0200] The second processing module is used to perform static analysis on the first task to obtain the vectorized score and parallel availability score of the first task.
[0201] The third processing module is used to perform dynamic analysis on the first task to obtain the arithmetic density score and logical suggestion score of the first task.
[0202] The third processing module is used to determine the fit score between the first task and the heterogeneous subsystem based on the vectorization score, the parallel availability score, the arithmetic density score, and the logical suggestion score.
[0203] The feature adaptation parameters of the first task include one or more of the vectorization score, the parallel availability score, the arithmetic density score, the logical suggestion score, and the adaptation score.
[0204] In some embodiments, the first processing module is specifically used for:
[0205] Based on the correction function composed of the feature adaptation parameters and the architecture scaling factor, the first execution feature of the first task on the CPU is equivalently transformed to obtain the second execution feature of the first task on the heterogeneous subsystem; wherein, the architecture scaling factor is the architecture scaling factor between the CPU and the heterogeneous subsystem.
[0206] In some embodiments, the apparatus further includes:
[0207] The pre-training module is used to train linear models for multiple heterogeneous subsystems contained in a system-on-a-chip (SoC) based on sample data, and obtain the pre-trained model parameters of each heterogeneous subsystem at different frequencies.
[0208] In some embodiments, the pre-training module is specifically used for:
[0209] A frequency state space is defined for each heterogeneous subsystem included in the SoC, and the frequency state space corresponding to each heterogeneous subsystem includes at least one frequency.
[0210] For each of the heterogeneous subsystems, activity data of the hardware performance counter (PMC) under different frequency state spaces and power consumption of the heterogeneous subsystems are collected to form sample data.
[0211] Based on the sample data, a correlation analysis was performed to determine the PMC set;
[0212] Model training is performed based on the PMC sample values in the PMC set to obtain a pre-trained linear model and pre-trained model parameters for each heterogeneous subsystem at each frequency.
[0213] In some embodiments, the first prediction unit is specifically used for:
[0214] The second execution feature and the pre-trained model parameters are input into the pre-trained linear model to obtain the real-time power consumption of the first task running on the heterogeneous subsystem.
[0215] The linear model is used to calculate the real-time power consumption of the task running on the heterogeneous subsystem; the pre-trained model parameters include: weight coefficients for static power consumption and PMC sample values.
[0216] In some embodiments, the second prediction unit is specifically used for:
[0217] Predict the speedup ratio of the heterogeneous subsystem based on feature adaptation parameters;
[0218] Based on the execution time of the first task on the CPU, the speedup ratio, and the fixed overhead, the execution time of the first task on the heterogeneous subsystem is predicted, where the fixed overhead is the fixed time consumption value of the first task when running on the heterogeneous subsystem.
[0219] In some embodiments, the scheduling module is specifically used for:
[0220] Based on the total energy consumption and the energy consumption of the first task running on the CPU, determine the energy efficiency improvement ratio of the first task in the heterogeneous subsystem;
[0221] If the energy efficiency improvement ratio is greater than the first threshold, and the execution time of the first task on the heterogeneous subsystem meets the performance service level agreement (SLA) requirements, then it is determined that the first task is migrated to the heterogeneous subsystem for execution.
[0222] If the energy efficiency improvement ratio is less than or equal to the first threshold, and / or the execution time of the first task on the heterogeneous subsystem does not meet the performance SLA requirements, then it is determined that the first task is executed on the CPU.
[0223] The task scheduling device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific implementation.
[0224] The task scheduling device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0225] The task scheduling device provided in this application embodiment can achieve... Figures 1 to 3 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.
[0226] Optionally, such as Figure 5 As shown, this application embodiment also provides an electronic device 500, including a processor 501 and a memory 502. The memory 502 stores a program or instructions that can run on the processor 501. When the program or instructions are executed by the processor 501, they implement the various steps of the above-described task scheduling method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0227] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0228] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0229] The electronic device 600 includes, but is not limited to, components such as: radio frequency unit 601, network module 602, audio output unit 603, input unit 604, sensor 605, display unit 606, user input unit 607, interface unit 608, memory 609, and processor 610.
[0230] Those skilled in the art will understand that the electronic device 600 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 610 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0231] The processor 610 is configured to convert the first execution characteristics of the first task on the central processing unit (CPU) into the second execution characteristics of the first task on the heterogeneous subsystem according to the feature adaptation parameters of the first task; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem.
[0232] Based on the feature adaptation parameters and the second execution feature, predict the total energy consumption of the first task running on the heterogeneous subsystem;
[0233] Based on the total energy consumption and the energy consumption of the first task running on the CPU, a scheduling strategy for the first task is determined.
[0234] In some embodiments, the processor predicts the total energy consumption of the first task running on the heterogeneous subsystem based on the feature adaptation parameters and the second execution feature, including:
[0235] Based on the second execution feature and the pre-trained model parameters corresponding to the heterogeneous subsystem, predict the real-time power consumption of the first task running on the heterogeneous subsystem;
[0236] Based on the feature adaptation parameters, predict the execution time of the first task on the heterogeneous subsystem;
[0237] Based on the real-time power consumption and the execution time, the total energy consumption of the first task running on the heterogeneous subsystem is determined.
[0238] In some embodiments, the processor is further configured to:
[0239] Static and dynamic analyses are performed on the first task to obtain its feature adaptation parameters, including:
[0240] Static analysis is performed on the first task to obtain its vectorized score and parallel availability score.
[0241] The first task is dynamically analyzed to obtain its arithmetic density score and logical suggestion score.
[0242] The adaptation score between the first task and the heterogeneous subsystem is determined based on the vectorization score, the parallel availability score, the arithmetic density score, and the logical suggestion score.
[0243] The feature adaptation parameters of the first task include one or more of the vectorization score, the parallel availability score, the arithmetic density score, the logical suggestion score, and the adaptation score.
[0244] In some embodiments, the processor converts a first execution characteristic of the first task on a central processing unit (CPU) into a second execution characteristic of the first task on a heterogeneous subsystem based on the feature adaptation parameters of the first task, including:
[0245] Based on the correction function composed of the feature adaptation parameters and the architecture scaling factor, the first execution feature of the first task on the CPU is equivalently transformed to obtain the second execution feature of the first task on the heterogeneous subsystem.
[0246] The architecture scaling factor is the architecture scaling factor between the CPU and the heterogeneous subsystem.
[0247] In some embodiments, the processor is further configured to:
[0248] Based on sample data, linear models are trained for multiple heterogeneous subsystems contained in a system-on-a-chip (SoC), and pre-trained model parameters for each heterogeneous subsystem at different frequencies are obtained.
[0249] In some embodiments, the processor trains a linear model based on sample data for multiple heterogeneous subsystems included in a system-on-a-chip (SoC), and obtains pre-trained model parameters for each heterogeneous subsystem at different frequencies, including:
[0250] A frequency state space is defined for each heterogeneous subsystem included in the SoC, and the frequency state space corresponding to each heterogeneous subsystem includes at least one frequency.
[0251] For each of the heterogeneous subsystems, activity data of the hardware performance counter (PMC) under different frequency state spaces and power consumption of the heterogeneous subsystems are collected to form sample data.
[0252] Based on the sample data, a correlation analysis was performed to determine the PMC set;
[0253] Model training is performed based on the PMC sample values in the PMC set to obtain a pre-trained linear model and pre-trained model parameters for each heterogeneous subsystem at each frequency.
[0254] In some embodiments, the processor predicts the real-time power consumption of the first task running on the heterogeneous subsystem based on the second execution characteristics and the pre-trained model parameters corresponding to the heterogeneous subsystem, including:
[0255] The second execution feature and the pre-trained model parameters are input into the pre-trained linear model to obtain the real-time power consumption of the first task running on the heterogeneous subsystem.
[0256] The linear model is used to calculate the real-time power consumption of the task running on the heterogeneous subsystem; the pre-trained model parameters include: weight coefficients for static power consumption and PMC sample values.
[0257] In some embodiments, the processor predicts the execution time of the first task on the heterogeneous subsystem based on the feature adaptation parameters, including:
[0258] Predict the speedup ratio of the heterogeneous subsystem based on the feature adaptation parameters;
[0259] Based on the execution time of the first task on the CPU, the speedup ratio, and the fixed overhead, the execution time of the first task on the heterogeneous subsystem is predicted, where the fixed overhead is the fixed time consumption value of the first task when running on the heterogeneous subsystem.
[0260] In some embodiments, the processor determines a scheduling policy for the first task based on the total energy consumption and the energy consumption of the first task running on the CPU, including:
[0261] Based on the total energy consumption and the energy consumption of the first task running on the CPU, determine the energy efficiency improvement ratio of the first task in the heterogeneous subsystem;
[0262] If the energy efficiency improvement ratio is greater than the first threshold, and the execution time of the first task on the heterogeneous subsystem meets the performance service level agreement (SLA) requirements, then it is determined that the first task is migrated to the heterogeneous subsystem for execution.
[0263] If the energy efficiency improvement ratio is less than or equal to the first threshold, and / or the execution time of the first task on the heterogeneous subsystem does not meet the performance SLA requirements, then it is determined that the first task is executed on the CPU.
[0264] In embodiments of this application, the execution characteristics of a first task on the CPU are converted into execution characteristics on a heterogeneous subsystem to be evaluated based on feature adaptation parameters. These execution characteristics are then used to predict the total energy consumption of the first task on the heterogeneous subsystem. Based on the total energy consumption and the energy consumption of the first task on the CPU, a scheduling strategy for the first task is determined. This scheme enables the system scheduler to make forward-looking judgments during the execution of the first task, determining the optimal adjustment strategy based on the task's compatibility with the heterogeneous subsystem and its energy consumption. For example, it can automatically distribute highly compatible tasks to the heterogeneous subsystem and retain less compatible tasks on the CPU, thereby achieving full SoC-level energy consumption optimization while ensuring system smoothness.
[0265] It should be understood that, in this embodiment, the input unit 604 may include a graphics processing unit (GPU) 6041 and a microphone 6042. The GPU 6041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 607 includes at least one of a touch panel 6071 and other input devices 6072. The touch panel 6071 is also called a touch screen. The touch panel 6071 may include a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0266] The memory 609 can be used to store software programs and various data. The memory 609 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 609 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 609 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0267] Processor 610 may include one or more processing units; optionally, processor 610 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 610.
[0268] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described task scheduling method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0269] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0270] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described task scheduling method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0271] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0272] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the task scheduling method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0273] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0274] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better 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 computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0275] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A task scheduling method, characterized by, include: Based on the feature adaptation parameters of the first task, the first execution characteristics of the first task on the central processing unit (CPU) are converted into the second execution characteristics of the first task on the heterogeneous subsystem; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem. Based on the feature adaptation parameters and the second execution feature, predict the total energy consumption of the first task running on the heterogeneous subsystem; Based on the total energy consumption and the energy consumption of the first task running on the CPU, a scheduling strategy for the first task is determined.
2. The method of claim 1, wherein, The step of predicting the total energy consumption of the first task running on the heterogeneous subsystem based on the feature adaptation parameters and the second execution feature includes: Based on the second execution feature and the pre-trained model parameters corresponding to the heterogeneous subsystem, predict the real-time power consumption of the first task running on the heterogeneous subsystem; Based on the feature adaptation parameters, predict the execution time of the first task on the heterogeneous subsystem; Based on the real-time power consumption and the execution time, the total energy consumption of the first task running on the heterogeneous subsystem is determined.
3. The method according to claim 1, characterized in that, Before converting the first execution characteristics of the first task on the central processing unit (CPU) into the second execution characteristics of the first task on the heterogeneous subsystem according to the feature adaptation parameters of the first task, the method further includes: Static analysis is performed on the first task to obtain its vectorized score and parallel availability score. The first task is dynamically analyzed to obtain its arithmetic density score and logical suggestion score. The adaptation score between the first task and the heterogeneous subsystem is determined based on the vectorization score, the parallel availability score, the arithmetic density score, and the logical suggestion score. The feature adaptation parameters of the first task include one or more of the vectorization score, the parallel availability score, the arithmetic density score, the logical suggestion score, and the adaptation score.
4. The method according to claim 1, characterized in that, The step of converting the first execution characteristics of the first task on the central processing unit (CPU) into the second execution characteristics of the first task on the heterogeneous subsystem according to the feature adaptation parameters of the first task includes: Based on the correction function composed of the feature adaptation parameters and the architecture scaling factor, the first execution feature of the first task on the CPU is equivalently transformed to obtain the second execution feature of the first task on the heterogeneous subsystem. The architecture scaling factor is the architecture scaling factor between the CPU and the heterogeneous subsystem.
5. The method according to claim 2, characterized in that, The method further includes: Based on sample data, linear models are trained for multiple heterogeneous subsystems contained in a system-on-a-chip (SoC) to obtain pre-trained model parameters for each heterogeneous subsystem at different frequencies.
6. The method according to claim 5, characterized in that, The process involves training linear models based on sample data for multiple heterogeneous subsystems contained in a System-on-a-Chip (SoC), obtaining pre-trained model parameters for each heterogeneous subsystem at different frequencies, including: A frequency state space is defined for each heterogeneous subsystem included in the SoC, and the frequency state space corresponding to each heterogeneous subsystem includes at least one frequency. For each of the heterogeneous subsystems, activity data of the hardware performance counter (PMC) under different frequency state spaces and power consumption of the heterogeneous subsystems are collected to form sample data. Based on the sample data, a correlation analysis was performed to determine the PMC set; Model training is performed based on the PMC sample values in the PMC set to obtain a pre-trained linear model and pre-trained model parameters for each heterogeneous subsystem at each frequency.
7. The method according to claim 2 or 6, characterized in that, The step of predicting the real-time power consumption of the first task running on the heterogeneous subsystem based on the second execution feature and the pre-trained model parameters corresponding to the heterogeneous subsystem includes: The second execution feature and the pre-trained model parameters are input into the pre-trained linear model to obtain the real-time power consumption of the first task running on the heterogeneous subsystem. The linear model is used to calculate the real-time power consumption of the task running on the heterogeneous subsystem; the pre-trained model parameters include: weight coefficients for static power consumption and PMC sample values.
8. The method according to claim 2, characterized in that, The step of predicting the execution time of the first task on the heterogeneous subsystem based on the feature adaptation parameters includes: Predict the speedup ratio of the heterogeneous subsystem based on the feature adaptation parameters; Based on the execution time of the first task on the CPU, the speedup ratio, and the fixed overhead, the execution time of the first task on the heterogeneous subsystem is predicted, where the fixed overhead is the fixed time consumption value of the first task when running on the heterogeneous subsystem.
9. The method according to any one of claims 1 to 8, characterized in that, Based on the total energy consumption and the energy consumption of the first task running on the CPU, a scheduling strategy for the first task is determined, including: Based on the total energy consumption and the energy consumption of the first task running on the CPU, determine the energy efficiency improvement ratio of the first task in the heterogeneous subsystem; If the energy efficiency improvement ratio is greater than the first threshold, and the execution time of the first task on the heterogeneous subsystem meets the performance service level agreement (SLA) requirements, then it is determined that the first task is migrated to the heterogeneous subsystem for execution. If the energy efficiency improvement ratio is less than or equal to the first threshold, and / or the execution time of the first task on the heterogeneous subsystem does not meet the performance SLA requirements, then it is determined that the first task is executed on the CPU.
10. A task scheduling device, characterized in that, include: The first processing module is configured to convert the first execution characteristics of the first task on the central processing unit (CPU) into the second execution characteristics of the first task on the heterogeneous subsystem based on the feature adaptation parameters of the first task; the feature adaptation parameters are used to characterize the compatibility between the first task and the heterogeneous subsystem. The prediction module is used to predict the total energy consumption of the first task running on the heterogeneous subsystem based on the feature adaptation parameters and the second execution feature. The scheduling module is used to determine the scheduling strategy for the first task based on the total energy consumption and the energy consumption of the first task running on the CPU.
11. The apparatus according to claim 10, characterized in that, The prediction module includes: The first prediction unit is used to predict the real-time power consumption of the first task running on the heterogeneous subsystem based on the second execution feature and the pre-trained model parameters corresponding to the heterogeneous subsystem. The second prediction unit is used to predict the execution time of the first task on the heterogeneous subsystem based on the feature adaptation parameters. The first processing unit is configured to determine the total energy consumption of the first task running on the heterogeneous subsystem based on the real-time power consumption and the execution time.
12. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the task scheduling method as described in any one of claims 1 to 9.
13. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the task scheduling method as described in any one of claims 1 to 9.
