In this documentation, we use gridcell and grid interchangeably. They both mean the grid system induced by the gridding process.
In Circuit Training, proxy cost is the weighted sum of wirelength, density, and congestion costs. It is used to determine the overall quality of the macro placement solution.
Proxy Cost = Wwirelength × Costwirelength + Wdensity × Costdensity + Wcongestion × Costcongestion
Where Wwirelength, Wdensity and Wcongestion are the weights. From the Circuit Training repo, we found that Wwirelength = 1, Wdensity = 1, and Wcongestion = 0.5. From communication with Google engineers, we learned that in their internal flow, they use Wwirelength = 1, Wdensity = 0.5, and Wcongestion = 0.5.
Circuit Training repo provides the plc_wrapper_main binary to compute these cost functions. There is no available detailed description, or open-source implementation, of these cost functions. With feedback and confirmations from Google engineers, we have implemented all three cost functions; the source code is available here. In the following, we provide a detailed description of the implementation of these cost functions.
Testcase | Method | HPWL Cost |
Density Cost | Congestion Cost |
---|---|---|---|---|
Google's Ariane |
0.050186608 | 0.756401122 | 0.984565650 | |
Our | 0.050186604 | 0.756401122 | 0.984565675 | |
Ariane-NanGate45 |
0.387988658 | 0.500452106 | 2.448659090 | |
Our | 0.387988659 | 0.500452101 | 2.448659182 |
The wirelength cost function depends on the net (bounding box) half-perimeter wirelength (HPWL). So, first we describe steps to compute HPWL of a net – and then we compute the wirelength cost.
A protobuf netlist consists of different types of nodes. Different possible types of nodes are macro, standard cell, macro pin and port. A net consists of one source node and one or more sink nodes. A net can have only standard cell, macro pin and port as its source or sink nodes. In the following wirelength cost computation procedure, we use the term net weight, which is the weight of the source node of the net. This weight indicates the total number of connections between the source and each sink node.
In the above procedure, canvasheight is the height of the canvas and canvaswidth is the width of the canvas.
Density cost function depends on the gridcell density. So, first we describe the steps to compute gridcell density – and then we compute the density cost.
The gridcell density of grid (i, j) is the ratio of the summation of all the overlapped areas (the common area between the node and the grid) of standard cell and macro nodes with the grid (i, j) to the total gridcell area.
Notice that 0.5 is not the “weight” of this cost function, but simply another factor applied besides the weight factor from the cost function. Google engineers informed us “ the 0.5 is there to correct the bloating of the std cell clusters”.
We divide the congestion cost computation into six sub-stages:
We first want to address that the following computation is “grid-based” (not to be confused with the conventional n-pin net) derived from gridding. The main differences are instead of looking at each pin location, we only look at grid cells subject to pin locations. This implies that if all net entities (source pin and sink pins) are within the same grid cell, no routing congestion will be computed (except for macro congestions). More formally, we define a n-grid net as a net whose pins occupy n different grids. We also define the grid occupied by the source pin of a net as the source grid of the net, and remaining grids occupied by other pins of the net as sink grids. In other words, if a three-pin net has a source pin in grid gi and two sink pins in the same grid gj, we would consider this as a two-grid net.
Given the above grid-base routing setting, we divide this problem into three sub-problems.
A grid location (i, j) is the intersection of the ith column with the jth row.
For these three problems we consider that the horizontal routing cost due to a net-segment from (i, j) grid to (i+1, j) grid applies only to the grid (i, j). Similarly the vertical routing cost due to a net-segment from (i, j) grid to (i, j+1) grid applies only to the grid (i, j). Here the direction of the net does not matter.
Now we compute the congestion due to different nets:
Two-grid net routing depends on the source and sink node. Consider
In the following figure P2 is the source grid and P1 is the sink grid of the net. When the arrow crosses the top edge of the grid cell it contributes to the vertical congestion cost of the grid cell and when it crosses the right edge of the grid cell it contributes to the horizontal congestion cost of the grid cell.
The Congestion cost of three-grid nets does not change when the locations of the grids are interchanged.
In the following figure, P3 is the source and P1 and P2 are the sinks. We see that interchanging the position does not change the route.
Consider the three grid locations are (i1, j1), (i2, j2) and (i3, j3). We compute congestion due to three-grids using two functions:
In the below function all congestion cost computation takes into account the weight.
First we describe these two functions and then we describe how the congestion due to three grid nets are computed.
The inputs are three grid id and net weight. We consider the following grids are (i1, j1), (i2, j2) and (i3, j3) where i1 < i2 < i3 and (j1 < j2 < j3) or (j1 > j2 > j3).
The inputs are three grid id and net weight. We consider the following grids as (i1, j1), (i2, j2) and (i3, j3) where (j1 <= j2 <= j3 ) or (j1 >= j2 >= j3).
The inputs are three grid locations and the net weight.
The following four figures represent the four cases mentioned in the above procedure from point two to point five.
Figure corresponding to point two.
Figure corresponding to point three.
Figure corresponding to point four.
Figure corresponding to point five.
Macro congestion is induced by the location of hard macros over the grid cells. For each hard macro, we need to consider its dimension of overlapping over the grid cells and the macro routing resources given. The computation of macro congestion is quite straightforward. We just need to add the rout- ing resources blocked by the macros to the corresponding boundaries of the gridcells.
When a macro overlaps with multiple gridcells, if any part of the module partially overlaps with the grid cell (either vertically, or horizontally), we set the top row (if vertical) or right column (if horizontal) to 0. We define partially overlaps as when a hard macro does not fully cover a grid cell.
Vertical Partial Overlap is when in vertical direction, a macro (purple) is not entirely all covering the grid cells it overlaps with. Shown in the picture below. In this case, we set the macro congestion of grid cells from the top row (red) to 0.
Horizontal Partial Overlap is when in horizontal direction, a macro (purple) is not entirely all covering the grid cells it overlaps with. Shown in the picture below. In this case, we set the macro congestion of grid cells from the right column (red) to 0.
Note that these two situations are mutually inclusive.
Finally, we provide our computation steps below: