Chip layout model training and application method, device, electronic device and storage medium
By sorting the agent sequence in the chip layout model and using only one policy network and one value network, the problem of poor model generalization performance in the existing technology is solved, a chip layout suitable for different device numbers is realized, and the model's accuracy is improved. Adaptability and robustness.
Patent Information
- Application Number
- CN202410824680.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-06-25
AI Technical Summary
Existing reinforcement learning algorithms configure a separate policy network for each agent in chip layout model training, resulting in poor model generalization performance and inability to apply to chip layouts with different numbers of devices.
By sorting the agent sequence, only one policy network and one value network are set up, and the agents are controlled to execute the predicted actions in sequence, and the model structure parameters are updated based on the execution information obtained each time the predicted action is performed, ensuring that the model can be applied to devices with different numbers of devices. Same chip layout.
The generalization performance of the chip layout model is improved, making it suitable for chip layouts with different numbers of devices, and enhancing the adaptability and robustness of the model.
Smart Images

Figure CN118378094B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a chip layout model training and application method, device, electronic device and storage medium. Background Art
[0002] In the process of analog chip design, analog chip layout is a crucial link. At the same time, since analog chip layout is very complex, various automatic layout tools and algorithms are often used to complete it.
[0003] At present, reinforcement learning algorithm is a commonly used algorithm for simulating chip layout. After building a chip layout model based on reinforcement learning algorithm, when training the model, one or more devices of the chip are regarded as an intelligent agent, and a separate strategy network is configured for each intelligent agent.
[0004] However, since the policy network in the chip layout model corresponds one-to-one to the agent, the trained model can only be applied to the chip layout with the same number of devices and policy networks. For example, a chip layout model with 20 policy networks can only be used to layout a chip with 20 devices. Therefore, when building and training a chip layout model based on a reinforcement learning algorithm, if a separate policy network is configured for each agent, the model generalization performance will be poor. Summary of the invention
[0005] The present invention provides a chip layout model training and application method, device, electronic device and storage medium, which are used to solve the defect in the prior art that a separate strategy network is configured for each intelligent agent, resulting in poor model generalization performance.
[0006] The present invention provides a chip layout model training method, comprising:
[0007] Determine an agent sequence obtained by sorting all agents of the simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample;
[0008] The first agent in the agent sequence is used as the target agent, and based on the state information of all agents at the current moment, the target agent is controlled to perform the predicted action to obtain execution information;
[0009] The next agent in the agent sequence located at the target agent is used as a new target agent to control the new target agent to execute a new predicted action and obtain new execution information;
[0010] Traversing the agent sequence to obtain execution information of each agent after executing the predicted action;
[0011] Based on all the execution information, a policy network loss function value and a value network loss function value of the chip layout model are calculated to update structural parameters of the policy network and the value network in the chip layout model.
[0012] According to a chip layout model training method provided by the present invention, the first agent in the agent sequence is used as a target agent, and based on the state information of all agents at the current moment, the target agent is controlled to perform a predicted action to obtain execution information, including:
[0013] Acquire sample device information of the simulated chip sample to define an initial environment layout of the chip layout model and an initial state of the agent;
[0014] Based on the initial environment layout information and the state information of all agents at the current moment, a first fusion vector is obtained;
[0015] Inputting the first fusion vector into a strategy network to obtain an action vector output by the strategy network, wherein the action vector includes a movement direction and a movement speed of the predicted action;
[0016] Inputting the action vector and the first fusion vector into a value network to obtain a value result output by the value network;
[0017] Controlling the target agent to execute the predicted action to obtain execution information;
[0018] The execution information includes the first fusion vector, the second fusion vector, the current state vector, the predicted state vector, the evaluation function value and the action vector.
[0019] According to a chip layout model training method provided by the present invention, the first fusion vector is obtained based on the initial environment layout information and the state information of all agents at the current moment, including:
[0020] Constructing an observation vector according to the state information of all agents at the current moment; the state information includes the position information, distance information, overlapping area information and routability prediction information of all agents at the current moment;
[0021] Constructing an environment vector according to the initial environment layout information; the initial environment layout information includes connection relationship information, size information and boundary information of all devices corresponding to all intelligent agents;
[0022] Inputting the observation vector into an encoder to obtain an observation feature vector output by the encoder;
[0023] Inputting the environment vector into a convolutional neural network to obtain an environment feature vector output by the convolutional neural network;
[0024] The environment feature vector and the observation feature vector are fused to obtain the first fused vector.
[0025] According to a chip layout model training method provided by the present invention, the evaluation function value is determined after the target agent executes the prediction action at the next moment based on the overlapping area between the devices corresponding to all agents and the devices corresponding to the agents with overlapping relationships, the symmetry evaluation value between the devices corresponding to all agents and the devices corresponding to the agents with symmetric relationships, the routability prediction value of all devices corresponding to all agents, and the standardized total line length and standardized area utilization of all devices during routing.
[0026] According to a chip layout model training method provided by the present invention, the expression of the evaluation function value is as follows:
[0027] ;
[0028] in, is the evaluation function value of the target agent, is the overlapping area between the device corresponding to any agent and the device corresponding to the agent with overlapping relationship, is the symmetry evaluation value between the device corresponding to any agent and the device corresponding to the agent with a symmetric relationship, is the routability prediction value of all devices corresponding to all agents, It is the standardized bus length of the device corresponding to any intelligent agent during wiring. It is the standardized area utilization of all devices corresponding to all agents during routing.
[0029] According to a chip layout model training method provided by the present invention, for any intelligent agent, the overlapping area between a device corresponding to the intelligent agent and a device corresponding to another intelligent agent having an overlapping relationship is determined based on the following steps:
[0030] Determine an overlapping area between two or more devices having an overlapping relationship, and fit a minimum circumscribed rectangle of the overlapping area;
[0031] The vertex in the overlapping area that is not located on the side length of the minimum circumscribed rectangle and is closest to any side length of the minimum circumscribed rectangle is taken as the center point;
[0032] Connecting the center point with each vertex of the overlapping area to divide the overlapping area into a plurality of triangles;
[0033] The sum of the areas of several triangles is taken as the overlapping area.
[0034] According to a chip layout model training method provided by the present invention, the loss function of the strategy network is expressed as follows:
[0035] ;
[0036] ;
[0037] in, represents the batch size, represents the number of agents, Indicates The first track The current strategy result of the agent is The first track The probability ratio of the old strategy results of the agents, Indicates The first track The generalized advantage estimate calculated by each agent, Indicates The first track The first fusion vector of the agent, Indicates The first track The action vector of each agent represents the structural parameters of the policy network at the current moment, Represents the structural parameters of the policy network at the previous moment, represents the policy entropy, represents the entropy coefficient hyperparameter;
[0038] The expression of the loss function of the value network is as follows:
[0039] ;
[0040] in, represents the batch size, represents the number of agents, Indicates The first track The state vector of an agent, represents the remaining reward after discount, Represents the structural parameters of the value network at the current moment, Represents the structural parameters of the value network at the previous moment.
[0041] According to a chip layout model training method provided by the present invention, when the structural parameters of the strategy network are updated according to the loss function value of the strategy network, the structural parameters of the value network are set to be unmodifiable;
[0042] When the structural parameters of the value network are updated according to the value network loss function value, the structural parameters of the policy network are set to be unmodifiable.
[0043] The present invention also provides a chip layout model application method, comprising:
[0044] Initializing the initial environment layout of the chip layout model and the initial state of the intelligent agent based on the device information of the chip to be laid out; the intelligent agent corresponds to a device on the chip to be laid out;
[0045] Based on the initial environment layout information and the initial state information of each agent, a fusion vector of each agent is obtained;
[0046] Inputting the fusion vector of each agent into the chip layout model, and obtaining the final state corresponding to each agent output by the chip layout model; the chip layout model is trained based on any one of the chip layout model training methods described above;
[0047] According to the final state of each agent, the layout position of the device corresponding to each agent is determined.
[0048] The present invention also provides a chip layout model training device, comprising:
[0049] An agent sequence acquisition module, used to determine an agent sequence obtained by sorting all agents of the simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample;
[0050] A target agent action execution module is used to take the first agent in the agent sequence as the target agent, and based on the state information of all agents at the current moment, control the target agent to execute the predicted action to obtain execution information;
[0051] A target intelligent weight determination module is used to take the next intelligent agent in the intelligent agent sequence as a new target intelligent agent, so as to control the new target intelligent agent to perform a new predicted action and obtain new execution information;
[0052] A traversal execution module, used for traversing the agent sequence to obtain execution information after each agent executes the predicted action;
[0053] A network parameter updating module is used to calculate the policy network loss function value and the value network loss function value of the chip layout model based on all the execution information, so as to update the structural parameters of the policy network and the value network in the chip layout model.
[0054] The present invention also provides a chip layout model application device, comprising:
[0055] A model initialization module, used to initialize the initial environment layout of the chip layout model and the initial state of the intelligent agent based on the device information of the chip to be laid out; the intelligent agent corresponds to a device on the chip to be laid out;
[0056] A fusion vector acquisition module is used to obtain a fusion vector of each agent based on the initial environment layout information and the initial state information of each agent;
[0057] A state calculation module, used for inputting the fusion vector of each intelligent agent into the chip layout model to obtain the final state corresponding to each intelligent agent output by the chip layout model; the chip layout model is trained based on any one of the above-mentioned chip layout model training methods;
[0058] The position determination module is used to determine the layout position of the device corresponding to each intelligent agent according to the final state of each intelligent agent.
[0059] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the processor implements any one of the chip layout model training methods described above, or implements the chip layout model application method described above.
[0060] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the chip layout model training method described above or the chip layout model application method described above is implemented.
[0061] The chip layout model training and application method, device, electronic device and storage medium provided by the present invention control the intelligent agents to perform prediction actions in sequence when only one policy network and value network are set in the chip layout model. After all intelligent agents perform a prediction action once, the model structure parameters are updated according to all execution information obtained from each execution of the prediction action, so that the trained chip layout model can be applied to chip layouts with different numbers of devices, thereby improving the generalization performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0063] Figure 1 This is one of the flow charts of the chip layout model training method provided by the present invention.
[0064] Figure 2 This is the second flow chart of the chip layout model training method provided by the present invention.
[0065] Figure 3 It is an example diagram for determining the overlapping area provided by the present invention.
[0066] Figure 4 It is a flow chart of the chip layout model application method provided by the present invention.
[0067] Figure 5 It is a structural schematic diagram of the chip layout model training device provided by the present invention.
[0068] Figure 6 It is a structural schematic diagram of a chip layout model application device provided by the present invention.
[0069] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0071] Combine the following Figure 1-Figure 7 The present invention describes the chip layout model training and application method, device, electronic device and storage medium.
[0072] In the process of analog chip design, analog chip layout is a crucial link. Layout refers to the process of placing various devices (such as transistors, capacitors, resistors, etc.) in the corresponding metal layers of the chip to achieve the functions and performance requirements of the circuit. The quality of analog chip layout directly affects the performance, power consumption, noise characteristics and overall reliability of the circuit.
[0073] Analog chip layout faces many challenges. First, analog circuits are often sensitive to the interaction and position between electronic components, so the layout must meet the specific requirements of circuit designers, such as maintaining low noise, minimizing power jitter, and maximizing circuit bandwidth. Second, there are a large number of interconnects in analog circuits. The length, shape, and position of these interconnects will induce varying degrees of parasitic parameters, which will affect circuit performance, so precise routing and location planning are required. In addition, analog circuits usually need to consider the symmetrical placement between devices, so during the layout process, it is necessary to reasonably layout the devices that appear in pairs to reduce unnecessary coupling and interference.
[0074] Figure 1 FIG. 1 is one of the flow charts of the chip layout model training method provided by the present invention, such as Figure 1 As shown, the chip layout model training method includes but is not limited to the following steps 101 to 105.
[0075] It should be noted that the execution subject of the chip layout model training method provided by the present invention is the corresponding chip layout model training device, which can be a server, a computer device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc.
[0076] Step 101: Determine an agent sequence obtained by sorting all agents of a simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample.
[0077] Specifically, according to all devices that need to be laid out for the simulated chip sample, a device is taken as an intelligent agent, and all intelligent agents corresponding to the simulated chip sample in the chip layout model are determined. Then, after all intelligent agents are sorted, an intelligent agent sequence is obtained.
[0078] It should be noted that the purpose of sorting all intelligent agents is to determine the order in which all intelligent agents perform prediction actions. When all intelligent agents need to perform prediction actions, this order does not affect the final training results of the chip layout model. Therefore, the intelligent agents can be sorted according to different factors such as device model and size, and the present invention is not limited to this.
[0079] Step 102: Take the first agent in the agent sequence as the target agent, and based on the state information of all agents at the current moment, control the target agent to execute the predicted action to obtain execution information.
[0080] The state information includes but is not limited to the position information, distance information, overlapping area information and routability prediction information of each agent at the current moment.
[0081] Distance information refers to the distance information between the device corresponding to the target intelligent entity and other devices with a connection relationship; overlapping area information refers to the area of the overlapping area between the device corresponding to the target intelligent entity and other devices; routability prediction information refers to the evaluation information on whether the layout of the device corresponding to the target intelligent entity can meet good standards and actual needs.
[0082] Specifically, after the agent sequence is determined, the first agent in the agent sequence is used as the target agent. The predicted action to be performed by the target agent is determined based on the state information of all agents at the current moment.
[0083] For example, a vector is constructed based on the state information of all agents at the current moment, and the vector is input into the policy network of the chip layout model to obtain the action vector output by the policy network, which includes the movement direction and movement speed of the predicted action. The target agent then performs the predicted action based on the action vector, while the positions of other agents remain unchanged.
[0084] Furthermore, during the period of controlling the target agent to execute the predicted action, execution information corresponding to the target agent, that is, the first agent in the agent sequence, is obtained.
[0085] The execution information includes but is not limited to: the state information of all agents including the target agent before and after the target agent executes the predicted action; the action vector information related to the predicted action executed by the target agent; the evaluation function value for the target agent to execute the predicted action and other information.
[0086] Step 103: Use the next agent after the target agent in the agent sequence as a new target agent to control the new target agent to execute a new predicted action and obtain new execution information.
[0087] Specifically, after the first agent in the agent sequence performs a predicted action, the next agent of the first agent in the agent sequence (i.e., the second agent) is used as the new target agent.
[0088] The new predicted action to be performed by the new target agent is determined based on the state information of all agents after the first agent performs the predicted action. After the first agent performs the predicted action, the state information of all agents changes, and the predicted action to be performed by the new target agent also changes accordingly. Similarly, during the execution of the predicted action by the new target agent, the execution information corresponding to the new target agent, i.e., the second agent in the agent sequence, is obtained.
[0089] Step 104: traverse the agent sequence to obtain execution information of each agent after executing the predicted action.
[0090] Specifically, all agents in the agent sequence are traversed, and each agent in the agent sequence is used as the target agent in order. After the previous target agent performs the predicted action, the next target agent determines and executes a new predicted action based on the change in the state information of all agents caused by the previous target agent performing the predicted action, and obtains the execution information after each predicted action is executed, until each agent in the agent sequence performs a predicted action once, and obtains the execution information of each agent after executing the predicted action.
[0091] Step 105 : Based on all the execution information, calculate the policy network loss function value and the value network loss function value of the chip layout model to update the structural parameters of the policy network and the value network in the chip layout model.
[0092] Specifically, when all agents in the agent sequence perform a prediction action, it means that all devices of the simulated chip samples corresponding to all agents have completed a layout position change. At this time, based on all the execution information of each agent performing the prediction action obtained, the policy network loss function value is calculated according to the preset policy network loss function, and the value network loss function value is calculated according to the preset value network loss function. Based on the policy network loss function value and the value network loss function value, the structural parameters of the policy network and the value network in the chip layout model are updated.
[0093] Generally speaking, when training common chip layout models based on reinforcement learning algorithms, a separate policy network is configured for each agent, and the state information of each agent is input into the corresponding policy network. The policy network then outputs an action vector for the corresponding agent to perform the predicted action, and updates the structural parameters of the policy network based on the changes after the corresponding agent performs the corresponding predicted action.
[0094] In the present invention, the chip layout model has only one policy network and one value network. When training the policy network, each input of the policy network is determined based on the state information of all agents at the current moment, and the action vector output by the policy network is only used for the target agent at the current moment to perform the predicted action. After the state changes due to the previous target agent performing the predicted action, the state information of all agents input to the policy network for the next target agent also changes, and the predicted action performed by the next target agent output by the policy network is also different. All agents in the agent sequence table are traversed until all agents have performed a predicted action once, and then the structural functions of the policy network and the value network in the chip layout model are updated once according to the execution information of all agents when performing the predicted action.
[0095] The chip layout model training method provided by the present invention, when only one policy network and value network are set in the chip layout model, controls the intelligent agents to execute prediction actions in sequence, and after all the intelligent agents execute the prediction action once, updates the model structure parameters according to all the execution information obtained each time the prediction action is executed, so that the trained chip layout model can be applicable to chip layouts with different numbers of devices, thereby improving the generalization performance of the model.
[0096] Based on the above embodiment, as an optional embodiment, the first agent in the agent sequence is used as the target agent, and based on the state information of all agents at the current moment, the target agent is controlled to execute the predicted action to obtain the execution information, including:
[0097] Acquire sample device information of the simulated chip sample to define an initial environment layout of the chip layout model and an initial state of the agent;
[0098] Based on the initial environment layout information and the state information of all agents at the current moment, a first fusion vector is obtained;
[0099] Inputting the first fusion vector into a strategy network to obtain an action vector output by the strategy network, wherein the action vector includes a movement direction and a movement speed of the predicted action;
[0100] Inputting the action vector and the first fusion vector into a value network to obtain a value result output by the value network;
[0101] Controlling the target agent to execute the predicted action to obtain execution information;
[0102] The execution information includes the first fusion vector, the second fusion vector, the current state vector, the predicted state vector, the evaluation function value and the action vector.
[0103] As an optional embodiment, the second fusion vector mentioned in the above embodiment is determined based on the initial environment layout information and the state information of all agents at the next moment after the current moment; the current state vector is determined based on the state information of all agents at the current moment; and the predicted state vector is determined based on the state information of all agents at the next moment.
[0104] The sample device information of the analog chip sample includes, but is not limited to, size information, connection relationship information, width and height information, layout boundary information, symmetry information, etc. of each device.
[0105] Specifically, after obtaining the simulated chip samples for training the chip layout model, the initial environment layout of the chip layout model and the initial state of each intelligent agent are defined according to the sample device information of the simulated chip samples, and the initial environment layout information is determined based on the initial environment layout.
[0106] Optionally, the initial state of each agent is determined based on the standard that the centers of the devices corresponding to each agent overlap at the middle position of a given layout boundary.
[0107] Furthermore, the state space and action space of the simulation layout corresponding to deep reinforcement learning are defined, the way of interaction between multiple agents is defined, the evaluation function suitable for the simulation layout task, the structural parameters of the value network and the policy network, etc.
[0108] Optionally, the action space includes but is not limited to move up, move down, move left, move right, stay still, and the like.
[0109] Then, based on the initial environment layout information and the state information of all agents at the current moment, certain data processing operations are performed to obtain the first fusion vector, and then the first fusion vector is input into the policy network to obtain the action vector output by the policy network, including the movement direction and movement speed of the predicted action.
[0110] Furthermore, the action vector and the first fusion vector are input into the value network, and the value result output by the value network is obtained.
[0111] Further, the target agent is controlled to execute the predicted action to obtain execution information.
[0112] Among them, the execution information includes: the first fusion vector input into the strategy model, that is, the fusion vector determined based on the state information of all agents at the current moment and the initial environment layout information of the target agent; the second fusion vector, that is, the fusion vector determined based on the state information of all agents at the next moment after the target agent executes the predicted action and the initial environment layout information; the current state vector, that is, the vector determined based on the state information of all agents at the current moment; the predicted state vector, that is, the vector determined based on the state information of all agents at the next moment after the target agent executes the predicted action; the action vector output by the strategy model and the evaluation function value determined based on the preset evaluation function.
[0113] It can be understood that each agent in the agent sequence takes consistent steps to execute the predicted action, but the predicted actions executed by different agents may differ due to the state changes after the previous agent executes the predicted action.
[0114] Optionally, the action vector output by the policy network is determined based on the action with the highest probability after mapping the first fusion vector to the classification distribution of the action in the discrete action space.
[0115] Optionally, the action vector output by the policy network is determined based on the action with the highest probability after mapping the first fusion vector to the mean and standard deviation vector of the multivariate Gaussian distribution in the continuous action space.
[0116] The chip layout model training method provided by the present invention combines the initial environment layout information when determining the predicted action of the target intelligent agent based on the state information of all intelligent agents at the current moment, thereby improving the robustness, adaptability and other performance of the model.
[0117] Based on the above embodiment, as an optional embodiment, the first fusion vector is obtained based on the initial environment layout information and the state information of all agents at the current moment, including:
[0118] Constructing an observation vector according to the state information of all agents at the current moment; the state information includes the position information, distance information, overlapping area information and routability prediction information of all agents at the current moment;
[0119] Constructing an environment vector according to the initial environment layout information; the initial environment layout information includes connection relationship information, size information and boundary information of all devices corresponding to all intelligent agents;
[0120] Inputting the observation vector into an encoder to obtain an observation feature vector output by the encoder;
[0121] Inputting the environment vector into a convolutional neural network to obtain an environment feature vector output by the convolutional neural network;
[0122] The environment feature vector and the observation feature vector are fused to obtain the first fused vector.
[0123] Figure 2 FIG. 2 is a flow chart of the chip layout model training method provided by the present invention. Figure 2 As shown, when determining the predicted action that the target agent needs to perform at the current moment, first, an observation vector is constructed based on the state information of all agents at the current moment, and an environment vector is constructed based on the initial environment layout information.
[0124] Then the observation vector is input into the encoder to obtain the observation feature vector output by the encoder, the environment vector is input into the convolutional neural network to obtain the environment feature vector output by the convolutional neural network, and the observation feature vector and the environment feature vector are fused into a first fusion vector.
[0125] Optionally, the observation feature vector and the environment feature vector are fused into a first fused vector through a Concate operation layer.
[0126] Optionally, the first fusion vector is processed using a Transformer structure so that inputs of different numbers of agents can be output in a fixed size to facilitate generalization.
[0127] The chip layout model training method provided by the present invention utilizes an encoder and a convolutional neural network to extract features of the current state information and initial environment layout information of all agents, thereby obtaining more compact and meaningful feature information to improve the convergence speed and model performance of chip layout model training.
[0128] Based on the above embodiment, as an optional embodiment, the evaluation function value is determined after the target agent executes the predicted action at the next moment based on the overlapping area between the devices corresponding to all agents and the devices corresponding to the agents with overlapping relationships, the symmetry evaluation value between the devices corresponding to all agents and the devices corresponding to the agents with symmetrical relationships, the routability prediction value of all devices corresponding to all agents, and the standardized total line length and standardized area utilization of all devices during routing.
[0129] Standardized bus length refers to the key parameter for measuring and optimizing the length of the signal transmission path after all devices are wired in the standard design layout of analog chip devices.
[0130] Normalized area utilization refers to the ratio of the actual area occupied by all devices to the available area in the standard design layout of analog chip devices. This ratio can be used to measure the efficiency of chip layout and directly affects the performance, power consumption and manufacturing cost of the chip.
[0131] As an optional embodiment, the expression of the evaluation function value is as follows:
[0132] ;
[0133] in, is the evaluation function value of the target agent, is the overlapping area between the device corresponding to any agent and the device corresponding to the agent with overlapping relationship, is the symmetry evaluation value between the device corresponding to any agent and the device corresponding to the agent with a symmetric relationship, is the routability prediction value of all devices corresponding to all agents, It is the standardized bus length of the device corresponding to any intelligent agent during wiring. It is the standardized area utilization of all devices corresponding to all agents during routing.
[0134] As an optional embodiment, for any agent, the expression of the overlapping area between the device corresponding to the agent and the device corresponding to the agent having an overlapping relationship can be expressed as follows:
[0135] ;
[0136] in, is the overlapping area between the device corresponding to the agent and the device corresponding to the agent with overlapping relationship, They represent the intersection points of the overlapping areas respectively.
[0137] As an optional embodiment, for any agent, the expression of the symmetry evaluation value between the device corresponding to the agent and the device corresponding to the agent having a symmetric relationship can be expressed as follows:
[0138] ;
[0139] in, is the symmetry evaluation value, and Indicates The center coordinates of the device corresponding to each agent, and represents the coordinates of the center of symmetry, It is with The devices corresponding to each intelligent agent have a set of devices with a symmetric relationship.
[0140] The chip layout model training method provided by the present invention introduces a symmetry evaluation value into an evaluation function. When setting the corresponding relationship between an agent and a device, two devices with a symmetric relationship can be represented by two separate agents. The method is not limited to representing two devices with a symmetric relationship by one agent, and the symmetry restriction conditions of the chip layout can also be guaranteed.
[0141] As an optional embodiment, for any intelligent agent, the standardized bus length of the device corresponding to any intelligent agent during wiring is The expression can be expressed as follows:
[0142] ;
[0143] in, is the normalized total bus length, Indicates The physical location of the device corresponding to each agent coordinate, Indicates The physical location of the device corresponding to each agent coordinate, Indicates The physical location of the device corresponding to each agent coordinate, Indicates The physical location of the device corresponding to each agent coordinate.
[0144] Based on the above embodiment, as an optional embodiment, for any agent, the overlapping area between the device corresponding to the agent and the device corresponding to another agent having an overlapping relationship is determined based on the following steps:
[0145] Determine an overlapping area between two or more devices having an overlapping relationship, and fit a minimum circumscribed rectangle of the overlapping area;
[0146] The vertex in the overlapping area that is not located on the side length of the minimum circumscribed rectangle and is closest to any side length of the minimum circumscribed rectangle is taken as the center point;
[0147] Connecting the center point with each vertex of the overlapping area to divide the overlapping area into a plurality of triangles;
[0148] The sum of the areas of several triangles is taken as the overlapping area.
[0149] Figure 3 is an example diagram for determining the overlapping area provided by the present invention, such as Figure 3As shown, the device M16 and the device M14 have an overlapping relationship, and an overlapping area between the device M16 and the device M14 is determined, and each vertex of the overlapping area is the intersection point where the two devices overlap.
[0150] Then fit the minimum circumscribed rectangle of the overlapping area, and use the vertex A that is not on the side length of the minimum circumscribed rectangle and is closest to any side length of the minimum circumscribed rectangle as the center point, and then connect vertex A with other vertices in the overlapping area to divide the overlapping area into triangles S1, S2, S3, S4, S5 and S6. Add the areas of triangles S1, S2, S3, S4, S5 and S6 to get the overlapping area of the overlapping area.
[0151] In one embodiment, if the number of overlapping intersections is less than 3, it indicates that there is no overlapping area.
[0152] As an optional embodiment, the loss function of the policy network is expressed as follows:
[0153] ;
[0154] ;
[0155] in, represents the batch size, represents the number of agents, Indicates The first track The current strategy result of the agent is The first track The probability ratio of the old strategy results of the agents, Indicates The first track The generalized advantage estimate calculated by each agent, Indicates The first track The first fusion vector of the agent, Indicates The first track The action vector of the agent, Represents the structural parameters of the policy network at the current moment, Represents the structural parameters of the policy network at the previous moment, represents the policy entropy, represents the entropy coefficient hyperparameter.
[0156] As an optional embodiment, the expression of the loss function of the value network is as follows:
[0157] ;
[0158] in, represents the batch size, represents the number of agents, Indicates The first track The state vector of an agent, represents the remaining reward after discount, Represents the structural parameters of the value network at the current moment, Represents the structural parameters of the value network at the previous moment.
[0159] Among them, the batch size is the size of a batchsize.
[0160] For example, 128 trajectories are extracted from 10,000 trajectory data to perform the current model task as a batch size, that is, The maximum value is 128.
[0161] Based on the above embodiment, as an optional embodiment, when the structural parameters of the strategy network are updated according to the loss function value of the strategy network, the structural parameters of the value network are set to be unmodifiable;
[0162] When the structural parameters of the value network are updated according to the value network loss function value, the structural parameters of the policy network are set to be unmodifiable.
[0163] Specifically, when the structural parameters of the policy network are updated, the structural parameters of the value network in the chip layout model are set to be unmodifiable, and when the structural parameters of the value network are updated, the structural parameters of the policy network are set to be unmodifiable.
[0164] By alternately repeating the steps of updating the structural parameters of the strategy network and the value network until the preset convergence conditions are met, a trained chip layout model is obtained.
[0165] As an optional embodiment, when the chip layout model is trained using batch data, the hidden layer states of the policy network and the value network are updated according to the optimal data fed back in the batch data, and the structural parameters of the policy network and the value network are updated based on the Adam gradient optimization algorithm.
[0166] Figure 4 FIG. 1 is a flow chart of a method for applying a chip layout model provided by the present invention. Figure 4 As shown, the chip layout model application method includes but is not limited to the following steps 401 to 404.
[0167] It should be noted that the execution subject of the chip layout model application method provided by the present invention is the corresponding chip layout model application device, which can be a server, a computer device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA).
[0168] Step 401: Initialize the initial environment layout of the chip layout model and the initial state of the agent based on the device information of the chip to be laid out; the agent corresponds to a device on the chip to be laid out.
[0169] Step 402: Based on the initial environment layout information and the initial state information of each agent, a fusion vector of each agent is obtained.
[0170] Step 403: input the fusion vector of each agent into the chip layout model to obtain the final state corresponding to each agent output by the chip layout model; the chip layout model is trained by the chip layout model training method provided in any of the above embodiments.
[0171] Step 404: Determine the layout position of the device corresponding to each intelligent agent according to the final state of each intelligent agent.
[0172] Specifically, when using the chip layout model provided by any of the above embodiments, based on device information such as the number of devices in the chip to be laid out, the size information of each device, and the layout boundary information, the initial environment layout of the chip layout model and the initial state of the agent are initialized on the principle that one agent corresponds to one device on the layout chip.
[0173] Then, according to the initial environment layout information and the initial state information of each agent, the method for obtaining the first fusion vector in the chip layout model training method provided in any of the above embodiments is applied to obtain the fusion vector of each agent. The fusion vector of each agent is input into the chip layout model, and the state of each agent is continuously adjusted under the control of the chip layout model to obtain the final state corresponding to each agent output by the chip layout model. According to the final state of each agent, the layout position of the device corresponding to each agent on the chip to be laid out can be determined to complete the layout of the chip to be laid out.
[0174] The chip layout model application method provided by the present invention, when only one strategy network and value network are set in the chip layout model, controls the intelligent agents to execute prediction actions in sequence, and after all the intelligent agents execute the prediction action once, updates the model structure parameters according to all the execution information obtained each time the prediction action is executed, so that the trained chip layout model can be applied to chip layouts with different numbers of devices, thereby improving the generalization performance of the model.
[0175] Figure 5 is a schematic diagram of the structure of the chip layout model training device provided by the present invention, such as Figure 5 As shown, the chip layout model training device includes but is not limited to an agent sequence acquisition module 501, a target agent action execution module 502, a target agent weight determination module 503, a traversal execution module 504 and a network parameter updating module 505.
[0176] An agent sequence acquisition module 501 is used to determine an agent sequence obtained by sorting all agents of the simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample;
[0177] A target agent action execution module 502 is used to take the first agent in the agent sequence as the target agent, and based on the state information of all agents at the current moment, control the target agent to execute the predicted action to obtain execution information;
[0178] The target intelligent weight determination module 503 is used to take the next intelligent agent in the intelligent agent sequence as the new target intelligent agent, so as to control the new target intelligent agent to perform a new predicted action and obtain new execution information;
[0179] A traversal execution module 504 is used to traverse the agent sequence to obtain execution information after each agent executes the predicted action;
[0180] The network parameter updating module 505 is used to calculate the policy network loss function value and the value network loss function value of the chip layout model based on all the execution information, so as to update the structural parameters of the policy network and the value network in the chip layout model.
[0181] It should be noted that the chip layout model training device provided by the present invention can execute the chip layout model training method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0182] The chip layout model training device provided by the present invention controls the intelligent agents to perform prediction actions in sequence when only one policy network and value network are set in the chip layout model. After all intelligent agents perform a prediction action once, the model structure parameters are updated according to all execution information obtained each time the prediction action is performed, so that the trained chip layout model can be applicable to chip layouts with different numbers of devices, thereby improving the generalization performance of the model.
[0183] Figure 6 is a schematic diagram of the structure of the chip layout model application device provided by the present invention, such as Figure 6 As shown, the chip layout model application device includes but is not limited to a model initialization module 601 , a fusion vector acquisition module 602 , a state calculation module 603 and a position determination module 604 .
[0184] The model initialization module 601 is used to initialize the initial environment layout of the chip layout model and the initial state of the intelligent agent based on the device information of the chip to be laid out; the intelligent agent corresponds to a device on the chip to be laid out.
[0185] The fusion vector acquisition module 602 is used to obtain the fusion vector of each agent based on the initial environment layout information and the initial state information of each agent.
[0186] The state calculation module 603 is used to input the fusion vector of each intelligent agent into the chip layout model to obtain the final state corresponding to each intelligent agent output by the chip layout model; the chip layout model is trained by the chip layout model training method provided in any of the above embodiments.
[0187] The position determination module 604 is used to determine the layout position of the device corresponding to each intelligent agent according to the final state of each intelligent agent.
[0188] It should be noted that the chip layout model application device provided by the present invention can execute the chip layout model application method described in any of the above embodiments during specific operation, which will not be described in detail in this embodiment.
[0189] The chip layout model application device provided by the present invention controls the intelligent agents to perform prediction actions in sequence when only one strategy network and value network are set in the chip layout model. After all the intelligent agents perform a prediction action once, the model structure parameters are updated according to all execution information obtained each time the prediction action is performed, so that the trained chip layout model can be applied to chip layouts with different numbers of devices, thereby improving the generalization performance of the model.
[0190] Figure 7 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 7As shown, the electronic device may include: a processor (processor) 710 , a communication interface (Communications Interface) 720 , a memory (memory) 730 and a communication bus 740 , wherein the processor 710 , the communication interface 720 , and the memory 730 communicate with each other through the communication bus 740 . The processor 710 may call the logic instructions in the memory 730 to execute the chip layout model training method provided by any of the above embodiments, wherein the chip layout model training method includes but is not limited to the following steps: determining an agent sequence obtained by sorting all agents of a simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample; taking the first agent in the agent sequence as the target agent, and based on the state information of all agents at the current moment, controlling the target agent to perform a predicted action to obtain execution information; taking the next agent in the agent sequence located below the target agent as the new target agent, controlling the new target agent to perform a new predicted action to obtain new execution information; traversing the agent sequence to obtain execution information after each agent performs the predicted action; and calculating the policy network loss function value and the value network loss function value of the chip layout model based on all the execution information to update the structural parameters of the policy network and the value network in the chip layout model;
[0191] Alternatively, the chip layout model application method provided in any of the above embodiments is executed, and the chip layout model application method includes but is not limited to the following steps: based on the device information of the chip to be laid out, initializing the initial environment layout of the chip layout model and the initial state of the agent; the agent corresponds to a device on the chip to be laid out; based on the initial environment layout information and the initial state information of each agent, a fusion vector of each agent is obtained; the fusion vector of each agent is input into the chip layout model to obtain a final state corresponding to each agent output by the chip layout model; the chip layout model is trained by the chip layout model training method described in any of the above embodiments; and according to the final state of each agent, the layout position of the device corresponding to each agent is determined.
[0192] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0193] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the chip layout model training method provided in any of the above embodiments is implemented, and the chip layout model training method includes but is not limited to the following steps: determining an agent sequence obtained by sorting all agents of a simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample; taking the first agent in the agent sequence as the target agent, and based on the state information of all agents at the current moment, controlling the target agent to perform a predicted action to obtain execution information; taking the next agent in the agent sequence located below the target agent as the new target agent, so as to control the new target agent to perform a new predicted action and obtain new execution information; traversing the agent sequence to obtain the execution information after each agent performs the predicted action; and calculating the policy network loss function value and the value network loss function value of the chip layout model based on all the execution information, so as to update the structural parameters of the policy network and the value network in the chip layout model;
[0194] Alternatively, the chip layout model application method provided in any of the above embodiments is executed, and the chip layout model application method includes but is not limited to the following steps: based on the device information of the chip to be laid out, initializing the initial environment layout of the chip layout model and the initial state of the agent; the agent corresponds to a device on the chip to be laid out; based on the initial environment layout information and the initial state information of each agent, a fusion vector of each agent is obtained; the fusion vector of each agent is input into the chip layout model to obtain a final state corresponding to each agent output by the chip layout model; the chip layout model is trained by the chip layout model training method described in any of the above embodiments; and according to the final state of each agent, the layout position of the device corresponding to each agent is determined.
[0195] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0196] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0197] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A chip layout model training method, characterized in that: include: Determine an agent sequence obtained by sorting all agents of the simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample; The first agent in the agent sequence is used as the target agent, and based on the state information of all agents at the current moment, the target agent is controlled to perform the predicted action to obtain execution information; The next agent in the agent sequence located at the target agent is used as a new target agent to control the new target agent to execute a new predicted action and obtain new execution information; Traversing the agent sequence to obtain execution information of each agent after executing the predicted action; Based on all the execution information, a policy network loss function value and a value network loss function value of the chip layout model are calculated to update structural parameters of the policy network and the value network in the chip layout model; The first agent in the agent sequence is used as a target agent, and based on the state information of all agents at the current moment, the target agent is controlled to execute a predicted action to obtain execution information, including: Acquire sample device information of the simulated chip sample to define an initial environment layout of the chip layout model and an initial state of the agent; Based on the initial environment layout information and the state information of all agents at the current moment, a first fusion vector is obtained; the first fusion vector is input into the policy network to obtain the action vector output by the policy network; the action vector and the first fusion vector are input into the value network to obtain the value result output by the value network; the target agent is controlled to execute the predicted action to obtain execution information; the execution information includes the first fusion vector, the second fusion vector, the current state vector, the predicted state vector, the evaluation function value and the action vector; The second fusion vector is determined based on the initial environment layout information and state information of all agents at the next moment after the current moment.
2. The chip layout model training method according to claim 1, characterized in that: The first fusion vector is obtained based on the initial environment layout information and the state information of all agents at the current moment, including: Constructing an observation vector according to the state information of all agents at the current moment; the state information includes the position information, distance information, overlapping area information and routability prediction information of all agents at the current moment; Constructing an environment vector according to the initial environment layout information; the initial environment layout information includes connection relationship information, size information and boundary information of all devices corresponding to all intelligent agents; Inputting the observation vector into an encoder to obtain an observation feature vector output by the encoder; Inputting the environment vector into a convolutional neural network to obtain an environment feature vector output by the convolutional neural network; The environment feature vector and the observation feature vector are fused to obtain the first fused vector.
3. The chip layout model training method according to claim 1, characterized in that: The evaluation function value is determined after the target agent executes the predicted action at the next moment based on the overlapping area between the devices corresponding to all agents and the devices corresponding to the agents with overlapping relationships, the symmetry evaluation value between the devices corresponding to all agents and the devices corresponding to the agents with symmetrical relationships, the routability prediction value of all devices corresponding to all agents, and the standardized total line length and standardized area utilization of all devices during routing.
4. The chip layout model training method according to claim 3, characterized in that: The expression of the evaluation function value is as follows: ; in, is the evaluation function value of the target agent, is the overlapping area between the device corresponding to any agent and the device corresponding to the agent with overlapping relationship, is the symmetry evaluation value between the device corresponding to any agent and the device corresponding to the agent with a symmetric relationship, is the routability prediction value of all devices corresponding to all agents, It is the standardized bus length of the device corresponding to any intelligent agent during wiring. It is the standardized area utilization of all devices corresponding to all agents during routing.
5. The chip layout model training method according to claim 4, characterized in that: For any agent, the overlapping area between the device corresponding to the agent and the device corresponding to another agent having an overlapping relationship is determined based on the following steps: Determine an overlapping area between two or more devices having an overlapping relationship, and fit a minimum circumscribed rectangle of the overlapping area; The vertex in the overlapping area that is not located on the side length of the minimum circumscribed rectangle and is closest to any side length of the minimum circumscribed rectangle is taken as the center point; Connecting the center point with each vertex of the overlapping area to divide the overlapping area into a plurality of triangles; The sum of the areas of several triangles is taken as the overlapping area.
6. The chip layout model training method according to any one of claims 1 to 5, characterized in that: The expression of the loss function of the policy network is as follows: ; ; in, represents the batch size, represents the number of agents, Indicates The first track The current strategy result of the agent is The first track The probability ratio of the old strategy results of the agents, Indicates The first track The generalized advantage estimate calculated by each agent, Indicates The first track The first fusion vector of the agent, Indicates The first track The action vector of the agent, Represents the structural parameters of the policy network at the current moment, Represents the structural parameters of the policy network at the previous moment, represents the policy entropy, represents the entropy coefficient hyperparameter; The expression of the loss function of the value network is as follows: ; in, represents the batch size, represents the number of agents, Indicates The first track The state vector of an agent, represents the remaining reward after discount, Represents the structural parameters of the value network at the current moment, Represents the structural parameters of the value network at the previous moment.
7. The chip layout model training method according to claim 6, characterized in that: When the structural parameters of the strategy network are updated according to the loss function value of the strategy network, the structural parameters of the value network are set to be unmodifiable; When the structural parameters of the value network are updated according to the value network loss function value, the structural parameters of the policy network are set to be unmodifiable.
8. A chip layout model application method, characterized in that: include: Initialize the initial environment layout of the chip layout model and the initial state of the intelligent agent based on the device information of the chip to be laid out; The intelligent agent corresponds to a device on the chip to be laid out; Based on the initial environment layout information and the initial state information of each agent, a fusion vector of each agent is obtained; Inputting the fusion vector of each agent into the chip layout model, and obtaining the final state corresponding to each agent output by the chip layout model; the chip layout model is trained based on the chip layout model training method according to any one of claims 1 to 7; According to the final state of each agent, the layout position of the device corresponding to each agent is determined.
9. A chip layout model training device, characterized in that: include: An agent sequence acquisition module, used to determine an agent sequence obtained by sorting all agents of the simulated chip sample, wherein the agent corresponds to a device on the simulated chip sample; A target agent action execution module is used to take the first agent in the agent sequence as the target agent, and based on the state information of all agents at the current moment, control the target agent to execute the predicted action to obtain execution information; A target intelligent weight determination module is used to take the next intelligent agent in the intelligent agent sequence as a new target intelligent agent, so as to control the new target intelligent agent to perform a new predicted action and obtain new execution information; A traversal execution module, used for traversing the agent sequence to obtain execution information after each agent executes the predicted action; A network parameter updating module, used to calculate the policy network loss function value and the value network loss function value of the chip layout model based on all the execution information, so as to update the structural parameters of the policy network and the value network in the chip layout model; The target agent action execution module is further used to obtain the sample device information of the simulated chip sample to define the initial environment layout of the chip layout model and the initial state of the agent; obtain a first fusion vector based on the initial environment layout information and the state information of all agents at the current moment; input the first fusion vector into the policy network to obtain the action vector output by the policy network; input the action vector and the first fusion vector into the value network to obtain the value result output by the value network; control the target agent to execute the predicted action to obtain execution information; the execution information includes the first fusion vector, the second fusion vector, the current state vector, the predicted state vector, the evaluation function value and the action vector; The second fusion vector is determined based on the initial environment layout information and state information of all agents at the next moment after the current moment.
10. A chip layout model application device, characterized in that: include: A model initialization module is used to initialize the initial environment layout of the chip layout model and the initial state of the intelligent agent based on the device information of the chip to be laid out; The intelligent agent corresponds to a device on the chip to be laid out; A fusion vector acquisition module is used to obtain a fusion vector of each agent based on the initial environment layout information and the initial state information of each agent; A state calculation module, used for inputting the fusion vector of each intelligent agent into the chip layout model to obtain the final state corresponding to each intelligent agent output by the chip layout model; the chip layout model is trained based on the chip layout model training method according to any one of claims 1 to 7; The position determination module is used to determine the layout position of the device corresponding to each intelligent agent according to the final state of each intelligent agent.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the chip layout model training method according to any one of claims 1 to 7 is implemented, or the chip layout model application method according to claim 8 is implemented.
12. A non-transitory 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 model training method according to any one of claims 1 to 7 is implemented, or the chip layout model application method according to claim 8 is implemented.
