Task processing method, device, electronic device and computer readable storage medium

By merging multiple computing tasks into one task, it reduces the number of task scheduling, solves the overhead problem when the CPU distributes tasks to the GPGPU, improves processing efficiency, and is suitable for inference and training scenarios of various network models.

CN118132279BActive Publication Date: 2024-08-30北京壁仞科技开发有限公司 +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410561634.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-08
Publication Date
2024-08-30
Estimated Expiration
2044-05-08

AI Technical Summary

Technical Problem

When the CPU distributes computing tasks to processors such as GPGPU, the frequent task distribution process causes a large overhead on the host side CPU, and the input and output tensor addresses are difficult to change after recording the task graph, which limits the usage scenarios of the task graph, and Re-recording the task map takes a long time.

Method used

By obtaining the task information of at least two computing tasks from the memory, using the fusion strategy to merge them into one fused computing task, storing and sending them to the task processor during the task distribution process, reducing the number of scheduling times and improving processing efficiency.

Benefits of technology

It reduces the cost of task scheduling, improves processing efficiency, reduces the time it takes for a computing task to go from the host to the task processing end, returns results quickly, and supports efficient inference or training of various inference or training network models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118132279B
    Figure CN118132279B
Patent Text Reader

Abstract

A task processing method, a task processing device, an electronic device and a computer-readable storage medium. The task processing method comprises: obtaining task information of at least two computing tasks from a memory, wherein the task information comprises at least one of input parameters, output parameters, hardware resource information and computing instructions; fusing the task information of at least two computing tasks according to a fusion strategy to obtain task information of the fused computing task, and storing the task information of the fused computing task; and sending the task information of the fused computing task to a task processor during a task distribution process. The method can reduce task scheduling overhead and improve processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to a task processing method, apparatus, electronic device, and computer-readable storage medium. Background Art

[0002] Processors such as the Graphics Processing Unit (GPU) and the Deep Learning Processing Unit (DPU) can assist the Central Processing Unit (CPU) in completing processing tasks that it cannot perform or performs inefficiently or ineffectively, thus achieving the effect of processing acceleration. The CPU acts as a host processor and is responsible for the distribution, management, and control of tasks. It can receive instructions from applications and assign computing tasks to other processors for processing. Summary of the invention

[0003] At least one embodiment of the present disclosure provides a task processing method, comprising: obtaining task information of at least two computing tasks from a memory, wherein the task information includes at least one of input parameters, output parameters, hardware resource information and computing instructions; fusing the task information of the at least two computing tasks according to a fusion strategy to obtain task information of the fused computing task, and storing the task information of the fused computing task; and sending the task information of the fused computing task to a task processor during a task distribution process.

[0004] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, the task information of the at least two computing tasks is fused according to the fusion strategy, including: when it is determined that the task information of each of the at least two computing tasks satisfies a predetermined format, the task information of the at least two computing tasks is fused according to the fusion strategy.

[0005] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, the predetermined format includes: an input parameter statement, including the input parameters of the computing task; an output parameter statement, including the output parameters of the computing task; a hardware resource statement, including the base address and quantity of each of the multiple hardware resources required for the computing task; and an instruction statement, including data loading instructions and computing instructions of the computing task.

[0006] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, the task information of the at least two computing tasks is fused according to the fusion strategy to obtain the task information of the fused computing task, including: merging the input parameters of the at least two computing tasks as the input parameters of the fused computing task; merging the output parameters of the at least two computing tasks as the output parameters of the fused computing task; determining the hardware resource information of the fused computing task based on the hardware resource information of the at least two computing tasks; and using the computing instructions of each of the computing tasks as an instruction block of the fused computing task.

[0007] For example, in the task processing method provided by at least one example of the above-mentioned embodiment of the present disclosure, the at least two computing tasks include a first computing task and a second computing task, the computing instructions of the first computing task serve as the first instruction block of the fused computing task, and the computing instructions of the second computing task serve as the second instruction block of the fused computing task. Based on the hardware resource information of the at least two computing tasks, the hardware resource information of the fused computing task is obtained, including: using the hardware resource information of the first computing task as the first resource information block corresponding to the first instruction block in the fused computing task; based on the hardware resource information of the first computing task, changing the hardware resource information of the second computing task, and using the changed hardware resource information of the second computing task as the second resource information block corresponding to the second instruction block in the fused computing task.

[0008] For example, in the task processing method provided by at least one example of the above embodiments of the present disclosure, the hardware resource information of the second computing task is changed based on the hardware resource information of the first computing task, including: based on the quantity of each hardware resource required by the first computing task, changing the base address of each hardware resource of the second computing task.

[0009] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, the task information of the at least two computing tasks is fused according to the fusion strategy to obtain the task information of the fused computing task, including: determining the intermediate result parameters based on the input parameters and output parameters of the at least two computing tasks, and determining the input parameters and output parameters of the fused computing task based on the intermediate result parameters and the input parameters and output parameters of the at least two computing tasks; determining the hardware resource information of the fused computing task based on the input parameters and output parameters of the fused computing task; and determining the computing instructions of the fused computing task based on the computing instructions of each of the computing tasks.

[0010] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, based on the input parameters and output parameters of the at least two computing tasks, intermediate result parameters are determined, and based on the intermediate result parameters and the input parameters and output parameters of the at least two computing tasks, the input parameters and output parameters of the fusion computing task are determined, including: merging the input parameters of the at least two computing tasks to obtain a merged plurality of input parameters, and merging the output parameters of the at least two computing tasks to obtain a merged plurality of output parameters; filtering out the output parameters appearing in the merged plurality of input parameters from the merged plurality of output parameters as the intermediate result parameters; removing the intermediate result parameters from the merged plurality of input parameters, and using the remaining input parameters as the input parameters of the fusion computing task; removing the intermediate result parameters from the merged plurality of output parameters, and using the remaining output parameters as the output parameters of the fusion computing task.

[0011] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, the hardware resources include registers. Based on the input parameters and output parameters of the fusion computing task, determining the hardware resource information of the fusion computing task includes: determining the number of registers required to store the input parameters and output parameters of the fusion computing task as the number of registers in the hardware resource information of the fusion computing task.

[0012] For example, in the task processing method provided by at least one example of the above embodiments of the present disclosure, the task information of the at least two computing tasks is fused according to the fusion strategy, including: determining whether the quantity of each hardware resource required after the fusion of the at least two computing tasks exceeds the available quantity of each hardware resource; if the quantity of each hardware resource required after the fusion of the at least two computing tasks does not exceed the available quantity of each hardware resource, the task information of the at least two computing tasks is fused according to the fusion strategy.

[0013] For example, in the task processing method provided by at least one example of the above-mentioned embodiments of the present disclosure, the at least two computing tasks include tasks corresponding to the computing functions in the neural network model.

[0014] At least one embodiment of the present disclosure provides a task processing device, including an acquisition unit, a fusion unit and a sending unit, the acquisition unit is configured to acquire task information of at least two computing tasks from a memory, wherein the task information includes at least one of input parameters, output parameters, hardware resource information and computing instructions; the fusion unit is configured to fuse the task information of the at least two computing tasks to obtain the task information of the fused computing task, and store the task information of the fused computing task; the sending unit is configured to send the task information of the fused computing task to the task processor during a task distribution process.

[0015] At least one embodiment of the present disclosure provides an electronic device, including a memory, a task processor and a central processing unit, wherein the memory is configured to store task information of at least two computing tasks; the task processor is configured to execute computing tasks; the processor is configured to: obtain task information of the at least two computing tasks from the memory, wherein the task information includes at least one of input parameters, output parameters, hardware resource information and computing instructions; fuse the task information of the at least two computing tasks to obtain task information of a fused computing task, and store the task information of the fused computing task in the memory; and in a task distribution process, send the task information of the fused computing task to the task processor so that the task processor executes the fused computing task.

[0016] At least one embodiment of the present disclosure provides an electronic device, comprising a processor; a memory storing one or more computer program modules; wherein the one or more computer program modules are configured to be executed by the processor to implement the task processing method provided by any embodiment of the present disclosure.

[0017] At least one embodiment of the present disclosure provides a computer-readable storage medium storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the task processing method provided by any embodiment of the present disclosure can be implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure.

[0019] Figure 1 A flowchart of a task processing method provided by at least one embodiment of the present disclosure is shown;

[0020] Figure 2 A schematic diagram showing a task processing flow provided by at least one embodiment of the present disclosure;

[0021] Figure 3 A schematic diagram showing a format of task information provided by at least one embodiment of the present disclosure is shown;

[0022] Figure 4 A schematic diagram showing a fusion computing task provided by at least one embodiment of the present disclosure is shown;

[0023] Figure 5 A schematic diagram showing another fusion computing task provided by at least one embodiment of the present disclosure is shown;

[0024] Figure 6 A schematic block diagram of a task processing device provided by at least one embodiment of the present disclosure is shown;

[0025] Figure 7 A schematic block diagram of an electronic device provided by at least one embodiment of the present disclosure is shown;

[0026] Figure 8 A schematic block diagram showing another electronic device provided by at least one embodiment of the present disclosure; and

[0027] Fig. 9 A schematic diagram of a computer-readable storage medium provided by at least one embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0029] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, similar words such as "one", "one" or "the" do not indicate quantity restrictions, but indicate that there is at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Similar words such as "connect" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0030] When the CPU assigns computing tasks to processors such as GPGPU (General-purpose computing on graphics processing units) for processing, it needs to offload the computing task code to processors such as GPGPU. In scenarios where there are many computing tasks involved in neural network model inference training, the CPU needs to distribute tasks frequently. The total time overhead of the CPU distributing computing tasks to processors such as GPGPU for execution is relatively large, which requires a certain amount of host CPU overhead.

[0031] One way to reduce scheduling is to record all or part of the tasks used in the inference or training model to form a task graph, and then use the recorded operation node graph directly each time it runs, saving the CPU overhead on the host side. However, after recording the computing task into a task graph, the addresses of the input and output tensors of the graph cannot be changed, or it is very troublesome to change these addresses, which limits the use of the task graph to a certain extent. If the task graph needs to be re-recorded each time, the recording CPU host side will take a long time.

[0032] Therefore, how to efficiently and quickly schedule computing tasks to hardware execution units is very critical.

[0033] At least one embodiment of the present disclosure provides a task processing method, a task processing device, an electronic device, and a computer-readable storage medium. The task processing method includes: obtaining task information of at least two computing tasks from a memory, wherein the task information includes at least one of input parameters, output parameters, hardware resource information, and computing instructions; fusing the task information of at least two computing tasks according to a fusion strategy to obtain task information of the fused computing task, and storing the task information of the fused computing task; in a task distribution process, sending the task information of the fused computing task to a task processor.

[0034] This task processing method can automatically fuse computing tasks using a preset fusion strategy, and can distribute the fused computing tasks to the task processor at one time. Compared with the overhead of scheduling multiple small computing tasks, the overhead of scheduling a fused computing task once is smaller, which reduces the number of task scheduling times and improves processing efficiency.

[0035] Figure 1 A flowchart of a task processing method provided by at least one embodiment of the present disclosure is shown.

[0036] like Figure 1 As shown, the method may include steps S110 to S130.

[0037] Step S110: Obtain task information of at least two computing tasks from a memory.

[0038] Step S120: Fusing the task information of at least two computing tasks according to the fusion strategy to obtain the task information of the fused computing task, and storing the task information of the fused computing task.

[0039] Step S130: During a task distribution process, the task information of the fusion computing task is sent to the task processor.

[0040] For example, the task processing method of the embodiment of the present disclosure can be executed by a central processing unit or by other devices, or some steps in the task processing method can be executed by the central processing unit and the remaining steps can be executed by other devices. In the following embodiments, the central processing unit is used as the execution subject for description.

[0041] Figure 2 A schematic diagram of a task processing flow provided by at least one embodiment of the present disclosure is shown.

[0042] like Figure 2As shown, the memory 202 may store task information of multiple computing tasks. The task information may include at least one of input parameters, output parameters, hardware resource information, and computing instructions. The input parameters may include the data type and address of the data to be calculated, the output parameters may include the storage address allocated for the calculation result, the hardware resource information may include information on the hardware resources (such as registers) required for the computing task, and the computing instruction may include the operation to be performed, such as addition, multiplication, etc.

[0043] For example, the at least two computing tasks include tasks corresponding to computing functions in the neural network model, and the computing functions may include functions such as addition and multiplication. The computing tasks may be used to process image data, speech data, and the like.

[0044] For example, the central processor 201 may include a fusion unit. In step S120, the central processor 201 may read task information of at least two computing tasks from the memory 202, fuse the at least two computing tasks using the fusion unit to obtain a fused computing task, and store the task information of the fused computing task in the memory. The type and number of computing tasks to be fused may be configured as needed, and different methods of fusion may be performed according to different situations of the computing tasks to be fused.

[0045] For example, when a fusion computing task needs to be executed, the central processor 201 can obtain the task information of the fusion computing task from the memory 202, and send the task information of the fusion computing task to the task processor 203 during a task distribution process. The task processor 203 can execute the fusion computing task according to the task information.

[0046] According to the task processing method of the embodiment of the present disclosure, the computing tasks can be automatically fused using a preset fusion strategy, and the fused computing tasks can be distributed to the task processor at one time. Compared with the overhead of scheduling multiple small computing tasks, the overhead of scheduling a fused computing task once is smaller, which reduces the number of task scheduling times and improves processing efficiency.

[0047] For example, in step S120, when it is determined that the task information of each of the at least two computing tasks satisfies a predetermined format, the task information of the at least two computing tasks is fused according to a fusion strategy.

[0048] For example, a format of task information may be defined so that the computing tasks compiled by the compiler follow the format, so that the fusion unit can automatically perform task fusion.

[0049] For example, the predetermined format may include: input parameter statements, output parameter statements, hardware resource statements and instruction statements, the input parameter statement includes the input parameters of the computing task, the output parameter statement includes the output parameters of the computing task, the hardware resource statement includes the base address (or starting address) and quantity of each of the multiple hardware resources required for the computing task, and the instruction statement includes the data loading instructions and computing instructions of the computing task.

[0050] Figure 3 A schematic diagram of a format of task information 310 provided by at least one embodiment of the present disclosure is shown.

[0051] like Figure 3 As shown, "input Params: xx" is an input parameter statement, where xx represents an input parameter; "OutputParams: yy" is an output parameter statement, where yy represents an output parameter; the portion indicated by label 311 is a hardware resource statement, "Resource A base:0" indicates that the base address of the required hardware resource A is 0, and "Resource A size:5" indicates that the number of required hardware resources A is 5, and the same is true for hardware resources B and C; the portion indicated by label 312 is an instruction statement, which may include data loading instructions and calculation instructions.

[0052] For ease of explanation, in the following embodiments, the fusion of the first computing task and the second computing task is taken as an example for explanation, but the embodiments of the present disclosure are not limited thereto, and the number of fused computing tasks can be determined according to actual needs.

[0053] For example, the first computing task and the second computing task to be fused may or may not have a data dependency relationship. Two computing tasks with data dependencies have a fixed execution order, and the input data of the latter computing task depends on the output data of the previous computing task. For example, the first computing task is to add parameter E and parameter F to obtain parameter G, and the second computing task is to multiply parameter G and parameter K to obtain parameter T, and the output of the first computing task is the input of the second computing task. Two computing tasks without data dependencies do not have a fixed execution order, and there is no dependency between the input parameters and the output parameters. For example, the first computing task is to add parameter E and parameter F to obtain parameter G, and the second computing task is to multiply parameter E and parameter F to obtain parameter H. Different fusion methods can be used for these two situations.

[0054] For example, in step S120, when the at least two computing tasks do not have a dependency relationship, the task information of the at least two computing tasks is fused according to the fusion strategy to obtain the task information of the fused computing task, which may include: merging the input parameters of the at least two computing tasks as the input parameters of the fused computing task; merging the output parameters of the at least two computing tasks as the output parameters of the fused computing task; determining the hardware resource information of the fused computing task based on the hardware resource information of the at least two computing tasks; and using the computing instructions of each computing task as an instruction block of the fused computing task.

[0055] Figure 4 A schematic diagram of a fusion computing task provided by at least one embodiment of the present disclosure is shown.

[0056] like Figure 4 As shown, the computing task 410 in the figure can be used as the first computing task, the computing task 420 can be used as the second computing task, and the computing task 430 can be used as the fusion computing task. In the fusion process, the input parameter xx of the first computing task 410 and the input parameter zz of the second computing task 420 can be merged to obtain the input parameter [xx, zz] of the fusion computing task 430. If there are repeated parameters, they can be removed. The output parameter yy of the first computing task 410 and the output parameter ww of the second computing task 420 can be merged to obtain the output parameter [yy, ww] of the fusion computing task 430. According to the hardware resource information 411 of the first computing task 410, the first resource information block 431 of the fusion computing task 430 can be obtained, and according to the hardware resource information 421 of the second computing task 420, the second resource information block 433 of the fusion computing task 430 can be obtained. The computing instruction 412 of the first computing task 410 can be used as the first instruction block 432 of the fusion computing task, and the computing instruction 422 of the second computing task 420 can be used as the second instruction block 434 of the fusion computing task. The first instruction block 432 may be located behind the first resource information block 431 and connected to the first resource information block 431 , and the second instruction block 434 may be located behind the second resource information block 433 and connected to the second resource information block 433 .

[0057] For example, a relative index (index) method can be used to determine the hardware resources allocated to a computing task. For example, the starting position of the hardware resource is determined according to the base address (base), and the number (size) is used to determine the number of hardware resources required starting from the base address hardware resource. Taking the register as an example, the base address register is r0, and after the base address register, registers r1, r2, r3, ..., rn (n is a positive integer) are arranged in sequence. If the base address of the register in the hardware resource information of a computing task is 0 and the number is 5, registers r0~r4 can be allocated to the computing task for use.

[0058] For example, since the base address of a hardware resource in the first computing task and the second computing task may be the same, in this case, after merging the first computing task and the second computing task, the hardware resource information of at least one of the computing tasks needs to be changed to avoid hardware resource conflicts.

[0059] For example, obtaining the hardware resource information of a fused computing task based on the hardware resource information of at least two computing tasks may include: using the hardware resource information of the first computing task as the first resource information block corresponding to the first instruction block in the fused computing task; based on the hardware resource information of the first computing task, changing the hardware resource information of the second computing task, and using the changed hardware resource information of the second computing task as the second resource information block corresponding to the second instruction block in the fused computing task.

[0060] For example, changing the hardware resource information of the second computing task based on the hardware resource information of the first computing task may include: changing the base address of each hardware resource of the second computing task based on the quantity of each hardware resource required by the first computing task.

[0061] For example, Figure 4 As shown, the base address of the hardware resource A of the first computing task 410 is 0, and the base address of the hardware resource A of the second computing task 420 is also 0. If the base address of the hardware resource A in the first resource information block 431 and the base address of the hardware resource A in the second resource information block 433 in the fusion computing task 430 are both 0, then there may be a conflict between the hardware resources A used before and after. Therefore, the base address of the hardware resource A in the first resource information block 431 can be kept as 0, and the base address of the hardware resource A in the second resource information block 433 can be changed. The base address of the hardware resource A in the second resource information block 433 can be changed according to the number 5 of the hardware resource A of the first computing task 410. For example, the number 5 can be added to the base address 0, and the result 5 can be used as the base address of the hardware resource A in the second resource information block 433. In this way, according to the first resource information block 431, registers r0~r4 can be allocated to the first instruction block 432 for use, and according to the second resource information block 433, registers r5~r14 can be allocated to the second instruction block 434 for use, thereby avoiding hardware resource conflicts. The same goes for other hardware resources B and C.

[0062] For example, the above fusion method can be used to fuse the first computing task and the second computing task that do not have a dependency relationship, and can also be used for the first computing task and the second computing task that have a dependency relationship. For the first computing task and the second computing task that have a dependency relationship, if the above fusion method is adopted, during the execution of the fused computing task, after completing the first part of the computing task, it is necessary to first output and save the result of the first part of the computing task, and then obtain data from the storage device when executing the second part of the computing task, which increases memory access. Therefore, the following provides another fusion method, which can directly apply the calculation result of the first part of the computing task to the second part of the computing task, reduce memory access, and improve efficiency.

[0063] For example, in step S120, the task information of at least two computing tasks is fused according to the fusion strategy to obtain the task information of the fused computing task, which may include: determining the intermediate result parameters based on the input parameters and output parameters of the at least two computing tasks, and determining the input parameters and output parameters of the fused computing task based on the intermediate result parameters and the input parameters and output parameters of the at least two computing tasks; determining the hardware resource information of the fused computing task based on the input parameters and output parameters of the fused computing task; and determining the computing instructions of the fused computing task based on the computing instructions of each computing task.

[0064] Figure 5 A schematic diagram of another fusion computing task provided by at least one embodiment of the present disclosure is shown.

[0065] like Figure 5 As shown, the input parameters of the first computing task 510 are E and F, and the output parameter is G. The input parameters of the second computing task 520 are G and K, and the output parameter is T. The intermediate result parameter can be a parameter that appears at the output of one computing task and the input of another computing task at the same time. The parameter G is both the output parameter of the first computing task and the input parameter of the second computing task. Therefore, the parameter G can be used as the intermediate result parameter. Then, the input / output parameters of the fusion computing task 530 are determined based on the intermediate result parameter G and the input / output parameters of the two computing tasks.

[0066] For example, determining intermediate result parameters based on the input parameters and output parameters of at least two computing tasks, and determining the input parameters and output parameters of the fusion computing task based on the intermediate result parameters and the input parameters and output parameters of the at least two computing tasks can include: merging the input parameters of at least two computing tasks to obtain a merged plurality of input parameters, and merging the output parameters of at least two computing tasks to obtain a merged plurality of output parameters; filtering out output parameters that appear in the merged plurality of input parameters from the merged plurality of output parameters as intermediate result parameters; removing the intermediate result parameters from the merged plurality of input parameters, and using the remaining input parameters as the input parameters of the fusion computing task; removing the intermediate result parameters from the merged plurality of output parameters, and using the remaining output parameters as the output parameters of the fusion computing task.

[0067] For example, the input parameters of the first computing task 510 and the second computing task 520 are merged into [E, F, G, K], and the output parameters of the first computing task 510 and the second computing task 520 are merged into [G, T]. The parameter G that appears in both the merged input parameters and the merged output parameters can be used as an intermediate result parameter. [E, F, K] obtained by removing G from [E, F, G, K] can be used as an input parameter of the fusion computing task 530, and [T] obtained by removing G from [G, T] can be used as an output parameter of the fusion computing task 530. In this way, the data corresponding to the parameter G can participate in the calculation of the second part without having to access memory, thereby improving the execution efficiency without affecting the calculation process.

[0068] For example, determining the hardware resource information of the fusion computing task based on the input parameters and output parameters of the fusion computing task may include: determining the number of registers required to store the input parameters and output parameters of the fusion computing task as the number of registers in the hardware resource information of the fusion computing task.

[0069] For example, taking each parameter occupying one register as an example, for the first computing task 510, the input and output involve three parameters E / F / G, so three registers need to be occupied, the register base address is 0, and the number of registers is 3. For the first computing task 520, the input and output involve three parameters G / K / T, so three registers need to be occupied, the register base address is 0, and the number of registers is 3. After the first computing task and the second computing task are fused, the input and output of the fused computing task 530 involve four parameters E / F / K / T, so the register base address of the fused computing task can still be 0, and the number of registers can be 4.

[0070] For example, since the first part of the calculation and the second part of the calculation in the fusion calculation task are related, the calculation instructions corresponding to the second part of the calculation can be adjusted accordingly to ensure the correctness of the calculation. For example, the calculation instruction of the first calculation task is to add parameter E and parameter F to obtain parameter G, that is, E+F=G. The instruction part of the first calculation task may include: loading the data corresponding to parameter E into register r0, loading the data corresponding to parameter F into register r1, adding the data of register r0 and the data of register r1 to obtain the data of register r2, and storing the data of register r2 corresponding to parameter G. The calculation instruction of the second calculation task is to add parameter G and parameter K to obtain parameter T, that is , the instruction part of the second computing task may include: loading the data corresponding to the parameter G into the register r0, loading the data corresponding to the parameter K into the register r1, multiplying the data of the register r0 and the data of the register r1 to obtain the data of the register r2, and storing the data of the register r2 corresponding to the parameter T. The computing instruction of the fused computing task obtained by merging the first computing task and the second computing task may be The first part of the calculation instructions of the fusion calculation task may include: loading the data corresponding to parameter E into register r0, loading the data corresponding to parameter F into register r1, adding the data of register r0 and the data of register r1 to obtain the data of register r2; the second part of the calculation instructions of the fusion calculation task may include: loading the data corresponding to parameter K into register r1, multiplying the data of register r1 and the data of register r2 to obtain the data of register r3, and storing the data of register r3 corresponding to parameter T.

[0071] For example, in step S120, the task information of at least two computing tasks is merged according to the fusion strategy, and it can also include: determining whether the quantity of each hardware resource required after the fusion of the at least two computing tasks exceeds the available quantity of each hardware resource; if the quantity of each hardware resource required after the fusion of the at least two computing tasks does not exceed the available quantity of each hardware resource, the task information of the at least two computing tasks is merged according to the fusion strategy.

[0072] For example, taking registers as an example, the total number of available registers is, for example, 10. If the number of registers required after the fusion of the first computing task and the second computing task is less than or equal to 10, the first computing task and the second computing task can be fused; if the number of registers required after the fusion of the first computing task and the second computing task is greater than 10, there are not enough registers to support the implementation of the fusion computing task, so the first computing task and the second computing task cannot be fused. Based on this approach, the smooth implementation of the calculation can be guaranteed to avoid the situation where the calculation fails due to insufficient hardware resources. For example, the number of hardware required after the fusion of the first computing task and the second computing task can be obtained in the following way.

[0073] For example, in some embodiments, if there is no dependency between the input / output of the first computing task and the second computing task, the quantity of each hardware resource required by the first computing task can be added together, and the result of the addition can be used as the quantity of various hardware resources required after fusion. Figure 4 As shown, the first computing task requires 5 hardware resources A, and the second computing task requires 10 hardware resources A. Then, the number of hardware resources A required after the first computing task and the second computing task are merged is 15, and the same is true for other types of hardware resources.

[0074] For example, in some other embodiments, if there is a dependency relationship between the input / output of the first computing task and the second computing task, the required hardware resources can be determined according to the input / output parameters involved after fusion. Figure 5 As shown, taking the example that each parameter corresponds to one register, the number of parameters involved after the fusion of the first computing task and the second computing task is 4, so it can be determined that the number of required registers is 4.

[0075] According to the task processing method of at least one embodiment of the present disclosure, for scenarios of network models with a large number of input kernel functions in reasoning and training scenarios, a method of merging multiple computing tasks into one computing task is proposed, thereby reducing the problem of a long total CPU time occupied by computing tasks on the host side. This can greatly reduce the time it takes for computing tasks to be processed from the host side to the task processing side, reduce the response speed, and quickly return results.

[0076] The task processing method according to at least one embodiment of the present disclosure can flexibly support various reasoning or training network models, greatly improving the efficiency of model reasoning or training.

[0077] According to the task processing method of at least one embodiment of the present disclosure, the fusion of computing tasks can be automatically realized by machines, which can greatly reduce the manual workload and improve work efficiency.

[0078] Figure 6A schematic block diagram of a task processing device 600 provided by at least one embodiment of the present disclosure is shown.

[0079] For example, Figure 6 As shown, the task processing device 600 includes an acquisition unit 610, a fusion unit 620 and a sending unit 630. These components are interconnected via a bus system and / or other forms of connection mechanisms (not shown). For example, these modules can be implemented by hardware (such as circuit) modules, software modules, or any combination of the two. The following embodiments are the same and will not be repeated here. For example, these units can be implemented by a central processing unit (CPU), a graphics processing unit (GPU), a tensor processing unit (TPU), a field programmable gate array (FPGA), or other forms of processing units with data processing capabilities and / or instruction execution capabilities and corresponding computer instructions. It should be noted that Figure 6 The components and structures of the task processing device 600 shown are merely exemplary and not restrictive. The task processing device 600 may also have other components and structures as required.

[0080] The acquisition unit 610 is configured to acquire task information of at least two computing tasks from the memory, wherein the task information includes at least one of input parameters, output parameters, hardware resource information, and computing instructions. The acquisition unit 610 may, for example, execute Figure 1 Step S110 described.

[0081] The fusion unit 620 is configured to fuse the task information of the at least two computing tasks to obtain the task information of the fused computing task and store the task information of the fused computing task. Figure 1 Step S120 described.

[0082] The sending unit 630 is configured to send the task information of the fusion computing task to the task processor during a task distribution process. The sending unit 630 may, for example, execute Figure 1 Step S130 described.

[0083] For example, the acquisition unit 610, the fusion unit 620, and the sending unit 630 may be hardware, software, firmware, or any feasible combination thereof. For example, the acquisition unit 610, the fusion unit 620, and the sending unit 630 may be a dedicated or general circuit, chip, or device, or may be a combination of a processor and a memory. The embodiments of the present disclosure do not limit the specific implementation forms of the above-mentioned units.

[0084] For example, the acquisition unit 610, the fusion unit 620, and the sending unit 630 may include codes and programs stored in a memory; the processor may execute the codes and programs to implement some or all of the functions of the image acquisition unit 610, the fusion unit 620, and the sending unit 630 as described above. For example, the acquisition unit 610, the fusion unit 620, and the sending unit 630 may be dedicated hardware devices, used to implement some or all of the functions of the acquisition unit 610, the fusion unit 620, and the sending unit 630 as described above. For example, the acquisition unit 610, the fusion unit 620, and the sending unit 630 may be a circuit board or a combination of multiple circuit boards, used to implement the functions as described above. In the embodiment of the present disclosure, the circuit board or the combination of multiple circuit boards may include: (1) one or more processors; (2) one or more non-temporary memories connected to the processor; and (3) firmware stored in the memory that can be executed by the processor.

[0085] It should be noted that in the embodiment of the present disclosure, each unit of the task processing device 600 corresponds to each step of the aforementioned task processing method. For the specific functions of the task processing device 600, reference can be made to the relevant description of the task processing method, which will not be repeated here. Figure 6 The components and structures of the task processing device 600 shown are only exemplary and non-restrictive. The task processing device 600 may also include other components and structures as needed. The task processing device 600 may include more or fewer circuits or units, and the connection relationship between the various circuits or units is not limited and can be determined according to actual needs. The specific configuration of each circuit or unit is not limited and can be composed of analog devices according to circuit principles, or can be composed of digital chips, or can be composed in other applicable ways.

[0086] At least one embodiment of the present disclosure also provides an electronic device, comprising: a memory, a task processor and a central processing unit, the memory being configured to store task information of at least two computing tasks; the task processor being configured to execute computing tasks; the central processing unit being configured to: obtain task information of the at least two computing tasks from the memory, wherein the task information includes at least one of input parameters, output parameters, hardware resource information and computing instructions; fuse the task information of the at least two computing tasks to obtain task information of a fused computing task, and store the task information of the fused computing task in the memory; and in a task distribution process, send the task information of the fused computing task to the task processor so that the task processor executes the fused computing task.

[0087] For the memory, task processor and central processing unit in the electronic device, reference may be made to the relevant description in the above embodiments, which will not be repeated here.

[0088] At least one embodiment of the present disclosure further provides another electronic device, which includes a processor and a memory, wherein the memory stores one or more computer program modules. The one or more computer program modules are configured to be executed by the processor to implement the above-mentioned task processing method.

[0089] Figure 7 A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Figure 7 As shown, the electronic device 700 includes a processor 710 and a memory 720. The memory 720 stores non-temporary computer-readable instructions (e.g., one or more computer program modules). The processor 710 is used to run non-temporary computer-readable instructions, and the non-temporary computer-readable instructions are executed by the processor 710 to execute one or more steps in the task processing method described above. The memory 720 and the processor 710 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For the specific implementation of each step of the task processing method and the related explanation content, please refer to the above-mentioned embodiment of the task processing method, and the repetitions will not be repeated here.

[0090] It should be noted that Figure 7 The components of the electronic device 700 shown are merely exemplary and non-limiting. The electronic device 700 may also have other components according to actual application requirements.

[0091] For example, the processor 710 and the memory 720 may communicate with each other directly or indirectly.

[0092] For example, the processor 710 and the memory 720 may communicate via a network. The network may include a wireless network, a wired network, and / or any combination of a wireless network and a wired network. The processor 710 and the memory 720 may also communicate with each other via a system bus, which is not limited in the present disclosure.

[0093] For example, the processor 710 and the memory 720 may be arranged on a server side (or a cloud side).

[0094] For example, the processor 710 can control other components in the electronic device 700 to perform desired functions. For example, the processor 710 can be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units with data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) can be an X86 or ARM architecture, etc. The processor 710 can be a general-purpose processor or a special-purpose processor, and can control other components in the electronic device 700 to perform desired functions.

[0095] For example, the memory 720 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 710 may run one or more computer program modules to implement various functions of the electronic device 700. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.

[0096] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 700 can refer to the above description of the task processing method, which will not be repeated here.

[0097] Figure 8 This is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. The electronic device 800 is suitable for implementing the task processing method provided in the embodiments of the present disclosure. The electronic device 800 may be a terminal device, etc. It should be noted that: Figure 8 The electronic device 800 shown is only an example and does not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0098] like Figure 8 As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 810, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 820 or a program loaded from a storage device 880 to a random access memory (RAM) 830. In the RAM 830, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 810, the ROM 820, and the RAM 830 are connected to each other via a bus 840. An input / output (I / O) interface 850 is also connected to the bus 840.

[0099] Typically, the following devices may be connected to the I / O interface 850: an input device 860 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 870 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 880 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 890. The communication device 890 may allow the electronic device 800 to communicate with other electronic devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown to have various devices, but it should be understood that it is not required to implement or possess all of the devices shown, and the electronic device 800 may alternatively implement or possess more or fewer devices.

[0100] For example, according to an embodiment of the present disclosure, the above-mentioned task processing method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned task processing method. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 890, or installed from a storage device 880, or installed from a ROM 820. When the computer program is executed by the processing device 810, the functions defined in the task processing method provided in the embodiment of the present disclosure can be implemented.

[0101] At least one embodiment of the present disclosure further provides a computer-readable storage medium storing non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a computer, the above-mentioned task processing method can be implemented.

[0102] Fig. 9 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Fig. 9 As shown, the storage medium 900 stores non-transitory computer-readable instructions 910. For example, when the non-transitory computer-readable instructions 910 are executed by a computer, one or more steps in the task processing method described above are performed.

[0103] For example, the storage medium 900 may be applied to the electronic device 700. Figure 7 The memory 720 in the electronic device 700 is shown. For example, the description of the storage medium 900 can refer to Figure 7 The corresponding description of the memory 720 in the electronic device 700 is shown and will not be repeated here.

[0104] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0105] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0106] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

[0107] There are a few points to note about this disclosure:

[0108] (1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure. Other structures may refer to the general design.

[0109] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to obtain new embodiments.

[0110] The above description is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. The protection scope of the present disclosure shall be based on the protection scope of the claims.

Claims

1. A task processing method, comprising: Acquire task information of at least two computing tasks from a memory, wherein the task information includes input parameters, output parameters, hardware resource information, and computing instructions, and the hardware resource information includes the number of hardware resources required for the computing tasks, wherein the number of hardware resources required for the computing tasks includes the number of multiple registers required for the computing tasks; Fusing the task information of the at least two computing tasks according to the fusion strategy to obtain the task information of the fused computing task, and storing the task information of the fused computing task; In a task distribution process, the task information of the fusion computing task is sent to the task processor; The at least two computing tasks include a first computing task and a second computing task, the computing instructions of the first computing task serve as the first instruction block of the fused computing task, and the computing instructions of the second computing task serve as the second instruction block of the fused computing task; The task information of the at least two computing tasks is merged according to the fusion strategy to obtain the task information of the fused computing task, including: Using the hardware resource information of the first computing task as the first resource information block corresponding to the first instruction block in the fusion computing task; Based on the hardware resource information of the first computing task, the hardware resource information of the second computing task is changed, and the changed hardware resource information of the second computing task is used as the second resource information block corresponding to the second instruction block in the fusion computing task.

2. The method according to claim 1, wherein: The task information of the at least two computing tasks is merged according to a fusion strategy, including: When it is determined that the task information of each of the at least two computing tasks satisfies a predetermined format, the task information of the at least two computing tasks is fused according to a fusion strategy.

3. The method according to claim 2, wherein: The predetermined format includes: Input parameter statements, including input parameters of computing tasks; Output parameter statements, including output parameters of computing tasks; a hardware resource statement, including a base address and quantity of each of a plurality of hardware resources required for the computing task; and Instruction statements include data loading instructions and calculation instructions for computing tasks.

4. The method according to any one of claims 1 to 3, wherein: The task information of the at least two computing tasks is merged according to the fusion strategy to obtain the task information of the fused computing task, including: Combining the input parameters of the at least two computing tasks as the input parameters of the fusion computing task; Combining the output parameters of the at least two computing tasks as the output parameters of the fusion computing task; The computing instructions of each computing task are used as an instruction block of the fused computing task.

5. The method according to claim 1, wherein: Changing the hardware resource information of the second computing task based on the hardware resource information of the first computing task includes: Based on the quantity of each hardware resource required by the first computing task, the base address of each hardware resource of the second computing task is changed.

6. The method according to any one of claims 1 to 3, wherein: The task information of the at least two computing tasks is merged according to the fusion strategy to obtain the task information of the fused computing task, including: Determine intermediate result parameters based on the input parameters and output parameters of the at least two computing tasks, and determine input parameters and output parameters of the fusion computing task based on the intermediate result parameters and the input parameters and output parameters of the at least two computing tasks; Determining hardware resource information of the fusion computing task based on the input parameters and output parameters of the fusion computing task; Based on the computing instructions of each of the computing tasks, the computing instructions of the fused computing task are determined.

7. The method according to claim 6, wherein: Determining intermediate result parameters based on the input parameters and output parameters of the at least two computing tasks, and determining input parameters and output parameters of the fusion computing task based on the intermediate result parameters and the input parameters and output parameters of the at least two computing tasks, includes: Combining the input parameters of the at least two computing tasks to obtain a combined plurality of input parameters, and combining the output parameters of the at least two computing tasks to obtain a combined plurality of output parameters; Filtering out the output parameters that appear in the merged multiple input parameters from the merged multiple output parameters as the intermediate result parameters; Removing the intermediate result parameter from the merged multiple input parameters, and using the remaining input parameters as input parameters of the fusion calculation task; The intermediate result parameters are removed from the merged multiple output parameters, and the remaining output parameters are used as the output parameters of the fusion calculation task.

8. The method according to claim 6, wherein: Determining hardware resource information of the fusion computing task based on the input parameters and output parameters of the fusion computing task includes: The number of registers required to store the input parameters and output parameters of the fusion computing task is determined as the number of registers in the hardware resource information of the fusion computing task.

9. The method according to any one of claims 1 to 3, wherein: The task information of the at least two computing tasks is merged according to a fusion strategy, including: Determining whether the quantity of each hardware resource required after the fusion of the at least two computing tasks exceeds the available quantity of each hardware resource; When the quantity of each hardware resource required after the fusion of the at least two computing tasks does not exceed the available quantity of each hardware resource, the task information of the at least two computing tasks is fused according to the fusion strategy.

10. The method according to any one of claims 1 to 3, wherein: The at least two computing tasks include tasks corresponding to computing functions in the neural network model.

11. A task processing device, comprising: an acquisition unit, configured to acquire task information of at least two computing tasks from a memory, wherein the task information includes input parameters, output parameters, hardware resource information and computing instructions, and the hardware resource information includes the quantity of hardware resources required for the computing task; a fusion unit configured to fuse the task information of the at least two computing tasks to obtain task information of the fused computing task, and store the task information of the fused computing task; A sending unit, configured to send the task information of the fusion computing task to the task processor during a task distribution process; The at least two computing tasks include a first computing task and a second computing task, the computing instructions of the first computing task serve as the first instruction block of the fused computing task, and the computing instructions of the second computing task serve as the second instruction block of the fused computing task; The fusion unit is further configured as: Using the hardware resource information of the first computing task as the first resource information block corresponding to the first instruction block in the fusion computing task; Based on the hardware resource information of the first computing task, the hardware resource information of the second computing task is changed, and the changed hardware resource information of the second computing task is used as the second resource information block corresponding to the second instruction block in the fusion computing task.

12. An electronic device comprising: A memory configured to store task information of at least two computing tasks; a task processor configured to execute a computing task; CPU, configured as: Acquire task information of the at least two computing tasks from the memory, wherein the task information includes input parameters, output parameters, hardware resource information and computing instructions, and the hardware resource information includes the number of hardware resources required for the computing tasks, wherein the number of hardware resources required for the computing tasks includes the number of multiple registers required for the computing tasks; Merging the task information of the at least two computing tasks to obtain task information of a fused computing task, and storing the task information of the fused computing task in the memory; In a task distribution process, the task information of the fusion computing task is sent to the task processor so that the task processor executes the fusion computing task; The at least two computing tasks include a first computing task and a second computing task, the computing instructions of the first computing task serve as the first instruction block of the fused computing task, and the computing instructions of the second computing task serve as the second instruction block of the fused computing task; The task information of the at least two computing tasks is merged according to the fusion strategy to obtain the task information of the fused computing task, including: Using the hardware resource information of the first computing task as the first resource information block corresponding to the first instruction block in the fusion computing task; Based on the hardware resource information of the first computing task, the hardware resource information of the second computing task is changed, and the changed hardware resource information of the second computing task is used as the second resource information block corresponding to the second instruction block in the fusion computing task.

13. An electronic device comprising: processor; a memory storing one or more computer program modules; The one or more computer program modules are configured to be executed by the processor to implement the task processing method according to any one of claims 1 to 10.

14. A computer-readable storage medium storing non-transitory computer-readable instructions, which, when executed by a computer, can implement the task processing method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Executable file issuing method and device and electronic equipment

    CN115220917A