Data flow diagram segmentation method and device, computing equipment and storage medium

By dividing partitions in the data flow graph and predicting node gains, optimizing the segmentation strategy solves the problem of low efficiency and accuracy of data flow graph segmentation in the existing technology, and improves the configuration efficiency and success rate of programmable hardware.

CN118690702APending Publication Date: 2024-09-24HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310307748.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-24
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

When the existing technology handles large-scale data flow graphs with complex connection relationships, it is difficult to quickly determine the segmentation strategy with the integer linear programming method, resulting in low segmentation efficiency and accuracy, which affects the configuration efficiency and success rate of programmable hardware.

Method used

By dividing the data flow graph into two partitions, the gain of the node is determined in each partition, and the sum of gains after each node movement is predicted based on the gain, and the segmentation strategy is optimized to improve segmentation efficiency and accuracy, taking into account node attributes and Deadlock situations to balance partition distribution.

Benefits of technology

It improves the efficiency and accuracy of data flow graph segmentation, enhances the configuration efficiency and success rate of programmable hardware, and can quickly process data flow graphs of large-scale nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000
    Figure 00000000_0000
Patent Text Reader

Abstract

The invention provides a data flow diagram segmentation method and device, computing equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: dividing a plurality of first sub-graphs of a data flow graph into two partitions; determining the gain of each node based on the partition where each node is located, the attribute of each node and the deadlock condition of the first sub-graph to which each node belongs; based on the gain of each node, predicting the sum of gains of the moved nodes after one node is moved each time; and based on the partition where each node corresponding to the minimum gain sum is located, segmenting the plurality of first sub-graphs into a plurality of second sub-graphs. In the method, since the node moved each time is determined based on the gain, and when the gain of the node is determined, the distribution condition of the nodes with different attributes in the two partitions and the deadlock condition of the sub-graph are considered, so that the moved node can balance the distribution of the nodes with different attributes in the two partitions or crack the deadlock; therefore, the configuration efficiency and the success rate of the programmable hardware are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computing device and storage medium for segmenting a data flow graph. Background Art

[0002] In reconfigurable technology, the task to be executed by programmable hardware is described by a data flow graph, which includes multiple nodes and at least one hyperedge, wherein each node corresponds to a data processing process in the task, and the data processing process is executed by an execution unit in the programmable hardware; each hyperedge is composed of at least one edge starting from the same node, which is used to describe the data flow in the task, and the data flow corresponds to a path between multiple execution units. Due to the limitation of the number of execution units in programmable hardware and the connection method between execution units, programmable hardware may not be able to execute the task corresponding to the entire data flow graph at one time. Therefore, it is necessary to first divide the data flow graph (control dataflow graph, CDFG) of programmable hardware into multiple subgraphs, and then configure the execution units of programmable hardware based on each subgraph in turn, that is, to layout and route the programmable hardware so that the programmable hardware can execute the tasks corresponding to each subgraph in turn. Therefore, if the data flow graph is not divided reasonably, it will have a great impact on the configuration success rate of subsequent execution units.

[0003] In the related art, the integer linear programming (ILP) method is used to convert the architectural information and graph partitioning constraints of the programmable hardware into constraints, and the expected resource utilization of the programmable hardware is converted into an objective function. First, multiple partitioning strategies that meet the constraints are determined, and then the partitioning strategy that maximizes the objective function among the multiple partitioning strategies is determined as the target partitioning strategy, and the data flow graph is partitioned based on the target partitioning strategy.

[0004] However, in the above method, for data flow graphs with large scale and complex connection relationships, the integer linear programming method is difficult to quickly determine the accurate segmentation strategy. Therefore, it is difficult to ensure the segmentation efficiency and segmentation accuracy. There is also the possibility that it is difficult to complete the configuration of the execution unit based on the segmented sub-graphs, which in turn affects the configuration efficiency and success rate of programmable hardware. Summary of the invention

[0005] The embodiment of the present application provides a data flow graph segmentation method, apparatus, computing device and storage medium, which can improve the segmentation efficiency and segmentation accuracy of the data flow graph, thereby improving the configuration efficiency and success rate of programmable hardware. The technical solution is as follows.

[0006] In a first aspect, a method for segmenting a data flow graph is provided, the method comprising:

[0007] Dividing a plurality of first subgraphs of the data flow graph into two partitions, each partition including at least one first subgraph, each first subgraph including at least one node, the data flow graph indicating tasks to be performed by the programmable hardware, and the first subgraphs being used to configure a plurality of execution units in the programmable hardware;

[0008] Based on the partition where each node is located, the attributes of each node and the deadlock situation of the first subgraph to which each node belongs, the gain of each node is determined, where the gain indicates the impact on the segmentation result if the node is moved from the partition where the node is located to another partition;

[0009] Based on the gains of each node, the sum of the gains of the moved nodes after each node is moved is predicted to obtain multiple gain sums;

[0010] Based on the partitions where each node corresponding to the minimum gain sum in each gain sum is located, the multiple first subgraphs are divided into multiple second subgraphs, and the second subgraphs are used to configure multiple execution units in the programmable hardware.

[0011] Among them, based on the gain of each node, the sum of the gains of the moved nodes after each node is moved, and obtaining multiple gain sums means: first, based on the gain of each node, predict the sum of the gains of the moved nodes after the node with the largest gain is moved to another partition; then re-determine the gain of each node that has not been moved, and predict the sum of the gains of the moved nodes after the node with the largest gain among the unmoved nodes is moved to another partition, and so on, until the prediction of the sum of the gains after all nodes are moved is completed. For example, the data flow graph includes four nodes a, b, c, and d. The first step is to determine the gains of these four nodes, where the node with the largest gain is node a, and the gain of node a is 30, then the total gain of the moved nodes (node ​​a) is 30; the second step is to determine the gains of each node (node ​​b, c, d) that is not moved after node a is moved to another partition, where the node with the largest gain is node c, and the gain of node c is -10, then the total gain of the moved nodes (nodes a, c) is 20, and so on, until the prediction of the total gain of all nodes after moving is completed.

[0012] Among them, after each partition, after moving each node in turn based on the movement strategy corresponding to the minimum gain sum, each node in the same partition is divided into a second subgraph. For example, nodes a and b are in the left partition, and nodes c and d are in the right partition. The corresponding gain sums after the movement of the four nodes a, c, b, and d are 30, 20, 35, and 25, respectively. The minimum gain sum is 10, and the corresponding moved nodes are a and c. After moving nodes a and c, the left partition includes nodes b and c, and the right partition includes nodes a and d. Then, nodes b and c in the left partition are divided into a second subgraph, and nodes a and d in the right partition are divided into another second subgraph.

[0013] In the above method, since the node to be moved each time is determined based on the gain, and when determining the gain of the node, the distribution of nodes with different attributes in the two partitions and the deadlock situation of the first subgraph are considered, since when a deadlock occurs in the first subgraph, the first subgraph and another first subgraph are interdependent, it is impossible to determine which first subgraph to configure the programmable hardware based on. Therefore, considering the deadlock situation when determining the gain is conducive to moving the nodes in the first subgraph where the deadlock occurs to break the deadlock, thereby ensuring that the node moved each time can balance the distribution of nodes with different attributes in the two partitions or break the deadlock, that is, ensuring that the node moved each time is a node that has a greater impact on the segmentation result, thereby improving the efficiency and success rate of programmable hardware layout and routing.

[0014] Optionally, the method further comprises:

[0015] Based on the number of nodes in the data flow graph, the attributes of each node and the architecture information of the programmable hardware, the number of divisions is determined, the attributes indicate the functions of the nodes, and the architecture information is used to describe the architecture of the programmable hardware; based on the number of divisions, the data flow graph is divided into a first subgraph of the number of divisions.

[0016] In the above method, the number of splits is determined based on the number of nodes in the data flow graph, the attributes of each node and the architectural information of the programmable hardware, which is conducive to ensuring that each subsequent split sub-graph meets the architectural constraints, thereby ensuring the feasibility of the split sub-graphs and improving the configuration success rate of the programmable hardware.

[0017] Optionally, based on the number of shares, dividing the data flow graph into first subgraphs of the number of shares includes any of the following:

[0018] Perform a random traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts, wherein M is a positive integer greater than or equal to 1; perform a layer-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts; perform a pre-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts; perform a reverse pre-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts; perform a quasi-pre-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts.

[0019] In the above method, an effective initialization partitioning method is adopted to partition the data flow graph into a plurality of first subgraphs based on the number of partitions, which can ensure that a feasible solution can be obtained based on the partitioning of the first subgraphs.

[0020] Optionally, determining the gain of each node based on the partition where each node is located, the attribute of each node, and the deadlock condition of the first subgraph to which each node belongs includes:

[0021] The first gain of the node is determined based on the partition where the node is located and the partitions where other nodes on the hyperedge where the node is located are located; based on the attributes of each node, the proportion of nodes with various attributes in the partition where the node is located and another partition is determined respectively, and the second gain of the node is determined based on the proportion of nodes with various attributes in the two partitions; the third gain of the node is determined based on the deadlock situation of the first subgraph to which the node belongs; the first gain, the second gain and the third gain are merged to obtain the gain of the node.

[0022] In the above method, when determining the gain of the node, the distribution of nodes with various attributes in the two partitions and the deadlock situation of the first subgraph are taken into consideration, which can ensure that the node moved each time is the node with a greater impact on the segmentation result, thereby improving the efficiency and success rate of programmable hardware layout and routing.

[0023] Optionally, the two partitions obtained by the first division are used as first-level partitions, and based on the partitions where each node corresponding to the minimum gain sum in each gain sum is located, the multiple first subgraphs are divided into multiple second subgraphs, including:

[0024] Move each node corresponding to the minimum gain sum among each gain sum from the first-level partition to another first-level partition;

[0025] If the number of second subgraphs included in the first-level partition is greater than 1, the step of partitioning the first-level partition at least once is performed, and after the i-th partition, based on the i-level partition in which each node in the i-level partition is located, the attributes of each node, and the deadlock situation of the subgraph to which each node in the i-level partition belongs, the gain of each node in the i-level partition is determined, and based on the gain of each node in the i-level partition, the sum of the gains of the moved nodes in the i-level partition after each movement of a node in the i-level partition to another i-level partition is predicted, and multiple gain sums corresponding to the i-level partition are obtained, and the moved node corresponding to the minimum gain sum among the multiple gain sums corresponding to the i-level partition is moved to another i-level partition to obtain multiple second subgraphs;

[0026] If after the i-th partition, the number of second subgraphs included in the i-th partition is equal to 1, the partitioning process is terminated; if the number of second subgraphs included in the i-th partition is greater than 1, the step of performing the i+1-th partitioning based on the i-th partition is continued;

[0027] Here, i is an integer greater than or equal to 2.

[0028] Optionally, the method further comprises:

[0029] If any second subgraph is not feasible and the number of splits under the split number is less than the preset number, the step of dividing the multiple first subgraphs of the data flow graph into two partitions is executed; if any second subgraph is not feasible and the number of splits under the split number is equal to the preset number, the split number is increased by one, and the step of dividing the data flow graph into the first subgraphs of the split number based on the split number is executed.

[0030] In the above method, if the second subgraph is not feasible, the data flow graph is split again until a feasible second subgraph is split out. The worst splitting situation under this splitting method is that all nodes are split, and one node is a second subgraph, which can ensure the configuration success rate of programmable hardware.

[0031] Optionally, the second subgraph is not feasible including at least one of the following:

[0032] The gain of each node in the second subgraph is greater than or equal to the preset gain; there is a deadlock between the nodes in the second subgraph; there is a deadlock between the second subgraph and any other second subgraph; there is any node in the second subgraph that is not connected to any other node in the second subgraph; the second subgraph is an empty subgraph; the number of nodes in the second subgraph is greater than the number of nodes that can be accommodated by the programmable hardware.

[0033] Optionally, the method further comprises:

[0034] If each second subgraph is feasible, a storage node is added to each second subgraph based on the input and output of each second subgraph, and the storage node is used to load the input of the second subgraph and store the output of the second subgraph.

[0035] Optionally, the method further comprises:

[0036] Merge any two second subgraphs. If the merged graph is feasible, the merged graph is determined as the second subgraph after the data flow graph is updated. If the merged graph is not feasible, the second subgraph of the data flow graph is not updated.

[0037] Among them, determining the merged graph as the second subgraph after the data flow graph is updated means deleting the subgraph before the merge and retaining the merged graph as the second subgraph of the data flow graph; not updating the second subgraph of the data flow graph means retaining the second subgraph before the merge and not retaining the merged graph.

[0038] In the above method, the mergeable second subgraphs are merged to reduce the number of second subgraphs, thereby improving resource utilization while ensuring the success rate of programmable hardware layout and routing, which is beneficial to enhancing the competitiveness of the programmable hardware architecture.

[0039] In a second aspect, a data flow graph segmentation device is provided, the device comprising at least one functional module, and the at least one functional module is used to execute the data flow graph segmentation method provided by the aforementioned first aspect or any possible implementation method of the first aspect.

[0040] In a third aspect, a computing device is provided, the computing device comprising a processor and a memory;

[0041] The processor is used to execute instructions stored in the memory so that the computing device executes the data flow graph segmentation method provided by the aforementioned first aspect or any possible implementation of the first aspect.

[0042] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes a data flow graph segmentation method as provided in the aforementioned first aspect or any possible implementation of the first aspect.

[0043] In a fifth aspect, a computer-readable storage medium is provided, which includes computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes a data flow graph segmentation method provided in the aforementioned first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1It is a schematic diagram of an implementation environment of a data flow graph segmentation method provided in an embodiment of the present application;

[0045] Figure 2 is a schematic diagram of the structure of a programmable hardware provided in an embodiment of the present application;

[0046] Figure 3 It is a flow chart of a data flow graph segmentation method provided in an embodiment of the present application;

[0047] Figure 4 It is a schematic diagram of a process of performing multiple binary divisions on a data flow graph provided in an embodiment of the present application;

[0048] Figure 5 It is a schematic diagram of segmenting a data flow graph provided in an embodiment of the present application;

[0049] Figure 6 It is a flow chart of a method for segmenting a data flow graph provided in an embodiment of the present application;

[0050] Figure 7 is a schematic diagram of dividing a first sub-graph into a plurality of second sub-graphs provided in an embodiment of the present application;

[0051] Figure 8 It is a flow chart of a method for segmenting a data flow graph provided in an embodiment of the present application;

[0052] Fig. 9 is a schematic diagram of a merging process of a second subgraph provided in an embodiment of the present application;

[0053] Fig.10 It is a structural block diagram of a data flow graph segmentation device provided in an embodiment of the present application;

[0054] Fig.11 It is a structural diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0056] In order to facilitate understanding of the technical solution of the present application, several technical terms involved in the embodiments of the present application are introduced below.

[0057] Coarse grained reconfigurable array (CGRA): A chip architecture technology that organizes computing resources of different functions at different granularities through spatial hardware structures, adjusts hardware functions through hardware configuration during operation, and interconnects functionally configured hardware resources to form a relatively fixed computing path according to the characteristics of data flow, thereby performing data-driven computing in a manner close to that of a "dedicated circuit". When algorithms and applications change, the hardware is reconfigured into different computing paths for execution through configuration again.

[0058] The implementation environment of the embodiments of the present application is introduced below.

[0059] Figure 1 Schematic diagram of the implementation environment of a data flow graph segmentation method provided in an embodiment of the present application. Figure 1 As shown, the implementation environment includes a computing device 101 and programmable hardware 102. The programmable hardware 102 may be a built-in hardware structure on the computing device 101, or may be a pluggable hardware structure on the computing device 101, which is not limited in the present embodiment.

[0060] The computing device 101 may be at least one of a smart phone, a smart watch, a desktop computer, a laptop, a virtual reality terminal, an augmented reality terminal, a wireless terminal, and a laptop computer, etc. It may be an independent physical server, or a server cluster composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Exemplarily, the computing device 101 provides a data flow graph segmentation function and a programmable hardware configuration function, and can segment the data flow graph into multiple subgraphs based on the architecture information of the programmable hardware 102, and can also generate configuration instructions of the programmable hardware 102 corresponding to each subgraph based on the segmented multiple subgraphs, and configure multiple execution units in the programmable hardware 102 in sequence based on each configuration instruction, so that the programmable hardware 102 can sequentially execute tasks corresponding to each subgraph.

[0061] The programmable hardware 102 may be any programmable hardware structure such as a field-programmable gate array (FPGA), a systolic array, or a coarse grained reconfigurable array (CGRA). Taking the programmable hardware 102 as a CGRA as an example, Figure 2 is a schematic diagram of a structure of programmable hardware provided in an embodiment of the present application, such as Figure 2 As shown, the programmable hardware 102 includes multiple execution units (process elements, PE), configuration random access memory (config random access memory, CONFIG RAM), coarse grained reconfigurable array random access memory (coarse grained reconfigurable array random access memory, CGRA RAM), load-store unit (load store unit, LSU), configuration channel, load-store channel and interaction channel between execution units. Among them, an execution unit is used to execute the data processing process corresponding to a node in the data flow graph; CONFIG RAM is used to store configuration information of multiple execution units; CGRA RAM is used to store operation data (including input data, intermediate data and output data, etc.); LSU is used to read and write RAM. LSU and execution units support basic direct memory access (DMA). LSU and execution units can read configuration instructions from CONFIG RAM through configuration channels, and then configure multiple execution units based on configuration instructions. In addition, LSU can also read the input data of the subgraph from CGRA RAM through the load-store channel, load the input data to the execution unit, and store some intermediate data generated by the execution unit and the output data of the subgraph in CGRA RAM. Each execution unit exchanges data through the interaction channel between execution units.

[0062] The implementation environment of the embodiment of the present application is introduced above, and the following is an introduction to a method for segmenting a data flow graph provided by the embodiment of the present application. The method is executed by a computing device, in which the computing device first divides the multiple first subgraphs of the data flow graph into two partitions, and then determines the gain of each node based on the partition where each node is located, the balance of the number of nodes of various attributes in the two partitions, and the deadlock situation of the first subgraph to which each node belongs, and then based on the gain of each node, predicts the sum of the gains of the moved nodes after each node is moved, and then based on the partition where each node corresponds to the minimum gain sum, the multiple first subgraphs are segmented into multiple second subgraphs.

[0063] The above introduces the basic process of the embodiment of the present application. The following describes the specific process of the embodiment of the present application in detail. Figure 3 is a flow chart of a data flow graph segmentation method provided in an embodiment of the present application, such as Figure 3 As shown, the method is executed by a computing device, and the method includes the following steps 301 to 308.

[0064] 301. The computing device determines the number of splits based on the number of nodes in the data flow graph, the attributes of each node, and the architecture information of the programmable hardware. The data flow graph indicates the tasks to be performed by the programmable hardware, the attributes indicate the functions of the nodes, and the architecture information is used to describe the architecture of the programmable hardware.

[0065] The data flow graph is used to describe the task to be performed by the programmable hardware, and the task includes multiple data processing processes and at least one data flow composed of multiple data processing processes. Correspondingly, the data flow graph includes at least multiple nodes and at least one hyperedge, wherein each node is used to describe a data processing process in the task, for example, an addition process, and the data processing process is executed by an execution unit in the programmable hardware; the hyperedge is composed of at least one edge starting from the same node, for example, in the data flow graph, the edges starting from node a are ac and ad, then acd form a hyperedge. Each hyperedge corresponds to a data flow in the task, and the tail end and head end of the hyperedge represent the node of the source of the data flow and the node to which the data flow flows, respectively. The attributes of the node include addition nodes (add), subtraction nodes (subtraction), multiplication nodes (multiplication), division nodes (division) and storage nodes (store), among which, addition nodes, subtraction nodes, multiplication nodes and division nodes are used to describe the data processing process in the task, which can be collectively referred to as operation nodes. For example, node a is an addition node, and the data processing process described by the node is to add the outputs of nodes b and c, and input the result of the addition operation into node d; the storage node is used to load the input data of the task read from the RAM, and to store the output data obtained after the task is completed. It can be understood that the storage node is used to indicate the start and end of the task. The architectural information of programmable hardware includes: the number of execution units in the programmable hardware and the number of nodes of each attribute that can be accommodated, among which accommodation refers to the data processing process corresponding to the programmable hardware running node.

[0066] In some embodiments, the architecture information also includes the number of nodes that each execution unit can accommodate after configuration, wherein one execution unit can only execute the data processing process corresponding to one node at a time; however, when there are nodes corresponding to the same data processing process in multiple independent subgraphs, the corresponding execution units can, after configuration, successively execute the data processing processes corresponding to the nodes in multiple subgraphs without waiting for other execution units to complete subsequent data processing tasks or reconfiguring, that is, the execution unit can execute the same data processing process in multiple subgraphs in a pipelined manner. Since different execution units take different amounts of time to execute different data processing processes, the number of nodes that each execution unit can accommodate after configuration refers to the number of nodes that each execution unit can run while ensuring the smooth operation of the pipeline between multiple execution units. For example, after being configured, execution unit a is used to perform addition operations on the outputs of execution unit b and execution unit c, and input the result of the addition operation to execution unit d. If there are addition nodes in two independent subgraphs g1 and g2, and the addition node is used to perform addition operations on the outputs of the two nodes and input the result of the addition operation to another node, then execution unit a can execute the data processing process corresponding to the addition node in subgraph g2 after executing the data processing process corresponding to the addition node in subgraph g1, without waiting for other execution units to complete the tasks corresponding to the entire subgraph g1, and without reconfiguring execution unit a. In the above method, the architecture information includes the number of nodes that each execution unit can accommodate after configuration. Since the situation that there may be no need to reconfigure the execution unit in the future is considered before the data flow graph is divided, it is beneficial to improve the resource utilization of programmable hardware.

[0067] In other embodiments, the architecture information also includes the maximum resource utilization of the programmable hardware, wherein the maximum resource utilization refers to the maximum proportion of the total number of execution units that can be used for calculations in each configuration, excluding the execution units that may be used to load or store data in subsequent configurations. In the above method, the architecture information includes the maximum resource utilization of the programmable hardware. Since the situation that a part of the execution units may be used to load or store data in the subsequent execution process is taken into account before the data flow graph is split, these execution units can be vacated in advance, thereby avoiding the situation that when the total number of execution units is used as a constraint for splitting, the number of execution units actually corresponding to the split subgraph is greater than the total number of execution units in the programmable hardware, thereby ensuring resource utilization while improving the success rate of programmable hardware layout and routing.

[0068] It should be noted that the above description of the architecture information is only exemplary, and the architecture information can be determined according to the architecture of the programmable hardware actually selected, and the embodiments of the present application do not limit this.

[0069] Among them, the computing device uses the various contents in the architecture information of the programmable hardware as constraints to determine the number of splits that can simultaneously meet the various constraints. For example, the total number of nodes in the data flow graph is 20, of which the number of division nodes is 6 and the number of storage nodes is 4. The first constraint is: the number of execution units in the programmable hardware is 10, the second constraint is: the number of division nodes that the programmable hardware can accommodate is 3, and the third constraint is: the number of storage nodes that the programmable hardware can accommodate is 2. The number of splits determined based on the first constraint is greater than or equal to 2; the number of splits determined based on the second constraint is greater than or equal to 3; the number of splits determined based on the third constraint is greater than or equal to 2. Combining the above three constraints, the number of splits finally determined is greater than or equal to 3. In the above method, the number of splits finally determined by the computing device can meet the various constraints, thereby ensuring that the subgraphs subsequently split can meet the architecture constraints and improve the configuration success rate of the programmable hardware. In some embodiments, the number of shares finally determined by the computing device can satisfy various constraints and equally divide the nodes in the data flow graph, which is conducive to balancing the number of nodes in each first subgraph, and then to ensuring the balance of the number of nodes in each subsequent subgraph, thereby avoiding the problem of uneven resource utilization of programmable hardware during each configuration. In some embodiments, the computing device uses the minimum number of shares that satisfies various constraints as the final number of shares to improve the resource utilization of programmable hardware.

[0070] It should be noted that, in some embodiments, the computing device first determines whether the data flow graph satisfies the architectural constraints based on the number of nodes in the data flow graph, the attributes of each node, and the architectural information of the programmable hardware. If the data flow graph already satisfies the architectural constraints, the splitting task is terminated directly; otherwise, step 301 and its subsequent steps are executed.

[0071] It should be noted that the above step 301 is an optional step. In some embodiments, the number of cuts is determined based on other methods, which is not limited in the embodiments of the present application.

[0072] 302. The computing device divides the data flow graph into first subgraphs of the number of divisions based on the number of divisions, each first subgraph including at least one node, and the first subgraph is used to configure multiple execution units in the programmable hardware.

[0073] Among them, the computing device traverses each node in the data flow graph, and each time it traverses M nodes, it divides the M nodes into a first subgraph to obtain multiple first subgraphs whose number is equal to the number of splits, where M is an integer greater than or equal to 1. The process includes any of the following methods.

[0074] The first method is to randomly traverse each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed to obtain the first subgraph with the same number of cuts. In the above method, each node is traversed by random traversal to randomly initialize each first subgraph, which can increase the exploratory nature of the first subgraph division.

[0075] The second method: perform a layer-order traversal on each node in the data flow graph. Every time M nodes are traversed, the M nodes are divided into a first subgraph to obtain the first subgraph of the number of cuts. Among them, layer-order traversal refers to traversing each root node in the data flow graph from left to right, then traversing each second-level subnode, third-level subnode, and so on. It can be understood as traversing each node in the data flow graph from left to right layer by layer. Layer-order traversal can also be called breadth traversal. In the above method, each node is traversed by layer-order traversal to initialize each first subgraph. Since the time consumed by the layer-order traversal is relatively short, that is, the time complexity of the layer-order traversal is relatively low, it is beneficial to improve the efficiency of data flow graph segmentation.

[0076] The third method: perform a pre-order traversal on each node in the data flow graph. Every time M nodes are traversed, the M nodes are divided into a first subgraph to obtain the first subgraph of the number of cuts. Among them, the pre-order traversal refers to first visiting a root node in the data flow graph, then traversing each node on the left branch of the root node, and finally traversing each node on the right branch of the root node. After traversing the nodes on the branch corresponding to a root node, the next root node and the nodes on its corresponding branch are traversed in the same way. The pre-order traversal can also be called a deep traversal. In the above method, each node is traversed by a pre-order traversal to initialize each first subgraph. Since the pre-order traversal first traverses one branch and then traverses the next branch, it can make the traversed multiple nodes have a connection relationship, so as to reduce the situation of single nodes in the first subgraph, which is conducive to improving the rationality of the initialization of the first subgraph, and then it is conducive to the subsequent cutting of a reasonable second subgraph based on the first subgraph.

[0077] The fourth method: perform a reverse pre-order traversal on each node in the data flow graph, and each time M nodes are traversed, the M nodes are divided into a first subgraph to obtain the first subgraph of the number of cuts. Among them, the reverse pre-order traversal is the same as the pre-order traversal, the difference is that the order between layers is from right to left during traversal, that is, the reverse pre-order traversal first traverses each node on the right branch of the root node, and then traverses the nodes on the left branch of the root node; the similarities between the reverse pre-order traversal and the pre-order traversal are not repeated. In the above method, each node is traversed by reverse pre-order traversal to initialize each first subgraph. Since the reverse pre-order traversal first traverses one branch and then traverses the next branch, it can make the traversed multiple nodes have a connection relationship, so as to reduce the situation of single nodes in the first subgraph, which is conducive to improving the rationality of the initialization of the first subgraph, and then facilitating the subsequent division of a reasonable second subgraph based on the first subgraph.

[0078] The fifth method: perform a pre-order traversal on each node in the data flow graph. Every time M nodes are traversed, the M nodes are divided into a first subgraph to obtain the first subgraph with the same number of divisions. The pre-order traversal is the same as the pre-order traversal. The difference is that every time a node is traversed, the pre-order traversal will determine whether the node has other parent nodes. If the node has other parent nodes, the parent node will be the next node to be traversed, and the parent node will be added to a last-in-first-out stack, which is conducive to dividing adjacent nodes into the same subgraph, thereby avoiding over-fragmentation of the first subgraph. The similarities between the pre-order traversal and the pre-order traversal are not repeated here. In the above method, each node is traversed in a manner similar to a pre-order traversal to initialize each second subgraph. Since the pre-order traversal takes into account that the nodes on the branch may have other parent nodes that do not belong to the branch, and each time a node is traversed, the parent nodes of the node on other branches are traversed immediately afterwards, it is beneficial to divide adjacent nodes into the same first subgraph, thereby avoiding excessive segmentation of the first subgraph.

[0079] It should be noted that the above description of the traversal method is only exemplary, and different traversal methods can be selected according to actual needs, and the embodiments of the present application do not limit this.

[0080] It should be noted that the above step 302 is described by taking the example that the number of nodes in each first subgraph is the same. In some embodiments, the nodes in the data flow graph cannot be equally divided based on the final number of splits. At this time, it should be ensured that the difference in the number of nodes in different first subgraphs is less than a preset value, that is, the difference in the number of nodes in different first subgraphs cannot be too large, so as to balance the number of nodes in each first subgraph. The embodiment of the present application does not limit the number of nodes in each first subgraph.

[0081] 303. The computing device divides the multiple first subgraphs into two partitions, each partition including at least one first subgraph.

[0082] Among them, the computing device determines a segmentation ratio based on the number of segments, and based on the segmentation ratio, divides multiple first sub-graphs into two partitions, each partition including at least one first sub-graph, wherein the segmentation ratio indicates the ratio of the number of first sub-graphs included in the two partitions. For example, when the number of segments is 8, the multiple first sub-graphs can be divided into two partitions based on a segmentation ratio of 3:5 or 2:6. It should be noted that the above examples of segmentation ratios are only exemplary, and the segmentation ratios can be determined according to actual needs, or the partitions can be divided according to random ratios. The embodiments of the present application do not limit this.

[0083] 304. The computing device determines the gain of each node based on the partition where each node is located, the attributes of each node, and the deadlock status of the first subgraph to which each node belongs. The gain indicates the impact on the segmentation result if the node is moved from the partition where the node is located to another partition.

[0084] Among them, the gain of a node is related to three factors: the partition where the node is located, the attributes of the node, and the deadlock situation of the first subgraph to which the node belongs. For the first factor (the partition where the node is located), if the node is in the z1 partition, and the other nodes on the hyperedge where the node is located are all in the z2 partition, it means that if the node is moved from the z1 partition to the z2 partition, then all the nodes on the hyperedge where the node is located are in the same partition, which can reduce the number of hyperedges that are cut, thereby reducing the communication cost between the cut subgraphs; for the second factor (the attributes of the node), if the number of nodes of various attributes included in the two partitions is unbalanced, it may lead to an unbalanced number of nodes of various attributes between the subsequently cut subgraphs. Since the number of nodes of each attribute that programmable hardware can accommodate is fixed, the uneven distribution of nodes of various attributes between subgraphs may make it difficult to successfully configure programmable hardware based on certain subgraphs. Programming hardware, thereby affecting the success rate of programmable hardware layout and routing. By moving nodes with unevenly distributed attributes, the number of nodes with various attributes in the two partitions can be balanced; for the third factor (deadlock situation of the first subgraph to which the node belongs), if the first subgraph has a deadlock situation, it means that the first subgraph is interdependent with other first subgraphs. In this case, it is impossible to determine which first subgraph to configure the programmable hardware based on first, that is, the subsequent scheduling tasks are difficult to complete. For example, the first subgraph g1 includes nodes a and b, the first subgraph g2 includes nodes c and d, and the connection relationship between nodes a, b, c and d forms a loop abcda. At this time, the input of g1 is the output of node d in g2, and the input of g2 is the output of node b in g1. A deadlock situation occurs between g1 and g2. g1 and g2 are interdependent, and it is impossible to determine which first subgraph to configure the programmable hardware based on first. If some nodes in the first subgraph with a deadlock situation are moved to split the first subgraph, it is helpful to break the deadlock. Combining the above three factors, the gain of a node can indicate the impact on the partitioning result if the node is moved from the partition where the node is located to another partition.

[0085] Based on the above three factors related to gain, taking the target node as an example, the process of the computing device determining the gain of the node includes the following steps 1 to 4.

[0086] Step 1: Determine a first gain of the target node based on the partition where the target node is located and the partitions where other nodes on the hyperedge where the node is located are located.

[0087] Among them, the initial value of the first gain of the target node is 0, and the computing device traverses the hyperedge where the target node is located. For any traversed hyperedge, if there is only a target node in one partition on the hyperedge, and other nodes on the hyperedge are in another partition, then the computing device adds one to the first gain of the target node. If all nodes on the hyperedge are in the same partition, then the computing device reduces the first gain of the target node by one. After the traversal is completed, the final first gain of the target node is obtained. It should be noted that the above description of the initial value of the first gain is only exemplary, and the initial value of the first gain can be set according to actual needs. The embodiment of the present application does not limit this.

[0088] Step 2: Based on the attributes of each node, determine the proportion of nodes with various attributes in the partition where the target node is located and another partition respectively, and determine the second gain of the target node based on the proportion of nodes with various attributes in the two partitions.

[0089] The computing device determines the difference between the proportion of nodes of various attributes in the partition where the target node is located and the proportion of nodes of various attributes in another partition, and determines the difference as the second gain of the target node.

[0090] Step 3: Determine a third gain of the target node based on the deadlock condition of the first subgraph to which the target node belongs.

[0091] Among them, if the first subgraph to which the target node belongs is deadlocked, the computing device determines the third gain of the target node as the gain threshold, and the gain threshold is a preset fixed value, otherwise, the third gain is determined to be 0. In some embodiments, the gain threshold is a value much larger than the first gain and the second gain to ensure that when the first subgraph to which the target node belongs is deadlocked, the target node can be moved first to break the deadlock. The embodiment of the present application does not limit the size of the gain threshold.

[0092] Step 4: Fuse the first gain, the second gain, and the third gain to obtain the gain of the target node.

[0093] The computing device adds the first gain, the second gain, and the third gain to obtain the gain of the target node. In some embodiments, the computing device performs weighted summation of the first gain, the second gain, and the third gain based on preset weights of the first gain, the second gain, and the third gain to obtain the gain of the target node. The embodiment of the present application does not limit the fusion method.

[0094] The above steps 1 to 4 can be expressed by the following formula (1).

[0095] gain(j)=FS(j)-TE(j)+Ba_op(j)+Ba_%(j)+Ba_ls(j)+DL(j) (1)

[0096] Wherein, j represents the target node, gain(j) represents the gain of the target node; FS(j)-TE(j) represents the first gain of the target node. When there is only a target node in one partition on the hyperedge where the target node is located, and the other nodes on the hyperedge are in another partition, then FS(j)+=1, otherwise, TE(j)+=1; Ba_op(j) represents the difference in the number of nodes between the partition where the target node is located and the other partition; Ba_%(j) represents the difference between the proportion of division nodes in the partition where the target node is located and the proportion of division nodes in the other partition; Ba_ls(j) represents the difference between the proportion of storage nodes in the partition where the target node is located and the proportion of division nodes in the other partition; DL(j) represents the gain threshold.

[0097] It should be noted that the execution order of the above steps 1 to 3 is only exemplary, and the embodiments of the present application do not limit the execution order of the above steps 1 to 3.

[0098] In the above method, when determining the gain of a node, not only the partition where the node is located is taken into consideration, but also the balance of nodes with different attributes in the two partitions and the deadlock situation of the first subgraph to which the node belongs are taken into consideration. This can ensure the effectiveness of subsequent gain-based node movement, which is conducive to improving the partitioning efficiency and success rate.

[0099] 305. The computing device predicts the sum of gains of moved nodes after each node is moved based on the gains of each node, and obtains multiple gain sums.

[0100] Wherein, the computing device predicts the sum of gains of the moved nodes after the node with the largest gain is moved to another partition based on the gains of each node; the computing device re-determines the gains of each node that has not been moved, and predicts the sum of gains of the moved nodes after the node with the largest gain among the unmoved nodes is moved to another partition, and so on, until the prediction of the sum of gains after all nodes are moved is completed. For example, the data flow graph includes four nodes a, b, c, and d. In the first step, the gains of these four nodes are determined first, where the node with the largest gain is node a, and the gain of node a is 30, then the sum of gains of the moved nodes (node ​​a) is 30; in the second step, the gains of each node (node ​​b, c, d) that has not been moved after node a is moved to another partition are determined, where the node with the largest gain is node c, and the gain of node c is -10, then the sum of gains of the moved nodes (nodes a, c) is 20, and so on, until the prediction of the sum of gains after all nodes are moved is completed.

[0101] In some embodiments, if there are multiple nodes with the largest gains, the computing device determines the node to be moved based on the movement constraint, wherein the movement constraint refers to ensuring that the deviation between the ratio of the number of nodes in the two partitions after moving the node and the corresponding split ratio of the two partitions is within a preset range, thereby avoiding a large difference between the ratio of the number of nodes in the two partitions and the split ratio after the node is moved, which is beneficial to balancing the resource utilization of the programmable hardware after each configuration.

[0102] 306. The computing device uses the two partitions obtained by the first division as first-level partitions, and moves each node corresponding to the minimum gain sum among the gain sums from the first-level partition to another first-level partition.

[0103] 307. If the number of second subgraphs included in the first-level partition is greater than 1, the computing device performs the step of partitioning the first-level partition at least once. After the i-th partition, based on the i-level partition in which each node in the i-level partition is located, the attributes of each node and the deadlock situation of the subgraph to which each node in the i-level partition belongs, the gain of each node in the i-level partition is determined. Based on the gain of each node in the i-level partition, the sum of the gains of the moved nodes in the i-level partition after each movement of a node in the i-level partition to another i-level partition is predicted to obtain multiple gain sums corresponding to the i-level partition, and the moved node corresponding to the minimum gain sum among the multiple gain sums corresponding to the i-level partition is moved to another i-level partition to obtain multiple second subgraphs, wherein i is an integer greater than or equal to 2, and the second subgraph is used to configure multiple execution units in programmable hardware.

[0104] Among them, if the number of second subgraphs included in the first-level partition is greater than 1, it means that after moving the node corresponding to the minimum gain sum in the first-level partition, the computing device needs to perform at least one partitioning step on the first-level partition to divide the nodes in the first-level partition into multiple second subgraphs. For example, the number of partitions of the data flow graph is 8. If the left and right first-level partitions are divided according to the partition ratio of 2:6, it means that the left first-level partition eventually needs to be divided into 2 second subgraphs, and the right first-level partition eventually needs to be divided into 6 second subgraphs. Therefore, it is necessary to perform at least one partitioning step on the left and right first-level partitions respectively to divide 2 second subgraphs from the left first-level partition and 6 second subgraphs from the right first-level partition.

[0105] The process of determining the node gain, the predicted gain sum, and the moved node corresponding to the minimum moving gain sum after each division is the same as the above steps 304 to 306 and will not be repeated here.

[0106] Among them, after the i-th partition, after the computing device moves each node in turn based on the movement strategy corresponding to the minimum gain sum, the nodes in the same i-th level partition are divided into a second subgraph. For example, nodes a and b are in the i-th level partition on the left, and nodes c and d are in the i-th level partition on the right. The corresponding gain sums after the movement of the four nodes a, c, b, and d are 30, 20, 35, and 25, respectively. The minimum gain sum is 20, and the corresponding moved nodes are a and c. After moving nodes a and c, the i-th level partition on the left includes nodes b and c, and the i-th level partition on the right includes nodes a and d. Then, nodes b and c in the i-th level partition on the left are divided into a second subgraph, and nodes a and d in the i-th level partition on the right are divided into another second subgraph.

[0107] 308. If after the i-th partition, the number of second subgraphs included in the i-th level partition is equal to 1, then the partitioning process is terminated; if the number of second subgraphs included in the i-th level partition is greater than 1, then the step of performing the i+1-th partitioning based on the i-th level partition is continued.

[0108] Below through Figure 4 and Figure 5 The process shown in the above steps 306 to 308 is described by way of example. Figure 4 is a schematic diagram of a process of performing multiple binary divisions on a data flow graph provided in an embodiment of the present application. Figure 5 Schematic diagram of dividing a data flow graph provided in an embodiment of the present application. Figure 5As shown, the data flow graph needs to be divided into 8 second subgraphs. The first partitioning step is performed at a ratio of 2:6 to obtain two first-level partitions on the left and right. The nodes in the first-level partitions are moved based on the minimum gain sum. Since the number of second subgraphs included in the first-level partition on the right is 6, which is greater than 1, the second partitioning step is performed on the first-level partition on the right at a ratio of 2:4 to obtain two upper and lower second-level partitions. Based on the minimum gain sum corresponding to the second-level partition, the nodes in the second-level partition are moved. Since the number of second subgraphs included in the upper second-level partition is 2, which is greater than 1, the third partitioning operation is performed on the upper second-level partition at a ratio of 1:1 to obtain two upper and lower third-level partitions. Based on the minimum gain sum, the nodes in the third-level partition are moved. Since the number of second subgraphs included in the third-level partition is equal to 1, the partitioning process of the third-level partition is terminated, and the nodes in the upper third-level partition are divided into a second subgraph, and the nodes in the lower third-level partition are divided into another second subgraph. The above steps are performed on each partition obtained after each partitioning, until the number of second sub-graphs included in each partition is equal to 1, and finally 8 second sub-graphs are obtained. Among them, the ratio adopted for each partitioning refers to the ratio of the number of second sub-graphs included in the two partitions. It should be noted that in the above partitioning process, the description of the ratio adopted for each partitioning is only exemplary, and the ratio adopted for each partitioning can be set according to actual needs, and the embodiment of the present application does not limit this.

[0109] It should be noted that the above steps 306 to 308 are an implementation method of dividing multiple first subgraphs into multiple second subgraphs based on the partitions where each node corresponding to the minimum gain sum in each gain sum is located. In some embodiments, the process is also implemented based on other steps, which is not limited to the embodiments of the present application.

[0110] It should be noted that the above steps 305 and 308 are described by taking the example that the computing device predicts the sum of gains of the moved nodes and divides multiple first subgraphs into multiple second subgraphs based on the minimum sum of gains. In some embodiments, the computing device predicts the number of hyperedges to be cut each time a node is moved based on the gains of each node, and obtains multiple hyperedge numbers; the computing device divides the multiple first subgraphs into multiple second subgraphs based on the partitions where each node corresponds to the minimum number of hyperedges in each number of hyperedges. The embodiments of the present application do not limit this.

[0111] In some embodiments, after splitting the second subgraph, the computing device also performs a feasibility check on the second subgraph. If the second subgraph is feasible, the computing device adds a storage node to the second subgraph; if the second subgraph is not feasible, the computing device re-splits the data flow graph. The process includes the following steps one and two.

[0112] Step 1: If each second subgraph is feasible, the computing device adds a storage node in each second subgraph based on the input and output of each second subgraph, and the storage node is used to load the input of the second subgraph and store the output of the second subgraph.

[0113] Among them, taking any second subgraph as an example, the feasibility of the second subgraph includes: the gain of each node in the second subgraph is less than the preset gain; there is no deadlock between the second subgraph and any other second subgraph; any node in the second subgraph is connected to other nodes in the second subgraph; the second subgraph is not an empty subgraph. It should be noted that the above description of the feasibility of the second subgraph is only exemplary, and the judgment conditions of feasibility can be set according to actual needs, and the embodiments of the present application do not limit this.

[0114] The computing device adds the input and output nodes of the split hyperedge that are divided into another second subgraph as storage nodes in the second subgraph. For example, Figure 6 is a schematic diagram of dividing a first sub-graph into a plurality of second sub-graphs provided in an embodiment of the present application, such as Figure 6 As shown, Figure 6 After the first subgraph in the figure is cut along the solid line, the computing device will store the outputs of the node2_sub0, node7_load2, and node0_add0 nodes, add three storage nodes in the second subgraph above to store the outputs of the node2_sub0, node7_load2, and node_add0 nodes, and add three storage nodes in the second subgraph below to load the outputs of the node2_sub0, node7_load2, and node_add0 nodes as the input of the second subgraph below.

[0115] Among them, after the computing device adds storage nodes in each second subgraph, it determines whether the total number of nodes in the second subgraph meets the architectural constraints of the programmable hardware. If not, the number of splits is increased by one, and the data flow graph is re-split based on the newly determined number of splits.

[0116] Step 2: If any second subgraph is not feasible and the number of splits under the split number is less than the preset number, the computing device executes the step of dividing the multiple first subgraphs of the data flow graph into two partitions; if any second subgraph is not feasible and the number of splits under the split number is equal to the preset number, the computing device increases the split number by one and executes the step of dividing the data flow graph into the first subgraphs of the split number based on the split number.

[0117] Among them, taking any second subgraph as an example, the second subgraph is not feasible including any of the following items: the gain of each node in the second subgraph is greater than or equal to the preset gain; there is a deadlock between the second subgraph and any other second subgraph; there is any node in the second subgraph that is not connected to any other node in the second subgraph; the second subgraph is an empty subgraph. It should be noted that the above description of the second subgraph being not feasible is only exemplary, and the feasibility judgment condition can be set according to actual needs, and the embodiments of the present application do not limit this.

[0118] Among them, the preset number of times is set according to actual needs, for example, it is set to 3 times, so as to avoid directly increasing the number of cuts and causing the performance of the computing device to decrease. The embodiment of the present application does not limit the size of the preset number of times. When any second sub-graph is not feasible and the number of cuts under the number of cuts is less than the preset number, the computing device can use the same cutting ratio as the last cutting to re-divide the multiple first sub-graphs into two partitions, or use a different cutting ratio from the last cutting to re-divide the multiple first sub-graphs into two partitions. The embodiment of the present application does not limit this.

[0119] In the above method, the feasibility of the second subgraph is judged. If the second subgraph is feasible, a load / storage node is added to the second subgraph to prepare for the subsequent configuration of the programmable hardware. If the second subgraph is not feasible, the data flow graph is split again until a feasible second subgraph is split. The worst splitting situation under this splitting method is that all nodes are split, and one node is a second subgraph, which can ensure the configuration success rate of the programmable hardware.

[0120] It should be noted that the above steps 1 and 2 are optional steps. In some embodiments, the above steps 1 and 2 are not performed, and the embodiments of the present application do not limit this.

[0121] In some embodiments, after segmenting out a feasible second subgraph, in order to improve resource utilization, the computing device will also merge the second subgraphs that can be merged, and the process includes: merging any two second subgraphs, and if the merged graph is feasible, determining the merged graph as the updated second subgraph of the data flow graph, and if the merged graph is not feasible, not updating the second subgraph of the data flow graph. Determining the merged graph as the updated second subgraph of the data flow graph means deleting the subgraph before merging, and retaining the merged graph as the second subgraph of the data flow graph; not updating the second subgraph of the data flow graph means retaining the second subgraph before merging, and not retaining the merged graph.

[0122] After the computing device completes the segmentation of the data flow graph, it generates configuration instructions for the programmable hardware corresponding to the second subgraphs based on the segmented second subgraphs, and executes the configuration instructions respectively based on the scheduling order of the second subgraphs to complete the layout and routing of the programmable hardware.

[0123] Below through Figures 7 to 9 The process shown in the above steps 301 to 308 is described with an example. Figure 7 is a flow chart of a data flow graph segmentation method provided in an embodiment of the present application, such as Figure 7 As shown, the node information, architecture information and algorithm hyperparameters (preset times) are input into the computing device, wherein the architecture information includes the number of execution units, the number of division nodes that can be accommodated, and the number of load-store units. The computing device parses the input information. If the data flow graph satisfies the constraints of the architecture information, the data flow graph is directly used as the final segmentation strategy, that is, the data flow graph is not segmented, and the segmentation task is directly terminated, wherein the segmentation strategy refers to which hyperedge is segmented and which nodes are segmented into the same subgraph, and one segmentation strategy corresponds to one subgraph. If the data flow graph does not meet the constraints of the architecture information, the computer device determines the number of segments according to the node information included in the data flow graph, segments the data flow graph based on the number of segments, obtains a complete segmentation strategy, and then merges the segmentation strategies that can be merged, that is, post-processing merged subgraphs to obtain all segmentation strategies (including the original segmentation strategy and the merged segmentation strategy).

[0124] Above Figure 7 In the process of segmenting the data flow graph, Figure 8 As shown, Figure 8 is a flow chart of a data flow graph segmentation method provided in an embodiment of the present application, such as Figure 8As shown, the computing device determines the number of shares to be split, and when the number of shares to be split is less than the number of nodes, the split ratio is randomly initialized and the preset number of times is set; if the number of splits under the current number of shares to be split is greater than the preset number of times, the number of shares to be split is increased by one, and the two partitions are reinitialized; if the number of splits under the current number of shares to be split is less than the preset number of times, the two partitions are initialized based on the split ratio; the computing device determines the gain of each node, and based on the gain, predicts the sum of the gains of the moved nodes after each movement of a node, obtains multiple gain sums, and divides multiple first subgraphs into multiple second subgraphs based on the partitions where each node corresponding to the minimum gain sum in each gain sum is located; the computing device adds storage nodes to the second subgraph when each second subgraph is feasible, and if the second subgraph after the addition of the node meets the architectural constraints, the splitting ends; otherwise, the number of shares to be split is increased by one, and the data flow graph is split based on the re-determined number of shares to be split.

[0125] Above Fig. 9 In the post-processing process of merging subgraphs, Fig.10 As shown, Fig.10 is a schematic diagram of a second sub-graph merging process provided in an embodiment of the present application, such as Fig.10 As shown, all the split strategies are merged in pairs to determine whether the merged split strategies meet the utilization constraint, connectivity constraint and deadlock-free constraint. If they do, the split strategies are updated until all the split strategies do not meet the utilization constraint, connectivity constraint and deadlock-free constraint after being merged in pairs, and the merging task is terminated. Among them, the utilization constraint means that the total number of nodes in the merged graph is less than or equal to the maximum number of nodes that the programmable hardware can accommodate, the connectivity constraint means that there are no nodes in the merged graph that are completely unconnected to other nodes; the deadlock-free constraint means that there is no deadlock between the nodes in the merged graph and between the merged graph and the other second subgraph.

[0126] In the above method, an effective initialization partitioning method is adopted to partition the data flow graph into multiple first subgraphs based on the number of partitions, which can ensure that the partitioning based on the first subgraph can obtain a reasonable solution; the data flow graph is partitioned by multiple binary divisions to improve the partitioning efficiency, thereby improving the configuration efficiency of the programmable hardware; in addition, since the node to be moved each time is determined based on the gain, and when determining the gain of the node, the distribution of nodes with different attributes in the two partitions and the deadlock of the first subgraph are considered, since when a deadlock occurs in the first subgraph, the first subgraph is interdependent with another first subgraph, and it is impossible to determine which first subgraph to configure the programmable hardware based on, therefore, considering the deadlock when determining the gain is beneficial to the first subgraph where the deadlock occurs. The nodes in the partition are moved to break the deadlock, thereby ensuring that each moved node can balance the distribution of nodes with different attributes in the two partitions or break the deadlock, that is, ensuring that each moved node has a greater impact on the partitioning result, thereby improving the efficiency and success rate of programmable hardware layout and routing; and, after the second subgraph is partitioned, the storage nodes added by the partition are dynamically taken into account, which can improve the success rate of programmable hardware layout and routing; further, on the basis of considering architectural constraints, connectivity and deadlock, the mergeable subgraphs are merged to reduce the number of subgraphs, thereby improving resource utilization on the basis of ensuring the success rate of programmable hardware layout and routing, which is conducive to enhancing the competitiveness of the programmable hardware architecture.

[0127] The verification results show that: in the three data flow graphs with 102, 264 and 384 nodes respectively, the above method can be used to complete the segmentation and the layout and routing are all successful. In addition, the data flow graph with 384 nodes can be segmented within 25 minutes (the integer linear programming method times out and has no solution in this scenario), the data flow graph with 264 nodes can be segmented within 8 minutes, and the data flow graph with 102 nodes can be segmented within a few seconds, achieving fast and 100% success rate data flow graph segmentation, thereby improving the efficiency and success rate of programmable hardware layout and routing, and achieving the goal.

[0128] Fig.10 It is a structural block diagram of a data flow graph segmentation device provided in an embodiment of the present application, and the device includes a partition division module 1001, a gain determination module 1002, a gain sum prediction module 1003 and a first sub-graph segmentation module 1004.

[0129] A partition division module 1001 is used to divide a plurality of first subgraphs of a data flow graph into two partitions, each partition includes at least one first subgraph, each first subgraph includes at least one node, the data flow graph indicates tasks to be performed by the programmable hardware, and the first subgraph is used to configure a plurality of execution units in the programmable hardware;

[0130] A gain determination module 1002 is used to determine the gain of each node based on the partition where each node is located, the attributes of each node and the deadlock situation of the first subgraph to which each node belongs, where the gain indicates the impact on the segmentation result if the node is moved from the partition where the node is located to another partition;

[0131] A gain sum prediction module 1003 is used to predict the gain sum of the moved nodes after each node is moved based on the gain of each node, and obtain multiple gain sums;

[0132] The first subgraph segmentation module 1004 is used to segment the multiple first subgraphs into multiple second subgraphs based on the partitions where the nodes corresponding to the minimum gain sums in the gain sums are located. The second subgraphs are used to configure multiple execution units in the programmable hardware.

[0133] Optionally, the device further comprises:

[0134] A split number determination module, used to determine the split number based on the number of nodes in the data flow graph, the attributes of each node and the architecture information of the programmable hardware, where the attributes indicate the function of the node and the architecture information is used to describe the architecture of the programmable hardware;

[0135] The data flow graph segmentation module is used to segment the data flow graph into the first subgraph of the segmentation number based on the segmentation number.

[0136] Optionally, the data flow graph segmentation module is used for any of the following:

[0137] Perform a random traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts, wherein M is a positive integer greater than or equal to 1; perform a layer-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts; perform a pre-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts; perform a reverse pre-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts; perform a quasi-pre-order traversal on each node in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain a first subgraph with the number of cuts.

[0138] Optionally, the gain determination module 1002 is used to:

[0139] The first gain of the node is determined based on the partition where the node is located and the partitions where other nodes on the hyperedge where the node is located are located; based on the attributes of each node, the proportion of nodes with various attributes in the partition where the node is located and another partition is determined respectively, and the second gain of the node is determined based on the proportion of nodes with various attributes in the two partitions; the third gain of the node is determined based on the deadlock situation of the first subgraph to which the node belongs; the first gain, the second gain and the third gain are merged to obtain the gain of the node.

[0140] Optionally, the partition division module 1001 is further used to execute the step of dividing the plurality of first subgraphs of the data flow graph into two partitions if any second subgraph is not feasible and the number of divisions under the number of divisions is less than a preset number;

[0141] The data flow graph segmentation module is also used to increase the number of segments by one if any second sub-graph is not feasible and the number of segmentation times under the number of segments is equal to a preset number, and execute the step of segmenting the data flow graph into the first sub-graph of the number of segments based on the number of segments.

[0142] Optionally, the two partitions obtained by the first division are used as first-level partitions, and the first subgraph segmentation module 1004 is used to:

[0143] Move each node corresponding to the minimum gain sum among each gain sum from the first-level partition to another first-level partition;

[0144] If the number of second subgraphs included in the first-level partition is greater than 1, the step of partitioning the first-level partition at least once is performed, and after the i-th partition, based on the i-level partition in which each node in the i-level partition is located, the attributes of each node, and the deadlock situation of the subgraph to which each node in the i-level partition belongs, the gain of each node in the i-level partition is determined, and based on the gain of each node in the i-level partition, the sum of the gains of the moved nodes in the i-level partition after each movement of a node in the i-level partition to another i-level partition is predicted, and multiple gain sums corresponding to the i-level partition are obtained, and the moved node corresponding to the minimum gain sum among the multiple gain sums corresponding to the i-level partition is moved to another i-level partition to obtain multiple second subgraphs;

[0145] If after the i-th partition, the number of second subgraphs included in the i-th partition is equal to 1, the partitioning process is terminated; if the number of second subgraphs included in the i-th partition is greater than 1, the step of performing the i+1-th partitioning based on the i-th partition is continued;

[0146] Here, i is an integer greater than or equal to 2.

[0147] Optionally, the second subgraph is not feasible including any of the following:

[0148] The gain of each node in the second subgraph is greater than or equal to the preset gain; there is a deadlock between the second subgraph and any other second subgraph; there is any node in the second subgraph that is not connected to any other node in the second subgraph; the second subgraph is an empty subgraph; the number of nodes in the second subgraph is greater than the number of nodes that can be accommodated by the programmable hardware.

[0149] Optionally, the device further comprises:

[0150] The node adding module is used to add a storage node in each second subgraph based on the input and output of each second subgraph if each second subgraph is feasible, and the storage node is used to load the input of the second subgraph and store the output of the second subgraph.

[0151] Optionally, the device further comprises:

[0152] A second subgraph merging module, used for merging two second subgraphs if the input and output of any two second subgraphs are consistent;

[0153] The second subgraph updating module is used to determine the merged graph as the updated second subgraph of the data flow graph if the merged graph is feasible, and not update the second subgraph of the data flow graph if the merged graph is not feasible.

[0154] Among them, the partition division module 1001, the gain determination module 1002, the gain sum prediction module 1003 and the first sub-graph segmentation module 1004 can all be implemented by software, or can be implemented by hardware. Exemplarily, the partition division module 1001 is taken as an example to introduce the implementation of the partition division module 1001. Similarly, the implementation of the gain determination module 1002, the gain sum prediction module 1003 and the first sub-graph segmentation module 1004 can refer to the implementation of the partition division module 1001.

[0155] As an example of a software functional unit, the partitioning module 1001 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the partitioning module 1001 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with similar geographical locations. Among them, usually a region may include multiple AZs.

[0156] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.

[0157] As an example of a hardware functional unit, the partition division module 1001 may include at least one computing device, such as a server, etc. Alternatively, the partition division module 1001 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.

[0158] The multiple computing devices included in the partitioning module 1001 can be distributed in the same region or in different regions. The multiple computing devices included in the partitioning module 1001 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the gain determination module 1002, the gain sum prediction module 1003 and the first subgraph segmentation module 1004 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs and GALs.

[0159] It should be noted that, in other embodiments, the steps that the above modules are responsible for implementing can be specified as needed, and the above modules respectively implement different steps in the data flow graph segmentation method to realize all the functions of the above device. That is, the data flow graph segmentation device provided in the above embodiment only uses the division of the above functional modules as an example when implementing the data flow graph segmentation method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment belongs to the same concept as the corresponding method embodiment. The specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0160] The present application also provides a computing device 1100 . Fig.11 is a schematic diagram of a computing device provided in an embodiment of the present application, such as Fig.11 As shown, the computing device 1100 includes: a bus 1101, a processor 1102, a memory 1103 and a communication interface 1104. The processor 1102, the memory 1103 and the communication interface 1104 communicate with each other through the bus 1101. The computing device 1100 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 1100.

[0161] The bus 1101 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 The bus 1101 is represented by only one line, but it does not mean that there is only one bus or one type of bus. The bus 1101 may include a path for transmitting information between various components of the computing device 1100 (for example, the memory 1103, the processor 1102, and the communication interface 1104).

[0162] The processor 1102 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0163] The memory 1103 may include a volatile memory (VM), such as a random access memory (RAM). The memory 1103 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0164] The memory 1103 stores executable program codes, and the processor 1102 executes the executable program codes to respectively implement the functions of the aforementioned partition division module 801, the gain determination module 802, the gain sum prediction module 803, and the first subgraph segmentation module 804, thereby implementing the data flow graph segmentation method. That is, the memory 1103 stores instructions for executing the data flow graph segmentation method.

[0165] The communication interface 1104 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1100 and other devices or a communication network.

[0166] The present application implements a computer program product including instructions, which may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device implements the data flow graph segmentation method provided in the above embodiment.

[0167] The embodiment of the present application provides a computer-readable storage medium, which can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions, and when the instructions are executed by a computing device cluster, the computing device cluster executes the data flow graph segmentation method provided in the above embodiment.

[0168] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions. For example, the data flow diagrams involved in this application are all obtained with full authorization.

[0169] Those of ordinary skill in the art will appreciate that the various method steps and units described in the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the steps and components of each embodiment have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0170] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

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

[0172] The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.

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

[0174] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computing device (which can be a personal computer, a server, or a computing device, etc.) to execute all or part of the steps of the method in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0175] In this application, the terms "first", "second", etc. are used to distinguish between identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is the quantity and execution order limited. It should also be understood that although the following description uses the terms first, second, etc. to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of various examples, the first subgraph can be referred to as the second subgraph, and similarly, the second subgraph can be referred to as the first subgraph. Both the first subgraph and the second subgraph can be subgraphs, and in some cases, can be separate and different subgraphs.

[0176] In this application, the term "at least one" means one or more, and the term "multiple" means two or more, for example, multiple first subgraphs means two or more first subgraphs. In this document, the terms "system" and "network" are often used interchangeably.

[0177] It should also be understood that the term "if" may be interpreted to mean "when" or "upon" or "in response to determining" or "in response to detecting." Similarly, the phrase "if it is determined that ..." or "if [a stated condition or event] is detected" may be interpreted to mean "upon determining that ..." or "in response to determining that ..." or "upon detecting [a stated condition or event]" or "in response to detecting [a stated condition or event]," depending on the context.

[0178] The above description is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0179] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer program instructions. When the computer program instructions are loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.

[0180] The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD), or a semiconductor medium (e.g., a solid-state drive)), etc.

[0181] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0182] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A data flow graph segmentation method, It is characterized in that The method comprises: Divide a plurality of first subgraphs of a data flow graph into two partitions, each of the partitions including at least one of the first subgraphs, each of the first subgraphs including at least one node, the data flow graph indicating tasks to be performed by programmable hardware, and the first subgraphs being used to configure a plurality of execution units in the programmable hardware; Determine the gain of each node based on the partition where each node is located, the attribute of each node and the deadlock condition of the first subgraph to which each node belongs, wherein the gain indicates the influence on the segmentation result if the node is moved from the partition where the node is located to another partition; Based on the gains of each of the nodes, predicting the sum of gains of the moved nodes after each moving of one node, to obtain a plurality of gain sums; Based on the partitions where each node corresponding to the minimum gain sum in each of the gain sums is located, the multiple first subgraphs are divided into multiple second subgraphs, and the second subgraphs are used to configure the multiple execution units in the programmable hardware.

2. The method according to claim 1, It is characterized in that The method further comprises: Determine the number of splits based on the number of nodes in the data flow graph, the attributes of each node, and the architecture information of the programmable hardware, wherein the attributes indicate the function of the node, and the architecture information is used to describe the architecture of the programmable hardware; Based on the number of cuts, the data flow graph is cut into first subgraphs of the number of cuts.

3. The method according to claim 2, It is characterized in that The step of dividing the data flow graph into first subgraphs of the number of divided portions based on the number of divided portions includes any of the following: Randomly traverse each of the nodes in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of divisions, wherein M is a positive integer greater than or equal to 1; Performing a layer-order traversal on each of the nodes in the data flow graph, and dividing the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of divided portions; Performing a pre-order traversal on each of the nodes in the data flow graph, and dividing the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of partitions; Performing a reverse pre-order traversal on each of the nodes in the data flow graph, and dividing the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of partitions; A pre-order traversal is performed on each of the nodes in the data flow graph, and each time M nodes are traversed, the M nodes are divided into a first subgraph to obtain a first subgraph of the number of divided portions.

4. The method according to claim 1, It is characterized in that The determining the gain of each of the nodes based on the partitions where each of the nodes is located, the attributes of each of the nodes, and the deadlock situation of the first subgraph to which each of the nodes belongs includes: Determine a first gain of the node based on the partition where the node is located and the partitions where other nodes on the hyperedge where the node is located are located; Based on the attributes of each of the nodes, respectively determine the proportion of nodes with various attributes in the partition where the node is located and another partition, and determine the second gain of the node based on the proportion of nodes with various attributes in the two partitions; Determining a third gain of the node based on a deadlock condition of a first subgraph to which the node belongs; The first gain, the second gain and the third gain are integrated to obtain the gain of the node.

5. The method according to claim 1, It is characterized in that The two partitions obtained by the first division are used as the first-level partitions, and the partitions where the nodes corresponding to the minimum gain sum in the gain sums are located are divided into the multiple first subgraphs into multiple second subgraphs, including: Move each node corresponding to the minimum gain sum among the gain sums from the first-level partition to another first-level partition; If the number of the second subgraphs included in the first-level partition is greater than 1, the step of partitioning the first-level partition at least once is performed, and after the i-th partition, based on the i-level partition in which each node in the i-level partition obtained by the division is located, the attributes of each node and the deadlock situation of the subgraph to which each node in the i-level partition belongs, the gain of each node in the i-level partition is determined, and based on the gain of each node in the i-level partition, the sum of the gains of the moved nodes in the i-level partition after each movement of a node in the i-level partition to another i-level partition is predicted, and multiple gain sums corresponding to the i-level partition are obtained, and the moved node corresponding to the minimum gain sum among the multiple gain sums corresponding to the i-level partition is moved to the other i-level partition to obtain multiple second subgraphs; If after the i-th partition, the number of the second subgraphs included in the i-th partition is equal to 1, the partitioning process is terminated; if the number of the second subgraphs included in the i-th partition is greater than 1, the step of performing the i+1-th partitioning based on the i-th partition is continued; Here, i is an integer greater than or equal to 2.

6. The method according to claim 2, It is characterized in that The method further comprises: If any of the second subgraphs is not feasible, and the number of divisions under the number of divisions is less than the preset number, then executing the step of dividing the plurality of first subgraphs of the data flow graph into two partitions; If any of the second subgraphs is not feasible, and the number of splits under the split number is equal to the preset number, the split number is increased by one, and the step of splitting the data flow graph into the first subgraphs of the split number based on the split number is executed.

7. The method according to claim 6, It is characterized in that The second subgraph is not feasible including any of the following: The gain of each of the nodes in the second subgraph is greater than or equal to a preset gain; There is a deadlock between the second subgraph and any other second subgraph; There is any node in the second subgraph that is not connected to any other node in the second subgraph; The second subgraph is an empty subgraph; The number of nodes in the second subgraph is greater than the number of nodes that can be accommodated by the programmable hardware.

8. The method according to claim 1, It is characterized in that The method further comprises: If each of the second subgraphs is feasible, a storage node is added to each of the second subgraphs based on the input and output of each of the second subgraphs, and the storage node is used to load the input of the second subgraph and store the output of the second subgraph.

9. The method according to claim 1, It is characterized in that The method further comprises: Merge any two of the second subgraphs. If the merged graph is feasible, determine the merged graph as the updated second subgraph of the data flow graph. If the merged graph is not feasible, do not update the second subgraph of the data flow graph.

10. A data flow graph segmentation device, It is characterized in that The device comprises: a partition division module, configured to divide a plurality of first subgraphs of a data flow graph into two partitions, each of the partitions comprising at least one of the first subgraphs, each of the first subgraphs comprising at least one node, the data flow graph indicating tasks to be performed by programmable hardware, and the first subgraphs being used to configure a plurality of execution units in the programmable hardware; A gain determination module, configured to determine the gain of each node based on the partition where each node is located, the attributes of each node, and the deadlock condition of the first subgraph to which each node belongs, wherein the gain indicates the impact on the segmentation result if the node is moved from the partition where the node is located to another partition; A gain sum prediction module, used for predicting the gain sum of the moved nodes after each node is moved based on the gain of each node, to obtain multiple gain sums; The first subgraph segmentation module is used to segment the multiple first subgraphs into multiple second subgraphs based on the partitions where each node corresponding to the minimum gain sum in each gain sum is located, and the second subgraphs are used to configure the multiple execution units in the programmable hardware.

11. The device according to claim 10, It is characterized in that The device also includes: A split number determination module, used to determine the split number based on the number of nodes in the data flow graph, the attributes of each node and the architecture information of the programmable hardware, wherein the attributes indicate the function of the node and the architecture information is used to describe the architecture of the programmable hardware; A data flow graph segmentation module is used to segment the data flow graph into a first subgraph of the segmentation number based on the segmentation number.

12. The device according to claim 11, It is characterized in that The data flow graph segmentation module is used for any of the following: Randomly traverse each of the nodes in the data flow graph, and divide the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of divisions, wherein M is a positive integer greater than or equal to 1; Performing a layer-order traversal on each of the nodes in the data flow graph, and dividing the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of cut portions; Performing a pre-order traversal on each of the nodes in the data flow graph, and dividing the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of cut portions; Performing a reverse pre-order traversal on each of the nodes in the data flow graph, and dividing the M nodes into a first subgraph every time M nodes are traversed, so as to obtain the first subgraph of the number of partitions; A pre-order traversal is performed on each of the nodes in the data flow graph, and each time M nodes are traversed, the M nodes are divided into a first subgraph to obtain the first subgraph of the number of cut portions.

13. The device according to claim 10, It is characterized in that The gain determination module is used to: Determine a first gain of the node based on the partition where the node is located and the partitions where other nodes on the hyperedge where the node is located are located; Based on the attributes of each of the nodes, respectively determine the proportion of nodes with various attributes in the partition where the node is located and another partition, and determine the second gain of the node by the difference between the proportions of nodes with various attributes in the two partitions; Determining a third gain of the node based on a deadlock condition of a first subgraph to which the node belongs; The first gain, the second gain and the third gain are integrated to obtain the gain of the node.

14. The device according to claim 10, It is characterized in that The two partitions obtained by the first partition are used as first-level partitions, and the first subgraph partitioning module is used to: Move each node corresponding to the minimum gain sum among the gain sums from the first-level partition to another first-level partition; If the number of the second subgraphs included in the first-level partition is greater than 1, the step of partitioning the first-level partition at least once is performed, and after the i-th partition, based on the i-level partition in which each node in the i-level partition obtained by the division is located, the attributes of each node and the deadlock situation of the subgraph to which each node in the i-level partition belongs, the gain of each node in the i-level partition is determined, and based on the gain of each node in the i-level partition, the sum of the gains of the moved nodes in the i-level partition after each movement of a node in the i-level partition to another i-level partition is predicted, and multiple gain sums corresponding to the i-level partition are obtained, and the moved node corresponding to the minimum gain sum among the multiple gain sums corresponding to the i-level partition is moved to the other i-level partition to obtain multiple second subgraphs; If after the i-th partition, the number of the second subgraphs included in the i-th partition is equal to 1, the partitioning process is terminated; if the number of the second subgraphs included in the i-th partition is greater than 1, the step of partitioning the i+1-th partition is continued based on the i-th partition; Here, i is an integer greater than or equal to 2.

15. The device according to claim 11, It is characterized in that The partition division module is further used to execute the step of dividing the plurality of first subgraphs of the data flow graph into two partitions if any of the second subgraphs is not feasible and the number of divisions under the number of divisions is less than a preset number; The data flow graph segmentation module is also used to increase the number of segments by one and execute the step of segmenting the data flow graph into the first subgraphs of the number of segments based on the number of segments if any of the second subgraphs is not feasible and the number of segmentations under the number of segments is equal to the preset number of times.

16. The device according to claim 15, It is characterized in that The second subgraph is not feasible including any of the following: The gain of each of the nodes in the second subgraph is greater than or equal to a preset gain; There is a deadlock between the second subgraph and any other second subgraph; There is any node in the second subgraph that is not connected to any other node in the second subgraph; The second subgraph is an empty subgraph; The number of nodes in the second subgraph is greater than the number of nodes that can be accommodated by the programmable hardware.

17. The device according to claim 10, It is characterized in that The device also includes: A node adding module is used to add a storage node in each of the second subgraphs based on the input and output of each of the second subgraphs, wherein the storage node is used to load the input of the second subgraph and store the output of the second subgraph.

18. The device according to claim 10, It is characterized in that The device also includes: The second subgraph merging module is used to merge any two of the second subgraphs. If the merged graph is feasible, the merged graph is determined as the second subgraph after the data flow graph is updated. If the merged graph is not feasible, the second subgraph of the data flow graph is not updated.

19. A computing device, It is characterized in that The computing device includes a processor and a memory; The processor is used to execute instructions stored in the memory so that the computing device executes the data flow graph segmentation method as described in any one of claims 1 to 9.

20. A computer program product comprising instructions, It is characterized in that When the instruction is executed by a computing device, the computing device executes the data flow graph segmentation method according to any one of claims 1 to 9.

21. A computer-readable storage medium, It is characterized in that It includes computer program instructions. When the computer program instructions are executed by a computing device, the computing device executes the data flow graph segmentation method as described in any one of claims 1 to claim 9.