Chip layout planning method, device and storage medium based on graph neural network

Through the chip layout planning method based on graph neural network, the variational graph autoencoder model is used to learn the interconnection information between modules, which solves the problem of slow processing speed in the existing technology, achieves fast and efficient module layout, and improves improve the efficiency of chip design.

CN115081381BActive Publication Date: 2024-10-15SHANGHAI BANXIN TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210707368.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2024-10-15
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

The existing technology has a slow processing speed in chip layout planning and requires a particularly long time to achieve convergence, resulting in low efficiency.

Method used

Using a graph neural network-based method, by generating training data sets and building a variational graph autoencoder model, we learn the mapping relationship between the interconnection information between modules and the optimal layout, and use the trained model to quickly determine the module location. , improve layout efficiency.

Benefits of technology

It shortens the processing time, improves the efficiency of module layout, can automatically generate training data sets for optimal module layout, and improves circuit division speed through hypergraph coarse-graining and spectral clustering technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115081381B_ABST
    Figure CN115081381B_ABST
Patent Text Reader

Abstract

The present invention provides a chip layout planning method, device and storage medium based on graph neural network, including: generating a training data set with optimal module layout; constructing a module layout model based on a variational graph autoencoder framework; training the module layout model with the training data set to obtain a trained module layout model, so that it can learn the key features of the optimal module layout; dividing the circuit of the target chip according to the circuit netlist of the target chip to obtain all modules and the interconnection information between modules; according to the interconnection information between modules, using the trained module layout model to determine the position of each module in the target chip. The layout planning method provided by the present invention has a faster convergence speed and stronger line length optimization capability than the traditional mathematical analysis method or construction method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chip design, and in particular to a chip layout planning method, device and storage medium based on graph neural network. Background Art

[0002] Floorplan is a graphical representation of the main functional modules of a circuit in an experimental layout. It is an important part of the physical design of very large-scale integrated circuits. Its results have a direct impact on subsequent chip layout and routing algorithms.

[0003] Layout planning is mainly the layout of the main functional modules of the circuit. In the prior art, there is a module-level layout algorithm that represents the position of the module as a sequence pair or a B* tree, and then optimizes the module position using simulated annealing, genetic algorithm or particle swarm optimization algorithm to obtain the desired result. The advantage of this method is that the former reduces the complexity of the problem search space through reasonable representation, and the latter can jump out of the local optimal value and achieve the desired result, but this requires a particularly long computing time to obtain.

[0004] Another typical algorithm is the analytical method. The analytical method describes the constrained feasibility layout planning with a series of equations, and solves this series of equations through mathematical programming. The optimization goal is often to minimize the line length, and the constraints are generally that the modules do not overlap and the density of the modules in the entire chip does not exceed a certain threshold. The main challenge facing this method is still the slow processing speed. Summary of the invention

[0005] The purpose of the present invention is to provide a chip layout planning method, device and storage medium based on graph neural network, which is used to solve the problem that the prior art takes a very long time to reach convergence and has a slow processing speed.

[0006] The technical solution provided by the present invention is as follows:

[0007] A chip layout planning method based on graph neural network, comprising: generating a training data set, each sample of the training data set corresponds to an optimal module layout, the sample includes interconnection information between modules and position information of each module in the corresponding optimal module layout; the optimal module layout is a layout with the shortest interconnection bus length among all module layouts that meet the interconnection information between the modules;

[0008] A module layout model is constructed based on a variational graph autoencoder framework, wherein the variational graph autoencoder includes an encoder and a decoder, wherein the encoder encodes the interconnection information between input modules into a distribution in a latent space, and the decoder predicts the position information of each module in the module layout corresponding to the interconnection information between the input modules based on samples extracted from the latent space;

[0009] The module layout model is trained with the training data set to obtain a trained module layout model; the method includes: calculating the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample; calculating the KL divergence between the distribution of the latent space and the Gaussian distribution; combining the reconstruction loss and the KL divergence into a loss function of the module layout model;

[0010] According to the circuit netlist of the target chip, the circuit of the target chip is divided into circuits to obtain all modules and interconnection information between the modules;

[0011] According to the interconnection information between the modules, the position of each module in the target chip is determined using the trained module layout model.

[0012] In some embodiments, the generation of each sample of the training data set includes:

[0013] Get the number of modules n, the number of neighbors of each module, and the number of connections from each module to each neighbor;

[0014] Create an empty chip area, and evenly divide the chip area into a corresponding number of sub-areas according to the number of modules n, each sub-area representing a module;

[0015] Traverse all modules and perform the following operations on each module: starting from the nearest surrounding module, determine all neighbors of the module in order of increasing distance, and allocate the number of connections from the module to each neighbor according to the rule that the closer the neighbor, the more connections are allocated.

[0016] In some embodiments, obtaining the number of neighbors of each module and the number of connections from each module to each neighbor includes:

[0017] Set the distribution of the number of neighbors and the number of connections of the module;

[0018] Determining the number of neighbors of each module according to the distribution of the number of neighbors of the module;

[0019] Determining the total number of connections for each module according to the distribution of the number of connections of the modules;

[0020] The total number of connections of each module is decomposed into a corresponding number of integers according to the number of neighbors of the module, the sum of the integers is equal to the total number of connections of the module, and the obtained integer is used as the number of connections from the module to each neighbor.

[0021] In some embodiments, dividing the circuit of the target chip according to the circuit netlist of the target chip to obtain all modules and interconnection information between the modules includes:

[0022] According to the connection relationship between each unit in the circuit netlist, the units in the circuit netlist are grouped using a spectral clustering algorithm, and each obtained group is regarded as a module; and the interconnection information between the modules is determined according to the circuit netlist.

[0023] In some embodiments, the adopting of a spectral clustering algorithm to group the units in the circuit netlist and treating each obtained group as a module comprises:

[0024] Obtaining a corresponding hypergraph according to the circuit netlist, wherein the units of the circuit netlist are used as nodes of the hypergraph, and the wire nets of the circuit netlist are used as hyperedges of the hypergraph;

[0025] Starting from the hyperedge with the largest hyperedge degree, traverse all hyperedges in descending order of hyperedge degree, merge all unprocessed nodes on a hyperedge into a submodule, and then process the next hyperedge. The next hyperedge corresponds to a new submodule, and the cycle continues until all nodes are processed;

[0026] Obtaining interconnection information between the submodules according to the circuit netlist;

[0027] According to the interconnection information between the submodules, the submodules are grouped using a spectral clustering algorithm, and each obtained group is regarded as a module.

[0028] In some embodiments, after obtaining the module, it also includes: traversing all modules, extracting macro cells from modules with macro cells, treating each macro cell as a new module, and updating the modules with macro cells to modules without macro cells; determining the interconnection information between the updated modules according to the circuit netlist.

[0029] In some embodiments, the calculation of the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample specifically includes: treating two modules with an interconnection relationship as a module pair; selecting a module pair, and calculating the distance between the two modules included in the module pair according to the position information of the two modules in the module layout predicted by the module layout model, and recording it as the predicted distance of the module pair; calculating the distance between the two modules corresponding to the sample according to the position information of the two modules in the sample, and recording it as the target distance of the module pair; calculating the distance difference of the module pair according to the predicted distance and the target distance of the module pair; calculating the distance difference of all module pairs in the sample; and obtaining the reconstruction loss according to the distance difference of all module pairs.

[0030] The present invention also provides a chip layout planning device based on graph neural network, comprising:

[0031] A sample generating unit is used to generate a training data set, each sample of the training data set corresponds to an optimal module layout, and the sample includes interconnection information between modules and position information of each module in the corresponding optimal module layout; the optimal module layout is a layout with the shortest interconnection bus length among all module layouts that meet the interconnection information between the modules;

[0032] A model construction unit, for constructing a module layout model based on a variational graph autoencoder framework, wherein the variational graph autoencoder comprises an encoder and a decoder, wherein the encoder encodes the interconnection information between the input modules into a distribution in a latent space, and the decoder predicts the position information of each module in the module layout corresponding to the interconnection information between the input modules based on samples extracted from the latent space;

[0033] A training unit is used to train the module layout model with the training data set to obtain a trained module layout model; the training unit includes: calculating the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample; calculating the KL divergence between the distribution of the latent space and the Gaussian distribution; combining the reconstruction loss and the KL divergence into a loss function of the module layout model;

[0034] A circuit division unit, used for performing circuit division on the circuit of the target chip according to the circuit netlist of the target chip, and obtaining all modules and interconnection information between the modules;

[0035] The module layout unit is used to determine the position of each module in the target chip according to the interconnection information between the modules using the trained module layout model.

[0036] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing any of the aforementioned chip layout planning methods based on graph neural networks when executing the computer program stored in the memory.

[0037] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the chip layout planning method based on graph neural network described in any of the above items is implemented.

[0038] Compared with the prior art, the chip layout planning method, device and storage medium based on graph neural network provided by the present invention can at least bring the following beneficial effects:

[0039] 1. The present invention constructs a module layout model based on a variational graph neural network, and uses a training data set with an optimal module layout to train the model, so that the model learns the mapping relationship between the interconnection information between modules in the chip and the interconnection bus length of the optimal module layout; the real circuit is input into the trained model, and the model can output the position information of each module with the optimal module layout based on the previously learned mapping relationship. By using the trained model for practical applications, the processing time can be shortened and the module layout efficiency can be improved.

[0040] 2. The present invention can automatically generate a training data set with an optimal module layout. The input circuit topology can be specified by the user in the form of probability distribution. The generated training data set supports the training of the deep learning model.

[0041] 3. The present invention improves the circuit partitioning speed of large-scale circuits by combining hypergraph coarse-graining and spectral clustering technology, while retaining the segmentation advantages of the spectral clustering algorithm. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The following will explain the preferred implementation mode in a clear and understandable manner with reference to the accompanying drawings, and further explain the above-mentioned characteristics, technical features, advantages and implementation methods of a chip layout planning method, device and storage medium based on graph neural network.

[0043] Figure 1 It is a flow chart of an embodiment of a chip layout planning method based on graph neural network of the present invention;

[0044] Figure 2 It is a structural schematic diagram of an embodiment of a chip layout planning device based on a graph neural network of the present invention;

[0045] Figure 3 is a schematic structural diagram of an embodiment of an electronic device of the present invention;

[0046] Figure 4 It is a schematic diagram of the structure of the variational graph autoencoder;

[0047] Figure 5 It is a schematic diagram of the distribution of the number of neighbors and the number of connections of the module;

[0048] Figure 6 It is a schematic diagram of the working principle of the variational graph autoencoder;

[0049] Figure 7 It is a circuit diagram. DETAILED DESCRIPTION

[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.

[0051] In order to simplify the drawings, only the parts related to the present invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".

[0052] The overall circuit corresponding to the chip is usually very complex and large in scale. In the back-end design of the chip, it is necessary to first divide the circuit, then do the module layout, the wiring between modules, and then further design the circuit within the module. This hierarchical design idea can reduce the complexity of the design.

[0053] The whole circuit is decomposed into several sub-circuits, each of which is called a module. This process is called circuit partitioning. When the modules do not overlap, the modules are placed at different positions in the plane area of ​​the chip to obtain a module layout.

[0054] Layout planning includes circuit division and module layout. One of the goals of module layout is to find an optimal or nearly optimal layout under the conditions of satisfying chip area constraints and density constraints, so that the sum of the lengths of interconnection lines between all modules (referred to as interconnection line length) is as small as possible.

[0055] As mentioned above, existing technologies, such as simulated annealing, genetic algorithm, particle swarm optimization algorithm, analytical method, etc., require multiple iterations and long processing time to obtain a converged solution, that is, an ideal module layout result.

[0056] To this end, the present invention constructs a module layout model based on a variational graph neural network. The model learns the mapping relationship between the interconnection structure between modules in the chip and the interconnection bus length of the optimal module layout. The real circuit is input into the trained model, and the model infers and decodes the position information of each module with the optimal module layout based on the previously learned mapping relationship.

[0057] The training and learning of the model takes some time, but it can be done offline. Using the trained model for online applications does not require tedious iterative calculations compared to existing technologies, which improves the efficiency of module layout.

[0058] In order to fully train the model and output an optimal or approximately optimal module layout, the present invention also provides a method for generating a training data set with an optimal module layout.

[0059] This is explained in detail below.

[0060] In one embodiment of the present invention, Figure 1 As shown, a chip layout planning method based on graph neural network includes:

[0061] Step S100 generates a training data set.

[0062] Each sample of the training data set corresponds to an optimal module layout, and each sample includes the interconnection information between modules and the position information of each module in the optimal module layout corresponding to the sample. The optimal module layout is the layout with the shortest interconnection bus length among all module layouts that meet the interconnection information between modules.

[0063] The interconnection information between modules can be expressed in many forms, for example, including the number of connections between any two modules. If the number of connections is 0, it means that there is no neighbor relationship between the two modules; it can also include whether there is a connection between the modules and the number of connections between the two modules with connections. The connection between two modules with a large number of connections is closer than that between two modules with a small number of connections. In short, the interconnection information between modules not only reflects the neighbor relationship between modules, but also reflects the closeness of the connection between modules.

[0064] The position information of the module refers to the position information of the module in the plane area of ​​the chip, for example, expressed by two-dimensional coordinates in a reference coordinate system.

[0065] The sum of the lengths of interconnection lines between all modules in a layout is recorded as the interconnection bus length. For the same module interconnection information, there are multiple module layouts, and the module layout with the shortest interconnection bus length is the optimal module layout.

[0066] Excellent layout planning data can be collected from practical applications and processed to obtain the required samples; new samples can be expanded based on the obtained samples, such as using graphic transformation technology; and the required samples can also be simulated and generated.

[0067] Step S200 constructs a module layout model;

[0068] Step S300 uses the training data set to train the module layout model to obtain a trained module layout model.

[0069] Specifically, the module layout model is constructed based on the variational graph auto-encoder (VGAE) framework. The variational graph auto-encoder is a graph neural network that includes an encoder and a decoder. Figure 4 As shown, its working principle is as follows Figure 6 shown.

[0070] The input of the model includes the interconnection information between modules, such as Figure 6 The output of the model is the location information of each module in the module layout corresponding to the interconnection information, that is, Figure 6 of The encoder encodes the interconnection information between modules (i.e., the circuit interconnection structure at the module level) into a distribution in a latent space, which is approximated by a Gaussian distribution (u X is the mean of the distribution, σ X is the variance of the distribution); the decoder randomly extracts samples from the latent space to obtain a variable Z, and predicts the position information (such as two-dimensional coordinate information) of each module in the module layout corresponding to the interconnection information according to the variable Z.

[0071] The input of the encoder is the adjacency matrix A and the feature matrix F. The adjacency matrix A is a specific expression of the interconnection information between modules, and its elements w ij is the number of connections between module i and module j. If there is no connection between module i and module j, then w ij is equal to 0. The matrix F is composed of the feature vectors of each module (also called nodes), and the feature vector of each node is represented by a one-hot code.

[0072] The encoder is a graph reasoning encoder that is composed of a fusion of variational reasoning and a two-layer variational graph neural network, such as Figure 6 As shown, the first layer is a common graph neural network GNN, and the second layer is two different graph neural networks h and g. The mean u of the latent space distribution is obtained through the graph neural network g. X, the variance σx of the latent space distribution is obtained through the graph neural network h. In order to standardize the output of the latent space distribution, a regular term is added to the hidden layer, requiring the latent space distribution law to be as consistent as possible with the standard Gaussian distribution N(0,1). The evaluation method is the KL divergence between the latent space distribution and the Gaussian distribution (that is, the similarity between the latent space distribution calculated by the encoder and the Gaussian distribution).

[0073] By introducing the variational mechanism and using distribution to describe the expression of the entire latent space, the generalization ability of the model is improved.

[0074] The decoder is composed of a multi-layer perceptron. The decoder predicts the module layout corresponding to the interconnection information according to the variable Z, specifically the predicted position information of each module under the module layout.

[0075] Since the ideal position information of each module in the training data (i.e., the position information corresponding to the optimal module layout) is known, the reconstruction loss between the optimal module layout of the sample and the module layout predicted by the model can be evaluated based on the ideal position information and predicted position information of each module.

[0076] During the model training process, the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample is calculated; the KL divergence between the distribution of the latent space and the Gaussian distribution is calculated; the reconstruction loss and the KL divergence are combined into the loss function of the module layout model. The model training process is to continuously optimize the model parameters to minimize the loss function value. The model obtained by using the parameters that minimize the loss function value is the trained model.

[0077] It can be seen that, unlike traditional VGAE (which is unsupervised learning), the present invention organically combines supervised learning with VGAE, and carries label information in the training samples. The label information is the relative distance information between modules obtained based on the position information of each module in the optimal module layout. By learning the training samples, the model can output a module layout that is close to the optimal module layout in the sample.

[0078] Step S400 divides the circuit of the target chip according to the circuit netlist of the target chip to obtain all modules and the interconnection information between the modules.

[0079] Step S500 determines the position of each module in the target chip using the trained module layout model according to the interconnection information between the modules.

[0080] In this embodiment, a module layout model is constructed based on a variational graph neural network, and a training data set with an optimal module layout is used to train the model so that the model learns the mapping relationship between the interconnection information between modules in the chip and the interconnection bus length of the optimal module layout. The real circuit is input into the trained model, and the model decodes the position information of each module with the optimal module layout based on the previously learned mapping relationship. By using the trained model for practical applications, the processing time can be shortened and the module layout efficiency can be improved.

[0081] In one embodiment, the generation of each sample of the training data set in step S100 includes:

[0082] Step S110 obtains the number of modules n, the number of neighbors of each module, and the number of connections from each module to each neighbor;

[0083] Step S120 creates an empty chip area, and evenly divides the chip area into a corresponding number of sub-areas according to the number of modules n, each sub-area representing a module;

[0084] Step S130 traverses all modules and performs the following operations on each module: starting from the nearest surrounding module, all neighbors of the module are determined in order of increasing distance, and the number of connections allocated to each neighbor by the module is allocated according to the rule that the closer the neighbor is, the more connections are allocated.

[0085] Specifically, it is difficult to obtain ideal module layout data in real environments. First, it is difficult to prove that the obtained module layout data is optimal. Second, even if some optimal data is obtained, it is difficult to support the training of deep learning models due to the lack of data. To this end, we propose a method to obtain simulated optimal module layout data.

[0086] When creating an optimal module layout dataset, the following points must be ensured:

[0087] Condition 1. The mapping between the interconnection information between modules and the interconnection bus length of the module layout is optimal.

[0088] Condition 2: There is no overlap between modules.

[0089] For example:

[0090] Input: The number of modules is 9. The number of neighbors of each module and the number of connections from each module to each neighbor are shown in Table 1, where the number of neighbors of each module and the number of connections from each module to each neighbor determine the interconnection information between modules:

[0091] Table 1

[0092] Modules Number of neighbors The number of connections the module has to each neighbor 1 3 10、11、12 2 2 6、4 3 1 4 4 2 7、10 ... ... ...

[0093] The position of each module is determined by step S120, for example, as shown in Table 2. By making certain adjustments to Table 2, such as exchanging the third column with the second column of Table 2, a new module position deployment can be obtained. In short, the position of the module can be determined arbitrarily, and the present invention does not limit this. This embodiment is analyzed according to Table 2. Obviously, the condition of no overlap between modules is met.

[0094] Table 2

[0095] Module 1 Module 2 Module 3 Module 4 Module 5 Module 6 Module 7 Module 8 Module 9

[0096] To meet condition 1, we must ensure that: the closer the distance between modules, the more connections are allocated between modules, that is, the number of connections between modules that are close is greater than the number of connections between modules that are far away. To this end, the distance between the module and its surrounding modules is divided into different levels. The higher the level, the farther the distance between the modules. The first layer area includes the four areas of the top, bottom, left and right of the module, with a distance of 1 unit. In order to meet the shortest interconnection bus length, the modules in these four directions should be allocated the most connections. The second layer area includes the four areas of the upper left corner, upper right corner, lower left corner, and lower right corner of the module, with a distance of The distance between the first layer area and this module is smaller than the distance between the second layer area and this module, the distance between the second layer area and this module is smaller than the distance between the third layer area and this module, and so on. The distances between each module and this module in the same layer area are equal.

[0097] Taking Table 2 as an example, the first layer area of ​​module 5 includes modules 2, 4, 6, and 8, and the second layer area includes modules 1, 3, 7, and 9. If the number of modules is greater, module 5 will also have a third layer area, a fourth layer area, and so on.

[0098] Neighbor determination rule for the module: first select the first layer area. If the first layer area is full and cannot meet the neighbor number requirement, then select the second layer area, and so on, until the neighbor number requirement is met.

[0099] When the neighbors of the module are determined, the number of connections is allocated to each neighbor according to the rule that the closer the neighbor is, the more connections are allocated.

[0100] Continuing with the above example, the module's neighbors and the number of connections assigned to each neighbor are as follows:

[0101] Table 3

[0102] Modules Number of neighbors The number of connections the module has to each neighbor Neighbor The number of connections allocated to the neighbor Updated number of connections 1 3 10、11、12 2、4、5 2(12)、4(11)、5(10) 2(9)、4(11)、5(10) 2 2 6、4 1、3 1(6)、3(4) 1(9)、3(4) 3 1 4 2 2(4) 2(4) 4 2 7、10 1、7 1(10)、7(7) 1(11)、7(7) ... ... ... ... ... ...

[0103] Take module 1 as an example. Its number of neighbors is 3. First, select its first-layer region and take modules 2 and 4 as its neighbors. Then select the second-layer region, which only has module 5, and take module 5 as its neighbor. So far, the requirement of the number of neighbors of module 1 is met. If the number of neighbors of module 1 is 4, you need to select a region from the third-layer region (including module 7 and module 3) as a neighbor.

[0104] As shown in Table 3, the neighbors of module 1 are determined to be modules 2, 4, and 5. Modules 2 and 4 belong to the first layer area, and module 5 belongs to the second layer area, so the number of connections allocated to module 2 or 4 is greater than that of module 5. The number of connections from module 1 to each neighbor is 10, 11, and 12, so the number of connections 11 and 12 need to be allocated to module 2 or 4, and the number of connections 10 is allocated to module 5. Modules 2 and 4 belong to the same layer, and the number of connections 12 can be arbitrarily allocated to one of them.

[0105] All modules are processed in the above manner, and at this point, the determination of neighbors of all modules and the number of connections to each neighbor are completed.

[0106] The fifth column of Table 3 is only one allocation method that meets condition 1. There may be other methods as long as they meet condition 1.

[0107] From the fifth column of Table 3, we can see that when module 1 is processing, 11 connections are allocated from module 1 to module 4; when module 4 is processing, 10 connections are allocated from module 4 to module 1. There is inconsistency. Therefore, the number of connections between the two modules is updated according to the following rules:

[0108] If the number of connections allocated from module A to module B is n, and the number of connections allocated from module B to module A is m, then the number of connections between module A and module B is adjusted to (n+m) / 2.

[0109] The fifth column of Table 3 is processed according to the above rules to obtain the sixth column of Table 3. According to the sixth column of Table 3, the final interconnection relationship between modules is obtained. Table 2 is the optimal module layout corresponding to this interconnection relationship. According to Table 2, the position information of each module is obtained. So far, a sample with an optimal module layout is generated.

[0110] Adjusting the input parameters, or adjusting the selection of neighbors, or adjusting the distribution of the number of connections can produce more samples with optimal module layouts.

[0111] In one embodiment, obtaining the number of neighbors of each module and the number of connections from each module to each neighbor in step S110 includes:

[0112] Step S111 sets the distribution of the number of neighbors of the module and the distribution of the number of connections of the module;

[0113] Step S112 determines the number of neighbors of each module according to the distribution of the number of neighbors of the module;

[0114] Step S113 determines the total number of connections of each module according to the connection number distribution of the modules;

[0115] Step S114 decomposes the total number of connections of each module into a corresponding number of integers according to the number of neighbors of the module, the sum of the integers is equal to the total number of connections of the module, and the obtained integer is used as the number of connections from the module to each neighbor.

[0116] Specifically, considering the actual needs, when constructing the training data set, the input parameters are adjusted to the distribution of the number of neighbors of the module and the distribution of the number of connections of the module, and this distribution can be specified by the user.

[0117] The distribution of neighbor numbers refers to the number of modules with neighbor number i or the proportion of modules, i = 1, 2, 3, ..., the number of modules n; the distribution of module connections refers to the number of connections with connection number j or the proportion of connections, j = 1, 2, ..., the total number of connections. Figure 5 As shown, the left figure is an example of the distribution rule of the number of neighbors of a module, and the right figure is an example of the distribution rule of the number of connections of a module.

[0118] Step S112 can determine the number of neighbors of each module by the following operations:

[0119] For example, the number of neighbors of a module is distributed as follows:

[0120] Number of neighbors 1 2 3 4 … 12 … Module number ratio 0% 1.5% 2% 10% … 15% …

[0121] Assuming that the number of modules is 16, the neighbor number distribution rule is converted into a random number generation rule, and random integers are generated between 1 and 16. The generation rule is: the probability of 1 appearing is 0%, the probability of 2 appearing is 1.5%... Assuming that the 16 random integers obtained are [3,1,5,7...], it can be considered that the number of neighbors of module 1 is 3, the number of neighbors of module 2 is 1, the number of neighbors of module 3 is 5, etc. Since it is randomly generated, each operation will generate a different arrangement of random integers, but the proportion of integer 3 appearing is 2%, and the proportion of integer 1 appearing is 0%.

[0122] Step S113 can determine the total number of connections of each module using a method similar to step S112. The module connection number distribution rule is converted into a random number generation rule. Assuming there are 500 connections in total, the distribution probability of the connection number 1-500 becomes the generation probability of the random number 1-500, and a set of random integers is obtained, such as [11, 15, 20, ...], then the total number of connections of module 1 can be considered to be 11, the total number of connections of module 2 can be considered to be 15, and so on.

[0123] Step S114 is used to determine the number of connections from the module to its neighbors. Assuming that module 1 has 11 connections in total and needs to be distributed to 3 neighbors, 11 can be randomly decomposed or decomposed into 3 integers according to a certain rule, such as 5, 4, and 2, and these numbers are used as the number of connections from module 1 to the 3 neighbors.

[0124] In one embodiment, the calculation of the reconstruction loss in the loss function of the module layout model in step S300 includes:

[0125] The two modules that are interconnected are regarded as a module pair;

[0126] Select a module pair, calculate the distance between the two modules in the module pair according to the position information of the two modules in the module layout predicted by the module layout model, and record it as the predicted distance of the module pair;

[0127] Calculate the distance between the two corresponding modules according to their position information in the sample, and record it as the target distance of the module pair;

[0128] Calculate the distance difference of the module pair according to the predicted distance and the target distance of the module pair;

[0129] Calculate the distance difference of all module pairs in the sample; according to the distance difference of all module pairs, obtain the reconstruction loss.

[0130] In one embodiment, the distance differences of all module pairs are accumulated and then divided by the number of modules, and the result is used as the reconstruction loss.

[0131] In some embodiments, the maximum value, median value or average value of the distance differences of all module pairs is selected as the reconstruction loss. Other physical quantities that can reflect the reconstruction loss may also be used, and there is no limitation on this.

[0132] In one embodiment, step S400 divides the circuit of the target chip according to the circuit netlist of the target chip to obtain all modules and interconnection information between the modules, including:

[0133] Step S410: grouping the units in the circuit netlist using a spectral clustering algorithm according to the connection relationship between the units in the circuit netlist, and treating each obtained group as a module;

[0134] Step S420 determines the interconnection information between modules according to the circuit netlist.

[0135] Specifically, the spectral clustering algorithm is a point-to-point clustering algorithm based on the spectral graph theory of graph theory. It can cluster on sample spaces of arbitrary shapes. It transforms the clustering problem into the optimal partitioning problem of the graph, and can make the partitioning result of the graph achieve a balance between the minimum cut edge and uniform partitioning.

[0136] The spectral clustering algorithm is used to group the cells in the circuit netlist, including:

[0137] Step S411 obtains the corresponding adjacency matrix according to the connection relationship between each unit in the circuit netlist, where the element w of the adjacency matrix is ij is the number of connections between unit i and unit j;

[0138] Step S412 calculates the Laplacian matrix corresponding to the adjacency matrix;

[0139] Step S413 calculates the eigenvector corresponding to the second smallest eigenvalue of the Laplacian matrix;

[0140] Step S414 clusters all units according to the feature vector using K-means or other classical clustering algorithms, and regards each obtained group as a module.

[0141] A circuit netlist is a description of a circuit. After the circuit is divided by the spectral clustering algorithm, the number of connections between any two modules can be determined based on the circuit netlist. The interconnection information between modules can be obtained based on the number of connections between all modules.

[0142] For this embodiment, the minimum cut edge sum means that the sum of the connection weights between the modules obtained after cutting is the smallest. In this embodiment, the connection weights between the modules are the number of connections between the modules; uniform segmentation means that the modules obtained after cutting contain a similar number of units, which can ensure that the module sizes are not much different and remain consistent with the module sizes in the training data set.

[0143] The spectral clustering algorithm can achieve a balance between minimum cut edge and uniform segmentation. However, as the size of the graph increases and the number of modules to be segmented increases, the algorithm requires a very long computation time. In order to retain the advantages of spectral clustering while improving the speed of the algorithm, we improved the spectral clustering algorithm and proposed the C-spectral clustering algorithm.

[0144] In one embodiment, the C-spectral clustering algorithm is specifically as follows:

[0145] Step S430 obtains a corresponding hypergraph according to the circuit netlist, wherein the units of the circuit netlist are used as nodes of the hypergraph, and the wire nets of the circuit netlist are used as hyperedges of the hypergraph;

[0146] Step S440 starts from the hyperedge with the largest hyperedge degree, traverses all hyperedges in descending order of hyperedge degree, merges all unprocessed nodes on a hyperedge into a submodule, and then processes the next hyperedge. The next hyperedge corresponds to a new submodule, and the cycle continues until all nodes are processed; the hyperedge degree is the number of nodes on the corresponding hyperedge;

[0147] Step S450 obtains interconnection information between submodules according to the circuit netlist;

[0148] Step S460: grouping the submodules using a spectral clustering algorithm according to the interconnection information between the submodules, and treating each obtained group as a module;

[0149] Step S470 determines the interconnection information between modules according to the interconnection information between sub-modules; and takes all modules and the interconnection information between modules as the final circuit division result.

[0150] Specifically, fusing the nodes of a hyperedge into a submodule means that all the units of the circuit corresponding to the nodes of the hyperedge form a submodule. If the same node appears in multiple hyperedges, the node is attributed to the node fusion of the hyperedge that appears first.

[0151] Examples, such as Figure 7 As shown, the circuit has 7 units, namely U1 to U7, which constitute the 7 nodes of the hypergraph. The correspondence between the line network and the hyperedge is as follows:

[0152]

[0153]

[0154] According to the descending order of hyperedge degree, assuming that the order in the above table is followed, the nodes of hyperedge 1 are fused, and units U1, U2, and U4 are combined into sub-module A; then the nodes of hyperedge 2 are fused, because U2 and U4 have been fused in sub-module A, only one node U5 is left, and U5 is set as sub-module B alone; then the nodes of hyperedge 3 are fused, and nodes U3 and U6 are left, and U3 and U6 are combined into sub-module C; then the nodes of hyperedge 4 are fused, and only node U7 is left, and U7 is set as sub-module D; and so on, the fusion processing of nodes on all hyperedges is completed, and finally 4 sub-modules A to D are obtained.

[0155] The core of the C-spectral clustering algorithm is to quickly complete the first circuit division and obtain sub-modules through bottom-up hypergraph coarse-graining (corresponding to steps S430 to S450); then use the spectral clustering algorithm to perform the second circuit division based on the first circuit division, which improves the speed of circuit division while retaining the segmentation advantage of spectral clustering.

[0156] In one embodiment, after obtaining the module in step S470, the method further includes:

[0157] Step S480 traverses all modules, extracts macro units from the modules with macro units, takes each macro unit as a new module, and updates the modules with macro units to modules without macro units;

[0158] Step S490 determines the interconnection information between the updated modules according to the circuit netlist.

[0159] Specifically, in an integrated circuit, a macro cell is a cell that is larger in size than a standard cell. Generally, it is necessary to separate it, so the macro cell is extracted from the module and processed as an independent module. For this reason, the decomposition of the module has changed, so the interconnection information between the modules needs to be updated.

[0160] In one embodiment of the present invention, Figure 2 As shown, a chip layout planning device based on graph neural network includes:

[0161] The sample generating unit 100 is used to generate a training data set, each sample of the training data set corresponds to an optimal module layout, and the sample includes the interconnection information between modules and the position information of each module in the corresponding optimal module layout; the optimal module layout is the layout with the shortest interconnection bus length among all module layouts that meet the interconnection information between modules;

[0162] The model construction unit 200 is used to construct a module layout model based on a variational graph autoencoder framework, wherein the variational graph autoencoder includes an encoder and a decoder, wherein the encoder encodes the interconnection information between the input modules into a distribution in a latent space, and the decoder predicts the position information of each module in the module layout corresponding to the interconnection information between the input modules based on samples extracted from the latent space;

[0163] The training unit 300 is used to train the module layout model with the training data set to obtain a trained module layout model; the training unit 300 includes: calculating the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample; calculating the KL divergence between the distribution of the latent space and the Gaussian distribution; combining the reconstruction loss and the KL divergence into a loss function of the module layout model;

[0164] A circuit partitioning unit 400 is used to partition the circuit of the target chip according to the circuit netlist of the target chip to obtain all modules and interconnection information between the modules;

[0165] The module layout unit 500 is used to determine the position of each module in the target chip according to the interconnection information between the modules using the trained module layout model.

[0166] In one embodiment, the sample generation unit 100 includes:

[0167] A sample parameter acquisition unit, used to obtain the number of modules n, the number of neighbors of each module, and the number of connections from each module to each neighbor;

[0168] The module establishment unit is used to create an empty chip area and evenly divide the chip area into a corresponding number of sub-areas according to the number of modules n, each sub-area represents a module;

[0169] The allocation unit is used to traverse all modules and perform the following operations on each module: starting from the nearest peripheral module, all neighbors of the module are determined in order of increasing distance, and the number of connections allocated from the module to each neighbor is allocated according to the rule that the closer the neighbor is, the more connections are allocated.

[0170] In one embodiment, the sample parameter acquisition unit is further used for:

[0171] Set the distribution of the number of neighbors of the module and the distribution of the number of connections of the module; determine the number of neighbors of each module according to the distribution of the number of neighbors of the module; determine the total number of connections of each module according to the distribution of the number of connections of the module; decompose the total number of connections of each module into a corresponding number of integers according to the number of neighbors of the module, the sum of the integers is equal to the total number of connections of the module, and use the obtained integer as the number of connections from the module to each neighbor.

[0172] In one embodiment, the training unit 300 is further configured to:

[0173] Two modules with an interconnected relationship are regarded as a module pair; a module pair is selected, and the distance between them is calculated according to the position information of the two modules contained in the module pair in the module layout predicted by the module layout model, and it is recorded as the predicted distance of the module pair; the distance between the corresponding two modules in the sample is calculated according to the position information of the two modules, and it is recorded as the target distance of the module pair; the distance difference of the module pair is calculated according to the predicted distance and the target distance of the module pair; the distance difference of all module pairs in the sample is calculated; and the reconstruction loss is obtained according to the distance difference of all module pairs.

[0174] In one embodiment, the circuit division unit 400 is further configured to:

[0175] According to the connection relationship between each unit in the circuit netlist, the spectral clustering algorithm is used to group the units in the circuit netlist, and each obtained group is regarded as a module; the interconnection information between the modules is determined according to the circuit netlist.

[0176] In one embodiment, the circuit division unit 400 is further configured to:

[0177] A corresponding hypergraph is obtained according to the circuit netlist, wherein the units of the circuit netlist are used as nodes of the hypergraph, and the wire nets of the circuit netlist are used as hyperedges of the hypergraph;

[0178] Starting from the hyperedge with the largest hyperedge degree, traverse all hyperedges in descending order of hyperedge degree, merge all unprocessed nodes on a hyperedge into a submodule, and then process the next hyperedge. The next hyperedge corresponds to a new submodule, and the cycle continues until all nodes are processed; the hyperedge degree is the number of nodes on the corresponding hyperedge;

[0179] The interconnection information between sub-modules is obtained according to the circuit netlist; the sub-modules are grouped using a spectral clustering algorithm according to the interconnection information between sub-modules, and each obtained group is used as a module; the interconnection information between modules is determined according to the interconnection information between sub-modules; all modules and the interconnection information between modules are used as the result of the final circuit division.

[0180] In one embodiment, the circuit division unit 400 is further configured to:

[0181] After obtaining the module, the method also includes: traversing all modules, extracting macro cells from the modules with macro cells, treating each macro cell as a new module, and updating the modules with macro cells to modules without macro cells; and determining the interconnection information between the updated modules according to the circuit netlist.

[0182] It should be noted that the embodiment of the chip layout planning device based on graph neural network provided by the present invention and the embodiment of the chip layout planning method based on graph neural network provided above are based on the same inventive concept and can achieve the same technical effect. Therefore, other specific contents of the embodiment of the chip layout planning device based on graph neural network can refer to the contents of the embodiment of the chip layout planning method based on graph neural network.

[0183] In one embodiment of the present invention, Figure 3 As shown, an electronic device includes a memory 21 and a processor 22;

[0184] A memory 21 for storing a computer program 23;

[0185] The processor 22 is used to implement the chip layout planning method based on graph neural network as described above when executing the computer program 23.

[0186] As required, the computing device may also include input and output devices, display devices, network access devices and buses, etc.

[0187] In one embodiment of the present invention, a computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, a chip layout planning method based on a graph neural network as described in the aforementioned embodiment can be implemented. That is, when part or all of the technical solutions that contribute to the prior art in the aforementioned embodiment of the present invention are embodied in the form of a computer software product, the aforementioned computer software product is stored in a computer-readable storage medium. The computer-readable storage medium can be any physical device or equipment that can carry a computer program code. For example, a computer-readable storage medium can be a USB flash drive, a mobile disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, and the like.

[0188] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A chip layout planning method based on graph neural network, characterized in that: include: Generate a training data set, each sample of the training data set corresponds to an optimal module layout, and the sample includes interconnection information between modules and position information of each module in the corresponding optimal module layout; the optimal module layout is a layout with the shortest interconnection bus length among all module layouts that meet the interconnection information between the modules; A module layout model is constructed based on a variational graph autoencoder framework, wherein the variational graph autoencoder includes an encoder and a decoder, wherein the encoder encodes the interconnection information between input modules into a distribution in a latent space, and the decoder predicts the position information of each module in the module layout corresponding to the interconnection information between the input modules based on samples extracted from the latent space; The module layout model is trained with the training data set to obtain a trained module layout model; the method includes: calculating the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample; calculating the KL divergence between the distribution of the latent space and the Gaussian distribution; combining the reconstruction loss and the KL divergence into a loss function of the module layout model; Performing circuit division on the target chip according to the circuit netlist of the target chip to obtain all modules and interconnection information between the modules; According to the interconnection information between the modules, the position of each module in the target chip is determined using the trained module layout model.

2. The chip layout planning method based on graph neural network according to claim 1 is characterized in that: The generation of each sample of the training data set includes: Get the number of modules n, the number of neighbors of each module, and the number of connections from each module to each neighbor; Create an empty chip area, and evenly divide the chip area into a corresponding number of sub-areas according to the number of modules n, each sub-area representing a module; Traverse all modules and perform the following operations on each module: starting from the nearest surrounding module, determine all neighbors of the module in order of increasing distance, and allocate the number of connections from the module to each neighbor according to the rule that the closer the neighbor, the more connections are allocated.

3. The chip layout planning method based on graph neural network according to claim 2 is characterized in that: The step of obtaining the number of neighbors of each module and the number of connections from each module to each neighbor includes: Set the distribution of the number of neighbors and the number of connections of the module; Determining the number of neighbors of each module according to the distribution of the number of neighbors of the module; Determining the total number of connections for each module according to the distribution of the number of connections of the modules; The total number of connections of each module is decomposed into a corresponding number of integers according to the number of neighbors of the module, the sum of the integers is equal to the total number of connections of the module, and the obtained integer is used as the number of connections from the module to each neighbor.

4. The chip layout planning method based on graph neural network according to claim 1 is characterized in that: The circuit division of the target chip according to the circuit netlist of the target chip to obtain all modules and interconnection information between the modules includes: According to the connection relationship between each unit in the circuit netlist, the units in the circuit netlist are grouped by using a spectral clustering algorithm, and each obtained group is regarded as a module; The interconnection information between the modules is determined according to the circuit netlist.

5. The chip layout planning method based on graph neural network according to claim 4 is characterized in that: The spectral clustering algorithm is used to group the units in the circuit netlist, and each obtained group is used as a module, including: Obtaining a corresponding hypergraph according to the circuit netlist, wherein the units of the circuit netlist are used as nodes of the hypergraph, and the wire nets of the circuit netlist are used as hyperedges of the hypergraph; Starting from the hyperedge with the largest hyperedge degree, traverse all hyperedges in descending order of hyperedge degree, merge all unprocessed nodes on a hyperedge into a submodule, and then process the next hyperedge. The next hyperedge corresponds to a new submodule, and the cycle continues until all nodes are processed; Obtaining interconnection information between the submodules according to the circuit netlist; According to the interconnection information between the submodules, the submodules are grouped using a spectral clustering algorithm, and each obtained group is regarded as a module.

6. The chip layout planning method based on graph neural network according to claim 5 is characterized in that: After getting the module, it also includes: Traversing all modules, extracting macro units from the modules with macro units, treating each macro unit as a new module, and updating the modules with macro units to modules without macro units; The interconnection information between the updated modules is determined according to the circuit netlist.

7. The chip layout planning method based on graph neural network according to claim 1 is characterized in that: The calculating of the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample specifically includes: The two modules that are interconnected are regarded as a module pair; Select a module pair, calculate the distance between the two modules included in the module pair according to the position information of the two modules in the module layout predicted by the module layout model, and record it as the predicted distance of the module pair; Calculate the distance between two modules according to their position information in the sample, and record it as the target distance of the module pair; Calculating the distance difference of the module pair according to the predicted distance and the target distance of the module pair; Calculating the distance differences of all module pairs in the sample; The reconstruction loss is obtained according to the distance differences of all module pairs.

8. A chip layout planning device based on graph neural network, characterized in that: include: A sample generating unit is used to generate a training data set, each sample of the training data set corresponds to an optimal module layout, and the sample includes interconnection information between modules and position information of each module in the corresponding optimal module layout; the optimal module layout is a layout with the shortest interconnection bus length among all module layouts that meet the interconnection information between the modules; A model construction unit, for constructing a module layout model based on a variational graph autoencoder framework, wherein the variational graph autoencoder comprises an encoder and a decoder, wherein the encoder encodes the interconnection information between the input modules into a distribution in a latent space, and the decoder predicts the position information of each module in the module layout corresponding to the interconnection information between the input modules based on samples extracted from the latent space; A training unit, used for training the module layout model with the training data set to obtain a trained module layout model; The method includes: calculating the reconstruction loss between the module layout predicted by the module layout model for the interconnection information between modules of each sample in the training data set and the optimal module layout corresponding to the sample; calculating the KL divergence between the distribution of the latent space and the Gaussian distribution; combining the reconstruction loss and the KL divergence into a loss function of the module layout model; A circuit division unit, used for performing circuit division on the circuit of the target chip according to the circuit netlist of the target chip, and obtaining all modules and interconnection information between the modules; The module layout unit is used to determine the position of each module in the target chip according to the interconnection information between the modules using the trained module layout model.

9. An electronic device, characterized in that: include: Memory for storing computer programs; The processor is used to implement the chip layout planning method based on graph neural network described in any one of claims 1 to 7 when executing the computer program stored in the memory.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the chip layout planning method based on graph neural network described in any one of claims 1 to 7 is implemented.