Fix Router→HBM_CTRL lines visibility in cube_view

Draw HBM connection lines last (on top of component blocks).
PE routers: thicker (1.5px, opacity 0.6) with dashed style.
Relay routers: thinner (0.7px, opacity 0.2).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 22:25:40 -07:00
parent 109c9b4483
commit 7cd30e106e
2 changed files with 56 additions and 43 deletions
+24 -11
View File
@@ -563,16 +563,7 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
f'{rkey}</text>'
)
# ── Router → HBM_CTRL line (all routers connect to HBM) ──
hbm_edge_y = hbm_y if py < hbm_y else hbm_y + hbm_h
r_edge_y = py + r_size if py < hbm_y else py - r_size
# Only draw if not inside HBM zone
if abs(r_edge_y - hbm_edge_y) > 10:
parts.append(
f' <line x1="{px:.0f}" y1="{r_edge_y:.0f}" '
f'x2="{px:.0f}" y2="{hbm_edge_y:.0f}" '
f'stroke="#10b981" stroke-width="0.8" opacity="0.25"/>'
)
# ── Router → HBM_CTRL line (deferred, drawn after component blocks) ──
# ── Attached component blocks ──
# Collect components to draw, positioned outward from router
@@ -672,14 +663,36 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
# ── PE router → HBM BW annotation ──
if pe_items:
pe_hbm_edge = hbm_y if py < hbm_y else hbm_y + hbm_h
pe_r_edge = py + r_size if py < hbm_y else py - r_size
bw_x = px + 14
bw_y = (r_edge_y + hbm_edge_y) / 2
bw_y = (pe_r_edge + pe_hbm_edge) / 2
parts.append(
f' <text x="{bw_x:.0f}" y="{bw_y:.0f}" '
f'font-family="monospace" font-size="6" fill="#10b98188">'
f'{agg_bw:.0f}GB/s</text>'
)
# ── Router → HBM_CTRL lines (drawn last, on top of everything) ──
for rkey, rval in routers.items():
if rval is None:
continue
rx, ry = rval["pos_mm"]
px, py = mm2px(rx, ry)
hbm_edge_y = hbm_y if py < hbm_y else hbm_y + hbm_h
r_edge_y = py + r_size if py < hbm_y else py - r_size
if abs(r_edge_y - hbm_edge_y) > 10:
has_pe = any(a.endswith(".dma") for a in rval.get("attach", []))
# PE routers: thicker, more visible
sw = "1.5" if has_pe else "0.7"
op = "0.6" if has_pe else "0.2"
parts.append(
f' <line x1="{px:.0f}" y1="{r_edge_y:.0f}" '
f'x2="{px:.0f}" y2="{hbm_edge_y:.0f}" '
f'stroke="#10b981" stroke-width="{sw}" opacity="{op}" '
f'stroke-dasharray="4,3"/>'
)
# ── Legend ──
ly = h_px - 35
legend_items = [