Repository navigation
helios,flare-cli: add experimental ConnectX-7 hardware-hairpin ring mode (--roce-hairpin) - #712
Draft
original-el8 wants to merge 1 commit into
Draft
original-el8 wants to merge 1 commit into
original-el8 wants to merge 1 commit into
Conversation
…ode (--roce-hairpin)
Switchless multi-host RoCEv2 rings running `--roce-ring` connect only neighbor
queue pairs and forward non-neighbor transfers (such as `0 <-> 2` and `1 <-> 3`
in a 4-Spark ring) through the native host CPU proxy over 64 KiB software
mailboxes. ConnectX-7 NICs support wire-speed hardware hairpin forwarding
(`tc flower skip_sw` `in_hw`) between physical ports without crossing host PCIe
or CPU. Adding a `Shape::HairpinRing` (`--roce-hairpin`) mode lets intermediate
ConnectX-7 NICs forward non-neighbor RoCEv2 UDP/4791 packets in hardware while
ranks open direct all-to-all RC queue pairs without CPU proxy relaying or
changes to the native RoCE proxy ABI.
Exact changes:
- `helios/src/execution/roce_fabric.rs`: add `Shape::HairpinRing`
(`relays() == false`, `linked() == (peer != rank)`), `plan_hairpin_ring_routes`,
and `hairpin_equal_arc_pair`. Adjacent ring neighbors keep their physical
cable links, non-neighbors pair arc-entry and arc-exit devices along the
shorter arc, and equal-arc opposite pairs (`0 <-> 2` and `1 <-> 3` on a
4-Spark ring) split Rail 0 clockwise and Rail 1 counter-clockwise while
avoiding shared devices, PCIe links, and physical ports at both ends. Tighten
`direct_peers` to require `same_link(x, y)` so multi-hop hairpin peers report
`direct = false`.
- `helios/src/execution/roce.rs`: treat `Shape::HairpinRing` identically to
`Shape::Mesh` in `RoceTransport::open` (`enabled = 0`, no `roce_enable_ring`),
leaving the native C proxy and ABI 14 core layout unchanged.
- `flare-cli/src/{cli,cluster,distribution,fabric,fabric_transport,launch,main}.rs`
and `flare-cli/src/orbit/{agent,controller,fabric,grant,store}.rs`: wire
`--roce-hairpin` (mutually exclusive with `--roce-ring` and `--roce-chain`)
across manual, `--hosts`, and Orbit launches with `hairpin-ring` rendezvous
shape agreement, backward-compatible `#[serde(default)]` Orbit grant/store
fields, and neighbor-relayed TCP core distribution so NIC hairpin rules need
only offload RoCEv2 traffic.
- `scripts/setup_cx7_hairpin_ring.sh`: add a dry-run-by-default (`--apply`,
`--verify`, `--teardown`) host setup helper generating per-rank ConnectX-7
`tc flower skip_sw` L3 hairpin rules (`pedit` MAC rewrite plus `mirred egress
redirect`) and static `/32` routes and permanent neighbor entries for a
4-node ring.
- `docs/roce-ring.md` and `docs/cli-design.md`: document `--roce-hairpin`
routing, host configuration, verification checks, and unverified hardware
status.
Expected benefit: on switchless 4-Spark rings configured with ConnectX-7
hardware hairpin, eliminates CPU proxy relay hops and software mailbox copies
for non-neighbor collectives, splits diagonal traffic across both ring arcs and
both PCIe Gen5 x4 links per host, and reuses existing exported cores without
re-export. Mesh, ring, and chain behavior remain unchanged. No end-to-end
hardware performance improvement has been measured yet.
Evidence and material limitations:
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features roce,runtime-core,server --lib roce`:
46 passed, 0 failed (covering 4-Spark diagonal split-arc PCIe/port
separation, symmetric 2..16-rank hairpin routing, and proxy preflight).
- `cargo test --locked --release --manifest-path flare-cli/Cargo.toml`:
225 unit tests and 7 integration tests passed, 0 failed (covering CLI mutual
exclusivity and forwarding, rendezvous shape agreement, neighbor-relayed TCP
distribution, and Orbit fabric/grant/store validation).
- `bash -n scripts/setup_cx7_hairpin_ring.sh` and 4-rank dry-run verification
checked all 8 unidirectional diagonal transit flows.
- Limitation: not yet tested on a physical switchless 4-Spark ring; live
hardware validation is required for ConnectX-7 dual-PF switchdev `in_hw`
offload, TC 0 PFC stability, 2-hop `ib_write_lat`, and multi-host `flare run
--roce-hairpin` collective replay.
Discord: el8
Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Switchless multi-host RoCEv2 rings using
--roce-ringconnect only neighbor queue pairs and forward non-neighbor transfers (such as0 <-> 2and1 <-> 3in a 4-Spark ring) through the native host CPU proxy (helios/native/roce_proxy.c) over 64 KiB software mailboxes. ConnectX-7 NICs support wire-speed hardware hairpin forwarding (tc flower skip_swin_hw) between physical ports without crossing host PCIe or CPU.Adding an explicit
Shape::HairpinRing(--roce-hairpin) mode lets intermediate ConnectX-7 NICs forward non-neighbor RoCEv2 UDP/4791 packets in hardware while ranks open direct all-to-all RC queue pairs without CPU proxy relaying or changes to the native RoCE proxy ABI.What Changed
helios/src/execution/roce_fabric.rs: AddedShape::HairpinRing(relays() == false,linked() == (peer != rank)),plan_hairpin_ring_routes, andhairpin_equal_arc_pair. Adjacent ring neighbors retain their direct physical cable links; non-neighbor peers pair arc-entry and arc-exit devices along the shorter arc; equal-length opposite pairs (0 <-> 2and1 <-> 3in a 4-Spark ring) split Rail 0 clockwise and Rail 1 counter-clockwise while minimizing shared devices, PCIe links, and physical ports at both ends. Tighteneddirect_peersto requiresame_link(x, y)so multi-hop hairpin peers reportdirect = false.helios/src/execution/roce.rs: TreatedShape::HairpinRingidentically toShape::MeshinRoceTransport::open(enabled = 0, noroce_enable_ring), keeping the native C proxy and ABI 14 core layout unchanged.flare-cli/src/{cli,cluster,distribution,fabric,fabric_transport,launch,main}.rs&flare-cli/src/orbit/{agent,controller,fabric,grant,store}.rs: Wired--roce-hairpin(mutually exclusive with--roce-ringand--roce-chain) across manual,--hosts, and Orbit launches withhairpin-ringrendezvous shape agreement, backward-compatible#[serde(default)]Orbit grant/store fields, and neighbor-relayed TCP core distribution so NIC hairpin rules need only offload RoCEv2 traffic.scripts/setup_cx7_hairpin_ring.sh: Added a dry-run-by-default (--apply,--verify,--teardown) host setup and verification helper generating per-rank ConnectX-7tc flower skip_swL3 hairpin rules (peditMAC rewrite plusmirred egress redirect) and static/32routes and permanent neighbor entries for a 4-node switchless ring.docs/roce-ring.md&docs/cli-design.md: Documented--roce-hairpinrouting, host configuration, verification checks, and unverified hardware status.Expected Benefit
On switchless 4-Spark rings configured with ConnectX-7 hardware hairpin:
0 <-> 2,1 <-> 3) transfers across both ring arcs and both PCIe Gen5 x4 links per host.--roce-ring, and--roce-chainpaths unchanged.No end-to-end serving speedup has been measured yet; this draft PR is published for testing on physical switchless ring hardware.
Evidence & Material Limitations
cargo test --locked --release --manifest-path helios/Cargo.toml --features roce,runtime-core,server --lib roce: 46 passed, 0 failed (includinghairpin_ring_on_four_sparks_splits_diagonals_across_both_arcs_and_pcie_linksandvariable_size_hairpin_rings_route_all_peers_symmetrically).cargo test --locked --release --manifest-path flare-cli/Cargo.toml: 225 unit tests and 7 integration tests passed, 0 failed (includinghairpin_flag_is_forwarded_and_excludes_ring_and_chain,hairpin_ring_uses_neighbor_relays_for_tcp_distribution,cluster::routing_tests, andorbit::fabric::tests).bash -n scripts/setup_cx7_hairpin_ring.shand 4-rank dry-run verification checked symmetric endpoint routes and transit rules across all 8 unidirectional diagonal flows.tc flower skip_swreportsin_hwon all intermediate ring ports without software fallback.ib_write_latsucceeds across0 <-> 2and1 <-> 3on both arcs with zero drops/retransmits.flare run --roce-hairpincompletes collective warmup and serving replay cleanly.Discord: el8