Skip to content

Commit

Permalink
RackPlaneHost: Added mii placeholder link for NPU-NIC links
Browse files Browse the repository at this point in the history
Also using camel case for device names.
  • Loading branch information
thomas-am committed Nov 5, 2024
1 parent 1ff0b3d commit b5e3f04
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/rack_plane_fabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, host_builder: bld.DeviceBuilder, host_count: int = 1):
rack_switch, _ = self._add_fabric_devices(
host_builder,
host_count,
"rack switch",
"RackSwitch",
)
self.lowest_device = rack_switch

Expand Down
29 changes: 17 additions & 12 deletions src/rack_plane_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RackPlaneHostBuilder(bld.HostBuilder):
supports connecting to switching via multiple planes
"""

name = "rack plane host"
name = "RackPlaneHost"
description = "a host with dedicated scale up and scale out NICs"

def __init__(
Expand All @@ -38,14 +38,18 @@ def __init__(
# name="scale-out-nic", count=scale_out_nic_count, nic=infra.Nic()
# )

# 2. Add device
# 2. Add link & device
# link is yet undetermined, using mii as placeholder with zero cost speed
mii_link = infra.Link(name="mii")

self._device = infra.Device(
name=self.name,
components={
npu.name: npu,
scale_up_nic.name: scale_up_nic,
# scale_out_nic.name: scale_out_nic,
},
links={mii_link.name: mii_link},
)

# 3. Add component links
Expand All @@ -55,21 +59,22 @@ def __init__(
self._add_component_link(
npu.name,
c1_index,
f"{npu.name}.{c1_index}.to.{scale_up_nic.name}.{c2_index}",
mii_link.name,
scale_up_nic.name,
c2_index,
)

# TODO: Scale OUT NICs
# scale OUT NICs to NPU connections
for c1_index in range(npu.count):
for c2_index in range(scale_up_nic.count):
self._add_component_link(
npu.name,
c1_index,
f"{npu.name}.{c1_index=}.to.{scale_up_nic.name}.{c2_index}",
scale_up_nic.name,
c2_index,
)
# for c1_index in range(npu.count):
# for c2_index in range(scale_up_nic.count):
# self._add_component_link(
# npu.name,
# c1_index,
# mii_link.name,
# scale_up_nic.name,
# c2_index,
# )

@property
def port_up_component(self) -> infra.Component:
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_rack_plane.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def assert_device_conn(
d2_index: int,
c2_index: int,
):
assert dev_conn.link.d1 == "rack plane host"
assert dev_conn.link.d1 == "RackPlaneHost"
assert dev_conn.link.c1 == "scale-up-nic"
assert dev_conn.link.d2 == "rack switch"
assert dev_conn.link.d2 == "RackSwitch"
assert dev_conn.link.c2 == "port-down"
assert dev_conn.link.link == "eth"
assert dev_conn.link.d1_index == d1_index
Expand Down

0 comments on commit b5e3f04

Please sign in to comment.