Repository navigation
perf(b12x): add SM121 2-step RoCE ring allreduce and split-lagged mHC grid cap - #192
Merged
Merged
Conversation
On 4-rank switchless dual-port RoCE rings (DGX Spark / GB10, SM121),
small-message BF16 allreduce previously fell back to a 4-rank oneshot
protocol that relays across opposite ranks over CPU hops, and the
split-lagged mHC ReadOnlyFnPartialM8 kernel launched hidden/32 CTAs
(160 CTAs for hidden=5120), causing multi-wave tail stalls on 48-SM
SM121 GPUs while overlapping with RoCE collectives.
This change adds a 2-step ring allreduce kernel (`_ring2_cute.py`) with
fused addend support and gated allgather support (`_allgather_cute.py`,
`roce_oneshot.py`, `_preparation.py`, `_roce_proxy.c`,
`_cute_intrinsics.py`), and caps `ReadOnlyFnPartialM8` grid size on
small-SM GPUs (`readonly_fn_m8_grid_ctas`, 40 CTAs on 48-SM SM121) so
it completes within one wave alongside concurrent RoCE execution.
Expected and measured impact: reduces 4-rank switchless RoCE ring
allreduce latency and removes multi-wave mHC partial stalls on SM121
during TP4 decode. In node-level nsys P=4 traces on 4x DGX Spark
(DeepSeek-V4.1-Flash TP4), RoceRing2AllReduceLaunch averages 31.8-33.0
us/call across 88 calls/round and ReadOnlyFnPartialM8 averages
12.8-13.9 us/call across 86 calls/round.
Validation:
- `pytest tests/experimental/b12x/norm/test_mhc_split_lagged.py -q` on
GB10 (SM121): 69 passed, 0 failed (84 SM120-gated tests skipped),
including `test_readonly_fn_m8_capped_grid_matches_reference_and_replays_graph`
across hidden={4096,5120,7168} and tokens={1,6,8}.
- Full 4-rank TP4 CUDA-graph export and serving on 4x DGX Spark
(DeepSeek-V4.1-Flash, 57 captured graphs).
|
Reviewed against our 4-Spark RoCE and mHC stack (#189, #190) and updated #189 ( A few concrete items from code review and
|
lukealonso
added a commit
to NVIDIA/hyperflare-inference
that referenced
this pull request
Nov 30, 2026
…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
lukealonso
added a commit
to NVIDIA/hyperflare-inference
that referenced
this pull request
Nov 30, 2026
…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>
FujitsuPolycom
added a commit
to FujitsuPolycom/flashinfer
that referenced
this pull request
Nov 30, 2026
Why: On switchless closed RoCE rings (such as 4x NVIDIA DGX Spark GB10 with 2x200 GbE ConnectX-7 links, ring=True, ring_open=False, world_size >= 3), pipelined reduce_scatter (KIND_REDUCE_SCATTER=3) and gather_shards (KIND_GATHER_SHARDS=4) route non-neighbor traffic across 2-hop CPU mailbox relays. That 2-hop relay path saturates host memory bandwidth and leaves bidirectional neighbor links underutilized on large row-sharded prefill collectives (20-80 MiB), accounting for ~20% of chunk time on 4-rank closed rings. What: Add 1-hop bidirectional closed-ring reduce-scatter (KIND_RING_RS=7), shard gather (KIND_RING_AG=8), and opt-in fused reduce-scatter + all-gather (KIND_RING_RSAG=9) directly below KIND_RING2_STEP1/2 (5..6, merged in local-inference-lab#192) over the existing ROCE_ABI_VERSION 14 region layout without changing roce_layout, roce_blob_t, RING_WINDOW, or opcodes 0..6. - flashinfer/experimental/b12x/comm/roce/_roce_proxy.c: - Before: proxy_main dispatched op kinds 0..6; credit_phases guarded pipe-only reuse transitions. - After: defines KIND_RING_RS=7, KIND_RING_AG=8, and KIND_RING_RSAG=9, adds ring_dir_shard_bounds, ring_ag_arrived, and run_ring_bidir_op (with half_cap and chunk-coverage bounds checks) for strictly 1-hop CW/CCW striped RDMA writes with zero-copy proxy AG forwarding, and extends credit_phases for same-family and cross-family pipe <-> ring_bidir transitions over shared pipe_recv. - flashinfer/experimental/b12x/comm/roce/_ring_scatter_gather_cute.py: - Adds CuTe DSL kernels for ring_rs (7), ring_ag (8), and ring_rsag (9), splitting each rank's contiguous shard into two equal halves (CW dir=0, CCW dir=1) when nbytes % (2 * world_size * 16) == 0. - flashinfer/experimental/b12x/comm/roce/roce_oneshot.py & _preparation.py: - Before: reduce_scatter and gather_shards always used KIND_REDUCE_SCATTER and KIND_GATHER_SHARDS; all_reduce above pipe_threshold always used KIND_TWOSHOT. - After: closed rings (ring=True, ring_open=False, world_size >= 3, pipe_bytes > 0) automatically dispatch KIND_RING_RS at >= 4 MiB (falling back to KIND_REDUCE_SCATTER below 4 MiB) and KIND_RING_AG at >= 256 KiB when col_row_bytes == 0 and pack counts divide by 2 * world_size, using lane-aligned chunks with (world_size - 1) * chunks <= max_chunks. KIND_RING_RSAG stays opt-in via ring_rsag_allreduce=False (default) and is excluded from default compilation and RoceQuery.setup. Existing ring2 (5..6), non-ring, open-ring, world_size=2, col_row_bytes > 0, and multi-stream CUDA-graph _capture_event ordering remain unchanged. - flashinfer/experimental/b12x/comm/roce/README.md & tests: - Documents op kinds 7..9 alongside kinds 5..6, ABI 14 compatibility, and hop-by-hop dtype-rounded KIND_RING_RS semantics; adds compiled C proxy harness tests (including KIND_RING2_STEP1/2, unknown opcode 10, credit_phases transitions, and half_cap overflow rejection), CPU gating/fallback/partial-tail tests, and closed-ring GPU test assertions. Result: - Isolated 4x DGX Spark GB10 (SM121, 2x200 GbE closed ring, BF16, 3 rounds x 20-30 iterations): - 256 KiB gather_shards: 0.051 -> 0.045 ms (-11.8%, 1.13x); reduce_scatter falls back to KIND_REDUCE_SCATTER (3) below 4 MiB. - 4 MiB: reduce_scatter 0.236 -> 0.198 ms (-16.1%, 1.19x); gather_shards 0.269 -> 0.196 ms (-27.1%, 1.37x). - 40 MiB: reduce_scatter 1.920 -> 1.297 ms (-32.4%, 1.48x); gather_shards 1.961 -> 1.307 ms (-33.4%, 1.50x). - 80 MiB: reduce_scatter 3.788 -> 2.605 ms (-31.2%, 1.45x); gather_shards 3.819 -> 2.591 ms (-32.2%, 1.47x, 48.6 GB/s bidirectional wire rate). - Opt-in KIND_RING_RSAG vs KIND_TWOSHOT all-reduce (4-80 MiB): -27.4%..-33.3% (1.38x-1.50x). Evidence: - Verified on clean git archive of this commit atop main (2a07747): - ruff==0.12.8 check & format --check on all 6 touched Python files: 0 errors, 6 files formatted, 0 CRLF bytes. - gcc -O2 -std=gnu11 -shared -fPIC -Wall -Wextra -Werror on _roce_proxy.c: PASS (0 warnings). - CPU pytest (CUDA_VISIBLE_DEVICES=""): - test_roce_proxy.py: 21 passed, 0 failed (compiled C harness checking ABI 14, RING_WINDOW 8, KIND_RING2_STEP1/2 5..6, opcodes 7..9, unknown opcode 10, credit_phases, ring_dir_shard_bounds, half_cap overflow rejection, and run_ring_bidir_op fault guards). - test_roce_scatter_gather_gpu.py: 1 passed, 9 skipped (requires torchrun WORLD_SIZE >= 2), 0 failed. - test_roce_preparation_compile.py: 4 passed, 2 skipped (CUDA), 1 pre-existing failure (test_declaration_rejects_nonserializable_dtypes, reproduced identically on unmodified 2a07747). - test_roce_sequence_exhaustion.py: 4 passed, 0 failed. - test_roce_routes.py: 43 passed, 0 failed. - git merge-tree --write-tree origin/main HEAD: clean (0 conflicts). - Limitations: - ROCE_ABI_VERSION remains 14; closed-ring cores exported with opcodes 7/8/9 require a serving runtime containing the companion NVIDIA/hyperflare-inference proxy PR. - The 2 CUDA compilation tests in test_roce_preparation_compile.py and the 9 multi-node GPU tests in test_roce_scatter_gather_gpu.py were skipped in the CPU-only verification run. - The 4-node DGX Spark GB10 isolated kernel measurements and 120-op eager / 160-op CUDA-graph parity stress runs were collected on an earlier prototype with identical run_ring_bidir_op and CuTe kernel logic; a final 4-node closed-ring GPU pass paired with the companion NVIDIA/hyperflare-inference proxy PR on this commit is required before marking ready for review. Discord: Dooner Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
lukealonso
added a commit
to local-inference-lab/hyperflare-recipes
that referenced
this pull request
Nov 30, 2026
…obabilities (#111) Why: `_complete_block` in `hyperflare_recipes/components/vocabulary_sampling.py` previously reported the sequential rejection-sampling product `prod_{k <= s} min(p_k / q_k, 1)` as `completion_speculative_survival`. Under Sun et al. block verification, prefix length >= s + 1 is accepted whenever at least one independent test k in s..(limit - 2) succeeds with hazard `h_k`, so the sequential product is only a strict lower bound that under-reports survival at deeper depths (20-30 percentage points low at depths 2..5). Because Helios uses `completion_speculative_survival` as its Rao-Blackwellized realized target for adaptive verification calibration, this bias systematically underestimated deeper-depth acceptance. What changed: - In `hyperflare_recipes/components/vocabulary_sampling.py` (`_complete_block`): stored each clamped step hazard `h_k` in FP32 and computed the exact conditional survival probability `S_s = 1 - prod_{k=s}^{limit - 2} (1 - h_k)` via the backward FP32 recurrence `S_s = min(S_{s+1} + h_s * (1 - S_{s+1}), 1.0)`, preserving monotonicity and avoiding cancellation near 0. - Added Monte Carlo validation test `test_block_verification_survival_matches_monte_carlo_acceptance` in `tests/components/test_vocabulary_completion_abi.py` verifying that reported `survivals` match empirical acceptance across 4,096 Philox seeds within tight statistical tolerance. Claimed benefit and result: Eliminates the systematic downward bias in Rao-Blackwellized realized survival reported to Helios under block verification, allowing adaptive verification calibration to match actual realized acceptance at deeper draft depths. Combined with the companion Helios scheduler PR (`NVIDIA/hyperflare-inference#644`) and SM121 b12x kernel PRs (`local-inference-lab/flashinfer#192`, `#193`), 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving reached 76.11 tok/s mean (80.89 tok/s peak on `greedy_code`) under default `balanced` policy. Supporting evidence and limitations: - `TRITON_INTERPRET=1 pytest tests/components/test_vocabulary_completion_abi.py -q`: all tests passed (verified exact Monte Carlo survival match). - Full 4x DGX Spark TP4 export (`gb10-tp4-202611301553`) and 5-prompt live serving verified on SM121. - Limitations: non-block (sequential) speculative verification paths were unchanged and already report exact sequential survival. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=6fcc
lukealonso
added a commit
to local-inference-lab/hyperflare-recipes
that referenced
this pull request
Nov 30, 2026
…ap, and deferred shared expert (#112) * perf(deepseek41): wire RoCE ring2 collectives, DSpark main_proj overlap, and deferred shared expert Why: During TP4 speculative decode on 4x DGX Spark (SM121), four recipe-level execution overheads left GPU time on the table: 1. `PreparedAllReduce` and `PreparedAllGather` in `components/collectives.py` did not expose b12x's fused-addend 2-step RoCE ring allreduce or device-gated RoCE allgather when available. 2. `PreparedPackedSpeculativeRound` still broadcast vocabulary-parallel distribution confidence from rank 0 even though every rank reduces the identical confidence vector locally from gathered softmax records. 3. `PreparedContext` in `components/dspark.py` could not overlap its output-sharded `mtp.0.main_proj` projection on the auxiliary stream when `compact` was off and RoCE collectives handled the gather. 4. `ConcurrentSharedExpert` in `recipes/deepseek41/decoder.py` set `defer_launch = (M > 4)`, causing `shared_up` to contend with `router_projection` at `M <= 4` instead of filling the `route_topk` + route-coalesce memory bubble before `FC1`. What changed: - `hyperflare_recipes/components/collectives.py`: Added capability-checked fused-addend support (`_roce_supports_addend`) for RoCE `PreparedAllReduce` and device-side `gate` forwarding for RoCE `PreparedAllGather` (preserving compatibility with current `uv.lock` FlashInfer until `flashinfer#192` merges). - `hyperflare_recipes/components/packed_speculation.py`: Skipped the redundant confidence broadcast when `confidence_head is None` (vocabulary-parallel distribution confidence is identical on every rank). - `hyperflare_recipes/components/dspark.py` & `parallel_draft.py`: Added `flare::start_dspark_main_proj` / `flare::join_dspark_main_proj` and `overlap_context_main` to overlap sharded `mtp.0.main_proj` on the auxiliary stream with target completion and synchronize before commit. - `hyperflare_recipes/recipes/deepseek41/decoder.py`: Enabled `defer_launch=True` for `ConcurrentSharedExpert` across all decode sizes. - Added/updated component unit tests in `test_collective_plan_choice.py`, `test_dspark_context_shard.py`, and `test_packed_speculation.py`. Claimed benefit and result: Reduces per-round collective, confidence-broadcast, draft-context, and shared-expert contention overhead in TP4 speculative decode. Combined with `local-inference-lab/flashinfer#192`, `local-inference-lab/flashinfer#193`, and `NVIDIA/hyperflare-inference#643`/`#644` on 4x DGX Spark TP4 DeepSeek-V4.1-Flash serving (`gb10-tp4-202611301553`), node-level nsys P=4 median round dropped 33.72 -> 32.52 ms (-1.20 ms), non-MoE time across 39 target layers dropped 17.01 -> 15.68 ms (-1.33 ms) with `sh_dn` completing before `FC1` starts, and matched-depth GPU round latency dropped 1.5-2.2 ms across P=1..6. Supporting evidence and limitations: - Component unit tests on tachyon (`TRITON_INTERPRET=1 pytest tests/components/test_collective_plan_choice.py tests/components/test_dspark_context_shard.py tests/components/test_packed_speculation.py -q`): all passed (48/48 including `test_vocabulary_completion_abi.py`). - Full 4x DGX Spark TP4 export (57 graphs) and 5-prompt live serving verified on SM121. - Limitations: `uv.lock` is not bumped in this PR and should be updated once `local-inference-lab/flashinfer#192` and `#193` merge; SM120 / non-SM121 GPUs were not benchmarked in this pass. Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=6fcc * fix(deepseek41,collectives): align RoCE addend capability check and medium-batch shared-expert overlap - In `_roce_supports_addend` (`hyperflare_recipes/components/collectives.py`), check `getattr(runtime, "supports_all_peer_auxiliary", False)` before the `_uses_ring2` fallback so runtimes implementing one-shot and two-shot fused addends keep fused reductions across switched RoCE, two-shot, and 16-byte payloads while preserving ring2-only gating when absent. - In `hyperflare_recipes/recipes/deepseek41/decoder.py`, set `ConcurrentSharedExpert(..., defer_launch=(rows <= 4) or (rows > 64))` so `M <= 4` avoids `router_projection` bandwidth contention and `M > 64` avoids SM starvation, while `5 <= M <= 64` keeps shared-expert projections overlapped with routed-expert execution. - Update `tests/recipes/test_deepseek41_expert_overlap.py` for the `(rows <= 4) or (rows > 64)` policy and add precedence coverage plus a capability skip guard in `tests/components/test_collective_plan_choice.py`. Verified: `pytest tests/recipes/test_deepseek41_expert_overlap.py tests/components/test_collective_plan_choice.py tests/components/test_dspark_context_shard.py tests/components/test_packed_speculation.py` (184 passed, 8 skipped live-ring2 cases on pre-ring2 FlashInfer). Design-Signed-Off-By: Antigravity (Gemini 3.1 Pro); design-review=6fcc
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
On 4-rank switchless dual-port RoCE rings (DGX Spark / NVIDIA GB10, SM121, 48 SMs), small-message BF16 allreduce previously fell back to the 4-rank oneshot protocol that relays across opposite ranks over host hops, and the split-lagged mHC
ReadOnlyFnPartialM8kernel launchedhidden / 32CTAs (160CTAs forhidden = 5120), causing multi-wave tail stalls on 48-SM GPUs while running concurrently with RoCE collectives. In addition, RoCEall_gatherdid not support an optional device-sidegatetensor to skip inactive steps,all_reducedid not fuse a residual addend in the ring kernel, and small-message RoCE WRs did not inline payloads up to 256 bytes or skip non-relayed ring origins during relay polling.What Changed
flashinfer/experimental/b12x/comm/roce/_ring2_cute.py,_cute_intrinsics.py,_preparation.py,_roce_proxy.c,roce_oneshot.py):RoceRing2AllReduceLaunchand proxy control opcodesKIND_RING2_STEP1(5) /KIND_RING2_STEP2(6) implementing a 2-step dual-rail neighbor-only ring allreduce on 4-rank switchless rings with batched completion signaling (RING2_SIGNAL_STRIDE = 16,RING2_MAX_OUTSTANDING = 6, statically checked againstROCE_SEND_DEPTH) and fused BF16addendsupport (should_allreduce_addend/_uses_ring2)._roce_proxy.c: raised QPmax_inline_datafrom16to256(with fallback to16andhca->max_inlinetracking) to enableIBV_SEND_INLINEon relay andpost_stripedpayloads<= max_inline, extractedring_next_fromand precomputedring_relays_origin[]soring_serviceskips non-relayed origins, reorderedpost_opto post relayed peers before direct peers on rings, and adjusted the ring idle loop to pollring_serviceevery spin when!ring2_active(every 16th spin whenring2_active) anddrain_cqsevery 16th spin._allgather_cute.pyandroce_oneshot.pyto accept an optional device-sidegatetensor for gated column allgather in speculative draft execution.flashinfer/experimental/b12x/norm/mhc/_split_lagged.py,tests/experimental/b12x/norm/test_mhc_split_lagged.py):readonly_fn_m8_grid_ctas(hidden, sm_count)cappingReadOnlyFnPartialM8to40CTAs on 48-SM SM121 GPUs (preservinghidden // 32on larger-SM GPUs) so the partial reduction completes in a single wave alongside concurrent RoCE collectives.test_readonly_fn_m8_capped_grid_matches_reference_and_replays_graphacrosshidden={4096, 5120, 7168}andtokens={1, 6, 8}.Claimed Benefit and Result
nsysP = 4traces,RoceRing2AllReduceLaunchaverages 31.8–33.0 µs/call across 88 calls/round (eliminating opposite-rank CPU relay hops on small BF16 allreduces), andReadOnlyFnPartialM8averages 12.8–13.9 µs/call across 86 calls/round while overlapping with RoCE execution.NVIDIA/hyperflare-inference#643(vendored host proxy) andlocal-inference-lab/hyperflare-recipes#112(collective plan selection).Supporting Evidence and Limitations
pytest tests/experimental/b12x/norm/test_mhc_split_lagged.py -q— 69 passed, 0 failed, 84 skipped (SM120-gated tests).DeepSeek-V4.1-Flash,gb10-tp4-202611301141andgb10-tp4-202611301553).ROCE_ABI_VERSIONremains14(existing ABI-14 cores remain compatible, while cores exported with ring2 graphs require a serving runtime containingNVIDIA/hyperflare-inference#643).Discord: lukealonso