Teaching an agent to place chip macros.

A from-scratch rebuild of Google's reinforcement-learning method for chip floorplanning, added to one piece at a time and measured at every step.

The trained V2 agent placing four macros one at a time, then twelve standard-cell clusters settling around them, with the wirelength, congestion, and density scores updating.
The trained V2 agent places four macros one at a time, then the standard-cell clusters settle around them. (Here clusters are kept clear of the macros at every step, so the final scores differ slightly from V2's results.)
macros (placed by the agent)standard-cell clusters

Summary

In 2021, Google researchers reported that a reinforcement-learning agent could produce chip floorplans as good as or better than human experts' in under six hours (Mirhoseini, Goldie, et al., Nature 2021, with open-source code in Circuit Training). This project rebuilds that method from scratch at laptop scale, in six versions. Each version adds one piece of the paper and is measured against random placement on the same problems. The goal was to understand each piece of the method by building it, and to find out which pieces actually help at this scale.

In short: the learning works, but learning to place well on new problems is hard. On one fixed problem, the agent learns a layout that beats 90 percent of random ones. On 200 problems it has never seen, it is only 2.6 percent better than random, and adding the paper's graph network and spatial output layer did not change that. See the results.

The problem

A chip is built from two kinds of blocks. Macros are large fixed blocks, such as memories, that each take up a big rectangle of the chip. Standard cells are the small logic gates that make up the rest, often millions of them. Wires called nets connect them. Where the macros go decides how long those wires must be and how crowded the chip becomes. This step, macro placement, is still largely done by hand, and the paper notes that it takes human experts several weeks for each block of a modern chip.

The paper turns it into a game played on a grid laid over the chip. An agent places the macros one at a time, each on a grid cell, and may not pick a cell where the macro would overlap another or hang off the edge. Once every macro is down, a fixed rule places the standard cells, which are grouped into clusters to keep their number manageable. The finished layout then gets one score, and that score is all the agent learns from.

The problems here are small. Most versions place 4 macros and 12 clusters on a 25 × 25 grid, and the scaling study goes up to 14 macros. The paper's designs have tens to hundreds of macros and millions of standard cells. They are kept small so that each version trains in an hour or less on one laptop, because every episode runs the cell placement and scoring on the processor.

How the standard cells are placed

The clusters are placed by force-directed placement, which works like objects joined by springs, sliding until the forces balance. Three forces act on each cluster.

PULL net center PUSH range: 3.5 cells KEEP OUT macro plus a one-cell margin Each cluster is pulled toward the center of every net it belongs to. Clusters closer than 3.5 cells push apart, so they do not pile up. Macros never move. A cluster that lands on one is pushed back out.
The clusters take 60 small steps under these forces, and a final clean-up pass makes sure no cluster is left on a macro. These are V2's settings. V3 onward use an earlier version of the rule, noted under V3 below.

How a layout is scored

The true test of a layout is a full place-and-route run, which takes minutes to hours. Training needs tens of thousands of layouts, so the paper scores each one with three fast estimates, which it calls proxies. In V2, a whole episode, including the cell placement and the scoring, takes about 16 milliseconds.

WIRELENGTH width height CONGESTION overlap = busier cells DENSITY darker = more area in that bin For each net, width + height of the box around it. Summed over all nets. Each net's wire is spread evenly over its box. Score: the average of the busiest 10 percent of cells. Each object's area is added to the bin holding its center (8 × 8 bins). Score: average of the busiest 15 percent.
Lower is better for all three.

The three scores are combined into one cost, and the reward is its negative.

cost=0.1·W+10·C+2·Dreward=−cost
W
total wirelength (about 80 to 150 on these problems)
C
congestion (about 1.1)
D
density (about 11)
0.1,10,2
weights that set how much each score counts. With these values, density makes up about half of the total cost

How the agent learns

Think of learning a video game with no instructions. You press buttons, see what happens, and watch your score. Over many games you repeat what tended to raise the score and drop what did not. Reinforcement learning is that process, run by a computer for thousands of rounds.

Agent makes decisions Environment reacts to them ACTION what the agent does STATE + REWARD what it now sees, and a score Repeat. One full attempt from start to finish is an episode.
Agent

The decision-maker.

Here: a neural network.

State

What the agent can see when it decides.

Here (in V1): which cells are taken, where the next macro's connected neighbors sit, and which macro is next.

Action

One choice the agent makes.

Here: the cell where the next macro goes.

Reward

A number saying how good the outcome was.

Here: minus the layout's cost, so cheaper layouts score higher.

Episode

One complete attempt, start to finish.

Here: placing every macro once.

Policy

The agent's strategy: how likely it is to pick each action in each state.

Training changes this.

Why each piece is there

All four of these choices are taken directly from the paper, and every version keeps them.

01

Mask illegal moves, do not penalize them

What: illegal cells are removed before the agent chooses, using MaskablePPO (Maskable Proximal Policy Optimization) from sb3-contrib.

Why: a penalty only discourages overlap. A mask makes it impossible, so no training time is spent learning the rule.

02

One macro per step

What: place one, look, place the next.

Why: a few small decisions are far easier to learn than one giant one.

03

One reward, at the end

What: no score until the layout is complete.

Why: a floorplan is only good or bad as a whole. The cost: the agent must work out which moves earned the score.

04

A grid of choices

What: the action is a grid cell (625 options on a 25 × 25 grid).

Why: a fixed list of choices makes masking easy. The cost: positions snap to the grid.

How the agent gets better

The policy starts out random. Over thousands of episodes, training shifts probability toward the choices that led to cheaper layouts. The method that decides how to make each shift is Proximal Policy Optimization (PPO), the same one the paper uses.

How training works, step by step: from policy gradient to Proximal Policy Optimization (PPO)
BEFORE TRAINING every cell about equally likely: random play thousands of episodes AFTER TRAINING probability piles up on the cells that led to short wires
Each bar is the chance of placing the next macro in one candidate cell.

The policy starts out random. Inside, it is a small neural network controlled by tens of thousands of adjustable numbers (81,936 in V1), written θ (theta). Think of them as knobs: turn them and the probabilities change. A training method is a rule for which way to turn the knobs after each batch of episodes, and how far. There are two broad families of rules.

VALUE-BASED Learn a score for every action, then take the highest Example: Q-learning (Q for quality) Not used here: the paper took the other route POLICY-BASED: LEARN THE PROBABILITIES 1. Policy gradient push choices up in proportion to their score 2. Actor-critic + a critic that predicts the score in advance 3. Proximal Policy Optimization (PPO) + a limit on each update. Used here.
Each step on the right keeps everything above it and fixes one weakness.

The math, step by step

The other family

Value-based: Q-learning (Q for quality)

Keep a score for every action in every state: how much reward to expect after taking it. Play by taking the highest-scoring action. After each move, nudge that score toward what actually happened.

Q(s,a)←Q(s,a)+α[r+γmaxa′Q(s′,a′)−Q(s,a)]
Q(s,a)
the score: expected future reward for action a in state s
α
step size: how big each nudge is
r
the reward just received
γ
how much future reward counts compared with reward now
maxa′Q(s′,a′)
the best score available from the next state

The strategy is only implied: always take the top score. The paper learns the strategy itself, so this project does too.

Step 1

Policy gradient: learn the probabilities directly

Skip the scores. After an episode, turn the knobs so each choice becomes more likely in proportion to the score that followed it.

θ←θ+α·G·∇θlog⁡πθ(a|s)
θ
the knobs: every adjustable number in the network
πθ(a|s)
the probability the policy gives action a in state s
∇θlog⁡πθ(a|s)
which way to turn each knob to make action a more likely (the log points the same way and keeps the math simple)
G
the score that followed this choice. Here: minus the final cost
α
step size: how far to turn

Still a problem: here every score is negative, because it is minus the cost. So every choice gets pushed down, only by different amounts. Learning is slow and noisy.

Step 2

Actor-critic: judge each choice against what was expected

Add a second small network, the critic, that looks at the state and predicts the score the episode will end with. The policy is now called the actor. Each choice is judged by how much better or worse things went than the critic predicted.

A=G−V(s)θ←θ+α·A·∇θlog⁡πθ(a|s)
V(s)
the critic's prediction: the score it expects from state s. The critic is trained alongside the actor to predict better
A
the advantage: positive if the episode beat the prediction, negative if it fell short

Fixes: better-than-expected choices go up and worse ones go down, even when every score is negative. Still a problem: nothing limits how far one update turns the knobs. One lucky batch can make a mediocre move look great, and a big overreaction can wreck what thousands of episodes taught.

Step 3: used here

Proximal Policy Optimization (PPO): limit each update

"Proximal" means "nearby": each update must keep the new policy close to the old one. Measure how much each choice's probability has changed with a ratio, and stop rewarding change beyond a small band.

ρ=πθ(a|s)πold(a|s)L=min⁡(ρA,clip⁡(ρ,1−ε,1+ε)A)
πold(a|s)
the probability before this update began
ρ
the ratio: 1.0 means unchanged, 1.2 means 20 percent more likely
ε
the allowed band. Here 0.2, so the ratio is capped between 0.8 and 1.2
clip
holds the ratio inside that band
min
takes the more cautious of the two versions
L
the objective. Training turns θ to make it as large as possible

Fixes: no single update can move far, so one noisy batch cannot undo past learning. Because each step is safe, every batch is reused for 10 passes instead of being thrown away after one.

0.8 1.0 1.2 flat: no more push A GOOD CHOICE (A > 0) L rises as the choice becomes more likely stops rising at 20 percent more likely 0.8 1.0 1.2 flat: no more push A BAD CHOICE (A < 0) L rises as the choice becomes less likely stops rising at 20 percent less likely Horizontal axis: ρ, the new probability divided by the old one (1.0 = unchanged).
Training turns θ to make L larger. Where the line is flat, turning θ cannot raise L any further, so that choice stops being pushed for the rest of this batch.

An earlier method, Trust Region Policy Optimization (TRPO), enforced a similar limit with much heavier math. Proximal Policy Optimization (PPO) gets most of the benefit with a simple clip, which is why it became the standard. In this project each batch is 2,048 placements, and the code uses a smoothed form of the advantage called Generalized Advantage Estimation (GAE); the idea is the same.

The six versions

Each version keeps everything before it and adds one piece of the paper, so that each piece's effect can be measured on its own. The results for all six follow in the next section, and the learning method itself is explained after that.

V1: the learning loop

The loop in its simplest form: eight macros, each a single cell, on a 20 × 20 grid, with no standard cells. The reward is minus the total wirelength. V1 trains and is tested on one fixed problem, so it can memorize the answer. That is deliberate: it proves the machinery before asking it to generalize.

INPUT 1 Taken cells 0 1 2 macros 0, 1 and 2 are placed; macro 3 is next INPUT 2 Macro 3's placed neighbors 0 2 macro 3 connects to 0 and 2, so only their cells are marked THE MASK Cells it may choose 0 1 2 every empty cell is allowed; a good pick sits beside 0 and 2 Drawn at 8 × 8 for readability. On the real 20 × 20 grid, 397 of 400 cells are allowed at this step.
The agent sees the two grids, plus which macro is next. Input 2 is the strong hint: it shows where the next macro's connections already sit. In V1 every macro fills a single cell, so the mask only removes cells that are already taken. From V2 on, macros have real sizes and the mask checks the whole footprint.
STEP 1 STEP 2 STEP 3 … STEP 8 Score the finished layout reward = −wirelength reward 0 reward 0 reward 0 reward 0 The single end-of-episode reward is credited back to every placement that led to it. The agent has to work out which of those early moves actually earned it.
Each step places one macro (outlined: the newest) and earns nothing. Only the finished layout is scored, and that one score judges all eight choices.

V1 source on GitHub →

V2: the paper's score

Three changes bring the problem in line with the paper. The macros get real sizes: four rectangles (4 × 4, 3 × 5, or 5 × 3 cells) on a 25 × 25 grid, and the mask now allows a corner only if the whole rectangle fits without overlapping another macro. Twelve clusters of standard cells are added and placed by the force-directed rule. The reward becomes the three-part cost. The agent and its training settings are unchanged, and it still trains and is tested on one fixed problem.

1. AGENT PLACES 4 MACROS 2. CELLS SETTLE AROUND THEM 3. SCORE THE LAYOUT wirelength congestion density reward = −cost Real sizes: the mask checks the whole rectangle 12 clusters, 60 steps of the force-directed rule Three scores replace wirelength alone Stages 2 and 3 run on the processor, once per episode: about 8 milliseconds, against about 3 for the agent's four moves.
One V2 episode. The line under each stage is what V2 adds to V1. Times are averages over 200 episodes of the trained V2 agent on one processor thread, not counting the learning updates. Stages 2 and 3 grow with the number of clusters and nets, which is why the problems are kept small.

V2 source on GitHub →

V3: a new problem every episode

From solving one problem to learning a placer. Each episode now starts with a fresh random problem: every macro gets a random width and height between 3 and 5 cells, every cluster a random area, and the connections are redrawn. The number of macros and clusters stays fixed, so the agent's inputs and choices keep the same shape, and two extra inputs tell it the current macro's width and height. Training and test problems come from two separate random streams, so no test problem is ever seen in training.

TRAINING STREAM TEST STREAM episode 1 15 nets episode 2 15 nets episode 3 16 nets … test 1 16 nets test 2 15 nets … 75,264 problems, each seen once 200 problems, never seen in training
Real problems from the generator, with each problem's four macros drawn to scale. Only the sizes and the connections change: there are always four macros and twelve clusters.
A note on cell placement V3 and the later versions use an earlier version of the cell-placement step than V2. Its clusters start at the center of the grid rather than among the macros, every pair of clusters pushes apart however far apart they are, and the final clean-up runs once and keeps clusters about half a cell clear of a macro instead of a full cell.

V3 source on GitHub →

V4: the netlist as a graph

V4 lets the agent see the whole netlist. Up to V3, its only clue about wiring is which placed macros share a net with the next one. But nearly every net includes a cluster, so most links between macros pass through a cluster, and V3 never sees them.

WHAT V3 SEES macro A cluster c (unseen) macro B, next WHAT V4 SEES macro A cluster c macro B, next A and B share no net, so there is no link. B could go anywhere. A connects to c, and c connects to B. B belongs near A, with c between them.
The same three objects as each version sees them. V3 only knows which placed macros share a net with the next macro, so links that pass through a cluster are invisible to it.

To show it everything, V4 draws the netlist as a graph, the central idea of the paper. Every macro and cluster is a point, a line joins two objects that share a net, and each object carries eight numbers about itself.

THE NETLIST AS A GRAPH being placed now 8 NUMBERS FOR EVERY OBJECT Is it a macro or a cluster? (2 numbers) Is it placed yet? Is it the macro being placed now? Width and height (a cluster: its area) Center x and y, once placed Plus the 25 × 25 grid of taken cells, as before.
Squares are macros and dots are clusters. A line joins two objects that share a net. Some clusters are left out for clarity.

A graph network then condenses the graph into a few numbers the agent can use. It works in rounds, like news passing between friends: in each round, every object blends its numbers with its neighbors' numbers. After two rounds, the macro about to be placed has heard from objects up to two connections away, which is enough to see that A, c and B belong together.

THE CHIP: 25 × 25 GRID NOT PLACED YET macro 1 macro 2 macro 3, next macro 4

One action. Macros 1 and 2 are already on the chip, and the agent must now place macro 3 (outlined). Clusters are placed only after every macro, so for now they exist only in the graph. Each line is a shared net.

A real action from the trained V4 agent on one of the 200 test problems. The macro sizes and positions, the nets and the glow strengths (the network's averaging weights, before the learned layer W) are the actual ones. Only the positions of the unplaced objects on the right are chosen for drawing.
The math: one round of mixing
Hnew=ReLU(A^HW)
H
every object's numbers, one row per object
A^
who connects to whom, including each object to itself, scaled so that heavily connected objects do not drown out the rest
W
learned weights, separate for each round. They describe no particular graph: the same W is applied to every object, in every problem. It is a recipe that turns each object's mixed numbers into new ones, each new number a weighted blend of the old ones (8 numbers become 32 in round 1, and 32 stay 32 in round 2). Training tunes the recipe so that the new numbers carry whatever helps the agent place macros well.
ReLU
Rectified Linear Unit (ReLU): keeps positive values and sets negative ones to zero

The rest of the agent is unchanged from V3. The graph's summaries are simply added to what it already sees.

INPUTS Netlist graph 8 numbers per object Grid of taken cells 25 × 25, as before Graph network 2 rounds of mixing Two summaries macro being placed: 32 all objects, averaged: 32 Grid summary 64 numbers Score all 625 cells, pick one
The graph network only adds the top path. The grid path and the layers that score the 625 cells work as in V3.

The graph network is small, only 1,344 adjustable numbers. Most of the policy's 110,961 still sit in the grid summary and in the layers that score the 625 cells.

V4 source on GitHub →

V5: a spatial output layer

V5 changes only the agent's very last step: turning its summary of the situation (64 numbers) into 625 scores, one per cell of the grid. The macro goes to the best-scoring cell it fits in.

V4 does this with a plain layer, which gives every cell its own private set of weights. Picture a theater with a separate judge for each of its 625 seats, each judge with their own rulebook. Seats 12 and 13 are almost the same seat, yet what judge 12 learns teaches judge 13 nothing, so every judge has to learn on their own.

A convolution replaces the 625 rulebooks with one small rule card. The card looks at a 3 × 3 patch, a cell and its eight neighbors, and is slid across the whole grid, so every cell is scored the same way. A lesson learned at one spot now applies everywhere, and neighboring cells, whose patches overlap, get similar scores.

PLAIN LAYER (V4) CONVOLUTION (V5) Every cell has its own weights. A lesson about one cell stays with that cell. One 3 × 3 rule card, slid over every cell. A lesson learned anywhere applies everywhere.
A small corner of the 25 × 25 grid. On the left, each shade stands for one cell's private weights. On the right, the card scores the dark center cell from the 3 × 3 patch around it, then moves on. Neighboring cells share most of their patch, so they get similar scores.

The paper builds its grid of scores with deconvolution layers. A deconvolution works the other way round from a convolution: it grows a small picture into a bigger one, like enlarging a thumbnail, with learned weights filling in the detail. The paper starts from a tiny map and doubles it five times. V5 takes a simpler route to the same end, called a spatial head here: it turns the 64 numbers into a small 5 × 5 map, stretches that to 25 × 25 by plain resizing, then runs convolutions over it.

64 NUMBERS averaged over its 32 layers SCORES darker = higher score

V5 placing macro 3, on the same test problem as the figure above (macros 1 and 2 are outlined on the right). Everything starts from the agent's summary of the situation: 64 numbers.

The real values from the trained V5 agent on one of the 200 test problems. From step 3 on, the maps are shown averaged over their 32 layers, and darker means larger. Each score depends only on the 3 × 3 patch around its cell, across all 32 layers: the 3 × 3 convolution and the final 1 × 1 convolution act together as one card.

V5 source on GitHub →

V6: a scaling study

V3 to V5 all use four macros. The paper's designs are far larger, so V6 asks whether the graph policy pulls ahead as problems grow. The number of macros, the number of clusters and the grid all grow together, and macro sides grow with the grid, up to a sixth of its width.

MacrosClustersGridCells to choose from
41225 × 25625
61831 × 31961
82435 × 351,225
103040 × 401,600
123643 × 431,849
144247 × 472,209

Two policies are trained at every size. The graph policy is V5's design. The flat policy gets exactly the same inputs but reads them as one long list with ordinary layers, with no message passing and no spatial head, so it is not V3's flat-grid policy. Every run gets the same budget of 100,000 placements, a third of V3's, so larger problems get fewer episodes: 25,000 at 4 macros, but only 7,142 at 14. The test is also lighter: each size is tested on 40 unseen problems, and each problem is compared with a single random layout, not 100.

V6 source on GitHub →

Results

VersionTested onLearned costRandom averageBetter than random byRandom layouts it beats
V1One fixed problem12 (wirelength)133 (wirelength)91 percentAll 2,000
V2One fixed problem42.144.75.8 percent90 percent
V3200 unseen problems44.145.22.6 percent70 percent
V4The same 20044.145.22.4 percent70 percent
V5The same 20044.345.22.1 percent67 percent
V640 unseen problems at each of 6 sizesFlat and graph policies, 4 to 14 macros−0.9 to +2.7 percentWithin the noise

Lower cost is better. Cost is the weighted sum of wirelength, congestion and density; V1 is scored on wirelength alone. Random placement drops each macro on any allowed cell, on the same problems. "Random layouts it beats" compares the learned layout with every random layout drawn for the same problem.

One fixed problem: the loop works (V1 and V2)

V1, scored on wirelength alone, packs connected macros tightly together. Its layout needs about a tenth of the wire of an average random one.

A random placement: macros scattered across the grid with long crossing nets.
Random (a typical example, close to the average of 2,000 random layouts): wirelength 133.
The learned placement: macros gathered into one tight overlap-free cluster.
Learned: wirelength about 12, with zero overlaps.

V2, scored the paper's way, has a lower total cost than 90 percent of 1,000 random layouts. It gets there by trading: much shorter wires, the same congestion, and slightly worse density.

A random macro placement with clusters and nets around it.
Random (a typical example, with a total cost close to the random average): wirelength 111, congestion 1.18, density 10.9.
The learned macro placement with macros grouped around the clusters.
Learned: wirelength 82, congestion 1.12, density 11.3. Red: macros. Green: cell clusters. Faint lines: nets.
Score (lower is better)Random averageLearnedLearned beats
Wirelength1178298 percent of random
Congestion1.111.1247 percent of random
Density10.911.319 percent of random
Total cost44.742.190 percent of random

The trade follows from the problem. The four macros hold more area than all twelve clusters combined (62 cells against 50). Packing them together saves a lot of wire, but it also crowds the busiest bins, which raises density. Of the three weighted terms, wirelength changes the most from one layout to another, so it is where the agent has the most to gain.

A robustness check confirms that this result is not an artifact of chance. The force-directed step starts from a random seed, and training always used the same one. Rescored with 20 other seeds, the learned layout still beats random 95 percent of the time.

Unseen problems: a small gain, unchanged by the paper's architecture (V3 to V5)

V3, V4 and V5 were each tested on the same 200 unseen problems, against the same 100 random layouts per problem.

A random macro placement on a test problem, with clusters and nets around it.
Random (a typical layout, with a cost close to the random average): wirelength 146, congestion 1.31, density 9.3.
The learned macro placement on the same test problem, with the macros grouped closer around the clusters.
Learned: wirelength 122, congestion 1.28, density 9.8. The agent never saw this problem in training, and its gain here is the median gain across the test problems.
Score (lower is better)Random averageV3 (flat)V4 (graph)V5 (graph, spatial head)
Wirelength123114114115
Congestion1.141.131.141.13
Density10.810.710.710.7
Total cost45.244.144.144.3
Share of random layouts beaten70 percent70 percent67 percent

V3's gain over random is real but small, and almost all of it is shorter wiring: its congestion and density are no better than chance. It is not memorizing, because it scores about the same on 200 problems it trained on (44.2) as on unseen ones (44.1). The graph network (V4) and the spatial head (V5) made no measurable difference: V4 beats V3 on 99 of the 200 problems, a coin flip, and V5 beats it on 92, within the margin of error.

Limits Keeping the cheapest of 100 random layouts beats V3 on 191 of the 200 test problems, V4 on 191 and V5 on 197. Each version was trained once, so small differences between versions could be run-to-run variation.

Why: one fixed arrangement

None of the three policies reads the problem much. On the 200 test problems, V4 put its first macro on the same cell every time, and its second macro on the same cell in 153. V5 holds its arrangement even more firmly: 194 and 195. V3 behaves the same way. Deleting all of the netlist's connections from V4's input never changes its first move, and changes 366 of its 800 moves in total. Each has learned one good general arrangement, not a way to adapt to the problem in front of it, so a better view of the problem has nothing to work with.

RANDOM V4, LEARNED Darker = covered by a macro in more of the 200 test problems. Full color = every problem.

Does the graph policy pull ahead with size? (V6)

The study ran twice. The first run (3 sizes, 25 test problems, and very slightly different 8- and 14-macro problems) showed the graph policy rising with size, from 1.3 to 2.0 to 2.4 percent better than random, which looked like the paper's advantage appearing. The second run (6 sizes, 40 test problems) did not show it. The flat policy came out ahead at all six sizes, and both policies fell toward random as the problems grew.

−2 −1 0 +1 +2 +3 +4 random 4 6 8 10 12 14 Number of macros Percent better than random Flat policy, second run, 4 macros: +2.6 percent Flat policy, second run, 6 macros: +1.6 percent Flat policy, second run, 8 macros: +2.4 percent Flat policy, second run, 10 macros: +1.3 percent Flat policy, second run, 12 macros: +1.1 percent Flat policy, second run, 14 macros: -0.3 percent Flat policy, first run, 4 macros: +2.1 percent Flat policy, first run, 8 macros: +0.5 percent Flat policy, first run, 14 macros: +1.7 percent Graph policy, second run, 4 macros: +2.7 percent Graph policy, second run, 6 macros: +1.3 percent Graph policy, second run, 8 macros: +0.1 percent Graph policy, second run, 10 macros: +0.3 percent Graph policy, second run, 12 macros: +0.1 percent Graph policy, second run, 14 macros: -0.9 percent Graph policy, first run, 4 macros: +1.3 percent Graph policy, first run, 8 macros: +2.0 percent Graph policy, first run, 14 macros: +2.4 percent Flat policy Graph policy second run (lines) first run
Error bars show about ±1.1 points, the spread that comparing with a single random layout per problem causes on its own (measured on 4-macro problems). They leave out variation between training runs, which the two 4-macro results show is at least as large.
The numbers behind the chart
MacrosFlat, second runGraph, second runFlat, first runGraph, first run
4+2.6+2.7+2.1+1.3
6+1.6+1.3
8+2.4+0.1+0.5+2.0
10+1.3+0.3
12+1.1+0.1
14−0.3−0.9+1.7+2.4

Each number is the percentage by which the policy's average cost is lower than random placement's, on that size's test problems. Positive means better than random, negative means worse. Flat and graph are the two policies, and blank cells are sizes the first run did not test.

It is tempting to read the second run as refuting the first, but neither run is precise enough to settle anything. Comparing each problem with a single random layout moves each number by up to about 1.1 points on its own, and the gap between the two policies by about 1.6. Training once per point adds at least as much: at 4 macros, with identical settings and test problems, the graph policy scored 1.3 percent in one run and 2.7 in the other. Against that noise, the first run's rising line is not a real trend, and in the second run only the 8-macro gap (2.3 points) clearly exceeds the margin.

What V6 can and cannot say At this training budget, run-to-run noise is as large as any difference between the policies, so this study cannot tell whether the graph policy pulls ahead with size. It also starves the larger problems: at 14 macros each run sees under a third as many episodes as at 4, while choosing among more than three times as many cells. A fair test needs several training runs per point, many random layouts per problem, and a training budget that grows with problem size.

Compared with the paper

The paper's details are from its arXiv version.

AspectThe paperThis project
Learning methodProximal Policy Optimization (PPO), one macro per step, illegal cells masked, one reward at the endThe same, in every version
Design sizeTens to hundreds of macros, millions of standard cells4 to 14 macros
Standard cellsGrouped into a few thousand clusters by a partitioning tool12 to 42 clusters made by a generator (from V2)
GridUp to 128 × 12820 × 20 to 47 × 47
Congestion estimateBased on how wires would actually be routedRectangular Uniform wire DensitY (RUDY): each net's wire spread evenly over its box
DensityAlso enforced as a hard rule during placementOnly a penalty in the reward
Training problemsA library of real chip designsSmall random problems from a generator (from V3)
TestingNew designs, both directly and after extra training on each one (fine-tuning)Unseen random problems, directly only
Graph networkEdge-based: every connection gets its own learned summary, and each object averages its connectionsPlain message passing: each object averages its neighbors (V4)
How the graph network is trainedFirst trained on its own to predict the wirelength and congestion of 10,000 placements of 5 netlists, then reused inside the policyLearned from scratch, from the reward alone
Extra inputsA summary of the design and technology: routing capacity, object counts, canvas sizeNone
Output layerFive deconvolution layers, each doubling the map's size with learned weights, with batch normalization between themOne smooth stretch from 5 × 5 to 25 × 25 with no learned weights, then two convolutions (V5)
Training per designHours: fine-tuning for 2 to 12 hours, or more than 24 hours from scratchMinutes to about an hour
ComputeMany machines in parallelOne laptop

The rows on training and compute matter most for reading the results: the paper's main claimed benefit, learning from past chips, depends on exactly the things this project cannot afford.

Training runs

V1 to V5 use the same training settings: batches of 2,048 placements, each reused for 10 passes.

VersionEpisodesPlacementsHardwareTime
V125,088200,704Laptop processor (Intel Core i9-14900HX)About 4 minutes
V262,976251,904Laptop processorAbout 45 minutes
V375,264301,056Laptop processorAbout an hour (estimated)
V475,264301,056Laptop NVIDIA graphics card for the network, processor for cell placement and scoringAbout 45 minutes (estimated)
V5100,352401,408Same as V4About 46 minutes (estimated)
V67,142 to 25,000 per run100,000 per run, 18 runsLaptop graphics cardNot recorded

Estimated times come from timing 8 batches and scaling up. V2 takes about ten times longer than V1 because every episode now ends with the force-directed step and three scores. V6 did not save its trained policies, so its numbers cannot be re-measured without training again.

Conclusion

The learning loop works. On one fixed problem, the agent finds placements that beat 90 percent of random layouts and use 30 percent less wire. Learning a placer that works on new problems is much harder. Tested on 200 problems it never saw, the agent did only 2.6 percent better than the average random layout, and keeping the cheapest of 100 random layouts beat it on 191 of them. The paper's graph network and spatial output layer did not change this: every version learned one fixed arrangement and used it on every problem. A first scaling study hinted that the graph network helps on larger problems, but a repeat run did not show it, and the noise between runs is too large for either run to settle the question.

Limits and next steps

  • One training run per version. Differences smaller than the variation between runs cannot be seen, and V6 shows that this variation is at least as large as the effects being measured.
  • Small problems. With 4 to 14 macros there is little structure for a graph to exploit and little room above random placement.
  • No learning from past chips. The paper's main claimed benefit, training on a library of designs and then fine-tuning on a new one, is not reproduced.
  • Fast estimates only. Layouts are scored by the three proxies, never by a real place-and-route run.
  • An older cell-placement rule from V3 on, as noted under V3.

The next step is speed. Testing at real scale, with hundreds of macros, several training runs per point and a training budget that grows with problem size, needs a much faster environment. That means rewriting the cell placement and scoring to run on the graphics card so that many episodes run in parallel, and then more compute than one laptop.

Code

Built with Python, PyTorch, Gymnasium, Stable-Baselines3 and sb3-contrib (MaskablePPO, Maskable Proximal Policy Optimization), NumPy and Matplotlib.