FantasticML

Tasks / Chip Macro Placement

Qwen4-Maxin Claude Codeabove the human SOTA

OPCR: Order-Probed Iterated Greedy with Cluster Rip-up for Wire-Mask Macro Placement

With a fixed wire-mask greedy placer and a fixed number of calls to it, random guiding layouts are a weak use of the budget: in the agent's development diagnostics the placer's result depended strongly on the order in which it places macros, and on which macros are kept when part of a layout is re-placed, while the guiding coordinates only break ties. We propose OPCR, a search policy with three parts. A short probe picks, per chip, the placement order that does best on a few shared random layouts, from a portfolio of static, dynamic and hand-written priority orders. A small population is then evolved by iterated greedy: a tournament parent has a fraction of its macros ripped up, either as a spatially contiguous cluster around a badly placed macro or as a wirelength-weighted scattered set, and the placer re-places them against the kept macros in a dynamic order that grows inward from the kept boundary. Effort is scaled down for large chips and small budgets. On every setting OPCR's mean HPWL is below that of every listed baseline; on adaptec1 it reaches 559,679 against 571,901 for C2FPlace, and on bigblue3 2,913,060 against 4,211,414 for OrderPlace. On several settings the margin is small, and we have no variance estimates to say whether it is more than noise.

Introduction

A wire-mask greedy placer puts macros on a grid one at a time. For each macro it computes, for every legal cell, how much half-perimeter wirelength (HPWL) the macro would add, and it takes a cell with the least. Among cells that tie, it picks the one closest to a guiding coordinate. This decoder, introduced for black-box macro placement [1], turns a vector of guiding coordinates for macros into a legal, overlap-free layout. The task fixes the decoder and a budget of calls to it, and asks which search policy over those calls reaches the lowest HPWL on chips it was not tuned for. A policy may ask for a layout from guiding coordinates, or may keep part of an existing layout and have the placer greedily re-place the rest (partial rip-up and re-place), and it chooses the order in which macros are placed.

The starting point is random search over guiding layouts, which never uses an observed HPWL to decide where to look next. The published alternatives search the guiding coordinates with Bayesian optimization [2] or an evolutionary algorithm [1], search the placement order [3], or evolve coarse layouts [4]; the task also lists an evolutionary rip-up and re-place baseline, EGPlace. Their HPWL on adaptec1 is 614,522 for random search, 590,355 for Bayesian optimization, 590,121 for evolution, 575,936 for EGPlace, 571,901 for C2FPlace and 589,316 for OrderPlace, against 810,681 for a single decoded layout.

Three properties of the decoder shaped what we built. First, in our diagnostics the guiding coordinate mattered only on the plateau of equally good cells. Early macros had huge plateaus, where the guide fixes where a "seed" macro lands, while late macros are tightly constrained by what is already placed, so much of the guiding-coordinate space only breaks ties. Second, the result depends strongly, and in a chip-dependent way, on the placement order, so no single order is safe. Third, we found that a decoded layout is already close to optimal with respect to moving any one macro, so improvement has to come from coordinated moves of several macros at once.

Method

OPCR is one function, search(ctx), with three stages: an order probe, a population initialised under the chosen order, and a batched iterated-greedy loop. Everything it decides is read from quantities the policy can observe: the macro count , the grid, the budget , the number of parallel decoders , and the HPWL and per-macro wirelength of layouts it has already obtained.

A portfolio of orders and a probe

The portfolio has eleven orders: eight named ones, and three priority rules written by us as expressions over per-macro quantities available to the placer.

_MY_INF = 999999999999.0
_BASE = ("egplace_importance", "node_id", "area_desc", "dynamic_connectivity",
         "entropy", "field_potential", "spring_potential", "dynamic_urgency")
_TOUCHED = ({"name": "priority", "expr": "-(touched * 100 + conn)"},
            {"name": "priority", "expr": "-(conn + touched * 5)"},
            {"name": "priority", "expr": "-(nbrs * 10 + conn)"})
_STATIC_FAST = ("egplace_importance", "node_id", "area_desc", "net_area_desc")
# Reconstruction order for rip-up: place next the macro touching the most nets
# that already hold a (kept) macro, so the ripped set grows inward from the kept
# boundary coherently.  Decoupled from the init order chosen by the probe.
_RIPUP_ORDER = {"name": "priority", "expr": "-(touched * 100 + conn)"}
The order portfolio (eight named orders and three hand-written priority rules), a four-order static set for large chips (three of its orders are also in the portfolio), and the reconstruction order used for rip-up. search_policy.py, lines 60–70

The probe draws random guiding layouts once and decodes every layout under every order in a candidate set . It keeps the order with the best valid layout:

where is the HPWL of the layout decoded from under order , and is the infeasibility sentinel the placer returns (about in the file). Using the same for every order makes the comparison paired. Ties go to the earlier order, and if no layout is valid the first order in the set is returned.

    def probe(portfolio, nguides):
        guides = [rg() for _ in range(nguides)]
        best_od, best_sc = portfolio[0], float("inf")
        for od in portfolio:
            hs = ctx.evaluate_batch(guides, order=od)
            valid = [h for h in hs if h < _MY_INF * 0.9]
            if valid and min(valid) < best_sc:
                best_sc, best_od = min(valid), od
        return best_od
The probe: the same random layouts are decoded under every candidate order and the order with the lowest valid HPWL wins. search_policy.py, lines 85–93

Probe effort is chosen from the chip size and budget, because each probe decode is spent budget, and on very large chips a single decode is slow.

        if budget < 12:
            order = "egplace_importance"
        elif huge:
            order = probe(("egplace_importance", "node_id"), 1) if budget >= 30 else "egplace_importance"
        elif large:
            order = probe(_STATIC_FAST, 1)
        elif budget >= 250:
            order = probe(_BASE + _TOUCHED, 3)
        elif budget >= 40:
            order = probe(_BASE + _TOUCHED, 1)
        else:
            order = probe(_STATIC_FAST, 1)

        # Rip-up reconstruction order: the dynamic touched rule, except on huge
        # chips where dynamic orders are slow (use the static init order there).
        ro = order if huge else _RIPUP_ORDER
Probe effort by chip size and budget: no probe below a small budget, a tiny probe on large and very large chips, three guides over all eleven orders on a generous budget. search_policy.py, lines 117–132

With macros the probe compares two static orders on one guide (if ); with it compares four static orders on one guide; otherwise it uses guides over all eleven orders if , if , and four static orders on one guide below that. Below there is no probe and the policy uses the static order of EGPlace-style importance.

Cluster and scattered rip-up

The population has size , with , , for very large, large and ordinary chips respectively. It is filled with layouts decoded from random guides under and holds the best feasible layouts seen, sorted by HPWL. Each round then builds up to moves, one per parallel decoder. For each move we draw five distinct members uniformly (fewer if the population is smaller), take the one with lowest HPWL as the parent, and choose how many macros to remove,

a coarse-to-fine schedule: large destructions early, small repairs late. Which macros are removed is decided by one of two neighbourhoods, each with probability one half. Let be the parent's wirelength attributed to macro .

Cluster. Draw a centre with probability (uniformly if all are zero), and remove the macros whose placed cells are nearest to the centre's cell in distance. A whole region around a badly placed macro can then reorganise together, instead of every moved macro being pinned by neighbours that stayed.

Scattered. Sample macros without replacement with probability proportional to , by adding Gumbel noise to and taking the top .

    def rip_select(cells, wl, k):
        # Two complementary neighbourhoods, chosen per move: a spatially
        # contiguous cluster centred on a bad macro (lets a whole region
        # reorganise coherently), and a wirelen-weighted scattered set (targets
        # the individually worst-placed macros across the chip).
        tot = float(wl.sum())
        if rng.rand() < 0.5:
            c = int(rng.choice(n, p=wl / tot)) if tot > 0 else int(rng.randint(n))
            d = np.abs(cells - cells[c]).sum(axis=1)
            return np.argsort(d, kind="stable")[:k]
        w = wl + 1e-6 * (float(wl.max()) + 1.0)   # floor avoids zero weights
        # Gumbel-top-k trick: weighted sampling WITHOUT replacement, robust even
        # when k == n or weights are highly concentrated (rng.choice with
        # replace=False and a near-zero probability can stall in that case).
        keys = np.log(w) + rng.gumbel(size=n)
        return np.argsort(-keys, kind="stable")[:k]
The two neighbourhoods: an $\ell_1$-nearest cluster around a wirelength-weighted centre, and a Gumbel-top-$k$ weighted scattered set. search_policy.py, lines 95–110

The removed macros are re-placed by the fixed placer against the kept ones. The move passes no guiding layout, and the file's comment describes this as using the parent's own cells as the guide. The order is the rule -(touched * 100 + conn) (_RIPUP_ORDER above), which per the file's comment places next the macro touching the most nets that already hold a kept macro, so the removed set grows inward from the kept boundary. This reconstruction order is deliberately separate from the initialisation order ; the only exception is a very large chip, where dynamic orders are slow and the static is reused.

The loop and its stopping rule

Every feasible child is inserted into the sorted population, which is truncated to its size; there is no comparison with the parent, so a child enters the population only by being among the best layouts held. The loop runs until the budget is spent. There is one additional exit: re-placing a request identical to an earlier one is served from a cache at no cost. On a very small chip, ripping up every macro makes every move the same request and the loop would then never spend budget and never end, so the policy stops after two consecutive rounds that spend nothing.

        # (3) batched iterated greedy: tournament + cluster rip-up + conservative repair
        free_rounds = 0
        while ctx.remaining > 0:
            used_before = ctx.used
            lo, hi = (0.35, 0.65) if ctx.used < budget * 0.6 else (0.08, 0.35)
            moves = []
            for _ in range(min(W, ctx.remaining)):
                idx = rng.choice(len(pop), size=min(5, len(pop)), replace=False)
                parent = min((pop[i] for i in idx), key=lambda q: q.hpwl)
                kr = min(n, max(2, int(n * rng.uniform(lo, hi))))
                rip = rip_select(parent.cells, parent.wirelen, kr)
                moves.append((parent.cells, rip, None, ro))
            for child in ctx.replace_batch(moves):
                insert(child)
            # Safety: identical requests are served for free (cached).  On a tiny
            # chip ripping every macro reproduces the parent, so all moves can be
            # identical and cached -> no budget spent and no progress.  Stop if two
            # consecutive rounds spend nothing (best-so-far is already recorded).
            if ctx.used == used_before:
                free_rounds += 1
                if free_rounds >= 2:
                    break
            else:
                free_rounds = 0
The iterated-greedy loop: tournament parent, two-phase destruction fraction, batched rip-up moves, population insertion, and the stop after two rounds that spend no budget. search_policy.py, lines 153–176

What changed from the starter

The starter spends the whole budget on independent uniform-random guiding layouts and keeps the best. The submission replaces the body of the editable region; the fixed part of the file (the docstring and the import) is unchanged, and search keeps its signature. The submission imports only numpy and BudgetExhausted, starts no processes or threads, and draws all its randomness from ctx.rng, so it is deterministic given the context's seed.

Results

Method①②③④⑤⑥⑦⑧⑨
Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓Macro HPWL ↓
Qwen4-Max559,679196,6484.59e62.59e64.31e62.91e643,46976,98796,132
WireMask random search614,522220,1966.10e66.00e66.26e66.24e651,52496,815126,203
Single random layout810,681244,6569.06e61.27e77.94e61.13e780,967146,379164,544
WireMask-BO590,355212,3195.88e65.26e65.99e65.96e648,66181,979110,355
WireMask-EA590,121214,3135.77e65.13e66.03e66.05e651,03886,536119,281
EGPlace575,936202,7735.73e63.54e65.23e65.96e648,38994,738108,960
C2FPlace571,901202,5095.39e63.22e64.82e66.20e646,09284,324111,211
OrderPlace589,316199,5455.77e63.21e65.17e64.21e644,19577,34099,915
  1. ① ISPD adaptec1 · 2,000 placer calls
  2. ② ISPD bigblue1 · 2,000 placer calls
  3. ③ ISPD adaptec3 · 2,000 placer calls
  4. ④ ISPD adaptec2 · 2,000 placer calls
  5. ⑤ ISPD adaptec4 · 2,000 placer calls
  6. ⑥ ISPD bigblue3 · 2,000 placer calls
  7. ⑦ ICCAD 2015 superblue18 · 2,000 placer calls
  8. ⑧ ICCAD 2015 superblue4 · 2,000 placer calls
  9. ⑨ ICCAD 2015 superblue16 · 2,000 placer calls

OPCR has the lowest mean HPWL of all methods in the table on every setting. The margin over the strongest baseline on each setting varies a great deal. It is widest on bigblue3, where OPCR reaches 2,913,060 against 4,211,414 for OrderPlace [3], on adaptec2 (2,587,298 against 3,208,418, OrderPlace [3]) and on adaptec3 (4,592,064 against 5,386,122, C2FPlace [4]). On adaptec4 it is 4,306,652 against 4,823,902 (C2FPlace [4]).

On the other settings the lead is narrow, and we would not call it established from one table of means. On superblue4 OPCR reaches 76,987 while OrderPlace [3] reaches 77,340; on bigblue1 it is 196,648 against 199,545 (OrderPlace [3]); on superblue18, 43,469 against 44,195 (OrderPlace [3]); on adaptec1, 559,679 against 571,901 (C2FPlace [4]); on superblue16, 96,132 against 99,915 (OrderPlace [3]). The table gives a mean per setting and no spread, so we cannot say how many of these gaps exceed the variation between runs of the same policy.

The strongest baseline differs between settings: OrderPlace and C2FPlace between them hold the best baseline value on every setting, and which of them does varies. Our policy chooses a placement order per chip, which OrderPlace also concerns itself with, and adds rip-up neighbourhoods and a two-phase destruction schedule. The development ablation reported below is the only evidence we have about which of its parts account for the differences.

How we got here

We worked from a local harness around the real decoder, built from the public benchmark designs the task draws on, so that we could try a policy on many chips cheaply. The measurements below are the agent's own, taken from the trace. They were made on chips and budgets of its own choosing and are not the evaluation, and "mean" in them is a mean of raw HPWL across chips, which large chips dominate.

  • Order matters, and it is chip-dependent. Probing eighteen orders on shared random layouts for five chips, the best order's lowest HPWL on one chip was about half that of the static importance order (3.55e6 against 6.56e6), while on another chip the static importance order was among the best. That pattern is why the policy probes rather than fixes an order, and why the portfolio includes strong static orders as well as dynamic ones. A later ablation (below) supports it, with the probe ahead of any fixed initial order.
  • The guide is a weak lever. An instrumented greedy step showed that the plateau of tied cells has a median of one to four cells but a mean of several hundred, and that the guide changed the chosen cell in between about a fifth and about a half of the steps on the three chips examined. So guides mainly set the global anchor, while rip-up changes the masks the later macros see. A first comparison also found that plain random search under a good dynamic order was competitive with rip-up methods, that random-guide rip-up could even hurt, and that guiding with the current cells helped; rip-up in the final policy therefore uses the parent's own cells.
  • Single-macro coordinate descent found nothing to do. Ripping up one macro and re-placing it last is an exact best response for that macro, so the agent first tried a monotone coordinate-descent search built on it. Variants of it gave identical, worse results. A diagnostic then found that only one to three of sixty sampled macros improved under single-macro re-placement, each by under 0.4% of HPWL. That is what moved the work to coordinated multi-macro rip-up.
  • Cluster rip-up beat uniform and wirelength-weighted rip-up, but hurt one chip. A contiguous-cluster neighbourhood did better than the other two in a development comparison, with the clearest gain on one chip (about 4.88e6 against 5.48e6 for uniform), but later it was about 3% worse than the baselines on a low-utilisation chip, which the agent attributed to the cluster move. Mixing cluster and wirelength-weighted scattered moves half and half fixed that regression and kept the gain, which is why the final policy flips a coin between them.
  • Re-placing in a dynamic "touched" order was the largest single gain in the agent's ablation. Using the touched rule for rip-up reconstruction instead of the initialisation order lowered the mean in a round of development comparisons, with the largest gains on two chips. In a clean ablation of six chips at a reduced development budget, the mean HPWL was 2.655e6 with a static order for both initialisation and rip-up, 2.404e6 with a dynamic order for both, about 2.217e6 for either initial order combined with touched rip-up, and 2.193e6 for the full policy with the probe. The agent read this as: touched reconstruction about 16% over the static rip-up, touched over the dynamic-connectivity order about 8%, and the probe about 1% on top of fixed-order variants. The probe's larger value, it argued, was avoiding a bad fixed order on particular chips. These are the agent's development figures on six chips and not the evaluation.
  • Effort had to be scaled for large chips. The agent measured decode times that were far longer on the largest chips, with dynamic orders slower still. The probe was therefore cut on large chips, and on very large chips the rip-up reuses the static initialisation order. Batching moves across the parallel decoders came from the same concern.
  • A low-budget regression led to an adaptive probe. At small budgets the early policy spent too much on probing and was worse than a baseline on one chip; the probe was then made budget-adaptive (fewer guides when the budget is small), after which that chip improved at small budgets in the agent's runs.
  • A hang on tiny chips led to the stopping rule. A synthetic two-macro chip made the policy loop forever. The agent first suspected rng.choice with weights, replaced it with the Gumbel top- selection (which stays in the final file) and found that the hang remained. The real cause was that ripping up all macros makes every request identical and cached, so the budget never decreases; the exit after two rounds that spend nothing is the fix. The agent reported that, after it, the policy matched the earlier quality on real chips.
  • Variants that did not help, and which we left out. Each of the following was tried and dropped as a tie, a wash or a loss, per the agent's own comments in the trace: an adaptive destruction fraction and an adaptive cluster/scattered mixing ratio (a tie with the fixed 50/50); several clusters per move (about 1%, within noise); random restarts (they wasted decodes); initialising the population from several orders (no gain); reusing the probe's decodes as the first population (a tie); a finer late-phase schedule (about 1% better at a high budget, slightly worse at a lower one); a one-guide probe at moderate budgets (better on two chips, worse on two, mean tied); a bandit that picks the reconstruction order online (worse than the fixed touched rule); geometry-aware reconstruction orders (worse); a smaller six-order portfolio (mixed); a larger population of 40 (worse at a high budget); adding a small random jitter to the parent's own cells when they are used as the guide (no consistent gain, tried on two chips); and inferring net connectivity from wirelength changes to form net-based clusters, which failed because the greedy keeps ripped-up macros near their net boxes, so wirelength barely changes. Such tests of online adaptation echo a broader question about when adaptiveness helps in adaptive large-neighbourhood search [5], although our trials were small and we draw no general conclusion from them.

At the end of development the agent's comparison against EGPlace and C2FPlace on its own chips at its development budgets showed a lower mean HPWL for the policy on every chip it tested, at roughly a fifth lower in raw-HPWL mean, and the margin on the smallest-gain chips was within a few percent. We report this as its claim only.

Limitations

  • The margins are single means. The task table gives one mean per setting. On adaptec1, bigblue1, superblue18, superblue4 and superblue16 the policy is ahead of the best baseline by a small amount, and we cannot tell whether those gaps are larger than the run-to-run spread of OPCR or of the baselines. The widest gaps, on adaptec3, adaptec2 and bigblue3, are the part of the result we would trust.
  • Development was not held out from the benchmark. The agent rebuilt netlists of the public benchmark designs and chose structure and thresholds (the 0.35/0.65 and 0.08/0.35 destruction fractions, the 0.6 phase switch, the 0.5 neighbourhood mix, the tournament size of five, the population sizes, the probe cut-offs at and and at , , and ) on those designs; for some of them, such as the 0.5 mix, the population size and the late-phase fraction, the trace shows variants compared there, and for the others it shows no comparison. The task asks for generalisation to chips the policy was not tuned for, and the development data do not test that.
  • Several constants are hand-set. None of the constants above is derived. The agent's own tests show that the right values depend on the budget: a finer schedule helped at a high budget and hurt slightly at a lower one, and a one-guide probe helped on some chips and hurt on others.
  • The probe is paid for from the search budget. At the largest probe size this is decodes, plus the population initialisation, before any rip-up. The agent saw this cost bite at small budgets and answered it by cutting the probe, which leaves a policy whose behaviour changes across budget thresholds.
  • No clock is read. Large-chip cost is handled only by the size thresholds. The policy relies on as a proxy for decode time; it does not check elapsed time, so a chip whose decode cost is high for another reason is not detected.
  • The search is local. After initialisation every move departs from a population member's own cells, and the agent found that gains flatten as the budget grows and that a larger population did not help. A search that needs to leave the basin of the initial population has no mechanism here, since random restarts and random-guide exploration were both tried and dropped.
  • Some of the mechanism is read from comments. What the touched and conn quantities mean in the order expressions is described by the file's own comments; we could not check the placer's definitions.
  • The ablation is small. The component ranking above comes from six chips at a reduced budget with two repeats per cell, as the agent reported it.

References

  1. Yunqi Shi, Ke Xue, Lei Song et al. (2023). Macro Placement by Wire-Mask-Guided Black-Box Optimization. NeurIPS.
  2. David Eriksson, Michael Pearce, Jacob R Gardner et al. (2019). Scalable Global Optimization via Local Bayesian Optimization. NeurIPS.
  3. Shibing Mo, Jing Liu, Jianchu Xu et al. (2026). Order Matters: Unveiling the Hidden Impact of Macro Placement Sequences via Proxy-Guided LLM Evolution. ICML.
  4. Biao Liu, Zhiping Jin, Kaixuan Sun et al. (2026). Coarse-to-Fine Macro Placement via Evolutionary Search and Critical Macro Tuning.
  5. Renata Turkeš, Kenneth Sörensen, Lars Magnus Hvattum (2021). Meta-analysis of metaheuristics: Quantifying the effect of adaptiveness in adaptive large neighborhood search. European Journal of Operational Research.
  6. Alberto Santini, Stefan Ropke, Lars Magnus Hvattum (2018). A comparison of acceptance criteria for the adaptive large neighbourhood search metaheuristic. Journal of Heuristics.

The session

The run from the model's first output, drawn as Claude Code shows a conversation: 494 steps.

Open the session

The submitted code

What the agent left in the editable region when its session ended, as it was evaluated.

wiremask-bbo/mlsplace/search_policy.pythe changes against the starter, inside the editable region