Method, device and equipment for scheduling NPU (Network Processing Unit) computing tasks of multimode SoC (System on Chip) main control chip
By extracting the task feature parameters and resource state matrix of NPU computing tasks, building a Q-learning task optimization model and Pareto multi-objective optimization algorithm, the problems of unbalanced computing resource utilization and large task delay in traditional scheduling methods are solved, and more efficient task scheduling and resource management are achieved.
Patent Information
- Application Number
- CN202510217350.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-26
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-26
AI Technical Summary
Traditional NPU computing task scheduling methods are difficult to effectively deal with dynamically changing computing loads, resulting in unbalanced computing resource utilization and large task execution delays. Especially in the scenario where multiple computing modes coexist, there are problems of time overlap and resource competition.
By extracting the task feature parameters of the NPU calculation task, generating task descriptors, and establishing an initial scheduling timing table; computing resource partitioning and obtaining resource state matrix; calculating task overlap based on the initial scheduling timing table and resource state matrix, building a Q-learning task optimization model; performing two-layer grouping and sorting tasks, generating task allocation sequences; performing resource load calculations, generating migration cost matrix, and performing task reassignment; input task reassignment results into the Pareto multi-objective optimization algorithm to generate global execution timing, and perform task scheduling.
It achieves a balance between task execution delay and resource utilization, ensures the overall optimization of the scheduling scheme, improves the system's response ability and processing efficiency to burst tasks, reduces the additional overhead of task migration, and optimizes the system's energy efficiency.
Smart Images

Figure CN119718590A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of task scheduling, and in particular to a method, device and equipment for scheduling NPU computing tasks of a multi-mode SoC master chip. Background Art
[0002] With the rapid development of artificial intelligence technology, the number of NPU computing units integrated in multi-mode SoC main control chips is increasing, and the types of computing tasks are becoming more complex and diverse. In practical applications, NPU needs to handle periodic computing tasks and burst computing tasks at the same time, which puts higher requirements on the scheduling and management of computing resources.
[0003] Traditional NPU computing task scheduling methods mainly use static scheduling strategies, which cannot effectively cope with dynamically changing computing loads, resulting in uneven computing resource utilization and large task execution delays. Especially in scenarios where multiple computing modes coexist, there are time overlaps and resource competition problems between NPU computing tasks in different modes. Traditional scheduling methods are difficult to achieve reasonable allocation of computing resources while ensuring task execution efficiency. Summary of the invention
[0004] The main purpose of the present invention is to provide a method, device and equipment for scheduling NPU computing tasks of a multi-mode SoC main control chip. The present invention achieves a balance between task execution delay and resource utilization, ensures the overall optimality of the scheduling scheme, and improves the system's responsiveness and processing efficiency to sudden tasks.
[0005] To achieve the above object, the present invention provides a method for scheduling NPU computing tasks of a multi-mode SoC master chip, comprising the following steps: Extracting task characteristic parameters of the NPU computing task in the multi-mode SoC main control chip, generating a task descriptor according to the task characteristic parameters, and establishing an initial scheduling timing table based on the task descriptor; The NPU computing unit is partitioned into computing resource partitions to obtain a plurality of computing resource partitions, and performance parameters of each computing resource partition are obtained, and a resource status matrix is established according to the performance parameters; Calculating task overlap based on the initial scheduling time sequence table and the resource status matrix, generating an overlapping time sequence matrix, and constructing a Q-learning task optimization model according to the overlapping time sequence matrix; Performing double-layer grouping and sorting of NPU computing tasks according to the Q-learning task optimization model, and generating a task allocation sequence based on the resource status matrix; Performing resource load calculation on the NPU computing tasks in the task allocation sequence, generating a migration cost matrix, and performing task reallocation according to the migration cost matrix to obtain a task reallocation result; The task reallocation result is input into the Pareto multi-objective optimization algorithm to generate a global execution timing of the NPU computing task, and the NPU computing task is scheduled according to the global execution timing, and task scheduling execution information is output.
[0006] The present invention also provides an NPU computing task scheduling device for a multi-mode SoC main control chip, comprising: An extraction module is used to extract task characteristic parameters of the NPU computing task in the multi-mode SoC main control chip, generate a task descriptor according to the task characteristic parameters, and establish an initial scheduling timing table based on the task descriptor; A partitioning module is used to partition the computing resources of the NPU computing unit to obtain multiple computing resource partitions, obtain performance parameters of each computing resource partition, and establish a resource status matrix according to the performance parameters; A calculation module, used to calculate the task overlap based on the initial scheduling time sequence table and the resource status matrix, generate an overlapping time sequence matrix, and construct a Q-learning task optimization model according to the overlapping time sequence matrix; A sorting module, used to perform double-layer grouping sorting on the NPU computing tasks according to the Q-learning task optimization model, and generate a task allocation sequence based on the resource status matrix; A reallocation module, used to calculate the resource load of the NPU computing tasks in the task allocation sequence, generate a migration cost matrix, and perform task reallocation according to the migration cost matrix to obtain a task reallocation result; The output module is used to input the task reallocation result into the Pareto multi-objective optimization algorithm, generate the global execution timing of the NPU computing task, schedule the NPU computing task according to the global execution timing, and output the task scheduling execution information.
[0007] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0008] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0009] In summary, the technical solution provided by the present invention realizes the classification processing of periodic tasks and burst tasks by constructing a two-layer group scheduling mechanism, effectively reduces task scheduling conflicts, and improves the utilization efficiency of computing resources. The Q-learning task optimization model is used to dynamically evaluate the task overlap, accurately grasp the task execution characteristics, avoid resource allocation conflicts, and reduce task queuing delays. The migration cost matrix is introduced to make task reallocation decisions, comprehensively consider time overhead and energy consumption factors, reduce the additional overhead of task migration, and optimize system energy efficiency. Based on the Pareto multi-objective optimization algorithm, the global execution timing is generated, and a balance is achieved between task execution delay and resource utilization, ensuring the overall optimality of the scheduling scheme. The task feature parameter extraction and resource status matrix construction method are designed to realize real-time perception of NPU computing tasks and resource status. Through resource partitioning and dynamic integration strategies, flexible allocation of computing resources is realized, and the system's responsiveness and processing efficiency to burst tasks are improved. A complete task scheduling execution information feedback mechanism is established to support real-time optimization and adjustment of scheduling strategies, and enhance the adaptability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a schematic diagram of the steps of a method for scheduling NPU computing tasks of a multi-mode SoC master chip in one embodiment of the present invention; Figure 2 It is a structural block diagram of an NPU computing task scheduling device of a multi-mode SoC master chip in one embodiment of the present invention; Figure 3 It is a schematic block diagram of the structure of a computer device according to an embodiment of the present invention.
[0011] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0012] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0013] Reference Figure 1 This embodiment provides a method for scheduling NPU computing tasks of a multi-mode SoC master chip, including the following steps: S1, extracting the task characteristic parameters of the NPU computing task in the multi-mode SoC main control chip, generating a task descriptor according to the task characteristic parameters, and establishing an initial scheduling timing table based on the task descriptor; Among them, by collecting features of the NPU computing tasks in the chip, the task feature data such as the execution time, computing resource requirements, task priority, computing mode type, data dependency and task periodicity of each task are obtained. The execution time and resource requirements in the task feature data are numerically standardized to eliminate the differences in different feature dimensions, so that all feature data can be within the same standardized range, which is convenient for subsequent comparison and analysis, and a standardized feature vector is obtained. The standardized feature vector is combined with the priority value of the task for multi-dimensional feature fusion to obtain the task feature parameters. The task feature parameters are input into the feature mapping module for mapping to obtain a task descriptor. The task descriptor is a concentration of task information, including a task identifier, a computing mode identifier, a resource requirement vector, a task priority value, an expected execution time, and a dependency matrix between tasks. The dependency matrix between tasks can accurately describe the execution order relationship between tasks, ensuring that there will be no task conflict and resource competition during the scheduling process. The NPU computing tasks are classified according to the computing mode identifier in the task descriptor. The NPU computing tasks of the multi-mode SoC chip have different computing modes, such as serial mode, parallel mode or hybrid mode. By classifying the computing modes, a more accurate basis is provided for subsequent scheduling. After the mode classification is completed, the tasks in each mode classification are sorted according to the priority value of the task to obtain the priority sequence of task execution. The time trigger window is calculated based on the task execution priority sequence and the dependency matrix between tasks. A suitable time period is allocated to each task to ensure that the task can be executed on time under the premise of satisfying the dependency. When calculating the time trigger window, the periodicity of the task and the dependency between tasks are considered. The earliest start time and end time of each task are calculated through the scheduling algorithm, and the time resources are reasonably allocated to obtain a time allocation plan including the task start time point and end time point. This plan can effectively prevent time conflicts and resource competition between tasks, while ensuring that tasks can be executed at the scheduled time. The time allocation plan is scheduled and mapped with the task computing resource demand vector to obtain the initial scheduling time sequence table containing the time trigger window and computing resource allocation information of each task.
[0014] S2, partitioning the computing resources of the NPU computing unit to obtain multiple computing resource partitions, and obtaining performance parameters of each computing resource partition, and establishing a resource status matrix according to the performance parameters; Specifically, the resource statistics and analysis of the NPU computing unit are performed to obtain the computing resource pool data, which includes the number of computing units, the computing power of each computing unit, and the memory bandwidth. The computing power includes the number of floating-point operations that each computing unit can process per second, and the memory bandwidth represents the data transmission speed and bandwidth size. Based on the computing resource pool data, the NPU computing unit is partitioned. The computing resources of the NPU are divided into several partitions to achieve independent resource management of different computing tasks. The preliminary partitioning scheme is roughly divided according to factors such as the number of computing units and computing power. The initial partitioning scheme is verified and calculated for balance to ensure that the load of each computing resource partition can be as balanced as possible, and some partition resources will not be overloaded while other partitions are idle. Through the balance verification, the processing power distribution diagram of the computing resource partition is obtained to show the resource allocation and computing power distribution of each partition. The performance parameters of each computing resource partition are collected to obtain the partition performance data including the number of computing units, peak computing performance and memory bandwidth. These performance data can help the scheduling algorithm evaluate the potential and limitations of each computing resource partition, clarify the actual computing power and bandwidth of each partition, and ensure that tasks can be reasonably scheduled according to the resource status of the partition. The load rate is calculated for the partition performance data. The load rate is an important indicator for evaluating the current usage of each computing resource partition, which is represented by the ratio between the actual load and the maximum load. If the load rate of a partition is too high, it means that the partition is close to saturation and can no longer process more tasks; conversely, a partition with a low load rate means that its resources are still available and suitable for receiving more computing tasks. Through the load rate calculation, the current load status of each computing resource partition is obtained. Based on the load status of each computing resource partition, the remaining computing power is calculated to quantify the computing power that is not currently occupied by each computing resource partition. The remaining computing power value reflects the available processing power of each partition, helping the scheduling algorithm decide which tasks can be assigned to which partitions, and avoiding assigning tasks to resource partitions that are close to saturation, thereby reducing task execution delays and resource conflicts. According to the remaining computing power value of each computing resource partition, the task queue length is analyzed to determine how many new tasks each partition can currently receive. The longer the queue length, the more tasks the partition receives. It is necessary to consider whether to increase resources or migrate tasks to other partitions. The determination of the task acceptance threshold needs to consider not only the remaining computing power of the partition, but also the current task queue length. By analyzing the task queue length, the task acceptance threshold of each computing resource partition is obtained. The task acceptance threshold is integrated with the current load status to obtain the resource status matrix, which contains key information such as the load rate, remaining computing power, and task queue length of each computing resource partition.
[0015] S3, calculates the task overlap based on the initial scheduling time table and the resource status matrix, generates an overlapping time matrix, and builds a Q-learning task optimization model based on the overlapping time matrix; It should be noted that the time interval analysis is performed on the task time trigger window in the initial scheduling time sequence table, and the start and end time of each task is extracted to obtain a set of all task time intervals. The time interval of the task represents the execution cycle of each task and defines the time window required by the task on the resource. By analyzing the time interval set, the time overlap of any two NPU computing tasks is calculated to obtain the task pair overlap duration matrix, and the time overlap duration between each pair of tasks is recorded. The task overlap score is calculated based on the load rate data in the task pair overlap duration matrix and the resource status matrix. The load rate reflects the current usage of each computing resource partition. Therefore, whether the task can be successfully executed during the overlap period also needs to consider the actual load of the resource. The goal of the overlap score calculation is to evaluate the availability of system resources and the possibility of resource conflicts during the task overlap period, so as to provide a reasonable decision-making basis for the scheduling of tasks. Through the overlap score calculation, an overlap score vector is obtained, which contains the score of each pair of tasks during the overlap period. The overlap score vector is sorted by time interval, and the task pairs with higher scores are given priority to obtain an overlap timing matrix containing overlapping task identifiers and overlapping timing information. This matrix shows the time overlap between tasks and reflects the competition relationship between different tasks on system resources. Based on the overlapping timing matrix, the state space of the Q-learning task optimization model is constructed. The Q-learning algorithm optimizes the decision-making strategy according to the state and action of the environment. The state space consists of task state features and resource state features. Task state features include task priority, resource requirements, computing mode, etc., while resource state features include the load rate, remaining computing power, and available memory bandwidth of each computing resource partition. By fusing these features, a state vector is obtained, which represents the overall state of the current system. The action space is constructed based on the state vector. The action space contains task scheduling actions and resource allocation actions. Task scheduling actions refer to how to arrange the execution order and scheduling priority of tasks within a given time window; resource allocation actions refer to how to reasonably allocate computing resources to each task based on the resource requirements of the tasks and the remaining capacity of the resources. The choice of these actions directly affects the delay of task execution, the utilization efficiency of resources, and the overall performance of the system. Design the Q-value update function based on the action set. The Q-value update function is the core of the Q-learning algorithm, which adjusts the task scheduling strategy by evaluating rewards and penalties. The reward function mainly considers the delay of task execution and resource utilization. The delay penalty means that the longer the task execution time, the greater the penalty; while the resource utilization reward means that the more effectively the task can use computing resources, the higher the overall reward of the system. By comprehensively evaluating the penalty of task delay and the reward of resource utilization during task scheduling, the scheduling strategy is effectively guided to the optimal state. The state vector, action set and reward function are combined to construct a Q-learning task optimization model.The goal of this model is to learn how to select the optimal task scheduling and resource allocation actions based on the current state of the system through the Q-learning algorithm, thereby maximizing the performance of the system. In this process, the Q-learning model continuously obtains feedback from the environment, updates the Q value, optimizes the scheduling strategy, and finally outputs a task stacking plan that indicates the execution order and required resources of each task in the system.
[0016] S4, performs double-layer grouping and sorting of NPU computing tasks according to the Q-learning task optimization model, and generates a task allocation sequence based on the resource status matrix; Specifically, periodic computing tasks are extracted from the Q-learning model. These tasks have fixed periods and predictable execution times, and have high certainty when scheduling. By extracting these periodic tasks, a first-layer periodic task set is formed. Based on the load rate data in the resource status matrix, the periodic task set is statically partitioned. Static partition allocation means that the resource requirements of periodic tasks have been predetermined, and these tasks can be reasonably allocated according to the load rate of each computing resource partition. The load rate reflects the current resource usage of each partition. The partition with a lower load rate is preferentially allocated to periodic tasks to achieve effective resource utilization. Through this process, an allocation plan for periodic tasks is generated to ensure that periodic tasks can be reasonably scheduled on appropriate computing resources to avoid excessive resource competition. For the second-layer tasks, namely burst tasks, their characteristics are unpredictable execution time, large fluctuations in resource demand, and they may appear at any time, requiring flexible scheduling strategies. In the Q-learning model, the characteristics of burst tasks are extracted through the state vector to form a second-layer burst task set. According to the characteristics of these tasks, dynamic partition calculation is performed according to the remaining computing power data in the resource status matrix. The remaining computing power represents the unoccupied processing capacity in the computing resource partition, which is the key to determine whether new burst tasks can be received. Through dynamic partition calculation, candidate partitions for burst tasks are obtained. The selection of candidate partitions for burst tasks depends on the remaining computing power of the partition and the availability of computing resources. Partitions with high remaining computing power and sufficient resources are preferred to effectively process burst tasks. Task compatibility analysis is performed based on candidate partitions for burst tasks and periodic task allocation schemes to determine the conflicts and competitions between periodic tasks and burst tasks in resource allocation. The execution time of periodic tasks is fixed, while burst tasks may appear at any time, leading to resource competition. Through compatibility analysis, the task resource competition matrix is obtained, which reflects the intensity of competition for resources between different tasks. This matrix helps the scheduling algorithm evaluate which tasks can share resources in the same time window and which tasks need to be allocated to different computing resource partitions to avoid resource conflicts and task delays. Based on the task resource competition matrix, partition selection calculation is performed for burst tasks. According to the resource requirements of the task, the remaining computing power of the candidate partitions, and the resource competition, the most suitable computing resource partition is selected to execute the burst task. The result of partition selection forms the allocation scheme for burst tasks. The periodic task allocation scheme and the burst task allocation scheme are merged to obtain a complete task grouping scheme. During the merging process, the tasks are scheduled according to factors such as task priority, resource requirements, and time windows to ensure that all tasks can be executed smoothly on the same timeline and avoid resource conflicts or scheduling delays. The time window allocation calculation is performed for the complete task grouping scheme.According to the priority and resource requirements of the task, an appropriate execution time is allocated to each task to ensure that all tasks are executed within their specified time windows and that the execution order between tasks meets the scheduling requirements. After the time window allocation is completed, an execution time sequence is generated for each task. Computing resources are allocated based on the generated execution time sequence. Resource allocation needs to consider factors such as the computing power requirements, memory bandwidth requirements, and execution time of each task to achieve optimal resource utilization. The resource occupancy plan of the task is serialized with the execution time sequence to obtain the task allocation sequence, which clarifies the execution order, resource allocation, and execution time of each task.
[0017] S5, calculating the resource load of the NPU computing tasks in the task allocation sequence, generating a migration cost matrix, and performing task reallocation according to the migration cost matrix to obtain a task reallocation result; Among them, the load statistics analysis is performed on the NPU computing tasks in the task allocation sequence, the task load currently undertaken by each computing resource partition is evaluated, and the task load distribution data of each computing resource partition is obtained. Based on the task load distribution data, the load balance degree of the computing resource partition is calculated to measure whether the load of each partition is balanced. If the task load of some partitions is much higher than that of other partitions, it will lead to excessive resource consumption and task delay. The load balance degree calculation can help identify resource partitions with unbalanced loads, so as to determine which partitions need to migrate tasks to achieve the purpose of load balancing. The migration time cost is calculated for the tasks in the unbalanced partitions. The migration time cost calculation refers to calculating the time required to migrate a task from one computing resource partition to another. This process needs to consider factors such as the size of the task, the bandwidth and delay of the task migration. The migration time cost of each task is the time cost required for its process from the source partition to the target partition. The migration cost of each task is quantified by calculating the migration time cost vector. Based on factors such as the computing resources consumed by task migration, the amount of data transmission, and the network bandwidth, the task migration energy consumption is calculated according to the task migration time cost vector. By calculating the migration energy consumption of the task, the task migration energy consumption cost vector is obtained, which reflects the energy consumed by each task during the migration process. The task migration time cost vector and the task migration energy consumption cost vector are fused to obtain the migration cost matrix to evaluate the cost of task migration. Based on the migration cost matrix, the target partition for task migration is selected for the resource partition whose load rate is lower than the preset threshold. During the task migration process, multiple factors need to be considered when selecting the target partition, including the remaining computing power, load rate, time and energy consumption of the target partition. Partitions with lower load rates are more suitable for receiving migrated tasks. By analyzing the migration cost matrix, the most suitable target partition for task migration is determined, and the task migration plan is obtained. The task migration plan includes the target partition for each task migration and its migration related parameters. The NPU computing tasks are reallocated based on the task migration plan. Tasks are reallocated to computing resource partitions according to the migration plan, so that the task load is balanced and performance bottlenecks caused by overload in some partitions are avoided. The updated task allocation plan is obtained, which reflects the latest matching relationship between tasks and resource partitions. Resources are reorganized for the updated task allocation plan to obtain a task reallocation result containing task migration information and resource allocation information. The purpose of resource reorganization is to optimize the overall use of computing resources, ensure that the resources of each computing resource partition are configured in the most reasonable way, and ensure that tasks can be executed smoothly under the new allocation scheme. The reallocation results include the task migration path, migration time and migration energy consumption, as well as the new task allocation method and resource configuration.
[0018] S6, input the task reallocation result into the Pareto multi-objective optimization algorithm, generate the global execution timing of the NPU computing task, schedule the NPU computing task according to the global execution timing, and output the task scheduling execution information.
[0019] Specifically, the time cost analysis of the task execution delay in the task reallocation result is performed to evaluate the delay of each task in its new execution path. Through the comprehensive analysis of the task execution delay, an optimal task execution order is sought to shorten the overall execution time of the task as much as possible, and the delay minimization objective function is obtained. At the same time, the utilization rate of the computing resource allocation in the task reallocation result is calculated. By analyzing the usage of each computing resource partition, the utilization efficiency of computing resources is maximized to obtain the resource utilization maximization objective function. The delay minimization objective function and the resource utilization maximization objective function are combined to form a multi-objective space. In the multi-objective space, the two objective functions represent the key factors that need to be balanced in task scheduling: on the one hand, the task execution delay, and on the other hand, the utilization efficiency of computing resources. In the process of multi-objective optimization, the potential conflict between the two objectives is handled. In the multi-objective space, a reasonable compromise is made according to the actual needs of the task and the current state of the resources to obtain an optimal solution space with constraints. The multi-objective constraint space is searched for non-dominated solutions. In multi-objective optimization, a solution that is not superior to other solutions in all objectives is sought. These solutions are Pareto optimal solutions, representing the optimal task execution timing and resource allocation strategy under a given goal. Through non-dominated solution search and calculation, a Pareto optimal solution set containing multiple sets of task execution timing and resource allocation strategies is obtained. Each set of solutions corresponds to a different task execution order and resource allocation plan. Dependency verification is performed based on the task execution timing in the Pareto optimal solution set. There are certain dependencies between tasks, for example, some tasks must be executed only after other tasks are completed. The process of dependency verification is to ensure that all task dependencies are met when tasks are executed. The result of dependency verification is an execution timing subset that meets the task dependency constraints. These subsets represent the execution order that meets the dependency requirements between tasks and can ensure that there will be no deadlock or resource conflict during task scheduling. Based on the execution timing subset after dependency verification, the computing resources are allocated and verified. Confirm that each task can obtain the required computing resources within the specified time, and check whether the resources will be overloaded and whether there is a risk of overload. After verification, a global execution timing solution that meets the resource constraints is obtained. Convert the global execution timing plan into an execution instruction sequence for the NPU computing task. The execution instruction contains information such as the start time, end time, required resources, and execution order of each task. Issue the task scheduling instruction set to partition tasks. Allocate the execution instructions of each task according to the division of computing resource partitions, and generate execution instruction sequences for each computing resource partition. Distribute all execution instruction sequences to the corresponding computing resource partitions for execution processing. When each computing resource partition executes its task, it records and feedbacks information such as the status of task execution, computing performance, and resource utilization.
[0020] In one example, task characteristic parameters of NPU computing tasks in a multi-mode SoC main control chip are extracted, a task descriptor is generated according to the task characteristic parameters, and an initial scheduling timing table is established based on the task descriptor, including: Collect features of NPU computing tasks in multi-mode SoC master chips to obtain task feature data including task execution time, computing resource requirements, task priority value, computing mode type, data dependency, and task periodicity; Perform numerical normalization on the execution time and resource requirements in the task feature data to obtain a standardized feature vector, and perform multi-dimensional feature fusion on the standardized feature vector and the priority value in the task feature data to obtain the task feature parameters; Input the task feature parameters into the feature mapping module for mapping, and obtain a task descriptor including a task identifier, a computing mode identifier, a resource requirement vector, a task priority value, an expected execution time, and a dependency matrix between tasks; Classify the NPU computing tasks according to the computing mode identifier in the task descriptor to obtain a mode classification set, and sort the tasks in the mode classification set according to the task priority value to obtain a task execution priority sequence; The time trigger window is calculated according to the task execution priority sequence and the dependency matrix between tasks to obtain a time allocation plan including the task start time point and end time point; The time allocation scheme is mapped with the task computing resource demand vector to obtain an initial scheduling time sequence table including the time trigger window and computing resource allocation information of each task.
[0021] In this example, feature collection is performed on the NPU computing tasks to extract the specific requirements and resource requirements of each task during execution. Task feature data includes task execution time, computing resource requirements, task priority value, computing mode type, data dependencies, and task periodicity. These features can comprehensively reflect the behavioral characteristics of tasks when they are running in the system. Through task feature data, the system can understand the computational complexity, execution time requirements, and resource requirements of tasks. The execution time and computing resource requirements in the task feature data are numerically normalized to make the features of different tasks comparable in value and to avoid some features affecting the overall calculation due to too large or too small a value range. The standardization process uses the minimum-maximum standardization or Z-score standardization method. Assume that the task The execution time is , the computing resource requirement is , then the standardized eigenvalue and Use the following formula to calculate: ; ; in, and are the minimum and maximum execution times of all tasks, respectively. and are the minimum and maximum resource requirements of all tasks, respectively. Through standardization, the execution time and the characteristic values of computing resource requirements of all tasks are ensured to be within the same dimensional range, avoiding the influence of too large numerical range on scheduling calculation. Multi-dimensional feature fusion is performed on the standardized feature vector and the priority value in the task feature data. The priority value of the task is used to determine the priority order of the task during scheduling, and the values are high, medium, low, etc., and are given numerical representation. Assume that the priority of the task is , the standardized feature vector and the priority value are fused into a comprehensive task feature vector by weighted averaging , the calculation formula is as follows: ; in, represents the normalized execution time vector of the task, represents the normalized resource requirement vector of the task, is the priority value of the task, , and is the weight coefficient of each feature, which reflects the importance of different task features in task scheduling. Through multi-dimensional feature fusion, the comprehensive features of the task are represented as a vector, which can fully reflect the various behavioral characteristics of the task and facilitate subsequent scheduling decisions. The task feature parameters are input into the feature mapping module for mapping to obtain the task descriptor. The task descriptor includes the task identifier, as well as the computing mode identifier, resource requirement vector, task priority value, expected execution time, and the dependency matrix between tasks. Based on the computing mode identifier in the task descriptor, the NPU computing task is classified into patterns. Tasks are classified according to the computing mode so that the most appropriate computing resources can be selected for each type of task. For example, tasks are divided into two categories: processing-intensive tasks and data-intensive tasks. The former requires more computing resources, while the latter has higher requirements for memory bandwidth. After the tasks are classified, the tasks in the pattern classification set are sorted according to the priority of the tasks to obtain the priority sequence of task execution. According to the task execution priority sequence and the dependency matrix between tasks, the time trigger window calculation is performed. The start and end time points of each task are determined according to the priority and dependency of the task. Assume that the task The dependency is Dep ,Task The start time is , the end time is , then the time allocation scheme is calculated by the following formula: ; ; in, Indicates the task The start time point, Indicates the end time point. For the task The standardized execution time is calculated. A time window is assigned to each task to ensure that the tasks are executed in a reasonable order and time schedule. The time allocation scheme is mapped with the task computing resource demand vector to obtain the initial scheduling time table containing the time trigger window and computing resource allocation information of each task. Assume that the task The resource demand vector is , then the resource allocation of the task is mapped as follows: ; in, It is a scheduling mapping function that calculates the computing resource allocation required for the task according to the task's resource requirements and time window. The initial scheduling time table lists the start time, end time, resource requirements and allocation of all tasks, providing a detailed execution plan for subsequent scheduling execution.
[0022] In one example, the NPU computing unit is partitioned into computing resource partitions to obtain multiple computing resource partitions, and performance parameters of each computing resource partition are obtained. A resource state matrix is established according to the performance parameters, including: Perform resource statistics analysis on NPU computing units to obtain computing resource pool data including the number of computing units, computing power, and memory bandwidth; Based on the computing resource pool data, NPU computing units are partitioned and calculated to obtain initial partitioning schemes of multiple computing resource partitions. The initial partitioning schemes of the computing resource partitions are verified and calculated for balance to obtain a processing capacity distribution diagram of the computing resource partitions. According to the processing capacity distribution diagram of the computing resource partition, the performance parameters of each computing resource partition are collected to obtain the partition performance data including the number of computing units, peak computing performance and memory bandwidth; Calculate the load rate of the partition performance data to obtain the current load status of each computing resource partition, and calculate the remaining computing power of each computing resource partition based on the current load status to obtain the remaining computing capacity value of the computing resource partition; The task queue length is analyzed according to the remaining computing capacity value of the computing resource partition to obtain the task acceptance threshold of each computing resource partition, and the task acceptance threshold is fused with the current load status to obtain a resource status matrix including load rate, remaining computing power and task queue length.
[0023] In this example, we perform resource statistics analysis on the NPU computing units to obtain computing resource pool data including the number of computing units, computing power, and memory bandwidth. The number of computing units reflects the total number of physical computing units of the NPU, the computing power measures the amount of computing that each computing unit can complete per unit time, in FLOPS (floating point operations per second), and the memory bandwidth determines the data transfer speed between the NPU and the memory. Assume that the NPU has a total of The computing power of each computing unit is (in FLOPS), memory bandwidth is (Unit: GB / s). The computing resource pool data is represented as a matrix: ; in, and Respectively represent The computing power and memory bandwidth of each computing unit. Use this resource pool data to evaluate the hardware resource status of the NPU computing unit. Perform partition calculations on the NPU computing unit based on the computing resource pool data. Divide the computing unit into multiple computing resource partitions to facilitate the scheduling and resource allocation of subsequent tasks. The partition strategy is dynamically adjusted based on the computing power and memory bandwidth of the computing unit. Set an initial partitioning scheme to divide the NPU computing unit into partitions, each partition Contains several computing units The computational power and memory bandwidth of each partition are expressed as: ; ; These two formulas calculate the partition The total computing power and total memory bandwidth of the partition. The initial partitioning scheme needs to meet the load balance, that is, the computing power and memory bandwidth of each partition are as close as possible. In order to verify the balance of the initial partitioning scheme, calculate the processing power distribution diagram of each partition and observe the load situation between partitions. Assume that the processing power of the partition is The weighted sum of the computing power and memory bandwidth of each partition is expressed as: ; in, and They are the weight coefficients of computing power and memory bandwidth, respectively, and are used to balance the impact of the two. By drawing a processing power distribution diagram to reflect the load situation of each partition, it helps to adjust the partitioning scheme so that the computing resource partitions are as balanced as possible to avoid over-saturation or excessive idleness of some partition resources. According to the processing power distribution diagram of the computing resource partitions, the performance parameters of each partition are collected to obtain the peak computing performance and memory bandwidth of each computing resource partition. Peak computing performance refers to the computing power that can be achieved in theory when the computing resource partition fully exerts its maximum performance, while the memory bandwidth is the data transmission rate that the partition can withstand. Assuming the partition The peak computing performance is , whose memory bandwidth is , the performance data of the partition is expressed as: ; These performance parameters are obtained through hardware testing or simulation. By collecting these performance data, we can more accurately understand the processing capacity of each computing resource partition. We can calculate the load rate of the partition performance data and evaluate the current load status of each computing resource partition. Refers to computing resource partitioning The current resource usage is calculated as the ratio of the current task's computing load to the partition's maximum computing capacity. In the partition The computational load on , then the load rate It is expressed as: ; in, Indicates the current partition The set of tasks being executed in It's a task The corresponding computing load. The higher the load rate, the higher the utilization rate of the partition resources. Conversely, it means that the partition resources have not been fully utilized. Based on the current load status, calculate the remaining computing capacity of each computing resource partition, that is, the additional task computing capacity that the partition can handle under the current task load. Remaining computing capacity The calculation formula is as follows: ; Remaining computing power Represents a partition The acceptable computing task load can guide the system to reasonably allocate resources and migrate tasks. Partitions with higher remaining computing power can receive more computing tasks, while partitions with lower remaining computing power require task migration or resource adjustment. Based on the remaining computing power of the computing resource partitions, the task queue length is analyzed to obtain the task acceptance threshold of each computing resource partition. The task acceptance threshold refers to the maximum number of tasks that each partition can accept, which depends on the remaining computing power and current load status of the partition. Assuming the partition The task acceptance threshold is , then it is expressed as: ; in, is the average computational load of each task, Indicates a round-down operation. This threshold indicates the number of tasks that the partition can accept within the remaining computing capacity. The task acceptance threshold is combined with the current load status to obtain a resource status matrix that includes the load rate, remaining computing power, and task queue length. Resource Status Matrix It is expressed as: ; This matrix can comprehensively reflect the current resource usage of each computing resource partition, help the system evaluate the optimization space of resource allocation, and provide a basis for subsequent task scheduling and resource management.
[0024] In one example, the task overlap is calculated based on the initial scheduling time table and the resource status matrix, an overlapping time matrix is generated, and a Q-learning task optimization model is constructed according to the overlapping time matrix, including: Perform time interval analysis on the task time trigger window in the initial scheduling time sequence table to obtain a time interval set containing the start and end times of each task, and perform time overlap calculation on any two NPU computing tasks based on the time interval set to obtain a task pair overlap duration matrix; Based on the task overlap duration matrix and the load rate in the resource status matrix, the task overlap score is calculated to obtain an overlap score vector, and the overlap score vector is sorted according to the time interval to obtain an overlap timing matrix containing overlapping task identifiers and overlapping timing information; Construct the Q-learning state space based on the overlapping time series matrix to obtain the state vector containing the task state characteristics and resource state characteristics; Construct the action space of the state vector to obtain an action set including task scheduling actions and resource allocation actions; Design a Q-value update function based on the action set to obtain a reward function that includes task execution delay penalty and resource utilization reward; The state vector, action set and reward function are used to construct a Q-learning model to obtain a Q-learning task optimization model for outputting a task stacking solution.
[0025] In this example, the time interval analysis is performed on the task time trigger window in the initial scheduling schedule. The initial scheduling schedule contains the time trigger window of each NPU computing task, that is, the start time and end time of each task. , whose time-triggered window is represented as a pair of timestamps ,in It's a task The start time, is the end time of the task. The time window set of all tasks is expressed as: Time Interval Set ; in, is the total number of tasks. Through time interval analysis, it is concluded that any two tasks and Assume that For the task and The overlap duration is calculated by the following formula: ; Calculate whether the time windows of two tasks overlap. If they overlap, take the duration of the overlapping part; if they do not overlap, the overlapping duration is zero. By calculating the overlapping duration of all task pairs, we get the task pair overlapping duration matrix, which represents the overlapping duration between tasks. The size is , where each element Representative tasks and tasks The task overlap is scored based on the task overlap duration matrix and the load rate in the resource status matrix. Assume that the resource status matrix Contains the load rate information of each computing resource partition, expressed as: ; in, It is the computing resource partition The load factor, is the total number of resource partitions. The load rate is calculated by the ratio of the resources occupied by the current task to the total available resources of the resource. The overlap score of each pair of tasks is calculated by combining the task pair overlap duration matrix and the load rate matrix. It is expressed by the following formula: ; in, It's a task and tasks Resource partition during execution The higher the load rate, the higher the resource utilization, so the greater the penalty for overlap and the lower the score. In this way, the overlap score matrix for each pair of tasks is obtained. , reflecting the impact of overlap between tasks on computing resources. Sort the overlap score vectors to obtain an overlap timing matrix containing overlapping task identifiers and overlapping timing information. Assume that the overlap score vector is: ; in, Indicates the task and tasks The overlap score between them. By sorting the score vectors, a list of task pairs arranged by overlap priority is obtained, namely the overlapping timing matrix. Based on the overlapping timing matrix, the state space of Q-learning is constructed. The state space is the core part of the Q-learning algorithm and represents the state of the system at any given moment. In the task scheduling scenario, the state space is composed of the state characteristics of the task and the state characteristics of the resource. Task state characteristics include the current execution time of the task, the execution priority of the task, the remaining execution time of the task, etc.; resource state characteristics include the load rate of the computing resources, the remaining computing power, the memory bandwidth, etc. Merge the task state and the resource state into a state vector , indicating the current state of the system: ; in, represents the state feature vector of the task, Represents the state feature vector of the resource. Based on the state vector, an action space is constructed. The action space includes task scheduling actions and resource allocation actions. Task scheduling actions determine which task should be executed at the next time point, and resource allocation actions refer to how to allocate computing resources when executing tasks. Assume that the action set is , where each action Represents a decision on task scheduling or resource allocation. The elements in the action set are represented as: ; in is the total number of actions. Based on the action set, a Q-value update function is designed to guide the optimization of task scheduling and resource allocation. The core idea of the Q-value update function is to update the Q-value by feedback rewards, so that the system can make better decisions in the future. The Q-value update function is defined as: ; in, is the learning rate, Is to perform an action After the reward, is the discount factor, is the maximum Q value in the next state. Designed based on the penalty for delayed task execution and the reward for resource utilization. For example, delayed task execution brings penalties, while higher resource utilization brings greater rewards: ; Among them, Delay Indicates execution of an action The task delay after Utilization Indicates execution of an action After the resource utilization rate, and It is the importance coefficient for adjusting delay and resource utilization. By training the Q-learning model, the task scheduling and resource allocation strategies are continuously adjusted, and finally a task optimization solution for task stacking is output. The Q-learning task optimization model makes the best scheduling decision based on the priority of the task, the status of the resource, and the overlapping relationship between the tasks, thereby improving the overall performance of the system.
[0026] In one example, the NPU computing tasks are grouped and sorted in two layers according to the Q-learning task optimization model, and a task allocation sequence is generated based on the resource status matrix, including: According to the Q-learning task optimization model, periodic computing tasks are extracted to obtain the first-layer periodic task set, and the first-layer periodic task set is statically partitioned and allocated based on the load rate in the resource state matrix to obtain a periodic task allocation scheme; The burst task features are extracted from the state vector in the Q-learning task optimization model to obtain the second-layer burst task set, and the second-layer burst task set is dynamically partitioned according to the remaining computing power in the resource state matrix to obtain the burst task candidate partitions. Based on the candidate partitions of burst tasks and the periodic task allocation scheme, task compatibility analysis is performed to obtain the task resource competition matrix; According to the task resource competition matrix, the burst tasks are partitioned and selected to obtain the burst task allocation plan, and the periodic task allocation plan and the burst task allocation plan are merged to obtain a complete task grouping plan; Perform time window allocation calculation on the complete task grouping scheme to obtain the execution time series of each group, and allocate computing resources based on the execution time series to obtain the resource occupancy plan of the task; The resource occupation plan and the execution time sequence are serialized to obtain a task allocation sequence containing task execution order and resource allocation information.
[0027] In this example, periodic computing tasks are extracted from the Q-learning task optimization model and these tasks are grouped into the first-level periodic task set. Periodic tasks are tasks with a fixed execution period, which are executed regularly at a given time interval. These tasks have relatively stable resource requirements and execution time. For the periodic task set, let its task set be , where each task It has the characteristics of periodic execution, and the period is The resource requirements of periodic tasks are usually fixed, and their execution time is predictable. These tasks are statically partitioned based on the load ratio in the resource status matrix to find a resource partition for each task so that the resources are fully utilized and overcrowding is avoided. Assume that the resource status matrix Contains each resource partition Load rate , select the appropriate partition using the following formula: ; in, Represents resource partition The load factor, task It will be assigned to the resource partition with the smallest load rate. After completing the static partition, the allocation plan for periodic tasks is obtained. , a resource partition is allocated to each periodic task. The feature extraction of burst tasks is performed based on the state vector in the Q-learning model. Burst tasks refer to tasks that occur in non-periodic time intervals, and their occurrence is random. The set of burst tasks is , each burst task A lot of resources are consumed during execution. In order to handle these sudden tasks, these tasks are dynamically partitioned and calculated based on the remaining computing power in the resource status matrix. It is expressed as: ; in, Is a resource partition The total computing power of is the total computing resources required by the tasks assigned to this resource partition. Burst tasks are assigned to resource partitions with larger remaining computing power to ensure that they can be executed in the shortest time. Based on this remaining computing power, the candidate partitions for burst tasks are represented as: ; In this way, burst tasks are dynamically allocated to resource partitions with more remaining computing power. After completing the dynamic allocation of burst tasks, task compatibility analysis is performed to determine whether there is resource competition between periodic tasks and burst tasks. Assume that the task resource competition matrix Represents resource conflicts between tasks, where each element Indicates the task and The resource contention between tasks depends on the degree of overlap in the demand for computing resources. The resource contention between computing tasks is calculated by the following formula: ; when When it is higher, it indicates that the task and tasks If the resource requirements of the periodic tasks and the burst tasks are similar, the competition is fierce; otherwise, it means that the resource competition is small. Through task compatibility analysis, check whether the periodic tasks and the burst tasks can share the resource partition. If the resource competition is low, the two tasks can coexist in the same resource partition. The partition selection calculation of the burst task is performed according to the task resource competition matrix to determine the final allocation plan of the burst task. Assuming that the optimal resource allocation strategy is selected according to the competition matrix, the partition selection formula of the burst task is: ; The periodic task allocation scheme and the burst task allocation scheme are combined to obtain a complete task grouping scheme. The time window allocation calculation is performed on the complete task grouping scheme to determine the execution time of each task. By calculating the start and end time of each task, the execution time sequence of the task is obtained. , these tasks are arranged in a scheduling order, and each task is executed on its assigned resource partition. The execution time of a task is expressed by the following formula: in, and Respectively represent tasks The start and end time of Indicates the task The time required for execution, and the start time of each task must be greater than or equal to the end time of the previous task to avoid time conflicts. After obtaining the execution time series of the tasks, the computing resources are allocated based on these time series, and the resource occupancy plan of the tasks is obtained. The resource occupancy plan Resource Occupancy includes the computing resources occupied by each task during the execution process. The goal of computing resource allocation is to maximize the utilization rate of resources while avoiding excessive congestion of resources. The resource occupancy of a task is calculated using the following formula: ; By calculating the resource usage of all tasks, the usage of each resource partition in the entire execution process is obtained. Combining the resource usage plan and the task execution time series, after serialization processing, the task allocation sequence is obtained. The task allocation sequence contains the execution order of tasks and computing resource allocation information, ensuring that each task can be completed on time and there will be no conflicts in resources.
[0028] Among them, the periodic computing tasks are extracted according to the Q-learning task optimization model to obtain the first-layer periodic task set, and the first-layer periodic task set is statically partitioned and allocated based on the load rate in the resource state matrix to obtain a periodic task allocation scheme, including: The state vector in the Q-learning task optimization model is analyzed for periodic characteristics, and the start interval time, execution duration and completion time of each task in the continuous execution cycle are extracted. The extracted characteristic parameters are numerically statistically processed to obtain a periodic characteristic matrix containing the task execution cycle, start time and execution duration; variance analysis is performed on the computing tasks based on the start interval time in the periodic characteristic matrix, and the periodic index of the task is calculated according to the variance analysis results and the stability of the execution duration, and the periodic index is compared with the preset periodic threshold to obtain a task index set with a fixed execution cycle; the task state characteristics in the Q-learning task optimization model are mapped to feature space according to the task index set, and characteristic parameters including computing resource requirements, execution priority and data dependency are extracted, and grouped according to the task execution cycle to obtain the first-level periodic task set; for each task in the first-level periodic task set, the computing unit quantity requirement, memory bandwidth requirement and computing power requirement are quantitatively calculated, and the resource requirement parameters of each dimension are normalized and a characteristic vector is constructed to obtain a standardized task resource requirement vector. The task resource demand vector is analyzed for correlation with the current load rate and remaining computing capacity of each resource partition in the resource status matrix, the matching degree between the task resource demand and the partition resource supply is calculated, and the scoring matrix is constructed by the cosine similarity method to obtain the fitness matrix of the task and the resource partition; the first-layer periodic task set is partitioned and allocated by a greedy algorithm based on the fitness matrix, and tasks with high fitness are preferentially allocated to the corresponding resource partitions, and the remaining capacity of the resource partitions is updated in real time, and the allocation of all tasks is completed in the order of task priority to obtain the initial task allocation plan; the number of tasks, resource occupancy rate and computing load of each resource partition in the initial task allocation plan are statistically analyzed, the load balance index between partitions is calculated, and a multidimensional vector including the distribution of the number of tasks, the distribution of resource utilization and the distribution of load is constructed to obtain the task distribution vector of each resource partition; the load imbalance of the current allocation plan is calculated according to the task distribution vector, and the resource partitions with too high and too low loads are identified. The loads between partitions are dynamically adjusted by task migration to ensure that the load balance of each partition meets the preset threshold requirements, and a periodic task allocation plan that meets the load balance constraint is obtained.
[0029] Among them, the burst task feature is extracted from the state vector in the Q-learning task optimization model to obtain the second-level burst task set, and the second-level burst task set is dynamically partitioned according to the remaining computing power in the resource state matrix to obtain the burst task candidate partitions, including: The time characteristic analysis of the state vector in the Q-learning task optimization model is performed, the execution frequency and time distribution characteristics of each task are calculated, and the task arrival pattern is quantitatively processed according to the randomness and burstiness indicators to obtain the task time characteristic data including execution regularity, time distribution density and burstiness score; cluster analysis is performed based on the task time characteristic data, and the time characteristics of the tasks are classified using the K-means clustering algorithm, and the time series discreteness and fluctuation amplitude of the tasks are calculated. The tasks are screened according to the clustering results and the preset burstiness threshold to obtain the burst task index set; the task identifier in the burst task index set is input into the feature extraction module, and the characteristic parameters of resource demand, execution time and priority of each burst task are extracted, and the data is normalized to obtain the second-level burst task set; the remaining computing power of each computing resource partition in the resource state matrix is statistically analyzed, and the resource capacity indicators including the number of idle computing units, available memory bandwidth and remaining computing power are calculated, and the resource indicators are weighted to obtain the resource index. Source partition scoring vector; pre-screen the computing resource partitions according to the resource partition scoring vector, calculate the resource utilization and load balancing degree of each partition, set the resource capacity threshold and load balancing threshold, screen out the resource partitions that meet the burst task processing requirements, and obtain the candidate partition set; perform resource demand analysis on the tasks in the second-layer burst task set, calculate the computing density and memory access characteristics of the tasks, construct a task feature vector containing the computing demand intensity and memory bandwidth requirements, and calculate the matching degree with the partition resource characteristics in the candidate partition set to obtain the task partition adaptation matrix; perform a comprehensive evaluation based on the task partition adaptation matrix and the resource partition scoring vector, use a weighted scoring method to sort the candidate partitions, calculate the affinity score between the task and the partition, generate the priority mapping relationship between the task and the partition, and obtain the partition selection priority table; dynamically match the partition selection priority table with the real-time resource status, screen and sort the partitions according to the task urgency and resource availability, select the appropriate resource partitions in order of priority, and obtain the burst task candidate partitions.
[0030] In one example, resource load calculation is performed on the NPU computing tasks in the task allocation sequence, a migration cost matrix is generated, and task reallocation is performed according to the migration cost matrix to obtain a task reallocation result, including: Perform load statistics analysis on the NPU computing tasks in the task allocation sequence to obtain the task load distribution data of each computing resource partition, and calculate the load balance of the computing resource partition based on the task load distribution data to obtain a set of load imbalanced partitions; Calculate the migration time cost of tasks in the load imbalance partition set to obtain the task migration time cost vector, and calculate the task migration energy consumption based on the task migration time cost vector to obtain the task migration energy consumption cost vector; The task migration time cost vector and the task migration energy cost vector are fused to obtain the migration cost matrix; Select the target partition for task migration for the resource partition whose load rate in the migration cost matrix is lower than the preset threshold, and obtain the task migration plan; Reassign the NPU computing tasks based on the task migration plan to obtain an updated task allocation plan; The updated task allocation plan is reorganized with resources to obtain a task reallocation result including task migration information and resource allocation information.
[0031] In this example, the load data of each task on each computing resource partition is extracted from the task allocation sequence. The load data includes the occupancy of computing resources, the usage time of resources, etc. Assume that the load data of each computing resource partition is represented as a vector ,in Indicates resource partition The load data of each task, the dimension of the load data Indicates the number of tasks processed by the partition. Performs load distribution data balance calculations. By calculating the load imbalance of each resource partition, it is determined whether there is load imbalance in the resource partition. The load balance is measured by calculating the difference between the load of each resource partition and the load of other resource partitions. Set the load balance The calculation formula is: ; in, For the The average load of a resource partition is calculated as: ; Load balancing The smaller the value, the more balanced the load is; otherwise, it indicates that the load of the resource partition is unbalanced and needs to be migrated. The migration time of tasks in the unbalanced partition set is calculated. Task migration time refers to the time required for a task to migrate from one resource partition to another, which is related to the size of the task, the migration path, and the idleness of the target resource. Task migration time cost vector Record the migration time of each unbalanced task, where Representative The migration time of a task. Assuming that the migration time is related to the task size and the bandwidth of the computing resources, the migration time cost is expressed by the following formula: ; in, Indicates the task The size of is the bandwidth of the target resource. Calculate the energy consumption caused by task migration. The energy consumption of task migration is related to the size of the task and the energy efficiency of the computing resources. Assume that the migration energy cost vector is ,in Indicates the task The migration energy consumption is expressed by the following formula: ; in, is the energy consumption constant, is the migration time, is the power consumption of the resource. The time cost and energy cost of task migration are combined to obtain the migration cost matrix , expressed as: ; in, and is a weight coefficient used to adjust the importance of time cost and energy cost. After obtaining the migration cost matrix, the task migration target partition is selected for the resource partition whose load rate is lower than the preset threshold according to the current load status. Set a load rate threshold , filter the resources whose load rate is lower than the threshold in the migration cost matrix and select the appropriate target partition. The task migration scheme is expressed as , is a set of task migration target partitions. Based on the task migration scheme, the NPU computing tasks are redistributed so that the tasks can be reasonably allocated to each resource partition according to the new load state distribution. The update scheme after task redistribution is expressed as , which is the new task allocation plan. The updated task allocation plan is reorganized so that each resource partition can maximize its computing power. During the reorganization process, the utilization and performance of each computing resource are optimized based on the task migration information and resource allocation information, and the task reallocation result is finally obtained. , contains task migration information and resource allocation information for each resource partition.
[0032] In one example, the task reallocation result is input into the Pareto multi-objective optimization algorithm to generate the global execution timing of the NPU computing task, and the NPU computing task is scheduled according to the global execution timing, and the task scheduling execution information is output, including: Perform time cost analysis on the task execution delay in the task reallocation result to obtain the delay minimization objective function, and perform utilization calculation on the computing resource allocation in the task reallocation result to obtain the resource utilization maximization objective function; The delay minimization objective function and resource utilization maximization objective function are used to construct a multi-objective space, and a multi-objective constraint space including task time constraints and resource capacity constraints is obtained; Perform non-dominated solution search calculation on the multi-objective constraint space to obtain the Pareto optimal solution set containing multiple sets of task execution timing and resource allocation strategies; Verify the dependency relationship based on the task execution timing in the Pareto optimal solution set, and obtain the execution timing subset that satisfies the task dependency constraints; Based on the execution timing subset, the computing resources are allocated and verified to obtain a global execution timing plan that meets the resource constraints, and the global execution timing plan is converted into an execution instruction sequence of the NPU computing task to obtain a task scheduling instruction set; Issue partitioned tasks to the task scheduling instruction set to obtain the execution instruction sequence of each computing resource partition; The execution instruction sequence is distributed to the corresponding computing resource partitions for execution processing, and task scheduling execution information including task execution status, computing performance and resource utilization is obtained.
[0033] In this example, consider the delay factor when executing tasks. Task delay is affected by multiple factors such as computing resource allocation, task execution order, and task size. Define tasks The execution delay is , which is determined by the actual time of task execution and system scheduling time. The calculation formula for task delay is as follows: ; in, Indicates the task The execution time, Indicates the time the task waits for execution. Execution time The queue time depends on the processing power of the computing resources and the computing requirements of the task. It is related to the position of the task in the resource queue and the scheduling priority of the task. In order to reduce the total delay of task execution, minimize the execution time and waiting time of the task, and obtain an objective function of delay minimization. Assume that the delay minimization objective function in the task redistribution result is for: ; The objective function represents the sum of all task execution delays. By optimizing this objective function, the task delay can be effectively reduced, thereby improving the overall performance of the system. The utilization rate of computing resource allocation in the task reallocation result is calculated. It is measured by the ratio of actual resource usage to total resource capacity. Assume that The total capacity of computing resources is The actual usage is , computing resources The utilization rate is expressed as: ; The objective function of maximizing the resource utilization of the entire system It is expressed as the sum of all computing resource utilizations in the system, and the formula is as follows: ; in, Indicates the total number of computing resources in the system, Indicates The actual usage of resources. Indicates The goal is to maximize resource utilization so that each computing resource is fully utilized. and Based on this, multi-objective optimization is performed to construct a multi-objective space, including task time constraints and resource capacity constraints. Task time constraints mean that the total time of task execution cannot exceed the maximum execution time preset by the system. , resource capacity constraint means that the actual usage of each computing resource in the system cannot exceed its total capacity These constraints are expressed mathematically as: ; ; Based on these constraints, a multi-objective constraint space including task time constraints and resource capacity constraints is constructed. A non-dominated solution search is performed to obtain a Pareto optimal solution set containing multiple sets of task execution timings and resource allocation strategies. A non-dominated solution is a solution that cannot be surpassed by other solutions on all objectives. In multi-objective optimization, the Pareto optimal solution set contains all non-dominated solutions, which achieve the best balance between different objectives. A variety of methods are used to search for non-dominated solutions, such as the NSGA-II algorithm or other multi-objective evolutionary algorithms. Through these methods, multiple solutions are obtained, each of which represents a different task scheduling timing and resource allocation strategy. Dependency verification is performed based on the task execution timing in the Pareto optimal solution set. The dependency between tasks determines the execution order of tasks, ensuring that tasks are executed in the correct order and avoiding execution errors due to dependency conflicts. Assume that the task Depends on the task , then the task Start time Must be greater than or equal to task End time ,Right now: ; In the dependency verification process, check whether each set of solutions satisfies the dependencies of all tasks, and obtain the execution timing subset that satisfies the task dependency constraints. Based on the execution timing subset, verify the allocation of computing resources to ensure that the resources allocated to each task will not exceed the maximum capacity of the resources during the entire execution process. Assume that the task When executing, it uses Unit resources, then for each moment , must satisfy: ; Through verification, it is ensured that the allocation of resources will not exceed its capacity at any time. A global execution timing scheme that meets all constraints is obtained. After converting the scheme into an execution instruction sequence of the NPU computing task, a task scheduling instruction set is obtained. The scheduling instruction set contains the execution timing of each task, the required resources, and the dependencies between tasks. The task scheduling instruction set is partitioned and issued to obtain the execution instruction sequence of each computing resource partition. These execution instructions are distributed to the corresponding computing resource partitions for processing, and finally the task scheduling execution information containing the task execution status, computing performance, and resource utilization is obtained. The execution information is used to monitor and adjust the task scheduling strategy in real time to ensure the efficient operation of the system.
[0034] Reference Figure 2 This embodiment provides an NPU computing task scheduling device for a multi-mode SoC main control chip, including: Extraction module 1, used to extract task characteristic parameters of NPU computing tasks in the multi-mode SoC main control chip, generate task descriptors according to the task characteristic parameters, and establish an initial scheduling timing table based on the task descriptors; Partitioning module 2 is used to partition the computing resources of the NPU computing unit to obtain multiple computing resource partitions, obtain performance parameters of each computing resource partition, and establish a resource status matrix according to the performance parameters; Calculation module 3, used for calculating task overlap based on the initial scheduling time sequence table and the resource status matrix, generating an overlapping time sequence matrix, and constructing a Q-learning task optimization model according to the overlapping time sequence matrix; Sorting module 4, used to perform double-layer grouping and sorting of NPU computing tasks according to the Q-learning task optimization model, and generate a task allocation sequence based on the resource status matrix; The reallocation module 5 is used to calculate the resource load of the NPU computing tasks in the task allocation sequence, generate a migration cost matrix, and perform task reallocation according to the migration cost matrix to obtain a task reallocation result; The output module 6 is used to input the task reallocation result into the Pareto multi-objective optimization algorithm, generate the global execution timing of the NPU computing task, schedule the NPU computing task according to the global execution timing, and output the task scheduling execution information.
[0035] In this embodiment, for the specific implementation of each unit in the above device embodiment, please refer to the above method embodiment, which will not be repeated here.
[0036] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a display screen, an input device, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the corresponding data in this embodiment. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the above method is implemented.
[0037] Those skilled in the art will understand that Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied.
[0038] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.
[0039] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double-speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM.
[0040] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0041] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for scheduling NPU computing tasks of a multi-mode SoC master chip, characterized in that: The following steps are involved: Extracting task characteristic parameters of the NPU computing task in the multi-mode SoC main control chip, generating a task descriptor according to the task characteristic parameters, and establishing an initial scheduling timing table based on the task descriptor; The NPU computing unit is partitioned into computing resource partitions to obtain a plurality of computing resource partitions, and performance parameters of each computing resource partition are obtained, and a resource status matrix is established according to the performance parameters; Calculating task overlap based on the initial scheduling time sequence table and the resource status matrix, generating an overlapping time sequence matrix, and constructing a Q-learning task optimization model according to the overlapping time sequence matrix; Performing double-layer grouping and sorting of NPU computing tasks according to the Q-learning task optimization model, and generating a task allocation sequence based on the resource status matrix; Performing resource load calculation on the NPU computing tasks in the task allocation sequence, generating a migration cost matrix, and performing task reallocation according to the migration cost matrix to obtain a task reallocation result; The task reallocation result is input into the Pareto multi-objective optimization algorithm to generate a global execution timing of the NPU computing task, and the NPU computing task is scheduled according to the global execution timing, and task scheduling execution information is output.
2. The NPU computing task scheduling method of the multi-mode SoC master chip according to claim 1 is characterized in that: The extracting task characteristic parameters of the NPU computing task in the multi-mode SoC main control chip, generating a task descriptor according to the task characteristic parameters, and establishing an initial scheduling timing table based on the task descriptor includes: Collect features of NPU computing tasks in multi-mode SoC master chips to obtain task feature data including task execution time, computing resource requirements, task priority value, computing mode type, data dependency, and task periodicity; Performing numerical normalization processing on the execution time and resource demand in the task feature data to obtain a standardized feature vector, and performing multi-dimensional feature fusion on the standardized feature vector and the priority value in the task feature data to obtain a task feature parameter; Inputting the task feature parameters into a feature mapping module for mapping to obtain a task descriptor including a task identifier, a computing mode identifier, a resource requirement vector, a task priority value, an expected execution time, and a task dependency matrix; Classifying the NPU computing tasks according to the computing mode identifier in the task descriptor to obtain a mode classification set, and sorting the tasks in the mode classification set according to the task priority values to obtain a task execution priority sequence; Calculate the time trigger window according to the task execution priority sequence and the inter-task dependency matrix to obtain a time allocation scheme including task start time point and end time point; The time allocation scheme is scheduled and mapped with the task computing resource demand vector to obtain an initial scheduling time sequence table including the time trigger window and computing resource allocation information of each task.
3. The NPU computing task scheduling method of the multi-mode SoC master chip according to claim 2 is characterized in that: The NPU computing unit is partitioned into computing resources to obtain a plurality of computing resource partitions, and performance parameters of each computing resource partition are obtained, and a resource state matrix is established according to the performance parameters, including: Perform resource statistics analysis on NPU computing units to obtain computing resource pool data including the number of computing units, computing power, and memory bandwidth; Based on the computing resource pool data, partition calculation is performed on the NPU computing unit to obtain an initial partitioning scheme of multiple computing resource partitions, and a balance verification calculation is performed on the initial partitioning scheme of the computing resource partitions to obtain a processing capacity distribution map of the computing resource partitions; Collecting performance parameters of each computing resource partition according to the processing capacity distribution diagram of the computing resource partition to obtain partition performance data including the number of computing units, peak computing performance and memory bandwidth; Calculating the load rate of the partition performance data to obtain the current load status of each computing resource partition, and calculating the remaining computing power of each computing resource partition based on the current load status to obtain the remaining computing capacity value of the computing resource partition; The task queue length is analyzed according to the remaining computing capacity value of the computing resource partition to obtain the task acceptance threshold of each computing resource partition, and the task acceptance threshold is fused with the current load state to obtain a resource state matrix including the load rate, remaining computing power and task queue length.
4. The NPU computing task scheduling method of the multi-mode SoC master chip according to claim 3 is characterized in that: The calculating task overlap based on the initial scheduling time sequence table and the resource status matrix, generating an overlapping time sequence matrix, and constructing a Q-learning task optimization model according to the overlapping time sequence matrix includes: Performing time interval analysis on the task time trigger window in the initial scheduling time sequence table to obtain a time interval set including the start and end time of each task, and performing time overlap calculation on any two NPU computing tasks according to the time interval set to obtain a task pair overlap duration matrix; Based on the task pair overlap duration matrix and the load rate in the resource status matrix, a task overlap score is calculated to obtain an overlap score vector, and the overlap score vector is sorted according to the time interval to obtain an overlap timing matrix including overlap task identifiers and overlap timing information; Constructing a Q-learning state space based on the overlapping time series matrix to obtain a state vector including task state features and resource state features; Constructing an action space for the state vector to obtain an action set including task scheduling actions and resource allocation actions; Designing a Q-value update function according to the action set to obtain a reward function including a task execution delay penalty and a resource utilization rate reward; A Q-learning model is constructed for the state vector, the action set and the reward function to obtain a Q-learning task optimization model for outputting a task stacking solution.
5. The NPU computing task scheduling method of the multi-mode SoC master chip according to claim 4 is characterized in that: The step of performing double-layer grouping and sorting of NPU computing tasks according to the Q-learning task optimization model and generating a task allocation sequence based on the resource status matrix includes: Extracting periodic computing tasks according to the Q-learning task optimization model to obtain a first-layer periodic task set, and statically partitioning and allocating the first-layer periodic task set based on the load rate in the resource status matrix to obtain a periodic task allocation scheme; Extracting burst task features from the state vector in the Q-learning task optimization model to obtain a second-layer burst task set, and dynamically partitioning the second-layer burst task set according to the remaining computing power in the resource state matrix to obtain burst task candidate partitions; Performing task compatibility analysis based on the candidate burst task partitions and the periodic task allocation scheme to obtain a task resource competition matrix; Performing partition selection calculation on the burst tasks according to the task resource competition matrix to obtain a burst task allocation scheme, and merging the periodic task allocation scheme and the burst task allocation scheme to obtain a complete task grouping scheme; Performing time window allocation calculation on the complete task grouping scheme to obtain the execution time sequence of each group, and performing computing resource allocation based on the execution time sequence to obtain the resource occupation scheme of the task; The resource occupation scheme and the execution time sequence are serialized to obtain a task allocation sequence including task execution order and resource allocation information.
6. The NPU computing task scheduling method of the multi-mode SoC master chip according to claim 5 is characterized in that: The performing resource load calculation on the NPU computing tasks in the task allocation sequence, generating a migration cost matrix, and performing task reallocation according to the migration cost matrix to obtain a task reallocation result includes: Performing load statistics analysis on the NPU computing tasks in the task allocation sequence to obtain task load distribution data of each computing resource partition, and performing load balancing calculation on the computing resource partition based on the task load distribution data to obtain a set of load imbalanced partitions; Calculating the migration time overhead of the tasks in the load imbalance partition set to obtain a task migration time cost vector, and calculating the task migration energy consumption according to the task migration time cost vector to obtain a task migration energy consumption cost vector; The task migration time cost vector and the task migration energy consumption cost vector are cost-fused to obtain a migration cost matrix; Selecting a task migration target partition for a resource partition whose load rate in the migration cost matrix is lower than a preset threshold, and obtaining a task migration plan; Reassign the NPU computing tasks based on the task migration plan to obtain an updated task allocation plan; The updated task allocation scheme is reorganized for resources to obtain a task reallocation result including task migration information and resource allocation information.
7. The NPU computing task scheduling method of the multi-mode SoC master chip according to claim 6 is characterized in that: The task reallocation result is input into the Pareto multi-objective optimization algorithm to generate a global execution timing of the NPU computing task, and the NPU computing task is scheduled according to the global execution timing, and the task scheduling execution information is output, including: Performing a time cost analysis on the task execution delay in the task reallocation result to obtain a delay minimization objective function, and performing a utilization calculation on the computing resource allocation in the task reallocation result to obtain a resource utilization maximization objective function; The delay minimization objective function and the resource utilization maximization objective function are constructed into a multi-objective space to obtain a multi-objective constraint space including task time constraints and resource capacity constraints; Performing non-dominated solution search calculation on the multi-objective constraint space to obtain a Pareto optimal solution set including multiple groups of task execution timings and resource allocation strategies; Verify the dependency relationship according to the task execution timing in the Pareto optimal solution set to obtain a subset of execution timings that meet the task dependency constraints; Based on the execution timing subset, computing resources are allocated and verified to obtain a global execution timing solution that satisfies resource constraints, and the global execution timing solution is converted into an execution instruction sequence of the NPU computing task to obtain a task scheduling instruction set; Distribute the task scheduling instruction set to partition tasks to obtain execution instruction sequences for each computing resource partition; The execution instruction sequence is distributed to the corresponding computing resource partitions for execution processing to obtain task scheduling execution information including task execution status, computing performance and resource utilization.
8. A NPU computing task scheduling device for a multi-mode SoC main control chip, characterized in that: For implementing the steps of the method according to any one of claims 1 to 7, the device comprises: An extraction module is used to extract task characteristic parameters of the NPU computing task in the multi-mode SoC main control chip, generate a task descriptor according to the task characteristic parameters, and establish an initial scheduling timing table based on the task descriptor; A partitioning module is used to partition the computing resources of the NPU computing unit to obtain multiple computing resource partitions, obtain performance parameters of each computing resource partition, and establish a resource status matrix according to the performance parameters; A calculation module, used to calculate the task overlap based on the initial scheduling time sequence table and the resource status matrix, generate an overlapping time sequence matrix, and construct a Q-learning task optimization model according to the overlapping time sequence matrix; A sorting module, used to perform double-layer grouping sorting on the NPU computing tasks according to the Q-learning task optimization model, and generate a task allocation sequence based on the resource status matrix; A reallocation module, used to calculate the resource load of the NPU computing tasks in the task allocation sequence, generate a migration cost matrix, and perform task reallocation according to the migration cost matrix to obtain a task reallocation result; The output module is used to input the task reallocation result into the Pareto multi-objective optimization algorithm, generate the global execution timing of the NPU computing task, schedule the NPU computing task according to the global execution timing, and output the task scheduling execution information.
9. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Heterogeneous network resource allocation method based on reinforcement learning
CN112351433A
Internet of Vehicles calculation unloading method and system based on multi-objective reinforcement learning
CN113961204A
Dynamic multi-target flexible workshop job scheduling method based on deep Q learning
CN118536723A
Large model scheduling method and device based on NPU computing power
CN119336457A
GPU (Graphics Processing Unit) and NPU (Network Processing Unit) resource scheduling method for high-performance computing
CN119512752A
Cited By
Reliable configuration method for regularly executing tasks
CN120216209A
Resource scheduling method and related equipment
CN120276830A
Storage and calculation integrated server optimization method based on NPU
CN121009935A
Npu-based storage-computing integrated server optimization method
CN121009935B
Intelligent management method and system for cloud assets
CN121070596A