Task running method and device and related equipment

By using the data dependency method in the task-level programming model to realize task dependency expression, the complexity problem of requiring two sets of implementations in the traditional method is solved, which improves the operability of hardware acceleration and reduces the cost.

CN118550659APending Publication Date: 2024-08-27HUAWEI TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310226120.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-27
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

Traditional methods that simultaneously support the expression of task dependencies and data dependencies in a task-level programming model require two different sets of programming models and runtime underlying implementations, resulting in increased project development complexity and hindered operability of hardware acceleration solutions.

Method used

Implement task dependency expression through data dependency, use task identifiers as special data objects to indicate task dependency relationships, and then support two operating modes of task dependence and data dependence with the underlying implementation of data expression.

Benefits of technology

It reduces the obstacles of hardware acceleration solutions, improves operability, reduces the cost of hardware acceleration, and simplifies development complexity and engineering workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550659A
    Figure CN118550659A
Patent Text Reader

Abstract

The embodiment of the invention provides a task running method and device and related equipment. The task running method is applied to a task scheduler, and a plurality of tasks run in the task scheduler. A plurality of tasks comprise a first task and a second task, and the method comprises the steps that a dependency relationship corresponding to the second task is determined based on input information of the second task, the input information of the second task comprises a first task identifier, the first task identifier is used for indicating the first task, and the dependency relationship indicates that the second task depends on the first task; based on the dependency relationship corresponding to the second task, determining a running sequence between the first task and the second task; and according to the running sequence, after the first task finishes running, running the second task. By implementing the embodiment of the invention, two expression modes of supporting task dependence and data dependence at the same time can be realized based on a bottom layer of data dependence, the operability of a hardening acceleration scheme is improved, and the complexity and project amount of project development are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a task execution method, device and related equipment. Background Art

[0002] The programming model is a paradigm abstraction that the computer system provides to users for programming. In the field of general computing, there are two common types of programming models: thread-level programming model and task-level programming model. Among them, the task-level programming model is based on the task as the core abstraction, that is, the program is written as a combination of tasks, and the compiler handles the mapping of tasks to threads or execution units at runtime.

[0003] Currently, there are two architectures in the task-level programming model: data dependency-based and task dependency-based. The difference lies in how the dependencies between different tasks are expressed. The data dependency architecture refers to specifying the data used by each task, while the task dependency architecture refers to specifying the other tasks that each task depends on. Therefore, the underlying expressions of the data dependency architecture and the task dependency architecture are different. In many systems, especially terminal systems, heterogeneous computing is increasing day by day. Developers of many businesses prefer task dependency expressions, while developers of other businesses prefer data dependency expressions. Therefore, it is crucial to provide an expression method that supports both data dependency and task dependency.

[0004] However, the traditional method supports both task dependency and data dependency expressions at the same time, which requires two different programming models and runtime underlying implementations, which brings a heavy burden to the system, increases the complexity and workload of project development, and also hinders the operability of hardening acceleration solutions.

[0005] Therefore, providing a method that can support both task dependency expression and data dependency expression in the programming model while using the same programming model and runtime underlying implementation is an urgent problem to be solved. Summary of the invention

[0006] The embodiments of the present application provide a task running method, apparatus and related equipment to achieve a data expression mode that supports both task dependency and data dependency.

[0007] In a first aspect, an embodiment of the present application provides a task running method, which is applied to a task scheduler, wherein multiple tasks are running in the task scheduler; the multiple tasks include a first task and a second task, and the method includes: determining a dependency relationship corresponding to the second task based on input information of the second task, the input information of the second task including a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task; determining a running order between the first task and the second task based on the dependency relationship corresponding to the second task; and running the second task after the first task is finished running in accordance with the running order.

[0008] In the prior art, the task dependency expression and data dependency expression between different tasks are supported at the same time, which often requires two sets of underlying implementations, hindering the development of hardware acceleration. In the embodiment of the present application, the task dependency expression between different tasks can be realized by means of data dependency, that is, the data expression between different tasks when there is task dependency is realized by indicating the task in a way of a special data object (task identifier, which can also be referred to as a task handle), and then the underlying implementation of data expression simultaneously supports two sets of operation of task dependency and data dependency. Exemplarily, when running multiple tasks, when the input information of the task obtained (such as: the input information of the second task) includes a task identifier, the task can be determined as a task-dependent task based on the task identifier in the input information, and the dependency relationship between the task and the task corresponding to the task identifier can be determined. It can be understood that the input information corresponding to the task will include the task identifier of the dependent task (that is, the input information of the second task includes the task identifier corresponding to the first task). In other words, when the input information of the task includes the task identifier, it indicates that the task depends on the task corresponding to the task identifier, that is, the task dependency expression is realized by means of data dependency. After determining the dependencies between tasks, the task scheduler can determine the running order between tasks through the dependencies, and then can run multiple tasks according to the running order. For example: when the dependency indicates that the second task depends on the first task, the second task needs to run after the first task. Therefore, the embodiment of the present application supports both task dependency and data dependency through the data expression mode, which reduces the obstacles of the hardening acceleration scheme compared to the implementation of two different running modes in the prior art, improves operability and reduces the cost of hardware acceleration.

[0009] In one possible implementation, the method further includes: obtaining task information of the first task and generating the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identification information corresponding to the first task identifier; after the second task and the first task are both completed, recycling the first task identifier.

[0010] In an embodiment of the present application, after receiving the task information of the first task, if it is determined that the first task needs to return the first task identifier after the operation is completed (that is, the task information includes the identification information corresponding to the first task identifier), the task scheduler needs to generate a task identifier, and in order for the task identifier to function normally during operation, the task scheduler also needs to manage the life cycle of the task identifier, and the life cycle of the task identifier needs to cover the task it indicates, as well as the life cycle of the task that depends on the indicated task to run, that is, the first task identifier indicates the first task from the time it is generated to the time period after the first task runs and the second task that depends on the first task runs. The first task identifier is used to uniquely indicate the first task, and can only be generated to indicate other tasks as needed after it is recycled. In this regard, the data expression when the task is dependent is realized by indicating the task through the task identifier, and then the underlying implementation of the data expression supports both task dependency and data dependency at the same time, reducing the obstacles of the hardened acceleration solution, improving operability and reducing the cost of hardware acceleration.

[0011] In one possible implementation, the multiple tasks also include a third task, the output information of the third task includes a first storage address, and the input information of the second task also includes the first storage address; the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; determining the running order between the first task and the second task based on the dependency relationship corresponding to the second task includes: determining the running order between the first task, the second task and the third task based on the dependency relationship corresponding to the second task; running the second task in accordance with the running order after the first task is completed includes: running the second task in accordance with the running order after the first task and the third task are both completed.

[0012] In an embodiment of the present application, the output information of the third task includes a first storage address, and the input information of the second task may also include the first storage address. Among them, the storage address is used to correspond to the output of a task, that is, the storage area corresponding to the storage address is used to store the relevant data after the task is completed, and the relevant data can be considered as the output of the task after the operation is completed. For example, the output information of the third task includes a first storage address, and the storage area corresponding to the first storage address is used to store the data output after the third task is completed. Therefore, in the embodiment of the present application, the second task can not only be dependent on the first task through the task identification task, but also be dependent on the third task through the storage address data. Compared with the prior art, where only the data expression mode exists, the embodiment of the present application is more generally applicable to various application scenarios, increases the expression form of traditional data dependence, greatly reduces the complexity and engineering workload of development, and the embodiment of the present application can more flexibly support users to realize data dependency expression and task dependency expression, greatly improving the compatible expression ability of data dependency in the prior art.

[0013] In one possible implementation, the multiple tasks also include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the method also includes: comparing the task acquisition times corresponding to the fourth task and the fifth task respectively to obtain a comparison result; determining the dependency relationship corresponding to the second task based on the input information of the second task includes: determining the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task.

[0014] In an embodiment of the present application, the task output of a task after the operation is completed can correspond to a storage address, but a storage address can correspond to the task output of different tasks in different time periods. When the output information of two tasks includes the same storage address, the storage address corresponding to the task output will be adjusted according to the corresponding task acquisition time. Correspondingly, the two tasks also have a dependency relationship through the storage addresses corresponding to the task output. Exemplarily, when the second storage address is included in the input information of the second task, and the output information of the fourth task and the output information of the fifth task both include the second storage address, the task scheduler can determine whether the task on which the data of the second task depends is the fourth task or the fifth task according to the order in which the fourth task and the fifth task are obtained. At the same time, the running order between the fourth task and the fifth task can also be determined according to the order.

[0015] In one possible implementation, the determining the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task includes: if the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determining that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes the running order between the second task, the first task and the fifth task; the method also includes: after the fourth task is completed, running the fifth task; and after the fifth task is completed, updating the second storage address from the output corresponding to the fourth task to the output corresponding to the fifth task.

[0016] In an embodiment of the present application, when the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, it means that the fifth task is closer to the second task than the fourth task, and the latest task output corresponding to the second storage address is the output of the fifth task. Therefore, it can be determined that the dependency relationship corresponding to the second task indicates that the second task depends on the fifth task. In addition, based on the comparison result of the task acquisition time, the running order between the fourth task and the fifth task can also be determined, that is, after the fourth task is completed, the fifth task is run, and after the fifth task is completed, the second storage address is updated from the output corresponding to the fourth task to the output corresponding to the fifth task. Based on this, the task scheduler at runtime can determine the dependency relationship between multiple tasks, and the expression form of traditional data dependency is also increased.

[0017] In one possible implementation, the multiple tasks also include a sixth task, and the output information of the sixth task includes a third storage address; the method also includes: obtaining input information of the first task, and the input information of the first task includes the third storage address; determining the dependency relationship corresponding to the second task based on the input information of the second task includes: determining the dependency relationship corresponding to the second task based on the input information of the second task and the input information of the first task, and the dependency relationship includes the running order between the second task, the first task and the third task.

[0018] In an embodiment of the present application, in order to determine the dependency between multiple tasks, the input information of the multiple tasks is obtained respectively, and based on the task identifiers and / or storage addresses carried in the input information, the dependency between tasks can be determined, and then the corresponding running order can be determined. This method of judging the dependency between tasks based on input information and the input information can carry task identifiers enables the embodiment of the present application to support both task dependency and data dependency through a data expression mode, normalizes the underlying running logic, and reduces the obstacles to the hardening acceleration scheme compared to the implementation of two different running modes in the prior art, improves operability and reduces the cost of hardware acceleration.

[0019] In a second aspect, an embodiment of the present application provides a task running device, which is applied to a task scheduler, wherein a plurality of tasks are run in the task scheduler; the plurality of tasks include a first task and a second task, and the device includes:

[0020] a dependency unit, configured to determine a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task;

[0021] A first determining unit, configured to determine a running order between the first task and the second task based on a dependency relationship corresponding to the second task;

[0022] The running unit is used to run the second task after the first task is finished running according to the running order.

[0023] In one possible implementation, the device also includes: an acquisition unit, used to acquire task information of the first task and generate the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identification information corresponding to the first task identifier; and a recycling unit, used to recycle the first task identifier after the second task and the first task are both completed.

[0024] In one possible implementation, the multiple tasks also include a third task, the output information of the third task includes a first storage address, and the input information of the second task also includes the first storage address; the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; the first determination unit is specifically used to: determine the running order between the first task, the second task and the third task based on the dependency relationship corresponding to the second task; the running unit is specifically used to: run the second task after the first task and the third task are both finished running in accordance with the running order.

[0025] In one possible implementation, the multiple tasks also include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the device also includes: a comparison unit, used to compare the task acquisition time corresponding to the fourth task and the fifth task respectively, to obtain a comparison result; the dependency unit is specifically used to: determine the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task.

[0026] In one possible implementation, the dependency unit is specifically used to: if the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determine that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes the running order between the second task, the first task and the fifth task; the device also includes an update unit for: after the fourth task is completed, running the fifth task; and after the fifth task is completed, updating the second storage address from the output corresponding to the fourth task to the output corresponding to the fifth task.

[0027] In one possible implementation, the multiple tasks also include a sixth task, and the output information of the sixth task includes a third storage address; the device also includes: a second determination unit, used to determine the input information of the first task, and the input information of the first task includes the third storage address; the first determination unit is specifically used to: determine the dependency relationship corresponding to the second task based on the input information of the second task and the input information of the first task, and the dependency relationship includes the running order between the second task, the first task and the third task.

[0028] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a task scheduler, wherein a plurality of tasks are run in the task scheduler; the plurality of tasks include a first task and a second task, and the task scheduler is used to:

[0029] Determining a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task;

[0030] Determining a running order between the first task and the second task based on a dependency relationship corresponding to the second task;

[0031] According to the execution sequence, after the execution of the first task is completed, the second task is executed.

[0032] In one possible implementation, the task scheduler is also used to: obtain task information of the first task, and generate the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identification information corresponding to the first task identifier; after the second task and the first task are both completed, reclaim the first task identifier.

[0033] In one possible implementation, the multiple tasks also include a third task, the output information of the third task includes a first storage address, and the input information of the second task also includes the first storage address; the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; the task scheduler is specifically used to: determine the running order between the first task, the second task and the third task based on the dependency relationship corresponding to the second task; the task scheduler is specifically used to: run the second task after the first task and the third task are both finished running in accordance with the running order.

[0034] In one possible implementation, the multiple tasks also include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the task scheduler is also used to: compare the task acquisition time corresponding to the fourth task and the fifth task respectively to obtain a comparison result; the task scheduler is specifically used to: determine the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task.

[0035] In one possible implementation, the task scheduler is specifically used to: if the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determine that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes the running order between the second task, the first task and the fifth task; the task scheduler is also used to: after the fourth task is completed, run the fifth task; and after the fifth task is completed, update the second storage address from the output corresponding to the fourth task to the output corresponding to the fifth task.

[0036] In one possible implementation, the multiple tasks also include a sixth task, and the output information of the sixth task includes a third storage address; the task scheduler is also used to: obtain input information of the first task, and the input information of the first task includes the third storage address; the task scheduler is specifically used to: determine the dependency relationship corresponding to the second task based on the input information of the second task and the input information of the first task, and the dependency relationship includes the running order between the second task, the first task and the third task.

[0037] In a fourth aspect, an embodiment of the present application provides a computer program, which includes instructions. When the computer program is executed by a computer, the computer can execute the process executed by the task running device in the second aspect above.

[0038] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer software instructions used by a task execution device provided in the second aspect, which includes a program designed for executing the above aspect.

[0039] In a sixth aspect, an embodiment of the present application provides an electronic device, the electronic device includes a task scheduler and a memory, and the task scheduler is configured to support the electronic device to implement the corresponding functions in the task running method provided in the first aspect. The electronic device may also include a memory, the memory is used to couple with the processor, and it stores the necessary program instructions and data of the electronic device. The electronic device may also include a communication interface for the electronic device to communicate with other devices or a communication network through a wired serial bus. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments of the present application or the background technology will be described below.

[0041] Figure 1 It is a schematic diagram of the architecture of a task execution system provided in an embodiment of the present application.

[0042] Figure 2 This is a life cycle diagram for a task identifier provided in an embodiment of the present application.

[0043] Figure 3 It is a flowchart of a task running method provided in an embodiment of the present application.

[0044] Figure 4 It is a structural diagram of a task running device provided in an embodiment of the present application.

[0045] Figure 5 It is a structural diagram of another task running device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0047] The terms "first", "second", "third", "fourth", "fifth" and "sixth" in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0048] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0049] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0050] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program and / or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process and / or an execution thread, and a component may be located on a computer and / or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may, for example, communicate through local and / or remote processes according to signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system and / or a network, such as the Internet interacting with other systems through signals).

[0051] First of all, in order to facilitate understanding of the embodiments of the present application, the technical problems and application scenarios that need to be solved by the embodiments of the present application are analyzed in detail below.

[0052] Currently, programming models are paradigm abstractions that computer systems provide to users for programming. In the field of general computing, there are two common categories of programming models: thread-level programming models and task-level programming models.

[0053] Among them, the task-level programming model uses tasks as the core abstraction. Users can write programs as a combination of tasks and let the compiler or task scheduler handle the mapping of tasks to threads or execution units. This task-level programming model has many advantages. The mapping of tasks to threads or execution units can be performed in user mode, which can be made lighter, so the granularity of tasks can be smaller than traditional threads. This smaller granularity means that more parallelism can be exploited in the system, thereby improving system performance and energy efficiency.

[0054] There are two architectures in the task-level programming model: data dependency-based and task dependency-based. The key difference lies in how the dependencies between tasks are expressed. The data dependency method refers to specifying the data used by each task, while the task dependency method refers to directly specifying the other tasks on which each task depends.

[0055] Specifically, because the data dependency method allows users to only care about the data used in a task when writing it, without having to care about other tasks. Therefore, the data dependency method mainly exists in the fields of artificial intelligence and supercomputing, while the task dependency method is suitable for the general computing field, especially in control flow-intensive programs designed according to business processes. The task dependency method can break down the program or transaction into several steps, focusing only on the relationship between each step (task) and the previous and subsequent steps (tasks), which is more convenient to express.

[0056] Data dependency and task dependency are two different task-level programming model design paradigms that often come with different internal implementations. Many business developers prefer task dependency expressions, while other business developers prefer data dependency expressions. Therefore, it is crucial to provide an expression method that supports both data dependency and task dependency.

[0057] However, the traditional method supports both task dependency and data dependency, which requires two different programming models and runtime underlying implementations. This places a heavy burden on the system and task scheduler, increases the complexity and workload of project development, and hinders the operability of hardened acceleration solutions. Hardware acceleration is a key means to improve system performance and energy efficiency after the current obstruction of Moore's Law.

[0058] Therefore, it is crucial to provide an implementation method that can support both task dependency and data dependency expressions in the programming model, but uses a normalized internal implementation to support the combination of software and hardware.

[0059] In this regard, the embodiment of the present application provides a task running method, device and related electronic device based on the underlying implementation of data dependency that can directly support the expression of task dependency. Among them, the task running method can be applied to a task scheduler, in which multiple tasks are running; the multiple tasks include a first task and a second task, and the method includes: based on the input information of the second task, determining the dependency relationship corresponding to the second task, the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task; based on the dependency relationship corresponding to the second task, determining the running order between the first task and the second task; according to the running order, after the first task runs, run the second task. For example: specify the input information IN and output information OUT of the task, access the corresponding data object or task object in the form of input information IN and output information OUT, and then rely on the task scheduler to perform correct scheduling to solve the problem that the existing technical solution supports two expressions of task dependency and data dependency at the same time, requires two different programming models and runtime underlying implementations, brings a great burden to the system and the task scheduler, increases the complexity and engineering workload of project development, and also hinders the operability of the hardening acceleration solution. Among them, the specific implementation method of the present application can refer to the relevant description of the following embodiments, and the embodiments of the present application will not be described in detail here.

[0060] Based on the technical issues raised above and to facilitate understanding of the embodiments of the present application, the following first describes one of the task execution system architectures on which the embodiments of the present application are based.

[0061] Please refer to the attached Figure 1 , Figure 1 Schematic diagram of the architecture of a task execution system provided in an embodiment of the present application. Figure 1 As shown, the task running system includes a user side 01 (also referred to as a device side, user state) and a running side 02 (i.e., a task scheduler side, also referred to as a host side, kernel state).

[0062] The user side 01 can receive task information corresponding to each of the multiple tasks input by the user, and the task information includes input information and output information of the corresponding task. If some or all of the multiple tasks are task-dependent tasks, the task information can also include task identifiers, etc. In addition, the task information can also include other relevant information such as functions, data types, processing methods, processing cores, etc. applicable to the corresponding tasks.

[0063] Exemplarily, the user side can receive task information corresponding to multiple tasks input by the user: Task 1: submit_task(func1, IN:{0x88, 0x9c}, OUT:{0x7c}); Task 2: h2=submit_task(func2, IN:{0x7c}, OUT:{}); Task 3: h3=submit_task(func3, IN:{h2}, OUT:{}).

[0064] Among them, submit task() represents the task, and the information in the brackets is the task information corresponding to the task, for example: fun XX represents the function information called by the task (such as: task 1 calls the fun c1 function; task 2 calls the fun c2 function; task 3 calls the fun c3 function). 0x88, 0x9c and 0x7c are storage addresses, which are used to indicate the data in the storage space corresponding to the storage address. h2 and h3 are identification information input by the user, which can instruct the running side to generate a task identifier indicating the task, so that the task identifier is used to indicate the logical output of the corresponding task after the running is completed.

[0065] It should be noted that the task information corresponding to the task that only has data dependency does not include the identification information of the task identifier (such as: Task 1), and the task information corresponding to the task that has task dependency and the task that is dependent on the task can include the identification information of the task identifier (such as: Task 3 and Task 2).

[0066] In addition, IN:{xxx} is used to indicate the input of the task, indicating the input object that the task accesses in IN mode, where the input information xxx in the brackets can be understood as the input object of the task (i.e.: the data object corresponding to the storage address or the task object corresponding to the task identifier). The task needs to access and obtain the input object before it can run normally. It can also be understood that the corresponding task is the consumer of the data object or task object in the brackets, so the task needs to wait for the previous producer of the object to end before it can start. For example: the input of task A is the data of storage address A, then task A is the consumer of the data of storage address A, so task A needs to wait until task B generates the data of storage address A before it can start running based on the data of storage address A.

[0067] OUT:{xxx} is used to indicate the output of the task, indicating the output object accessed by the task in OUT mode, wherein the output information xxx in the brackets can be understood as the output object of the task (which can be represented by a storage address or a task identifier). It should be noted that for tasks that have task dependencies and tasks that are dependent on tasks, since the task identifier has been used to indicate the task and the output after running the task, accordingly, the information in the OUT:{} brackets of this type of task can be empty, or in some other embodiments, the information in the OUT:{} brackets is consistent with its corresponding task identifier. It can also be understood that the corresponding task is the producer of the output object in the brackets (which can be understood as a data object or a task object), therefore, when the information in the OUT:{} brackets of at least two tasks is consistent (exemplarily: when the storage address is consistent, it means that the output data of at least two tasks are stored in the storage area corresponding to the storage address; when the task identifier is consistent, it means that the task identifier is reused after being recycled), in order to prevent conflicts when using the output object, the task needs to wait for the previous producer and consumer of the output object to end before it can start running.

[0068] It should be noted that the input information of each task may include one or more input objects; the output information of each task may include one or more output objects.

[0069] The operation side 02 dynamically schedules and runs the multiple tasks based on the task information corresponding to each task in the multiple tasks input by the user side. The operation side can be understood as a task scheduler. Exemplarily, the operation side determines the corresponding dependency relationship between the multiple tasks based on the input information (such as the above IN: {xxx}) and / or output information (such as the above OUT: {xxx}) of each task in the multiple tasks; then determines the operation order between the multiple tasks based on the corresponding dependency relationship between the multiple tasks; and finally runs the multiple tasks according to the operation order.

[0070] It should be noted that the operation side can also dynamically allocate and manage the life cycle of task identifiers. As a medium for connecting task dependencies and data dependencies, task identifiers can be reused to save computing and memory resources on the operation side.

[0071] In the case where task identifiers are reused, the life cycle of each task identifier corresponding to different tasks must not be repeated. The life cycle refers to the time period from when a task identifier indicates a task after it is generated to when it is recycled by the running side and no longer indicates the task. For details, please refer to the attached Figure 2 , Figure 2It is a life cycle diagram for a task identifier provided by an embodiment of the present application. For example, when the task information of the target task input by the user is obtained, it is determined that the task information of the target task includes identification information, and a target task identifier for indicating the target task can be generated. When the target task corresponding to the target task identifier is completed, and other tasks with a dependency relationship with the target task are also completed, the target task identifier can be recycled. After the target task identifier is recycled, the target task identifier can be generated again when needed (a task with the same identification information in another task information), so that the target task identifier indicates another task.

[0072] It is understandable that tasks with task dependencies (there is identification information in the task information) can generate a "special data object", that is, a task identifier, by the runtime (equivalent to the running side, task scheduler) when the task is submitted. At this time, the task identifier can indicate the task. When the task is running on the running side, the task identifier remains associated with the task until the running side no longer calls or runs the task currently corresponding to the task identifier. At this time, the task identifier can be recycled. Since the task identifier of each task is regarded by the task as an output object accessed in OUT mode, the dependency on the task identifier is accessed in IN mode. Therefore, if Figure 2 As shown, the life cycle of the "special data object" needs to satisfy the union of the life cycle of the task identifier on the user side and the life cycle of the task identifier on the running side. In this regard, in the reuse process, the task identifiers can only be reused if their life cycles do not overlap.

[0073] In addition, the embodiments of the present application do not impose any specific limitation on the specific use of task identifiers. For example, in other embodiments, task information of the first task can also be obtained, and when the task information includes identification information, the first task identifier corresponding to the identification information is associated with the first task, so that the first task identifier is used to indicate the first task; and after the second task and the first task are both completed, the association between the first task identifier and the first task is released, wherein after the association between the first task identifier and the first task is released, the first task identifier does not indicate the first task.

[0074] Based on the task running system architecture provided in the above embodiments and in combination with the task running method provided in this application, the technical problems raised in this application are specifically analyzed and solved.

[0075] See also Figure 3 , Figure 3 is a flowchart of a task running method provided in an embodiment of the present application, which can be applied to the above Figure 1 In the task running system architecture described in Figure 1 The user side 01 in the above can be used to perform step S101. Figure 1 The operation side 02 in the task execution method can be used to execute steps S102-S104. The detailed description of each step of the task execution method is as follows:

[0076] Step S101: Obtain input information of the second task.

[0077] Specifically, the task scheduler may receive multiple tasks input by the user, and obtain task information of each task, where the task information includes input information and output information of the corresponding task, etc. For example, the task scheduler may obtain input information of the second task based on the received task information of the second task.

[0078] For example, the user may enter the following code:

[0079] / / h1 task is the consumer of 0x88, 0x9c and the producer of 0x7c / / ;

[0080] submit_task(func1, IN: {0x88, 0x9c}, OUT: {0x7c});

[0081] / / h2 task is the consumer of 0x7c / / h2 task will depend on h1 task through "data dependency (0x7c)" / / ;

[0082] / / h2 variable is the task handle / / ;

[0083] h2=submit task(func2, IN:{0x7c}, OUT:{});

[0084] " / / h3 task will depend on h2 task through "task dependency" / / ;

[0085] h3=submit_task(func3, IN: (h2}, OUT: {});

[0086] / / The h4 task uses both "data dependency" and "task dependency" expressions, and depends on the h1 and h2 tasks / / ;

[0087] h4=submit task(func4, IN: {h2, 0x7c}, OUT: {}).

[0088] Thus, the task scheduler can obtain the input information of the task. At this time, the second task is equivalent to the h3 task in the above code.

[0089] In addition, the above code description is only an exemplary method provided by the embodiment of the present application, and the embodiment of the present application does not impose any specific limitation on this.

[0090] Step S102: Determine the dependency relationship corresponding to the second task based on the input information of the second task.

[0091] Specifically, the task scheduler may determine the dependency relationship corresponding to the second task based on the input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task.

[0092] It is understandable that the task scheduler can determine the dependency relationship corresponding to the task based on the input information of the task. Exemplarily, if the input information includes a storage address, it means that the task has a data object with data dependency; if the input information includes a task identifier, it means that the task has a task with task dependency; if the input information includes a storage address and a task identifier, it means that the task has both a data object with data dependency and a task with task dependency. For example: the input information of the second task includes a first task identifier, and the first task identifier is used to indicate the first task, then the dependency relationship corresponding to the second task indicates that the second task depends on the first task.

[0093] Optionally, the method also includes: obtaining task information of the first task and generating the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identification information corresponding to the first task identifier; after the second task and the first task are both completed, recycling the first task identifier.

[0094] It should be noted that if the task information corresponding to the task input by the user includes the identification information of the task identifier, the task scheduler can generate the corresponding task identifier. Exemplary: the task corresponding to the relevant code (equivalent to the task information) input by the user is: identification information = task name (calling function, IN: {input information}, OUT: {output information / null}), at this time, the task scheduler can generate a task identifier corresponding to the identification information. In addition, the task identifier can be specifically understood as a "special data object". This method of indicating tasks through task identifiers realizes data expression when tasks are dependent, and then supports both task dependency and data dependency at the same time with the underlying implementation of data expression.

[0095] It should also be noted that the identification information included in the task information refers to the identification in the task information that directly corresponds to the task, rather than the identification information of the task identification included in the input information. Exemplarily, the task corresponding to the relevant code (equivalent to the task information) input by the user is: the identification information S1 corresponding to the second task identification = Task A (calling function B, IN: {identification information S2 corresponding to the third task identification}, OUT: {}). It can be seen from the task information that the task information of task A includes the identification information S1 corresponding to the second task identification, and the input information includes the identification information S2 corresponding to the third task identification. Then, the task scheduler can generate a second task identification based on the identification information S1 corresponding to the second task identification to indicate task A. When running task A, it is necessary to rely on task B indicated by the third task identification. The task scheduler cannot generate a third task identification from the identification information S2 corresponding to the third task identification and use it to indicate task A.

[0096] In addition, in order for the task identifier to function properly at runtime, the task scheduler needs to manage the life cycle of the task identifier. The life cycle of the task identifier cannot be repeated, that is, the task identifier corresponds to the task one-to-one during the time period from when the task identifier is associated with the task to when it is disassociated.

[0097] Exemplarily, after the first task has finished running and the second task that called the first task has also finished running, the task scheduler can recycle the first task identifier, and the recycled first task identifier is no longer used to indicate the first task, and the recycled first task identifier can be generated / allocated by the task scheduler to be associated with other tasks again, and the first task identifier is used to indicate other tasks after being associated again. Among them, for the situation where the task identifier is reused, the relevant description of the above embodiment can also be referred to, and the embodiment of the present application will not be repeated here.

[0098] In other embodiments, the task identifier may also be referred to as a task handle. Moreover, the embodiment of the present application does not specifically limit the manner in which the task identifier is associated with the task. For example, the task scheduler may assign a task identifier to a target task from a plurality of task identifiers based on the identification information, and recycle the task identifier when the target task is finished and does not need to be called.

[0099] Step S103: determining the running order between the first task and the second task based on the dependency relationship corresponding to the second task.

[0100] Specifically, the task scheduler can determine the running order between the first task and the second task based on the dependency relationship corresponding to the second task. Since the dependency relationship can indicate that the second task depends on the first task, it means that the second task needs to be run after the first task is finished. Therefore, the task scheduler can determine the corresponding running order of multiple tasks based on the dependency relationship between them.

[0101] Step S104: After the first task is completed, the second task is executed according to the execution order.

[0102] Specifically, after the task scheduler determines the running order between multiple tasks, the multiple tasks can be run in the running order. For example: after the first task is finished running, the second task is run. In addition, the present application does not specifically limit the running order between multiple tasks that do not have a dependency relationship. Exemplarily, between multiple tasks that do not have a dependency relationship, if the relevant conditions such as running resources allow, the multiple tasks can be run in parallel, and this will not be elaborated in the embodiments of the present application.

[0103] Optionally, the multiple tasks also include a third task, the output information of the third task includes a first storage address, and the input information of the second task also includes the first storage address; the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; determining the running order between the first task and the second task based on the dependency relationship corresponding to the second task includes: determining the running order between the first task, the second task and the third task based on the dependency relationship corresponding to the second task; running the second task after the first task is completed in accordance with the running order includes: running the second task after the first task and the third task are both completed in accordance with the running order.

[0104] Among them, the input information of the second task also includes the first storage address, and the first storage address corresponds to the output of the third task, that is, it can be understood that the output data after the third task is completed is stored in the storage area corresponding to the first storage address. At this time, the input information of the second task includes the task identifier corresponding to the first task and the storage address corresponding to the third task. For example, the input information of the second task uses the expressions of "data dependence" and "task dependence" at the same time, and depends on the first task and the third task. Correspondingly, based on the input information, it can be determined that the second task depends on the first task and the third task at the same time, wherein the task depends on the first task and the data depends on the third task. Furthermore, the running order between the first task, the second task and the third task can be determined, that is, after the first task and the third task are completed, the second task is run. In addition, the embodiment of the present application does not specifically limit the running order between the first task and the third task.

[0105] It should be noted that the task identifier corresponds to the output after the task is logically completed. The storage address corresponds to the actual output data after the task is completed. From the above, it can be seen that when the input information of the task only includes the storage address, the dependency relationship between tasks is data dependency.

[0106] In addition, in the embodiment of the present application, the second task can not only depend on the first task through the task identification task, but also depend on the third task through the storage address data. Compared with the prior art where only the data expression mode exists, the embodiment of the present application is more generally applicable to various application scenarios, increases the expression form of traditional data dependency, greatly reduces the complexity and engineering workload of development, and the embodiment of the present application can more flexibly support users to realize data dependency expression and task dependency expression, greatly improving the compatible expression capability of data dependency in the prior art.

[0107] Optionally, the multiple tasks also include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the method also includes: comparing the task acquisition times corresponding to the fourth task and the fifth task respectively to obtain a comparison result; determining the dependency relationship corresponding to the second task based on the input information of the second task includes: determining the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task.

[0108] When the output of the task corresponding to the storage address is the input of other tasks, the other tasks will obtain the output of the task corresponding to the latest storage address. For example, when the second storage address is included in the input information of the second task, the second task will obtain the latest output information corresponding to the second storage address. The latest output information corresponding to the second storage address is determined according to the task acquisition time.

[0109] For example, the output information of the fourth task and the output information of the fifth task both include the second storage address. At this time, the task scheduler can determine the latest output information corresponding to the second storage address based on the order in which the fourth task and the fifth task are acquired, that is, the comparison result of the task acquisition time corresponding to the fourth task and the fifth task, and then determine whether the task on which the data of the second task depends is the fourth task or the fifth task. At the same time, the task scheduler can also determine the running order between the fourth task and the fifth task based on the comparison result.

[0110] It is understandable that for data-dependent tasks, each task output after running can correspond to a storage address, but a storage address can correspond to the output of different tasks in different time periods. When two tasks correspond to the same storage address, the storage address corresponding to the output will be adjusted according to the corresponding task acquisition time. Accordingly, the two tasks can have a dependency relationship through the output information of the tasks. It is understandable that the task acquisition time is equivalent to the time when the user submits the task on the user side.

[0111] Optionally, determining the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task includes: if the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determining that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes the running order between the second task, the first task and the fifth task; the method also includes: after the fourth task is completed, running the fifth task; and after the fifth task is completed, updating the second storage address from the output corresponding to the fourth task to the output corresponding to the fifth task.

[0112] When the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, it means that the fifth task is closer to the second task than the fourth task. Therefore, it can be determined that the dependency relationship corresponding to the second task indicates that the second task depends on the fifth task. In addition, based on the comparison result of the task acquisition time, the running order between the fourth task and the fifth task can also be determined, that is, after the fourth task is completed, the fifth task is run, and after the fifth task is completed, the second storage address is updated from the output corresponding to the fourth task to the output corresponding to the fifth task. This method of determining the dependency of tasks based on the task acquisition time when the outputs of the tasks are the same is conducive to the task scheduler at runtime to determine the dependency between multiple tasks, and also increases the expression form of traditional data dependency.

[0113] It should be noted that the task acquisition time of the fourth task and the fifth task is earlier than the task acquisition time of the second task.

[0114] In other embodiments, there is a situation where only one of the task acquisition time of the fourth task and the fifth task is earlier than the task acquisition time of the second task. For example, if the task acquisition time of the fourth task is earlier than the task acquisition time of the second task, and the task acquisition time of the fifth task is later than the task acquisition time of the second task, then it can be determined that the dependency relationship corresponding to the second task indicates that the second task depends on the fourth task.

[0115] In addition, since the task acquisition time of the fifth task is later than the task acquisition time of the second task, in order to prevent the second task from updating the second storage address to the output of the fifth task during the process of calling the data corresponding to the second storage address, causing task operation errors, the fifth task needs to wait for the preceding fourth task and the second task to finish before it can start (that is, it needs to wait for the preceding producer and consumer of the output object corresponding to the second storage address to finish before it can start). Therefore, when the outputs of multiple tasks are the same, the corresponding dependency relationship of the tasks can also be determined based on the comparison results of the task acquisition times corresponding to the multiple tasks and the input information of the tasks.

[0116] In other embodiments, in addition to determining the dependency relationship corresponding to the tasks based on the comparison results of the task acquisition times corresponding to the multiple tasks and the input information of the tasks, the dependency relationship corresponding to the tasks can also be determined based on other information and the input information of the tasks, and the embodiments of the present application do not specifically limit this. For example, it can also be based on other information such as the output information of the tasks, the preset running order, etc.

[0117] Optionally, the multiple tasks also include a sixth task, and the output information of the sixth task includes a third storage address; the method also includes: obtaining input information of the first task, and the input information of the first task includes the third storage address; determining the dependency relationship corresponding to the second task based on the input information of the second task includes: determining the dependency relationship corresponding to the second task based on the input information of the second task and the input information of the first task, and the dependency relationship includes the running order between the second task, the first task and the third task.

[0118] To determine the dependency between multiple tasks, the input information of the multiple tasks is obtained respectively. Based on the task identifiers and / or storage addresses carried in the input information, the dependency between tasks can be determined, and then the corresponding running order can be determined. This method of determining the dependency between tasks based on input information and the input information can carry task identifiers enables the embodiment of the present application to support both task dependency and data dependency through a data expression mode, normalizes the underlying running logic, and reduces the obstacles to the hardening acceleration solution compared to the implementation of two different running modes in the prior art, improves operability and reduces the cost of hardware acceleration.

[0119] It should be noted that one storage address corresponds to the output of one task, and different storage addresses correspond to the outputs of different tasks.

[0120] In summary, the task running method provided by the embodiment of the present application can realize the task dependency expression between different tasks by means of data dependency, that is, by indicating the task by a special data object (task identifier, which can also be referred to as a task handle) to realize the data expression between different tasks when there is task dependency, and then support the two sets of operation of task dependency and data dependency at the same time with the underlying implementation of data expression. Exemplarily, when running multiple tasks, when the input information of the task obtained (such as: the input information of the second task) includes the task identifier, the task can be determined as a task-dependent task based on the task identifier in the input information, and the dependency relationship between the task and the task identifier corresponding to the task can be determined. It can be understood that the input information corresponding to the task will include the task identifier of the dependent task (that is, the input information of the second task includes the task identifier corresponding to the first task). In other words, when the input information of the task includes the task identifier, it indicates that the task depends on the task corresponding to the task identifier, that is, the task dependency expression is realized by means of data dependency. After determining the dependency between tasks, the task scheduler can determine the running order between tasks by the dependency, and then multiple tasks can be run according to the running order. For example, when the dependency relationship indicates that the second task depends on the first task, the second task needs to be run after the first task. Therefore, the embodiment of the present application supports both task dependency and data dependency through the data expression mode, which reduces the obstacles of the hardening acceleration scheme, improves operability and reduces the cost of hardware acceleration compared to the implementation of two different operation modes in the prior art.

[0121] The method of the embodiment of the present application is described in detail above, and the related device of the embodiment of the present application is provided below.

[0122] See also Figure 4 , Figure 4 It is a structural diagram of a task running device provided in an embodiment of the present application.

[0123] like Figure 4 The task running device 10 is applied to the above Figure 1 The task running system architecture shown is also applicable to a task scheduler, in which multiple tasks are running; the multiple tasks include a first task and a second task. The task running device 10 may include: a dependency unit 201, a first determination unit 202 and an operation unit 203; and may also include: an acquisition unit 204, a recycling unit 205, a comparison unit 206, an update unit 207 and a second determination unit 208. The detailed description of each unit is as follows:

[0124] A dependency unit 201, configured to determine a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task;

[0125] A first determining unit 202, configured to determine a running order between the first task and the second task based on a dependency relationship corresponding to the second task;

[0126] The running unit 203 is used to run the second task after the first task is finished running according to the running order.

[0127] In one possible implementation, the device also includes: an acquisition unit 204, used to acquire task information of the first task and generate the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identification information corresponding to the first task identifier; a recycling unit 205, used to recycle the first task identifier after the second task and the first task are both completed.

[0128] In one possible implementation, the multiple tasks also include a third task, the output information of the third task includes a first storage address, and the input information of the second task also includes the first storage address; the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; the first determination unit 202 is specifically used to: determine the running order between the first task, the second task and the third task based on the dependency relationship corresponding to the second task; the running unit 203 is specifically used to: run the second task after the first task and the third task are both finished running in accordance with the running order.

[0129] In one possible implementation, the multiple tasks also include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the device also includes: a comparison unit 206, used to compare the task acquisition time corresponding to the fourth task and the fifth task respectively, to obtain a comparison result; the dependency unit 201 is specifically used to: determine the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task.

[0130] In one possible implementation, the dependency unit 201 is specifically used to: if the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determine that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes the running order between the second task, the first task and the fifth task; the device also includes an update unit 207 for: after the fourth task is completed, running the fifth task; and after the fifth task is completed, updating the second storage address from the output corresponding to the fourth task to the output corresponding to the fifth task.

[0131] In one possible implementation, the multiple tasks also include a sixth task, and the output information of the sixth task includes a third storage address; the device also includes: a second determination unit 208, used to determine the input information of the first task, and the input information of the first task includes the third storage address; the first determination unit 202 is specifically used to: determine the dependency relationship corresponding to the second task based on the input information of the second task and the input information of the first task, and the dependency relationship includes the running order between the second task, the first task and the third task.

[0132] It should be noted that the functions of the various functional modules in the task execution device 10 described in the embodiment of the present application can also be referred to in the above Figure 3 The descriptions of steps S101 to S104 in the method embodiment are not repeated here.

[0133] The embodiment of the present application also provides an electronic device, which can be a server, a desktop computer, a handheld computer, a notebook computer, a super mobile personal computer, a netbook, an artificial intelligence device, a vehicle-mounted device, etc. The electronic device includes a memory and a task scheduler, and the task scheduler runs multiple tasks; the multiple tasks include a first task and a second task, and the task scheduler is used to:

[0134] Determining a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task;

[0135] Determining a running order between the first task and the second task based on a dependency relationship corresponding to the second task;

[0136] According to the execution sequence, after the execution of the first task is completed, the second task is executed.

[0137] In one possible implementation, the task scheduler is also used to: obtain task information of the first task, and generate the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identification information corresponding to the first task identifier; after the second task and the first task are both completed, reclaim the first task identifier.

[0138] In one possible implementation, the multiple tasks also include a third task, the output information of the third task includes a first storage address, and the input information of the second task also includes the first storage address; the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; the task scheduler is specifically used to: determine the running order between the first task, the second task and the third task based on the dependency relationship corresponding to the second task; the task scheduler is specifically used to: run the second task after the first task and the third task are both finished running in accordance with the running order.

[0139] In one possible implementation, the multiple tasks also include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the task scheduler is also used to: compare the task acquisition time corresponding to the fourth task and the fifth task respectively to obtain a comparison result; the task scheduler is specifically used to: determine the dependency relationship corresponding to the second task based on the comparison result and the input information of the second task.

[0140] In one possible implementation, the task scheduler is specifically used to: if the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determine that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes the running order between the second task, the first task and the fifth task; the task scheduler is also used to: after the fourth task is completed, run the fifth task; and after the fifth task is completed, update the second storage address from the output corresponding to the fourth task to the output corresponding to the fifth task.

[0141] In one possible implementation, the multiple tasks also include a sixth task, and the output information of the sixth task includes a third storage address; the task scheduler is also used to: obtain input information of the first task, and the input information of the first task includes the third storage address; the task scheduler is specifically used to: determine the dependency relationship corresponding to the second task based on the input information of the second task and the input information of the first task, and the dependency relationship includes the running order between the second task, the first task and the third task.

[0142] It should be noted that the task scheduler mentioned in the embodiments of the present application may be a chip, a processor, a processing module, etc. The present application does not specifically limit the specific form of the task scheduler.

[0143] It should also be noted that the related functions of the electronic device described in the embodiments of the present application can be found in the above Figure 3 The related descriptions of steps S101 to S104 in the above method embodiment and other embodiments are not repeated here.

[0144] like Figure 5 As shown, Figure 5 2 is a schematic diagram of the structure of another task execution device provided in an embodiment of the present application, wherein the device 20 includes at least one processor 301, at least one memory 302, and at least one communication interface 303. In addition, the device may also include common components such as an antenna, which will not be described in detail here.

[0145] The processor 301 may be a general purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.

[0146] The communication interface 303 is used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), core network, Wireless Local Area Networks (WLAN), etc.

[0147] The memory 302 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.

[0148] The memory 302 is used to store application code for executing the above solution and store related data, and is controlled and executed by the processor 301. The processor 301 is used to execute the application code stored in the memory 302.

[0149] The code stored in the memory 302 can execute the above Figure 3 The provided task running method, for example, dynamically schedules and runs the multiple tasks based on the task information corresponding to each of the multiple tasks input by the user side. There are multiple tasks running in the processor; the multiple tasks include a first task and a second task, and the processor is used to execute: based on the input information of the second task, determine the dependency relationship corresponding to the second task, the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task; based on the dependency relationship corresponding to the second task, determine the running order between the first task and the second task; according to the running order, after the first task is finished running, run the second task.

[0150] It should be noted that the functions of the various functional units in the task execution device 20 described in the embodiment of the present application can be referred to in the above Figure 3 The descriptions of steps S101 to S104 in the method embodiment are not repeated here.

[0151] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0152] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0153] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program and / or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process and / or an execution thread, and a component may be located on a computer and / or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may, for example, communicate through local and / or remote processes according to signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system and / or a network, for example, the Internet interacting with other systems through signals).

[0154] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the above-mentioned units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0155] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0156] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0157] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform all or part of the steps of the above-mentioned methods of each embodiment of the present application. Among them, the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, read-only memory (Read-Only Memory, abbreviated: ROM) or random access memory (Random Access Memory, abbreviated: RAM) and other media that can store program codes.

[0158] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A task running method, characterized in that: Applied to a task scheduler, wherein a plurality of tasks are running in the task scheduler; The plurality of tasks include a first task and a second task, and the method includes: Determining a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task; Determining a running order between the first task and the second task based on a dependency relationship corresponding to the second task; According to the execution sequence, after the execution of the first task is completed, the second task is executed.

2. The method according to claim 1, characterized in that: The method further comprises: Acquire task information of the first task, and generate the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identifier information corresponding to the first task identifier; After the second task and the first task are both completed, the first task identifier is recovered.

3. The method according to claim 1 or 2, characterized in that: The plurality of tasks further include a third task, the output information of the third task includes a first storage address, and the input information of the second task further includes the first storage address; The dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; The determining the running order between the first task and the second task based on the dependency relationship corresponding to the second task includes: Determining a running order among the first task, the second task, and the third task based on a dependency relationship corresponding to the second task; According to the execution sequence, after the execution of the first task is completed, executing the second task includes: According to the execution sequence, after the execution of the first task and the third task is completed, the second task is executed.

4. The method according to claim 1 or 2, characterized in that: The multiple tasks further include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the method further includes: Comparing the task acquisition time corresponding to the fourth task and the fifth task respectively, to obtain a comparison result; The determining, based on the input information of the second task, the dependency relationship corresponding to the second task includes: Based on the comparison result and the input information of the second task, a dependency relationship corresponding to the second task is determined.

5. The method according to claim 4, characterized in that: The determining, based on the comparison result and the input information of the second task, the dependency relationship corresponding to the second task includes: If the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determining that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes a running order among the second task, the first task and the fifth task; The method further comprises: After the fourth task is completed, the fifth task is executed, and after the fifth task is completed, the second storage address is updated from the output corresponding to the fourth task to the output corresponding to the fifth task.

6. The method according to any one of claims 1 to 5, characterized in that: The plurality of tasks further include a sixth task, and the output information of the sixth task includes a third storage address; and the method further includes: Acquire input information of the first task, where the input information of the first task includes the third storage address; The determining, based on the input information of the second task, the dependency relationship corresponding to the second task includes: Based on the input information of the second task and the input information of the first task, a dependency relationship corresponding to the second task is determined, where the dependency relationship includes a running order among the second task, the first task, and the third task.

7. A task running device, characterized in that: Applied to a task scheduler, wherein a plurality of tasks are running in the task scheduler; The plurality of tasks include a first task and a second task, and the apparatus includes: a dependency unit, configured to determine a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task; A first determining unit, configured to determine a running order between the first task and the second task based on a dependency relationship corresponding to the second task; The running unit is used to run the second task after the first task is finished running according to the running order.

8. The device according to claim 7, characterized in that: The device also includes: an acquiring unit, configured to acquire task information of the first task and generate the first task identifier, so that the first task identifier is used to indicate the first task, wherein the task information includes identifier information corresponding to the first task identifier; The recycling unit is used to recycle the first task identifier after the second task and the first task are both completed.

9. The device according to claim 7 or 8, characterized in that: The plurality of tasks further include a third task, the output information of the third task includes a first storage address, and the input information of the second task further includes the first storage address; The dependency relationship corresponding to the second task indicates that the second task depends on the first task and the third task; The first determining unit is specifically configured to: Determining a running order among the first task, the second task, and the third task based on a dependency relationship corresponding to the second task; The operation unit is specifically used for: According to the execution sequence, after the execution of the first task and the third task is completed, the second task is executed.

10. The device according to claim 7 or 8, characterized in that: The multiple tasks further include a fourth task and a fifth task, the output information of the fourth task and the output information of the fifth task both include a second storage address, and the input information of the second task also includes the second storage address; the device further includes: A comparing unit, used for comparing the task acquisition time corresponding to the fourth task and the fifth task respectively, to obtain a comparison result; The dependency unit is specifically used for: Based on the comparison result and the input information of the second task, a dependency relationship corresponding to the second task is determined.

11. The device according to claim 10, characterized in that: The dependency unit is specifically used for: If the task acquisition time corresponding to the fifth task is later than the task acquisition time corresponding to the fourth task, determining that the dependency relationship corresponding to the second task indicates that the second task depends on the first task and the fifth task, and the dependency relationship corresponding to the second task includes a running order among the second task, the first task and the fifth task; The device also includes an updating unit for: After the fourth task is finished running, the fifth task is run; and after the fifth task is finished running, the second storage address is updated from the output corresponding to the fourth task to the output corresponding to the fifth task.

12. The device according to any one of claims 7 to 11, characterized in that: The plurality of tasks further include a sixth task, and the output information of the sixth task includes a third storage address; and the device further includes: a second determining unit, configured to determine input information of the first task, wherein the input information of the first task includes the third storage address; The first determining unit is specifically configured to: Based on the input information of the second task and the input information of the first task, a dependency relationship corresponding to the second task is determined, where the dependency relationship includes a running order among the second task, the first task, and the third task.

13. An electronic device, characterized in that: The electronic device includes a memory and a task scheduler, wherein a plurality of tasks are run in the task scheduler; the plurality of tasks include a first task and a second task, and the task scheduler is used to: Determining a dependency relationship corresponding to the second task based on input information of the second task, wherein the input information of the second task includes a first task identifier, wherein the first task identifier is used to indicate the first task, and the dependency relationship indicates that the second task depends on the first task; Determining a running order between the first task and the second task based on a dependency relationship corresponding to the second task; According to the execution sequence, after the execution of the first task is completed, the second task is executed.

14. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a computer or a processor, the computer or the processor is caused to execute the method according to any one of claims 1 to 6.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computer or a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Task operation method and apparatus, and related device

    EP4664284A1

  • Task operation method and apparatus, and related device

    WO2024179378A1