Repository navigation
Pin Helios execution and RoCE proxy threads to high-capacity CPUs on asymmetric Linux topologies - #576
Pin Helios execution and RoCE proxy threads to high-capacity CPUs on asymmetric Linux topologies#576fordbmorris wants to merge 1 commit into
Conversation
3363573 to
4b41ddc
Compare
|
A case file has been opened for 576. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe DGX Spark placement work is well-targeted and preserves operator cpusets, but two concrete defects block merge: a vendored
Have your agent review the Full Review for complete verified findings, To opt out, include |
original-el8
left a comment
There was a problem hiding this comment.
Pinning critical execution threads to high-capacity CPUs on asymmetric ARM64 hosts addresses a real throughput and jitter problem on GB10, and the eos/src/unix.rs tier-selection logic cleanly respects operator cpusets and no-ops on homogeneous or x86_64 systems. Two blockers need resolution before merge:
- Child-thread affinity inheritance in
helios/src/server/runtime.rs:565: Callingflare_eos::prefer_high_capacity_cpus()at entry to theflare-modelthread runs beforeRankExecutor::new,crate::offload::open(host prefix offload, codec, and disk threads), andImagePreparation::new(helios/src/server/runtime.rs:682-725). On Linux, spawned child threads inherit their parent's affinity mask, so background offload, disk, and image-preparation threads inherit the Cortex-X925-only mask instead of remaining free to run on efficiency cores. Move theprefer_high_capacity_cpus()call inflare-modelto right beforeworker.run(&mut executor)(and verifyhelios/src/execution/parallel.rs:536does not narrow affinity before spawning non-critical helper threads). - Vendored
helios/native/roce_proxy.cfork and duplicate C logic (helios/native/roce_proxy.c:186-258):helios/native/roce_proxy.cmust remain identical to FlashInfer's pinnedflashinfer/experimental/b12x/comm/roce/_roce_proxy.c(lines 6-8), and this duplicates 66 lines of untested C capacity-selection logic alongsideeos/src/unix.rs. Either sync the change through FlashInfer PR #156 first, or applyflare_eos::prefer_high_capacity_cpus()from Rust around proxy thread creation without modifying the vendored C file. - Commit message and sign-off hygiene: Update the commit message so it matches the PR description (the commit message still states 6-launch and serving runs "follow immediately"), include the reviewing model identity in
Design-Signed-Off-By(Antigravityomits the model), and refresh thedocs/design-review.mddigest (eb2fis stale onmain).
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe core tier-selection helper is sound, but editing vendored
Walkthrough
Merge Risk: High · up to
|
4b41ddc to
4c82ab5
Compare
|
Thanks @original-el8 for the thorough review. Rebased onto current
Ready for re-review! |
4c82ab5 to
ba2796c
Compare
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe rework clears two of the three prior blockers —
Walkthrough
Merge Risk: Medium · up to
|
…tep ring2) Why: On 4-rank switchless dual-port RoCE rings (DGX Spark / NVIDIA GB10, SM121), small-message BF16 allreduce previously used the oneshot protocol, which relays across opposite ranks over CPU mailbox hops. FlashInfer's merged `local-inference-lab/flashinfer#192` (`2a07747b8e12e54ec8e8e4bbef34de8586618e68`) adds a 2-step neighbor-only ring allreduce (`KIND_RING2_STEP1` / `KIND_RING2_STEP2`) plus small-message inline WR and ring-relay improvements in `_roce_proxy.c`. Per `docs/roce-ring.md`, Helios's vendored `helios/native/roce_proxy.c` must remain byte-identical to FlashInfer's `_roce_proxy.c` after its provenance header so preparation and serving share the transport protocol. What changed: Re-vendored `helios/native/roce_proxy.c` byte-for-byte (after the 9-line provenance header) from `local-inference-lab/flashinfer` commit `2a07747b8e12e54ec8e8e4bbef34de8586618e68` (`#192`). Relative to Flare `main`, this brings in: - `KIND_RING2_STEP1` (5) and `KIND_RING2_STEP2` (6) direct-neighbor RDMA write handling (`post_direct_striped_batched`, `post_ring2_step`) with batched completion signaling (`RING2_SIGNAL_STRIDE = 16`, `RING2_MAX_OUTSTANDING = 6`, statically verified against `ROCE_SEND_DEPTH` with queue slack for relay ops and ring ACKs). - Small-message and ring-relay transport improvements from FlashInfer `#192`: QP `max_inline_data` raised from 16 to 256 (with fallback to 16 and per-HCA `max_inline` tracking) to enable `IBV_SEND_INLINE` on relay mailbox and `post_striped` payloads `<= max_inline`; `ring_next_from` and precomputed `ring_relays_origin[]` so `ring_service` skips non-relayed origins; `post_op` posting relayed peers before direct peers on rings; and idle-loop polling (`ring_service` every spin when `!ring2_active`, every 16th when `ring2_active`; `drain_cqs` every 16th). - High-capacity CPU pinning (`pin_high_capacity_cpus`, `"flare-roce"` thread name) already merged upstream in `flashinfer#156` (overlaps open `#576`). - Existing control opcodes (0..4) and `ROCE_ABI_VERSION = 14` remain unchanged, preserving full compatibility with existing ABI-14 cores. Claimed benefit and result: Enables native Rust serving (`flare run`) to drive b12x's 2-step RoCE ring allreduce on 4-rank switchless rings without opposite-rank CPU relay hops. Note that an isolated `#643`-only run on a `main`-exported core does not emit kinds 5/6; paired with `local-inference-lab/flashinfer#192` (`2a07747b8`), `local-inference-lab/flashinfer#193`, `local-inference-lab/hyperflare-recipes#112`, and `#644` on 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving (`max_tokens = 256`, 5-prompt suite): - In node-level nsys P=4 traces, `RoceRing2AllReduceLaunch` averages 31.8-33.0 us/call across 88 calls/round (eliminating opposite-rank CPU relay hops on small BF16 allreduces). - Combined-stack matched-depth GPU round times dropped 1.5-2.2 ms across P=1..6 versus pre-existing non-ring2 baseline core `gb10-tp4-202611291503` (P=1: 22.3 -> 20.8 ms, P~4: 34.59 -> 32.36 ms, P~5: 35.92 -> 34.16 ms; 5-prompt mean 74.02 -> 76.11 tok/s under `balanced`, `greedy_code` 74.39 -> 80.89 tok/s). Supporting evidence and limitations: - Byte-parity check: `diff` between `tail -n +10 helios/native/roce_proxy.c` and `flashinfer@2a07747b8:flashinfer/experimental/b12x/comm/roce/_roce_proxy.c` returned 0 bytes diff. - Native RoCE proxy unit tests (`cargo test --locked --release --manifest-path helios/Cargo.toml --features roce --lib --target-dir flare-cli/target execution::roce`): **30 passed, 0 failed** (6 `execution::roce::tests` + 24 `execution::roce_fabric::tests`). - Full crate tests (`cargo test --locked --release` on `helios` with `--features runtime-core,server`, `flare`, `flare-cli`): all passed. - Live 4-rank multi-GPU collective execution verified on 4x DGX Spark dual-port switchless RoCE rings serving both ring2-enabled cores (`gb10-tp4-202611301141`, `gb10-tp4-202611301553`, 57 graphs each) and legacy non-ring2 ABI-14 core (`gb10-tp4-202611291503`). - Limitations / unrun checks: - Keeping `ROCE_ABI_VERSION = 14` preserves compatibility with existing ABI-14 cores, but an older Flare binary without `#643` loading a newer ring2-exported core will connect and fail on replay op 1 with `unknown op kind 5` rather than rejecting at startup. - Collides on `roce_proxy.c` with open `#576` (`pin_high_capacity_cpus` from merged `flashinfer#156`) and `#577` (`RING_WINDOW` / `reserve`); whichever lands second will rebase cleanly against the vendored file. - Non-4-rank ring topologies and non-SM121 RoCE NICs were not benchmarked. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b
…tep ring2) (#643) Why: On 4-rank switchless dual-port RoCE rings (DGX Spark / NVIDIA GB10, SM121), small-message BF16 allreduce previously used the oneshot protocol, which relays across opposite ranks over CPU mailbox hops. FlashInfer's merged `local-inference-lab/flashinfer#192` (`2a07747b8e12e54ec8e8e4bbef34de8586618e68`) adds a 2-step neighbor-only ring allreduce (`KIND_RING2_STEP1` / `KIND_RING2_STEP2`) plus small-message inline WR and ring-relay improvements in `_roce_proxy.c`. Per `docs/roce-ring.md`, Helios's vendored `helios/native/roce_proxy.c` must remain byte-identical to FlashInfer's `_roce_proxy.c` after its provenance header so preparation and serving share the transport protocol. What changed: Re-vendored `helios/native/roce_proxy.c` byte-for-byte (after the 9-line provenance header) from `local-inference-lab/flashinfer` commit `2a07747b8e12e54ec8e8e4bbef34de8586618e68` (`#192`). Relative to Flare `main`, this brings in: - `KIND_RING2_STEP1` (5) and `KIND_RING2_STEP2` (6) direct-neighbor RDMA write handling (`post_direct_striped_batched`, `post_ring2_step`) with batched completion signaling (`RING2_SIGNAL_STRIDE = 16`, `RING2_MAX_OUTSTANDING = 6`, statically verified against `ROCE_SEND_DEPTH` with queue slack for relay ops and ring ACKs). - Small-message and ring-relay transport improvements from FlashInfer `#192`: QP `max_inline_data` raised from 16 to 256 (with fallback to 16 and per-HCA `max_inline` tracking) to enable `IBV_SEND_INLINE` on relay mailbox and `post_striped` payloads `<= max_inline`; `ring_next_from` and precomputed `ring_relays_origin[]` so `ring_service` skips non-relayed origins; `post_op` posting relayed peers before direct peers on rings; and idle-loop polling (`ring_service` every spin when `!ring2_active`, every 16th when `ring2_active`; `drain_cqs` every 16th). - High-capacity CPU pinning (`pin_high_capacity_cpus`, `"flare-roce"` thread name) already merged upstream in `flashinfer#156` (overlaps open `#576`). - Existing control opcodes (0..4) and `ROCE_ABI_VERSION = 14` remain unchanged, preserving full compatibility with existing ABI-14 cores. Claimed benefit and result: Enables native Rust serving (`flare run`) to drive b12x's 2-step RoCE ring allreduce on 4-rank switchless rings without opposite-rank CPU relay hops. Note that an isolated `#643`-only run on a `main`-exported core does not emit kinds 5/6; paired with `local-inference-lab/flashinfer#192` (`2a07747b8`), `local-inference-lab/flashinfer#193`, `local-inference-lab/hyperflare-recipes#112`, and `#644` on 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving (`max_tokens = 256`, 5-prompt suite): - In node-level nsys P=4 traces, `RoceRing2AllReduceLaunch` averages 31.8-33.0 us/call across 88 calls/round (eliminating opposite-rank CPU relay hops on small BF16 allreduces). - Combined-stack matched-depth GPU round times dropped 1.5-2.2 ms across P=1..6 versus pre-existing non-ring2 baseline core `gb10-tp4-202611291503` (P=1: 22.3 -> 20.8 ms, P~4: 34.59 -> 32.36 ms, P~5: 35.92 -> 34.16 ms; 5-prompt mean 74.02 -> 76.11 tok/s under `balanced`, `greedy_code` 74.39 -> 80.89 tok/s). Supporting evidence and limitations: - Byte-parity check: `diff` between `tail -n +10 helios/native/roce_proxy.c` and `flashinfer@2a07747b8:flashinfer/experimental/b12x/comm/roce/_roce_proxy.c` returned 0 bytes diff. - Native RoCE proxy unit tests (`cargo test --locked --release --manifest-path helios/Cargo.toml --features roce --lib --target-dir flare-cli/target execution::roce`): **30 passed, 0 failed** (6 `execution::roce::tests` + 24 `execution::roce_fabric::tests`). - Full crate tests (`cargo test --locked --release` on `helios` with `--features runtime-core,server`, `flare`, `flare-cli`): all passed. - Live 4-rank multi-GPU collective execution verified on 4x DGX Spark dual-port switchless RoCE rings serving both ring2-enabled cores (`gb10-tp4-202611301141`, `gb10-tp4-202611301553`, 57 graphs each) and legacy non-ring2 ABI-14 core (`gb10-tp4-202611291503`). - Limitations / unrun checks: - Keeping `ROCE_ABI_VERSION = 14` preserves compatibility with existing ABI-14 cores, but an older Flare binary without `#643` loading a newer ring2-exported core will connect and fail on replay op 1 with `unknown op kind 5` rather than rejecting at startup. - Collides on `roce_proxy.c` with open `#576` (`pin_high_capacity_cpus` from merged `flashinfer#156`) and `#577` (`RING_WINDOW` / `reserve`); whichever lands second will rebase cleanly against the vendored file. - Non-4-rank ring topologies and non-SM121 RoCE NICs were not benchmarked. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=2e5b Signed-off-by: Luke Alonso <lalonso@gmail.com>
…x topologies On asymmetric ARM64 Linux SoCs such as NVIDIA GB10 (10 Cortex-A725 efficiency cores with sysfs cpu_capacity 718..731 alongside 10 Cortex-X925 performance cores with cpu_capacity 997..1024), the Linux scheduler places Helios's execution threads onto efficiency cores on some launches and performance cores on others. Efficiency-core placement slows one-shot RoCE collectives, inflates inter-graph host wake gaps, and creates launch-to-launch throughput jitter that distorts speculative drafting choices. Changes (rebased onto main after NVIDIA#643 already vendored pin_high_capacity_cpus in helios/native/roce_proxy.c from merged local-inference-lab/flashinfer#156): - Add flare_eos::select_high_capacity_cpus and prefer_high_capacity_cpus in eos/src/unix.rs (with a no-op stub in eos/src/windows.rs and unit tests in eos/src/unix.rs). On Linux, prefer_high_capacity_cpus reads /sys/devices/system/cpu/cpu<N>/cpu_capacity across the thread's current sched_getaffinity mask, selects CPUs at or above 90% of the maximum allowed capacity (falling back above midpoint so busy threads never collapse onto fewer than two cores), and no-ops when cpu_capacity is absent, homogeneous, or already single-tier. - Call flare_eos::prefer_high_capacity_cpus() in Helios critical worker threads after child-thread spawning so background threads keep the full process affinity mask: - helios/src/server/runtime.rs (flare-model): called after RankExecutor::new, crate::offload::open (host prefix offload, KV codec pool, and disk threads), and ImagePreparation::new, immediately before worker.run(&mut executor). - helios/src/execution/worker.rs (flare-execution): called after RankExecutor::new. - helios/src/execution/threaded.rs (flare-rank-*): called after GraphExecutor::new_unstarted. - helios/src/execution/parallel.rs (serve_rank): called after GraphExecutor::new_unstarted. - helios/src/replay.rs (flare-cuda): called on worker entry before the replay loop. - Existing core ABIs and operator cpusets remain unchanged. Measured benefit on four DGX Spark GB10 nodes (--roce-ring, Inkling 2 Small NVFP4 TP4 core gb10-tp4-202611271425): - Across 6 consecutive launches, 48/48 critical threads stayed on Cortex-X925 (vs 4/4 unpinned launches landing on Cortex-A725). - Batch=1 width=8 graph-time CV dropped 6.7x (4.82% to 0.72%); controlled A/B C8 64k decode rose 17.2% (123.66 to 144.88 tok/s); 8k-128k cold prefill rose 2.6%-17.3%. - Node-level nsys showed C1 width-1 RoceOneshotLaunch dropped 31.0% (2.77 to 1.91 ms) and p90 inter-graph host wake gap dropped 61x (1,880 to 30.9 us). Validation and limitations: - ARM64 Linux (dgx2): cargo test --locked --release --manifest-path eos/Cargo.toml passed 5/5 (asymmetric, homogeneous, single-tier, zero-capacity, and three-tier unit tests); cargo test --locked --release --manifest-path helios/Cargo.toml --features roce,runtime-core,server passed 1,728/1,728 (44 GPU-only ignored). - Live four-Spark serving via flare run confirmed flare-model, flare-roce, and peer serve_rank threads pinned to Cpus_allowed_list 5-9,15-19 across all 13 checkpoints of a 2-hour production soak while the ImagePreparation child thread, flare-http, tokio-rt-worker, and CUDA helper threads remained unconstrained on 0-19. - Limitations: tested on ARM64 Linux (NVIDIA GB10, schedutil); on x86_64 Linux sysfs cpu_capacity is absent so the helper is a no-op; the eos/src/windows.rs stub was not compiled on Windows; host prefix offload with --prefix-cache-memory was not exercised on multi-host TP4 (verified by placement order after crate::offload::open). Design-Signed-Off-By: Antigravity (Gemini-4-Neon); design-review=2e5b Signed-off-by: woooflet <ford@fordmorris.com>
|
Rebased onto latest
Discord: woooflet |
ba2796c to
ca0c982
Compare
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedDropping the redundant
Walkthrough
Merge Risk: Medium · up to
|
Why
On asymmetric ARM64 Linux SoCs such as NVIDIA GB10 (DGX Spark: 10 Cortex-A725 efficiency cores with sysfs
cpu_capacity718–731 alongside 10 Cortex-X925 performance cores withcpu_capacity997–1,024), the Linux scheduler places Helios execution threads and the busy-polling RoCE proxy thread onto efficiency cores on some launches and performance cores on others. Efficiency-core placement slows one-shot RoCE collectives, inflates inter-graph host wake gaps, and creates launch-to-launch timing variance that distorts speculative drafting choices.What Changed
eos/src/unix.rs(+ no-op stub ineos/src/windows.rs): addselect_high_capacity_cpusandprefer_high_capacity_cpus, which intersect strictly with the thread's existingsched_getaffinitymask, read/sys/devices/system/cpu/cpu<N>/cpu_capacity, select CPUs >= 90% of max allowed capacity (falling back above midpoint to never collapse below 2 cores), and no-op whencpu_capacityis absent, homogeneous, or already single-tier.flare_eos::prefer_high_capacity_cpus()in Helios critical worker threads until after child-thread spawning so background threads retain the unnarrowed process affinity mask:helios/src/server/runtime.rs(flare-model): called afterRankExecutor::new,crate::offload::open(host prefix offload, KV codec pool, and disk threads), andImagePreparation::new, right beforeworker.run(&mut executor).helios/src/execution/worker.rs(flare-execution): called afterRankExecutor::new.helios/src/execution/threaded.rs(flare-rank-*): called afterGraphExecutor::new_unstarted.helios/src/execution/parallel.rs(serve_rank): called afterGraphExecutor::new_unstarted(no non-critical helper threads are spawned inserve_rank).helios/src/replay.rs(flare-cuda): called on worker entry before the replay loop.helios/native/roce_proxy.c: vendor the exactpin_high_capacity_cpus()and"flare-roce"thread-naming hunk merged in feat(b12x/comm/roce): pin RoCE proxy thread to high-capacity CPUs on asymmetric Linux topologies local-inference-lab/flashinfer#156 (335459b2). Existing core ABIs and operator cpusets remain unchanged.Claimed Benefit & Supporting Evidence (4× DGX Spark GB10 TP4,
--roce-ring, Inkling 2 Small NVFP4 coregb10-tp4-202611271425)48/48critical threads stayed on Cortex-X925 (vs4/4unpinned launches landing on A725). On the updated binary (4c82ab5b), inspecting/proc/<pid>/task/*/statusacross all four ranks during live serving confirmedflare-model,flare-roce, and peerserve_rankthreads hadCpus_allowed_list=5-9,15-19while theImagePreparationchild thread spawned byflare-model,flare-http,tokio-rt-worker, and CUDA driver helper threads retained0-19.batch=1, width=8graph-time CV dropped 6.7× (4.82% -> 0.72%); controlled A/BC864k decode rose +17.2% (123.66 -> 144.88 tok/s); 8k–128k cold prefill rose+2.6%to+17.3%.nsys: C1 width-1RoceOneshotLaunchdropped -31.0% (2.77 -> 1.91 ms); p90 inter-graph host wake gap dropped 61× (1,880 -> 30.9 us).4c82ab5b):cargo test --locked --release --manifest-path eos/Cargo.toml:5/5passed on ARM64 Linux (dgx2).cargo test --locked --release --manifest-path helios/Cargo.toml --features roce,runtime-core,server:1,728/1,728passed (44GPU-only ignored), including all6execution::roce::tests.flare runon existing ABI-14 coregb10-tp4-202611271425:60.0 tok/sshort,79.4 tok/s256-token coding,0/16ConnectX-7 RDMA port errors, clean Orbit drain.Limitations: Tested on ARM64 Linux (NVIDIA GB10,
schedutil). On x86_64 Linux,/sys/devices/system/cpu/cpu<N>/cpu_capacityis absent so the helper is a no-op.eos/src/windows.rswas not compiled on Windows. Host prefix offload (--prefix-cache-memory) was not exercised on multi-host TP4 and is protected by deferringprefer_high_capacity_cpus()pastcrate::offload::open.Discord: woooflet