A task scheduling system, method, apparatus, device and medium
By introducing components such as task prefetching components and hardware schedulers into the chip, tasks are rationally allocated to heterogeneous units, solving the problems of low resource utilization and scheduling efficiency, and improving the chip's computing power.
Patent Information
- Application Number
- CN202310998074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-08
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2043-08-08
AI Technical Summary
In existing technologies, task scheduling schemes in chips suffer from low resource utilization and scheduling efficiency, which seriously affects computing power.
The system employs a task prefetching component, a hardware scheduler, a hardware resource management component, an instruction scheduling component, and an instruction packet distribution component. The hardware scheduler splits tasks into subtasks and rationally allocates subtasks to available heterogeneous units for processing based on the resource status of the heterogeneous units.
It improves resource utilization and scheduling efficiency in the chip's task scheduling process, thereby enhancing computing power.
Smart Images

Figure CN116974767B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a task scheduling system, method, apparatus, device, and medium. Background Technology
[0002] Typically, a chip contains multiple heterogeneous units for executing computational instructions. These heterogeneous units include, but are not limited to, a predetermined number of computation engines, data engines, general-purpose processors, and image / video processing units. A large number of computational tasks are generated within the chip. During chip operation, these computational tasks need to be scheduled, and the computational instructions within these tasks are executed through the heterogeneous units.
[0003] In related technologies, a common task scheduling scheme involves using on-chip scheduling software to break down computational tasks into multiple subtasks that can be processed independently. Each subtask is then assigned to a heterogeneous unit, which executes the computational instructions within the subtask. However, during the scheduling process, the scheduling software frequently experiences scheduling delays. Furthermore, the scheduling software cannot reasonably and accurately assign each subtask to an available heterogeneous unit based on its resource status, resulting in low resource utilization and scheduling efficiency, severely impacting the chip's computing power. Summary of the Invention
[0004] This invention provides a task scheduling system, method, apparatus, device, and medium to address the problem that task scheduling schemes in related technologies have low resource utilization and scheduling efficiency, which seriously affect the computing power of chips.
[0005] According to one aspect of the present invention, a task scheduling system is provided, comprising: a task prefetching component, a hardware scheduler, a hardware resource management component, an instruction scheduling component, an instruction packet distribution component, and at least one heterogeneous unit;
[0006] The task prefetching component is used to monitor the task queue and store the tasks to be processed in the task queue to the local storage space of the hardware scheduler.
[0007] The hardware scheduler is configured to: after obtaining a divisible target task from the pending tasks, split the target task into multiple target sub-tasks based on the task information of the target task; obtain the resource status of each heterogeneous unit from the hardware resource management component, and determine the available heterogeneous units for each target sub-task based on the task information of each target sub-task and the resource status of each heterogeneous unit; send heterogeneous unit application requests corresponding to the available heterogeneous units of each target sub-task to the hardware resource management component; after receiving a successful application notification from the hardware resource management component, generate heterogeneous unit pre-preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target sub-task based on the task information and available heterogeneous units of each target sub-task; send the heterogeneous unit pre-preparation instructions and heterogeneous unit startup instructions corresponding to each target sub-task to the instruction scheduling component; and after receiving an instruction completion notification from the instruction scheduling component, send the task instruction packages corresponding to each target sub-task to the instruction package distribution component.
[0008] The hardware resource management component is used to manage the resource status of each heterogeneous unit; after receiving a heterogeneous unit application request corresponding to an available heterogeneous unit of each target subtask, it sends a successful application message or a failed application message to the hardware scheduler according to the resource status of each heterogeneous unit.
[0009] The instruction scheduling component is used to, after receiving the heterogeneous unit pre-preparation instruction and heterogeneous unit start instruction corresponding to each target subtask, perform data transfer according to the heterogeneous unit pre-preparation instruction corresponding to each target subtask, control the start of available heterogeneous units of each target subtask according to the heterogeneous unit start instruction corresponding to each target subtask, and after the available heterogeneous units of each target subtask are started, feed back instruction completion prompt information to the hardware scheduler.
[0010] The instruction packet distribution component is used to send the task instruction packet corresponding to each target subtask to the available heterogeneous unit of each target subtask after receiving the task instruction packet corresponding to each target subtask.
[0011] Each of the target subtasks has a available heterogeneous unit for executing the task instruction packet after receiving it.
[0012] According to another aspect of the present invention, a task scheduling method is provided, applied to a hardware scheduler in a task scheduling system as described in any embodiment of the present invention, comprising:
[0013] After obtaining the divisible target task from the pending tasks, the target task is divided into multiple target sub-tasks according to the task information of the target task.
[0014] The resource status of each heterogeneous unit is obtained from the hardware resource management component, and the available heterogeneous units of each target subtask are determined based on the task information of each target subtask and the resource status of each heterogeneous unit.
[0015] The heterogeneous unit request corresponding to the available heterogeneous units of each of the target sub-tasks is sent to the hardware resource management component;
[0016] After receiving the application success notification from the hardware resource management component, based on the task information of each target subtask and the available heterogeneous units of each target subtask, a heterogeneous unit pre-preparation instruction, a heterogeneous unit start instruction, and a task instruction package corresponding to each target subtask are generated.
[0017] Send the heterogeneous unit preparation instructions and heterogeneous unit start instructions corresponding to each of the target sub-tasks to the instruction scheduling component;
[0018] After receiving the instruction completion prompt from the instruction scheduling component, the task instruction package corresponding to each target subtask is sent to the instruction package distribution component.
[0019] According to another aspect of the present invention, a task scheduling apparatus is provided, comprising:
[0020] The task splitting module is used to split the target task into multiple target subtasks based on the task information of the target task after obtaining the splittable target task from the tasks to be processed.
[0021] The scheduling decision module is used to obtain the resource status of each heterogeneous unit from the hardware resource management component, and determine the available heterogeneous units of each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit.
[0022] The resource request module is used to send heterogeneous unit request requests corresponding to the available heterogeneous units of each target subtask to the hardware resource management component;
[0023] The information generation module is used to generate heterogeneous unit pre-preparation instructions, heterogeneous unit start instructions, and task instruction packages corresponding to each target subtask based on the task information of each target subtask and the available heterogeneous units of each target subtask after receiving the application success prompt information from the hardware resource management component.
[0024] The instruction sending module is used to send the heterogeneous unit preparation instruction and heterogeneous unit start instruction corresponding to each of the target sub-tasks to the instruction scheduling component;
[0025] The instruction packet sending module is used to send the task instruction packet corresponding to each of the target subtasks to the instruction packet distribution component after receiving the instruction completion prompt information fed back by the instruction scheduling component.
[0026] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0027] At least one processor;
[0028] and a memory communicatively connected to the at least one processor;
[0029] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the task scheduling method described in any embodiment of the present invention.
[0030] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the task scheduling method described in any embodiment of the present invention.
[0031] In the technical solution of this invention embodiment, after obtaining a divisible target task from the tasks to be processed through a hardware scheduler, the target task is divided into multiple target sub-tasks according to the task information of the target task. Then, the hardware scheduler obtains the resource status of each heterogeneous unit from the hardware resource management component. Based on the task information of each target sub-task and the resource status of each heterogeneous unit, the available heterogeneous units of each target sub-task are determined, and the heterogeneous unit application requests corresponding to the available heterogeneous units of each target sub-task are sent to the hardware resource management component. After receiving the application success prompt information from the hardware resource management component, based on the task information of each target sub-task and the available heterogeneous units of each target sub-task, heterogeneous unit pre-preparation instructions, heterogeneous unit start instructions, and task instruction packages corresponding to each target sub-task are generated. The heterogeneous unit pre-preparation instructions and heterogeneous unit start instructions corresponding to each target sub-task are sent to the instruction scheduling component, so that the instruction scheduling component performs data processing according to the heterogeneous unit pre-preparation instructions corresponding to each target sub-task. The process involves controlling the startup of available heterogeneous units for each target subtask based on the startup instructions corresponding to those subtasks. Upon receiving a completion notification from the instruction scheduling component, the process sends task instruction packets corresponding to each target subtask to the instruction packet distribution component. This allows the instruction packet distribution component to distribute these packets to the available heterogeneous units of each target subtask. The available heterogeneous units of each target subtask then execute the task instruction packets to process and complete the subtasks. This addresses the problem of low resource utilization and scheduling efficiency in related technologies, which severely impacts chip computing power. The process achieves the goal of splitting computational tasks generated within the chip into multiple independently processable subtasks. It automatically and accurately allocates each subtask to an available heterogeneous unit based on task information and the resource status of each heterogeneous unit within the chip, thereby improving resource utilization and scheduling efficiency, and ultimately enhancing the chip's computing power.
[0032] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1This is a schematic diagram of a task scheduling system provided in Embodiment 1 of the present invention.
[0035] Figure 2 This is a flowchart of a task scheduling method provided in Embodiment 2 of the present invention.
[0036] Figure 3 This is a schematic diagram of a task scheduling device provided in Embodiment 3 of the present invention.
[0037] Figure 4 A schematic diagram of the structure of an electronic device for implementing the task scheduling method of this embodiment of the invention. Detailed Implementation
[0038] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0039] It should be noted that the terms "target," "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising," "including," and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0040] Example 1
[0041] Figure 1 This is a schematic diagram of a task scheduling system provided in Embodiment 1 of the present invention. This embodiment is applicable to situations involving the scheduling of computational tasks. Figure 1 As shown, the task scheduling system may specifically include: a task prefetching component 101, a hardware scheduler 102, a hardware resource management component 103, an instruction scheduling component 104, an instruction packet distribution component 105, and at least one heterogeneous unit 106. Its structure and function are described below.
[0042] The task prefetching component 101 is used to monitor the task queue and store the tasks to be processed in the task queue to the local storage space of the hardware scheduler 102.
[0043] The hardware scheduler 102 is configured to, after obtaining a divisible target task from the tasks to be processed, divide the target task into multiple target sub-tasks according to the task information of the target task; obtain the resource status of each heterogeneous unit 106 from the hardware resource management component 103, and determine the available heterogeneous units of each target sub-task according to the task information of each target sub-task and the resource status of each heterogeneous unit 106; send heterogeneous unit application requests corresponding to the available heterogeneous units of each target sub-task to the hardware resource management component 103; and upon receiving the... After the hardware resource management component 103 sends a successful application notification, it generates heterogeneous unit preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target subtask based on the task information of each target subtask and the available heterogeneous units of each target subtask. The heterogeneous unit preparation instructions and heterogeneous unit startup instructions corresponding to each target subtask are then sent to the instruction scheduling component 104. After receiving an instruction completion notification from the instruction scheduling component 104, the task instruction packages corresponding to each target subtask are sent to the instruction package distribution component 105.
[0044] The hardware resource management component 103 is used to manage the resource status of each heterogeneous unit 106; after receiving a heterogeneous unit application request corresponding to an available heterogeneous unit of each target subtask, it sends a successful application message or a failed application message to the hardware scheduler 102 according to the resource status of each heterogeneous unit 106.
[0045] The instruction scheduling component 104 is used to, after receiving the heterogeneous unit pre-preparation instruction and heterogeneous unit start instruction corresponding to each target subtask, perform data transfer according to the heterogeneous unit pre-preparation instruction corresponding to each target subtask, control the start of available heterogeneous units of each target subtask according to the heterogeneous unit start instruction corresponding to each target subtask, and after the available heterogeneous units of each target subtask are started, feed back instruction completion prompt information to the hardware scheduler 102.
[0046] The instruction packet distribution component 105 is used to send the task instruction packet corresponding to each target subtask to the available heterogeneous unit of each target subtask after receiving the task instruction packet corresponding to each target subtask.
[0047] Each of the target subtasks has a available heterogeneous unit for executing the task instruction packet after receiving it.
[0048] Optionally, the task prefetching component 101 monitors the task queue and stores the tasks to be processed in the task queue into the local storage space of the hardware scheduler 102. The hardware scheduler 102 is a hardware component set in the chip for scheduling computing tasks. The hardware scheduler 102 sequentially retrieves one computing task from each computing task in the tasks to be processed stored in the local storage space according to the order of task storage time. The task storage time can be the time when the computing task is stored in the local storage space. After retrieving the divisible target task from the tasks to be processed stored in the local storage space, the hardware scheduler 102 splits the target task into multiple target subtasks according to the task information of the target task. Then, the hardware scheduler 102 retrieves the resource status of each heterogeneous unit 106 from the hardware resource management component 103, and determines the available heterogeneous units for each target subtask according to the task information of each target subtask and the resource status of each heterogeneous unit 106. Hardware scheduler 102 sends heterogeneous unit request requests corresponding to the available heterogeneous units of each target subtask to hardware resource management component 103. Upon receiving the heterogeneous unit request requests, hardware resource management component 103, based on the resource status of each heterogeneous unit 106, sends a success message or failure message to hardware scheduler 102. Upon receiving the success message from hardware resource management component 103, hardware scheduler 102, based on the task information and available heterogeneous units of each target subtask, generates heterogeneous unit preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target subtask. Hardware scheduler 102 sends the heterogeneous unit preparation instructions and heterogeneous unit startup instructions corresponding to each target subtask to instruction scheduling component 104. After receiving the heterogeneous unit preparation instructions and heterogeneous unit start instructions corresponding to each target subtask, the instruction scheduling component 104 performs data transfer according to the heterogeneous unit preparation instructions and controls the start of available heterogeneous units for each target subtask according to the heterogeneous unit start instructions. After the available heterogeneous units of each target subtask are started, the instruction scheduling component 104 sends instruction completion prompt information back to the hardware scheduler 102. After receiving the instruction completion prompt information from the instruction scheduling component 104, the hardware scheduler 102 sends the task instruction packet corresponding to each target subtask to the instruction packet distribution component 105. After receiving the task instruction packet corresponding to each target subtask, the instruction packet distribution component 105 sends the task instruction packet corresponding to each target subtask to the available heterogeneous units of each target subtask.After receiving the task instruction packet, the available heterogeneous units of each target subtask execute the task instruction packet to process each target subtask and complete each target subtask.
[0049] Optionally, the task prefetching component 101 is a component within the chip used to monitor the task queue and store the tasks to be processed in the task queue to the local storage space of the hardware scheduler 102. The task queue is a queue within the chip used to store tasks to be processed. Tasks to be processed are one or more unprocessed computational tasks. The local storage space of the hardware scheduler 102 is a storage space used to store data needed by the hardware scheduler 102. The task prefetching component 101 can monitor whether there are tasks to be processed in the task queue. After detecting the presence of tasks to be processed in the task queue, it stores the tasks to be processed in the task queue to the local storage space of the hardware scheduler 102, so that the hardware scheduler 102 can retrieve the unprocessed computational tasks from the tasks to be processed stored in the local storage space and schedule the unprocessed computational tasks.
[0050] Optionally, the task prefetching component 101 can use a hardware queue synchronization unit for task prefetching. On the task dispatch path, the task prefetching component 101 monitors the read / write pointers of the task queue to detect any unprocessed new computational tasks. It then moves these unprocessed tasks to the local storage space of the hardware scheduler 102, reducing the latency of the task scheduling system acquiring tasks dispatched by the business software. Multiple hardware paths can also be configured within the task scheduling system to prefetch information stored in local storage space to a cache space and maintain consistency, further reducing task acquisition latency. The task scheduling system has multiple task dispatch and result return paths between heterogeneous units. General-purpose processors and heterogeneous units can store tasks to be dispatched and return results to be received in remote storage units. The task scheduling system can acquire tasks and return results by reading and writing the contents of this storage unit. However, this path requires traversing multiple bus levels, resulting in high read / write latency. To reduce the latency of task command acquisition and result return and improve the efficiency of the scheduling system, a hardware queue synchronization unit is used for task prefetching.
[0051] Optionally, each of the heterogeneous units 106 refers to a plurality of heterogeneous units disposed in the chip for executing computational instructions. Each of the heterogeneous units 106 may include a preset number of computation engines, data engines, general-purpose processors, and image / video processing units. The heterogeneous unit 106 can be a computation engine, data engine, general-purpose processor, or image / video processing unit. Correspondingly, the type of the heterogeneous unit 106 is a computation engine, data engine, general-purpose processor, or image / video processing unit. The identification information of the heterogeneous unit 106 is information used to uniquely identify the heterogeneous unit 106. The identification information of the heterogeneous unit 106 may be a numerical number corresponding to the heterogeneous unit 106.
[0052] Optionally, a divisible target task is a computational task that can be broken down into multiple subtasks that can be processed independently. The divisible target task can be stored in the task queue by the business software within the chip. The business software within the chip is the software configured within the chip to implement a specified business function. During operation, the business software generates the divisible target task and then stores the divisible target task and its task information in the task queue. This allows the hardware scheduler 102 to, upon receiving the divisible target task, split it into multiple subtasks that can be processed independently. Based on the task information of each subtask and the resource status of each heterogeneous unit, each subtask is assigned to an available heterogeneous unit for processing, thereby completing the divisible target task.
[0053] Optionally, a decomposable target task comprises multiple sets of computational instructions that can be executed independently. Each set of computational instructions contains one or more computational instructions. Each set of computational instructions can be executed independently by a heterogeneous unit of a specified type. The task information of the target task includes the identification information, priority information, heterogeneous unit type, and data storage address of each set of computational instructions. The identification information of each set of computational instructions is used to uniquely identify each set of computational instructions. The identification information of each set of computational instructions can be a numerical code corresponding to each set of computational instructions. The priority information of each set of computational instructions can be a numerical value used to characterize the importance of each set of computational instructions. The heterogeneous unit type of each set of computational instructions is the type of heterogeneous unit used to execute each set of computational instructions. The heterogeneous unit type of each set of computational instructions can be a computing engine, a data engine, a general-purpose processor, or an image / video processing unit. The data storage address of each set of computational instructions is the storage address of the data required during the execution of each set of computational instructions.
[0054] Optionally, the hardware scheduler 102, based on the task information of the target task, divides the target task into multiple target subtasks. This includes: the hardware scheduler 102 determining each group of computation instructions in the target task based on the identification information of each group of computation instructions in the task information of the target task, identifying each group of computation instructions as a target subtask, and obtaining multiple target subtasks, thereby dividing the target task into multiple target subtasks. Each target subtask is a subtask that can be processed independently. The hardware scheduler 102 determines the identification information, priority information, heterogeneous unit type, and data storage address of each group of computation instructions as the task information of each target subtask.
[0055] Optionally, the hardware resource management component 103 is a hardware component set in the chip for managing the resource status of each heterogeneous unit 106 and updating the resource status of each heterogeneous unit 106 stored in the hardware resource management component 103 according to the heterogeneous unit application request or heterogeneous unit return request corresponding to each heterogeneous unit 106.
[0056] Optionally, the hardware resource management component 103 stores the resource status of each of the heterogeneous units 106. The resource status of the heterogeneous unit 106 is information used to characterize whether the heterogeneous unit 106 is executing computation instructions. The resource status of the heterogeneous unit 106 is either idle or active. An idle resource status indicates that the heterogeneous unit 106 is not executing computation instructions. An active resource status indicates that the heterogeneous unit 106 is executing computation instructions. The hardware scheduler 102 establishes a communication connection with the hardware resource management component 103 and can exchange information based on the established communication connection. The hardware scheduler 102 can obtain the resource status of each of the heterogeneous units 106 from the hardware resource management component 103.
[0057] Optionally, the hardware scheduler 102 obtains the resource status of each heterogeneous unit 106 from the hardware resource management component 103, and determines the available heterogeneous units of each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit 106. This includes: the hardware scheduler 102 determining each idle heterogeneous unit among the heterogeneous units 106 based on the resource status of each heterogeneous unit 106; the hardware scheduler 102 determining the heterogeneous unit type of each target subtask based on the task information of each target subtask; and the hardware scheduler 102 determining the available heterogeneous units of each target subtask among the idle heterogeneous units based on the priority information and heterogeneous unit type of each target subtask.
[0058] Optionally, the hardware scheduler 102 determines each idle heterogeneous unit among the heterogeneous units 106 based on the resource status of each heterogeneous unit 106, including: the hardware scheduler 102 determines the heterogeneous units among the heterogeneous units 106 whose resource status is idle as idle heterogeneous units, thereby determining each idle heterogeneous unit among the heterogeneous units 106. An idle heterogeneous unit is a heterogeneous unit 106 that is not executing computation instructions.
[0059] Optionally, the hardware scheduler 102 determines the heterogeneous unit type of each target subtask based on the task information of each target subtask, including: the hardware scheduler 102 extracts the heterogeneous unit type of each target subtask from the task information of each target subtask.
[0060] Optionally, the hardware scheduler 102 determines the available heterogeneous units for each target subtask in each idle heterogeneous unit according to the priority information and heterogeneous unit type of each target subtask, including: the hardware scheduler 102 sorts each target subtask according to the priority information of each target subtask, and then determines the available heterogeneous units for each target subtask in each idle heterogeneous unit according to the priority information and heterogeneous unit type of each target subtask.
[0061] Optionally, the priority information of each group of computation instructions can be a numerical value used to characterize the importance of each group of computation instructions. The hardware scheduler 102 sorts the target subtasks from high to low according to the priority information, and then, starting from the target subtask ranked first, determines the available heterogeneous units for each target subtask in each idle heterogeneous unit according to the priority information and heterogeneous unit type of each target subtask.
[0062] Optionally, for each target subtask, the following operations are performed: Among the remaining idle heterogeneous units, query for idle heterogeneous units of the same type as the target subtask; randomly select one idle heterogeneous unit from among the idle heterogeneous units of the same type as the target subtask, and use it as a usable heterogeneous unit for the target subtask. The remaining idle heterogeneous units are all idle heterogeneous units that have not yet been determined as usable heterogeneous units for other target subtasks. The usable heterogeneous units of the target subtask are heterogeneous units 106 used to execute the computation instructions contained in the target subtask.
[0063] Optionally, the heterogeneous unit request corresponding to the specified heterogeneous unit is a request to use the specified heterogeneous unit to execute computation instructions. The hardware scheduler 102 stores a heterogeneous unit request template. This template is used to generate the heterogeneous unit request corresponding to the specified heterogeneous unit. The heterogeneous unit request template is a heterogeneous unit request that does not contain the identification information of the specified heterogeneous unit. After adding the identification information of the specified heterogeneous unit to the identification information addition position in the heterogeneous unit request template, the heterogeneous unit request corresponding to the specified heterogeneous unit can be obtained. The identification information addition position in the heterogeneous unit request template is the position in the template used to add the identification information of the specified heterogeneous unit.
[0064] Optionally, the hardware scheduler 102 adds the identification information of the available heterogeneous units of each target subtask to the identification information addition position in the heterogeneous unit application request template, obtains the heterogeneous unit application request corresponding to the available heterogeneous units of each target subtask, and then sends the heterogeneous unit application request corresponding to the available heterogeneous units of each target subtask to the hardware resource management component 103.
[0065] Optionally, after receiving a heterogeneous unit application request corresponding to an available heterogeneous unit for each of the target subtasks, the hardware resource management component 103 sends a successful application message or a failed application message to the hardware scheduler 102 based on the resource status of each heterogeneous unit 106.
[0066] Optionally, based on the resource status of each heterogeneous unit 106, a successful application message or a failed application message is sent to the hardware scheduler 102. This includes: determining whether the resource status of the available heterogeneous units of each target subtask stored in the hardware resource management component 103 is idle; if the resource status of the available heterogeneous units of each target subtask is idle, it indicates that the available heterogeneous units of each target subtask can be used to execute new computation instructions, that is, the heterogeneous unit requested by the hardware scheduler 102 can be used to execute new computation instructions, then a successful application message is sent to the hardware scheduler 102, and the resource status of the available heterogeneous units of each target subtask stored in the hardware resource management component 103 is updated to working; if there are available heterogeneous units with a working resource status among the available heterogeneous units of each target subtask, it indicates that there are heterogeneous units among the available heterogeneous units of each target subtask that cannot be used to execute new computation instructions, that is, the heterogeneous unit requested by the hardware scheduler 102 cannot be used to execute new computation instructions, then a failed application message is sent to the hardware scheduler 102. The successful application message is a message set in the hardware resource management component 103 to indicate that the heterogeneous unit requested by the hardware scheduler 102 can be used to execute new computing instructions. The failed application message is a message set in the hardware resource management component 103 to indicate that the heterogeneous unit requested by the hardware scheduler 102 cannot be used to execute new computing instructions.
[0067] Optionally, after receiving the application success notification from the hardware resource management component 103, the hardware scheduler 102 determines that all available heterogeneous units of each target subtask can be used to execute new computing instructions, and generates heterogeneous unit pre-preparation instructions, heterogeneous unit start instructions, and task instruction packages corresponding to each target subtask based on the task information of each target subtask and the available heterogeneous units of each target subtask.
[0068] Optionally, based on the task information of each target subtask and the available heterogeneous units of each target subtask, a heterogeneous unit pre-preparation instruction, a heterogeneous unit startup instruction, and a task instruction package corresponding to each target subtask are generated, including: performing the following operations for each target subtask: determining the data storage address of the target subtask based on the task information of the target subtask; generating a heterogeneous unit pre-preparation instruction corresponding to the target subtask based on the data storage address and the address of the cache area of the available heterogeneous units of the target subtask; wherein, the heterogeneous unit pre-preparation instruction is used to instruct the instruction scheduling component to perform the operation of moving the original data of the target subtask from the data storage address to the cache area of the available heterogeneous units of the target subtask; generating a heterogeneous unit startup instruction corresponding to the target subtask based on the identification information of the available heterogeneous units of the target subtask; wherein, the heterogeneous unit startup instruction is used to instruct the instruction scheduling component to perform the operation of controlling the startup of the available heterogeneous units of the target subtask; and generating a task instruction package corresponding to the target subtask based on the computation instructions contained in the target subtask.
[0069] Optionally, determining the data storage address of the target subtask based on the task information of the target subtask includes: extracting the data storage address of the target subtask from the task information of the target subtask.
[0070] Optionally, the instruction scheduling component 104 is a component in the chip used to move the data needed by the heterogeneous unit 106 to execute computation instructions according to the instructions of the hardware scheduler 102, and to control the start and stop of the heterogeneous unit 106. The instruction scheduling component 104 establishes communication connections with the hardware scheduler 102 and each of the heterogeneous units 106, and can exchange information based on the established communication connections.
[0071] Optionally, the heterogeneous unit pre-preparation instruction corresponding to the target subtask is an instruction used to instruct the instruction scheduling component 104 to perform an operation to move the raw data of the target subtask from the data storage address of the target subtask to the cache area of the available heterogeneous units of the target subtask. The raw data of the target subtask is the data required during the execution of the computation instructions in the target subtask. The data storage address of the target subtask is the storage address of the data required during the execution of the computation instructions in the target subtask. The cache area of the heterogeneous unit is an area used to cache the data required by the heterogeneous units. The hardware scheduler 102 stores a heterogeneous unit pre-preparation instruction template. The heterogeneous unit pre-preparation instruction template is a template used to generate heterogeneous unit pre-preparation instructions corresponding to the target subtask. The heterogeneous unit pre-preparation instruction template is a heterogeneous unit pre-preparation instruction that does not contain the data storage address of the target subtask and the address of the cache area of the available heterogeneous units of the target subtask. After adding the data storage address of the target subtask to the data storage address addition position in the heterogeneous unit pre-preparation instruction template, and adding the address of the cache region of the available heterogeneous unit of the target subtask to the region address addition position in the heterogeneous unit pre-preparation instruction template, the heterogeneous unit pre-preparation instruction corresponding to the target subtask can be obtained. The data storage address addition position is the location in the heterogeneous unit pre-preparation instruction template used to add the data storage address of the target subtask. The region address addition position is the location in the heterogeneous unit pre-preparation instruction template used to add the address of the cache region of the available heterogeneous unit of the target subtask.
[0072] Optionally, based on the data storage address and the address of the cache region of the available heterogeneous units of the target subtask, a heterogeneous unit pre-preparation instruction corresponding to the target subtask is generated, including: adding the data storage address of the target subtask to the data storage address addition position in the heterogeneous unit pre-preparation instruction template, and adding the address of the cache region of the available heterogeneous units of the target subtask to the region address addition position in the heterogeneous unit pre-preparation instruction template, to obtain the heterogeneous unit pre-preparation instruction corresponding to the target subtask.
[0073] Optionally, the heterogeneous unit startup instruction corresponding to the target subtask is an instruction used to instruct the instruction scheduling component 104 to perform an operation controlling the startup of available heterogeneous units of the target subtask. The hardware scheduler 102 stores a heterogeneous unit startup instruction template. This template is used to generate the heterogeneous unit startup instruction corresponding to the target subtask. The heterogeneous unit startup instruction template does not contain identification information of the available heterogeneous units of the target subtask. After adding the identification information of the available heterogeneous units of the target subtask to the identification information addition position in the heterogeneous unit startup instruction template, the heterogeneous unit startup instruction corresponding to the target subtask can be obtained. The identification information addition position is the location in the heterogeneous unit startup instruction template used to add the identification information of the available heterogeneous units of the target subtask.
[0074] Optionally, based on the identification information of the available heterogeneous units of the target subtask, a heterogeneous unit startup instruction corresponding to the target subtask is generated, including: adding the identification information of the available heterogeneous units of the target subtask to the identification information addition position in the heterogeneous unit startup instruction template to obtain the heterogeneous unit startup instruction corresponding to the target subtask.
[0075] Optionally, based on the computation instructions contained in the target subtask, a task instruction package corresponding to the target subtask is generated. This includes: packaging the computation instructions contained in the target subtask using a packaging module to obtain the task instruction package corresponding to the target subtask. The task instruction package corresponding to the target subtask is a data packet consisting of all the computation instructions contained in the target subtask. The packaging module is a component in the hardware scheduler 102 used for packaging data. The hardware scheduler 102 can use the packaging module to package all the computation instructions contained in the target subtask to obtain a data packet. This data packet is the task instruction package corresponding to the target subtask.
[0076] Optionally, the hardware scheduler 102 sends the heterogeneous unit preparation instructions and heterogeneous unit startup instructions corresponding to each of the target subtasks to the instruction scheduling component 104. After receiving the heterogeneous unit preparation instructions and heterogeneous unit startup instructions corresponding to each of the target subtasks, the instruction scheduling component 104 performs data transfer according to the heterogeneous unit preparation instructions and controls the startup of the available heterogeneous units of each target subtask according to the heterogeneous unit startup instructions.
[0077] Optionally, after receiving the heterogeneous unit preparation instruction and heterogeneous unit start instruction corresponding to each target subtask, the instruction scheduling component 104 performs the operation of moving the original data of each target subtask from the data storage address of each target subtask to the cache area of the available heterogeneous unit of each target subtask, and then performs the operation of controlling the start of the available heterogeneous unit of each target subtask.
[0078] Optionally, moving the raw data of the target subtask from the data storage address of the target subtask to the cache area of the available heterogeneous unit of the target subtask includes: obtaining the raw data of the target subtask from the data storage address of the target subtask; and storing the raw data of the target subtask in the cache area of the available heterogeneous unit of the target subtask.
[0079] Optionally, controlling the startup of available heterogeneous units of the target subtask includes sending a startup command to the available heterogeneous units of the target subtask. The startup command is an instruction to instruct heterogeneous unit 106 to start. If the available heterogeneous units of the target subtask are in a disabled state, the available heterogeneous units of the target subtask start after receiving the startup command, and then, after startup is complete, send startup notification information back to the instruction scheduling component 104. If the available heterogeneous units of the target subtask are already running, the available heterogeneous units of the target subtask directly send startup notification information back to the instruction scheduling component 104 after receiving the startup command. The startup notification information is used to indicate that heterogeneous unit 106 has started.
[0080] Optionally, after receiving the start-up prompt information from the available heterogeneous units of each target subtask, the instruction scheduling component 104 determines that the available heterogeneous units of each target subtask have started, and sends the instruction completion prompt information back to the hardware scheduler 102. The instruction completion prompt information is used to indicate that the instruction scheduling component 104 has completed the heterogeneous unit pre-preparation instruction and the heterogeneous unit start-up instruction sent by the hardware scheduler 102.
[0081] Optionally, after receiving the instruction completion prompt information from the instruction scheduling component 104, the hardware scheduler 102 sends the task instruction packets corresponding to each of the target subtasks to the instruction packet distribution component 105.
[0082] Optionally, the instruction packet distribution component 105 is a component in the chip used to distribute task instruction packets sent by the hardware scheduler 102 to the corresponding heterogeneous units 106. The instruction packet distribution component 105 establishes communication connections with the hardware scheduler 102 and each of the heterogeneous units 106, and can exchange information based on the established communication connections.
[0083] Optionally, the hardware scheduler 102 sends the task instruction packet corresponding to each target subtask and the identification information of the available heterogeneous units of each target subtask to the instruction packet distribution component 105. For each target subtask, the instruction packet distribution component 105 determines the available heterogeneous units of the target subtask based on the identification information of the available heterogeneous units of the target subtask, and then sends the task instruction packet corresponding to the target subtask to the available heterogeneous units of the target subtask.
[0084] Optionally, after receiving the task instruction packet, the available heterogeneous units of each target subtask execute the task instruction packet to process and complete each target subtask. Executing the task instruction packet corresponding to the target subtask includes: extracting each calculation instruction from the task instruction packet corresponding to the target subtask, and executing each calculation instruction respectively; after all calculation instructions have been executed, determining that the task instruction packet corresponding to the target subtask has been completed, thus completing the target subtask.
[0085] Optionally, the available heterogeneous units of each target subtask are further configured to: send a task completion notification to the instruction packet distribution component 105 after completing the execution of the task instruction packet; the instruction packet distribution component 105 is further configured to: after receiving the task completion notification sent by the available heterogeneous units of each target subtask, send the task completion notification sent by the available heterogeneous units of each target subtask to the hardware scheduler 102; the hardware scheduler 102 is further configured to: after receiving the task completion notification sent by the available heterogeneous units of each target subtask, send a heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask to the hardware resource management component 103.
[0086] Optionally, the hardware resource management component 103 is further configured to: after receiving a heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask, update the resource status of the available heterogeneous units of each target subtask.
[0087] Optionally, the task completion notification information is used to indicate that available heterogeneous units have completed the execution of the target sub-task. After completing the task instruction packet, each available heterogeneous unit of the target sub-task sends the task completion notification information to the instruction packet distribution component 105. After receiving the task completion notification information sent by each available heterogeneous unit of the target sub-task, the instruction packet distribution component 105 sends the task completion notification information sent by each available heterogeneous unit of the target sub-task to the hardware scheduler 102. The hardware scheduler 102 is further configured to, after receiving the task completion notification information sent by each available heterogeneous unit of the target sub-task, determine that all available heterogeneous units have completed the execution of the corresponding target sub-task, that is, all target sub-tasks have been completed and the target task has been completed, and then send the heterogeneous unit return request corresponding to each available heterogeneous unit of the target sub-task to the hardware resource management component 103. After receiving the heterogeneous unit return request corresponding to each available heterogeneous unit of the target sub-task, the hardware resource management component 103 updates the resource status of each available heterogeneous unit of the target sub-task.
[0088] Optionally, the heterogeneous unit return request corresponding to the specified heterogeneous unit is a request to stop using the specified heterogeneous unit to execute computation instructions. The hardware scheduler 102 stores a heterogeneous unit return request template. This template is used to generate the heterogeneous unit return request corresponding to the specified heterogeneous unit. The heterogeneous unit return request template does not contain the identification information of the specified heterogeneous unit. After adding the identification information of the specified heterogeneous unit to the identification information addition position in the heterogeneous unit return request template, the heterogeneous unit return request corresponding to the specified heterogeneous unit can be obtained. The identification information addition position in the heterogeneous unit return request template is the position in the template used to add the identification information of the specified heterogeneous unit.
[0089] Optionally, the hardware scheduler 102 adds the identification information of the available heterogeneous units of each target subtask to the identification information addition position in the heterogeneous unit return request template, obtains the heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask, and then sends the heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask to the hardware resource management component 103.
[0090] Optionally, after receiving a heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask, the hardware resource management component 103 determines that the available heterogeneous units of each target subtask are no longer executing computation instructions and can be used to execute new computation instructions, and updates the resource status of the available heterogeneous units of each target subtask stored in the hardware resource management component 103 to idle.
[0091] Optionally, after receiving the application failure prompt information from the hardware resource management component 103, the hardware scheduler 102 re-executes the operation of obtaining the resource status of each heterogeneous unit 106 from the hardware resource management component 103, determining the available heterogeneous units of each target sub-task based on the task information of each target sub-task and the resource status of each heterogeneous unit 106, and sending the heterogeneous unit application request corresponding to the available heterogeneous units of each target sub-task to the hardware resource management component 103, until it receives the application success prompt information from the hardware resource management component 103.
[0092] In the technical solution of this invention embodiment, after obtaining a divisible target task from the tasks to be processed through a hardware scheduler, the target task is divided into multiple target sub-tasks according to the task information of the target task. Then, the hardware scheduler obtains the resource status of each heterogeneous unit from the hardware resource management component. Based on the task information of each target sub-task and the resource status of each heterogeneous unit, the available heterogeneous units of each target sub-task are determined, and the heterogeneous unit application requests corresponding to the available heterogeneous units of each target sub-task are sent to the hardware resource management component. After receiving the application success prompt information from the hardware resource management component, based on the task information of each target sub-task and the available heterogeneous units of each target sub-task, heterogeneous unit pre-preparation instructions, heterogeneous unit start instructions, and task instruction packages corresponding to each target sub-task are generated. The heterogeneous unit pre-preparation instructions and heterogeneous unit start instructions corresponding to each target sub-task are sent to the instruction scheduling component, so that the instruction scheduling component performs data processing according to the heterogeneous unit pre-preparation instructions corresponding to each target sub-task. The process involves controlling the startup of available heterogeneous units for each target subtask based on the startup instructions corresponding to those subtasks. Upon receiving a completion notification from the instruction scheduling component, the process sends task instruction packets corresponding to each target subtask to the instruction packet distribution component. This allows the instruction packet distribution component to distribute these packets to the available heterogeneous units of each target subtask. The available heterogeneous units of each target subtask then execute the task instruction packets to process and complete the subtasks. This addresses the problem of low resource utilization and scheduling efficiency in related technologies, which severely impacts chip computing power. The process achieves the goal of splitting computational tasks generated within the chip into multiple independently processable subtasks. It automatically and accurately allocates each subtask to an available heterogeneous unit based on task information and the resource status of each heterogeneous unit within the chip, thereby improving resource utilization and scheduling efficiency, and ultimately enhancing the chip's computing power.
[0093] Example 2
[0094] Figure 2 This is a flowchart illustrating a task scheduling method provided in Embodiment 2 of the present invention. This embodiment is applicable to the scheduling of computational tasks. This method can be applied to the hardware scheduler in the task scheduling system provided in the above embodiments of the present invention. Figure 2 As shown, the method in this embodiment specifically includes:
[0095] Step 201: After obtaining the divisible target task from the tasks to be processed, the target task is divided into multiple target sub-tasks according to the task information of the target task.
[0096] Optionally, the task prefetching component monitors the task queue and stores the tasks to be processed in the queue into the local storage space of the hardware scheduler. The hardware scheduler, according to the order in which the tasks were stored, sequentially retrieves one computational task from each computational task in the pending tasks stored in the local storage space for scheduling. After retrieving a divisible target task from the pending tasks stored in the local storage space, the hardware scheduler splits the target task into multiple target subtasks based on the task information of the target task.
[0097] Optionally, the hardware scheduler determines each set of computation instructions in the target task based on the identification information of each set of computation instructions in the task information of the target task. Each set of computation instructions is then designated as a target subtask, resulting in multiple target subtasks, thus splitting the target task into multiple target subtasks. Each target subtask is a subtask that can be processed independently. The hardware scheduler determines the task information of each target subtask based on the identification information, priority information, heterogeneous unit type, and data storage address of each set of computation instructions.
[0098] Step 202: Obtain the resource status of each heterogeneous unit from the hardware resource management component, and determine the available heterogeneous units for each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit.
[0099] Optionally, based on the task information of each target subtask and the resource status of each heterogeneous unit, the available heterogeneous units of each target subtask are determined, including: determining each idle heterogeneous unit in each heterogeneous unit based on the resource status of each heterogeneous unit; determining the heterogeneous unit type of each target subtask based on the task information of each target subtask; and determining the available heterogeneous units of each target subtask in each idle heterogeneous unit based on the priority information and heterogeneous unit type of each target subtask.
[0100] Optionally, based on the resource status of each heterogeneous unit, each idle heterogeneous unit in each heterogeneous unit is determined, including: determining the heterogeneous units in each heterogeneous unit whose resource status is idle as idle heterogeneous units, thereby determining each idle heterogeneous unit in each heterogeneous unit.
[0101] Optionally, the hardware scheduler determines the heterogeneous unit type of each target subtask based on the task information of each target subtask, including: extracting the heterogeneous unit type of each target subtask from the task information of each target subtask.
[0102] Optionally, based on the priority information and heterogeneous unit type of each target subtask, the available heterogeneous units of each target subtask are determined in each idle heterogeneous unit, including: sorting each target subtask according to the priority information of each target subtask, and then determining the available heterogeneous units of each target subtask in each idle heterogeneous unit according to the priority information and heterogeneous unit type of each target subtask in turn.
[0103] Optionally, the target subtasks are sorted from high to low according to priority information. Then, starting from the target subtask ranked first, the available heterogeneous units of each target subtask are determined from each idle heterogeneous unit according to the priority information and heterogeneous unit type of each target subtask.
[0104] Optionally, for each target subtask, the following operations are performed: Among the remaining idle heterogeneous units, query for idle heterogeneous units of the same type as the target subtask; randomly select one idle heterogeneous unit from among those of the same type as the target subtask, and use it as a usable heterogeneous unit for the target subtask. The remaining idle heterogeneous units are all idle heterogeneous units that have not yet been determined as usable heterogeneous units for other target subtasks. The usable heterogeneous units of the target subtask are the heterogeneous units used to execute the computational instructions contained in the target subtask.
[0105] Step 203: Send the heterogeneous unit application request corresponding to the available heterogeneous units of each target subtask to the hardware resource management component.
[0106] Step 204: After receiving the application success notification from the hardware resource management component, generate heterogeneous unit preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target subtask based on the task information of each target subtask and the available heterogeneous units of each target subtask.
[0107] Optionally, based on the task information of each target subtask and the available heterogeneous units of each target subtask, a heterogeneous unit pre-preparation instruction, a heterogeneous unit startup instruction, and a task instruction package corresponding to each target subtask are generated, including: performing the following operations for each target subtask: determining the data storage address of the target subtask based on the task information of the target subtask; generating a heterogeneous unit pre-preparation instruction corresponding to the target subtask based on the data storage address and the address of the cache area of the available heterogeneous units of the target subtask; wherein, the heterogeneous unit pre-preparation instruction is used to instruct the instruction scheduling component to perform the operation of moving the original data of the target subtask from the data storage address to the cache area of the available heterogeneous units of the target subtask; generating a heterogeneous unit startup instruction corresponding to the target subtask based on the identification information of the available heterogeneous units of the target subtask; wherein, the heterogeneous unit startup instruction is used to instruct the instruction scheduling component to perform the operation of controlling the startup of the available heterogeneous units of the target subtask; and generating a task instruction package corresponding to the target subtask based on the computation instructions contained in the target subtask.
[0108] Step 205: Send the heterogeneous unit preparation instructions and heterogeneous unit start instructions corresponding to each of the target sub-tasks to the instruction scheduling component.
[0109] Step 206: After receiving the instruction completion prompt information from the instruction scheduling component, the task instruction package corresponding to each target subtask is sent to the instruction package distribution component.
[0110] Optionally, after sending the task instruction packet corresponding to each of the target sub-tasks to the instruction packet distribution component, the method further includes: after receiving the task completion prompt information sent by the available heterogeneous units of each of the target sub-tasks, sending the heterogeneous unit return request corresponding to the available heterogeneous units of each of the target sub-tasks to the hardware resource management component.
[0111] The technical solution of this invention involves obtaining a divisible target task from a task to be processed, then dividing the target task into multiple target subtasks based on the target task's task information; then obtaining the resource status of each heterogeneous unit from a hardware resource management component, and determining the available heterogeneous units for each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit; sending heterogeneous unit application requests corresponding to the available heterogeneous units of each target subtask to the hardware resource management component; and after receiving a successful application notification from the hardware resource management component, generating heterogeneous unit pre-preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target subtask based on the task information and available heterogeneous units of each target subtask. The method sends the heterogeneous unit preparation instructions and heterogeneous unit start instructions corresponding to each target subtask to the instruction scheduling component; after receiving the instruction completion prompt information from the instruction scheduling component, it sends the task instruction package corresponding to each target subtask to the instruction package distribution component. This solves the problem of low resource utilization and scheduling efficiency in related technologies, which seriously affects the computing power of the chip. It achieves the beneficial effect of splitting the computing tasks generated in the chip into multiple subtasks that can be processed independently, and automatically and reasonably and accurately allocating each subtask to an available heterogeneous unit for processing based on task information and the resource status of each heterogeneous unit in the chip. This improves the resource utilization and scheduling efficiency of the chip's task scheduling process and enhances the chip's computing power.
[0112] Example 3
[0113] Figure 3 This is a schematic diagram of a task scheduling device provided in Embodiment 3 of the present invention. The device can be configured in the hardware scheduler of the task scheduling system provided in the above embodiments of the present invention. Figure 3 As shown, the device includes: a task splitting module 301, a scheduling decision module 302, a resource application module 303, an information generation module 304, an instruction sending module 305, and an instruction packet sending module 306.
[0114] The task splitting module 301 is used to split the target task into multiple target subtasks according to the task information of the target task after obtaining the splittable target task from the tasks to be processed; the scheduling decision module 302 is used to obtain the resource status of each heterogeneous unit from the hardware resource management component, and determine the available heterogeneous units of each target subtask according to the task information of each target subtask and the resource status of each heterogeneous unit; the resource application module 303 is used to send the heterogeneous unit application request corresponding to the available heterogeneous units of each target subtask to the hardware resource management component; the information generation module 304 is used to... After receiving the application success notification from the hardware resource management component, the module generates heterogeneous unit pre-preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target sub-task based on the task information of each target sub-task and the available heterogeneous units of each target sub-task. The instruction sending module 305 is used to send the heterogeneous unit pre-preparation instructions and heterogeneous unit startup instructions corresponding to each target sub-task to the instruction scheduling component. The instruction package sending module 306 is used to send the task instruction package corresponding to each target sub-task to the instruction package distribution component after receiving the instruction completion notification from the instruction scheduling component.
[0115] The technical solution of this invention involves obtaining a divisible target task from a task to be processed, then dividing the target task into multiple target subtasks based on the target task's task information; then obtaining the resource status of each heterogeneous unit from a hardware resource management component, and determining the available heterogeneous units for each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit; sending heterogeneous unit application requests corresponding to the available heterogeneous units of each target subtask to the hardware resource management component; and after receiving a successful application notification from the hardware resource management component, generating heterogeneous unit pre-preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target subtask based on the task information and available heterogeneous units of each target subtask. The method sends the heterogeneous unit preparation instructions and heterogeneous unit start instructions corresponding to each target subtask to the instruction scheduling component; after receiving the instruction completion prompt information from the instruction scheduling component, it sends the task instruction package corresponding to each target subtask to the instruction package distribution component. This solves the problem of low resource utilization and scheduling efficiency in related technologies, which seriously affects the computing power of the chip. It achieves the beneficial effect of splitting the computing tasks generated in the chip into multiple subtasks that can be processed independently, and automatically and reasonably and accurately allocating each subtask to an available heterogeneous unit for processing based on task information and the resource status of each heterogeneous unit in the chip. This improves the resource utilization and scheduling efficiency of the chip's task scheduling process and enhances the chip's computing power.
[0116] In an optional embodiment of the present invention, the task scheduling device may further include: a resource return module, configured to send a heterogeneous unit return request corresponding to the available heterogeneous unit of each target subtask to the hardware resource management component after receiving the task completion prompt information sent by the available heterogeneous unit of each target subtask.
[0117] In an optional embodiment of the present invention, the scheduling decision module 302, when performing the operation of determining the available heterogeneous units of each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit, is specifically configured to: determine each idle heterogeneous unit in each heterogeneous unit based on the resource status of each heterogeneous unit; determine the heterogeneous unit type of each target subtask based on the task information of each target subtask; and determine the available heterogeneous units of each target subtask in each idle heterogeneous unit based on the priority information and heterogeneous unit type of each target subtask.
[0118] In an optional embodiment of the present invention, the information generation module 304, when performing the operation of determining the available heterogeneous units of each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit, is specifically configured to: perform the following operations for each target subtask: determine the data storage address of the target subtask based on the task information of the target subtask; generate a heterogeneous unit pre-preparation instruction corresponding to the target subtask based on the data storage address and the address of the cache area of the available heterogeneous units of the target subtask; wherein the heterogeneous unit pre-preparation instruction is used to instruct the instruction scheduling component to perform the operation of moving the original data of the target subtask from the data storage address to the cache area of the available heterogeneous units of the target subtask; generate a heterogeneous unit start instruction corresponding to the target subtask based on the identification information of the available heterogeneous units of the target subtask; wherein the heterogeneous unit start instruction is used to instruct the instruction scheduling component to perform the operation of controlling the start of the available heterogeneous units of the target subtask; and generate a task instruction package corresponding to the target subtask based on the calculation instructions included in the target subtask.
[0119] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0120] The above-described task scheduling device can execute the task scheduling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the task scheduling method.
[0121] Example 4
[0122] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement the task scheduling method of embodiments of the present invention is shown. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the invention described and / or claimed herein.
[0123] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or a computer program constructed from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0124] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0125] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as task scheduling methods.
[0126] In some embodiments, the task scheduling method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is built into RAM 13 and executed by processor 11, one or more steps of the task scheduling method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the task scheduling method by any other suitable means (e.g., by means of firmware).
[0127] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0128] Computer programs for implementing the task scheduling method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0129] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0130] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0131] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0132] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0133] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0134] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A task scheduling system, characterized in that, include: The system includes a task prefetching component, a hardware scheduler, a hardware resource management component, an instruction scheduling component, an instruction packet distribution component, and at least one heterogeneous unit. The task prefetching component is used to monitor the task queue and store the tasks to be processed in the task queue to the local storage space of the hardware scheduler. The hardware scheduler is configured to: after obtaining a divisible target task from the tasks to be processed, split the target task into multiple target subtasks according to the task information of the target task; obtain the resource status of each heterogeneous unit from the hardware resource management component, and determine the available heterogeneous units for each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit; send heterogeneous unit application requests corresponding to the available heterogeneous units of each target subtask to the hardware resource management component; after receiving a successful application notification from the hardware resource management component, generate heterogeneous unit pre-preparation instructions, heterogeneous unit start instructions, and task instruction packages corresponding to each target subtask based on the task information and available heterogeneous units of each target subtask; send the heterogeneous unit pre-preparation instructions and heterogeneous unit start instructions corresponding to each target subtask to the instruction scheduling component; and after receiving an instruction completion notification from the instruction scheduling component, send the task instruction packages corresponding to each target subtask to the instruction package distribution component. The hardware resource management component is used to manage the resource status of each heterogeneous unit; after receiving a heterogeneous unit application request corresponding to an available heterogeneous unit of each target subtask, it sends a successful application message or a failed application message to the hardware scheduler according to the resource status of each heterogeneous unit. The instruction scheduling component is used to, after receiving the heterogeneous unit pre-preparation instruction and heterogeneous unit start instruction corresponding to each target subtask, perform data transfer according to the heterogeneous unit pre-preparation instruction corresponding to each target subtask, control the start of available heterogeneous units of each target subtask according to the heterogeneous unit start instruction corresponding to each target subtask, and after the available heterogeneous units of each target subtask are started, feed back instruction completion prompt information to the hardware scheduler. The instruction packet distribution component is used to send the task instruction packet corresponding to each target subtask to the available heterogeneous unit of each target subtask after receiving the task instruction packet corresponding to each target subtask. Each of the target subtasks has a available heterogeneous unit for executing the task instruction packet after receiving it.
2. The task scheduling system according to claim 1, characterized in that, The available heterogeneous units of each of the target subtasks are further configured to: send a task completion notification to the instruction package distribution component after the task instruction package has been executed; The instruction packet distribution component is further configured to: after receiving the task completion prompt information sent by the available heterogeneous units of each target subtask, send the task completion prompt information sent by the available heterogeneous units of each target subtask to the hardware scheduler; The hardware scheduler is further configured to: after receiving task completion prompt information sent by the available heterogeneous units of each target subtask, send a heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask to the hardware resource management component.
3. The task scheduling system according to claim 2, characterized in that, The hardware resource management component is further configured to: update the resource status of the available heterogeneous units of each target subtask after receiving a heterogeneous unit return request corresponding to the available heterogeneous units of each target subtask.
4. A task scheduling method, applied in the hardware scheduler of the task scheduling system as described in claim 1, characterized in that, include: After obtaining the divisible target task from the pending tasks, the target task is divided into multiple target sub-tasks according to the task information of the target task. The resource status of each heterogeneous unit is obtained from the hardware resource management component, and the available heterogeneous units of each target subtask are determined based on the task information of each target subtask and the resource status of each heterogeneous unit. The heterogeneous unit request corresponding to the available heterogeneous units of each of the target sub-tasks is sent to the hardware resource management component; After receiving the application success notification from the hardware resource management component, based on the task information of each target subtask and the available heterogeneous units of each target subtask, a heterogeneous unit pre-preparation instruction, a heterogeneous unit start instruction, and a task instruction package corresponding to each target subtask are generated. Send the heterogeneous unit preparation instructions and heterogeneous unit start instructions corresponding to each of the target sub-tasks to the instruction scheduling component; After receiving the instruction completion prompt from the instruction scheduling component, the task instruction package corresponding to each target subtask is sent to the instruction package distribution component.
5. The task scheduling method according to claim 4, characterized in that, After sending the task instruction packets corresponding to each of the target subtasks to the instruction packet distribution component, the method further includes: After receiving the task completion prompt information sent by the available heterogeneous units of each target subtask, a heterogeneous unit return request corresponding to the available heterogeneous unit of each target subtask is sent to the hardware resource management component.
6. The task scheduling method according to claim 4, characterized in that, Based on the task information of each target subtask and the resource status of each heterogeneous unit, the available heterogeneous units for each target subtask are determined, including: Based on the resource status of each heterogeneous unit, determine each idle heterogeneous unit in each heterogeneous unit; Based on the task information of each target subtask, determine the heterogeneous unit type of each target subtask; Based on the priority information and heterogeneous unit type of each target subtask, the available heterogeneous units of each target subtask are determined in each idle heterogeneous unit.
7. The task scheduling method according to claim 4, characterized in that, Based on the task information of each target subtask and the available heterogeneous units for each target subtask, generate heterogeneous unit pre-preparation instructions, heterogeneous unit startup instructions, and task instruction packages corresponding to each target subtask, including: Perform the following operations for each target subtask: Based on the task information of the target subtask, determine the data storage address of the target subtask; Based on the data storage address and the address of the cache area of the available heterogeneous unit of the target subtask, a heterogeneous unit pre-preparation instruction corresponding to the target subtask is generated; wherein, the heterogeneous unit pre-preparation instruction is used to instruct the instruction scheduling component to perform the operation of moving the original data of the target subtask from the data storage address to the cache area of the available heterogeneous unit of the target subtask; Based on the identification information of the available heterogeneous units of the target subtask, a heterogeneous unit startup instruction corresponding to the target subtask is generated; wherein, the heterogeneous unit startup instruction is used to instruct the instruction scheduling component to perform an operation to control the startup of the available heterogeneous units of the target subtask; Based on the computation instructions contained in the target subtask, a task instruction package corresponding to the target subtask is generated.
8. A task scheduling device, configured in the hardware scheduler of the task scheduling system as described in claim 1, characterized in that, include: The task splitting module is used to split the target task into multiple target subtasks based on the task information of the target task after obtaining the splittable target task from the tasks to be processed. The scheduling decision module is used to obtain the resource status of each heterogeneous unit from the hardware resource management component, and determine the available heterogeneous units of each target subtask based on the task information of each target subtask and the resource status of each heterogeneous unit. The resource request module is used to send heterogeneous unit request requests corresponding to the available heterogeneous units of each target subtask to the hardware resource management component; The information generation module is used to generate heterogeneous unit pre-preparation instructions, heterogeneous unit start instructions, and task instruction packages corresponding to each target subtask based on the task information of each target subtask and the available heterogeneous units of each target subtask after receiving the application success prompt information from the hardware resource management component. The instruction sending module is used to send the heterogeneous unit preparation instruction and heterogeneous unit start instruction corresponding to each of the target sub-tasks to the instruction scheduling component; The instruction packet sending module is used to send the task instruction packet corresponding to each of the target subtasks to the instruction packet distribution component after receiving the instruction completion prompt information fed back by the instruction scheduling component.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and a memory that is in communication with the at least one processor network; The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the task scheduling method according to any one of claims 4-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the task scheduling method of any one of claims 4-7.
Citation Information
Patent Citations
Task scheduling method, computer equipment and storage medium
CN112328378A
Software and hardware engine device, software and hardware engine setting method, equipment and medium
CN116431307A
