The present invention relates to the field of electronic design automation technologies, and in particular, to a chip placement method and apparatus, an electronic device and a storage medium.
Placement of integrated circuit chips in various applications may involve placing millions of circuit modules on a 2D chip canvas or circuit board. Such placement is time-consuming and expensive because it requires the involvement of hardware experts in order to achieve better chip performance, e.g., avoiding long circuit paths between chip modules. Deep learning technology employing neural networks can be applied to overcome such difficulties. Due to the chip placement problem having domain characteristics, original features need to be pre-processed to obtain various masks before inputting data into the neural network. The neural network can learn is the location of the most suitable position for the module to be placed according to the current state of the design. In this process, different convolutional kernel sizes in the neural network can extract local and global features.
Prior techniques for chip placement include Lin et al., “DREAMPlace: Deep Learning Toolkit-Enabled GPU Acceleration for Modern VLSI Placement, IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, 40(4), 748-761, which is a classic optimization-based method (not a learning-based method). The article Mirhoseini et al., “A graph placement methodology for fast chip design,” Nature, 2021, 594(7862):207-212 describes a graphical neural network-based method. However; it cannot satisfy the no-overlapping constraint for chip placement. The article, Yan et al., “Towards Machine Learning for Placement and Routing in Chip Design: a Methodological Overview,” arXiv:2202.13564 (2022) presents a detailed review of recent advance in machine learning for placement and routing. However, it does not include a design method for generating position masks and wire masks. The article Alhyari et al., “A Deep Learning Framework to Predict Routability for FPGA Circuit Placement,” 2019 29th International Conference on Field Programmable Logic and Applications (FPL), Barcelona, Spain, 2019, pp. 334-341, doi:10.1109/FPL.2019.00060 discusses a novel, deep-learning framework based on a Convolutional Neural Network model for predicting the routability of a placement that incorporates the deep-learning model into a state-of-the-art placement tool, and shows how the model can be used to (1) avoid costly, but futile, place-and-route iterations, and (2) improve the placer's ability to produce routable placements for hard-to-route circuits using feedback based on routability estimates generated by the proposed model. The task of the method is to predict routability given a known placement plan, which is not suitable for generating a placement plan.
The present invention is directed to the field of computer vision, communication, and particularly relates to electronic design automation, including but not limited to a chip placement method and device, a computer device and a storage medium. The invention provides a chip placement method that facilitates the placement of thousands of modules on a chip canvas with high performance and efficiency. It extracts features of the chip modules and generates various masks which can contain information for the placement of the modules and determines place positions from these masks by convolutional neural networks.
A first aspect of an embodiment of the invention provides a chip placement method, which may include the following operations:
A second aspect of an embodiment of the invention provides a chip placement apparatus, which includes a processor and a memory for storing instructions executable by the processor. The processor is configured to perform the operations of the chip placement method.
A third aspect of an embodiment of the invention provides a storage medium, having stored therein computer instructions that, when being executed by a processor, cause the processor to implement the operations of the chip placement method.
The invention provides better chip placement performance and meets chip design constraints. The diverse masks used with the invention can help neural networks obtain essential information for placement and satisfy constraints on placement. Multi-scale feature extraction can avoid the diffusion of location information. A reward design scheme is employed to avoid sparse rewards that are difficult to train. Chips placed according to the invention have better performance (shorter wirelength) and meet constraints that are difficult to meet with other methods (e.g., no module overlap in the design).
The foregoing and other objects and advantages of the present invention will become more apparent when considered in connection with the following detailed description and appended drawings in which like designations denote like elements in the various views, and wherein:
In order to make the purposes, technical solutions and advantages of the embodiments of the invention clearer, specific technical solutions of the invention will further be described in detail below in combination with the drawings of the embodiments of the invention. The following embodiments are adopted to describe the invention but are not intended to limit the scope of the invention.
The present invention includes a chip placement method, which enables the user to select the most suitable location (position) for each chip module, so that chip performance can be optimized and at the same time, the design can comply with chip design constraints. The method is applied by means of a computer device, and the functions realized by the method may be realized by calling a program code through a processor in the computer device. Of course, the program code may be stored in a computer storage medium. Thus, the computer device at least includes the processor and the storage medium.
As shown in
In step S101, the features of the modules to be placed are acquired, including the number of pins (nets) (f1) and modules (f2) they are connected to, and their area (f3). The operation of step S101 may be implemented by a computer device.
In step S102, a score is calculated for each module by the weighted sum of normalized features. The score equals α1f1+α2f2 +α3f3, where α1,α2,α3 are definable weights of each feature.
In step S103, a sorting algorithm is implemented on the scores achieved in step S102. The order of the scores from largest to smallest determines the order of the placement of the modules.
A third embodiment of the invention provides a chip placement method.
In step S201, the features of the placed modules and the next two modules to be placed are acquired, including the width, height, and position of the modules. Then, the next two modules are slid on the chip canvas. If the next module cannot overlap with existing placed modules, the corresponding position on the mask is marked as 1. Otherwise, it is marked as 0. If one module occupies more than one element in the mask, the leftmost element it occupies is marked as the status of a module as placeable or not. Then, step S201 generates two position masks for the next two modules separately. As shown in
In step S202, the features of modules to be placed are acquired, including the width, height and pin locations of the modules. All pins connected by the same wire (i.e., belong to the same net) generate a bounding box. Then, two wire masks are generated by the accumulation of the shortest distance from each element in the mask to the bounding box. Each wire mask accumulates only the bounding box of the pins to which the module is connected. As shown in
In step S203, the features of modules to be placed are acquired, including the width, height, and positions of the modules. A view mask is generated by these placed modules, and each element in the mask indicates whether the position is occupied by a module. Each module with size w×h, covers [wN/W]×[hN/H] elements in the view mask, where W and H represent the chip canvas size, ┌.┐ denotes the ceiling function and N×N represents the size of view mask. If one element is occupied by one module, the corresponding element is marked by 1 and otherwise it is marked by 0. Therefore, step S203 generates one view mask to represent the current placement status.
A fourth embodiment provides a chip placement method.
In step S301, two position masks and two wire masks are acquired. Local features of the placement status are extracted by small convolution kernels. Then, step S301 obtains a local feature map that has the same size as the position and wire masks.
In step S302, two wire masks and one view mask are acquired. Global features of the placement status are extracted by large convolution kernels. Then, step S302 obtains a global feature map that has the same size as the other masks.
In step S303, the global feature and the local feature are input in different channels and are merged by convolution layers in the channel dimension, where a convolutional layer consists of one or more channels and the number of channels is the depth of the matrices involved in the convolution. Then, the output of the neural network is normalized into a probability matrix by one softmax layer. The softmax function is used as the activation function in the output layer of neural network models that predict a multinomial probability distribution. That is, softmax is used as the activation function for multi-class classification problems where each class represents a place position in the chip placement task. Each element in the output matrix means the probability of the next macro will be placed in that position.
A fifth embodiment of the invention provides a chip placement method.
In step S401, an expected congestion threshold is acquired, which defines the maximum congestion allowed by the design.
In step S402, one position for placing the module is sampled according to the probability matrix. In this process, illegal positions that would result in overlap of chips are removed directly before the sampling process.
In step S403, the congestion is computed with the new placement design after placing the next module in the sampled position.
If the congestion is smaller than the congestion threshold, the next module is placed according to the sampled place in step S406.
Otherwise, in step S404, some positions are re-sampled uniformly and the corresponding congestion and wirelength are computed.
In step S405, the position which has the shortest wirelength while satisfying the congestion threshold limit is selected.
In step S406, the next module is placed according to the selected position.
A sixth embodiment of the invention is a chip placement method as shown in
In step S501, a policy network is randomly initialized. The input of the network is the generated masks, and the output of the network is the probability matrix of placement positions.
In step S502, some actions are taken based on the policy network. In this process, some placement designs are saved based on a reinforcement learning framework.
In step S503, the wirelength increase for each action step is computed and is saved as the reward. In detail, the reward is defined as:
reward=wirelengtht−1−wirelengtht (1)
where wirelengtht is the wirelength after placing t modules.
In step S504, gradient descent strategy is used to update the policy network based on the reward and placement action. In detail, if the placement action can receive a higher reward, the policy model should increase the probability of this action, and conversely, if the reward is lowered the probability of the action needs to be reduced.
If the parameters of the model have converged, then the training process of the policy model is finished and the results are saved for placement. Otherwise, the policy model continues to update in step S502.
The embodiments of the invention provide a chip placement device.
In the embodiment of the invention, the first acquisition module 601 includes a first extraction submodule configured to perform feature extraction on features of the chip by the use of prepossessing. Correspondingly, a pre-set parameter set includes a first hyper-parameter, a second hyper-parameter and a learning parameter.
The first calculation module 602 includes a first calculation submodule configured to calculate the final probability matrix according to the user defined hyper-parameter and learning parameter in the pre-set parameter set.
The first acquisition module 601 includes a first determination submodule configured to determine the score for each chip according to the acquired features and a second determination submodule configured to determine the placement order according to the scores computed in the first determination.
Correspondingly, the first calculation module 602 includes a first-generation submodule configured to correspondingly generate position masks, wire masks and view mask with the acquired features of modules. It further includes a first calculation submodule configured to compute the local and global feature matrix by convolution operations respectively; and a third determination submodule configured to determine the probability of placement in each position by the softmax layer based on the feature matrix.
Correspondingly, the first determination module 603 includes a fourth determination submodule configured to determine the final placement position according to the probability matrix and the user defined congestion threshold.
It is to be noted that, in the embodiments of the invention, when being implemented in the form of software function modules and sold or used as an independent product, the chip placement method may also be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the embodiments of the invention substantially, or parts making contributions to the conventional art, may be embodied in the form of a software product. The computer software product may be stored in a storage medium, including a plurality of instructions for enabling an instant messaging device (which may be a terminal and a server, etc.) to perform all or part of the method in each embodiment of the invention. The storage medium includes various media capable of storing program codes such as a U disk, a mobile hard disk, a Read Only Memory (ROM), a magnetic disk or an optical disk. As a consequence, the embodiments of the invention are not limited to any specific hardware and software combination.
Correspondingly, the embodiments of the invention provide a computer storage medium, which stores computer-executable instructions that, when being executed, cause implementation of the steps of the chip placement method provided in the embodiments of the invention.
The embodiments of the invention provide a computer device, which includes a memory and a processor. The memory is configured to store computer executable instructions. The processor is configured to execute the computer executable instructions in the memory to implement the steps in the chip placement method provided in the embodiments of the invention.
The above descriptions about the instant computer device and storage medium embodiments are similar to descriptions about the method embodiments and beneficial effects similar to those of the method embodiments are achieved. Technical details undisclosed in the instant communication device and storage medium embodiments of the invention may be understood with reference to the descriptions of the method embodiments of the invention.
It is to be understood that “one embodiment” and “an embodiment” mentioned in the whole specification mean that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the invention. Therefore, “in one embodiment” or “in an embodiment” appearing at any place in the whole specification does not always refer to the same embodiment. In addition, these specific features, structures or characteristics may be combined in one or more embodiments in any proper manner. It is to be understood that, in various embodiments of the invention, a magnitude of a sequence number of each process does not mean an execution sequence and the execution sequence of each process should be determined by its function and internal logic and should not form any limit on an implementation process of the embodiments of the invention. The sequence numbers of the embodiments of the invention are adopted not to represent superiority or inferiority of the embodiments, but only for description.
It is to be noted that terms “include” and “comprise” or any other variant thereof are intended to cover nonexclusive inclusions herein, so that a process, method, object or device including a series of elements not only includes those elements but also includes other elements which are not clearly listed or further includes elements intrinsic to the process, the method, the object or the device. Without more limitations, an element defined by the statement “including a/an” does not exclude the existence of the same other elements in a process, method, object or device including the element.
In some embodiments provided by the invention, it is to be understood that the disclosed device and method may be implemented in another manner. The device embodiment de scribed above is only schematic, and for example, division of the units is only logic function division, and other division manners may be adopted during practical implementation. For example, multiple units or components may be combined or integrated into another system, or some characteristics may be neglected or not executed. In addition, coupling, direct coupling or communication connection between various displayed or discussed components may be indirect coupling or communication connection, implemented through some interfaces of the device or the units, and may be electrical and mechanical or adopt other forms.
The units described as separate parts may or may not be physically separated, and parts displayed as units may or may not be physical units, namely they may be located in the same place, or may also be distributed to multiple network units. Part or all of the units may be selected according to a practical requirement to achieve the purposes of the solutions of the embodiments.
In addition, various functional units in each embodiment of the invention may be integrated into a processing unit, or serve as an independent unit, and two or more units may also be integrated into a unit. The integrated unit may be implemented in a hardware form or may be implemented in the form of hardware and software functional units.
Those of ordinary skill in the art should know that all or part of the steps of the method embodiments may be implemented by related hardware instructed by a program. The program may be stored in a computer-readable storage medium, and when being executed, implement the steps of the method embodiments. The storage medium includes various media capable of storing program codes, such as a mobile storage device, a ROM, a magnetic disk or a compact disc.
When being implemented in the form of software functional modules, and sold or used as an independent product, the integrated unit of the invention may also be stored in a computer-readable storage medium. Based on such an understanding, the technical solutions of the embodiments of the invention substantially, or parts making contributions to the conventional art, may be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions configured to enable a computer device (which may be a personal computer, a server or the like) to execute all or part of the method in various embodiments of the invention. The storage medium includes various media capable of storing program codes such as a mobile hard disk, a ROM, a magnetic disk or a compact disc.
The above is only the specific implementation mode of the invention and not intended to limit the scope of protection of the invention. Any modifications or substitutes apparent to those skilled in the art shall fall within the scope of protection of the invention. Therefore, the protected scope of the invention shall be subject to the scope of protection of the claims.
While the invention is explained in relation to certain embodiments, it is to be understood that various modifications thereof will become apparent to those skilled in the art upon reading the specification. Therefore, it is to be understood that the invention disclosed herein is intended to cover such modifications as fall within the scope of the appended claims.
This application is a U.S. non-provisional application claiming the benefit of priority under 35 U.S.C. Section 119(e) of U.S. Application No. 63/396,053, filed Aug. 8, 2022, which is incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
63396053 | Aug 2022 | US |