Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SOURCE.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@
"net-sircl/net_sircl.h": "de03b0ae808c101c2a3acc1dc7361b78eaf3d6baefa94f21af97723cb4a978d1",
"net-sircl/net_sircl_admission.h": "6e92a7e07863fc7667f1db549ac89761a34a4a372388497915fb6c362fea1409",
"net-sircl/net_sircl_compat.h": "0053800750c2f061a1254d1db95e65e4317de000c1b52873c0fe2cec9afafdf9",
"net-sircl/net_sircl_config.h": "872feba25ac32d7e4e5e1444787edb8fe78188b6484e8fac58758dbc092dac37",
"net-sircl/net_sircl_config.h": "5e4f8396caf08e3ebcc1a32e9a0d5d6952715407fdf301c0a1dde48ccea80243",
"net-sircl/net_sircl_connection.h": "901f799e6964445294f2a5fbca0413419d601f8a0cd5bde59f948a8650cff067",
"net-sircl/net_sircl_plan.c": "6fc1f03374562864b5b5898a54f4b2cf471e6d11003af83839e0f5a1f777e856",
"net-sircl/net_sircl_plan.c": "27a9eac56ad81695b3f17fcebd63208997094516eadf1d40c69d77345b6e5011",
"net-sircl/net_sircl_plan.h": "dcb857dce8247ff61756e216e90cfd40c6ce3a2b24f5e990b39ec561d2169526",
"net-sircl/net_sircl_profile.h": "58b2d994f86fbc88fba4b4d90f332142c52610fcb069dbb2990356734ac076fe",
"net-sircl/net_sircl_tuner.h": "30190717119d61bf1f25b184b1b1ad8f661ac8915c888e55ae013bff2a344bf1",
Expand Down Expand Up @@ -178,7 +178,7 @@
"transport-core/src/shm_memory.h": "defe5e56c0162f2c2ce3d7484693b2771bf0afb953f8a9994ba8ebe5e4f1e01b",
"transport-core/src/shm_verbs.c": "2bc7a33b4e492c1ab0ee25de3527695420ce7ddde4bd4b9b5128874093a1686b",
"transport-core/src/sysfs.c": "747062778a2cab1744d43e602c724b1887ad6ba66428d62ee892b351f7f5b7c2",
"transport-core/src/topology.c": "0719f36aa7b5a3b4754c180166ed3d8620a67bf9d285aed3faf92d4fbc9852f4",
"transport-core/src/topology.c": "c0a61fd97072a7114bf39890055b8d17dff891ce3930d2970faaa4fcc4200832",
"transport-core/src/verbs_dl.c": "ea38fd0ef71bc215f8d97c4f836179aa9190dc87a34125a4a24a96e23bbc4d84",
"transport-core/tests/fake_verbs/infiniband/verbs.h": "8c2173547a2169bb455d103b7842463168e75d4350f4434d92ab5dabc353c64c",
"transport-core/tests/test_core.c": "af1228e52b14a1da826573e8eb604ca27ffaf603d3aa7f464b00a4b729f0c2c0",
Expand Down
30 changes: 16 additions & 14 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,26 @@ cabling ring
| `hosts <name> ...` | host names in position order, 2 to 64 of them, each at most 63 characters; several `hosts` lines append; a host finds its own position by its host name (`NET_SIRCL_POSITION` overrides) |
| `cabling ring` / `path` / `explicit` | required. `ring`: host i's port 0 is cabled to host i+1's port 1, and the last host to the first; `path`: the same without the closing cable; `explicit`: only `cable` lines. With two hosts `ring` and `path` both mean the one cable `0.port0`–`1.port1` |
| `cable <i>.port<p> <j>.port<q>` | one cable (repeatable); positions are plain decimal numbers and ports are 0 or 1 |
| `port0 <fn> <fn>`, `port1 <fn> <fn>` | the two RDMA functions of each port, lane order (default `rocep1s0f0 roceP2p1s0f0` and `rocep1s0f1 roceP2p1s0f1`, the DGX OS names); letters, digits and `_.:-`, at most 63 characters |
| `port0 <fn> [<fn>]`, `port1 <fn> [<fn>]` | one or two RDMA functions per port in lane order (both ports must have the same count; default two functions per port: `rocep1s0f0 roceP2p1s0f0` and `rocep1s0f1 roceP2p1s0f1`); letters, digits and `_.:-`, at most 63 characters |
| `relay_budget <bytes>` | directional budget ceiling, 65536–393216 bytes; default ceiling 393216, further limited by `NET_SIRCL_RELAY_BUDGET` |

A topology file is required, including for a direct pair. The plugin derives the shortest cabled path,
the local functions of its two lanes, the relays on the way and the source allowance. Each physical port
must have at most one cable; host names must be unique. Expose both functions required by each route. Where two directions are equally short (the opposite host of an
even ring, or a pair joined by two cables), lane 0 takes the direction that leaves the lower position through
its port 0 and lane 1 the other, at both ends, whichever way round `explicit` cabling connects the hosts
between; the standalone route and queue-model tests verify it. A pair joined by two cables is written with
`cabling explicit` and two `cable` lines.
the local functions of its one or two lanes, the relays on the way and the source allowance. Each physical port
must have at most one cable; host names must be unique. Expose the functions required by each route. Where two
directions are equally short (the opposite host of an even ring, or a pair joined by two cables), lane 0 takes
the direction that leaves the lower position through its port 0 and (in two-function topologies) lane 1 takes
the other, at both ends, whichever way round `explicit` cabling connects the hosts between; the standalone route
and queue-model tests verify it. A pair joined by two cables is written with `cabling explicit` and two `cable`
lines. A two-HCA ring or path (one RDMA function per physical port) sets one name on both `port0` and `port1`
(see `examples/ring4-two-hca.topology`).

The file is refused, with the line and the rule, rather than interpreted loosely: an unknown key, a missing
`cabling` line, extra words after a key, a `port0`/`port1` line without exactly two names, a name that is too
long, a line over 1022 characters, a host that no cable reaches, or cables that do not join every host into
one path or one cycle. `fabric-tool` reads the same file by the same rules, and a shared test holds the two
parsers to the same cables and lanes. One difference is deliberate: the plugin accepts the same function name
for both ports (the emulation tests use it, and relay admission then keeps the aggregate model), while
`fabric-tool` requires four distinct functions.
`cabling` line, extra words after a key, a `port0`/`port1` line with zero or more than two names, mismatched
function counts between `port0` and `port1`, a name that is too long, a line over 1022 characters, a host that
no cable reaches, or cables that do not join every host into one path or one cycle. `fabric-tool` reads the same
file by the same rules, and a shared test holds the two parsers to the same cables and lanes. One difference is
deliberate: the plugin accepts the same function name for both ports (the emulation tests use it, and relay
admission then keeps the aggregate model), while `fabric-tool` requires distinct functions across both ports.

The NCCL ranks may be a subset of the hosts: a path of three Sparks inside a ring of four lists all four hosts,
and the fourth relays.
Expand All @@ -43,7 +45,7 @@ and the fourth relays.
|---|---|---|
| `NET_SIRCL_TOPOLOGY` | required | topology shared by all hosts, including relay-only hosts |
| `NET_SIRCL_POSITION` | from the topology file's host names | this process's position |
| `NET_SIRCL_ROUTES` | unset | optional `<position>=<function>/<function>,...`; must exactly match topology lanes |
| `NET_SIRCL_ROUTES` | unset | optional `<position>=<function>` (one-function ports) or `<position>=<function>/<function>,...` (two-function ports); must exactly match topology lanes |
| `NET_SIRCL_WINDOWS` | unset | `<position>=<bytes>,...`; direct peers: optional per-function payload cap; relayed peers: can only lower the shared source allowance; 0 is rejected for relayed peers |
| `NET_SIRCL_HCA` | every active RoCE function | comma list of functions to expose |
| `NET_SIRCL_GID_INDEX` | the function's RoCE v2 IPv4 GID | GID index, 0–255 |
Expand Down
7 changes: 7 additions & 0 deletions examples/ring4-two-hca.topology
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
net-sircl-topology
# Four hosts in a ring with one RDMA function per physical port (two HCAs per host).
# Port 0 of host i is cabled to port 1 of host (i + 1) mod 4.
hosts spark1 spark2 spark3 spark4
cabling ring
port0 rocep1s0f0
port1 rocep1s0f1
12 changes: 9 additions & 3 deletions fabric-tool/fabric_tool/facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,15 @@ def bind(document: dict[str, object], topology: Topology) -> Facts:
raise FabricError(f"the hosts name function {device} by different network devices "
f"{sorted(named)}; every host must name it alike")
netdevs[device] = named.pop()
roles = tuple(model.Role(("cw_primary", "cw_secondary", "ccw_primary", "ccw_secondary")[index],
device, netdevs[device], index // 2, bool(index % 2))
for index, device in enumerate(topology.functions))
if topology.lanes == 1:
roles = (
model.Role("cw_primary", topology.functions[0], netdevs[topology.functions[0]], 0, False),
model.Role("ccw_primary", topology.functions[1], netdevs[topology.functions[1]], 1, False),
)
else:
roles = tuple(model.Role(("cw_primary", "cw_secondary", "ccw_primary", "ccw_secondary")[index],
device, netdevs[device], index // 2, bool(index % 2))
for index, device in enumerate(topology.functions))
bindings = model.FabricBindings(roles)
hosts = []
for position, name in enumerate(topology.hosts):
Expand Down
21 changes: 15 additions & 6 deletions fabric-tool/fabric_tool/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,30 @@ def label(self) -> str:

@dataclasses.dataclass(frozen=True)
class FabricBindings:
"""Four validated RDMA functions and their Ethernet interfaces for one operation."""
"""Two or four validated RDMA functions and their Ethernet interfaces for one operation."""

roles: tuple[Role, ...] = DEFAULT_ROLES

def __post_init__(self) -> None:
object.__setattr__(self, "roles", tuple(self.roles))
if len(self.roles) != 4:
raise FabricError("a role table holds four functions")
if len(self.roles) not in (2, 4):
raise FabricError("a role table holds two or four functions")
for role in self.roles:
device_name(role.device)
device_name(role.netdev)
if len(set(self.devices)) != 4 or len(set(self.netdevs)) != 4:
if len(set(self.devices)) != len(self.roles) or len(set(self.netdevs)) != len(self.roles):
raise FabricError("a role table names one device or interface for two functions")
if sorted((r.port, r.secondary) for r in self.roles) != [(0, False), (0, True), (1, False), (1, True)]:
raise FabricError("a role table needs both function classes of each port")
slots = sorted((r.port, r.secondary) for r in self.roles)
if slots not in ([(0, False), (1, False)], [(0, False), (0, True), (1, False), (1, True)]):
raise FabricError("a role table needs one or both function classes of each port")

@property
def lanes(self) -> int:
return len(self.roles) // 2

@property
def classes(self) -> tuple[bool, ...]:
return (False, True) if self.lanes == 2 else (False,)

@property
def devices(self) -> tuple[str, ...]:
Expand Down
7 changes: 4 additions & 3 deletions fabric-tool/fabric_tool/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def cable_problems(group: GroupSpec, facts: Facts) -> list[str]:
the cabling."""
problems = []
for cable in group.layout.fabric.cables:
for secondary in (False, True):
for secondary in facts.bindings.classes:
here = facts.port(cable.a, facts.bindings.role_at(cable.a_port, secondary).netdev)
there = facts.port(cable.b, facts.bindings.role_at(cable.b_port, secondary).netdev)
networks = (here.network(), there.network())
Expand All @@ -146,7 +146,7 @@ def unchecked_cables(group: GroupSpec, facts: Facts) -> list[str]:
length, so its subnet is unknown. Reported, so a skipped cabling check is never a silent pass."""
skipped = []
for cable in group.layout.fabric.cables:
for secondary in (False, True):
for secondary in facts.bindings.classes:
here = facts.port(cable.a, facts.bindings.role_at(cable.a_port, secondary).netdev)
there = facts.port(cable.b, facts.bindings.role_at(cable.b_port, secondary).netdev)
if here.network() is None or there.network() is None:
Expand Down Expand Up @@ -198,7 +198,8 @@ def evaluate(topology: Topology, states: dict[int, HostState], file_facts: Facts
group = topology.group
compared = sorted(set(positions if positions is not None else group.order))
outcome = Outcome(topology, group, mode, None)
problems = model.isolation_problems([model.derive_routes(group.layout, 2, bindings=file_facts.bindings if file_facts else topology.bindings)])
initial_bindings = file_facts.bindings if file_facts else topology.bindings
problems = model.isolation_problems([model.derive_routes(group.layout, initial_bindings.lanes, bindings=initial_bindings)])
if problems:
raise FabricError("isolation: " + "; ".join(problems))
read_facts = facts_from(states, bindings=file_facts.bindings if file_facts else topology.bindings)
Expand Down
8 changes: 5 additions & 3 deletions fabric-tool/fabric_tool/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@ def build_group_plan(group: GroupSpec, facts: Facts, *, relay_egress: str,
"""The relay plan of one group (module docstring), checked by :func:`trace` on every origin route."""
if relay_egress not in ("same", "sibling"):
raise FabricError(f"relay egress must be same or sibling, got {relay_egress!r}")
if facts.bindings.lanes == 1 and relay_egress == "sibling":
raise FabricError("sibling relay egress requires two functions per port")
if not 0 <= max_relays <= MAX_TAG:
raise FabricError(f"the relay limit must be between 0 and {MAX_TAG} (one tag per relay count)")
layout = group.layout
Expand All @@ -470,9 +472,9 @@ def build_group_plan(group: GroupSpec, facts: Facts, *, relay_egress: str,
f"group {group.label}: host {target} is {len(path)} cables from host {origin}, "
f"{len(path) - 1} relays; the configured limit is {max_relays} ("
"--max-relays raises it, research-only)")
for secondary in (False, True):
for secondary in facts.bindings.classes:
_carry(path, secondary, facts, relay_egress, routes_at, filters_at, group.label)
sircl = model.derive_routes(layout, 2, bindings=facts.bindings)
sircl = model.derive_routes(layout, facts.bindings.lanes, bindings=facts.bindings)
lanes_of: dict[tuple[int, str], list[str]] = {}
for rank, peers in enumerate(sircl.ranks):
origin = layout.positions[rank]
Expand Down Expand Up @@ -523,7 +525,7 @@ def build_group_plan(group: GroupSpec, facts: Facts, *, relay_egress: str,

def build_plan(group: GroupSpec, facts: Facts, *, max_relays: int = model.DEFAULT_MAX_RELAYS) -> GroupPlan:
"""The plan of a topology's group, checked for isolation."""
problems = model.isolation_problems([model.derive_routes(group.layout, 2, bindings=facts.bindings)])
problems = model.isolation_problems([model.derive_routes(group.layout, facts.bindings.lanes, bindings=facts.bindings)])
plan = build_group_plan(group, facts, relay_egress=group.relay_egress, max_relays=max_relays)
problems += isolation_problems([plan])
if problems:
Expand Down
27 changes: 19 additions & 8 deletions fabric-tool/fabric_tool/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ class Topology:
functions: tuple[str, ...] # port 0 lane 0/1, port 1 lane 0/1
budget: int

@property
def lanes(self) -> int:
return len(self.functions) // 2

@property
def bindings(self) -> model.FabricBindings:
return model.FabricBindings(_roles_of_functions(self.functions))
Expand Down Expand Up @@ -169,12 +173,17 @@ def group(self) -> GroupSpec:


def _roles_of_functions(functions: tuple[str, ...]) -> tuple[Role, ...]:
"""The four roles of a topology's function names, with the DGX OS network devices as defaults.
"""The two or four roles of a topology's function names, with the DGX OS network devices as defaults.

The facts file (or a host read) binds each function to its network
device; until then the roles carry the default devices, which the fact
checks replace when a host names others.
"""
if len(functions) == 2:
return (
Role("cw_primary", functions[0], DEFAULT_NETDEVS[0], 0, False),
Role("ccw_primary", functions[1], DEFAULT_NETDEVS[2], 1, False),
)
roles = []
for index, device in enumerate(functions):
port, secondary = divmod(index, 2)
Expand All @@ -187,7 +196,7 @@ def parse(text: str, *, path: str = "<topology>") -> Topology:
"""Parse topology file text; FabricError names the line and the rule."""
hosts: list[str] = []
cables: list[Cable] = []
functions: list[str] = list(DEFAULT_FUNCTIONS)
port_functions: list[list[str]] = [list(DEFAULT_FUNCTIONS[:2]), list(DEFAULT_FUNCTIONS[2:])]
budget = DEFAULT_BUDGET
cabling = ""
for lineno, raw in enumerate(text.splitlines(), start=1):
Expand All @@ -210,11 +219,10 @@ def parse(text: str, *, path: str = "<topology>") -> Topology:
except FabricError:
raise FabricError(f"{path}:{lineno}: a cable is `cable <i>.port<0|1> <j>.port<0|1>`") from None
elif key in ("port0", "port1"):
if len(rest) != 2:
raise FabricError(f"{path}:{lineno}: {key} requires exactly two device identifiers")
if len(rest) not in (1, 2):
raise FabricError(f"{path}:{lineno}: {key} requires one or two device identifiers")
port = int(key[-1])
for lane, name in enumerate(rest[:2]):
functions[2 * port + lane] = name
port_functions[port] = list(rest)
elif key == "relay_budget":
if len(rest) != 1 or not _DECIMAL.fullmatch(rest[0]) or int(rest[0]) == 0:
raise FabricError(f"{path}:{lineno}: relay_budget is a positive byte count")
Expand All @@ -240,7 +248,10 @@ def parse(text: str, *, path: str = "<topology>") -> Topology:
last = len(hosts) if cabling == "ring" and len(hosts) > 2 else len(hosts) - 1
for i in range(last):
cables.append(Cable(i, 0, (i + 1) % len(hosts), 1))
if len(set(functions)) != 4:
if len(port_functions[0]) != len(port_functions[1]):
raise FabricError(f"{path}: port0 and port1 must name the same number of functions (1 or 2)")
functions = port_functions[0] + port_functions[1]
if len(set(functions)) != len(functions):
raise FabricError(f"{path}: port0 and port1 name one function twice")
try:
fabric = Fabric(tuple(cables))
Expand Down Expand Up @@ -276,7 +287,7 @@ def _group_of(topology: Topology) -> GroupSpec:
"""The one group of a topology: whole cycle or path, with the topology relay-egress default."""
fabric = Fabric(topology.cables)
layout = Layout(fabric, tuple(range(topology.size)))
egress = "same" if fabric.kind == "cycle" else "sibling"
egress = "same" if fabric.kind == "cycle" or topology.lanes == 1 else "sibling"
return GroupSpec(layout, egress, topology.layout_name, topology.bindings)


Expand Down
Loading
Loading