Adaptive graph partitioning method for multi-resource constraints in multi-fpga system
Patent Information
- Application Number
- CN202311257300.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2043-09-27
AI Technical Summary
在其他关于非平衡划分的研究中,通常需要事先指定分区的数量和比例,然而,这种刚性的约束不仅难以确定,还限制了划分策略的灵活性,从而限制了广泛的划分探索空间
步骤4.10、判断次级候选结点散列表是否存在元素;若否,结束程序,若是,转到步骤4.11;
Smart Images

Figure CN117236248B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of graph partitioning problem in very large-scale integrated circuits (VLSI), and relates to an adaptive graph partitioning method with multiple resource constraints in a multi-FPGA system. Background Technology
[0002] The development of VLSI technology has improved the performance of electronic devices in various fields, including smartphones, computers, and communication equipment, thereby enhancing quality of life and promoting scientific research and economic development. Prototype verification, a crucial stage in VLSI design, verifies the chip's functionality and performance, ensuring the design's correctness and guaranteeing successful manufacturing of the final product. As circuit design complexity continues to increase, circuit designs need to be allocated to multiple FPGA systems for simulation and verification. A reasonable and efficient circuit diagram partitioning directly affects the performance of multi-FPGA systems, including the effective utilization of logic array resources and high-speed signal transmission.
[0003] Traditional graph partitioning algorithms include iterative improvement methods based on movement (such as the KL / FM algorithm) and multi-level partitioning methods (such as Metis). Most research on these traditional graph partitioning algorithms focuses on balanced partitioning, meaning that the partitions generally require the sizes of the subsets to be roughly balanced to achieve load balancing. However, in scenarios where circuit designs are distributed across multiple FPGA systems for simulation and verification, the goal is not load balancing, but rather achieving the highest possible system frequency while satisfying FPGA capacity constraints. This goal primarily depends on the number of connections between subsets, as fewer partitions reduce communication overhead, thereby improving system performance. Other studies on unbalanced partitioning typically require pre-specifying the number and proportion of partitions; however, this rigid constraint is not only difficult to determine but also limits the flexibility of partitioning strategies, thus restricting the extensive partitioning exploration space. Furthermore, existing graph partitioning algorithms often only consider the case where nodes have a single resource, ignoring the multiple resource constraints in partitioning circuits across multiple FPGA systems, which may lead to invalid solutions. Summary of the Invention
[0004] Purpose of the invention: To provide an adaptive graph partitioning method with multiple resource constraints in a multi-FPGA system, so as to solve the above-mentioned problems existing in the prior art.
[0005] Technical solution: An adaptive graph partitioning method with multiple resource constraints in a multi-FPGA system, comprising the following steps: Step 1: Apply the balanced partitioning algorithm to obtain the initial solution for graph partitioning; Step 2: Use the node resource fine-tuning algorithm to fine-tune the node partitioning of the initial solution to obtain a partitioning solution that satisfies the resource constraints. At the same time, add the maximum number of cut edges of the initial solution at this time to the performance record stack. Step 3: Determine the fine-grained parameters, coarse out the nodes of each subset of the partition solution that satisfies the resource constraints into supernodes, and obtain the supernode graph; Step 4: Use the supernode transfer algorithm to adjust the partitioning of supernodes in the supernode graph to obtain the adjusted supernode graph; Step 5: Based on the adjusted supernode graph, map the supernodes back to the original nodes to obtain the adjusted partitioning solution; Step 6: Determine whether the partition quality data in the performance record stack has converged. If convergence is not met, update the fine-grained parameters, use the adjusted partition solution as input, and repeat step 3; otherwise, proceed to step 7. The formula for updating the fine-grained parameters is as follows:
[0006] Where, p t p represents the original fine-grained parameter. t+1 For the updated fine-grained parameters, To take the sign of the integer; Step 7: Take the value with the smallest maximum number of cutting edges in the performance record stack and record its corresponding partition as the optimal partition result. If there is an already recorded optimal partition result, determine whether the iteration has converged. If the iteration has not converged, reset the fine-grained parameter to 1, take the partition solution adjusted in step 5 as input, repeat step 3, and enter a new round of iteration; otherwise, determine that the iteration has converged and output the optimal partition result.
[0007] According to one aspect of this application, the resource fine-tuning algorithm in step 2 includes the following steps: Step 2.1: Determine whether the partitioning result satisfies the constraints on all resources. If the constraints are satisfied, output the partitioning result that satisfies the multi-resource constraints; otherwise, proceed to Step 2.2. Step 2.2: For overloaded resources, for each subset that does not satisfy the resource constraint, add all nodes containing overloaded resources to a priority queue, remove the node at the head of the priority queue, and move that node to the subset with the largest association that satisfies the resource constraint. If the subset still does not satisfy the resource constraint, continue to remove the node at the head of the queue and repeat the above adjustment process until the resource constraint is satisfied, then return to step 2.1. The priority queue of nodes is ordered. After each node movement, the information of adjacent nodes in the original subset queue is updated, and the queue order is adjusted accordingly. The nodes are arranged in ascending order according to the index calculated by the following formula: inter_degree i =in_degree i -out_degree i Among them, in_degree i `out_degree` is the sum of edge weights between a node and all nodes in its subset, representing the degree of association between the node and the original subset. i The sum of edge weights of a node and the subset containing the nodes with the highest correlation that satisfy resource constraints represents the degree of correlation between a node and its external environment.
[0008] According to one aspect of this application, the supernode transfer algorithm in step 4 includes the following steps: Step 4.1: Update the node information of all edge supernodes in the supernode graph and initialize the information for the supernode transfer algorithm; In the node information update operation, a candidate node hash table is maintained, including information such as the supernode index, transition gain, and destination subset stack; Step 4.2: Determine if the candidate node hash table is empty; if the candidate node hash table is empty, proceed to step 4.3; otherwise, proceed to step 4.4. Step 4.3: If the secondary candidate node hash table contains elements, perform supernode transfer on all elements of the secondary candidate node hash table and output the supernode partitioning result optimized by the transfer under the current fine-grained parameters; Step 4.4: Determine if the target subset stack is empty. If not, proceed to step 4.6. If yes, the supernode cannot be transferred to a subset that can produce greater quality improvement under the condition of satisfying the constraints. Therefore, the transfer of the supernode to any target subset will fail. Step 4.5: Delete the information of the supernode from the candidate node hash table, maintain the secondary candidate node hash table, record the information of the supernode, and go to step 4.2; Step 4.6: If the candidate node hash table is not empty, then take out the supernode with the maximum transition gain from the hash table, pop the top element of the destination subset stack, and transfer the supernode to the subset. Step 4.7: Determine whether the target subset satisfies resource constraints after the supernode is transferred; Step 4.8: If the target subset does not meet the resource constraints after the supernode transfer, the supernode transfer fails. Continue to pop the top element from the target subset stack and repeat the transfer process until successful. If the target subset stack is empty. Step 4.9: If the target subset satisfies the resource constraints after the supernode transfer, the supernode transfer is successful, the adjacency relationship between the supernode and the supernode is changed, and the node information update operation in step 4.1 is performed on the adjacent supernodes. Step 4.10: Determine if the hash table of the secondary candidate nodes contains any elements; if not, end the program; if yes, proceed to step 4.11. Step 4.11: If the secondary candidate node hash table contains elements, perform supernode transfer on all elements of the secondary candidate node hash table and proceed to step 4.2.
[0009] Beneficial effects: This invention transforms the unbalanced partitioning problem into an iterative balanced partitioning problem, making existing balanced partitioning algorithms more adaptable to the needs of circuit design and allocation to multiple FPGA systems for simulation and verification; in the initial solution and node transfer stages, multiple resource constraints are considered, and compared with the traditional method that only considers a single weight, this invention can avoid obtaining invalid solutions; compared with the traditional unbalanced partitioning method that requires the application of rigid constraints, the partitioning strategy of this invention is flexible and can search a wide partitioning space and explore the global optimal solution for partitioning, which has good practical application value. Attached Figure Description
[0010] Figure 1 This is a flowchart of the algorithm of the present invention.
[0011] Figure 2 The following is a pseudocode diagram of the node resource fine-tuning algorithm of the present invention.
[0012] Figure 3 The following is a pseudocode diagram of the supernode transfer algorithm of the present invention.
[0013] Figure 4 This is a simplified example diagram of the present invention.
[0014] Figure 5 This is a comparative experimental diagram of the present invention.
[0015] Figure 6 This is a flowchart of step 4 of the present invention.
[0016] Figure 7 This is a flowchart of another embodiment of step 4 of the present invention. Detailed Implementation
[0017] Current research on multi-FPGA systems lacks a universally applicable graph partitioning method for such scenarios. For example, TopoPart, a study on partitioning nodes across FPGAs, relies on a fixed FPGA network topology and nodes fixed to specific FPGAs. These constraints limit the solutions found to specific limitations, failing to provide a universally applicable approach.
[0018] This invention proposes an adaptive graph partitioning method for multi-resource constraints in multi-FPGA systems. To facilitate understanding of this invention, the following description will be more comprehensive and detailed in conjunction with the accompanying drawings and preferred embodiments. However, the scope of protection of this invention is not limited to the following specific embodiments.
[0019] Unless otherwise defined, all technical terms used herein have the same meaning as commonly understood by those skilled in the art. The technical terms used herein are for the purpose of describing particular embodiments only and are not intended to limit the scope of the invention.
[0020] To better illustrate this embodiment, some components in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions of the product; it is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0021] like Figure 1 The diagram shows a flowchart of an adaptive graph partitioning method with multiple resource constraints in a multi-FPGA system. The graph partitioning algorithm includes steps 1 to 7, specifically: Step 1: Apply the balanced partitioning algorithm to obtain the initial solution for graph partitioning.
[0022] Step 2: Initialize the graph partitioning and apply a node resource fine-tuning algorithm to fine-tune the node partitioning, obtaining a partitioning solution that satisfies resource constraints. Simultaneously, add the maximum number of cut edges in this solution to a performance record stack. The maximum number of cut edges is defined as the number of cut edges between the two largest parts, representing the two most difficult parts to partition and the bottleneck for partitioning performance.
[0023] Step 3: The initial input for this step is the partition solution that satisfies the resource constraints obtained in Step 2. With a fine-grained parameter initially set to 1, the nodes of each subset are coarsened into supernodes to obtain a supernode graph. The fine-grained parameter is defined as the number of supernodes in each subset after coarsening.
[0024] Step 4: Apply the supernode transfer algorithm to the supernode graph obtained in Step 3 to adjust the partitions of the supernodes and obtain the adjusted supernode graph.
[0025] Step 5: For the supernode graph adjusted in Step 4, map the supernodes back to the original nodes to obtain the adjusted partitioning solution.
[0026] Step 6: Determine if the partition quality data in the performance record stack has converged. If convergence is not achieved, after updating the fine-grained parameters, repeat Step 3 using the partition result adjusted in Step 5 as input. The formula for updating the fine-grained parameters is as follows:
[0027] Where, p tp represents the original fine-grained parameter. t+1 For the updated fine-grained parameters, The rounding up sign is used instead of the standard rounding up sign because the standard character cannot be displayed correctly. The fine-grained parameter list p is uniformly sampled on an exponential function, undergoing exponential growth with the number of iterations t. This strategy helps to gradually transition from coarse-grained to fine-grained levels during iterative optimization. Initially, the original graph undergoes a coarsening process to generate a coarser-grained supernode graph, followed by supernode scheduling optimization for partitioning. Subsequently, the original graph undergoes progressive coarsening, leading to the creation of a finer-grained supernode graph, thus repeating the unbalanced optimization process. Furthermore, the design focuses more on smaller values for the fine-grained parameters, emphasizing the iterative optimization process for the coarser-grained supernode graph.
[0028] Conversely, if the quality data converges, proceed to step 7. The performance convergence determination method in the performance record stack is as follows: if the variance of the top 10 elements of the stack is greater than 1, or the number of stack elements is less than 10, then the performance is considered non-converged; otherwise, the performance is considered converged.
[0029] Step 7: Take the value with the smallest maximum number of cutting edges in the performance record stack and record its corresponding partition as the optimal partition result. If an optimal partition result already exists, determine whether the iteration has converged. If the iteration has not converged, reset the fine-grained parameter to 1, use the partition result adjusted in Step 5 as input, and repeat Step 3 to enter a new round of iteration. Otherwise, the iteration has converged, and the optimal partition result is output. The method for determining iteration convergence is to compare the recorded optimal partition result with the currently obtained optimal partition result, calculate the ratio of the latter to the former, and if the ratio is greater than 0.98, the iteration has converged. Otherwise, the iteration has not converged.
[0030] In a further embodiment, such as Figure 2 The following is the pseudocode for the node resource fine-tuning algorithm in step 2: Iterate through all subsets and resources of the partition result V. If the partition result V is in subset V... i The above does not satisfy the sequence number k o Given the resource constraints, we maintain an ordered priority queue q, which contains a subset V. i Each node in the array contains k o The node is a resource. The priority queue of these nodes is ordered. After each node movement, due to changes in the adjacency relationships within the original subset, the information of adjacent nodes in the original subset queue is updated, and the queue order is adjusted accordingly. The elements in the priority queue q are arranged in ascending order according to the index calculated by the following formula: inter_degree i =in_degreei -out_degree i Among them, in_degree i For node v i The sum of edge weights between a node and all nodes in its own subset V0 represents the degree of association between the node and the original subset, denoted by out_degree. i Let V be a node and its subset V with the highest degree of association that satisfies the resource constraints. m The sum of edge weights of the nodes contained in the expression represents the degree of association between the node and its external counterpart. The specific formulas for calculating both are as follows: in_degree i =∑ u∈Vo w(u,v) i ) out_degree i =max Vm (∑) u∈Vm w(u,v) i V m ≠V0 ∑ vj∈Vm res_node vj,ko +res_node vi,ko <res_fpga ko Among them, w(u,v i ) represents nodes u and v i The connection weights between nodes, res_node vi,ko Represents node v i In sequence number k o Resource usage, res_fpga ko This refers to an FPGA chip, i.e., a single subset, at index k. o The upper limit of resource capacity on resources.
[0031] After obtaining an ordered priority queue q, take the head node v of queue q. head Move it to the k-th largest association that satisfies the resource constraint. o A subset V of the resource has remaining space. target If subset V i k in o If resource number is still overloaded, then update v in queue q. head All adjacent nodes v n The information is processed, and the order of queue q is adjusted accordingly. This process is repeated until subset V is reached. i Satisfy the kth oThe algorithm then iterates through all subsets and resources of the partitioning result V. If a resource constraint is not met, the node partitioning adjustment process described above is repeated until all resources in all subsets meet the resource constraints.
[0032] In a further embodiment, such as Figure 3 The image shows the pseudocode for the supernode transfer algorithm in step 4, which includes the following steps: Step 4.1: First, initialize the candidate transition supernode information in the supernode graph S, and maintain a candidate node hash table `candidates`. For each subset S in the supernode graph... i All edge supernodes i The node information is updated and stored in a hash table called `candidates`. Each element in `candidates` contains information such as the supernode's index, transition gain, and destination subset stack. The destination subset stack records the subsets with the highest connection weight to the supernode; it may contain multiple elements, ordered in descending order of degree, with the top element being `S`. top The design aims to minimize the degree of each subset while maintaining equal transition gains, thereby minimizing the total number of cut edges and the maximum number of cut edges in the partitioned graph. The transition gain is defined as the difference between the sum of edge weights of a supernode and the destination and original subsets, reflecting the degree to which the supernode improves the partitioning quality after scheduling. Only supernodes with positive transition gains—those that improve partitioning quality—are recorded in the hash table. Additionally, an initially empty secondary candidate node hash table, `candidates′`, is maintained.
[0033] Step 4.2: If the candidate hash table `candidates` is empty, proceed to step 4.3. Otherwise, if the hash table `candidates` is not empty, it indicates that there are some supernodes whose subsets are not optimal, and transferring them to the destination subset can significantly improve the quality of graph partitioning. In this case, select the supernode `s` with the largest transfer gain from the hash table `candidates`. m and its corresponding destination subset stack S target Pop stack S target The top element of the stack S top Attempt to transmit the supernode s m To subset S top There are two possible outcomes: If the supernode s m Transfer to target subset S top If this causes the target subset to not meet the resource constraints, then the transfer fails. At this point, continue popping from stack S. target The new top element of the stack, S′ top , will s mTransition to subset S′ top Repeat the transfer process until successful. If stack S target An empty value means that the supernode s m It cannot be scheduled to a subset that, under the current constraints and partitioning, could lead to a greater quality improvement. However, as the transfer of supernodes progresses, the node's partitioning may change, potentially creating conditions for the re-transfer of a failed supernode. Therefore, in supernode s m If all attempts to transfer to any destination subset fail, in addition to deleting the supernode's information from the candidate node hash table `candidates`, a secondary candidate node hash table `candidates'` is maintained to record the supernodes `s` that failed to transfer. m This information is for re-attempting to transfer the supernode s after the graph partitioning has changed. m This improves the quality of graph partitioning. After this step, return to step 4.2.
[0034] If the supernode s m Transfer to target subset S top Afterwards, if the target subset satisfies the resource constraints, the supernode transfer is successful. Due to the change in node partitioning, the information of some supernodes may need to be updated. Since the change in the position of a supernode only affects its neighboring supernodes, in supernode s... m After the transfer, only all cases related to s need to be processed. m Adjacent supernodes s nei Perform the node information update operation as described in step 4.1. Additionally, the supernode s... m Information will also be removed from the candidate node hash list `candidates`. Changes in graph partitioning may affect constraints, potentially allowing some supernodes that previously failed to be scheduled to successfully migrate to a better subset due to constraint breaking. Therefore, if the secondary candidate node hash list `candidates′` contains elements, all elements `s′` in that secondary candidate node hash list will be removed. m Attempt supernode transfers as described in step 4.2, maximizing the success rate of transfers for supernodes that are not in optimal positions. After this step, return to step 4.2.
[0035] Step 4.3: This step means that all supernodes are now in their optimal positions, and those supernodes that are not in their optimal positions either do not exist or have been added to the secondary candidate node hash table `candidates'`. At this point, in the final step, the algorithm attempts to move the supernodes `s'` that previously failed to move. mTake nodes from the secondary candidate node hash table `candidates'` and attempt supernode transfers as described in step 4.2 until `candidates'` is empty or no candidate supernode can be transferred to any better subset. This marks the end of the supernode transfer algorithm under a certain fine-grained parameter, and the output is the supernode partitioning result optimized for the current fine-grained parameter.
[0036] To more clearly illustrate the technical solution of the present invention, a simplified embodiment will be used to describe the present invention below, but the implementation of the present invention is not limited thereto.
[0037] Furthermore, such as Figure 4 (a) shows the original topology diagram, representing the interconnection of modules in the circuit. Here, we assume that the resource consumption of each node and the weight of the net are the same, and that the resource capacity of each subset is sufficient. Figure 4 (b) shows the partitioning result of the original topology graph after processing by the initial balanced partitioning algorithm. It can be seen that... Figure 4 In (b), the resource usage of the two partitions is the same, but the number of cutting edges is 2. Figure 4 (c) represents the algorithm's coarsening of the original graph nodes. As can be seen, the original graph is coarsened to have 4 supernodes, 2 in each partition, meaning the fine-grained parameter is now 2. As shown in 4(d), the algorithm finds that the supernode above the left partition has a greater correlation with the right partition. Therefore, this supernode is moved to the right partition, changing the partitioning result. The number of cutting edges in this partition is reduced to 1, resulting in a higher-quality partition. It should be noted that this... Figure 4 For the purpose of simplifying the description, many details of the invention have been omitted.
[0038] Furthermore, such as Figure 5 The figure shown is an experimental comparison diagram of the present invention. Experiments were conducted on seven samples under different partitions. The experiments were performed on a 64-bit Windows operating system equipped with an Intel i5-13400 2.5 GHz CPU and 16 GB of memory. The algorithm implementation of the present invention is entirely implemented in Python, while the benchmark algorithm Metis used for comparison is implemented in C++. It should be noted that although the optimization objective of the present invention is the maximum number of cutting edges, Figure 5 The experimental data also includes the total number of cuts, because on the one hand, the total number of cut edges is an important indicator of the quality of graph partitioning, and on the other hand, there is a certain correlation between the total number of cut edges and the maximum number of cut edges. Figure 5The results show that, in almost all examples, the present invention achieves significantly better results than the benchmark Metis algorithm in both metrics. Regarding the optimization metric of maximum number of cut edges, the present invention reduces the maximum number of cut edges obtained by the Metis algorithm by an average of 62%. Specifically, in some examples 2 and 4, the present invention achieves a partition solution with 0 cut edges, meaning that all nodes or supernodes are transferred to the same partition. This demonstrates that the present invention is also applicable and efficient under boundary conditions, eliminating the need for pre-calculation of resource capacity and unifying the partitioning method across all scenarios. The results also show that, in different partition examples of the same circuit with varying initial partitions, the present invention consistently achieves an optimal solution with 0 cut edges, indicating that the partitioning algorithm of the present invention converges to the optimal solution. Conversely, the Metis algorithm, because it can only generate equally divided partitions, can never achieve the optimal solution with 0 cut edges.
[0039] In a further embodiment, step 4.1: update the node information of all edge supernodes in the supernode graph to initialize the information of this algorithm; Preferably, in the node information update operation, a candidate node hash table is maintained, including information such as the supernode index, transition gain, and target subset stack. The target subset stack records the subsets with the highest connection weight to the supernode, and may contain multiple elements, arranged in descending order of degree. The transition gain is defined as the difference between the supernode and the sum of the edge weights of the target subset and the original subset, reflecting the degree to which the supernode improves the graph partitioning quality after scheduling. Only supernodes with positive transition gains, i.e., supernodes that can improve partitioning quality, are recorded in the hash table. Step 4.2: If the candidate node hash table is empty, proceed to step 4.3. Otherwise, if the candidate node hash table is not empty, retrieve the supernode with the maximum transition gain from the hash table, pop the top element from the destination subset stack, and transfer the supernode to that subset. This has two possible outcomes: Step 4.2.1: If the supernode transfer causes the target subset to no longer meet resource constraints, the supernode transfer fails. In this case, continue popping the top element from the target subset stack and repeat the transfer process until successful. If the stack is empty, it indicates that the supernode cannot be transferred to a subset that can produce a greater quality improvement while meeting the constraints. However, as node transfers proceed, the node's partitioning may change, potentially creating conditions for supernode transfers. Therefore, after a supernode transfer to any target subset fails, in addition to deleting the supernode's information from the candidate node hash table, a secondary candidate node hash table needs to be maintained to record the supernode's information. After this step, return to Step 4.2. Step 4.2.2: If the target subset satisfies the resource constraints after the supernode transfer, then the supernode transfer is successful. Due to the change in node partitioning, the adjacency relationships of the supernodes connected to this supernode change. Therefore, the algorithm will perform the node information update operation described in Step 4.1 on these adjacent supernodes. Also, due to the change in constraints caused by the partitioning change, if elements exist in the hash table of secondary candidate nodes, the algorithm will attempt to transfer the supernode as described in Step 4.2 for all elements in the hash table of secondary candidate nodes. After this step, return to Step 4.2. Step 4.3: If the secondary candidate node hash table contains elements, attempt the supernode transfer as described in Step 4.2 for all elements of the secondary candidate node hash table, and output the supernode partitioning result optimized by the transfer under the current fine-grained parameters.
[0040] like Figure 6 As shown, the supernode transfer algorithm in step 4 includes the following steps: Step 4.1: Update the node information of all edge supernodes in the supernode graph and initialize the information for the supernode transfer algorithm; In the node information update operation, a candidate node hash table is maintained, including information such as the supernode index, transition gain, and destination subset stack; Step 4.2: Determine if the candidate node hash table is empty; if the candidate node hash table is empty, proceed to step 4.3; otherwise, proceed to step 4.4. Step 4.3: If the secondary candidate node hash table contains elements, perform supernode transfer on all elements of the secondary candidate node hash table and output the supernode partitioning result optimized by the transfer under the current fine-grained parameters; Step 4.4: Determine if the target subset stack is empty. If not, proceed to step 4.6. If yes, the supernode cannot be transferred to a subset that can produce greater quality improvement under the condition of satisfying the constraints. Therefore, the transfer of the supernode to any target subset will fail. Step 4.5: Delete the information of the supernode from the candidate node hash table, maintain the secondary candidate node hash table, record the information of the supernode, and go to step 4.2; Step 4.6: If the candidate node hash table is not empty, then take out the supernode with the maximum transition gain from the hash table, pop the top element of the destination subset stack, and transfer the supernode to the subset. Step 4.7: Determine whether the target subset satisfies resource constraints after the supernode is transferred; Step 4.8: If the target subset does not meet the resource constraints after the supernode transfer, the supernode transfer fails. Continue to pop the top element from the target subset stack and repeat the transfer process until successful. If the target subset stack is empty. Step 4.9: If the target subset satisfies the resource constraints after the supernode transfer, the supernode transfer is successful, the adjacency relationship between the supernode and the supernode is changed, and the node information update operation in step 4.1 is performed on the adjacent supernodes. Step 4.10: Determine if the hash table of the secondary candidate nodes contains any elements; if not, end the program; if yes, proceed to step 4.11. Step 4.11: If the secondary candidate node hash table contains elements, perform supernode transfer on all elements of the secondary candidate node hash table and proceed to step 4.2.
[0041] like Figure 7 As shown, another embodiment is also provided. The specific process is as follows: Step 4.1 Update node information for all edge supernodes in the node graph to initialize the information for this algorithm. This is the same as in the previous embodiment.
[0042] Step 4.2 Determine if the candidate node hash table is empty. If not, proceed to step 4.3. Otherwise, retrieve the supernode with the maximum transfer gain from the hash table (i.e., step 4.6 in the figure) and then proceed to step 4.4. Step 4.3 Perform supernode transfer on all elements of the (secondary candidate node hash table), and output the supernode partitioning result after transfer optimization under the current fine-grained parameters. Step 4.4 Determine if the target subset stack is empty. If it is empty, proceed to step 4.5. If it is not empty, pop the top element of the target subset stack, move the supernode to the subset, and proceed to step 4.7. Step 4.5 Delete the supernode's information from the candidate node hash table, maintain the secondary candidate node hash table, and record the supernode's information; Step 4.7 Determine whether the target subset after the transfer meets the resource constraints; if not, the supernode transfer fails, and proceed to step 4.4. If so, proceed to step 4.9; Step 4.9 The supernode transfer is successful. The adjacency relationship of the supernodes connected to this supernode has changed. The node information update operation of the adjacent supernodes is performed using the method in step 4.1. Step 4.10: Determine if the hash table of the secondary candidate nodes contains any elements. If yes, that is, if the hash table of the secondary candidate nodes contains any elements, perform a supernode transfer on all elements of the hash table of the secondary candidate nodes; then proceed to step 4.2; otherwise, proceed directly to step 4.2.
[0043] This invention provides an adaptive graph partitioning algorithm with multiple resource constraints in a multi-FPGA system. It is suitable for automatically exploring the optimal partitioning scheme for deploying the designed circuit in a multi-FPGA system. The explored circuit partitioning scheme satisfies multiple resource constraints of the FPGA, and the optimization target is the system frequency. In terms of graph partitioning topology indicators, it is reflected in the maximum number of cut edges.
[0044] Compared to traditional balanced graph partitioning algorithms, such as the iteratively improved KL / FM algorithm based on movement and the multi-segment Metis algorithm, balanced graph partitioning algorithms can only generate multiple strictly equal subsets. They cannot flexibly adjust the partition ratio under specified capacity constraints. This constraint on the partition ratio limits the exploration of partitions with fewer cut nets and cannot achieve better partitioning. In contrast, this invention starts with an initial solution and then uses multi-level coarsening and moves nodes under a certain strategy to break the constraints of balanced partitioning and obtain higher-quality partitioning results.
[0045] Compared to existing unbalanced partitioning methods, some require specifying the proportion of partitioned subsets, such as in graph partitioning studies in heterogeneous computing scenarios, or specifying an imbalance degree. These methods, in effect, impose a rigid constraint on the partitioning, limiting the solution space. All partitioning results can only be explored under these constraints. Furthermore, these pre-defined parameters are difficult to determine. For a graph, its optimal partitioning differs under different resource constraints; that is, the optimal partitioning for the same circuit differs under FPGA chips with different resource capacity limitations. Moreover, for graphs of the same size, the optimal partitioning results exhibit different characteristics due to variations in graph features. This invention, by not pre-setting constraints but gradually adjusting from an initial solution that satisfies the constraints to approximate the optimal solution, resolves this problem.
[0046] It should be emphasized that the flexibility and applicability of this invention are not limited to specific application areas or resource-constrained environments. The technical solutions of this invention can be widely applied to a variety of different fields, industries, and resource-constrained situations. Therefore, without departing from the spirit of this invention, any technical solutions with similar structures and implementation methods existing in other technical fields or different application scenarios are still within the scope of protection of this patent.
[0047] The present invention and its embodiments have been described above illustratively. This description is not restrictive, and the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. The accompanying drawings are only one embodiment of the invention; the actual structure is not limited thereto, and any reference numerals in the claims should not limit the scope of the claims. Therefore, if a person skilled in the art, inspired by this description, designs a similar structure and embodiment without departing from the spirit of the invention, such design should fall within the scope of protection of this patent.
Claims
1. An adaptive graph partitioning method for multi-resource-constrained systems under multi-FPGA architecture, characterized in that, Includes the following steps: Step 1: Apply the balanced partitioning algorithm to obtain the initial solution for graph partitioning; Step 2: Use the node resource fine-tuning algorithm to fine-tune the node partitioning of the initial solution to obtain a partitioning solution that satisfies the resource constraints. At the same time, add the maximum number of cut edges of the initial solution at this time to the performance record stack. Step 3: Determine the fine-grained parameters, coarse out the nodes of each subset of the partition solution that satisfies the resource constraints into supernodes, and obtain the supernode graph; Step 4: Use the supernode transfer algorithm to adjust the partitioning of supernodes in the supernode graph to obtain the adjusted supernode graph; Step 5: Based on the adjusted supernode graph, map the supernodes back to the original nodes to obtain the adjusted partitioning solution; Step 6: Determine whether the partition quality data in the performance record stack has converged. If convergence is not met, update the fine-grained parameters, use the adjusted partition solution as input, and repeat step 3; otherwise, proceed to step 7. The formula for updating the fine-grained parameters is as follows: ; Where, p t p represents the original fine-grained parameter. t+1 For the updated fine-grained parameters, To take the sign of the integer; Step 7: Take the value with the smallest maximum number of cutting edges in the performance record stack and record its corresponding partition as the optimal partition result. If there is an optimal partition result that has been recorded, determine whether the iteration has converged. If the iteration has not converged, reset the fine-grained parameter to 1, take the partition solution adjusted in step 5 as input, repeat step 3, and enter a new round of iteration; otherwise, determine that the iteration has converged and output the optimal partition result. The resource fine-tuning algorithm in step 2 includes the following steps: Step 2.1: Determine whether the partitioning result satisfies the constraints on all resources. If the constraints are satisfied, output the partitioning result that satisfies the multi-resource constraints; otherwise, proceed to Step 2.
2. Step 2.2: For overloaded resources, for each subset that does not satisfy the resource constraint, add all nodes containing overloaded resources to a priority queue, remove the node at the head of the priority queue, and move that node to the subset with the largest association that satisfies the resource constraint. If the subset still does not satisfy the resource constraint, continue to remove the node at the head of the queue and repeat the above adjustment process until the resource constraint is satisfied, then return to step 2.
1. The priority queue of nodes is ordered. After each node movement, the information of adjacent nodes in the original subset queue is updated, and the queue order is adjusted accordingly. The nodes are arranged in ascending order according to the index calculated by the following formula: inter_degree i =in_degree i -out_degree i Among them, in_degree i `out_degree` is the sum of edge weights between a node and all nodes in its subset, representing the degree of association between the node and the original subset. i The sum of edge weights of a node and the subset containing the nodes with the highest correlation that satisfy resource constraints represents the degree of correlation between a node and its external environment.
2. The adaptive graph partitioning method for multi-resource-constrained systems under multi-FPGA systems according to claim 1, characterized in that, The supernode transfer algorithm in step 4 includes the following steps: Step 4.1: Update the node information of all edge supernodes in the supernode graph and initialize the information for the supernode transfer algorithm; In the node information update operation, a candidate node hash table is maintained, including the supernode index, transition gain, and destination subset stack information; Step 4.2: Determine if the candidate node hash table is empty; if the candidate node hash table is empty, proceed to step 4.3; otherwise, proceed to step 4.
4. Step 4.3: If the hash table of the secondary candidate nodes contains elements, perform supernode transfer on all elements of the hash table of the secondary candidate nodes, and output the supernode partitioning result after transfer optimization under the current fine-grained parameters; Step 4.4: Determine if the target subset stack is empty. If not, proceed to step 4.
6. If yes, the supernode cannot be transferred to a subset that can produce greater quality improvement under the condition of satisfying the constraints. Therefore, the transfer of the supernode to any target subset will fail. Step 4.5: Delete the information of the supernode from the candidate node hash table, maintain the secondary candidate node hash table, record the information of the supernode, and go to step 4.2; Step 4.6: If the candidate node hash table is not empty, then take out the supernode with the maximum transition gain from the hash table, pop the top element of the destination subset stack, and transfer the supernode to the subset. Step 4.7: Determine whether the target subset satisfies resource constraints after the supernode is transferred; Step 4.8: If the target subset does not meet the resource constraints after the supernode transfer, the supernode transfer fails. Continue to pop the top element from the target subset stack and repeat the transfer process until successful. If the target subset stack is empty. Step 4.9: If the target subset satisfies the resource constraints after the supernode transfer, the supernode transfer is successful, the adjacency relationship between the supernode and the supernode is changed, and the node information update operation in step 4.1 is performed on the adjacent supernodes. Step 4.10: Determine if the hash table of the secondary candidate nodes contains any elements; if not, end the program; if yes, proceed to step 4.
11. Step 4.11: If the hash table of the secondary candidate nodes contains elements, perform supernode transfer on all elements of the hash table of the secondary candidate nodes, and proceed to step 4.2.