Task scheduling method and device and computing system
By dividing partitions in the parallel computing system and setting up a partition scheduler, cross-partition task scheduling is determined based on the partition criticality, the problem of unbalanced task scheduling is solved, and resource utilization and task scheduling effect are improved.
Patent Information
- Application Number
- CN202311440475.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2025-05-02
AI Technical Summary
In parallel computing systems with high complexity and large scale, unbalanced task scheduling leads to low resource utilization.
By dividing multiple computing units of the computing system into multiple partitions, each partition is set up with a partition scheduler, and whether to perform cross-partition task scheduling is determined based on the partition criticality, so as to achieve balanced task scheduling.
It improves the resource utilization rate of the computing system, realizes balanced scheduling of tasks, and takes into account both fine-grained and coarse-grained task scheduling effects.
Smart Images

Figure CN119917229A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task scheduling method, device and computing system. Background Art
[0002] In parallel computing systems with high complexity and large scale, such as server systems with multiple cores and processors, cluster computing systems in data centers, high-performance computing (HPC) supercomputing systems, cloud computing, etc., the reasonable scheduling of tasks faces many challenges.
[0003] Among them, an important challenge is that when the scheduler in the computing system performs parallel task scheduling, there is an unbalanced task scheduling problem in the computing system, resulting in low resource utilization of the computing system. Summary of the invention
[0004] The present application provides a task scheduling method, device and system, which can improve the resource utilization of a computing system.
[0005] This application adopts the following technical solutions:
[0006] In the first aspect, the present application provides a task scheduling method for scheduling tasks for a computing system, wherein the computing system includes multiple computing units, the multiple computing units are divided into multiple partitions, each of the multiple partitions corresponds to a partition scheduler, and each partition includes multiple task queues of different priorities set based on task criticality, and the task criticality is determined based on the delay tolerance of the computing unit running a task to the task. The method includes: determining the partition criticality of each of the multiple partitions, the partition criticality is used to indicate the delay tolerance of the computing unit in the partition to the scheduled task; in the case of determining that cross-partition task scheduling needs to be initiated according to the partition criticality of each of the multiple partitions, the second partition scheduler moves the tasks in the first task queue of the first partition of the multiple partitions into the task queue of the second partition of the multiple partitions, so that the computing unit in the second partition processes the task; the second partition scheduler is the partition scheduler corresponding to the second partition; and the first partition scheduler moves the tasks in the second task queue of the second partition of the multiple partitions into the task queue of the first partition, so that the computing unit in the first partition processes the task, and the first partition scheduler is the partition scheduler corresponding to the first partition; the priority of the above-mentioned first task queue is different from the priority of the second task queue.
[0007] In the present application, whether cross-partition task scheduling is required can be determined based on the partition criticality. If cross-partition task scheduling is required, task scheduling is performed between two partitions, which can balance the tasks of the computing system and improve the resource utilization of the computing system.
[0008] Furthermore, multiple computing units of the computing system are partitioned, multiple partitions are scheduled in parallel, and a partition scheduler is set for each partition to perform autonomous task scheduling within each partition, thereby achieving fine-grained task scheduling; for different partitions, cross-partition task scheduling can be performed when necessary to achieve coarse-grained task scheduling. It can be seen that the task scheduling method provided in the embodiment of the present application can take into account both fine-grained and coarse-grained task scheduling, and the scheduling effect is good.
[0009] In a possible implementation, the above-mentioned multiple computing units include processing cores of one or more processors; wherein the one or more processors include a heterogeneous first processor and / or a second processor.
[0010] Optionally, the first processor is a general-purpose processor, such as a CPU, and the second processor is a processor heterogeneous to the first processor, such as a GPU, an FPGA, or an ASIC.
[0011] In one possible implementation, the partition criticality is the proportion of the number of processing cores whose core criticality values are greater than a first threshold value among the core criticalities of multiple processing cores in a partition; the core criticality is determined based on the latency tolerance of the processing cores for the tasks running on the processing cores. In the present application, the latency tolerance of the processing and verification tasks is related to the time slices consumed by the tasks during the running of the tasks (the time slices are the resource granularity of the processing cores) and / or the waiting time of the processing cores. The lower the latency tolerance of the processing and verification tasks, the higher the task criticality; the higher the latency tolerance of the processing and verification tasks, the lower the task criticality.
[0012] In one possible implementation, the task scheduling method provided in the embodiment of the present application also includes: calculating the criticality difference of multiple partitions based on the partition criticalities of multiple partitions, and the criticality difference is used to indicate the difference between the multiple partition criticalities of multiple partitions. The criticality difference of multiple partitions can measure whether the task scheduling in the entire computing system is balanced; when the criticality difference is greater than a second threshold, determining that cross-partition task scheduling needs to be initiated; when the criticality difference is less than or equal to the second threshold, each partition scheduler schedules the tasks in each partition.
[0013] In the present application, the computing system is partitioned and autonomous task scheduling is performed within the partitions, which can improve the resource utilization of the processing cores within the partitions; when the criticality of each partition differs greatly, cross-partition task scheduling is performed, which can improve the resource utilization of the computing system.
[0014] In a possible implementation, multiple partitions of a computing system correspond to a federal scheduler, and the federal scheduler is used to manage multiple partition schedulers; the federal scheduler can obtain the partition criticality of each of the multiple partitions from the partition scheduler, and determine the first partition and the second partition from the multiple partitions when it is determined that cross-partition task scheduling needs to be initiated based on the partition criticality of each of the multiple partitions; wherein the first partition is the partition corresponding to the partition criticality with the largest value among the multiple partition criticalities, and the second partition is the partition corresponding to the partition criticality with the smallest value among the multiple partition criticalities; and bilateral scheduling instructions are sent to the first partition scheduler and the second partition scheduler respectively; the bilateral scheduling instructions are used to instruct cross-partition task scheduling for the first partition and the second partition.
[0015] In one possible implementation, the priority of a task queue increases with increasing task criticality, and different numbers of time slices are allocated to queues of different priorities; the task criticality increases with decreasing delay tolerance for processing verification tasks; the first task queue is the queue with the highest priority among the task queues of the first partition, and the second task is the queue with the lowest priority among the task queues of the second partition.
[0016] In the process of cross-partition task scheduling, a partition with high partition criticality obtains tasks from the low priority queue of a partition with low partition criticality, which can reduce the criticality of the high partition; a partition with low partition criticality obtains tasks from the high priority queue of a partition with high partition criticality, which can increase the criticality of the low partition, thereby reducing the difference between the partition criticalities of the two partitions and achieving balanced task scheduling between the two partitions.
[0017] In one possible implementation, each partition scheduler schedules tasks within each partition, including: for any one of the multiple tasks in each partition, while the computing unit is executing the task, the partition scheduler updates the queue to which the task belongs so that the processing core executes the task according to the priority of the queue to which the task belongs.
[0018] In one possible implementation, the above-mentioned updating of the queue to which the task belongs includes: updating the task criticality of the task; and updating the queue to which the task belongs based on the task criticality of the task; wherein, when the task criticality of the task increases, the partition scheduler moves the task from the current queue to a queue with a priority higher than the priority of the current queue; when the task criticality of the task decreases, the partition scheduler moves the task from the current queue to a queue with a priority lower than the priority of the current queue.
[0019] In the present application, the process of task scheduling within a partition is a dynamic scheduling process based on task criticality. The partition scheduler of each partition performs autonomous task scheduling for the partition, and schedules based on the task criticality of the tasks within the partition. The scheduling granularity is finer, so that the task scheduling within the partition is balanced, which can improve the resource utilization of the processing core within the partition; and for each task, the overhead required to obtain the task criticality is small, which can significantly reduce the scheduling overhead required for task scheduling.
[0020] Furthermore, compared with the static scheduling method, the embodiment of the present application updates the queue based on the criticality of the task, does not rely on prior knowledge, and does not require any profiling performance collection data, thus greatly simplifying development and engineering optimization.
[0021] In one possible implementation, the task scheduling method provided by the embodiment of the present application also includes: each partition scheduler obtains the task dependency relationship between multiple tasks within the partition; and determines the initial task criticality of the multiple tasks respectively according to the task dependency depth indicated by the task dependency relationship; and according to the initial task criticality of the multiple tasks, determines the initial queues for the multiple tasks respectively from the queues of multiple different priorities of the partition.
[0022] In this application, the deeper the dependency depth of a task is, the more other tasks need to rely on the data of the task, and the higher the criticality of the task is.
[0023] In a second aspect, an embodiment of the present application provides a computing system, which includes a partition scheduler and may also include a federal scheduler. The partition scheduler and the federal scheduler include various modules for implementing the method described in the first aspect and one of its possible implementation methods, such as an acquisition module, a determination module, a scheduling module, a calculation module, a sending module, etc.
[0024] The partition scheduler and federated scheduler in the computing system have the function of implementing the behavior in the method example of any one of the first aspect and possible implementations thereof. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0025] In a third aspect, the present application provides a computing device comprising a memory and at least one processor connected to the memory, the memory being used to store computer program code, the computer program code comprising computer instructions, which, when executed by at least one processor, enable the computing device to execute the method of the first aspect and any one of its possible implementations.
[0026] In a fourth aspect, the present application provides a computer-readable storage medium storing computer instructions, which, when executed on a computer, execute the method of the first aspect and any one of its possible implementations.
[0027] In a fifth aspect, the present application provides a computer program product, which includes computer instructions. When the computer instructions are run on a computer, the method of the first aspect and any one of its possible implementations is executed.
[0028] In a sixth aspect, the present application provides a chip system, comprising: a processor, configured to call and run a computer program from a memory, so that a storage device equipped with the chip system executes the method of the first aspect and any one of its possible implementations.
[0029] It should be understood that the beneficial effects achieved by the technical solutions of the second to sixth aspects of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic diagram of a task dependency graph provided in an embodiment of the present application;
[0031] Figure 2 One of the architectural diagrams of a computing system provided in an embodiment of the present application;
[0032] Figure 3 A schematic diagram of the relationship between partitions and schedulers in a computing system provided in an embodiment of the present application;
[0033] Figure 4 A second schematic diagram of the architecture of a computing system provided in an embodiment of the present application;
[0034] Figure 5 One of the schematic diagrams of a scheduler deployment in a computing system provided in an embodiment of the present application;
[0035] Figure 6 One of the schematic diagrams of a scheduler deployment in a computing system provided in an embodiment of the present application;
[0036] Figure 7 One of the schematic diagrams of a scheduler deployment in a computing system provided in an embodiment of the present application;
[0037] Figure 8 One of the schematic diagrams of a scheduler deployment in a computing system provided in an embodiment of the present application;
[0038] Fig. 9One of the schematic diagrams of a scheduler deployment in a computing system provided in an embodiment of the present application;
[0039] Fig.10 One of the flowcharts of a task scheduling method provided in an embodiment of the present application;
[0040] Fig.11 A second flowchart of a task scheduling method provided in an embodiment of the present application;
[0041] Fig.12 A schematic diagram of a task queue provided in an embodiment of the present application;
[0042] Fig.13 A third flowchart of a task scheduling method provided in an embodiment of the present application;
[0043] Fig.14 A fourth flowchart of a task scheduling method provided in an embodiment of the present application;
[0044] Fig.15 A schematic diagram of a partition criticality reporting method provided in an embodiment of the present application;
[0045] Fig.16 A schematic diagram of a task scheduling process provided in an embodiment of the present application;
[0046] Fig.17 A schematic diagram of the structure of a computing system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0048] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of the objects. For example, the first partition and the second partition are used to distinguish different partitions rather than to describe a specific order of the partitions.
[0049] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0050] In the description of the embodiments of the present application, unless otherwise specified, “plurality” means two or more than two, and “plurality” may also be described as “at least two”.
[0051] The embodiments of the present application provide a task scheduling method, device and system, which mainly relate to a computing system with high computing complexity and large scale, for a computing architecture with multiple cores, multiple processors or multiple computing nodes. The tasks in the computing system are flexibly scheduled through the provided task scheduling method to balance the overall load of the computing system, that is, to achieve balanced scheduling of tasks, thereby improving the resource utilization of the computing system.
[0052] First, some technical terms involved in the task scheduling method, device and system provided in the embodiments of the present application are explained.
[0053] 1. Task Scheduling
[0054] In a computing system, the essence of a task is the access, calculation, analysis, and processing of data. In the actual processing process, there may be a sequential dependency between data, that is, there is a dependency between tasks. For example, to execute task A, you need to execute task B first, because the processing of task A depends on the processing result of task B.
[0055] To ensure efficient processing of large-scale data, tasks are required to be executed in parallel using computing resources as much as possible, especially for multi-core computing systems. However, because storage resources such as memory and cache are generally and significantly less than computing units, the tasks scheduled by the scheduler differ due to the execution of memory access operations or computing operations. Task scheduling is based on the dependencies between tasks and the differences between tasks, so that tasks are scheduled and executed according to a certain strategy.
[0056] It should be understood that in the embodiments of the present application, tasks may include I / O intensive tasks and computationally intensive tasks. Optionally, I / O intensive tasks include memory access tasks or tasks interacting with users, and computationally intensive tasks may include tasks in the fields of cloud computing, AI computing, etc.
[0057] 2. Mission criticality
[0058] For each task, the task criticality can be defined. The task criticality is determined based on the delay tolerance of the processing core running the task. The delay tolerance of the processing core is related to the time slices consumed by the task during the task running process and / or the waiting time of the processing core. The time slice is a unit of measurement for the length of time a processor is assigned to execute a task, and a task consumes one or more time slices.
[0059] It is understandable that the waiting time of the processing core or the time slice consumed by the task is related to the operations involved in the task running process, such as memory access operations and / or computing operations. Exemplarily, when there is an operation to initiate a memory access request during the task running process, it indicates that the data used for the processing core to perform calculations is not ready, and the data needs to be obtained through the memory access operation, and then the processing core performs computing operations based on the obtained data. It can be seen that when the task executes the memory access operation, the latency of the task increases, the processing core is not currently performing computing operations, and no longer consumes time slices. The processing core is in an idle or suspended state, and the processing core needs to wait for the memory access operation to end before it can perform computing operations. It can be seen that the waiting time of the processing core is long, so it is considered that the processing core has a low latency tolerance for the task. It is understandable that tasks that consume fewer time slices or cause the processing core to wait for a longer time can be called high-latency tasks.
[0060] In contrast, when the operation during the task execution is a calculation operation, the processing core is currently in a busy state and consumes less time slices. In addition, the current operation is a calculation operation, which indicates that the data used by the processing core for calculation is ready, and there is no need to initiate a memory access operation. The processing core does not need to wait or the waiting time is short. Therefore, the task processing core has a higher latency tolerance for the task. It can be understood that tasks that consume more time slices or make the waiting time of the processing core shorter can be called low-latency tasks.
[0061] It should be understood that the relationship between task criticality and latency tolerance of processing and checking tasks is: the lower the latency tolerance of processing and checking tasks, the higher the task criticality; the higher the latency tolerance of processing and checking tasks, the lower the task criticality. In other words, the higher the task criticality, the more idle the processing core is, and the lower the task criticality, the busier the processing core is. In some cases, it can also be understood that the task criticality of memory access tasks is high, and the task criticality of computing tasks is low.
[0062] In one implementation, the task criticality C L It is defined by the following dichotomy formula:
[0063]
[0064] Task criticality includes high task criticality (C L =1) and low mission criticality (C L =0), low delay tolerance corresponds to high task criticality, and high delay tolerance corresponds to low task criticality.
[0065] Optionally, the mission criticality C L It can also be defined in other ways, for example, the task criticality C L More values can be included, and the delay tolerance can be divided into multiple levels, with different levels corresponding to different task criticalities.
[0066] 3. Nuclear criticality
[0067] Nuclear criticality (C core ) is determined based on the latency tolerance of the processing core to the task running on the processing core. Referring to the above introduction to the definition of task criticality, at a certain moment, the core criticality is equal to the task criticality, and within a certain period of time, the core criticality and the task criticality may be different. This is because the processing core running a task may change. For example, at the current moment, a task is run by processing core 1, and at the next moment, the task is run by processing core 2. The core criticality of processing core 1 is no longer equal to the task criticality of the task.
[0068] 4. Partition criticality
[0069] First, the concept of partition in the embodiment of the present application is introduced. Partition is the division of a computing unit into blocks. The computing system includes multiple computing units, and the multiple computing units are divided into multiple partitions. A partition includes one or more computing units.
[0070] The multiple computing units of the above-mentioned computing system may include processing cores of one or more processors. The one or more processors in the embodiment of the present application may include homogeneous processors or heterogeneous processors.
[0071] Each partition in the computing system corresponds to a partition criticality, and the partition criticality is the proportion of the number of processing cores whose core criticality values are greater than a first threshold among the core criticalities of multiple processing cores in a partition, that is, the partition criticality is the proportion of the number of processing cores with higher core criticality (the value of the core criticality is greater than the first threshold) among the multiple processing cores in a partition.
[0072] Referring to the above introduction to the binary formula of task criticality, it is assumed that the nuclear criticality is also defined by the binary formula, that is, the nuclear criticality includes the high nuclear criticality (C core =1) and low nuclear criticality (C core =0), then the partition criticality C partition It can be determined by the following formula:
[0073]
[0074] Where n represents the total number of processing cores in a partition, C core_i represents the core criticality of the ith processing core.
[0075] It should be understood that the partition criticality is used to indicate the latency tolerance of the computing units in a partition for the scheduled tasks. The higher the partition criticality, the lower the latency tolerance of the computing units in the partition for the scheduled tasks; the lower the partition criticality, the higher the latency tolerance of the computing units in the partition for the scheduled tasks.
[0076] 5. Task dependency graph (TDG)
[0077] The task dependency graph is a representation form that can represent the relationship between tasks. The task dependency path can be determined through the task dependency graph, and the task dependency path can indicate the dependency relationship between tasks.
[0078] Generally, when tasks are generated, a task dependency graph may be generated. It should be understood that not all computing systems have a task dependency graph. Figure 1 , Figure 1 The tasks included in the task dependency graph are T0-T13, and the task dependency graph includes three task dependency paths, namely:
[0079] Path 1: T1→T3→T6→T11→T13
[0080] Path 2: T1→T4→T7→T8→T10→T12→T13
[0081] Path 3: T1→T5→T9
[0082] refer to Figure 1 In path 1, T3 depends on T1, T6 depends on T3, T11 depends on T6, and T13 depends on T11. In path 2, T4 depends on T1, T7 depends on T4, T8 depends on T7, T10 depends on T8, T12 depends on T10, and T13 depends on T12. In path 3, T5 depends on T1, and T9 depends on T5.
[0083] It should be noted that Figure 1 T0, T2 and T4 are independent tasks and do not depend on other tasks.
[0084] With the development of big data, the architecture of computing systems such as embedded computing systems, edge computing systems, cluster computing systems in data centers, high-performance computing (HPC) supercomputing systems, and cloud computing is becoming more and more complex. High-density interconnection, multi-core, many-core, and heterogeneous cores are the mainstream architectures of computing systems. Task scheduling for these computing systems faces many challenges.
[0085] One task scheduling method is: a scheduler (master scheduler) performs global task scheduling on the computing system. The scheduler needs to collect the operating status, bandwidth and other indicators of the processor (worker) through some interfaces, analyze the indicators, and schedule tasks according to the analysis results. In this task scheduling method, the need to collect indicators makes the task scheduling overhead relatively large, and in large-scale computing systems, the scheduler overhead is even greater. In addition, the scheduler may be overloaded, resulting in low scheduling efficiency, as well as unbalanced task scheduling and low resource utilization.
[0086] Another method of task scheduling is: parallel scheduling by the instruction-level scheduler (such as thread warp scheduler) originally contained in the processor in the computing system. This scheduling method is a static scheduling method, which relies on prior knowledge of task behavior (such as processing core consumption, task running time, memory access behavior), and the static scheduling method is not suitable for irregular tasks.
[0087] There is another task scheduling method: distributed task scheduling, such as distributed scheduling based on message passing interface (MPI). This distributed scheduling method is a coarse-grained scheduling method. The scheduling granularity of this task scheduling method is application (i.e., task scheduling at the application level). There is a problem of unbalanced task scheduling (i.e., unbalanced load), which makes the utilization rate of the resources of the computing system low.
[0088] In response to the above problems, an embodiment of the present application provides a task scheduling method, which divides multiple computing units of a computing system into multiple partitions, and configures a partition scheduler for each partition, the partition scheduler is used to schedule tasks within the partition, each partition includes multiple task queues with different priorities set based on task criticality, the task criticality is determined based on the delay tolerance of the computing unit running a task to the task, in this method, when it is determined that cross-partition task scheduling needs to be initiated according to the partition criticality of each partition, the second partition scheduler (the partition scheduler of the second partition) among the multiple partition schedulers can schedule the first task in the first task queue of the first partition to the computing unit in the second partition, and the computing unit in the second partition executes the first task of the first partition; and the first partition scheduler (the partition scheduler of the first partition) can schedule the task in the second task queue of the second partition to the computing unit in the first partition, and the computing unit in the first partition executes the second task of the second partition. In this way, the tasks of the entire computing system can be evenly scheduled (i.e., load balancing is achieved), thereby improving the resource utilization of the computing system.
[0089] Furthermore, in the embodiment of the present application, multiple computing units of the computing system are partitioned, multiple partitions are scheduled in parallel, and a partition scheduler is set for each partition to perform autonomous task scheduling within each partition, thereby realizing fine-grained task scheduling; for different partitions, cross-partition task scheduling can be performed when necessary to realize coarse-grained task scheduling. It can be seen that the task scheduling method provided in the embodiment of the present application can take into account both fine-grained and coarse-grained task scheduling, and the scheduling effect is better.
[0090] The task scheduling method provided in the embodiment of the present application is applied to a computing system, and the computing system can be a computing system of different scales, such as a small embedded system with a single processor, or a super-large system with more than 10 million cores, etc. Exemplarily, the computing system in the embodiment of the present application can be any of the following: a processor including multiple cores, a server including multiple processors (the multiple processors can be homogeneous processors and / or heterogeneous processors, and the processor can be a single-core or multi-core processor), a cabinet including multiple servers, or a cluster including multiple cabinets, etc.
[0091] For example, Figure 2 A schematic diagram of the architecture of a computing system is shown, Figure 2 As shown, the computing system includes multiple computing devices 200 (ie, computing nodes), and the multiple computing devices 200 can communicate with each other.
[0092] The computing device 200 may be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device 200 may also be a terminal device such as a desktop computer, a notebook computer, or a smart phone.
[0093] For example, continue to refer to Figure 2 The computing device 200 may include: one or more processors (eg Figure 2 200 ), a general purpose processor 201 and a heterogeneous processor 205, a memory 202, and a communication interface 203. The general purpose processor 201, the memory 202, the communication interface 203, and the heterogeneous processor 205 may be connected to each other via a bus 204, or in other ways. Optionally, the various components included in the computing device 200 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0094] The computing device may include one or more general-purpose processors 201, which are the control center of the computing device 200. The general-purpose processor 201 may be a CPU or other general-purpose processors, such as a microprocessor or any conventional processor. Optionally, the general-purpose processor 201 may include one or more processing cores.
[0095] The controller in the general processor 201 is the nerve center and command center of the computing device 200. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions. Optionally, a memory can also be set in the general processor 201 to store instructions and data.
[0096] The heterogeneous processor 205 is a processor that is heterogeneous with the general processor 201. For example, the heterogeneous processor 205 may include a graphics processing unit (GPU), a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), etc. The heterogeneous processor 205 may include one or more processing cores, and usually the heterogeneous processor 205 includes multiple processing cores.
[0097] The memory 202 includes, but is not limited to, a random access memory (RAM), a read only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, or an optical memory, a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer. In the embodiment of the present application, the memory 202 can store information such as computer instructions.
[0098] In a possible implementation, the memory 202 may exist independently of the processor (such as the general processor 201 or the heterogeneous processor 205). The memory 202 may be connected to the processor via the bus 204 for storing data, instructions or program codes. When the processor calls and executes the instructions or program codes stored in the memory, the relevant steps in the method provided in the embodiment of the present application can be implemented.
[0099] In another possible implementation, the memory 202 may also be integrated with the processor.
[0100] The communication interface 203 may be a transceiver module, which is used to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (WLAN), etc. The communication interface 203 may receive instructions, messages or data, etc. The transceiver module may be a device such as a transceiver or a transceiver. Optionally, the communication interface 203 may also be a transceiver circuit located in the processor, which is used to implement signal input and signal output of the processor. The communication interface 203 may be a wired interface (port), such as a fiber distributed data interface (FDDI), a gigabit Ethernet (GE) interface, or the communication interface 203 may also be a wireless interface.
[0101] The bus 204 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus may also be divided into a serial bus and a parallel bus. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0102] It should be noted that Figure 2 The computing device in the example is only one example of a computing device, which may have Figure 2 More or fewer components shown in the figure may be combined with two or more components, or may have different component configurations. For example, the computing device may also include an intelligent network card, such as a data processing unit (DPU).
[0103] The task scheduling method provided in the embodiment of the present application is executed by a scheduler. Optionally, the scheduler can be a hardware scheduler or a software scheduler, which is not limited in the embodiment of the present application.
[0104] In combination with the above content, it can be known that in the task scheduling method provided in the embodiment of the present application, multiple computing units in the computing system are partitioned, and the multiple computing units of the computing system are divided into multiple partitions. A partition scheduler (which can be called an L1 scheduler) is set for each partition. The partition scheduler has completely autonomous scheduling rights for the computing resources in the partition, and is used to autonomously schedule the tasks in the partition. The computing unit includes one or more processing cores of the processor. In the computing system, the multiple processing cores can be isomorphic processing cores and / or heterogeneous processing cores. Optionally, in some cases, for example, when the number of processing cores of the computing system is large (such as a multi-core computing system) and the number of partitions is large, a higher-level federal scheduler (which can be called an L2 scheduler) can be set on the basis of the partition scheduler. The federal scheduler is used to manage multiple partition schedulers, and the L2 scheduler performs task scheduling between two partitions according to the equilibrium state of multiple partitions (i.e., bilateral peer scheduling). In the case where the number of processing cores of the computing system is particularly large (such as a multi-core computing system), a federal scheduler (which can be called an L3 scheduler) can also be set at the upper level of the L2 scheduler.
[0105] Exemplary, reference Figure 3 In (a), in the computing system, the six computing units can be divided into a partition, and each partition corresponds to an L1 scheduler. Figure 3 In (b), six computing units are divided into a partition, and each partition has an L1 scheduler. Furthermore, when the number of partitions in the computing system is large, the number of L1 schedulers is also large. In this case, multiple L1 schedulers can also cascade an L2 scheduler, and the L2 scheduler manages multiple L1 schedulers. Figure 3 In (c), when the number of partitions in the computing system is particularly large, multiple L1 schedulers can be divided into multiple groups. Each group of L1 schedulers is cascaded with an L2 scheduler. At this time, there are multiple L2 schedulers in the computing system. When the number of L2 schedulers is relatively large, multiple L2 schedulers are cascaded with an L3 scheduler, and the L3 scheduler manages multiple L2 schedulers.
[0106] Optionally, a reasonable number of L1 schedulers are set according to the scale of the computing system and actual needs, and it is selected whether to cascade the L2 scheduler and L3 scheduler. Of course, as the scale of the computing system increases, one or more levels of schedulers can be cascaded on top of the L3 scheduler. The scheduler is set according to actual needs, and the embodiments of the present application are not limited thereto.
[0107] Combination Figure 3It can be seen that the L1 scheduler schedules the tasks in the partition according to the task criticality of the tasks in each partition to achieve autonomous scheduling within the partition (i.e., partition autonomy). Autonomous scheduling within the partition is a fine-grained task scheduling strategy; L2 manages multiple L1 schedulers, and initiates cross-partition task scheduling between two partitions (i.e., bilateral peer scheduling) when the difference in partition criticalities reported by the L1 scheduler is large; when an L3 scheduler is set up, multiple L2 schedulers continue to report multiple domain criticalities to the L3 scheduler (domain criticality is the criticality obtained by each L2 calling it to perform relevant operations on multiple partition criticalities collected by it, called domain criticality, which can also be understood as classifying multiple partitions into one domain). When the L3 scheduler determines that the difference in the criticalities of each domain is large, it determines to initiate cross-domain task scheduling between the two domains (the essence of cross-domain task scheduling here is also cross-partition task scheduling). The detailed process of the scheduling method will be introduced in the following embodiments.
[0108] refer to Figure 4 As shown in the architecture diagram of the computing system (including the hardware system and software system of the computing system), as a possible implementation method, when the above scheduler is in software form, the scheduler can be deployed in Figure 4 In the runtime software system. It can be understood that the runtime is the environment required by the program during execution, and the runtime can also be called the running environment or the execution environment.
[0109] The runtime software system may include a runtime host system and an application runtime system (the application runtime system is the environment for running applications). Optionally, the scheduler may be deployed in the host system in the runtime system, and the scheduler may be a scheduling application, so that the scheduling application may be loaded as a runtime service.
[0110] As a possible implementation method, when the above scheduler is in software form, the scheduler can be deployed in Figure 4 In the runtime library software module, it can be understood that the runtime library is the library file required by the program at runtime. The runtime library generally includes functions commonly used in programming, such as string operations, file operations, interfaces, etc. The runtime library can provide APIs that call and integrate the scheduler. Application developers can implement the functions of the scheduler by explicitly calling the API, or the compiler can automatically integrate the scheduler during the linking stage.
[0111] As a possible implementation method, when the above-mentioned scheduler is in hardware form, the scheduler can be deployed on the processing core in the computing system. In the embodiment of the present application, the scheduler is deployed in a local manner (deployed on the same server) as much as possible. This can reduce the bandwidth consumption of the task scheduling process and improve the efficiency of task scheduling.
[0112] The following examples introduce possible deployment methods of various schedulers for computing systems of several different sizes.
[0113] 1. Single processor computing system including multiple processing cores
[0114] In a single processor computing system with multiple processing cores, when partitioning, the processing cores are partitioned based on the granularity of the computing unit. A partition includes one or more processing cores.
[0115] In one implementation, the L1 scheduler of each partition can be deployed on any processing core in the partition. When the number of partitions is large, at least one L2 scheduler can also be deployed, and at least one L2 scheduler can be deployed on any one or more processing cores of the processor. This deployment method can make the scheduler more closely integrated with the multi-core, making the task scheduling more efficient.
[0116] For example, assuming that each partition includes two processing cores, for each partition, the L1 scheduler can be integrated into any processing core in the partition. Figure 5 (a) shows a deployment example of the L1 scheduler corresponding to the partition and a deployment example of the L2 scheduler (assuming that the computing system only deploys one L2 scheduler).
[0117] In another implementation, the L1 scheduler of each partition can be deployed on a dedicated processing core, that is, a dedicated processing core outside the partition is defined in a processor for deploying the scheduler, and the partition scheduler of each partition is deployed on the dedicated processing core. When the number of partitions of the computing system is large, the L2 scheduler can also be deployed on the dedicated processing core. In this deployment method, the process of task scheduling by the scheduler does not occupy the computing resources of the processing core in the partition, which is conducive to the smooth execution of tasks. In addition, the L1 scheduler and the L2 scheduler are located on the same processor, and the processing cores on the same processor are packaged together. The process of task scheduling is on-chip interaction, and the efficiency of task scheduling is high. Figure 5 (b) shows a deployment example of the L1 scheduler corresponding to the partition and a deployment example of the L2 scheduler (assuming that the computing system only deploys one L2 scheduler).
[0118] It is understandable that small computing systems with single-core multi-processors usually do not need to deploy L3 and higher-level schedulers.
[0119] 2. Single server computing system with multiple processors
[0120] In one implementation, in a single-server computing system with multiple processors, the deployment method of the L1 scheduler can be similar to the deployment method in the above-mentioned single-processor computing system with multiple processing cores, that is, the L1 scheduler is deployed on any processing core in each partition. The deployment method of the L2 scheduler can be similar to the deployment method in the above-mentioned single-processor computing system with multiple processing cores, and at least the L2 scheduler is deployed on any processing core of any one or more processors among the multiple processors. In this deployment method, the L1 scheduler and the L2 scheduler are deployed in the same server, and the efficiency of task scheduling is high. Figure 5 (a) shows a deployment example of the L1 scheduler corresponding to the partition and a deployment example of the L2 scheduler (assuming that the computing system only deploys one L2 scheduler).
[0121] In another implementation, the L1 scheduler of each partition may be deployed on a dedicated processor or dedicated processing core, and at least one L2 scheduler may also be deployed, and at least one L2 scheduler may also be deployed on a dedicated processor or dedicated processing core. Figure 5 (b) shows a deployment example of the L1 scheduler corresponding to the partition and a deployment example of the L2 scheduler (assuming that the computing system only deploys one L2 scheduler).
[0122] 3. Single rack computing system containing multiple servers
[0123] Similarly, in one implementation, in a single-cabinet computing system with multiple servers, the deployment method of the L1 scheduler can be similar to the deployment method in the above-mentioned single-processor computing system with multiple processing cores, that is, the L1 scheduler is deployed on any processing core in each partition. Multiple L1 schedulers and their corresponding L2 schedulers are deployed on the same server as much as possible, for example, deployed on any one or more processing cores of any one or more processors of the same server, so as to avoid cross-partition scheduling and cross-server scheduling, thereby improving the efficiency of task scheduling.
[0124] Optionally, in a single-cabinet computing system with multiple servers, when the number of L2 schedulers is relatively large, an L3 scheduler can also be deployed. When multiple L2 schedulers are deployed on the same server, multiple L2 schedulers and their corresponding L3 schedulers can be deployed on the same server as much as possible to avoid cross-server scheduling. If the computing system deploys only one L3 scheduler, the L3 scheduler can be deployed on any processing core of any processor in any server. Figure 7 The diagram shows a deployment example of an L1 scheduler, a deployment example of an L2 scheduler, and a deployment example of an L3 scheduler corresponding to a partition (assuming that the computing system deploys only one L3 scheduler and each server deploys one L2 scheduler).
[0125] In another implementation, in some cases, for example, the L1 scheduler and its corresponding L2 scheduler and L3 scheduler cannot be deployed on the same server, and when the computing system includes a management server, the L2 scheduler and L3 scheduler can be deployed on the management server. Figure 8 A deployment example of an L2 scheduler and a deployment example of an L3 scheduler are shown (assuming that the computing system deploys only one L3 scheduler).
[0126] In another implementation, when each server has a DPU network card, the L2 scheduler or L3 scheduler can also be deployed on the processing core of the DPU network card. The DPU computing power can be used to fully accelerate task scheduling, thus saving the processing core resources of the server. Fig. 9 A deployment example of an L2 scheduler and a deployment example of an L3 scheduler are shown (assuming that the computing system deploys only one L3 scheduler).
[0127] It is understandable that a single-server computing system with multiple processors generally does not need to deploy L3 and higher-level schedulers.
[0128] Based on the above description of technical terms, system architecture, etc., the task scheduling method provided by the embodiment of the present application is described in detail below. It can be understood that the embodiment of the present application proposes a strategy for partitioning the computing units in the computing system, based on which task scheduling includes partition autonomous task scheduling and cross-partition task scheduling.
[0129] The plurality of computing units in the computing system include processing cores of one or more processors. The plurality of processors include a heterogeneous first processor and / or a second processor. The first processor may be, for example, the above-mentioned Figure 2 The general purpose processor 201 in the second processor may be, for example, Figure 2 The heterogeneous processor 205 in.
[0130] For example, in a homogeneous multi-core computing system (homogeneous means that the computing system contains one type of processor, such as only CPU), suppose for a server containing 4 CPUs with 48 cores, the 48 cores in the server are divided into 8 partitions, namely {P0, P1,......., P7}, and each partition contains 24 processing cores.
[0131] For another example, in a heterogeneous multi-core computing system (heterogeneous means that the computing system contains at least two different types of processors, such as a CPU and a GPU), suppose a server contains a heterogeneous processor with one 48-core CPU and four 128-core GPUs, and the processor cores in the server are divided into 10 partitions, namely {P0, P1,......., P9}, where the 48-core CPU is divided into two partitions, each partition contains 24 processing cores, and the four 128-core GPUs are divided into 8 partitions, each partition contains 64 processing cores.
[0132] Optionally, in an embodiment of the present application, a partition vector may be used to identify a partition, and a partition vector of a partition may be represented as a vector P, where P = (n, p, t, e0, e1, ...), and the embodiment of the present application does not limit the dimension of the partition vector. The partition vectors of multiple partitions of the computing system may form a matrix. The meanings of the elements in the partition vector are shown in Table 1 below.
[0133] Table 1
[0134]
[0135]
[0136] For processor index, in some cases, some computing systems, such as computing systems with big.LITTLR architecture, include large cores and small cores in one processor, and the same processor can be divided into two different types according to the characteristics of the core. Alternatively, logically, one processor can also virtualize two different types of processors. For example, the CPU can be divided into different types according to whether it has vector expansion capability or matrix expansion capability.
[0137] The extended index can be added according to actual needs. For example, e0 can be used to indicate the grouping index of the processing cores in the multi-core processor. The extended index can also include an index indicating a task timeout coefficient, a queue idle coefficient, and the like.
[0138] The multi-dimensional index based on the partition vector can obtain the topological information of the computing system, so as to determine the task routing of the entire computing system; and provide task routing information when scheduling cross-partition tasks to achieve bilateral scheduling nearby, such as trying to perform cross-partition scheduling of two partitions in the same server and the same cabinet, reducing the peer-to-peer scheduling of two partitions across servers and cabinets, and reducing the overhead caused by cross-node scheduling. In some practical applications, the partition vector can be provided to developers to explicitly call resources. Since the partition vector contains the computing node index and the processor type index, it can be directly used for heterogeneous programming and distributed programming calls.
[0139] Combination Figure 3 In (a), the method for scheduling tasks within each of the multiple partitions of the computing system is the same. The following embodiment takes one partition as an example to introduce the process of scheduling tasks within the partition. The main idea of scheduling tasks within the partition is to schedule tasks based on the criticality of the tasks within the partition using a scheduling strategy of a multi-level queue. Fig.10 As shown, the task scheduling method provided in the embodiment of the present application includes S901-S903.
[0140] S901. The partition scheduler determines the initial task criticality of the acquired task.
[0141] It can be understood that the tasks to be processed by the processing cores in the partition include multiple tasks. After the scheduler starts to obtain each task, it determines the task criticality of the initial state (i.e., the initial task criticality) for each task. During the task processing process, the task criticality of each task may change dynamically.
[0142] For a detailed introduction to task criticality and how to determine task criticality, please refer to the technical terminology section above, which will not be repeated here.
[0143] Combination Fig.10 ,like Fig.11 As shown, in one implementation, a method for a partition scheduler to determine an initial task criticality of a task (one task or multiple tasks) includes S9011-S9012.
[0144] S9011. The partition scheduler obtains task dependencies between multiple tasks in the partition.
[0145] In the embodiment of the present application, the task dependency relationship between tasks can be obtained through the task dependency graph of the computing system, and the task dependency path can be obtained through the task dependency graph. According to the task dependency path, it can be known which tasks have dependencies, how the tasks are dependent on each other, and the task dependency depth. For an introduction to the task dependency graph, please refer to Figure 1 And description of related technical terms.
[0146] S9012. The partition scheduler determines initial task criticalities of the multiple tasks respectively according to the task dependency depths indicated by the task dependency relationships.
[0147] The task dependency depth can be understood as the position of a task in the task dependency path to which it belongs (a task may have multiple task dependency paths).
[0148] For example, refer to the above Figure 1In the task dependency graph shown, among the three task dependency paths, T1 is located in path 1 (T1→T3→T6→T11→T13), path 2 (T1→T4→T7→T8→T10→T12→T13) and path 3 (T1→T5→T9) at the same time. The task dependency depth of T1 in path 1 is 4, the task dependency depth of T1 in path 2 is 6, and the task dependency depth of T1 in path 3 is 2.
[0149] Specifically, the process of determining the initial task criticality of multiple tasks respectively according to the task dependency depth is:
[0150] First, analyze the task dependency graph to obtain the attribute parameter of the task, which is the task dependency depth, and use the bottom-level (BL) algorithm to determine the maximum path depth in the dependency path where the task is located. For example, the above T1 is located in different task dependency paths, and the task dependency paths are 4, 6 and 2 respectively. Then the task dependency depth of T1 should be selected as 6 to determine the initial task criticality of T1. It can be understood that Figure 1 The value in the circle corresponding to each task is the determined task dependency depth.
[0151] Secondly, the initial task criticality of the task is determined according to the maximum value of the task dependency depth.
[0152] In one implementation, assuming that the initial task criticality of the task is also determined by the binary formula, the initial task criticality (C p ) can be:
[0153]
[0154] Among them, Dpath is the maximum value of the task dependency depth of the task. When the maximum value of the task dependency depth is greater than or equal to the second threshold, the initial task criticality is 1 (high task criticality). When the maximum value of the task dependency depth is less than the second threshold, the initial task criticality is 0 (low task criticality).
[0155] In summary, the embodiments of the present application can set an initial task criticality for a task according to a task dependency graph, and the initial task criticality is a static value determined when the task is generated.
[0156] In one implementation, when the task dependencies of some tasks cannot be obtained (the computing system has no task dependency graph or it is known from the dependency graph that some tasks are independent tasks and do not depend on other tasks), the initial task criticality of the task is set to the lowest task criticality, that is, the task is assumed to be a low-latency task (such as a computing task). For example, referring to the introduction of the concept of task criticality in the above embodiment, when the value of the task criticality is determined by a binary formula, that is, the task criticality includes 0 and 1, for new tasks, the task criticality can be set to a low task criticality of 0. Reference Figure 1 , Figure 1 T0, T2 and T4 are independent tasks, so the initial task criticality of T0, T2 and T4 can be set to 0.
[0157] S902: The partition scheduler determines an initial queue for the task from queues of multiple different priorities of the partition according to the criticality of the initial task.
[0158] In an embodiment of the present application, multiple task queues with different priorities are set for each partition. When the processing core runs tasks, the tasks in each queue are executed in order from high to low priority. For tasks in the same queue, the processing core adopts a round robin strategy to run the tasks.
[0159] Exemplary, reference Fig.12 As shown in the task queue, each partition can include 4 task queues with different priorities, namely Q L0 , Q L1 , Q L2 , Q L3 , the priority of the queue increases in sequence, queue Q L3 The tasks in T a and T b , queue Q L2 The task in T c , queue Q L0 The task in T d According to the priority of the task queue, when executing a task, the queue with the highest priority Q is executed first. L3 For tasks in queue Q L3 T a and T b , adopting the round-robin scheduling strategy, that is, executing T a , consumed as T a After the allocated time slice, execute T b , consumed as T b After the allocated time slice, execute T a , or other tasks in the queue; then, execute queue Q L2 Tc ; Finally, execute queue Q L0 T d .
[0160] In the embodiment of the present application, the time slice of the processing core is dynamically allocated to the task according to the queue priority from high to low, and the number of time slices corresponding to different task queues is different, and the number of time slices corresponding to the task queue decreases as the priority of the task queue increases. Optionally, the number of time slices corresponding to the above-mentioned multiple task queues with different priorities maintains a multiple relationship.
[0161] For example, referring to the above Fig.12 The four priority task queues shown in the figure have a time slice number corresponding to them, which is denoted as Quantum_Q. L0 、Quantum_Q L1 、Quantum_Q L2 、Quantum_Q L3 , then the quantity relationship of the time slices corresponding to the four task queues satisfies: Quantum_Q L3 <Quantum_Q L2 <Quantum_Q L1 <Quantum_Q L0 .
[0162] In the embodiment of the present application, tasks are placed in task queues of different priorities according to the criticality of the tasks, that is, the task criticality of the above-mentioned tasks is used to determine the task queue to which the tasks belong (the queues or task queues in the following embodiments all refer to the queues of tasks, which are the same concept). It can also be understood that tasks in task queues of different priorities have different processing priorities, the priority of a task is related to the level of the task criticality of the task, and tasks in the same task queue have the same processing task priority.
[0163] It should be understood that as the criticality of a task increases, the priority of the task queue to which the task belongs increases, that is, when the task criticality of a task increases, the task is moved to a queue with a higher priority, and when the task criticality of a task decreases, the task is moved to a queue with a lower priority.
[0164] In one implementation, there may be a corresponding relationship between the task criticality of a task and the priority of a task queue. For example, the task criticality includes four levels, and the task queue also includes four task queues of different priorities. Then, based on the corresponding relationship between the task criticality and the priority, the task is divided into the task queue corresponding to the task criticality.
[0165] In another implementation, if the task criticality is in binary form (i.e., the high task criticality of 1 and the low task criticality of 0 mentioned above), when a new task is acquired, the task is divided into the corresponding queue according to the initial criticality of the task. When the initial task criticality is the high task criticality of 1, the task is divided into the task queue with the highest priority (e.g., the Quantum_Q L3 ); When the initial task criticality is low task criticality 0, the task is assigned to the task queue with the lowest priority (such as the Quantum_Q L0 ).
[0166] Optionally, in the embodiment of the present application, the tasks in the task queue may be tasks of the same application or tasks of multiple applications, without specific limitation.
[0167] Combined with the above description of task criticality, task queue and time slice, it can be seen that the higher the priority of the task queue, the fewer time slices corresponding to the queue, the higher the task criticality of the tasks in the queue, and the lower the delay tolerance for processing and checking tasks.
[0168] S903: During the process of the computing unit executing the task, the partition scheduler updates the queue to which the task belongs, so that the processing core executes the task according to the priority of the queue to which the task belongs.
[0169] In the embodiment of the present application, during the task scheduling process, the task criticality of the task and the execution status of the task may change. For example, if a task consumed more time slices (in the computing state) at the previous moment, but consumed less time slices (in the memory access state) at the current moment, the task criticality of the task increases. For another example, if a task consumed less time slices (in the memory access state) at the previous moment, but consumed more time slices (in the computing state) at the current moment, the task criticality of the task decreases.
[0170] In one implementation, combining Fig.10 ,like Fig.13 As shown, the process of the partition scheduler updating the queue to which the task belongs includes S9031-S9032.
[0171] S9031. Update the task criticality of the task.
[0172] It is understandable that during the execution of a task, the criticality of the task may change, for example, the task may switch between memory access operations and computing operations. The criticality of a task is determined based on the time slice consumed by the task and the waiting time of the processing core, that is, based on the latency tolerance of the processing core for the task.
[0173] S9032. Update the queue to which the task belongs according to the task criticality of the task.
[0174] In an embodiment of the present application, task criticality is the basis for determining whether to switch queues for a task. Taking a task as an example, when the task criticality of the task increases, the partition scheduler moves the task from the current queue to a queue with a higher priority than the current queue; when the task criticality of the task decreases, the partition scheduler moves the task from the current queue to a queue with a lower priority than the current queue.
[0175] In some embodiments, a task is associated with the ID of the processing core to which it was initially assigned, and time slices of the same processing core are preferentially allocated. When a task encounters a cache miss and initiates memory access, the latency of the task increases, causing the criticality of the task to increase. The task is then moved into a high priority queue and scheduled for execution with priority.
[0176] Optionally, when the task criticality increases, the task is moved into a high-priority task queue step by step, and when the task criticality decreases, the task is moved into a low-priority task queue step by step. L1 If the criticality of the task increases, the task will be removed from queue Q L1 Move to queue Q L2 In the process of task execution, if the criticality of the subsequent task continues to increase, the task will be moved from Q L2 Move to queue Q L3 middle.
[0177] In another implementation, the queue to which the above update task belongs may also include the following situations.
[0178] Case 1: When the time slice corresponding to the task is consumed and the task has not finished running, the partition scheduler moves the task from the current queue to a queue with a lower priority than the current queue.
[0179] In the embodiment of the present application, the time slice corresponding to the task has been consumed, but the task has not been completed, indicating that the computing resources required to run the task are insufficient. Since the low-priority queues correspond to more time slices, the task is moved from the current queue to a queue with a lower priority than the current queue. The task can obtain more computing resources, which can ensure that the task runs quickly and improve the efficiency of task scheduling. Furthermore, switching tasks among the queues in the partition according to the running status of the task can improve the overall resource utilization of the processing cores in the partition.
[0180] Case 2: When the task waiting timeout is serious, the partition scheduler moves the task from the current queue to a queue with a higher priority than the current queue.
[0181] In the embodiment of the present application, when the task in the low-priority queue waits for timeout, it means that the task in the low-priority queue cannot be allocated to computing resources (i.e., time slices) in time, and starvation occurs. The task is moved from the current queue to a queue with a higher priority than the current queue, so that the task timeout in the partition can be alleviated and the task can run smoothly. Furthermore, switching tasks among the queues in the partition according to the running status of the task can improve the resource utilization of the processing core in the partition.
[0182] Case 3: When the time slice corresponding to the task queue has not been consumed and the processing core executing the task is released, the queue to which the task belongs remains unchanged.
[0183] The process of task scheduling within the partition described in S901-S903 above is a dynamic scheduling process based on task criticality. The partition scheduler of each partition performs autonomous task scheduling for the partition based on the task criticality of the tasks within the partition. The scheduling granularity is finer, so that the task scheduling within the partition is balanced, which can improve the resource utilization of the processing core within the partition; and for each task, the overhead required to obtain the task criticality is small, which can significantly reduce the scheduling overhead required for task scheduling.
[0184] Furthermore, compared with the static scheduling method, the queue is updated according to the task criticality in the embodiment of the present application, which does not rely on prior knowledge and does not require any Profiling performance collection data, thereby greatly simplifying development and engineering optimization.
[0185] The process of cross-partition task scheduling is described in detail below. The main idea of cross-partition task scheduling is: based on the partition criticality of each partition, determine whether it is necessary to initiate cross-partition task scheduling. If cross-partition task scheduling is required, the partition schedulers of the two partitions to be cross-partitioned perform cross-partition task scheduling.
[0186] Optionally, when the number of partitions of the computing system is small (for example, the number of partitions is less than or equal to 4), when cross-partition task scheduling is performed between partitions, the cross-partition task scheduling is performed by point-to-point negotiation between the partition schedulers, without the need to cascade the upper-level federal scheduler (i.e., L2 scheduler). When the number of partitions of the computing system is large (for example, the number of partitions is greater than 4), a higher-level federal scheduler (i.e., L2 scheduler) can be cascaded, and the L2 scheduler aggregates the criticality of each partition and determines whether to initiate cross-partition task scheduling, and determines between which two partitions to perform cross-partition task scheduling.
[0187] For scenarios where tasks are scheduled across partitions, such as Fig.14 As shown, the task scheduling method provided in the embodiment of the present application includes S1201-S1206.
[0188] S1201. Determine a partition criticality of each partition of a plurality of partitions of a computing system.
[0189] The partition criticality is used to indicate the latency tolerance of the computing units within the partition for the scheduled tasks, and the partition criticality is the basis for determining whether to switch the task across partition queues (ie, the basis for whether to schedule the task across partitions).
[0190] In an embodiment of the present application, the partition criticality of each partition is determined by the partition scheduler corresponding to the partition. The partition criticality is the proportion of the number of processing cores whose core criticality values are greater than the first threshold among the core criticalities of multiple processing cores in a partition, and the core criticality is determined based on the latency tolerance of the processing core to the task running on the processing core. For details on the process of determining the partition criticality, please refer to the description of the partition criticality in the above technical terminology introduction, which will not be repeated here.
[0191] S1202: Calculate criticality differences of the multiple partitions according to the partition criticalities of the multiple partitions.
[0192] The criticality difference is used to indicate the difference between the partition criticalities of multiple partitions. The criticality difference of multiple partitions can measure whether the task scheduling in the entire computing system is balanced.
[0193] In one implementation, when there is no L2 scheduler in the computing system, after the partition scheduler of each partition determines the partition criticality, multiple partition schedulers communicate point-to-point to transmit the partition criticality of each partition they manage, so that each partition scheduler can summarize the partition criticality of all partitions, and then one of the schedulers or multiple schedulers calculate the criticality difference of multiple partitions based on the multiple partition criticalities. For example, the criticality difference of multiple partitions can be calculated by the partition schedulers corresponding to the partition with the highest and lowest partition criticality, and whether to initiate cross-partition task scheduling is determined based on the criticality difference.
[0194] In another implementation, when an L2 scheduler exists in the computing system, the L2 scheduler can calculate the criticality difference of multiple partitions. The L2 scheduler obtains the partition criticality of each of the multiple partitions from the partition scheduler (i.e., the L2 scheduler summarizes the partition criticality of all partitions in the computing system), and calculates the criticality difference of the multiple partitions based on the multiple partition criticalities, and then determines whether it is necessary to initiate cross-partition task scheduling based on the criticality difference.
[0195] Optionally, a method for the L2 scheduler to summarize the partition criticalities of all partitions may be: the partition scheduler of each partition reports the partition criticality of the partition it manages to the L2 scheduler respectively.
[0196] Optionally, another method for the L2 scheduler to summarize the partition criticality of all partitions may be: using a Ring-All Reduce algorithm to summarize the partition criticality of multiple partitions. Fig.15 , Assume that the computing system includes n partitions, the partitions are numbered from 0 to n-1, the n partitions are recorded as partition 0 to partition n-1, and the n partition schedulers corresponding to the n partitions are recorded as scheduler L1_0 to scheduler L1_n-1 respectively. The partition schedulers of multiple partitions use the Ring-All Reduce algorithm to transfer partition criticality.
[0197] For example, Fig.13 Scheduler L1_0 in the partition 0 partition criticality C partition {0} is reported to scheduler L1_1, and scheduler L1_1 aggregates the partition criticality of partition 0 and the partition criticality of partition 1 to obtain C partition {0,1}, and reports it to scheduler L1_2; scheduler L1_2 summarizes the partition criticality of partition 0, the partition criticality of partition 1, and the partition criticality of partition 2 to obtain C partition {0,1,2}, and reports it to the next L1 scheduler; and so on, scheduler L1_n-2 receives C sent by scheduler L1_n-3 partition {0,1,2,n-3}, then the previous partition criticality is summed up with the partition criticality of partition n-2 to get C partition {0,1,2,n-2}, and report it to scheduler L1_n-1; finally, scheduler L1_n-1 summarizes the received partition criticality with the partition criticality of partition n-1 to obtain C partition {0,1,2,n-1}, and report it to the upper-level L2 scheduler.
[0198] The Ring-All Reduce algorithm is an efficient method for information aggregation. Using this method to aggregate partition criticality to the L2 scheduler can save the amount of data for summarizing partition criticality and reduce overhead.
[0199] Optionally, the criticality difference of the above-mentioned multiple partitions is the covariance of the criticality of the multiple partitions. The covariance calculation formula of the criticality of the multiple partitions is as follows:
[0200]
[0201]
[0202]
[0203] Among them, COV represents the criticality difference, σ represents the covariance of the partition criticality, C represents the mean of the partition criticality, and Ci represents the partition criticality of partition i, and n represents the number of partitions in the computing system.
[0204] S1203: When the criticality difference of multiple partitions is greater than a second threshold, determine that cross-partition task scheduling needs to be initiated.
[0205] It should be understood that when the criticality of multiple partitions differs greatly, it means that for the entire computing system, the global task scheduling is unbalanced, that is, the load is unbalanced. In other words, when the criticality of multiple partitions differs greatly, there are some partitions in the computing system with sufficient computing resources and some partitions with insufficient computing resources. Therefore, cross-partition task scheduling can be used to make the tasks between the partitions be evenly scheduled.
[0206] When it is determined that cross-partition task scheduling needs to be initiated, the following S1204 - S1205 are executed to complete the cross-partition task scheduling.
[0207] S1204: The second partition scheduler corresponding to the second partition moves the task in the first task queue of the first partition among the multiple partitions to the task queue of the second partition among the multiple partitions, so that the computing unit in the second partition processes the task.
[0208] S1205. The first partition scheduler corresponding to the first partition moves the task in the task queue of the second partition among the multiple partitions into the task queue of the first partition, so that the computing unit in the first partition processes the task.
[0209] The first partition and the second partition are two partitions from the multiple partitions of the computing system that need to perform cross-partition task scheduling, that is, two partitions that need to perform bilateral peer scheduling. Among the multiple partitions, the difference in partition criticality between the first partition and the second partition is the largest, for example, the first partition is the partition corresponding to the partition criticality with the largest median value of the multiple partition criticalities, and the second partition is the partition corresponding to the partition criticality with the smallest median value of the multiple partition criticalities. The first task queue is the queue with the highest priority among the multiple task queues of the first partition, and the second task queue is the queue with the lowest priority among the multiple task queues of the second partition.
[0210] Optionally, the method for determining the first partition and the second partition from multiple partitions includes the following two implementation manners.
[0211] In one implementation, when there is no L2 scheduler in the computing system, when cross-partition task scheduling needs to be initiated, each partition scheduler can obtain the partition criticality of all partitions. Therefore, each partition scheduler can determine whether the partition in which it is located is the partition with the highest or lowest partition criticality, and then the two partition schedulers corresponding to the partition with the highest partition criticality and the partition with the lowest partition criticality interact to obtain tasks from each other's task queue to the local task queue.
[0212] For example, a computing system includes four partitions (partition 1, partition 2, partition 3, and partition 4), the partition with the highest partition criticality is partition 1, and the partition with the lowest partition criticality is partition 4. After the partition scheduler of partition 1 obtains the partition criticalities of the four partitions, the partition scheduler of partition 1 can determine that partition 1 with the highest partition criticality is the first partition based on the four partition criticalities; similarly, after the partition scheduler of partition 4 obtains the partition criticalities of the four partitions, the partition scheduler of partition 4 can determine that partition 4 with the lowest partition criticality is the second partition based on the four partition criticalities.
[0213] In another implementation, when an L2 scheduler exists in the computing system, when it is necessary to initiate cross-partition task scheduling, the L2 scheduler determines the partition with the highest partition criticality from multiple partitions as the first partition, and determines the partition with the lowest partition criticality as the second partition, and the L2 scheduler sends bilateral scheduling instructions to the first partition scheduler and the second partition scheduler respectively, and the bilateral scheduling instructions are used to instruct cross-partition task scheduling of the first partition and the second partition.
[0214] In an embodiment of the present application, after the L2 scheduler summarizes the partition criticalities of all partitions, it determines the partition with the highest partition criticality as the first partition, and determines the partition with the lowest partition criticality as the second partition; and the L2 scheduler sends a first bilateral scheduling instruction to the L1 scheduler of the first partition, the first bilateral scheduling instruction instructs the first partition and the second partition to perform cross-partition scheduling, and the second bilateral scheduling instruction may include first indication information, and the first indication information is used to indicate that the first partition is the partition with the highest partition criticality; the L2 scheduler sends a second bilateral scheduling instruction to the second partition criticality of the second partition, the second bilateral scheduling instruction instructs the first partition and the second partition to perform cross-partition scheduling, and the second bilateral scheduling instruction may include second indication information, and the second indication information is used to indicate that the second partition is the partition with the lowest partition criticality; then, the first partition scheduler and the second partition scheduler interact to obtain tasks from each other's task queue to the local task queue.
[0215] The above-mentioned second partition scheduler moves the tasks in the first task queue (the task queue with the highest priority) of the first partition into the task queue of the second partition, and the task is processed by the processing core of the second partition (in order to distinguish it from other tasks, this task is referred to as the first task below); and the first scheduler moves the tasks in the second task queue (the task queue with the lowest priority) of the second partition into the task queue of the first partition, and the task is processed by the processing core of the first partition (the task is referred to as the second task below).
[0216] Optionally, the first task is the task at the end of the first task queue of the first partition. After the second partition scheduler receives the bilateral scheduling instruction, the second partition scheduler does not receive new tasks first, but first obtains the first task from the first task queue of the first partition, and moves the first task to the task queue with the highest priority in the task queue of the second partition.
[0217] Optionally, the second task is the task at the end of the second task queue of the second partition. The first partition scheduler moves the second task to the task queue with the lowest priority in the task queue of the first partition.
[0218] In some embodiments, if the first partition and the second partition to be scheduled for cross-partition tasks share memory or cache, then during the cross-partition task scheduling process, the second partition can move the first task in the first partition to any queue in the task queue of the second partition, which does not cause additional memory access and reduces overhead.
[0219] In some embodiments, if the first partition and the second partition to be scheduled for cross-partition tasks have no shared memory, for the second partition, the first task is a new task, and data needs to be prepared before the new task is executed, so there is a memory access operation. In this case, the second partition will preferentially move the first task in the first partition to the high-priority queue of the second partition.
[0220] Exemplary, reference Fig.16 , Assume that the task queue of the first partition includes four queues with different priorities. The four queues from low to high priority are Q L0 , Q L1 , Q L2 , Q L3 The task queue of the second partition also includes four queues with different priorities. The four queues from low to high priority are Q' L0 , Q' L1 , Q' L2 , Q' L3 When cross-partition task scheduling is required, and the criticality of the task in the first partition is higher than that of the task in the second partition, the second partition scheduler selects the task with the highest priority Q from the task queue of the first partition.L3 Get task T a , and the task T a Move to the task queue with the highest priority in the second partition, Q' L3 and the first partition scheduler obtains task T from the lowest priority Q0 in the task queue of the second partition i , and the task T i Move to the lowest priority task queue Q' in the first partition L0 middle.
[0221] Based on the above description, in the process of cross-partition task scheduling, a partition with high partition criticality obtains tasks from a low-priority queue of a partition with low partition criticality, which can reduce the criticality of the high partition; a partition with low partition criticality obtains tasks from a high-priority queue of a partition with high partition criticality, which can increase the criticality of the low partition, thereby reducing the difference between the partition criticalities of the two partitions and achieving balanced task scheduling between the two partitions.
[0222] It should be noted that in some cases, the difference between the partition criticalities of various partitions of the computing system is small (that is, the difference in criticality of multiple partitions is less than the second threshold), but there are some partitions whose task timeouts are very serious (such as a very high task timeout coefficient). At this time, the task scheduler of other partitions can obtain the timed-out tasks (task delay exceeds the threshold) from the task queue of the partition with task timeout and move them to the high-priority queue. In this way, the problem of task timeout can be solved.
[0223] Optionally, in an embodiment of the present application, for a heterogeneous multi-core computing system, when cross-partition task scheduling is performed, cross-partition task scheduling can be performed between partitions with the same processor type, and cross-partition task scheduling can also be performed between partitions with different processor types.
[0224] For example, for a computing system of heterogeneous processors including a 48-core CPU (the CPU also has vector processing or matrix processing functions) and four 128-core GPUs, the processor cores are divided into 10 partitions, namely {P0, P1, ..., P9}, where the 48-core CPU is divided into two partitions, namely P0 and P1, each partition contains 24 processing cores, and the four 128-core GPUs are divided into 8 partitions, namely P2 to P9, each partition contains 64 processing cores. When scheduling tasks across partitions, cross-partition scheduling can be performed between P0 and P1, cross-partition scheduling can be performed between P2 to P9, and cross-partition task scheduling can also be performed between partitions divided by heterogeneous processors, for example, cross-partition task scheduling can be performed between P1 and P2.
[0225] It should be noted that when cross-partition task scheduling is performed between partitions divided by heterogeneous processors, it is necessary to generate machine code modules suitable for processor class 1 (such as CPU) and processor class 2 (GPU) to run the same task through a heterogeneous compiler, that is, two executable libraries suitable for processor class 1 (CPU) and processor class 2 (GPU) are pre-compiled. For example, for task 1, it is necessary to pre-compile executable library 1 for the CPU to execute task 1 and executable library 2 for the GPU to execute task 1. When task 1 is originally executed by the CPU of the partition P1, task 1 is executed based on executable library 1. When P1 and P2 perform cross-partition task scheduling, task 1 is subsequently executed by the GPU of partition 2. When the GPU executes task 1, task 1 is executed based on executable library 2, thereby realizing task scheduling across heterogeneous cores and improving the processing core utilization rate of the computing system.
[0226] S1206: When the criticality difference is less than or equal to the second threshold, each partition scheduler performs intra-partition task scheduling for each partition.
[0227] It should be understood that when the criticality differences of multiple partitions are small, it means that for the entire computing system, the global task scheduling is relatively balanced, there is no need to perform cross-partition task scheduling, and autonomous task scheduling is performed within each partition.
[0228] The detailed description of the task scheduling within the partition can refer to the detailed description of S901-S903 and related contents in the above embodiment, which will not be repeated here.
[0229] Based on the above content, the task scheduling method provided in the embodiment of the present application is a dynamic task scheduling method, which can partition the computing system and perform autonomous task scheduling within the partition, thereby improving the resource utilization of the processing cores within the partition; when the criticality of each partition is greatly different, cross-partition task scheduling is performed, which can improve the resource utilization of the computing system.
[0230] Furthermore, the task scheduling method is applicable to various regular or irregular tasks and has good generalization. For example, for various types of CPU parallel tasks, whether they are computationally intensive, memory-intensive, complex task dependencies, or complex control flows (such as QR decomposition, Cholesky decomposition, Heat Diffusion, etc.), balanced parallel operation is achieved among multi-core processors, and the overall performance of the computing system is improved.
[0231] Optionally, in an embodiment of the present application, in a many-core computing system, the computing system has many partitions, the L1 scheduler cascades multiple L2 schedulers, and multiple L2 schedulers can also cascade L3 schedulers. The L2 scheduler and L3 scheduler are responsible for coarse-grained balanced task scheduling, and coarser-grained scheduling is achieved through L3 scheduling.
[0232] Exemplarily, a computing system includes multiple computing nodes, each computing node includes multiple processors, and each processor includes multiple processing cores. In this case, an L1 scheduler manages partitions of multiple cores, an L2 scheduler manages multiple L1 schedulers (equivalent to an L2 scheduler managing multiple partitions, and these multiple partitions can be defined as a domain), and an L3 scheduler manages multiple L2 schedulers (equivalent to an L3 scheduler managing multiple domains of the computing system). Optionally, a domain can be a cabinet. For example, multiple servers (for example, 8) can be defined as a cabinet, and one L2 is responsible for managing multiple servers. When the number of cabinets is large, an L3 scheduler is cascaded on top of multiple L2 schedulers, and the L3 scheduler is responsible for the global scheduling of the computing system.
[0233] Each L1 caller is responsible for scheduling tasks within the partition it manages according to the task criticality; after the L1 scheduler determines the partition criticality, it reports the partition criticality to the L2 scheduler, and the L2 scheduler determines whether cross-partition task scheduling is required between the multiple partitions managed by the L2 scheduler based on the aggregated multiple partition criticalities; further, each L2 scheduler can determine the domain criticality of the domain managed by the L2 scheduler based on the multiple partition criticalities it collects, and report the domain criticality to the L3 scheduler, and the L3 scheduler determines the difference between the domain criticalities of the multiple domains managed by the L3 caller based on the aggregated multiple domain criticalities, and determines whether cross-domain task scheduling is required.
[0234] The above-mentioned method for determining and reporting domain criticality may be similar to the above-mentioned method for determining and reporting partition criticality. The method for the L3 scheduler to determine the difference between domain criticalities may also be similar to the process for the L2 scheduler to determine the difference between partition criticalities. Please refer to the relevant description in the above embodiments for details.
[0235] In the embodiment of the present application, when the L3 scheduler determines that the difference between the multiple domain criticalities exceeds a threshold value based on the multiple domain criticalities, it is determined that cross-domain task scheduling is required, and the L3 scheduler determines two domains with larger differences between the domain criticalities from the multiple domains, and then selects a partition from each of the two domains, and then performs cross-partition task scheduling between the two partitions. For example, a partition with the largest partition criticality is selected from the domain with the largest domain criticality (referred to as the first target partition), and a partition with the smallest partition criticality is selected from the domain with the smallest domain criticality (referred to as the second target partition), and then indicates that cross-partition task scheduling is performed between the first target partition and the second target partition.
[0236] The L1 scheduler, L2 scheduler, and L3 scheduler are responsible for scheduling at different granularities in the computing system, which can make the task scheduling of the computing system more balanced and improve the resource utilization of the computing system.
[0237] The present application also provides a computing system, such as Fig.17 As shown, the computing system includes multiple partition schedulers, each partition scheduler includes a determination module 1701 and a scheduling module 1702, the determination module 1702 is used to execute S901, S9012, S902, S1203 in the above method embodiment, and the scheduling module 1702 is used to execute S903 (including S9031-S9032), S1201, S1204, S1205 in the above method embodiment.
[0238] Optionally, each of the multiple partition schedulers includes a calculation module 1703 and an acquisition module 1704, the calculation module 1703 is used to execute S1202 in the above method embodiment, and the acquisition module 1704 is used to execute S9012 in the above method embodiment.
[0239] Optionally, the computing system further includes a federated scheduler, which is used to manage multiple partition schedulers, and the federated scheduler includes an acquisition module 1705, a calculation module 1706, a determination module 1707, and a sending module 1708. Among them, the acquisition module 1705 is used to acquire the partition criticality of multiple partitions, the calculation module 1706 is used to calculate the criticality difference of each partition, the determination module 1707 is used to determine whether to initiate cross-partition task scheduling, and the sending module 1708 is used to send a bilateral scheduling instruction to the partition scheduler.
[0240] For more details on how the above modules implement the above functions, please refer to the descriptions in the previous method embodiments, which will not be repeated here. The various embodiments in this specification are described in a progressive manner, and the same and similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments.
[0241] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) mode or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).
[0242] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0243] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0244] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0245] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0246] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, or all or part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk, and other media that can store program codes.
[0247] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A task scheduling method, characterized in that: The method is used for scheduling tasks for a computing system, the computing system comprising a plurality of computing units, the plurality of computing units being divided into a plurality of partitions, each of the plurality of partitions corresponding to a partition scheduler, each partition comprising a plurality of task queues with different priorities set based on task criticality, the task criticality being determined based on the latency tolerance of a computing unit running a task to the task; the method comprising: Determine a partition criticality of each of the plurality of partitions, the partition criticality being used to indicate a latency tolerance of a computing unit within the partition to a scheduled task; When it is determined that cross-partition task scheduling needs to be initiated according to the partition criticality of each partition in the multiple partitions, the second partition scheduler moves the task in the first task queue of the first partition in the multiple partitions to the task queue of the second partition in the multiple partitions, so that the computing unit in the second partition processes the task; the second partition scheduler is the partition scheduler corresponding to the second partition; The first partition scheduler moves tasks in the second task queue of the second partition among the multiple partitions into the task queue of the first partition so that the computing unit in the first partition processes the tasks; the first partition scheduler is the partition scheduler corresponding to the first partition; the priority of the first task queue is different from the priority of the second task queue.
2. The method according to claim 1, characterized in that The plurality of computing units include processing cores of one or more processors; wherein the one or more processors include a heterogeneous first processor and / or a second processor.
3. The method according to claim 1 or 2, characterized in that: The partition criticality is the proportion of the number of processing cores whose core criticality values are greater than a first threshold among the core criticalities of multiple processing cores in a partition; the core criticality is determined based on the latency tolerance of the processing core to the task running on the processing core.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Calculating a criticality difference among the plurality of partitions according to the partition criticalities of the plurality of partitions; the criticality difference is used to indicate a difference between the plurality of partition criticalities of the plurality of partitions; When the criticality difference is greater than a second threshold, determining that cross-partition task scheduling needs to be initiated; When the criticality difference is less than or equal to the second threshold, each of the partition schedulers schedules the tasks in each partition.
5. The method according to any one of claims 1 to 4, characterized in that: The multiple partitions correspond to a federated scheduler, and the federated scheduler is used to manage the multiple partition schedulers; Determining the partition criticality of each of the plurality of partitions includes: The federated scheduler obtains the partition criticality of each of the plurality of partitions from the partition scheduler; The method further comprises: When the federated scheduler determines that cross-partition task scheduling needs to be initiated according to the partition criticality of each partition in the multiple partitions, the federated scheduler determines the first partition and the second partition from the multiple partitions; wherein the first partition is the partition corresponding to the partition criticality with the largest value among the multiple partition criticalities, and the second partition is the partition corresponding to the partition criticality with the smallest value among the multiple partition criticalities; The federated scheduler sends a bilateral scheduling instruction to the first partition scheduler and the second partition scheduler respectively; the bilateral scheduling instruction is used to instruct to perform cross-partition task scheduling on the first partition and the second partition.
6. The method according to claim 5, characterized in that The priority of the task queue increases with the increase of the criticality of the task, and the number of time slices allocated to queues of different priorities is different; the criticality of the task increases with the decrease of the delay tolerance of the processing core to the task; The first task queue is a queue with the highest priority among the task queues of the first partition, and the second task queue is a queue with the lowest priority among the task queues of the second partition.
7. The method according to any one of claims 1 to 6, characterized in that: Each of the partition schedulers schedules tasks in each partition, including: For any one of the multiple tasks in each partition, during the process of the computing unit executing the task, the partition scheduler updates the queue to which the task belongs, so that the processing core executes the task according to the priority of the queue to which the task belongs.
8. The method according to claim 7, characterized in that The updating of the queue to which the task belongs includes: updating the task criticality of the task; According to the task criticality of the task, the queue to which the task belongs is updated; wherein, when the task criticality of the task increases, the partition scheduler moves the task from the current queue to a queue with a priority higher than the priority of the current queue; when the task criticality of the task decreases, the partition scheduler moves the task from the current queue to a queue with a priority lower than the priority of the current queue.
9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Each of the partition schedulers obtains task dependencies between multiple tasks in a partition; The partition scheduler determines the initial task criticalities of the plurality of tasks respectively according to the task dependency depths indicated by the task dependency relationships; The partition scheduler determines initial queues for the multiple tasks respectively from queues of different priorities of the partition according to the initial task criticalities of the multiple tasks.
10. A computing system, characterized in that: The method comprises a plurality of partition schedulers, wherein the plurality of computing units of the computing system are divided into a plurality of partitions, each of the plurality of partitions corresponds to a partition scheduler, and each partition comprises a plurality of task queues with different priorities set based on task criticality, wherein the task criticality is determined based on the latency tolerance of a computing unit running a task to the task; Each partition scheduler includes a determination module and a scheduling module; A determination module of each of the plurality of partition schedulers, configured to determine a partition criticality of each of the plurality of partitions, wherein the partition criticality is used to indicate a latency tolerance of a computing unit within the partition to a scheduled task; a scheduling module of the second partition scheduler, configured to, when it is determined that cross-partition task scheduling needs to be initiated according to the partition criticality of each partition among the multiple partitions, move tasks in a first task queue of a first partition among the multiple partitions to a task queue of a second partition among the multiple partitions, so that a computing unit in the second partition processes the tasks; The second partition scheduler is a partition scheduler corresponding to the second partition; The scheduling module of the first partition scheduler is used for, when it is determined that cross-partition task scheduling needs to be initiated according to the partition criticality of each partition of the multiple partitions, moving tasks in the second task queue of a second partition of the multiple partitions into the task queue of the first partition, so that the computing unit in the first partition processes the tasks; The first partition scheduler is a partition scheduler corresponding to the first partition; the priority of the first task queue is different from the priority of the second task queue.
11. The computing system according to claim 10, characterized in that: The plurality of computing units include processing cores of one or more processors; wherein the one or more processors include a heterogeneous first processor and / or a second processor.
12. The computing system according to claim 10 or 11, characterized in that: The partition criticality is the proportion of the number of processing cores whose core criticality values are greater than a first threshold among the core criticalities of multiple processing cores in a partition; the core criticality is determined based on the latency tolerance of the processing core to the task running on the processing core.
13. The computing system according to any one of claims 10 to 12, characterized in that: Each of the plurality of partition schedulers comprises a computing module; The calculation module of the partition scheduler is used to calculate the criticality difference of the multiple partitions according to the partition criticality of the multiple partitions; The criticality difference is used to indicate the difference between the plurality of partition criticalities of the plurality of partitions; The determination module of the partition scheduler is further used to determine that cross-partition task scheduling needs to be initiated when the criticality difference is greater than a second threshold; The scheduling module of the partition scheduler is used to schedule the tasks in each partition when the criticality difference is less than or equal to the second threshold.
14. The computing system according to any one of claims 10 to 12, characterized in that: The computing system further includes a federated scheduler, the multiple partitions correspond to one federated scheduler, and the federated scheduler is used to manage the multiple partition schedulers; the federated scheduler includes an acquisition module, a calculation module, a determination module, and a sending module; The acquisition module of the federated scheduler is used to acquire the partition criticality of each of the multiple partitions from the partition scheduler; The calculation module of the federated scheduler is used to calculate the criticality difference of the plurality of partitions according to the partition criticalities of the plurality of partitions; The criticality difference is used to indicate the difference between the plurality of partition criticalities of the plurality of partitions; The determination module of the federated scheduler is configured to determine the first partition and the second partition from the multiple partitions when it is determined that cross-partition task scheduling needs to be initiated when the criticality difference is greater than a second threshold; wherein the first partition is the partition corresponding to the partition criticality with the largest median value of the multiple partition criticalities, and the second partition is the partition corresponding to the partition criticality with the smallest median value of the multiple partition criticalities; The sending module of the federated scheduler is used to send bilateral scheduling instructions to the first partition scheduler and the second partition scheduler respectively; the bilateral scheduling instructions are used to instruct to perform cross-partition task scheduling on the first partition and the second partition.
15. The computing system according to claim 14, characterized in that: The priority of the task queue increases with the increase of the criticality of the task, and the number of time slices allocated to queues of different priorities is different; the criticality of the task increases with the decrease of the delay tolerance of the processing core to the task; The first task queue is a queue with the highest priority among the task queues of the first partition, and the second task queue is a queue with the lowest priority among the task queues of the second partition.
16. The computing system according to any one of claims 10 to 15, characterized in that: The scheduling module of each partition scheduler is specifically used to update the queue to which any one of the multiple tasks in each partition belongs during the process of the computing unit executing the task, so that the processing core executes the task according to the priority of the queue to which the task belongs.
17. The computing system according to claim 16, characterized in that: A scheduling module is specifically used to update the task criticality of the task; and update the queue to which the task belongs according to the task criticality of the task; wherein, when the task criticality of the task increases, the partition scheduler moves the task from the current queue to a queue with a priority higher than the priority of the current queue; when the task criticality of the task decreases, the partition scheduler moves the task from the current queue to a queue with a priority lower than the priority of the current queue.
18. The computing system according to any one of claims 10 to 17, characterized in that: Each partition scheduler also includes an acquisition module; An acquisition module of each partition scheduler is used to acquire task dependencies between multiple tasks in a partition; The determination module of each partition scheduler is also used to determine the initial task criticality of the multiple tasks respectively according to the task dependency depth indicated by the task dependency relationship; and according to the initial task criticality of the multiple tasks, determine the initial queues for the multiple tasks respectively from the multiple queues of different priorities of the partition.
19. A computing device, characterized in that The method comprises a memory and at least one processor connected to the memory, wherein the memory is used to store computer program code, and the computer program code comprises computer instructions. When the computer instructions are executed by at least one processor, the computing device executes the method according to any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that: Computer instructions are stored, and when the computer instructions are executed on a computer, the method according to any one of claims 1 to 9 is executed.
Citation Information
Cited By
Task scheduling method and apparatus, and computing system
EP4804023A1
Task scheduling method and apparatus, and computing system
WO2025091933A1