Source-linked AI summary
MacroAgent: Regularity-Aware Macro Legalization with LLM-Agent-Designed Contour Algorithms
Jiaxi Jiang, Xufeng Yao, Yuxuan Zhao, Yuntao Lu, Peiyu Liao, Zuodong Zhang, Yibo Lin, Bei Yu
TL;DR
Existing macro legalization methods can overlook regularity or lack robustness across testcases, despite macro placement’s impact on downstream quality. MacroAgent uses four legalization stages and LLM-designed regularity-aware contour heuristics. It improves benchmark wirelength and regularity while maintaining comparable congestion, with reported gains in industrial place-and-route evaluation.
Problem
Existing macro legalization approaches either overlook regularity between macros or lack robustness because limited heuristics do not fit all testcases.
Method
MacroAgent combines clustering, regularity-aware contour generation, template-based macro matching, and inter-cluster refinement, using LLMs to discover diverse heuristics from a domain-agnostic geometric abstraction.
Results
On TILOS and Chipyard benchmarks, MacroAgent reduces routed wirelength by 3%–5% with comparable congestion, while Innovus evaluation reports 2.9% lower routed wirelength and 68.3% TNS improvement over DREAMPlace macro legalization.
Takeaways & Limitations
The framework provides regularity-aware macro legalization with reported wirelength improvements across academic and industrial evaluation flows.
Takeaways & Limitations
Regularity is enforced only within intra-cluster legalization; fallback inter-cluster heuristics can compromise regularity, and LLM-based design currently covers contour algorithms בלבד.
Abstract
from arXiv · showhide
Macros constitute a large part of the core area in modern very large-scale integration (VLSI) designs. Moreover, macro positions have a significant impact on the final quality of result (QoR), and macro legalization is typically the final step in determining the macro positions. However, existing approaches related to macro legalization either lack robustness or incur substantial computational costs or neglect the regularity between macros. To address these limitations, we introduce MacroAgent. The novel framework is a four-stage approach: clustering, contour generation, template matching, and inter-cluster refinement. We propose leveraging Large Language Models (LLMs) to discover multiple, effective heuristic regularity-aware contour algorithms. This framework successfully generates robust and effective algorithmic solutions for macro legalization. Compared with state-of-the-art macro legalization works, experimental results on TILOS and Chipyard benchmarks demonstrate a 2 to 8 fold improvement in layout regularity, a 3% to 5% reduction in routed wirelength with comparable congestion after global routing, and significantly better robustness with an acceptable runtime. Furthermore, end-to-end evaluation through Cadence Innovus place-and-route confirms that the regularity improvements translate into tangible PPA gains, including 2.9% lower routed wirelength and 68.3% TNS improvement over the DREAMPlace macro legalization baseline; it also achieves 1.8% lower routed wirelength when integrated into the Innovus macro placement flow.
1 INTRODUCTION
Macro legalization determines legal macro positions and influences downstream physical-design quality, yet prior methods often overlook macro regularity or lack robustness across testcases. MacroAgent addresses these gaps with a four-stage framework and LLM-designed regularity-aware heuristics.
- Macro positions constrain standard-cell optimization and can affect downstream power, performance, and area through routed wirelength.
- Prior macro legalization methods primarily minimize displacement while overlooking regularity and relying on too few heuristics for diverse testcases.
- Macro regularity is linked to lower wirelength and deadspace, but earlier studies use differing definitions and no universally accepted metric exists.
- MacroAgent quantifies regularity by counting channels, normalizing actual channels against the theoretical minimum, and assigning higher scores to more regular layouts.The theoretical minimum occurs for a square macro array; the regularity index approaches 1 as channel count approaches that minimum.
- MacroAgent decomposes legalization into clustering, regularity-aware contour generation, template-based matching, and inter-cluster refinement.LLMs receive a domain-agnostic geometric abstraction and manual legalization solutions to discover diverse heuristics offline without intermediate human intervention.
- 3%–5% lower routed wirelength with comparable congestion is reported on TILOS and Chipyard benchmarks in the academic evaluation flow.The industrial flow reports 2.9% lower routed wirelength and 68.3% TNS improvement over the DREAMPlace macro legalization baseline, plus 1.8% lower routed wirelength in the Innovus macro placement flow.
2 PRELIMINARIES
This section frames macro legalization as finding non-overlapping positions that minimize displacement while maximizing regularity, and introduces LLM agents as algorithm-design tools.
- LLM Agents for Algorithm Design: LLM agents use language models to autonomously perform tasks through reasoning, step-by-step actions, and tool use.
- Macro Legalization Problem Formulation: Macro legalization seeks legal positions for macros with fixed dimensions and initial coordinates after mixed-size placement.
- Macro Legalization Problem Formulation: Legalization requires that distinct macros do not overlap.
- Macro Legalization Problem Formulation: The formulation minimizes the total Manhattan displacement of all macros from their initial positions.
- Macro Legalization Problem Formulation: Regularity is maximized using an index R defined as the ratio of the theoretical minimum channel count to the actual channel count.
- Macro Legalization Problem Formulation: The Hanan-grid procedure computes actual channels by merging adjacent empty cells into maximal rectangular strips, with fragmented layouts producing lower regularity.
3 ALGORITHM DESIGN
MacroAgent legalizes macros through clustering, regularity-aware contour generation, template matching, and inter-cluster refinement. LLM-generated contours provide multiple regularity–displacement trade-offs, while matching and fallback procedures support practical legalization robustness.
- Overview: MacroAgent combines size-aware distance-based clustering, regularity-aware contour generation, template-based macro matching, and inter-cluster refinement.The components respectively identify suitable macro groups, generate regular configurations, minimize displacement, and prevent inter-cluster overlap.
- Regularity-Aware Contour Generation: Regularity-aware contours address the conflict between smoother macro boundaries and displacement by offering diverse points on the trade-off frontier.Smoothing contour burrs improves the channel metric but typically increases macro displacement; Grid, Alpha-shape, and MST provide different trade-offs.
- Regularity-Aware Contour Generation: The LLM workflow supplies task and metric specifications, prior ideas and code, evolution directives, and reference solutions to generate executable contour heuristics.Generated algorithms are executed and evaluated, with successful methods stored for feedback and further evolution.
- Template-Based Macro Matching: Template matching tiles a grid inside each generated contour and assigns macros to feasible positions to minimize displacement.Clusters are matched separately, and the Hungarian algorithm solves the macro-to-grid assignment.
- Robustness and Refinement: Multiple candidate contours can be combined into many legalization solutions, allowing top-K low-displacement candidates to improve the chance of finding a legal result.DREAMPlace’s default heuristics provide an efficient fallback when the linear-programming refinement fails, though regularity may be compromised.
4 IMPLEMENTATION DETAILS
The implementation uses Python and an automated agent workflow to support LLM-based contour algorithm generation. Model selection prioritizes structured, compositional code generation with few syntax errors.
- Implementation: The macro legalization algorithm was implemented in Python because LLMs generally perform better with interpreted languages like Python.
- Implementation: Cursor, Cua, and pyautogui automate the agent workflow, while sequential thinking, memory, and context capabilities support the fixed flow.After seeding the template prompt, the agent runs fully automatically.
- Model Selection: Model selection prioritized reliable adherence to structured code-generation instructions and production of long compositional functions with few syntax errors.Claude 4.0 Sonnet best satisfied these criteria in the budgeted setting; smaller 30–40B-class models struggled with syntax and structure.
5 EXPERIMENT
The experiments compare MacroAgent with baselines across TILOS and harder Chipyard benchmarks using academic and industrial evaluation flows. Stability analysis examines normalized routed-wirelength variation across candidate solutions, while prompt exploration documents the E2 strategy.
- Experiment Setup: DREAMPlace default legalization and sequence pair provide baseline comparisons; neither explicitly incorporates macro regularity.DREAMPlace uses heuristic and constraint-graph techniques, while sequence pair uses simulated annealing and is evaluated for robustness.
- Experiment Setup: MacroAgent is evaluated as a downstream framework that resolves overlaps and improves regularity in existing placements.The workflow begins with mixed-size placement, applies macro legalization, then performs standard-cell placement, legalization, and global routing in the academic flow.
- Stability Analysis: CV < 0.5% for diverse Chipyard macro types and CV ≈1%–1.5% for single-type TILOS cases indicate modest routed-wirelength variation across candidates.MacroAgent enumerates candidates in increasing displacement order, with variation mainly from permutations inside small clusters.
- Benchmark: TILOS is treated as an easy benchmark, while Chipyard-generated designs provide more challenging macro legalization scenarios.TILOS baseline methods legalize all testcases; Chipyard designs are introduced to model harder cases.
- Prompt Design: The E2 prompt strategy summarizes common ideas from five parent algorithms before synthesizing a substantially different contour heuristic.The prompt contains task, context, evolution, usage scenario, quality metrics, and input references; the evolution directive varies across strategies.
E2 Prompt Example for Contour Algorithm Generation
The E2 prompt frames contour generation as a geometric task and supplies prior ideas, results, and visualization feedback to guide iterative LLM discovery. The resulting algorithms span diverse geometric constructions and trade off regularity against displacement, with downstream experiments showing improved legalization and PPA.
- E2 Prompt Example for Contour Algorithm Generation: The task asks an LLM to implement generate_contour as a Python function that returns a closed polygon enclosing a macro cluster.Inputs are macro corners, centers, and Shapely bounding-box polygons.
- E2 Prompt Example for Contour Algorithm Generation: The prompt supplies previous ideas, displacement, regularity_index, solutions, and visualization as context for subsequent generations.
- 5.3 Agent Discovered Contour Algorithms: The offline discovery uses easy TILOS cases for generation and hard Chipyard cases for testing generalization, retaining 8 of 110 candidates.The initial stage generates N=10 diverse heuristics without hand-crafted algorithm design; nearly all candidates execute validly.
- 5.3 Agent Discovered Contour Algorithms: The retained methods include Alpha Shape, kNN Concave Hull, Grid-Based, MST, KDE Contour, Voronoi Clip, and relative-position variants.The representative families use triangulation, occupancy grids, graphs, density estimation, Voronoi geometry, and neighborhood structure.
- 5.3 Agent Discovered Contour Algorithms: Alpha Shape filters Delaunay triangles by adaptive circumradius to form a tighter concave boundary, while Grid-Based dilation and convex-hull extraction produce more regular contours.Large circumradius triangles are discarded because they likely span empty space between macros.
- 5.3 Agent Discovered Contour Algorithms: MST-Based contours buffer a minimum spanning tree over macro centers and unite the buffered region with macro polygons, smoothing boundaries around the original macros.The algorithms provide different regularity–displacement trade-offs at the algorithm level, not merely through parameter settings.
- 5.3 Agent Discovered Contour Algorithms: Pairwise IoU on Ariane133 measures geometric diversity among the eight algorithms, with lower off-diagonal values indicating more distinct contours.
- 5.4 Overall Comparisons: MacroAgent reports 5% lower wirelength than DREAMPlace and 4% lower than sequence pair on TILOS, plus 2.9% lower routed wirelength and 68.3% TNS improvement over DREAMPlace.It also reports 1.8% lower routed wirelength than Innovus and attributes downstream gains to improved regularity and reduced routing detours.
6 CONCLUSION
MacroAgent is a robust regularity-aware macro legalization framework that uses LLM-agent-designed contour algorithms within a four-stage pipeline. It improves wirelength, timing, legalization robustness, and industrial-flow routed wirelength across the reported benchmarks.
- 6 CONCLUSION: MacroAgent combines clustering, regularity-aware contour generation, template-based matching, and inter-cluster refinement.
- 6 CONCLUSION: MacroAgent reduces TILOS wirelength by 5% versus DREAMPlace 2.0 and 4% versus sequence pair while matching their congestion qualities.
- 6 CONCLUSION: On Chipyard designs, MacroAgent successfully legalizes every case and achieves 3% to 5% wirelength improvements.
- 6 CONCLUSION: End-to-end Innovus evaluation reports 2.9% lower routed wirelength and 68.3% TNS improvement over DREAMPlace, plus 1.8% lower routed wirelength in the Innovus flow.
- 6 CONCLUSION: The approach abstracts macro legalization into a domain-agnostic geometric problem for LLM-designed heuristic contour algorithms.