Task operation method and apparatus, and related device

By using data dependency in the programming model to express task dependencies, the problem of requiring two sets of implementations in the traditional method is solved, improving the operability of hardware acceleration and reducing costs.

WO2024179378A1PCT designated stage expired Publication Date: 2024-09-06HUAWEI TECH CO LTD

Patent Information

Application Number
PCT/CN2024/078277
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-27
Filing Date
2024-02-23
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

When the traditional method supports two expressions of task dependency and data dependence at the same time, it requires two different sets of programming models and runtime underlying implementations, resulting in increased system complexity and hindering the operability of hardware acceleration solutions.

Method used

Implement task dependency expression through data dependency, use task identifiers as data objects to indicate task dependencies, thereby supporting both task dependencies and data dependencies in the programming model, and adopting a unified underlying implementation.

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 CN2024078277_06092024_PF_FP
    Figure CN2024078277_06092024_PF_FP
Patent Text Reader

Abstract

Embodiments of the present application provide a task running method and apparatus, and a related device. The task running method is applied to a task scheduler, a plurality of tasks being run in the task scheduler. The plurality of tasks comprises a first task and a second task. The method comprises: on the basis of input information of the second task, determining a dependency relationship corresponding to the second task, the input information of the second task comprising a first task identifier, the first task identifier being used for indicating the first task, and the dependency relationship indicating that the second task is dependent on the first task; on the basis of the dependency relationship corresponding to the second task, determining the running order between the first task and the second task; and according to the running order, running the second task after running of the first task ends. By implementing the embodiments of the present application, two modes of expression, i.e., task dependence and data dependence, can both be supported on the basis of underlying implementation of data dependence, so that the operability of a hardening acceleration solution is improved, and the complexity and amount of engineering in project development are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

A task operation method, device and related equipment

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on February 27, 2023, with application number 202310226120.2, and priority to the Chinese patent application entitled “A task operation method, device and related equipment”, all contents of which are incorporated by reference into this application. Technical Field

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

[0003] A programming model is a paradigm abstraction that a computer system provides to users for programming. In general computing, there are two common types of programming models: thread-level programming models and task-level programming models. The task-level programming model uses tasks as its core abstraction. Specifically, a program is written as a combination of tasks, with the compiler handling the mapping of tasks to threads or execution units at runtime.

[0004] Currently, task-level programming models exist in two architectures: data-dependency-based and task-dependency-based. The difference lies in how dependencies between different tasks are expressed. A data-dependency architecture specifies the data used by each task, while a task-dependency architecture specifies the other tasks on which each task depends. Therefore, data-dependency and task-dependency architectures differ in their underlying expressions. With the increasing use of heterogeneous computing in many systems, especially end systems, developers of many businesses prefer task-dependency expressions, while developers of other businesses prefer data-dependency expressions. Therefore, providing an expression method that supports both data and task dependencies is crucial.

[0005] However, traditional methods support both task dependency and data dependency expressions simultaneously, requiring two different programming models and runtime underlying implementations. This places a heavy burden on the system, increases the complexity and workload of project development, and hinders the operability of hardening acceleration solutions.

[0006] 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.

[0007] Summary of the Invention

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

[0009] In the 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 the dependency relationship corresponding to the second task based on the input information of 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; determining the 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 completed in accordance with the running order.

[0010] In the prior art, simultaneously supporting task dependency expression and data dependency expression between different tasks often requires two sets of underlying implementations, which hinders the development of hardware acceleration. In an embodiment of the present application, task dependency expression between different tasks can be achieved through data dependency, that is, by indicating the task in a special data object (task identifier, which can also be called a task handle) to achieve data expression between different tasks when there is task dependency, and then using the underlying implementation of data expression to simultaneously support both task dependency and data dependency operations. 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 to be 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 is understandable 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 a task identifier, it indicates that the task depends on the task corresponding to the task identifier, that is, the task dependency expression is achieved through 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 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. Compared with the implementation of two different running modes in the prior art, it reduces the obstacles of the hardening acceleration solution, improves operability and reduces the cost of hardware acceleration.

[0011] 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, the first task identifier is recovered.

[0012] In an embodiment of the present application, after receiving the task information of the first task, when it is determined that the first task needs to return the first task identifier after the end of operation (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 time period from the time the first task identifier indicates the first task after it is generated to the time when the first task ends and the second task that depends on the first task ends. 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 during task dependency 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.

[0013] 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 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.

[0014] 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. 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 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 depend on the first task through the task identifier 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 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 capability of data dependency in the prior art.

[0015] 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.

[0016] In an embodiment of the present application, the task output of a task after completion of operation 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. Accordingly, the two tasks also have a dependency relationship through the storage addresses corresponding to the task outputs. For example, when the input information of the second task includes the second storage address, 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 based on the order in which the fourth task and the fifth task are acquired. At the same time, the running order between the fourth task and the fifth task can also be determined based on this order.

[0017] In one possible implementation, the determining of 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.

[0018] 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, which also increases the expression form of traditional data dependency.

[0019] 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.

[0020] In an embodiment of the present application, 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 execution order can be determined. This method of determining the dependency between tasks based on input information and the fact that 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 model, normalizes the underlying operation logic, and reduces the obstacles to the hardening acceleration solution compared to the implementation of two different operation modes in the prior art, thereby improving operability and reducing the cost of hardware acceleration.

[0021] In a second aspect, an embodiment of the present application provides a task running device, which is applied to a task scheduler, wherein the task scheduler runs multiple tasks; the multiple tasks include a first task and a second task, and the device includes:

[0022] 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;

[0023] 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;

[0024] The running unit is configured to run the second task after the first task is completed according to the running order.

[0025] 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.

[0026] 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.

[0027] 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.

[0028] 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.

[0029] 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.

[0030] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device including a memory and a task scheduler, wherein the task scheduler runs multiple tasks; the multiple tasks include a first task and a second task, and the task scheduler is configured to:

[0031] 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;

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

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

[0034] 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, the first task identifier is recovered.

[0035] 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.

[0036] 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.

[0037] 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.

[0038] 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.

[0039] 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.

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

[0041] In a sixth aspect, an embodiment of the present application provides an electronic device, comprising a task scheduler and a memory, wherein the task scheduler is configured to support the electronic device in implementing the corresponding functions of the task execution method provided in the first aspect. The electronic device may also include a memory, which is coupled to the processor and stores program instructions and data necessary for 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 via a wired serial bus. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] 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.

[0043] FIG1 is a schematic diagram of the architecture of a task execution system provided in an embodiment of the present application.

[0044] FIG2 is a schematic diagram of a life cycle of a task identifier provided in an embodiment of the present application.

[0045] FIG3 is a flow chart of a task execution method provided in an embodiment of the present application.

[0046] FIG4 is a schematic structural diagram of a task execution device provided in an embodiment of the present application.

[0047] FIG5 is a schematic structural diagram of another task execution device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0049] The terms "first," "second," "third," "fourth," "fifth," and "sixth" in the specification and claims of this application and the accompanying drawings are used to distinguish different objects, not 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 apparatus comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to the process, method, product, or apparatus.

[0050] It should be understood that in this application, "at least one (item)" refers to one or more, and "plurality" refers to 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 previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items 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.

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

[0052] As used in this specification, the terms "component," "module," "system," and the like 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 an application running on a computing device and a computing device can be a component. One or more components can reside in a process and / or an execution thread, and a component can be located on a computer and / or distributed between two or more computers. In addition, these components can be executed from various computer-readable media having various data structures stored thereon. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component on a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).

[0053] First, 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.

[0054] Currently, a programming model is a paradigm abstraction that a computer system provides 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.

[0055] The task-level programming model uses tasks as its core abstraction. Users can write programs as a combination of tasks, with the compiler or task scheduler handling the mapping of tasks to threads or execution units. This task-level programming model offers numerous advantages. The mapping of tasks to threads or execution units can be performed in user mode, making it more lightweight. Therefore, the granularity of tasks can be finer than that of traditional threads. This smaller granularity means that more parallelism can be exploited within the system, thereby improving system performance and energy efficiency.

[0056] The task-level programming model includes two architectures: data-dependent and task-dependent. The key difference lies in how the dependencies between tasks are expressed. The data-dependent approach specifies the data used by each task, while the task-dependent approach directly specifies the other tasks on which each task depends.

[0057] Specifically, because data-dependent methods allow users to focus only on the data used in a task when writing it, without having to worry about other tasks, data-dependent methods are primarily used in fields such as artificial intelligence and supercomputing, while task-dependent methods are more suitable for general computing, especially in control-flow-intensive programs designed according to business processes. Task-dependent methods can break down programs or transactions into several steps, focusing only on the relationship between each step (task) and its predecessors and subsequent steps (tasks), making them more convenient to express.

[0058] Data dependency and task dependency, as two distinct design paradigms for task-level programming models, often have different underlying implementations. Many business developers prefer to express task dependencies, while others prefer data dependencies. Therefore, providing an expression method that supports both data and task dependencies is crucial.

[0059] However, traditional methods support both task dependency and data dependency expressions simultaneously, requiring 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.

[0060] 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.

[0061] In this regard, an 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 is completed, running the second task. For example: specifying the input information IN and output information OUT of the task, accessing the corresponding data object or task object in the form of input information IN and output information OUT, and then relying on the task scheduler to perform correct scheduling, to solve the problem in the existing technical solution that supports both task dependency and data dependency expressions at the same time, requiring two different programming models and runtime underlying implementations, which brings a heavy 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 this application can refer to the relevant description of the following embodiments, and the embodiments of this application will not be repeated here.

[0062] 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.

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

[0064] User side 01 may receive task information corresponding to each of the multiple tasks input by the user. The task information includes input and output information of the corresponding task. If some or all of the multiple tasks are task-dependent, the task information may also include a task identifier. Furthermore, the task information may include other relevant information, such as the function, data type, processing method, and processing core applicable to the corresponding task.

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

[0066] 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 used to indicate the data in the storage space corresponding to the storage address. h2 and h3 are identification information input by the user. This identification information can instruct the running side to generate a task identifier indicating the task, and then the task identifier is used to indicate the logical output of the corresponding task after the execution is completed.

[0067] It should be noted that the task information corresponding to the task that only has data dependencies 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 dependencies and the tasks that are dependent on the task can include the identification information of the task identifier (such as: Task 3 and Task 2).

[0068] 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 end of the previous producer of the object 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.

[0069] OUT:{xxx} is used to indicate the output of the task and the output object that the task accesses 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 is already 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 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 (for example: 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 until the previous producer and consumer of the output object are finished before it can start running.

[0070] 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.

[0071] The operation side 02 dynamically schedules the execution of 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 dependencies 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, based on the corresponding dependencies between the multiple tasks, determines the execution order between the multiple tasks; and finally, executes the multiple tasks according to the execution order.

[0072] It should be noted that the operation side can also dynamically allocate and manage the life cycle of task identifiers. Task identifiers, as a medium connecting task dependencies and data dependencies, can achieve task identifier reuse and save computing and memory resources on the operation side.

[0073] Among them, for the situation that task identifiers are reused, it is necessary that the life cycle of each task identifier corresponding to different tasks cannot be repeated. Among them, the life cycle refers to the time period between when the task identifier indicates a task after it is generated and when it is recycled by the running side and does not indicate the task. Specifically, please refer to Figure 2, which is a schematic diagram of the life cycle of 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 has been completed, and other tasks that have a dependency relationship with the target task have also been 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.

[0074] 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 runtime 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 runtime side, the task identifier remains associated with the task until the runtime 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, as shown in Figure 2, the life cycle of the "special data object" needs to meet the union of the life cycle of the task identifier on the user side and the life cycle of the task identifier on the runtime side. To this end, in the reuse process, the task identifiers can only be reused if there is no overlap in their life cycles.

[0075] In addition, the embodiments of the present application do not impose any specific restrictions 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.

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

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

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

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

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

[0081] / / h1 task is consumer at 0x88, 0x9c and producer at 0x7c / / ;

[0082] submit_task(fun c1, IN: {0x88, 0x9c}, OUT: {0x7c});

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

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

[0085] h2=submit task(fun c2, IN: {0x7c}, OUT: {});

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

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

[0088] / / The h4 task uses both "data dependency" and "task dependency" expressions and depends on the h1 and h2 tasks. / /

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

[0090] 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.

[0091] 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 limitations on this.

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

[0093] Specifically, the task scheduler may 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 identify the first task, and the dependency relationship indicates that the second task depends on the first task.

[0094] It is understandable that the task scheduler can determine the dependency relationship corresponding to the task based on the input information of the task. For example, 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: if 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 is dependent on the first task.

[0095] 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, the first task identifier is recycled.

[0096] 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 / empty}), 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 the task through the task identifier realizes the data expression when the task is dependent, and then supports both task dependency and data dependency at the same time with the underlying implementation of the data expression.

[0097] 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 identifier included in the input information. Exemplarily, the task corresponding to the relevant code (equivalent to the task information) input by the user is: identification information S1 corresponding to the second task identifier = Task A (calling function B, IN: {identification information S2 corresponding to the third task identifier}, OUT: {}). It can be seen from the task information that the task information of task A includes identification information S1 corresponding to the second task identifier, and the input information includes identification information S2 corresponding to the third task identifier. The task scheduler can generate a second task identifier based on the identification information S1 corresponding to the second task identifier to indicate task A. When running task A, it is necessary to rely on task B indicated by the third task identifier. The task scheduler cannot generate a third task identifier from the identification information S2 corresponding to the third task identifier and use it to indicate task A.

[0098] 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 from the time the task identifier is associated with the task to the time it is disassociated.

[0099] For example, 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. The recycled first task identifier is no longer used to indicate the first task, and the recycled first task identifier can be generated / assigned by the task scheduler to be re-associated with other tasks. After re-association, the first task identifier is used to indicate other tasks. In particular, for the situation where task identifiers are reused, the relevant description of the above embodiment can also be referred to, and the embodiments of this application will not be repeated here.

[0100] In other embodiments, the task identifier may also be referred to as a task handle. Furthermore, the embodiments of the present application do 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 has completed its execution and is no longer needed.

[0101] Step S103: determining the execution order of the first task and the second task based on the dependency relationship corresponding to the second task.

[0102] Specifically, the task scheduler can determine the execution order of the first task and the second task based on the dependency relationship corresponding to the second task. Since the dependency relationship indicates that the second task depends on the first task, it means that the second task needs to be executed after the first task completes. Therefore, the task scheduler can determine the execution order of multiple tasks based on their dependency relationships.

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

[0104] 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 completed, the second task is run. In addition, this application does not specifically limit the running order between multiple tasks that do not have a dependency relationship. For example, between multiple tasks that do not have a dependency relationship, if relevant conditions such as running resources allow, the multiple tasks can be run in parallel. This is not elaborated in the embodiments of this application.

[0105] 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.

[0106] 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 dependency" and "task dependency" at the same time, and depends on the first task and the third task. Accordingly, 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 make specific limitations on the running order between the first task and the third task.

[0107] It should be noted that the task identifier corresponds to the logical output after the task is completed. The storage address corresponds to the actual output data after the task is completed. As can be seen from the above, when the task input information only includes the storage address, the dependency relationship between tasks is a data dependency.

[0108] 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 existing technology, 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 capability of data dependency in the existing technology.

[0109] 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.

[0110] When the output of the task corresponding to the storage address is the input of another task, the other task will obtain the latest output of the task corresponding to the storage address. For example, if the input information of a second task includes a second storage address, 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 based on the task acquisition time.

[0111] For example, if 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 the most recent output information corresponding to the second storage address based on the order in which the fourth and fifth tasks were acquired (i.e., a comparison of the acquisition times of the fourth and fifth tasks), and thus determine whether the task on which the second task's data depends is the fourth or fifth task. Furthermore, the task scheduler can also determine the execution order of the fourth and fifth tasks based on this comparison.

[0112] It is understood that for data-dependent tasks, each task output after completion can correspond to a storage address. However, a storage address can correspond to the output of different tasks at different time periods. When two tasks correspond to the same storage address, the storage address corresponding to the output will be adjusted based on the corresponding task acquisition time. Accordingly, the two tasks can have a dependency relationship through the task output information. It is understood that the task acquisition time is equivalent to the time when the user submits the task on the user side.

[0113] 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.

[0114] 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 relationship of tasks based on the task acquisition time when the outputs of the tasks are the same is beneficial for the task scheduler to judge the dependency relationship between multiple tasks during runtime, and also increases the expression form of traditional data dependency.

[0115] 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.

[0116] In other embodiments, for the 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, it can be determined that the dependency relationship corresponding to the second task indicates that the second task depends on the fourth task.

[0117] 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 storage address from being updated to the output of the fifth task during the process of the second task calling the data corresponding to the second storage address, causing a task operation error, the fifth task needs to wait for the completion of both the preceding fourth task and the second task (i.e., it needs to wait for both the preceding producer and consumer of the output object corresponding to the second storage address to complete before it can begin). 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.

[0118] In other embodiments, in addition to determining the task dependencies based on the comparison results of the task acquisition times corresponding to multiple tasks and the task input information, the task dependencies may also be determined based on other information and the task input information, which is not specifically limited in the embodiments of the present application. For example, the task dependencies may also be determined based on other information such as the task output information, the preset execution order, etc.

[0119] 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 the 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.

[0120] To determine the dependencies between multiple tasks, the input information of each task is obtained. Based on the task identifiers and / or storage addresses carried in the input information, the dependencies between tasks can be determined, and then their corresponding execution order can be determined. This method of determining the dependencies 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 model, normalizes the underlying operation logic, and reduces the obstacles to hardened acceleration solutions compared to the implementation of two different operation modes in the prior art, improves operability, and reduces the cost of hardware acceleration.

[0121] 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.

[0122] In summary, the task running method provided in the embodiment of the present application can realize the task dependency expression between different tasks in a data-dependent manner, that is, the data expression between different tasks when there is task dependency is realized by indicating the task in a special data object (task identifier, which can also be referred to as a task handle), and then the underlying implementation of the data expression simultaneously supports both 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 to be 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 is understandable 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 a task identifier, it indicates that the task depends on the task corresponding to the task identifier, that is, the task dependency expression is realized in a data-dependent manner. After determining the dependency between tasks, the task scheduler can determine the running order between tasks through the dependency, and then multiple tasks can be run according to the running order. For example, if a dependency indicates that a second task depends on a first task, the second task must run after the first task. Therefore, the embodiments of the present application support both task dependency and data dependency through a data representation model. Compared to the prior art implementation of two different operating modes, this reduces the obstacles to hardened acceleration solutions, improves operability, and reduces the cost of hardware acceleration.

[0123] The above describes in detail the method of the embodiment of the present application, and the following provides the relevant device of the embodiment of the present application.

[0124] Please refer to Figure 4, which is a structural diagram of a task running device provided in an embodiment of the present application.

[0125] As shown in FIG4 , the task running device 10 is applied to the task running system architecture shown in FIG1 , and 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. A detailed description of each unit is as follows:

[0126] A dependency unit 201 is 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;

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

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

[0129] 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.

[0130] 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, and 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.

[0131] 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, and 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.

[0132] 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, 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.

[0133] 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.

[0134] 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 found in the relevant descriptions of steps S101 to S104 in the method embodiment described in Figure 3 above, and will not be repeated here.

[0135] The present application also provides an electronic device, which can be a server, a desktop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer, a netbook, an artificial intelligence device, an in-vehicle device, or the like. The electronic device includes a memory and a task scheduler, wherein the task scheduler runs multiple tasks; the multiple tasks include a first task and a second task, and the task scheduler is configured to:

[0136] 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;

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

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

[0139] 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, the first task identifier is recovered.

[0140] 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.

[0141] 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.

[0142] 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.

[0143] 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.

[0144] It should be noted that the task scheduler mentioned in the embodiments of the present application may be a chip, a processor, or a processing module, etc. The present application does not make any specific limitation on the specific form of the task scheduler.

[0145] It should also be noted that the relevant functions of the electronic device described in the embodiments of the present application can be found in steps S101 to S104 in the above-mentioned method embodiment in Figure 3 and the relevant descriptions of other embodiments, which will not be repeated here.

[0146] As shown in Figure 5, Figure 5 is a schematic diagram of the structure of another task execution device provided in an embodiment of the present application. 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.

[0147] 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.

[0148] 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.

[0149] The memory 302 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device 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 compact 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 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.

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

[0151] The code stored in the memory 302 can execute the task running method provided in FIG. 3 above, such as dynamically scheduling the running of the multiple tasks based on the task information corresponding to each of the multiple tasks input by the user. In the example, multiple tasks are running in the processor; the multiple tasks include a first task and a second task, and the processor is configured to: determine the dependency relationship corresponding to the second task based on the 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; determine the running order between the first task and the second task based on the dependency relationship corresponding to the second task; and run the second task after the first task is finished running in accordance with the running order.

[0152] It should be noted that the functions of each functional unit in the task execution device 20 described in the embodiment of the present application can be found in the relevant descriptions of steps S101 to S104 in the method embodiment described in Figure 3 above, and will not be repeated here.

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

[0154] It should be noted that for the aforementioned 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 this application is not limited by the order of the actions described, because according to this application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0155] As used in this specification, the terms "component," "module," "system," and the like are used to refer to 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 an application running on a computing device and a computing device can be a component. One or more components can reside in a process and / or an execution thread, and a component can be located on a computer and / or distributed between two or more computers. In addition, these components can be executed from various computer-readable media having various data structures stored thereon. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component across a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).

[0156] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, 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.

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

[0158] In addition, the functional units in the embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0159] 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 for enabling a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to execute 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.

[0160] 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 above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above 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 further comprises 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

Patent Citations

  • Task running method and device and related equipment

    CN118550659A

  • Data processing method and computer equipment

    CN110543351A

  • Task dependency processing method and related device

    CN113760476A

  • Task scheduling method and device, equipment and storage medium

    CN114428674A

  • Calculation task scheduling method and device, electronic equipment and readable storage medium

    CN114510339A

Cited By

  • Inference task processing method and device, electronic equipment and storage medium

    CN120560867A