Skip to content

perf(b12x/comm/roce): add 1-hop closed-ring reduce-scatter and allgather - #195

Open
FujitsuPolycom wants to merge 1 commit into
local-inference-lab:mainfrom
FujitsuPolycom:feat/b12x-roce-ring-rs-ag
Open

FujitsuPolycom wants to merge 1 commit into
local-inference-lab:mainfrom
FujitsuPolycom:feat/b12x-roce-ring-rs-ag

Conversation

@FujitsuPolycom

@FujitsuPolycom FujitsuPolycom commented Nov 30, 2026 •

Copy link
Copy Markdown

📌 Description

1. Why

On switchless closed RoCE rings (ring=True, ring_open=False, world_size >= 3, such as 4× DGX Spark GB10 SM121 nodes over dual 200 GbE links), pipelined reduce_scatter (KIND_REDUCE_SCATTER = 3) and gather_shards (KIND_GATHER_SHARDS = 4) route non-neighbor shards through 2-hop CPU mailboxes. For 20–80 MiB prefill collectives, those relays saturate unified memory bandwidth and account for ~20% of chunk execution time.

2. What changed

Scoped strictly to flashinfer/experimental/b12x/comm/roce/ and tests/experimental/b12x/comm/ atop main (274eb290e270, which includes #189, #190, #192, and #194), with zero changes to ROCE_ABI_VERSION (14), roce_layout, roce_blob_t, RING_WINDOW (8), opcodes 0..6, or _capture_event:

  • _roce_proxy.c: Adds KIND_RING_RS = 7, KIND_RING_AG = 8, and KIND_RING_RSAG = 9 cleanly below KIND_RING2_STEP2 = 6u. Adds ring_dir_shard_bounds, ring_ag_arrived, and run_ring_bidir_op (including widest * 16 > half_cap & chunk-coverage validation) for strictly 1-hop CW (dir=0) / CCW (dir=1) striped RDMA writes with zero-copy all-gather forwarding, and extends credit_phases for same-family and cross-family pipe (1, 3, 4) <-> ring (7, 8, 9) transitions. Stays lockstep with NVIDIA/hyperflare-inference#649 (helios/native/roce_proxy.c).
  • _ring_scatter_gather_cute.py: Adds CuTe DSL kernels (7/8/9) splitting each rank's contiguous shard evenly into CW/CCW halves whenever nbytes % (2 * world_size * 16) == 0.
  • roce_oneshot.py & _preparation.py: Closed rings (world_size >= 3, pipe_bytes > 0, col_row_bytes == 0) auto-dispatch KIND_RING_RS at >= 4 MiB (falling back to KIND_REDUCE_SCATTER (3) below 4 MiB) and KIND_RING_AG at >= 256 KiB. Opt-in ring_rsag_allreduce: bool = False defaults off, is omitted from default compilation and RoceQuery.setup, and preserves addend semantics when enabled. Preserves 100% of #190 (fused addend in RoceOneshot/Twoshot, 4-rank 256 KiB pipe threshold, supports_gated_all_gather and switched-topology guards), #192 ring2, non-ring, open-ring, and world_size == 2 paths.
  • README.md & tests: Documents opcodes 7..9, ABI-14 invariance, and hop-by-hop dtype rounding; adds C-harness (test_roce_proxy.py: ABI 14, 5u/6u, 7..9, unknown 10u, shard_cap=256 overflow), CPU gating/addend (test_roce_preparation_compile.py), and non-CUDA + torchrun tests (test_roce_scatter_gather_gpu.py).

3. Claimed benefit

Isolated 4-Node Closed-Ring Gains (4× DGX Spark GB10 SM121, 2×200 GbE Closed Ring, BF16, N = 3 rounds × 20–30 iters)

Shape RS (3 -> 7) RS Speedup AG (4 -> 8) AG Speedup
256 KiB (128×1024) 0.054 ms (falls back to 3) — 0.051 -> 0.045 ms -11.8% (1.13×)
4 MiB 0.236 -> 0.198 ms -16.1% (1.19×) 0.269 -> 0.196 ms -27.1% (1.37×)
8 MiB 0.398 -> 0.348 ms -12.6% (1.14×) 0.447 -> 0.340 ms -23.9% (1.31×)
20.8 MiB 0.990 -> 0.746 ms -24.6% (1.33×) 1.031 -> 0.737 ms -28.5% (1.40×)
40 MiB 1.920 -> 1.297 ms -32.4% (1.48×) 1.961 -> 1.307 ms -33.4% (1.50×)
80 MiB 3.788 -> 2.605 ms -31.2% (1.45×) 3.819 -> 2.591 ms -32.2% (1.47×, 48.6 GB/s bidirectional)
  • Opt-in fused all_reduce (KIND_RING_RSAG = 9 vs 1, ring_rsag_allreduce=True): 4 MiB 0.415 -> 0.298 ms (-28.2%, 1.39×), 20 MiB 1.894 -> 1.263 ms (-33.3%, 1.50×), 40 MiB 3.805 -> 2.719 ms (-28.5%, 1.40×), 80 MiB 7.442 -> 5.400 ms (-27.4%, 1.38×).
  • Parity & stress (4 ranks): gather_shards 0-ULP bit-exact; reduce_scatter 0-ULP on integer inputs & vs KIND_RING_RSAG (max_abs = 0.01562 BF16 / 0.00000 FP32 random); 120-op eager + 160-op CUDA-graph mixed stress passed (0 deadlocks/timeouts, identical cross-rank SHA-1).

4. Supporting evidence and limitations

Verified on clean git archive d60e381ef38d649f4edb7274b9bd95989ae171b3 atop main (274eb290e270):

  • Lint, C compile & merge: uvx ruff==0.12.8 check + format --check PASS (6/6); 0 CRLF bytes; gcc -O2 -std=gnu11 -shared -fPIC -Wall -Wextra -Werror _roce_proxy.c -libverbs -lpthread PASS (0 warnings); git merge-tree --write-tree 274eb290e270 HEAD clean (32792c271e33, 0 conflicts).
  • CPU pytest (CUDA_VISIBLE_DEVICES=""):
    • test_roce_addend_gated.py: 6 passed, 0 failed (#190 fused addend, default_pipe_threshold(4) == 256 KiB, gated all-gather, ring2 forwarding)
    • test_roce_proxy.py: 21 passed, 0 failed (ABI 14, RING_WINDOW=8, 5u/6u, 7..9, unknown 10u, credit_phases, ring_dir_shard_bounds, shard_cap=256 half_cap rejection)
    • test_roce_scatter_gather_gpu.py: 1 passed, 9 skipped (WORLD_SIZE >= 2), 0 failed
    • test_roce_sequence_exhaustion.py: 4 passed · test_roce_routes.py: 43 passed · test_public_contracts.py: 10 passed
    • test_roce_preparation_compile.py: 4 passed, 2 skipped (CUDA), 1 failed — pre-existing test_declaration_rejects_nonserializable_dtypes failure reproduces identically on 274eb290e270 (1 failed, 2 passed, 1 skipped).
    • Combined tests/experimental/b12x/comm/test_roce*.py + tests/experimental/b12x/test_public_contracts.py (-k "not test_declaration_rejects_nonserializable_dtypes"): 89 passed, 123 skipped, 1 deselected, 0 failed.
  • Limitations:
    • ROCE_ABI_VERSION remains 14; closed-ring cores exported with opcodes 7/8/9 require a serving runtime containing NVIDIA/hyperflare-inference#649.
    • GPU tests (2 CUDA compile in test_roce_preparation_compile.py, 9 multi-node torchrun in test_roce_scatter_gather_gpu.py) skipped under CPU run; 4-node DGX Spark GB10 numbers above ran on an earlier prototype with identical C proxy & CuTe kernels, so a final 4-node GPU pass on d60e381ef38d paired with NVIDIA/hyperflare-inference#649 is required before marking Ready for Review.

5. Stack and cross-repo pairing

  1. NVIDIA/hyperflare-inference#649 (lands 1st): Backwards-compatible ABI-14 run_ring_bidir_op (7/8/9) in helios/native/roce_proxy.c.
  2. This PR (local-inference-lab/flashinfer#195, lands 2nd): Lockstep _roce_proxy.c + CuTe 7/8/9 kernels atop 274eb290e270 (#189, #190, #192, #194).
  3. local-inference-lab/hyperflare-recipes#114 (lands 3rd): Advances uv.lock and wires closed-ring RoCE reserve_sms=4 prefill overlap.

Discord: Dooner

🔍 Related Issues

  • Builds atop local-inference-lab/flashinfer#192 (2a07747b8e12, opcodes 5..6 for 2-step direct-neighbor ring all-reduce; ROCE_ABI_VERSION remains 14) and local-inference-lab/flashinfer#190 (274eb290e270, fused addend & 4-rank pipe threshold).
  • Paired with NVIDIA/hyperflare-inference#649 (lockstep proxy opcodes 7/8/9) and local-inference-lab/hyperflare-recipes#114 (closed-ring prefill overlap).

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • Verified uvx ruff==0.12.8 check and uvx ruff==0.12.8 format --check pass cleanly on all 6 touched Python files (0 errors, 0 CRLF bytes), and gcc -O2 -std=gnu11 -shared -fPIC -Wall -Wextra -Werror builds _roce_proxy.c cleanly (0 warnings).

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed (test_roce_proxy.py, test_roce_preparation_compile.py, test_roce_scatter_gather_gpu.py).
  • CPU unit and C-harness tests pass on git archive d60e381ef38d649f4edb7274b9bd95989ae171b3 (test_roce_addend_gated.py: 6 passed; test_roce_proxy.py: 21 passed; test_roce_scatter_gather_gpu.py: 1 passed, 9 skipped; test_roce_sequence_exhaustion.py: 4 passed; test_roce_routes.py: 43 passed; test_public_contracts.py: 10 passed; test_roce_preparation_compile.py: 4 passed, 2 skipped, 1 pre-existing base failure reproduced identically on 274eb290e270). Multi-node GPU torchrun verification on this rebased commit is pending paired NVIDIA/hyperflare-inference#649 hardware run.

🔬 Experimental Track

  • This PR is experimental: it adds or changes code under flashinfer/experimental/ and/or an @flashinfer_experimental_api. Tracking issue: (b12x RoCE experimental collective backend — scoped strictly to flashinfer/experimental/b12x/comm/roce/)
    • Zero files modified outside flashinfer/experimental/ and tests/experimental/.
    • Tests live in tests/experimental/b12x/comm/; CPU/C-harness tests verified on candidate SHA d60e381ef38d649f4edb7274b9bd95989ae171b3 and 4-node DGX Spark GB10 validation noted in Limitations.
    • Nothing is registered in flashinfer/aot.py, and no experimental backend is reachable from backend="auto" without FLASHINFER_ALLOW_EXPERIMENTAL_AUTO_BACKENDS=1.
    • Test scope declared below. The experimental CI lane runs exactly these targets, so keep them as narrow as the change allows.
tests/experimental/b12x/comm/test_roce_addend_gated.py
tests/experimental/b12x/comm/test_roce_proxy.py
tests/experimental/b12x/comm/test_roce_preparation_compile.py
tests/experimental/b12x/comm/test_roce_scatter_gather_gpu.py
tests/experimental/b12x/comm/test_roce_sequence_exhaustion.py
tests/experimental/b12x/comm/test_roce_routes.py

Reviewer Notes

  • ABI & opcode compatibility: ROCE_ABI_VERSION stays 14, RING_WINDOW stays 8, roce_layout/roce_blob_t/opcodes 0..6 (including #192's KIND_RING2_STEP1 = 5u and KIND_RING2_STEP2 = 6u) are unchanged, and KIND_RING_RS = 7, KIND_RING_AG = 8, KIND_RING_RSAG = 9 reuse the existing pipe_send/pipe_recv/pipe_flag capacity (4 * (W - 1) * half_cap < 2 * W * shard_cap and (W - 1) * chunks <= ROCE_MAX_CHUNKS), with widest * 16 > half_cap bounds validation in run_ring_bidir_op.
  • Cross-family credit ordering: credit_phases enforces start-of-op credits whenever switching between direct/two-shot pipe ops (1, 3, 4) and 1-hop ring ops (7, 8, 9) because they partition pipe_recv with different phase layouts, while KIND_RING2_STEP1/2 (5..6) use one-shot recv and require 0 pipe credits before KIND_RING_RS/AG.
  • Zero-drift defaults & #190 compatibility: Non-ring (switched mesh), open-ring, world_size == 2, pipe_bytes == 0, and col_row_bytes > 0 paths never enter KIND_RING_RS/AG/RSAG and emit identical RoceQuery.setup keys. #190 fused addend (oneshot/twoshot), 4-rank 256 KiB pipe threshold, and gated all-gather checks remain intact; KIND_RING_RSAG defaults off (ring_rsag_allreduce=False), is omitted from default compilation, and preserves addend semantics when enabled.

FujitsuPolycom added a commit to FujitsuPolycom/hyperflare-recipes that referenced this pull request Nov 30, 2026
On multi-host closed-ring RoCEv2 deployments (such as 4x NVIDIA DGX Spark
GB10 with 48 SMs), DeepSeek-V4.1 row-sharded prefill previously kept
reduce-scatter collectives on the main CUDA stream (`row_shard_roce`),
leaving 44 of 48 SMs idle during 4-CTA RoCE collectives (~20.5% of a
16K prefill chunk). Enabling half-chunk multi-stream overlap
(`row_shard_dma`) atop the RoCE gather-overlap plumbing from local-inference-lab#106 hides
closed-ring RoCE reduce-scatter and gather transfers behind local MoE
and dense GEMM compute while keeping every collective strictly
serialized on one auxiliary stream (`finish` before the next `start`) in
deterministic rank order, preserving RoCE epoch lockstep ordering.
Because persistent W4A8 routed-expert kernels occupy all SMs and cannot
be preempted by stream priority, reserving 4 SMs (`reserve_sms=4`,
leaving 44 MoE SMs + 4 RoCE SMs = 48 SMs on GB10) prevents tail-wave
serialization.

What changed:
- `hyperflare_recipes/components/collectives.py`:
  - Before: After local-inference-lab#106 added `flare::roce_reduce_scatter_dep`,
    `_gather_shards_exec`, and RoCE support in `ConcurrentGatherShards`,
    `ConcurrentReduceScatter` still rejected RoCE channels,
    `PreparedGatherShards` still raised `ValueError` on non-empty RoCE
    graph-ordering `dependencies`, and `PreparedChunkedGatherShards`
    chained multi-chunk dependencies only for PCIe DMA.
  - After: Added `flare::roce_gather_shards_dep` with its fake
    registration, accepted RoCE row-shard channels in
    `ConcurrentReduceScatter` (matching `ConcurrentGatherShards`'s
    `row_shard_surfaces` check, `ScratchArena.register_parallel`, and
    zero caller scratch validation), dispatched RoCE `dependencies` in
    `PreparedGatherShards`, and chained multi-chunk `deps=(output,)` for
    RoCE in `PreparedChunkedGatherShards`.
- `hyperflare_recipes/recipes/deepseek41/decoder.py`:
  - Before: `PreparedDecoder` enabled half-chunk `row_shard_dma` and
    `layer_pipelined` only for PCIe DMA runtimes, and `PreparedLayer`
    reserved `reserve_sms=2` unconditionally in `row_shard_dma`.
  - After: Added `_is_roce_overlap_runtime(runtime)` (requiring
    `_roce(runtime)`, `row_shard_surfaces(runtime)`, and
    `getattr(runtime, "ring_rs_ag", False)`), enabled `row_shard_dma`
    and encoder-layer `layer_pipelined` for qualifying closed-ring RoCE
    runtimes when encoder Engram layers carry `projection_full`, and set
    `reserve_sms=4 if _roce(runtime) else 2` on `PreparedRoutedExperts`
    in `row_shard_dma`. Decoder suffix layers, non-row-shard paths,
    local-inference-lab#106's `row_shard_roce` gather-overlap fallback, and local-inference-lab#112's
    ring2/DSpark/shared-expert scheduling remain unchanged.
- Tests (`test_row_shard_collectives.py`,
  `test_deepseek41_moe_sm_reservation.py`,
  `test_deepseek41_roce_prefill_overlap.py`):
  - Verified `roce_reduce_scatter_dep`, `roce_gather_shards_dep`, and
    multi-chunk chaining via `make_fx`, `ConcurrentReduceScatter` and
    `ConcurrentGatherShards` RoCE registration and validation,
    `_is_roce_overlap_runtime` gating (ABI 14), `reserve_sms=4` on RoCE
    vs `2` on PCIe DMA in `PreparedLayer` (updating the mock to local-inference-lab#113's
    public `b12x.moe.fused_moe` contract), and `PreparedDecoder`
    selection vs `row_shard_roce` fallback.
- Compatibility: `uv.lock` and `[tool.uv.sources]` are untouched.
  Against pinned FlashInfer (`cc532fdeac98`), `ring_rs_ag` is false, so
  `_is_roce_overlap_runtime` returns `False`, preserving existing
  `row_shard_roce` preparation and signed model cores until
  `NVIDIA/hyperflare-inference#649` and
  `local-inference-lab/flashinfer#195` land and `uv.lock` advances.

Result:
- Isolated 4-rank CUDA-graph overlap measurements on 4x DGX Spark GB10
  (SM121 TP4, 100 replays each, 0 deadlocks, 0-ULP RoCE parity):
  - `W4A8(M=4096, reserve_sms=4) || RING_RS(40 MiB)`: `14.90 -> 13.86 ms`
    (`-1.04 ms` net vs `reserve_sms=0` serial; `90.0%` overlap
    efficiency; `reserve_sms=0` regressed to `16.20 ms`).
  - `W4A8(M=8192, reserve_sms=4) || RING_RS(80 MiB)`: `25.04 -> 23.07 ms`
    (`-1.97 ms` net vs `reserve_sms=0` serial; `+0.01 ms` contention).
  - `DenseGemm(4096x5120x5120) || RING_RS(40 MiB)`: `3.97 -> 3.14 ms`
    (`-0.83 ms`, `57.6%` overlap efficiency).
- Combined-stack `flare run` serving observation (paired with
  `NVIDIA/hyperflare-inference#649` and
  `local-inference-lab/flashinfer#195`; not attributable to this change
  alone, and measured on non-matched prompt lengths relative to the
  earlier serial RoCE baseline): warm-Engram prefill observed
  `12,073.4 tok/s` (`15,999` tok / `1,325.2 ms`) at 16K and
  `12,891.0 tok/s` (`127,649` tok / `9,902.2 ms`) at 128K, with 15-cell
  sustained decode parity (`153.90 tok/s` geomean, `0` errors); a
  matched-ISL A/B on exact split commits is pending.

Evidence:
- Clean `git archive HEAD` CPU verification atop live `main`
  (`964b11a6b704`, including local-inference-lab#106, local-inference-lab#112, and local-inference-lab#113; `ignition`
  `d3d0e783555c`, `flashinfer-python` `cc532fdeac98`):
  - `git merge-tree --write-tree origin/main HEAD`: 0 conflicts;
    `git diff --check`: clean; 0 CRLF bytes across all 5 touched files.
  - `uvx ruff==0.12.8 check` on all 5 touched files: 0 errors;
    `uvx ruff==0.12.8 format --check` on
    `tests/recipes/test_deepseek41_roce_prefill_overlap.py`: clean.
  - CPU `pytest` (`CUDA_VISIBLE_DEVICES=""`) across 9 collective and
    DeepSeek-V4.1 prefill test files: 180 passed, 19 CUDA-only skipped,
    0 failed (`test_row_shard_collectives.py` 29 passed,
    `test_deepseek41_moe_sm_reservation.py` 7 passed,
    `test_deepseek41_roce_prefill_overlap.py` 5 passed), plus 3 `local-inference-lab#112`
    regression suites (`test_deepseek41_expert_overlap.py`,
    `test_dspark_context_shard.py`, `test_packed_speculation.py`): 165
    passed, 1 skipped, 0 failed.
- Limitations: Local verification ran on CPU without GPU execution. The
  4x DGX Spark GB10 microbenchmarks and signed `flare run` measurements
  were collected on equivalent combined-stack source; standalone
  matched-ISL GPU re-qualification after `flashinfer#195` lands and
  `uv.lock` advances, plus non-GB10 topologies (SM120/SM103, other TP
  widths), remain untested here.

Discord: Dooner

Design-Signed-Off-By: Antigravity (gemini-4-neon); design-review=6fcc
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
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,
rebased cleanly atop main (274eb29, including local-inference-lab#189, local-inference-lab#190, and local-inference-lab#194).

- 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. Stays lockstep with
    NVIDIA/hyperflare-inference#649 (helios/native/roce_proxy.c).
- 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 (with local-inference-lab#190 fused addend).
  - 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), is excluded from
    default compilation and RoceQuery.setup, and preserves addend
    semantics when explicitly enabled. Existing local-inference-lab#190 fused addends,
    4-rank 256 KiB pipe threshold, gated all-gather guards, local-inference-lab#192 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/addend/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
  (274eb29):
  - 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_addend_gated.py: 6 passed, 0 failed.
    - 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 274eb29).
    - test_roce_sequence_exhaustion.py: 4 passed, 0 failed.
    - test_roce_routes.py: 43 passed, 0 failed.
    - test_public_contracts.py: 10 passed, 0 failed.
    - Combined tests/experimental/b12x/comm/test_roce*.py and
      test_public_contracts.py (-k "not test_declaration_rejects_nonserializable_dtypes"):
      89 passed, 123 skipped, 1 deselected, 0 failed.
  - git merge-tree --write-tree 274eb29 HEAD: clean (0 conflicts).
- Limitations:
  - ROCE_ABI_VERSION remains 14; closed-ring cores exported with opcodes
    7/8/9 require a serving runtime containing NVIDIA/hyperflare-inference#649.
  - 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
    NVIDIA/hyperflare-inference#649 on this commit is required before
    marking ready for review.

Discord: Dooner
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
@FujitsuPolycom
FujitsuPolycom force-pushed the feat/b12x-roce-ring-rs-ag branch from 4148715 to d60e381 Compare November 30, 2026 21:37
@FujitsuPolycom
FujitsuPolycom marked this pull request as ready for review November 30, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant