Task processing methods and devices

By constructing a fusion spatial network and determining approximate and optimal costs, computer programs are grouped scientifically and rationally, solving the problem of unreasonable grouping in existing technologies and improving resource utilization and task processing efficiency.

CN116257249BActive Publication Date: 2026-05-26LYNXI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
LYNXI TECH CO LTD
Filing Date
2023-01-16
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

In the prior art, the approximate grouping method of computer programs usually relies on human experience, which leads to unreasonable grouping, ineffective use of resources, and high execution cost.

Method used

By constructing a fusion spatial network and determining the approximate and optimal costs of fusion nodes at each level, computer programs are scientifically and rationally grouped to achieve approximate processing.

Benefits of technology

It reduced the cost of program execution, improved resource utilization, optimized grouping effects, and increased task processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257249B_ABST
    Figure CN116257249B_ABST
Patent Text Reader

Abstract

This disclosure provides a task processing method and apparatus, belonging to the field of computer technology. The method includes: constructing a fusion spatial network corresponding to an initial program of a target task based on the acquired initial program; determining the approximate cost of each fusion node in the first level of the fusion spatial network; determining the approximate cost and optimal cost of at least one fusion node in other levels based on the approximate costs of each fusion node in the first level; determining candidate groups of the initial program based on the determined approximate and optimal costs of the fusion nodes; and, if a preset stopping condition is met based on the candidate groups, using the candidate groups as target groups of the initial program, and performing approximate processing of the initial program of the target task based on the target groups. Embodiments of this disclosure can approximate group various target tasks and perform approximate processing based on the obtained approximate groups, thereby reducing processing costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a task processing method and apparatus. Background Technology

[0002] Modern computers primarily execute programs using precise computation, meaning the hardware follows the steps specified by the top-level program exactly and outputs deterministic results. Maintaining precise computation often comes at a high cost. However, some tasks may have a certain margin of error and therefore do not require completely accurate results. Approximate computation methods can be used for these tasks. Compared to precise computation, approximate computation, by appropriately sacrificing computational precision or determinism during execution, can save significant resources and has gained increasing attention. Summary of the Invention

[0003] This disclosure provides a task processing method and apparatus, an electronic device, and a computer-readable storage medium.

[0004] In a first aspect, this disclosure provides a task processing method, comprising: constructing a fusion spatial network corresponding to an initial program of a target task; wherein the fusion spatial network consists of multiple levels of fusion nodes and connecting edges, the fusion nodes corresponding to at least one statement in the initial program, the connecting edges corresponding to data dependencies between the fusion nodes, and the fusion nodes at each level having corresponding fusion relationships; determining the approximate cost of each fusion node in the first level of the fusion spatial network; determining the approximate cost and optimal cost of at least one fusion node in other levels based on the approximate cost of each fusion node in the first level, wherein the optimal cost of the fusion node is less than or equal to the approximate cost of the fusion node; determining candidate groups of the initial program based on the determined approximate cost and optimal cost of the fusion nodes; and, if a preset stopping condition is met based on the candidate groups, using the candidate groups as target groups of the initial program, and performing approximate processing of the initial program of the target task based on the target groups.

[0005] Secondly, this disclosure provides a task processing apparatus, comprising: a construction module, configured to construct a fusion spatial network corresponding to an acquired initial program of a target task; wherein the fusion spatial network consists of multiple levels of fusion nodes and connecting edges, the fusion nodes corresponding to at least one statement in the initial program, the connecting edges corresponding to data dependencies between the fusion nodes, and the fusion nodes at each level having corresponding fusion relationships; a first determining module, configured to determine the approximate cost of each fusion node in the first level of the fusion spatial network; a second determining module, configured to determine the approximate cost and optimal cost of at least one fusion node in other levels based on the approximate cost of each fusion node in the first level, wherein the optimal cost of the fusion node is less than or equal to the approximate cost of the fusion node; a grouping module, configured to determine candidate groups of the initial program based on the determined approximate cost and optimal cost of the fusion nodes; and a grouping determining module, configured to, when a preset stopping condition is met based on the candidate groups, use the candidate groups as target groups of the initial program, and execute approximate processing of the initial program of the target task based on the target groups.

[0006] Thirdly, this disclosure provides a processing architecture, which includes: a task processing device, a compilation device, and a processor; the task processing device is used to execute the task processing method described in any one of the embodiments of this disclosure; the compilation device is used to perform compilation processing according to the target group of the initial program obtained by the task processing device to obtain a compilation result; and the processor is used to obtain the execution result of the target task according to the compilation result.

[0007] Fourthly, this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the task processing method described above.

[0008] Fifthly, this disclosure provides an electronic device comprising: a plurality of processing cores; and an on-chip network configured to interact with data between the plurality of processing cores and external data; wherein one or more of the processing cores store one or more instructions, and the one or more instructions are executed by the one or more processing cores to enable the one or more processing cores to perform the above-described task processing method.

[0009] In a sixth aspect, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor / processor core, implements the above-described task processing method.

[0010] The embodiments provided in this disclosure firstly construct a fusion spatial network corresponding to the initial program of the acquired target task. This fusion spatial network consists of multiple levels of fusion nodes and connecting edges. Each fusion node corresponds to at least one statement in the initial program, and the connecting edges correspond to data dependencies between fusion nodes. Furthermore, there are corresponding fusion relationships between fusion nodes at different levels. This process effectively divides the initial program into different granularities, resulting in multiple fusion nodes, providing a foundation for subsequent grouping. It also clarifies the fusion relationships between fusion nodes of different granularities and constructs a fusion spatial network with a network structure based on these relationships. This allows for a more intuitive and convenient presentation and utilization of these fusion relationships for subsequent grouping. Secondly, the approximate cost of each fusion node in the first level of the fusion spatial network is determined, and this approximate cost is used to determine the fusion nodes at higher levels. The approximate cost and optimal cost of each fusion node are determined. Then, based on the approximate cost of each fusion node in the first level, the approximate cost and optimal cost of at least one fusion node in other levels are determined. The optimal cost of a fusion node is less than or equal to its approximate cost. By setting the optimal cost, the subsequent grouping effect is optimized, which can further reduce costs and improve resource utilization. Based on the determined approximate cost and optimal cost of the fusion nodes, candidate groups for the initial program are determined, thus clarifying the relatively optimal candidate groups under the current circumstances. Finally, if the candidate groups meet the preset stopping conditions, the candidate groups are used as the target groups for the initial program. This achieves approximate grouping of the initial program and allows the initial program to be processed according to the target group. Compared with using the exact processing method to execute the initial task, this effectively reduces the program execution cost and improves resource utilization.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:

[0013] Figure 1A flowchart of a task processing method provided in an embodiment of this disclosure;

[0014] Figure 2 A schematic diagram of a fused spatial network provided in an embodiment of this disclosure;

[0015] Figure 3 A schematic diagram of a fused spatial network provided in an embodiment of this disclosure;

[0016] Figure 4 A schematic diagram illustrating an optimal cost determination method provided in an embodiment of this disclosure;

[0017] Figure 5 A schematic diagram illustrating an optimal cost determination method provided in an embodiment of this disclosure;

[0018] Figure 6 This is a schematic diagram illustrating the working process of a task processing method provided in an embodiment of the present disclosure;

[0019] Figure 7 This is a schematic diagram illustrating the working process of a task processing method provided in an embodiment of the present disclosure;

[0020] Figure 8 A schematic diagram illustrating error propagation provided in an embodiment of this disclosure;

[0021] Figure 9 A schematic diagram illustrating the relationship between input error and output error provided in an embodiment of this disclosure;

[0022] Figure 10 A schematic diagram of the correlation curve of fusion error cost based on fusion spatial network provided in this embodiment of the present disclosure;

[0023] Figure 11 This is a schematic diagram illustrating the working process of a task processing method provided in an embodiment of the present disclosure;

[0024] Figure 12 A block diagram of a task processing apparatus provided in an embodiment of this disclosure;

[0025] Figure 13 A block diagram of a processing architecture provided in an embodiment of this disclosure;

[0026] Figure 14 A block diagram of an electronic device provided in an embodiment of this disclosure;

[0027] Figure 15 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0028] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0029] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.

[0030] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0031] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0032] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0033] Approximate compilation is a method of deploying computer programs onto a computer in an approximate manner. Grouping is a crucial stage in approximate compilation, primarily used to group the execution steps or operators of the computer program so that individual approximations can be performed for each group. In related technologies, simple grouping is often done manually, relying on experience, to perform approximate calculations. However, the groupings obtained using these methods may be unreasonable, inconvenient for performing approximate calculations, or potentially too costly, thus failing to meet the usage requirements.

[0034] In view of this, the present disclosure provides a task processing method and apparatus, and a processing architecture.

[0035] According to the task processing method of this disclosure, the initial programs of various target tasks can be scientifically and reasonably grouped, and corresponding approximate processing can be performed based on the grouping, thereby further reducing costs and improving resource utilization.

[0036] The task processing method according to embodiments of this disclosure can be executed by electronic devices such as terminal devices or servers. Terminal devices can be in-vehicle devices, user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. The method can be implemented by a processor calling computer-readable program instructions stored in memory. The server can be a standalone physical server, a server cluster consisting of multiple servers, or a cloud server capable of cloud computing.

[0037] In a first aspect, embodiments of this disclosure provide a task processing method.

[0038] Figure 1 A flowchart illustrating a task processing method provided in an embodiment of this disclosure. (Refer to...) Figure 1 The task processing method includes:

[0039] In step S11, a fusion space network corresponding to the initial program of the target task is constructed based on the obtained initial program. The fusion space network consists of multiple levels of fusion nodes and connecting edges. The fusion nodes correspond to at least one statement in the initial program, the connecting edges correspond to the data dependencies between the fusion nodes, and there are corresponding fusion relationships between the fusion nodes at each level.

[0040] In step S12, the approximate cost of each fusion node in the first layer of the fusion spatial network is determined.

[0041] In step S13, based on the approximate costs of each fusion node in the first level, the approximate cost and optimal cost of at least one fusion node in other levels are determined, wherein the optimal cost of the fusion node is less than or equal to the approximate cost of the fusion node.

[0042] In step S14, candidate groups for the initial procedure are determined based on the approximate cost and optimal cost of the fusion nodes that have been determined.

[0043] In step S15, if the preset stopping conditions are met based on the candidate group, the candidate group is used as the target group of the initial program, and the approximate processing of the initial program of the target task is performed based on the target group.

[0044] The embodiments provided in this disclosure firstly construct a fusion space network corresponding to the initial program of the acquired target task. This fusion space network consists of multiple levels of fusion nodes, each corresponding to at least one statement in the initial program. Furthermore, there is a correspondence between the fusion nodes at each level. This process effectively divides the initial program into different granularities, resulting in multiple fusion nodes, which provides a basis for subsequent grouping. It also clarifies the fusion relationships between fusion nodes of different granularities and constructs a fusion space network with a network structure based on these relationships. This allows for a more intuitive and convenient presentation and utilization of these fusion relationships for subsequent grouping. Secondly, the approximate cost of each fusion node in the first level of the fusion space network is determined. This approximate cost is then used to determine the approximate cost and optimal cost of fusion nodes at higher levels. Then, based on the approximate costs of each fusion node in the first level, the approximate cost and optimal cost of at least one fusion node in other levels are determined. The optimal cost of a fusion node is less than or equal to its approximate cost. By setting the optimal cost, the subsequent grouping effect is further optimized, reducing costs and improving resource utilization. Based on the determined approximate and optimal costs of the fusion nodes, candidate groups for the initial program are determined, thus identifying the relatively optimal candidate groups under the current circumstances. Finally, if the candidate groups meet the preset stopping conditions, they are used as the target groups for the initial program. This achieves approximate grouping of the initial program and allows for approximate processing of the initial program for the target task based on the target group. Compared to executing the initial task entirely using precise processing, this effectively reduces program execution costs and improves resource utilization.

[0045] In some alternative implementations, the target task is the task to be executed. For example, the target task includes any one or more tasks such as video processing, image processing, speech processing, and text processing, and this disclosure does not limit this.

[0046] In some alternative implementations, the initial program for the target task is the source program for the target task, which includes program segments written in a high-level language or assembly language. Typically, the source program cannot be executed directly on a computer and needs to be compiled to obtain an executable program (e.g., binary code) that the computer can recognize.

[0047] In some alternative implementations, the initial program for the target task is a program written in a corresponding language based on the processing logic of the target task, which may include multiple statements.

[0048] In some alternative implementations, considering that approximate compilation can reduce processing costs and improve resource utilization, an approximate computation approach can be adopted for the initial program of the target task. Based on this, the initial program can be divided into multiple groups so that corresponding approximate processing can be performed on each group, thereby improving the flexibility of approximate computation.

[0049] In some alternative implementations, the initial program can be grouped by constructing a fusion spatial network.

[0050] In some alternative implementations, the initial program can be converted into a corresponding computation graph, and then a fusion space network of the initial program can be constructed based on the computation graph.

[0051] In some optional implementations, constructing the fusion spatial network in step S11 may include: determining a corresponding computation graph based on the initial program, the computation graph including at least one computation node, the computation node corresponding to at least one statement in the initial program, and the computation nodes having one-to-one and / or one-to-many connection relationships; constructing a fusion spatial network based on the computation graph; wherein the fusion spatial network includes multiple levels, each level including at least one fusion node, and connection edges for representing data dependencies are set between the fusion nodes, the fusion node is composed of one or more computation nodes with connection relationships, and the number of computation nodes corresponding to the fusion node increases sequentially with the increase of the level, and the fusion nodes of each level have corresponding fusion relationships.

[0052] In other words, this disclosure proposes an approximate grouping representation method—a fusion spatial network. When constructing this fusion spatial network, the initial program is first converted into a corresponding computation graph. This computation graph typically includes multiple computation nodes, each containing one or more statements. These computation nodes can be connected one-to-one or many-to-many, thus supporting both linear and mesh computation graph forms. Based on the computation graph, fusion nodes at each level can be constructed layer by layer from bottom to top, such that the number of computation nodes corresponding to each fusion node increases with the increase in level. Ultimately, multiple levels of fusion nodes form the corresponding fusion spatial network. Since each fusion node corresponds to one or more computation nodes, it essentially also corresponds to one or more statements in the initial program.

[0053] Figure 2 This is a schematic diagram of a fused spatial network provided as an embodiment of the present disclosure. (Refer to...) Figure 2 The computer program to be grouped is represented using a computation graph, where squares represent computation nodes (denoted by N). Figure 2The computer program consists of five computational nodes connected serially. Once the computational graph is determined, the corresponding fused spatial network can be constructed. For example... Figure 2 As shown, each fusion node in the fusion spatial network consists of one or more computation nodes, which can be considered as an approximate group (denoted by G). The numbers in the fusion node represent its number, and the computation nodes that make up the fusion node can be determined based on the number. For example, G1 indicates that it is an approximate group composed solely of computation node N1, and G234 indicates that it is an approximate group composed of computation nodes N2, N3, and N4.

[0054] like Figure 2 As shown, there is a connecting edge (which can be a directed edge) between fused nodes G1 and G2, indicating that there is a data dependency between G1 and G2. There is also a connecting edge between fused nodes G12 and G23, indicating that there is also a data dependency between G12 and G23. Other fused nodes are similar and will not be described in detail here.

[0055] Furthermore, there are corresponding fusion relationships between the fusion nodes at each level. For example, G234 has a fusion relationship with G23 and G34, which reflects that G234 is a fusion node obtained by fusing G23 and G34. Figure 2 The dashed lines between G234 and G23, and between G234 and G34. The corresponding fusion relationships of other fusion nodes are similar and will not be described further here. It should be noted that... Figure 2 The fusion space network is used to represent the fusion of different computation nodes in the same network (the network is the corresponding computation graph). The difference lies in the fusion method of the fusion nodes in different levels (including which computation nodes to fuse and the number of computation nodes to fuse).

[0056] It should also be noted that this fusion space network includes all approximation groups consisting of continuous computation nodes in the computation graph. Non-contiguous computation nodes in the computation graph will not appear in this fusion space network. For example, computation nodes N2 and N4 are non-contiguous; therefore, the approximation group G24 consisting of computation nodes N2 and N4 will not appear in the fusion space network.

[0057] After obtaining the above-mentioned fused spatial network, a search can be performed in the fused spatial network using some search algorithms to find the relatively optimal approximate grouping (corresponding to the subsequent steps of the embodiments of this disclosure).

[0058] In some optional implementations, if there is a connection between the computation node corresponding to the current fusion node and the computation node corresponding to another fusion node in the same level, it is determined that there is an association between the current fusion node and the other fusion node. Accordingly, based on the computation graph, a fusion space network is constructed, including: merging the computation nodes corresponding to at least two fusion nodes with an association in the i-th level to obtain the fusion node of the (i+1)-th level (i is an integer greater than or equal to 1); wherein, each fusion node in the first level corresponds to each computation node in the computation graph.

[0059] For example, if the i-th level includes fusion nodes G12 and G23, and the two are related, then the fusion node G123 of the (i+1)-th level can be obtained based on G12 and G23, and G123 has a fusion relationship with G12 and G23.

[0060] It should be noted that the connections between computation nodes characterize the dependencies, such as data interaction, between them. In other words, if a correlation is established between fusion nodes, it indicates a data dependency between them. Typically, a single computation node can implement a function with a smaller granularity, while multiple connected computation nodes can implement a function with a relatively larger granularity. Therefore, the fusion node corresponding to these multiple connected computation nodes is used to implement the relatively larger granularity function. In a fusion spatial network, since the number of computation nodes corresponding to a fusion node increases with the level, the functional granularity also increases with the level.

[0061] Furthermore, when determining the fusion spatial network, the relationships between fusion nodes are considered (essentially, the connections or data dependencies between computation nodes) to ensure that all fusion nodes in the fusion spatial network are combinations of computation nodes with connections. Combinations of computation nodes without connections in the computation graph will not appear in the fusion spatial network. In other words, the multiple computation nodes corresponding to a fusion node are adjacent and connected in the computation graph. For example, if computation node 2 and computation node 4 are not connected in the computation graph, then there will be no fusion node composed of computation node 2 and computation node 4 in the fusion spatial network.

[0062] The above method is used to construct the fused spatial network because a combination of computational nodes without connectivity may not be able to achieve a relatively independent function, or may be difficult to approximate (e.g., difficult to approximate using approximators). By constructing the fused spatial network in this way, some unreasonable approximation schemes can be eliminated at the source (they do not appear in the fused spatial network), thereby avoiding subsequent cost evaluation and other processing for unreasonable approximation schemes. This reduces data processing volume, resource consumption, and also shortens grouping time, improves grouping efficiency, and ultimately improves task processing efficiency.

[0063] Figure 2 The fusion spatial network shown is a network constructed for linear computation graphs. However, the computation graphs of real-world tasks are often more complex and may have more intricate structures. The fusion spatial network provided in this disclosure not only supports linear computation graphs but also computation graphs with more complex structures. It has generality and universality and is suitable for handling target tasks of various types and complexities.

[0064] The following is combined with Figure 3 The fused spatial network of the present disclosure embodiments will be described in detail.

[0065] Figure 3 This is a schematic diagram of a fused spatial network provided as an embodiment of the present disclosure. (Refer to...) Figure 3 If the computation graph obtained from the initial procedure includes 6 computation nodes, namely computation node 1, computation node 2, computation node 3, computation node 4, computation node 5, and computation node 6 ("1" to "6" are the identifiers of each computation node), and the above computation node sequence 1→2→3→5→6 forms a directed linear sequence of computation nodes, and computation node sequence 1→4→5→6 forms another directed linear sequence of computation nodes, and the two sequences of computation nodes form a ring-shaped computation graph, then the process of constructing a fused spatial network for this computation graph includes:

[0066] First, each computation node is treated as a fusion node in the first level of the fusion space network. For example... Figure 3As shown, the first level includes fusion node 1, fusion node 2, fusion node 3, fusion node 4, fusion node 5, and fusion node 6 ("1" to "6" are the numbers of each fusion node, which can be determined based on the identifier of the computation node corresponding to the fusion node), corresponding to computation nodes 1 to 6 respectively. Furthermore, fusion nodes corresponding to computation nodes with a connection relationship (data dependency) have an association relationship, with connecting edges between them. For example, computation node 1 and computation node 2 have a connection relationship (represented by lines with arrows), therefore, fusion node 1 and fusion node 2 have an association relationship (represented by lines without arrows). The association relationships between other fusion nodes are determined in a similar way and will not be described further here.

[0067] After completing the merging nodes of the first level, the construction of merging nodes of the second level can begin. Essentially, this involves merging two related merging nodes from the first level. For example, if merging node 1 and merging node 2 in the first level are related, merging them yields merging node 12 in the second level. Similarly, other merging nodes in the second level can be obtained. Furthermore, as... Figure 3 As mentioned above, there is a data dependency between fusion node 12 and fusion node 23 (for example, the output data of computing node 2 may need to be transmitted to computing node 3). Therefore, a connection edge is set between fusion node 12 and fusion node 23. Similarly, for other fusion nodes, a connection edge is set between them when there is a data dependency or other relationship between them.

[0068] For the third level, it is obtained by merging two related fusion nodes from the second level. For example, fusion nodes 12 and 23 in the second level are related; therefore, merging fusion nodes 12 and 23 yields fusion node 123 in the third level. It should be noted that in the current implementation, the number of the current fusion node is obtained by performing a union operation on the numbers of multiple fusion nodes to be merged in the next level. That is, the number of fusion node 123 is obtained by the union of the numbers of fusion nodes 12 and 23 (i.e., "123" is obtained from "12∪23", where ∪ represents the union operation). By using the fusion node's number, the corresponding computation node and the lower-level fusion nodes can be quickly located. For example, merging node 123 corresponds to compute node 1, compute node 2, and compute node 3; merging node 123 can be obtained by merging lower-level merging nodes 12 and 3, or by merging merging node 1 and merging node 23.

[0069] Using a similar approach, other fusion nodes in the third level can be obtained. Furthermore, similar to the first and second levels, fusion nodes in the third level also have associated relationships. For example, fusion node 123 corresponds to compute node 1, compute node 2, and compute node 3, and fusion node 235 corresponds to compute node 2, compute node 3, and compute node 5. Since compute node 3 in fusion node 123 and compute node 5 in fusion node 235 are connected, fusion node 123 and fusion node 235 are associated.

[0070] It should be noted that in some optional implementations, the relationship between merged nodes can be quickly and accurately determined by their numbers. For example, if two merged nodes have the same character in their numbers, a relationship is determined. For instance, merged nodes 123 and 235 have the same characters "2" and "3", therefore, a relationship is determined between merged nodes 123 and 235.

[0071] Following a similar method, the fusion nodes in levels 4 through 6 can be obtained, which will not be described in detail here. Ultimately, the result is as follows: Figure 3 The fused spatial network shown.

[0072] In conclusion, Figure 3 The fusion spatial network shown corresponds to a ring network computation graph, which can be compared... Figure 3 and Figure 2 As can be seen, the fused spatial network of this disclosure supports linear computation graphs and mesh computation graphs, has high universality and generality, and can be used to process target tasks of various types and computational logics.

[0073] It should be noted that in the construction Figure 3In the fusion spatial network shown, the fusion node of the i-th level is obtained by merging two connected fusion nodes in the (i-1)-th level. Therefore, the granularity difference of the fusion nodes between adjacent levels in this fusion spatial network is small (difference of one computation node), and it presents all possible combinations of computation nodes (the combination of computation nodes corresponds to the fusion node). In some other optional implementations, the fusion node of the i-th level can be obtained by merging two or more connected fusion nodes in the (i-1)-th level. For example, in the second level, fusion node 1, fusion node 2, and fusion node 3 can be directly merged to obtain fusion node 123 in the second level. In this way, the granularity difference of the fusion nodes between adjacent levels is large (difference of two computation nodes), and some combinations of computation nodes may not be presented in the fusion spatial network. In applications, appropriate granularity differences can be selected to construct the fusion spatial network based on experience, statistical data, accuracy requirements, etc., and this embodiment does not impose any limitations on this. For example, when the goal is to obtain a target group with better performance, the first implementation method can be used to construct a fusion spatial network that includes all possible combinations of computational nodes to avoid missing potential alternative groups. For example, when the goal is to determine the target group more quickly, the second implementation method can be used to appropriately increase the granularity difference between fusion nodes at adjacent levels, simplify the determination process, and reduce the time required to determine alternative groups.

[0074] It should also be noted that the fusion spatial network actually divides the initial program into different granularities. The granularity of the lower-level fusion nodes is smaller, and the granularity of the higher-level fusion nodes is larger. Furthermore, there are correlations between fusion nodes of the same granularity, and there are certain correspondences between fusion nodes of different granularities. Moreover, any fusion node can be mapped to a corresponding computation node. Therefore, the fusion spatial network can provide a more intuitive understanding of the computational logic of the initial program, improving the convenience of subsequent grouping.

[0075] In some alternative implementations, after obtaining the fused spatial network, the approximate cost of each fused node in the first level is first determined. Based on the approximate costs of these nodes in the first level, the approximate costs and optimal costs of one or more fused nodes in other levels are then determined. Here, the approximate cost refers to the cost required to process the fused nodes using an approximate approach. The approximate cost is related to computational complexity, time complexity, and other factors.

[0076] In some alternative implementations, the approximate cost of a fused node is obtained by evaluating the cost of all computation nodes that make up the fused node as a whole. For example, the cost evaluation of fused node 123 is performed by evaluating the approximate cost of computation nodes 1, 2, and 3 as a whole, rather than evaluating the approximate cost of computation nodes 1, 2, and 3 separately and then summing the individual approximate costs.

[0077] Furthermore, as can be seen from the foregoing, each fusion node in the first level corresponds to a computation node in the computation graph. Therefore, the approximate cost of each fusion node in the first level is equivalent to the approximate cost of the corresponding computation node.

[0078] In some optional implementations, the approximate cost can be obtained through a pre-defined approximator or a pre-defined cost evaluation model. The cost evaluation model is a model built upon and trained using at least one of Convolutional Neural Networks (CNN), Sequential Networks (SN), or Multi-Layer Perception (MLP), and possesses the ability to perform approximate cost evaluations on computational nodes / fusion nodes.

[0079] For example, one or more of the following can be used as approximators: neural networks, lookup tables, higher-order polynomials, etc., and these approximators can be used to determine the approximate cost of the fusion node.

[0080] For example, for neural network approximators, different approximation parameters correspond to different costs, and different costs correspond to different errors. Therefore, an error-cost correlation curve (also known as a cost-precision (CP) correlation curve, or simply a CP curve) can be pre-plotted for the neural network approximator. The horizontal axis of this curve represents the cost, and the vertical axis represents the error. For each point on the curve, the corresponding error value and approximation parameters for that cost can be determined. These approximation parameters include the network layer, number of nodes, and weight values ​​of the neural network. After determining the error-cost correlation curve, based on this curve and combined with the corresponding cost requirements and / or error requirements, the approximate cost of the fusion node is obtained.

[0081] Similarly, for lookup table approximation sub-sub ...

[0082] Therefore, when determining the approximate cost based on the approximator, it is often necessary to plot the error-cost correlation curve, which requires setting multiple sets of approximators with different approximation parameters and calculating their respective approximate costs, resulting in a long time consumption and low efficiency. Therefore, to reduce the cost evaluation time, an approximate cost evaluation can be implemented through a cost evaluation model. Theoretically, as long as the cost evaluation model is pre-trained, multiple cost evaluations can be performed based on this model, thereby effectively reducing the cost evaluation time and improving the efficiency of approximate evaluation.

[0083] For example, based on a preset accuracy requirement, the cost evaluation model is used to evaluate the fusion node and obtain its approximate cost. In this implementation, it is not necessary to determine the specific approximator of the fusion node (which can be regarded as an approximation group), train it, and then calculate the cost. Instead, the cost evaluation network can be used directly to evaluate the approximate cost, thus omitting the process of determining the specific approximator.

[0084] In some alternative implementations, considering that different approximators have different characteristics and applicability, in order to improve the accuracy of cost evaluation, when selecting a network to build the cost evaluation model, a suitable network can be selected for different types of programs, and the corresponding cost evaluation model can be built based on the selected network.

[0085] For example, when evaluating the approximate cost of an explicit mathematical function, it may be more related to the "flatness" of the function. Its total approximation cost is related to the approximation cost of the local domain. This implicit correlation between the local features of the function and the overall approximation cost can be used as one of the references for selecting and constructing a cost evaluation network.

[0086] For example, approximating a general program often involves analyzing the program's internal semantics. Therefore, Transformer neural networks may be better suited to this task, and thus, a cost evaluation model can be constructed using Transformer neural networks.

[0087] For example, for approximators that are applicable to lookup tables, higher-order polynomials, etc., and have mathematical derivation processes, a corresponding cost evaluation model can be constructed based on a multilayer perceptron. For cost evaluation of neural networks, if the original program corresponding to the approximator being evaluated is easy to represent as a mathematical function, a convolutional network can be used to construct a corresponding cost evaluation model.

[0088] Table 1 shows the correspondence between an approximator and a cost evaluation network.

[0089] Table 1. Correspondence between approximators and cost evaluation networks

[0090] low-dimensional functions High-dimensional functions Control Flow Neural Networks Convolutional Neural Networks, Temporal Networks Convolutional Neural Networks Temporal networks, transform networks Lookup table Multilayer perceptron / Multilayer perceptron higher-order polynomials Multilayer perceptron Multilayer perceptron /

[0091] As shown in Table 1, if the function to be evaluated is a low-dimensional function and is applicable to neural network (NN) approximators, a corresponding cost evaluation model can be constructed based on convolutional neural networks or temporal networks (including recurrent neural networks (RNNs) and spiking neural networks (SNNs)). If the function to be evaluated is a high-dimensional function and is applicable to neural network approximators, a corresponding cost evaluation model can be constructed based on convolutional neural networks. If the function to be evaluated is a control flow type and is applicable to neural network approximators, a corresponding cost evaluation model can be constructed based on temporal networks or transform networks. If the function to be evaluated is a low-dimensional function or a control flow type and is applicable to lookup table (LUT) approximators, a corresponding cost evaluation model can be constructed based on multilayer perceptrons. If the function to be evaluated is a low-dimensional function or a high-dimensional function and is applicable to high-degree polynomial (HDP) approximators, a corresponding cost evaluation model can be constructed based on multilayer perceptrons. It should be noted that the above examples illustrate the methods for determining approximate costs. Any cost evaluation method can be used to evaluate the cost of a fusion node in order to obtain the approximate cost of the fusion node. This disclosure does not limit the methods used.

[0092] In this embodiment of the disclosure, in addition to proposing an approximation cost, the concept of an optimal cost is also proposed for the fusion node. The optimal cost represents the total cost of the optimal approximation strategy for the computational nodes covered by the fusion node. The approximation strategy refers to the strategy adopted when grouping computational nodes for approximation processing.

[0093] In some alternative implementations, the optimal cost of the current fusion node is obtained using a bottom-up strategy through the following steps:

[0094] Based on the computation nodes corresponding to the current fusion node, at least one combination of fusion nodes is obtained; wherein, the combination of fusion nodes corresponds to at least two fusion nodes, the level of the fusion node corresponding to the combination of fusion nodes is lower than the level of the current fusion node, and the computation node of the fusion node corresponding to the combination of fusion nodes is the same as the computation node corresponding to the current fusion node; based on the approximate costs of each fusion node corresponding to each combination of fusion nodes, candidate costs of each combination of fusion nodes are obtained; the candidate costs of each combination of fusion nodes are compared with the approximate costs of the current fusion node, and the one with the smaller cost value is selected as the optimal cost of the current fusion node (the optimal cost of the fusion node must be less than or equal to its approximate cost).

[0095] Furthermore, for the first level, since each fusion node corresponds to the computation node itself, the optimal cost and the approximate cost of each fusion node in the first level are the same.

[0096] The following is combined with Figure 4 The method for determining the optimal cost in the embodiments of this disclosure will be described in detail.

[0097] Figure 4 This is a schematic diagram illustrating an optimal cost determination method provided in an embodiment of this disclosure. (Refer to...) Figure 4 The following example illustrates a fused spatial network consisting of five computational nodes (nodes 1 to 5, connected sequentially). The node numbers (not shown in the figure) follow the numbering rules described above. Each fused node is identified by two rows of numbers: the first row represents the approximate cost of the node, and the second row represents the optimal cost.

[0098] First, based on the approximation sub-network and / or cost evaluation network, the approximate cost of each fusion node in the first level is determined, thus determining the approximate cost of fusion node 1 as 52, fusion node 2 as 2, fusion node 3 as 12, fusion node 4 as 16, and fusion node 5 as 258. Since the optimal cost and approximate cost of the fusion nodes in the first level are the same, the optimal cost of each fusion node in the first level is also determined accordingly.

[0099] After determining the approximate and optimal costs of each fusion node in the first level, a bottom-up strategy (i.e., along the direction from the lower to the higher levels of the fusion spatial network) is adopted to determine the optimal cost of the fusion nodes in the second level.

[0100] First, for fusion node 12, since it corresponds to computation node 1 and computation node 2, there is only one possible combination of fusion nodes: the combination of fusion node 1 and fusion node 2. Since the approximate cost of fusion node 1 is 52 and the approximate cost of fusion node 2 is 2, their sum is 52 + 2 = 54. Therefore, the candidate cost for this combination is 54. Further, based on the approximator or cost evaluation network, the approximate cost of fusion node 12 is determined to be 51. Finally, comparing the candidate cost of the combination with the approximate cost of fusion node 12, the approximate cost with the smaller value is selected as the optimal cost of fusion node 12, thus determining the optimal cost of fusion node 12 as 51. In this case, since the candidate cost is greater than the approximate cost, the approximate cost and the optimal cost of fusion node 12 are the same.

[0101] For fusion node 23, since it corresponds to computation nodes 2 and 3, there is only one possible combination of fusion nodes: the combination of fusion nodes 2 and 3. Since the approximate cost of fusion node 2 is 2 and the approximate cost of fusion node 3 is 12, their sum is 2 + 12 = 14. Therefore, the candidate cost for this combination is 14. Further, based on the approximator or cost evaluation network, the approximate cost of fusion node 23 is determined to be 15. Finally, comparing the candidate cost of the combination with the approximate cost of fusion node 23, the candidate cost with the smaller value is selected as the optimal cost of fusion node 23, thus determining the optimal cost of fusion node 23 to be 12. The arrowed lines pointing from fusion node 23 to fusion nodes 2 and 3 indicate that this optimal cost is obtained from the approximate costs of fusion nodes 2 and 3, respectively. In this case, since the candidate cost is less than the approximate cost, the optimal cost of fusion node 23 is less than the approximate cost. The process of determining the optimal cost for merging nodes 34 and 45 is similar to that for merging node 12, and will not be described further here.

[0102] After obtaining the optimal cost of the fusion node in the second level, the optimal cost of the fusion node in the third level can be determined.

[0103] For fusion nodes 123, since they correspond to computation nodes 1, 2, and 3, there are two possible combinations of fusion nodes: one consisting of fusion nodes 12 and 3, and the other consisting of fusion nodes 1 and 23. Since the approximate cost of fusion node 12 is 51 and the approximate cost of fusion node 3 is 12, their sum is 51 + 12 = 63. Therefore, the alternative cost for the first combination of fusion nodes is 63. Furthermore, since the approximate cost of fusion node 1... The approximate cost of fusion node 123 is 15, and the sum of the two is 52 + 15 = 67. Therefore, the alternative cost for the second combination of fusion nodes is 67. Further, based on the approximator or cost evaluation network, the approximate cost of fusion node 123 is determined to be 21. Finally, comparing the alternative costs of each combination of fusion nodes with the approximate cost of fusion node 123 itself, the approximate cost with the smaller value is selected as the optimal cost of fusion node 123, thus determining the optimal cost of fusion node 123 as 21. In this case, since the alternative cost is greater than the approximate cost, the approximate cost and the optimal cost of fusion node 123 are the same.

[0104] For fusion node 234, since it corresponds to computation nodes 2, 3, and 4, there are two possible combinations of fusion nodes: one consisting of fusion nodes 23 and 4, and the other consisting of fusion nodes 2 and 34. Since the approximate cost of fusion node 23 is 15 and the approximate cost of fusion node 4 is 16, their sum is 15 + 16 = 31. Therefore, the alternative cost for the first combination of fusion nodes is 31. Furthermore, since the approximate cost of fusion node 2... The cost is 2, and the approximate cost of fusion node 34 is 12. The sum of these two costs is 2 + 12 = 14. Therefore, the alternative cost for the second combination of fusion nodes is 14. Further, based on the approximator or cost evaluation network, the approximate cost of fusion node 234 is determined to be 15. Finally, comparing the alternative costs of each combination of fusion nodes with the approximate cost of fusion node 234 itself, the alternative cost with the smaller value is selected as the optimal cost of fusion node 234, thus determining the optimal cost of fusion node 234 as 14. In this case, since the alternative cost is less than the approximate cost, the approximate cost of fusion node 234 is greater than its optimal cost. Furthermore, the arrowed lines pointing from fusion node 234 to fusion nodes 2 and 34 respectively indicate that this optimal cost is obtained from the approximate costs of fusion nodes 2 and 34, respectively. The process of determining the optimal cost of fusion node 345 is similar to that of fusion nodes 123 and will not be described further here.

[0105] After obtaining the optimal cost of the fusion node in the third level, the optimal cost of the fusion node in the fourth level can be determined.

[0106] For fusion nodes 1234, since they correspond to compute nodes 1, 2, 3, and 4, the possible combinations of fusion nodes include three types: a combination consisting of fusion nodes 1 and 234; a combination consisting of fusion nodes 12 and 34; and a combination consisting of fusion nodes 123 and 4 (e.g., ...). Figure 4 (As shown in the diagram). For the first combination of fusion nodes, the alternative cost is 52 + 15 = 67; for the second combination of fusion nodes, the alternative cost is 51 + 12 = 63; and for the third combination of fusion nodes, the alternative cost is 21 + 16 = 37. Further, based on the approximation subnet or cost evaluation network, the approximate cost of fusion node 1234 is determined to be 573. Finally, the alternative costs of each combination of fusion nodes (i.e., 67, 63, 37) are compared with the approximate cost of fusion node 1234 itself (i.e., 573), and the alternative cost 37 with the smallest cost value is selected as the optimal cost of fusion node 1234 (marked with ☆), thus determining the optimal cost of fusion node 1234 as 37.

[0107] The remaining fusion nodes are processed in a similar manner, and the optimal cost for all fusion nodes in the fusion space network can be obtained in the end.

[0108] It should be noted that, for computational graphs with a mesh structure, the process for determining the optimal cost of each fusion node in its fusion spatial network is similar to... Figure 4 The process shown is similar and will not be described in detail here.

[0109] It should also be noted that in some optional implementations, the initial program for the target task may need to be processed using a hybrid approach of precise and approximate calculations. That is, precise calculations may be used for some parts of the program, while approximate calculations may be used for others. For example, if some parts of the program do not support approximation processing of the approximator, or if it is difficult to achieve the preset accuracy requirements, then only precise calculations may be used for these parts of the program.

[0110] In some optional implementations, some statements in the initial program do not support approximation processing methods (e.g., a single lookup table does not support approximation of high-dimensional functions), and the approximation cost of the fusion node corresponding to the statements that do not support approximation processing methods is a preset extreme value; then the optimal cost of the current fusion node is determined based on fusion nodes other than those whose approximation cost is the preset extreme value. The preset extreme value can be a value set based on experience, statistical data, simulation data, etc., and this disclosure does not impose any restrictions on it.

[0111] In other words, for situations that require both precise and approximate calculation methods, when determining the optimal cost of a fusion node, fusion nodes that do not support approximate calculation can be skipped.

[0112] Figure 5 This is a schematic diagram illustrating an optimal cost determination method provided in an embodiment of this disclosure. (Refer to...) Figure 5 The following example illustrates a fused spatial network consisting of five computational nodes (nodes 1 to 5, connected sequentially). The node numbers (not shown in the figure) follow the numbering rules described above. Each fused node is identified by two rows of numbers: the first row represents the approximate cost of the node, and the second row represents the optimal cost. Fusion nodes without filled stripes support approximate calculations, while those with filled stripes support exact calculations.

[0113] like Figure 5As shown, when determining the fusion nodes of the first level, since fusion nodes 3 and 4 do not support approximate calculation, it is not necessary to determine the approximate cost of these two fusion nodes (or it is considered that their approximate cost is too large and the value is set to a preset extreme value). Only the approximate cost of the remaining fusion node 1 is determined to be 52, the approximate cost of fusion node 2 is 2, and the approximate cost of fusion node 5 is 258.

[0114] Secondly, the approximate cost and optimal cost of each fusion node in the second level are determined. The method for determining the approximate cost is similar to... Figure 4 The method shown is the same and will not be described further here. When determining the optimal cost, for fusion node 23, since the approximate cost of fusion node 3 cannot be determined, the optimal cost of fusion node 23 is the same as its approximate cost, which is 15. Figure 4 Its optimal cost is 14).

[0115] For the third level, fusion node 345 supports exact calculation; therefore, it is unnecessary to determine its approximate and optimal costs. For fusion nodes 123 and 234, according to... Figure 4 The method shown can be used to determine the approximate cost and the optimal cost for each.

[0116] For the fourth level, fusion nodes 1234 are based on Figure 4 The method shown can be used to determine its approximate cost and optimal cost. For merged node 2345, since merged node 345 cannot be approximated, the merged node combinations for merged node 2345 only include two types: a merged node combination consisting of merged node 23 and merged node 45, and a merged node combination consisting of merged node 234 and merged node 5 (more...). Figure 4 The number of fusion node combinations consisting of fusion node 2 and fusion node 345 was reduced. Among them, the alternative cost corresponding to the fusion node combination consisting of fusion node 23 and fusion node 45 is the smallest. Therefore, the optimal cost of fusion node 2345 is determined to be 183.

[0117] Finally, using a similar method, the optimal cost of fusion node 12345 can be determined to be 189, thus obtaining the approximate cost and optimal cost of each fusion node that supports approximate calculation.

[0118] In some alternative implementations, after determining the approximate cost and optimal cost of at least one fusion node in other levels (referring to any level other than the first level), candidate groups for the initial program can be determined based on the determined approximate and optimal costs of the fusion nodes. The candidate groups for the initial program refer to dividing the initial program into multiple approximation groups. Each approximation group may include one or more computation nodes, and during approximate computation, the corresponding approximation processing needs to be performed on a per-approximation-group basis.

[0119] In this embodiment of the disclosure, as long as the approximate cost and optimal cost of at least one fusion node in any level other than the first level are obtained, the candidate group can be determined. It is not necessary to obtain the approximate cost and optimal cost of all fusion nodes before determining the candidate group (it should be noted that this embodiment of the disclosure also supports determining the candidate group after obtaining the approximate cost and optimal cost of all fusion nodes).

[0120] For example, after obtaining the approximate cost and optimal cost of one or more fusion nodes in the second level (e.g., fusion node 12 and / or fusion node 34), the candidate groups for the initial procedure can be determined based on the approximate cost and optimal cost of the already determined fusion nodes (including all fusion nodes in the first level and one or more fusion nodes in the second level mentioned above).

[0121] For example, after obtaining the approximate cost and optimal cost of all fusion nodes in the second level, the candidate groups for the initial procedure can be determined based on the approximate cost and optimal cost of the already determined fusion nodes (including all fusion nodes in the first and second levels).

[0122] For example, after obtaining the approximate cost and optimal cost of each fusion node at all levels, the candidate groups for the initial procedure can be determined based on the approximate cost and optimal cost of the already determined fusion nodes (including all fusion nodes in the fusion space network).

[0123] In some optional implementations, candidate groups for the initial program are determined based on the approximate and optimal costs of the fusion nodes. This includes: determining the groups of computation nodes based on the approximate and optimal costs of the fusion nodes and using a preset search strategy; and determining candidate groups for the initial program based on the groups of computation nodes. Grouping computation nodes refers to dividing multiple computation nodes into different groups. Furthermore, since fusion nodes are used to obtain the groups of computation nodes, and the computation nodes that make up the fusion nodes are connected, the computation nodes within the same group also have connections, thus facilitating subsequent approximation processing.

[0124] In some alternative implementations, after determining the candidate group, it is also necessary to determine whether the candidate group is the final target group based on preset stopping conditions.

[0125] In some optional implementations, the stopping condition includes at least one of the following: the total error of the candidate groups is less than a preset error threshold; the total cost of the candidate groups is less than a preset cost threshold; the total cost of the candidate groups is less than the idle load of the hardware device carrying the target task; in response to the traversal of all fusion nodes in the fusion space network.

[0126] It should be noted that the above stopping conditions are merely illustrative examples. Stopping conditions can also be set based on experience, statistical data, simulation data, etc. This disclosure does not impose any limitations on this.

[0127] In some optional implementations, the search strategy includes dynamic programming-based search strategies, greedy algorithm-based search strategies, etc., and this disclosure does not limit the implementation of these strategies.

[0128] In some alternative implementations, the dynamic programming-based search strategy includes: in determining the optimal cost, a currently optimal candidate group can be maintained based on the approximate cost and optimal cost of the already determined fusion nodes, and the currently maintained candidate group can be used as the target group if the stopping condition is met.

[0129] In some optional implementations, the search strategy based on the greedy algorithm includes: calculating the approximate cost and optimal cost of each current fusion node, as well as the approximate cost and optimal cost of each fusion node at the next higher level obtained by combining the current fusion nodes; based on the above cost information, maintaining a priority queue with the cost reduction generated by combining the fusion nodes as the priority; selecting the combination scheme with the highest priority, and determining the candidate group based on the combination scheme with the highest priority; on this basis, jumping back to the first step, determining the approximate cost and optimal cost of at least one new fusion node (a new fusion node refers to a fusion node whose approximate cost and optimal cost have not been determined), and repeating the above process until a candidate group that meets the stopping condition is obtained, which is then taken as the final target group.

[0130] It should be noted that the search process (i.e., the process of determining the target group) and the calculation process described above can be processed in parallel. For example, for a processing chip, during its calculation process, the target group can be determined based on the search strategy described above. After the processing chip completes its calculation, it can perform corresponding approximate calculations based on the target group. Based on this processing method, the processing time can be further shortened, thereby improving processing efficiency.

[0131] The following is combined with Figure 6 and Figure 7 The method for determining target groups in the embodiments of this disclosure will be described in detail.

[0132] Figure 6 This is a schematic diagram illustrating the working process of a task processing method provided in an embodiment of this disclosure. (Refer to...) Figure 6 Taking a fused spatial network consisting of 5 computational nodes (nodes 1 to 5, connected sequentially) as an example, the node numbers (not shown in the figure) follow the numbering rules described above. Each fused node is identified by two rows of numbers: the first row represents the approximate cost of the node, and the second row represents the optimal cost. For example... Figure 6 As shown, it illustrates the process of determining target groups using a search strategy based on dynamic programming.

[0133] First, determine the approximate cost and optimal cost of each fusion node in the first level. Then, determine that the approximate cost and optimal cost of fusion node 12 in the second level are both 51. The method for determining the approximate cost and optimal cost is described in the aforementioned relevant content and will not be elaborated here.

[0134] Furthermore, based on the already determined approximate and optimal costs of the fusion nodes, candidate groups for the initial procedure are determined. Since the optimal cost of fusion node 12 is less than the sum of the approximate costs of fusion nodes 1 and 2, grouping fusion nodes 1 and 2 as one computation node (corresponding to fusion node 12, the computation node groups can be considered as one approximate group) can reduce the cost (the cost reduction is 52 + 2 - 51 = 3). Based on this, the currently relatively optimal candidate group is determined as follows: computation nodes 1 and 2 are grouped as one approximate group, and computation nodes 3, 4, and 5 are each grouped as a separate approximate group. The total cost at this point is 51 + 12 + 16 + 258 = 337.

[0135] Furthermore, the approximate cost of fusion node 23 in the second level is determined to be 15, and the optimal cost is 14. Since its optimal cost is equal to the sum of the approximate costs of computation nodes 2 and 3, it is unnecessary to group computation nodes 2 and 3 as one approximate group. Therefore, in the current case, the relatively optimal alternative grouping remains: grouping computation nodes 1 and 2 as one approximate group, and grouping computation nodes 3, 4, and 5 as separate approximate groups, keeping the total cost unchanged at 337.

[0136] Furthermore, it can be determined that the approximate cost and optimal cost of fusion node 34 in the second level are both 12. Since its optimal cost is less than the sum of the approximate costs of computation nodes 3 and 4, grouping computation nodes 3 and 4 into one approximate group can also achieve the goal of reducing costs. Based on this, the current relatively optimal candidate grouping can be determined as follows: grouping computation nodes 1 and 2 into one approximate group, grouping computation nodes 3 and 4 into one approximate group, and grouping computation node 5 into a separate approximate group. The total cost at this point is 51 + 12 + 258 = 321, which is a further reduction compared to before.

[0137] Furthermore, it can be determined that the approximate cost and optimal cost of fusion node 45 in the second level are both 168. Since its optimal cost is less than the sum of the approximate costs of computation nodes 4 and 5, grouping computation nodes 4 and 5 into an approximate group can also achieve the goal of reducing costs. However, in the current relatively optimal candidate group, computation nodes 3 and 4 have already been grouped into an approximate group, occupying computation node 4. Therefore, it is necessary to determine the cost difference between the approximate group composed of computation nodes 3 and 4 and the approximate group composed of computation nodes 4 and 5, in order to determine whether to update the candidate group. Specifically, grouping computation nodes 3 and 4 into an approximate group can reduce costs by 12 + 16 - 12 = 16, while grouping computation nodes 4 and 5 into an approximate group can reduce costs by 16 + 258 - 168 = 106. Obviously, the latter can reduce costs more than the former. Therefore, the candidate groups are updated, and the current relatively optimal candidate groups are determined as follows: computation node 1 and computation node 2 are grouped into one approximate group, computation node 3 is grouped into a separate approximate group, and computation node 4 and computation node 5 are grouped into another approximate group. The total cost at this point is 51 + 12 + 168 = 231, which is a further reduction compared to before.

[0138] Following a similar approach, a currently optimal alternative group can always be determined. For example... Figure 6 As shown, after traversing the entire fusion space network, the final candidate groups are determined as follows: computation nodes 1, 2, and 3 are grouped into one approximate group, and computation nodes 4 and 5 are grouped into another approximate group. The total cost at this point is the sum of the optimal cost of fusion nodes 1, 2, and 3 and the optimal cost of fusion node 4 and 5: 21 + 168 = 189.

[0139] Figure 7 This is a schematic diagram illustrating the working process of a task processing method provided in an embodiment of this disclosure. (Refer to...) Figure 7Taking a fused spatial network consisting of 5 computational nodes (nodes 1 to 5, connected sequentially) as an example, the node numbers (not shown in the figure) follow the numbering rules described above. Each fused node is identified by two rows of numbers: the first row represents the approximate cost of the node, and the second row represents the optimal cost. For example... Figure 7 As shown, it illustrates the process of determining target groups using a search strategy based on a greedy algorithm.

[0140] First, determine the approximate cost and optimal cost of each fusion node in the first level (equivalent to the approximate cost and optimal cost of the current fusion nodes). Based on this, determine the approximate cost and optimal cost of each fusion node in the second level (equivalent to the fusion nodes of the previous level obtained by combining the current fusion nodes). The method for determining the approximate cost and optimal cost is described in the aforementioned relevant content and will not be elaborated here.

[0141] Furthermore, based on the determined approximate and optimal costs of the fusion nodes, a priority queue is maintained, prioritizing the cost reduction resulting from combining the fusion nodes. Specifically, combining fusion node 1 and fusion node 2 to obtain fusion node 12 reduces the cost by 52 + 2 - 51 = 3; combining fusion node 3 and fusion node 4 to obtain fusion node 34 reduces the cost by 12 + 16 - 12 = 16; and combining fusion node 4 and fusion node 5 to obtain fusion node 45 reduces the cost by 16 + 258 - 168 = 106. Based on this, the determined priority queue is as follows: Figure 7 As shown, the cost reductions are 3, 16, and 106 respectively. Among them, the scheme that combines fusion node 4 and fusion node 5 reduces the cost the most and has the highest priority. Therefore, the alternative grouping is determined as follows: each of computation node 1, computation node 2, and computation node 3 is treated as a separate approximation group, and computation node 4 and computation node 5 are treated as a single approximation group.

[0142] Furthermore, fusion nodes 1, 2, 3, and 45 are taken as the current fusion nodes in the new round of iterative updates. The approximate cost and optimal cost of fusion node 345, obtained by further combining fusion nodes 3 and 45, are determined, both being 120. Based on this, a new priority queue is established using the cost reduction resulting from combining fusion nodes as the priority. Specifically, combining fusion nodes 1 and 2 to obtain fusion node 12 reduces the cost by 52 + 2 - 51 = 3; combining fusion nodes 3 and 45 to obtain fusion node 345 reduces the cost by 52 + 168 - 120 = 64. Based on this, the determined priority queue is as follows: Figure 7As shown, the cost reductions are 3 and 64 respectively. Among them, the scheme that combines fusion node 3 and fusion node 45 reduces the cost the most and has the highest priority. Therefore, the alternative grouping is determined as follows: computing node 1 and computing node 2 are each in a separate approximation group, and computing node 3, computing node 4 and computing node 5 are in a single approximation group.

[0143] Furthermore, fusion nodes 1, 2, and 345 are taken as the current fusion nodes in the new round of iterative updates. The approximate cost and optimal cost of fusion node 2345, obtained by combining fusion nodes 2 and 345, are determined to be 264 and 122, respectively. Based on this, a new priority queue is established with the cost reduction resulting from combining fusion nodes as the priority. Since the optimal cost of fusion node 2345 is greater than the sum of the approximate costs of fusion nodes 2 and 345, combining fusion nodes 2 and 345 cannot achieve cost reduction. Based on this, the determined priority queue is as follows: Figure 7 As shown, the scheme that only includes combining fusion node 1 and fusion node 2 has a reduced cost of 3 and has the highest priority. Therefore, the alternative grouping is determined as follows: fusion node 1 and fusion node 2 are grouped into one approximate group, and fusion node 3, fusion node 4 and fusion node 5 are grouped into another approximate group.

[0144] In a similar manner, the entire fusion space network can be traversed to obtain the corresponding candidate groups.

[0145] It should be noted that during the search process based on the search strategy, the appropriate time can be selected to determine whether the stopping condition is met, and if the stopping condition is met, the current relatively optimal candidate group is output as the final target group.

[0146] For example, when the first candidate group is determined and each candidate group is updated (i.e., every time a new candidate group is obtained), it can be determined whether the stopping condition is met. If the stopping condition is met, the current relatively optimal candidate group is output as the final target group.

[0147] For example, based on a bottom-up approach, after determining the optimal cost of all fusion nodes at a level and identifying the corresponding candidate groups, it is determined whether the stopping condition is met (i.e., whether the stopping condition is met in units of the fusion spatial network level). If the stopping condition is met, the current candidate group is output as the final target group.

[0148] It should be noted that the above-described timing for determining whether the stopping condition is met is merely an example, and this disclosure does not impose any limitations on it.

[0149] In some alternative implementations, considering that error accumulation may occur during approximation (e.g., error accumulation between associated subtasks may lead to a significant increase in the total task error), the error cost correlation curves of the fusion nodes to be combined are fused to more accurately determine the correlation between the error and cost of the combined fusion nodes.

[0150] In some optional implementations, the cost evaluation model is also used to determine the error cost correlation curves for each fusion node; correspondingly, after determining the candidate groups for the initial procedure, when the stopping condition is that the total error of the candidate groups is less than a preset error threshold, the following steps are also included:

[0151] The error cost correlation curves of each fusion node in the first level are determined based on the cost evaluation model. Based on a pre-defined accuracy propagation network, the fusion error cost correlation curves of at least one fusion node in other levels are obtained from the error cost correlation curves of each fusion node in the first level. The accuracy propagation network is used to determine the correlation between input and output errors. Based on the determined error cost correlation curves and pre-defined accuracy requirements, the total error of the candidate group is determined. Whether the stopping condition is met is determined based on the total error of the candidate group and a pre-defined error threshold. The accuracy propagation network can be obtained through training.

[0152] It should be noted that the fusion process of the precision propagation network is a relatively complex process. It is not simply a linear superposition of the error cost correlation curves of each fusion node, but rather a more accurate and reasonable fusion error cost correlation curve is determined from the perspective of the overall approximate processing of the task, combined with the characteristics of each fusion node itself.

[0153] Figure 8 This is a schematic diagram illustrating error propagation as provided in an embodiment of this disclosure. (Refer to...) Figure 8 For the ring network structure consisting of fusion nodes 1, 2, 3, and 4, when the input error of fusion node 1 is zero, due to the approximate calculation of fusion node 1, the input error of its corresponding fusion node 2 is 0.2, and the input error of its corresponding fusion node 3 is 1.4. For fusion node 2, with an input error of 0.2, the output error is 2.2; for fusion node 3, with an input error of 1.4, the output error is 0.5; finally, fusion node 4, based on the input errors of fusion nodes 2 and 3, ultimately outputs an error of 3.2. In the above process, although the input error of fusion node 1 is zero, the error is propagated through the processing of the subsequent two adjacent fusion nodes, resulting in a final output error of 3.2.

[0154] Figure 9 This is a schematic diagram illustrating the relationship between input error and output error, provided as an embodiment of this disclosure. (Refer to...) Figure 9 The horizontal axis of the coordinate system represents the input error, and the vertical axis represents the output error. The curve shown is the fusion error cost correlation curve. For example... Figure 9 As shown, when the input error range is determined to be (a1, a2), the output error range can be determined to be (b1, b2) based on the fusion error cost correlation curve.

[0155] Figure 10 This is a schematic diagram of the fusion error cost correlation curve based on a fusion spatial network, provided as an embodiment of this disclosure. (Refer to...) Figure 10 The following explanation uses a fusion spatial network consisting of five computation nodes (nodes 1 to 5, connected sequentially) as an example. For fusion node 1, its corresponding error cost correlation curve is essentially the error cost correlation curve of computation node 1. For fusion node 12, its corresponding fusion error cost correlation curve is obtained by fusing the error cost correlation curves of fusion node 1 and fusion node 2 based on the accuracy propagation network. For fusion nodes 345, its corresponding fusion error cost correlation curve is obtained by further fusing the fusion error cost correlation curves of fusion node 34 and fusion node 45 based on the accuracy propagation network. Other fusion nodes are similar and will not be described further here.

[0156] In some alternative implementations, after determining the alternative groups, it can be based on... Figure 10 The diagram shows how the error of each approximation group in the candidate group is determined, the total error of the candidate group is obtained, and the stopping condition is determined by comparing whether the total error is greater than a preset error threshold.

[0157] For example, if the candidate grouping is determined by taking computation node 1, computation node 2, and computation node 3 as one approximation group, and computation node 4 and computation node 5 as another approximation group, then according to... Figure 10 The fusion error cost correlation curves of fusion nodes 123 and 45 can be used to obtain the total error of the candidate group when the accuracy requirements are met. If the total error is less than the preset error threshold, the stopping condition is met and the current candidate group is taken as the final target group. If the total error is greater than or equal to the preset error threshold, the stopping condition is not met and a new candidate group is determined.

[0158] It should be noted that the tasks of neural network compilation and many-core system deployment also involve grouping computation nodes in the computation graph, and the task processing method of this disclosure is also applicable to this scenario. For example, when grouping computers and mapping different computer groups to different chips or different execution times of chips, parameters such as component data transfer volume, intra-group computation volume, and storage volume can be used as cost evaluation parameters. When determining computer groups based on search strategies, the approach usually moves towards local optima, and ultimately, the globally optimal computer grouping can be obtained with a high probability.

[0159] Figure 11 This is a schematic diagram illustrating the working process of a task processing method provided in an embodiment of this disclosure. (Refer to...) Figure 11 The task processing method includes:

[0160] Step S1101: Obtain the initial program for the target task.

[0161] Step S1102: Based on the initial program, determine the corresponding computation graph, which includes one computation node or multiple computation nodes with one-to-one and / or one-to-many connection relationships.

[0162] Step S1103: Construct a fusion spatial network based on the computation graph.

[0163] Step S1104: Determine the approximate cost of each fusion node in the first level of the fusion spatial network.

[0164] Step S1105: Based on the approximate costs of each fusion node in the first level, determine the approximate cost and optimal cost of at least one fusion node in other levels.

[0165] Step S1106: Based on the approximate cost and optimal cost of the determined fusion nodes, obtain the candidate groups for the initial procedure.

[0166] Step S1107: Determine whether the preset stop conditions are met.

[0167] If the stopping condition is met, step S1108 is executed; otherwise, the process jumps to step S1111.

[0168] Step S1108: Use the alternative group as the target group for the initial procedure.

[0169] Step S1109: Compile the initial program based on the target group to obtain the compilation result.

[0170] Step S1110: Execute the target task based on the compilation results to obtain the execution results of the target task.

[0171] Step S1111: Select at least one untraversed fusion node from the fusion spatial network, and determine the approximate cost and optimal cost of the selected at least one fusion node.

[0172] After completing step S1111, proceed to step S1106 to update the original candidate group, and execute the subsequent steps in sequence until the target group is obtained when the stopping condition is met, and obtain the execution result of the target task based on the target group.

[0173] It should be noted that, although the performance of the processing system (including single-core and many-core processing systems) is not directly changed in this embodiment, by grouping the initial program of the target task and performing corresponding processing (including compilation and execution) based on the obtained target groups, the resource allocation method of the processing system is essentially changed, which may affect the resource consumption of the processing system (usually by reducing its resource consumption). In some scenarios, if the required resource consumption is A when the task processing method of this embodiment is not used, the processing system can only execute the target task if the available resource consumption is greater than or equal to A; if the required resource consumption is reduced from A to B after using the task processing method of this embodiment, the processing system can execute the target task as long as the available resource consumption is greater than or equal to B, which is equivalent to enabling a processing system that was originally unable to run the target task to have the ability to execute the target task.

[0174] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.

[0175] Secondly, embodiments of this disclosure provide a task processing apparatus.

[0176] Figure 12 This is a block diagram of a task processing apparatus provided in an embodiment of the present disclosure.

[0177] Reference Figure 12 This disclosure provides a task processing apparatus 1200, which includes:

[0178] The construction module 1201 is used to construct a fusion space network corresponding to the initial program of the acquired target task. The fusion space network consists of multiple levels of fusion nodes and connecting edges. The fusion nodes correspond to at least one statement in the initial program, the connecting edges correspond to the data dependencies between the fusion nodes, and there are corresponding fusion relationships between the fusion nodes at each level.

[0179] The first determining module 1202 is used to determine the approximate cost of each fusion node in the first layer of the fusion spatial network;

[0180] The second determining module 1203 is used to determine the approximate cost and optimal cost of at least one fusion node in other levels based on the approximate cost of each fusion node in the first level, wherein the optimal cost of the fusion node is less than or equal to the approximate cost of the fusion node.

[0181] Grouping module 1204 is used to determine candidate groups for the initial procedure based on the approximate cost and optimal cost of the already determined fusion nodes;

[0182] The grouping determination module 1205 is used to determine, based on the premise that the candidate grouping meets the preset stopping conditions, the candidate grouping is used as the target grouping of the initial program, so as to perform approximate processing of the initial program of the target task based on the target grouping.

[0183] The embodiments provided in this disclosure firstly, through a construction module, a fusion spatial network corresponding to the initial program of the acquired target task is constructed. This fusion spatial network consists of multiple levels of fusion nodes, each corresponding to at least one statement in the initial program. Connection edges correspond to data dependencies between fusion nodes, and fusion nodes at different levels have corresponding fusion relationships. This process effectively divides the initial program into different granularities, resulting in multiple fusion nodes, providing a foundation for subsequent grouping. Furthermore, it clarifies the fusion relationships between fusion nodes of different granularities and constructs a fusion spatial network with a network structure based on these relationships, thus more intuitively and conveniently demonstrating and utilizing these relationships for subsequent grouping. Secondly, through a first determining module, the approximate cost of each fusion node in the first level of the fusion spatial network is determined, and this approximate cost is used to determine the approximate cost of fusion nodes at higher levels. The first step involves determining the approximate cost and optimal cost of each fusion node in the first level. Then, the second determining module, based on the approximate cost of each fusion node in the first level, determines the approximate cost and optimal cost of at least one fusion node in other levels. The optimal cost of a fusion node is less than or equal to its approximate cost. By setting the optimal cost, the subsequent grouping effect is optimized, further reducing costs and improving resource utilization. The grouping module, based on the determined approximate and optimal costs of the fusion nodes, determines candidate groups for the initial program, thus identifying the relatively optimal candidate groups under the current circumstances. Finally, the grouping determining module, based on the candidate groups and the predetermined stopping conditions, uses the candidate groups as the target groups for the initial program. This achieves approximate grouping of the initial program and allows for approximate processing of the initial program for the target task based on the target group. Compared to executing the initial task entirely using precise processing, this effectively reduces program execution costs and improves resource utilization.

[0184] Thirdly, embodiments of this disclosure provide a processing architecture.

[0185] Figure 13 This is a block diagram of a processing architecture provided in an embodiment of the present disclosure.

[0186] Reference Figure 13 This disclosure provides a processing architecture 1300, which includes a task processing device 1310, a compilation device 1320, and a processor 1330.

[0187] The task processing device 1310 is used to execute any of the task processing methods in the embodiments of this disclosure;

[0188] The compiler 1320 is used to perform compilation processing based on the target group of the initial program obtained by the task processing device, and to obtain the compilation result;

[0189] Processor 1330 is used to obtain the execution result of the target task based on the compilation result.

[0190] In the embodiments provided in this disclosure, the task processing device can scientifically and reasonably group the initial programs of various target tasks, thereby quickly obtaining target groups. The compilation device can perform corresponding approximate processing based on the target groups to obtain compilation results. Then, the processor can obtain the execution results of the target tasks based on the compilation results. Since the target groups are more scientific and reasonable, the cost required in the processing process can be reduced and the resource utilization rate can be improved.

[0191] In addition, this disclosure also provides electronic devices and computer-readable storage media, all of which can be used to implement any of the task processing methods provided in this disclosure. The corresponding technical solutions and descriptions are described in the corresponding descriptions in the method section, and will not be repeated here.

[0192] Figure 14 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.

[0193] Reference Figure 14 This disclosure provides an electronic device, which includes: at least one processor 1401; at least one memory 1402; and one or more I / O interfaces 1403 connected between the processor 1401 and the memory 1402; wherein the memory 1402 stores one or more computer programs that can be executed by the at least one processor 1401, and the one or more computer programs are executed by the at least one processor 1401 to enable the at least one processor 1401 to perform the above-described task processing method.

[0194] Figure 15 This is a block diagram of an electronic device provided in an embodiment of the present disclosure.

[0195] Reference Figure 15 This disclosure provides an electronic device that includes multiple processing cores 1501 and an on-chip network 1502. The multiple processing cores 1501 are all connected to the on-chip network 1502, and the on-chip network 1502 is used to exchange data between the multiple processing cores and external data.

[0196] One or more processing cores 1501 store one or more instructions, and the one or more instructions are executed by one or more processing cores 1501 to enable one or more processing cores 1501 to perform the above-described task processing method.

[0197] In some embodiments, the electronic device may be a neuromorphic chip. Since neuromorphic chips can employ vectorized computation and require external memory, such as Double Data Rate (DDR) synchronous dynamic random access memory, to load parameters such as weights of the neural network model, the batch processing method used in this embodiment offers higher computational efficiency.

[0198] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the above-described task processing method. The computer-readable storage medium may be volatile or non-volatile.

[0199] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the above-described task processing method.

[0200] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0201] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0202] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0203] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.

[0204] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0205] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0206] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0207] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0208] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0209] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.

Claims

1. A task processing method, characterized in that, include: Based on the initial program of the acquired target task, a fusion space network corresponding to the initial program is constructed; wherein, the fusion space network consists of multiple levels of fusion nodes and connecting edges, the fusion nodes correspond to at least one statement in the initial program, the connecting edges correspond to the data dependencies between the fusion nodes, and there are corresponding fusion relationships between the fusion nodes at each level. Determine the approximate cost of each fusion node in the first layer of the fusion spatial network; Based on the approximate costs of each fusion node in the first level, determine the approximate cost and optimal cost of at least one fusion node in other levels, wherein the optimal cost of the fusion node is less than or equal to the approximate cost of the fusion node. Based on the approximate cost and optimal cost of the fusion node that have been determined, the candidate groups for the initial procedure are determined; If a preset stopping condition is met based on the candidate group, the candidate group is used as the target group of the initial program, and an approximate processing of the initial program of the target task is performed based on the target group.

2. The method according to claim 1, characterized in that, The step of constructing a fusion spatial network corresponding to the initial program of the acquired target task includes: Based on the initial program, a corresponding computation graph is determined, the computation graph including at least one computation node, the computation node corresponding to at least one statement in the initial program, and the computation nodes having one-to-one and / or one-to-many connection relationships; Based on the computation graph, the fused spatial network is constructed; The fusion spatial network includes multiple levels, each level including at least one fusion node. The fusion node consists of one or more computing nodes with interconnected relationships, and the number of computing nodes corresponding to the fusion node increases sequentially with the increase of the level.

3. The method according to claim 2, characterized in that, If there is a connection between the computing node corresponding to the current fusion node and the computing node corresponding to another fusion node in the same level, it is determined that there is an association between the current fusion node and the other fusion node. The construction of the fused spatial network based on the computation graph includes: Merge the computation nodes corresponding to at least two related fusion nodes in the i-th level to obtain the fusion node of the (i+1)-th level; In this context, each fusion node in the first level corresponds to a computation node in the computation graph.

4. The method according to claim 2, characterized in that, The optimal cost of the current fusion node is obtained through the following steps using a bottom-up strategy: Based on the computing nodes corresponding to the current fusion node, at least one combination of fusion nodes is obtained; wherein, the combination of fusion nodes corresponds to at least two fusion nodes, the level of the fusion node corresponding to the combination of fusion nodes is lower than the level of the current fusion node, and the computing node of the fusion node corresponding to the combination of fusion nodes is the same as the computing node corresponding to the current fusion node. Based on the approximate cost of each fusion node corresponding to each fusion node combination, the alternative cost of each fusion node combination is obtained; Compare the alternative costs of each of the fusion node combinations with the approximate cost of the current fusion node, and select the one with the smaller cost value as the optimal cost of the current fusion node.

5. The method according to claim 1, characterized in that, The approximate cost of the fusion node is obtained by evaluating the cost of all the computational nodes that make up the fusion node as a whole.

6. The method according to claim 1 or 5, characterized in that, The approximate cost is obtained based on a preset accuracy requirement and through a pre-trained cost evaluation model; The cost evaluation model is constructed based on at least one of convolutional neural networks, temporal networks, and multilayer perceptrons.

7. The method according to claim 1, characterized in that, The process of determining candidate groups for the initial procedure based on the already determined approximate and optimal costs of the fusion nodes includes: Based on the already determined approximate cost and optimal cost of the fusion nodes, and through a preset search strategy, the grouping of computing nodes is determined; Based on the grouping of the computation nodes, the candidate groups for the initial program are determined.

8. The method according to claim 1, characterized in that, In the initial program, some statements do not support the approximation processing method, and the approximation cost of the fusion node corresponding to the statement that does not support the approximation processing method is a preset extreme value. The optimal cost of the current fusion node is determined based on fusion nodes other than those whose approximate cost is the preset extreme value.

9. The method according to claim 6, characterized in that, The stopping condition includes at least one of the following: The total error of the candidate groups is less than a preset error threshold; The total cost of the candidate groups is less than a preset cost threshold; The total cost of the alternative groups is less than the idle load of the hardware device carrying the target task; In response to a traversal of all fusion nodes in the fusion space network.

10. The method according to claim 9, characterized in that, The cost evaluation model is also used to determine the error cost correlation curve for each fusion node; When the stopping condition is that the total error of the candidate groups is less than a preset error threshold, after determining the candidate groups for the initial procedure, the method further includes: Based on the cost evaluation model, the error cost correlation curves of each fusion node in the first level are determined; Based on the preset precision propagation network, the fusion error cost correlation curve of at least one other level fusion node is obtained according to the error cost correlation curve of each fusion node in the first level. The precision propagation network is used to determine the correlation between input error and output error. Based on the determined error cost correlation curve and the preset accuracy requirements, the total error of the candidate groups is determined; Whether the stopping condition is met is determined based on the total error of the candidate groups and the preset error threshold.

11. The method according to claim 1, characterized in that, After selecting the candidate group as the target group for the initial procedure, the method further includes: The initial program is compiled based on the target group to obtain the compilation result; The target task is executed based on the compilation result, and the execution result of the target task is obtained.

12. A task processing device, characterized in that, For implementing the method as described in any one of claims 1-11, comprising: The construction module is used to construct a fusion space network corresponding to the initial program of the acquired target task; wherein the fusion space network consists of multiple levels of fusion nodes and connecting edges, the fusion nodes correspond to at least one statement in the initial program, the connecting edges correspond to the data dependencies between the fusion nodes, and there are corresponding fusion relationships between the fusion nodes at each level. The first determining module is used to determine the approximate cost of each fusion node in the first layer of the fusion spatial network; The second determining module is used to determine the approximate cost and optimal cost of at least one fusion node in other levels based on the approximate cost of each fusion node in the first level, wherein the optimal cost of the fusion node is less than or equal to the approximate cost of the fusion node. A grouping module is used to determine candidate groups for the initial procedure based on the approximate cost and optimal cost of the fusion nodes that have been determined. The grouping determination module is used to determine, based on the candidate grouping, that if a preset stopping condition is met, to use the candidate grouping as the target grouping of the initial program, so as to perform approximate processing of the initial program of the target task based on the target grouping.

13. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the task processing method as described in any one of claims 1-11.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the task processing method as described in any one of claims 1-11.