Cube-view: angle HBM lines, offset M_CPU/SRAM blocks

- HBM connection lines angled 30% toward HBM center (not vertical)
  to distinguish from mesh links
- M_CPU/SRAM blocks placed to the left of their router
  with horizontal connector lines (avoid mesh overlap)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 22:30:56 -07:00
parent 7cd30e106e
commit 24faf2e1d4
2 changed files with 57 additions and 43 deletions
+19 -5
View File
@@ -603,8 +603,12 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
bx, by = bx_base + 4, py + offset_x - blk_h / 2
else:
bx, by = px + offset_x - blk_w / 2, py - r_size - blk_h - 4
elif kind in ("mcpu", "sram"):
# M_CPU/SRAM: place to the left of router (avoid mesh overlap)
bx = px - r_size - blk_w - 6
by = py - blk_h / 2 + bi * (blk_h + 2)
else:
# PE/M_CPU/SRAM: place above (top half) or below (bottom half)
# PE: place above (top half) or below (bottom half)
bx = px + offset_x - blk_w / 2
if is_top:
by = py - r_size - blk_h - 4 - bi * (blk_h + 2)
@@ -651,8 +655,15 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
f'x2="{px + r_size:.0f}" y2="{py:.0f}" '
f'stroke="{style["stroke"]}" stroke-width="1" opacity="0.6"/>'
)
elif kind in ("mcpu", "sram"):
# Horizontal connector (block right edge → router left edge)
parts.append(
f' <line x1="{bx + blk_w:.0f}" y1="{by + blk_h / 2:.0f}" '
f'x2="{px - r_size:.0f}" y2="{py:.0f}" '
f'stroke="{style["stroke"]}" stroke-width="1" opacity="0.6"/>'
)
else:
# Vertical connector
# Vertical connector (PE above/below router)
ly1 = by + blk_h if is_top else by
ly2 = py - r_size if is_top else py + r_size
parts.append(
@@ -674,6 +685,8 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
)
# ── Router → HBM_CTRL lines (drawn last, on top of everything) ──
# Lines go from router to the HBM zone edge, angled toward HBM center
# to visually distinguish from vertical mesh links
for rkey, rval in routers.items():
if rval is None:
continue
@@ -683,12 +696,13 @@ def _render_cube_view_svg(view: ViewGraph, spec: dict) -> str:
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"
op = "0.6" if has_pe else "0.15"
# Angle toward HBM center x (hcx) — slight offset, not fully straight
dx = (hcx - px) * 0.3 # 30% pull toward center
parts.append(
f' <line x1="{px:.0f}" y1="{r_edge_y:.0f}" '
f'x2="{px:.0f}" y2="{hbm_edge_y:.0f}" '
f'x2="{px + dx:.0f}" y2="{hbm_edge_y:.0f}" '
f'stroke="#10b981" stroke-width="{sw}" opacity="{op}" '
f'stroke-dasharray="4,3"/>'
)