Task scheduling method and device, electronic equipment, storage medium and program product

By setting scheduling priorities for NPU tasks and establishing priority queues, the problem of low task scheduling efficiency in existing technologies is solved, achieving efficient task scheduling and improved user experience.

CN123177976APending Publication Date: 2026-11-27VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611194937.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-07
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing technologies, when multiple tasks simultaneously request neural network processor (NPU) resources, electronic devices lack a priority scheduling mechanism, resulting in low-priority tasks occupying NPU resources while high-priority tasks are forced to wait, leading to AI function response delays and a decline in user experience.

Method used

By determining the application type, task type, and process type of NPU tasks, the scheduling priority of each task is determined, and tasks are scheduled in order of priority. Four priority queues and the TaskDispatcher priority scheduling mechanism are established to ensure that high-priority tasks respond quickly.

Benefits of technology

It improves the efficiency of NPU task scheduling, ensures rapid response for high-priority tasks, and enhances user experience and NPU utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123177976A_ABST
    Figure CN123177976A_ABST
Patent Text Reader

Abstract

The application discloses a task scheduling method and device, electronic equipment, a storage medium and a program product, and belongs to the technical field of computer system software, and the method comprises the following steps: determining the scheduling priority corresponding to each neural network processor (NPU) task based on attribute information corresponding to the NPU task; the attribute information comprises at least one of an application type, a task type and a process type of a process called by a demand; and the task scheduling is performed on each NPU task based on the scheduling priority corresponding to each NPU task through the NPU.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of computer system software technology, specifically relating to a task scheduling method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] Currently, with the rapid development of artificial intelligence technology, electronic devices rely on neural processing units (NPUs) to process artificial intelligence (AI) tasks.

[0003] Typically, when multiple tasks request NPU resources simultaneously, electronic devices can allocate resources according to a first-come, first-served principle. That is, the electronic device allocates corresponding NPU resources to each task in sequence based on the time each task arrives at the NPU. As a result, some tasks may not be able to occupy NPU resources first, thus the task scheduling efficiency of electronic devices is low. Summary of the Invention

[0004] The purpose of this application is to provide a task scheduling method, apparatus, electronic device, storage medium, and program product that can improve the efficiency of task scheduling in electronic devices.

[0005] In a first aspect, embodiments of this application provide a task scheduling method, which includes: determining a scheduling priority for each task based on attribute information corresponding to at least two NPU tasks; the attribute information includes at least one of application type, task type, and process type of the process to which the request is made; and scheduling each NPU task based on the scheduling priority corresponding to each NPU task through the NPU.

[0006] Secondly, embodiments of this application provide a task scheduling apparatus, which includes a determining module and a processing module. The determining module is configured to determine the scheduling priority of each NPU task based on attribute information corresponding to at least two NPU tasks; the attribute information includes at least one of application type, task type, and process type of the process requesting the call. The processing module is configured to perform task scheduling on each NPU task through the NPU, based on the scheduling priority determined by the determining module.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program / program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0011] In this embodiment, the scheduling priority of each NPU task is determined by at least one of the application type, task type, and process type of the process that calls the request for at least two NPU tasks. Thus, the task is selected for priority scheduling based on the scheduling priority of each NPU task, thereby improving the efficiency of NPU task scheduling. Attached Figure Description

[0012] Figure 1 This is one of the flowcharts of a task scheduling method provided in the embodiments of this application;

[0013] Figure 2 This is a second flowchart of a task scheduling method provided in an embodiment of this application;

[0014] Figure 3 This is the third flowchart of a task scheduling method provided in the embodiments of this application;

[0015] Figure 4 This is the fourth flowchart of a task scheduling method provided in the embodiments of this application;

[0016] Figure 5 This is the fifth flowchart of a task scheduling method provided in the embodiments of this application;

[0017] Figure 6 This is a schematic diagram of the structure of a task scheduling device provided in an embodiment of this application;

[0018] Figure 7 This is one of the hardware structure diagrams of an electronic device provided in the embodiments of this application;

[0019] Figure 8 This is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0021] The terms "first," "second," etc., used in this application's specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects. For example, a first object can be one or more, where "more" means at least two. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0022] The terms "at least one" and "at least one of" in this application's specification refer to any one, any two, or a combination of two or more of the included objects. For example, "at least one of a, b, and c" can mean "a", "b", "c", "a and b", "a and c", "b and c", and "a, b, and c", where a, b, and c can be single or multiple, and multiple means at least two. Similarly, "at least two" means two or more, and its meaning is similar to "at least one". The identifiers in this application are text, symbols, images, etc., used to indicate information, and can use controls or other containers as carriers for displaying information, including but not limited to text identifiers, symbol identifiers, and image identifiers.

[0023] The terminology used in the implementation section of this application is only for explaining specific embodiments of this application and is not intended to limit this application. The terminology involved in the embodiments of this application is explained below.

[0024] The task scheduling method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0025] The task scheduling method provided in this application can be applied to NPU task execution scenarios.

[0026] Currently, with the rapid development of artificial intelligence technology, the demand for AI processing capabilities in smart devices is increasing daily. Especially in fields such as AI, imaging, and gaming, functions such as image recognition, voice interaction, and game character behavior control all rely on NPU capabilities to achieve faster and more accurate AI inference and computation, providing users with a smoother and more intelligent user experience.

[0027] However, existing NPU tasks lack a customized scheduling mechanism and are basically executed according to the first-in-first-out principle. This solution has the following technical drawbacks:

[0028] Due to the lack of a priority scheduling mechanism, when multiple AI tasks simultaneously request NPU resources, electronic devices will allocate resources on a first-come, first-served basis. Low-priority AI tasks, such as background image optimization, may occupy NPU resources first, while high-priority user interaction functions, such as real-time face unlock, are forced to wait. In this situation, the following problems may occur: delayed AI function response and degraded user experience; real-time-critical functions may experience lag or even malfunction; and background tasks may occupy the NPU for extended periods, preventing foreground tasks from receiving timely responses.

[0029] In the task scheduling method provided in this application embodiment, the scheduling priority of each NPU task is determined by at least one of the application type, task type and process type of the process that needs to be called by at least two NPU tasks. Thus, the task is selected for priority scheduling according to the scheduling priority of each NPU task, thereby improving the efficiency of NPU task scheduling.

[0030] The task scheduling method provided in this application is executed by a task scheduling device, which can be an electronic device, or a functional module or entity within an electronic device. This application does not limit the specific implementation of this method. The following will use an electronic device as an example to illustrate the task scheduling method provided in this application.

[0031] This application provides a task scheduling method. Figure 1 A flowchart of a task scheduling method provided in an embodiment of this application is shown. Figure 1 As shown, the task scheduling method provided in this application embodiment may include the following steps 201 and 202.

[0032] Step 201: The electronic device determines the scheduling priority of each NPU task based on the attribute information corresponding to at least two NPU tasks.

[0033] In this embodiment of the application, the aforementioned attribute information includes at least one of application type, task type, and process type of the process that invokes the request.

[0034] Optionally, in this embodiment, the application type can be video, game, or image editing. The specific type can be determined based on actual usage needs, and this embodiment does not impose any limitations.

[0035] Optionally, in this embodiment, the task type can be background image processing, log analysis, or security authentication, etc. The specific type can be determined based on actual usage requirements, and this embodiment does not impose any limitations.

[0036] Optionally, in this embodiment, the process type can be a system process type, an application process type, a foreground process type, etc. The specific type can be determined according to actual usage requirements, and this embodiment does not impose any restrictions.

[0037] Optionally, in this embodiment of the application, the scheduling priority can be low priority, normal priority, high priority, and real-time priority.

[0038] It can be understood that the execution timing of step 201 above can be as follows: when at least two NPU tasks are detected to exist at the same time, the electronic device determines the scheduling priority corresponding to each NPU task based on at least one of the application type, task type and process type of the process that needs to be called for the at least two NPU tasks.

[0039] It should be noted that the specific implementation process of step 201 above can be found in the following embodiments, and will not be repeated here to avoid repetition.

[0040] Step 202: The electronic device schedules each NPU task through the NPU based on the scheduling priority corresponding to each NPU task.

[0041] In this embodiment of the application, the electronic device can schedule NPU tasks sequentially from high to low according to the scheduling priority corresponding to each NPU task through the NPU.

[0042] In this embodiment of the application, the electronic device can schedule NPU tasks to the NPU according to the scheduling priority corresponding to each NPU task and in the above order, so that the NPU can allocate NPU resources for the NPU tasks and then execute the tasks.

[0043] It should be noted that the specific implementation process of step 202 above can be found in the following embodiments, and will not be repeated here to avoid repetition.

[0044] In the task scheduling method provided in this application embodiment, the scheduling priority of each task is determined based on attribute information corresponding to at least two NPU tasks. This attribute information includes application type, task type, and the process type of the process invoking the request. Based on the scheduling priority of each NPU task, task scheduling is performed on each NPU task. In this solution, the scheduling priority of each NPU task is determined by at least one of the application type, task type, and process type of the process invoking the request, thereby selecting the priority task for scheduling based on the scheduling priority of each NPU task, thus improving the efficiency of NPU task scheduling.

[0045] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 2 As shown, step 201 above can be implemented through steps 201a to 201d below.

[0046] Step 201a: The electronic device determines the first value corresponding to each NPU task based on the application type corresponding to each NPU task through the NPU.

[0047] In this embodiment of the application, the first value is used to characterize the importance of the application that initiates the NPU task.

[0048] Optionally, in this embodiment of the application, the above-mentioned application type may have a first correspondence with the first value, and the electronic device may determine the first value corresponding to each task based on the first correspondence.

[0049] Optionally, in the embodiments of this application, the above-mentioned first correspondence can be preset by the electronic device or customized by the user. The specific correspondence can be determined according to actual usage needs, and the embodiments of this application do not impose any restrictions.

[0050] For example, as shown in Table 1, the above first correspondence is explained.

[0051] Table 1

[0052]

[0053] It should be noted that the application types mentioned above refer to the applications that initiate NPU tasks, and the first weighted value mentioned above is the first value.

[0054] Optionally, in this embodiment of the application, the application that initiates the NPU task can be any application in the electronic device.

[0055] Step 201b: The electronic device, through the NPU, determines the second value corresponding to each NPU task based on the task type corresponding to each NPU task.

[0056] In this embodiment of the application, the second value is used to characterize the urgency of the application that initiated the NPU task in running the NPU task.

[0057] Optionally, in this embodiment of the application, the above-mentioned task type may have a second correspondence with the second value, and the electronic device may determine the second value corresponding to each NPU task according to the second correspondence.

[0058] Optionally, in the embodiments of this application, the above-mentioned second correspondence can be preset by the electronic device or customized by the user. The specific correspondence can be determined according to actual usage needs, and the embodiments of this application do not impose any restrictions.

[0059] For example, as shown in Table 2, the above second correspondence is explained.

[0060] Table 2

[0061]

[0062] It should be noted that the second value corresponding to the above task type can be configured by the application that initiated the NPU task, and the above second weighted value is the second value.

[0063] Step 201c: The electronic device, through the NPU, determines the third value corresponding to each NPU task based on the process type of the process called by each NPU task.

[0064] In this embodiment of the application, the third value is used to characterize the importance of the process of request invocation.

[0065] Optionally, in this embodiment of the application, the above process type may have a third correspondence with the third value, and the electronic device may determine the third value corresponding to each NPU task based on the third correspondence.

[0066] Optionally, in the embodiments of this application, the aforementioned third correspondence can be preset by the electronic device or user-defined, and can be determined according to actual usage needs. The embodiments of this application do not impose any restrictions.

[0067] For example, as shown in Table 3, the above third correspondence is explained.

[0068] Table 3

[0069]

[0070] It should be noted that the third weighted value mentioned above is the third value.

[0071] Step 201d: The electronic device determines the scheduling priority of each NPU task through the NPU, based on the first value, second value and third value corresponding to each NPU task.

[0072] In this embodiment of the application, the electronic device can perform a weighted summation of the first value, the second value, and the third value to obtain the scheduling priority corresponding to each task. Specifically, this can be achieved through the following formula (1), which is:

[0073] NPU task priority = coefficient A * weighted priority of task configuration + coefficient B * weighted application category + coefficient C * weighted Android adj value mapping (1)

[0074] Among them, the priority of the task configuration is weighted by the second value mentioned above, the application category is weighted by the first value mentioned above, the Android adj value mapping is weighted by the third value mentioned above, and coefficients A, B and C are the corresponding weights.

[0075] It is understandable that the sum of the above coefficients A, B, and C is 1.

[0076] Optionally, in this application embodiment, if the priority obtained after the weighted operation of the first three parts of the above scenario does not meet the expectations, a special case needs to be formulated through the special weighted part. In this part, a specific weight is given to this scenario, and it participates in the weighted operation again, thereby achieving the purpose of improving the priority. Specifically, it can be achieved through the following formula (2).

[0077] NPU task priority = coefficient A * task-side configuration priority weighting + coefficient B * application category weighting + coefficient C * Android adj value mapping weighting + special weighting (2)

[0078] Optionally, in this embodiment of the application, the electronic device can continuously monitor and optimize the coefficient ratios of various dimensions to ensure that the NPU task priority meets user expectations and system load status.

[0079] In this embodiment, the electronic device calculates the scheduling priority of each task from different dimensions, thereby improving the accuracy of the scheduling priority obtained by the electronic device.

[0080] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 3 As shown, step 202 can be implemented through steps 202a and 202b below.

[0081] Step 202a: The electronic device adds each NPU task to the task scheduling queue corresponding to the scheduling priority based on the scheduling priority of each NPU task.

[0082] In this embodiment of the application, the same scheduling priority corresponds to the same task scheduling queue.

[0083] In this embodiment of the application, when an application initiates an NPU task, the electronic device can calculate the scheduling priority of each NPU task according to the above scheduling priority specification, and then add each NPU task to the corresponding task scheduling queue according to the scheduling priority to wait for scheduling.

[0084] For example, as shown in Table 4, the above task scheduling queue is explained.

[0085] Table 4

[0086]

[0087] Optionally, in this embodiment of the application, the task scheduling queue can be divided into two layers: the first layer is the task queue, which stores the head pointer information of the four priority queues; the second layer is the priority queue, where each priority corresponds to a doubly linked list, and the linked list stores task nodes of the same priority in first-in-first-out (FIFO) order.

[0088] Optionally, in this embodiment, the task scheduling queue can correspond to a task scheduler, which is responsible for queuing, priority management, state scheduling, and lifecycle management of AI inference tasks, ensuring fairness and efficiency when multiple tasks are concurrent. Core functions include: task enqueueing: inserting NPU tasks into the corresponding queue according to priority; task dequeueing: retrieving tasks to be executed in priority order; priority adjustment: supporting dynamic modification of task priorities; and state management: maintaining task lifecycle state transitions.

[0089] For example, as shown in Table 5, the above priority adjustment can support the following dynamic adjustment strategies when the task priority changes or the execution order needs to be adjusted.

[0090] Table 5

[0091]

[0092] For example, the above task lifecycle state transitions can be as follows: Each NPU task goes through the following state transitions from creation to completion: PENDING: The task has entered the queue and is waiting for scheduling; RUNNING: The task is being executed; PAUSED: The task is paused; SUCCESSED: The task is completed normally; FAILED: The task execution encountered an error; CANCELLED: The task was canceled by the user.

[0093] For example, the above state transition rules are as follows: after a task is created, it enters the PENDING state; after being retrieved by the scheduler, it enters the RUNNING state; after execution, it enters the SUCCESSED or FAILED state based on the result; and the user can cancel the task at any time to make it enter the CANCELLED state.

[0094] Step 202b: The electronic device uses the NPU to schedule NPU tasks in each task scheduling queue in descending order of scheduling priority.

[0095] In this embodiment of the application, the electronic device can start scheduling from the task scheduling queue with the highest scheduling priority, and continue to schedule the task scheduling queue corresponding to the next scheduling priority after the task scheduling queue with the highest priority is empty, and so on, until the NPU task scheduling in all task scheduling queues is completed.

[0096] In this embodiment, the NPU multi-task scheduling architecture specifically addresses the issues of functional failure caused by resource preemption and the limitation of concurrency capabilities due to resource exclusivity. By defining NPU task priority specifications, the priority of each task is qualitatively evaluated to align with user expectations of task importance. By establishing four priority queues and the TaskDispatcher priority scheduling mechanism, it ensures that when multiple NPU tasks initiate requests simultaneously, high-priority NPU tasks can respond quickly, improving NPU utilization.

[0097] Optionally, in this embodiment of the application, the scheduling priority includes a scheduling value and a scheduling level.

[0098] For example, combined Figure 3 ,like Figure 4 As shown, step 202a above can be implemented through step 202a1 below.

[0099] 202a1. Based on the scheduling value and scheduling level corresponding to each NPU task, the electronic device adds each NPU task to the corresponding task scheduling queue in descending order.

[0100] In this embodiment of the application, the scheduling value is the value obtained after the weighting.

[0101] In this embodiment of the application, by establishing four priority queues and a Task Dispatcher priority scheduling mechanism, it is ensured that when multiple NPU tasks initiate requests at the same time, high-priority NPU tasks can respond quickly, thereby improving NPU utilization.

[0102] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 5 As shown, after step 202 above, the task scheduling method provided in this application embodiment further includes step 301 as follows.

[0103] Step 301: During the execution of the first NPU task, if it is detected that the scheduling priority of the second task is greater than that of the first NPU task, the electronic device interrupts the first NPU task and schedules the second NPU task through the NPU.

[0104] In this embodiment of the application, the first NPU task is any one of at least two NPU tasks.

[0105] It is understandable that the second NPU task mentioned above is the current NPU task.

[0106] In this embodiment, when the scheduling value corresponding to the second NPU task is detected to be the highest, the electronic device can prioritize the execution of the second NPU task, thereby avoiding the waiting of the second NPU task and improving the flexibility of task scheduling.

[0107] It should be noted that the above-described method embodiments, or the various possible implementations of the method embodiments, can be executed individually, or, provided there are no contradictions, they can be combined with each other. The specific implementation can be determined according to actual usage requirements, and this application embodiment does not impose any restrictions on this.

[0108] It should be noted that the task scheduling method provided in this application embodiment can be executed by a task scheduling device. This application embodiment uses the execution of the task scheduling method by a task scheduling device as an example to illustrate the task scheduling device provided in this application embodiment.

[0109] Figure 6 A schematic diagram of a possible structure of the task scheduling device involved in an embodiment of this application is shown. For example... Figure 6 As shown, the task scheduling device 70 may include a determination module 71 and a processing module 72.

[0110] The determining module 71 is used to determine the scheduling priority of each NPU task based on the attribute information corresponding to at least two NPU tasks; the attribute information includes at least one of application type, task type, and process type of the process that makes the request. The processing module 72 is used to schedule each NPU task through the NPU based on the scheduling priority of each NPU task determined by the determining module 71.

[0111] In one possible implementation, the determining module 71 is specifically used to: determine a first value for each NPU task based on the application type corresponding to each NPU task, the first value representing the importance of the application initiating the NPU task; determine a second value for each NPU task based on the task type corresponding to each NPU task, the second value representing the urgency of the application initiating the NPU task in running the NPU task; determine a third value for each NPU task based on the process type of the process to be invoked by each NPU task, the third value representing the importance of the process to be invoked; and determine the scheduling priority for each NPU task based on the first, second, and third values ​​corresponding to each NPU task.

[0112] In one possible implementation, the processing module 72 is specifically used to add each NPU task to the task scheduling queue corresponding to the scheduling priority based on the scheduling priority of each NPU task, with the same scheduling priority corresponding to the same task scheduling queue; and through the NPU, to schedule the NPU tasks in each task scheduling queue in descending order of scheduling priority based on the scheduling priority corresponding to each task scheduling queue.

[0113] In one possible implementation, the scheduling priority includes a scheduling value and a scheduling level; the processing module 72 is specifically used to add each NPU task to the corresponding task scheduling queue in descending order of the scheduling value and scheduling level corresponding to each NPU task.

[0114] In one possible implementation, the processing module 72 is further configured to schedule each NPU task based on the scheduling priority corresponding to each NPU task, and then, during the execution of the first NPU task, if it is detected that the scheduling priority corresponding to the second NPU task is greater than the scheduling priority of the first NPU task, the execution of the first NPU task is interrupted, and the second NPU task is scheduled through the NPU, wherein the first NPU task is any one of at least two NPU tasks.

[0115] In the task scheduling device provided in this application embodiment, the scheduling priority of each NPU task is determined by at least one of the application type, task type and process type of the process that needs to be called by at least two NPU tasks. Thus, the task is selected for priority scheduling according to the scheduling priority of each NPU task, thereby improving the efficiency of NPU task scheduling.

[0116] The task scheduling device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0117] The task scheduling device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system.

[0118] The task scheduling device provided in this application embodiment can implement the various processes implemented in the above method embodiment, and will not be described again here to avoid repetition.

[0119] Optionally, such as Figure 7 As shown, this application embodiment also provides an electronic device 90, including a processor 91 and a memory 92. The memory 92 stores a program or instructions that can run on the processor 91. When the program or instructions are executed by the processor 91, they implement the various steps of the above-described task scheduling method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0120] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0121] Figure 8 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0122] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.

[0123] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 8 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0124] The processor 110 is configured to determine the scheduling priority of each NPU task based on the attribute information corresponding to at least two NPU tasks, wherein the attribute information includes at least one of application type, task type and process type of the process to be invoked; and to schedule each NPU task based on the scheduling priority of each NPU task.

[0125] Optionally, in this embodiment of the application, the processor 110 is specifically configured to: determine a first value for each NPU task based on the application type corresponding to each NPU task, wherein the first value characterizes the importance of the application initiating the NPU task; determine a second value for each NPU task based on the task type corresponding to each NPU task, wherein the second value characterizes the urgency of the application initiating the NPU task in running the NPU task; determine a third value for each NPU task based on the process type of the process to be invoked by each NPU task, wherein the third value characterizes the importance of the process to be invoked; and determine the scheduling priority for each NPU task based on the first, second, and third values ​​corresponding to each NPU task.

[0126] Optionally, in this embodiment of the application, the processor 110 is specifically used to add each NPU task to the task scheduling queue corresponding to the scheduling priority based on the scheduling priority corresponding to each NPU task, with the same scheduling priority corresponding to the same task scheduling queue; and to perform task scheduling on the NPU tasks in each task scheduling queue in descending order of the scheduling priority corresponding to each task scheduling queue.

[0127] Optionally, in this embodiment of the application, the scheduling priority includes a scheduling value and a scheduling level; the processor 110 is specifically used to add each NPU task to the corresponding task scheduling queue in descending order based on the scheduling value and scheduling level corresponding to each NPU task.

[0128] Optionally, in this embodiment of the application, the processor 110 is further configured to schedule each NPU task based on the scheduling priority corresponding to each NPU task through the NPU, and if it is detected that the scheduling priority of the second NPU task is greater than the scheduling priority of the first NPU task during the execution of the first NPU task, the execution of the first NPU task is interrupted, and the second NPU task is scheduled through the NPU, wherein the first NPU task is any one of at least two NPU tasks.

[0129] In the electronic device provided in this application embodiment, the scheduling priority of each NPU task is determined by at least one of the application type, task type and process type of the process that needs to be called by at least two NPU tasks, thereby selecting the priority scheduling task according to the scheduling priority of each NPU task, thus improving the efficiency of NPU task scheduling.

[0130] The electronic device provided in this application embodiment can implement the various processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0131] The beneficial effects of the various implementation methods in this embodiment can be found in the beneficial effects of the corresponding implementation methods in the above method embodiments. To avoid repetition, they will not be repeated here.

[0132] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0133] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0134] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.

[0135] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0136] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0137] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0138] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0139] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above method embodiments and achieve the same technical effects. To avoid repetition, it will not be described again here.

[0140] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0141] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0142] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A task scheduling method, characterized in that, The method includes: Based on the attribute information corresponding to at least two neural network processor (NPU) tasks, the scheduling priority of each NPU task is determined; the attribute information includes at least one of application type, task type, and process type of the process that needs to be invoked. The NPU schedules each NPU task based on its scheduling priority.

2. The method according to claim 1, characterized in that, The step of determining the scheduling priority of each NPU task based on the attribute information corresponding to at least two NPU tasks includes: Based on the application type corresponding to each NPU task, a first value is determined for each NPU task, and the first value is used to characterize the importance of the application that initiated the NPU task. Based on the task type corresponding to each NPU task, a second value is determined for each NPU task. The second value is used to characterize the urgency of the application that initiated the NPU task in running the NPU task. Based on the process type of the process invoked by each NPU task, a third value is determined for each NPU task, which is used to characterize the importance of the process invoked. Based on the first value, the second value, and the third value corresponding to each NPU task, the scheduling priority corresponding to each NPU task is determined.

3. The method according to claim 1 or 2, characterized in that, The step of scheduling each NPU task using the NPU based on the scheduling priority corresponding to each NPU task includes: Based on the scheduling priority corresponding to each NPU task, each NPU task is added to the task scheduling queue corresponding to the scheduling priority, and the same scheduling priority corresponds to the same task scheduling queue. The NPU schedules NPU tasks in each task scheduling queue in descending order of their scheduling priority.

4. The method according to claim 3, characterized in that, The scheduling priority includes a scheduling value and a scheduling level; the step of adding each NPU task to the task scheduling queue corresponding to the scheduling priority of each NPU task includes: Based on the scheduling value and scheduling level corresponding to each NPU task, each NPU task is added to the corresponding task scheduling queue in descending order.

5. The method according to claim 1, characterized in that, After scheduling each NPU task based on its scheduling priority using the NPU, the method further includes: If, during the execution of the first NPU task, it is detected that the scheduling priority of the second NPU task is greater than that of the first NPU task, the execution of the first NPU task is interrupted, and the second NPU task is scheduled through the NPU. The first NPU task is any one of the at least two NPU tasks.

6. A task scheduling device, characterized in that, The task scheduling device includes: a determination module and a processing module; The determining module is used to determine the scheduling priority of each task based on the attribute information corresponding to at least two NPU tasks; the attribute information includes at least one of application type, task type, and process type of the process that needs to be invoked. The processing module is used to schedule each NPU task based on the scheduling priority corresponding to each NPU task determined by the determining module, through the NPU.

7. The apparatus according to claim 6, characterized in that, The determining module is specifically used to determine a first value corresponding to each NPU task based on the application type corresponding to each NPU task. The first value is used to characterize the importance of the application that initiated the NPU task. Based on the task type corresponding to each NPU task, a second value is determined for each NPU task. The second value is used to characterize the urgency of the application that initiated the task in running the NPU task. Based on the process type of the process invoked by each NPU task, a third value is determined for each NPU task, which is used to characterize the importance of the process invoked. Based on the first value, the second value, and the third value corresponding to each NPU task, the scheduling priority corresponding to each NPU task is determined.

8. The apparatus according to claim 6 or 7, characterized in that, The processing module is specifically used to add each NPU task to the task scheduling queue corresponding to the scheduling priority based on the scheduling priority of each NPU task, with the same scheduling priority corresponding to the same task scheduling queue; and through the NPU, to schedule the NPU tasks in each task scheduling queue in descending order of scheduling priority based on the scheduling priority corresponding to each task scheduling queue.

9. The apparatus according to claim 8, characterized in that, The scheduling priority includes a scheduling value and a scheduling level; the processing module is specifically used to add each NPU task to the corresponding task scheduling queue in descending order of the scheduling value and scheduling level corresponding to each NPU task.

10. The apparatus according to claim 9, characterized in that, The processing module is further configured to schedule each NPU task based on the scheduling priority corresponding to each NPU task, and then, during the execution of the first NPU task, if it is detected that the scheduling priority of the second NPU task is greater than the scheduling priority of the first NPU task, interrupt the execution of the first NPU task and schedule the second NPU task through the NPU, wherein the first NPU task is any one of the at least two NPU tasks.

11. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the task scheduling method as described in any one of claims 1 to 5.

12. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the task scheduling method as described in any one of claims 1 to 5.

13. A computer program product, characterized in that, The computer program product is stored in a storage medium, and the program product is executed by at least one processor to implement the steps of the task scheduling method as described in any one of claims 1 to 5.