Document routing between placed crossings and archive development records

This commit is contained in:
Jan Petykiewicz 2026-11-26 21:37:05 -08:00
commit 2c260e5e95
4 changed files with 161 additions and 102 deletions

View file

@ -125,13 +125,13 @@ def main() -> None:
"--output-dir",
type=Path,
default=None,
help="Directory to write pair_local_characterization.json and .md into. Defaults to <repo>/docs.",
help="Directory to write pair_local_characterization.json and .md into. Defaults to <repo>/archive/routing.",
)
args = parser.parse_args()
repo_root = Path(__file__).resolve().parents[1]
output_dir = repo_root / "docs" if args.output_dir is None else args.output_dir.resolve()
output_dir.mkdir(exist_ok=True)
output_dir = repo_root / "archive" / "routing" if args.output_dir is None else args.output_dir.resolve()
output_dir.mkdir(parents=True, exist_ok=True)
num_nets_values = _parse_csv_ints(args.num_nets)
seed_values = _parse_csv_ints(args.seeds)

View file

@ -160,8 +160,8 @@ def main() -> None:
parser.add_argument(
"--baseline",
type=Path,
default=Path("docs/performance_baseline.json"),
help="Baseline JSON to compare against.",
default=Path("archive/routing/performance_baseline.json"),
help="Baseline JSON to compare against. Defaults to archive/routing/performance_baseline.json.",
)
parser.add_argument(
"--output",

View file

@ -55,7 +55,7 @@ def _render_markdown(payload: dict[str, object]) -> str:
"",
f"Generated on {payload['generated_on']} by `{payload['generator']}`.",
"",
"The full machine-readable snapshot lives in `docs/performance_baseline.json`.",
"The full machine-readable snapshot is in [performance_baseline.json](performance_baseline.json).",
"Use `scripts/diff_performance_baseline.py` to compare a fresh run against that snapshot.",
"",
"| Scenario | Duration (s) | Total | Valid | Reached | Iter | Nets Routed | Nodes | Ray Casts | "
@ -88,7 +88,7 @@ def _render_markdown(payload: dict[str, object]) -> str:
"",
"## Full Counter Set",
"",
"Each scenario entry in `docs/performance_baseline.json` records the full `RouteMetrics` snapshot, "
"Each scenario entry in the JSON records the full `RouteMetrics` snapshot, "
"including cache, index, congestion, and verification counters.",
"These counters are currently observational only and are not enforced as CI regression gates.",
"",
@ -106,7 +106,7 @@ def main() -> None:
"--output-dir",
type=Path,
default=None,
help="Directory to write performance_baseline.json and performance.md into. Defaults to <repo>/docs.",
help="Directory to write performance_baseline.json and performance.md into. Defaults to <repo>/archive/routing.",
)
parser.add_argument(
"--scenario",
@ -123,13 +123,13 @@ def main() -> None:
args = parser.parse_args()
repo_root = Path(__file__).resolve().parents[1]
docs_dir = repo_root / "docs" if args.output_dir is None else args.output_dir.resolve()
docs_dir.mkdir(exist_ok=True)
output_dir = repo_root / "archive" / "routing" if args.output_dir is None else args.output_dir.resolve()
output_dir.mkdir(parents=True, exist_ok=True)
selected = tuple(args.scenarios) if args.scenarios else None
payload = _build_payload(selected, include_performance_only=args.include_performance_only)
json_path = docs_dir / "performance_baseline.json"
markdown_path = docs_dir / "performance.md"
json_path = output_dir / "performance_baseline.json"
markdown_path = output_dir / "performance.md"
json_path.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
markdown_path.write_text(_render_markdown(payload))

View file

@ -99,38 +99,37 @@ def _first_route(directory: Path) -> None:
def _placed_crossing(directory: Path) -> None:
(case,) = CASE_GROUPS["crossing-single"]
problem = case.problem
run = route(problem, options=case.options)
assert len(run.results_by_net) == 4
assert all(result.is_valid for result in run.results_by_net.values())
# Match the placed devices and port access in docs/user/route-a-layout.md.
a = box(30, 50, 80, 100)
b = box(260, 90, 310, 140)
a_keepout = a.difference(box(74, 69, 82, 81))
b_keepout = b.difference(box(258, 109, 266, 121))
link = NetSpec("A_east_to_B_west", Port(80, 75, 0), Port(260, 115, 0), width=2)
problem = RoutingProblem((0, 0, 340, 180), (link,), (a_keepout, b_keepout), clearance=4)
options = RoutingOptions(search=SearchOptions(bend_radii=(25,), sbend_radii=(25,)))
result = route(problem, options=options).results_by_net[link.net_id]
assert result.is_valid
assert all(shape.intersection(cell).area == 0 for shape in result.locked_geometry for cell in (a, b))
fig, ax = plt.subplots(figsize=(6.3, 4.5), layout="constrained")
fig, ax = plt.subplots(figsize=(7.1, 3.4), layout="constrained")
_board(ax, problem)
ax.set(xlim=(81, 239), ylim=(102, 218))
ax.plot([146, 174], [160, 160], linestyle="--", color=MUTED, linewidth=1, zorder=3)
ax.plot([160, 160], [146, 174], linestyle="--", color=MUTED, linewidth=1, zorder=3)
ax.set(xlim=(14, 326), ylim=(27, 159))
for name, cell in (("A", a), ("B", b)):
_polygon(ax, cell, fill="none", edge=INK, linestyle="--", linewidth=1.2, zorder=3)
ax.text(cell.centroid.x, cell.centroid.y + 12, f"Crossing {name}", color=INK, fontsize=10, ha="center", va="center")
labels = (
("West leg", (104, 167), (137, 153), "W"),
("East leg", (210, 167), (183, 153), "E"),
("South leg", (173, 115), (167, 132), "S"),
("North leg", (173, 205), (167, 184), "N"),
)
for net, (leg, label_xy, port_xy, port_name) in zip(problem.nets, labels, strict=True):
port = min((net.start, net.target), key=lambda p: abs(p.x - 160) + abs(p.y - 160))
_waveguide(ax, run.results_by_net[net.net_id], color=ROUTE)
_heading(ax, port, 5)
ax.text(*label_xy, leg, color=ROUTE, fontsize=11, ha="center")
ax.text(*port_xy, port_name, color=INK, fontsize=10, weight="bold", ha="center")
_waveguide(ax, result, color=ROUTE)
for label, port, dx, dy in (("A east port", link.start, 14, -13), ("B west port", link.target, -14, 13)):
_heading(ax, port, 10)
ax.text(port.x + dx, port.y + dy, label, color=INK, fontsize=10, ha="left" if dx > 0 else "right")
ax.annotate(
"Device keepout", xy=(144, 176), xytext=(93, 198), color=INK, fontsize=10,
arrowprops={"arrowstyle": "->", "color": MUTED},
"Port access opening", xy=(76, 79), xytext=(94, 117), color=INK, fontsize=10,
arrowprops={"arrowstyle": "->", "color": MUTED}, zorder=8,
)
ax.annotate(
"Access slot", xy=(177, 164), xytext=(202, 131), color=INK, fontsize=10,
arrowprops={"arrowstyle": "->", "color": MUTED},
"External waveguide", xy=(154, 75), xytext=(168, 47), color=ROUTE, fontsize=10,
arrowprops={"arrowstyle": "->", "color": ROUTE},
)
_save(fig, directory, "placed-crossing.png")