Skip to content

[PG][3/N] Add OneShot AllReduce and decouple algorithms from protocols - #4372

Merged
UNIDY2002 merged 1 commit into
mainfrom
czh/pg-device-collectives-pr3
Nov 6, 2026
Merged

UNIDY2002 merged 1 commit into
mainfrom
czh/pg-device-collectives-pr3

Conversation

@caozhanhao

@caozhanhao caozhanhao commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part of #3483 (Phase 2), stacked on #3914.

This PR introduces a low-latency One-shot AllReduce path for small GPU messages and decouples collective algorithms from protocols.

Key changes

Decoupling of algorithm and protocol

The initial framework (#3484) tightly coupled the collective algorithm with the synchronization protocol, making future algorithm additions intrusive and difficult to maintain.

This PR separates them conceptually:

  • Algorithms: Ring, One-shot
  • Protocols: Simple, LL (Low Latency)

Note on current state: The decoupling in this PR is not yet 100% complete -- the current Simple implementation retains some assumptions from Ring, and LL is similarly tailored to One-shot. This is an intentional choice: I think refining abstraction boundaries when new algorithms introduce concrete requirements is better than prematurely generalizing protocols in this PR.

One-shot data path

The One-shot path is designed to minimize latency for small AllReduce messages by writing tagged packets directly into peer-accessible GPU buffers, followed by local reduction.

In the hot path, cross-rank handshakes for buffer readiness and slot consumption are eliminated by combining dedicated per-communicator packet storage, a two-slot alternating buffer, and sequence tags. Minimal synchronization remains: receivers poll on packet tags, StrongStream preserves invocation order, and the multi-CTA path retains its startup and completion bookkeeping. LL reset barriers are deferred to cold path -- triggered only when the group view changed or when a tag reuse happened.

Resource ownership

The process-wide PG context owns the shared payload workspace. Per-communicator LL packet and signal allocations belong to an algorithm or protocol and scale with max_group_size.

To limit memory use, allocations are scoped as follows:

  1. Ring Simple Payload Buffer: Shared by communicators within one PG context.
  2. One-shot LL Packet Buffer: Owned by OneShotAllReduceAlgorithm per communicator, with capacity proportional to max_group_size.
  3. Simple / LL Signals: Owned separately by each protocol per communicator, with capacity proportional to max_group_size.

Example logical resource usage

Consider a single process using one PG context with two communicators of max_group_size = 4 and two of max_group_size = 8, all with LL and One-shot resources allocated.

Resource Calculation Amount Why it has this scope
Shared Ring Payload Buffer $1 \times 32\text{ MiB}$ 32 MiB Latency-insensitive; ordered execution allows communicators to multiplex the same staging area.
Simple Signals $32\text{ ch} \times (1 + 2 + 2)\text{ signals} \times 8\text{ B} \times 24$ 30 KiB Independent sequence tracking per communicator; isolated from group view update resets.
LL Signals $32\text{ ch} \times 4\text{ phases} \times 8\text{ B} \times 24$ 24 KiB Different signal layout from Simple; independent phase coordination per communicator.
One-shot LL Packet Buffers $16\text{ ch} \times 2\text{ slots} \times 4\text{ KiB payload} \times 2\ (\text{packet/payload ratio}) \times 24$ 6 MiB Private per communicator to isolate packets from other communicators' writes and resets.

These are logical slice sizes within DTS's peer-accessible region. Each PG context eagerly allocates 96 MiB: 32 MiB for the shared payload buffer and 64 MiB reserved for communicator resources, including the signals and One-shot packets above. A separate 32 MiB local staging region is allocated on demand.

Supported scope and limitations

Area This PR's behavior
Rollout Opt-in via MOONCAKE_PG_PREFERRED_GPU_COLLECTIVE_BACKEND=new; legacy remains the default.
Operations GPU AllReduce only. Other collectives continue using the existing path.
Algorithm Dispatch By default, One-shot is selected for supported combinations up to $512\text{ KiB}$ when every active rank has native atomic peer access to every other rank; Ring is used otherwise.
Algorithm Override MOONCAKE_PG_COLLECTIVE_ALGORITHM accepts auto (default), ring, or oneshot. The Coordinator reads it at startup and publishes one policy for all ranks in each group. ring selects Ring; oneshot removes the size threshold while retaining hardware eligibility checks, with Ring as the fallback.
Protocols LL writes tagged packets directly to peer-accessible GPU buffers; the Coordinator enables it only for groups with all-to-all native atomic peer access.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake Conductor (mooncake-conductor)
  • Reshard (mooncake-reshard)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

  • All tests under mooncake-pg/tests passed.
  • Manual e2e tests of scale-up and recovery are also passed.

Benchmark

As in PR #3484, this benchmark uses a minimal nccl-tests shim for Mooncake PG that forwards the required NCCL AllReduce API to the Mooncake PG C API. This avoids Python/PyTorch dispatch overhead and allows PG and NCCL to run under the same nccl-tests harness.

The sweep compares five execution modes on a single node of 8 × NVIDIA H20:

  • PG Legacy: the existing host-worker-based GPU collective implementation.
  • PG Ring Simple: the device collective runtime with Ring AllReduce and the Simple protocol, selected through MOONCAKE_PG_COLLECTIVE_ALGORITHM=ring.
  • PG OneShot LL: the device collective runtime with OneShot AllReduce and the LL protocol introduced by this PR, selected through MOONCAKE_PG_COLLECTIVE_ALGORITHM=oneshot.
  • NCCL default: automatic algorithm and protocol selection, without buffer registration (-R 0).
  • NCCL symmetric (auto): symmetric buffer registration (-R 2), with NCCL selecting the symmetric kernel automatically.

All five modes use float32 SUM, 50 warmup iterations, 500 measured iterations, and CUDA Graphs (-G 10). The plot shows in-place latency, taking the median of three benchmark cycles (-N 3); lower is better.

OneShot LL substantially reduces small-message latency compared with PG Ring Simple and PG Legacy, approaching NCCL symmetric at the smallest sizes.

pr3_ll_bench
Raw Results
===== Mooncake PG legacy =====
#                                                              out-of-place                       in-place
#       size         count      type   redop    root     time   algbw   busbw  #wrong     time   algbw   busbw  #wrong
#        (B)    (elements)                               (us)  (GB/s)  (GB/s)             (us)  (GB/s)  (GB/s)
          64            16     float     sum      -1    96.36    0.00    0.00       0    91.97    0.00    0.00       0
         128            32     float     sum      -1    88.54    0.00    0.00       0    90.28    0.00    0.00       0
         256            64     float     sum      -1    89.34    0.00    0.01       0    93.29    0.00    0.00       0
         512           128     float     sum      -1    87.32    0.01    0.01       0    90.16    0.01    0.01       0
        1024           256     float     sum      -1    89.74    0.01    0.02       0    89.90    0.01    0.02       0
        2048           512     float     sum      -1    95.31    0.02    0.04       0    91.65    0.02    0.04       0
        4096          1024     float     sum      -1    94.12    0.04    0.08       0    92.55    0.04    0.08       0
        8192          2048     float     sum      -1    86.74    0.09    0.17       0    86.42    0.09    0.17       0
       16384          4096     float     sum      -1    88.14    0.19    0.33       0    93.95    0.17    0.31       0
       32768          8192     float     sum      -1    93.20    0.35    0.62       0    92.59    0.35    0.62       0
       65536         16384     float     sum      -1   107.50    0.61    1.07       0   108.59    0.60    1.06       0
      131072         32768     float     sum      -1   137.09    0.96    1.67       0   135.84    0.96    1.69       0
      262144         65536     float     sum      -1   197.85    1.32    2.32       0   196.56    1.33    2.33       0
      524288        131072     float     sum      -1   317.47    1.65    2.89       0   317.23    1.65    2.89       0
          64            16     float     sum      -1    89.08    0.00    0.00       0    93.93    0.00    0.00       0
         128            32     float     sum      -1    88.90    0.00    0.00       0    93.29    0.00    0.00       0
         256            64     float     sum      -1    87.52    0.00    0.01       0    90.40    0.00    0.00       0
         512           128     float     sum      -1    89.63    0.01    0.01       0    88.17    0.01    0.01       0
        1024           256     float     sum      -1    94.24    0.01    0.02       0    91.63    0.01    0.02       0
        2048           512     float     sum      -1    94.37    0.02    0.04       0    89.12    0.02    0.04       0
        4096          1024     float     sum      -1    93.07    0.04    0.08       0    92.98    0.04    0.08       0
        8192          2048     float     sum      -1    86.38    0.09    0.17       0    85.60    0.10    0.17       0
       16384          4096     float     sum      -1    96.01    0.17    0.30       0    87.86    0.19    0.33       0
       32768          8192     float     sum      -1    91.51    0.36    0.63       0    91.95    0.36    0.62       0
       65536         16384     float     sum      -1   108.13    0.61    1.06       0   111.67    0.59    1.03       0
      131072         32768     float     sum      -1   135.54    0.97    1.69       0   137.16    0.96    1.67       0
      262144         65536     float     sum      -1   196.88    1.33    2.33       0   197.47    1.33    2.32       0
      524288        131072     float     sum      -1   315.78    1.66    2.91       0   317.69    1.65    2.89       0
          64            16     float     sum      -1    88.41    0.00    0.00       0    93.69    0.00    0.00       0
         128            32     float     sum      -1    86.73    0.00    0.00       0    93.34    0.00    0.00       0
         256            64     float     sum      -1    92.54    0.00    0.00       0    90.64    0.00    0.00       0
         512           128     float     sum      -1    94.73    0.01    0.01       0    94.05    0.01    0.01       0
        1024           256     float     sum      -1    93.73    0.01    0.02       0    92.34    0.01    0.02       0
        2048           512     float     sum      -1    91.68    0.02    0.04       0    92.28    0.02    0.04       0
        4096          1024     float     sum      -1    96.23    0.04    0.07       0    91.70    0.04    0.08       0
        8192          2048     float     sum      -1    90.07    0.09    0.16       0    90.68    0.09    0.16       0
       16384          4096     float     sum      -1    96.51    0.17    0.30       0   106.67    0.15    0.27       0
       32768          8192     float     sum      -1   115.38    0.28    0.50       0   115.52    0.28    0.50       0
       65536         16384     float     sum      -1   126.54    0.52    0.91       0   124.41    0.53    0.92       0
      131072         32768     float     sum      -1   147.24    0.89    1.56       0   148.51    0.88    1.54       0
      262144         65536     float     sum      -1   207.24    1.26    2.21       0   208.95    1.25    2.20       0
      524288        131072     float     sum      -1   332.34    1.58    2.76       0   328.41    1.60    2.79       0
# Out of bounds values : 0 OK
# Avg bus bandwidth    : 0.641856

===== Mooncake PG Ring + Simple =====
#                                                              out-of-place                       in-place
#       size         count      type   redop    root     time   algbw   busbw  #wrong     time   algbw   busbw  #wrong
#        (B)    (elements)                               (us)  (GB/s)  (GB/s)             (us)  (GB/s)  (GB/s)
          64            16     float     sum      -1   100.28    0.00    0.00       0   100.28    0.00    0.00       0
         128            32     float     sum      -1   100.46    0.00    0.00       0   100.46    0.00    0.00       0
         256            64     float     sum      -1   100.43    0.00    0.00       0   100.44    0.00    0.00       0
         512           128     float     sum      -1   100.45    0.01    0.01       0   100.40    0.01    0.01       0
        1024           256     float     sum      -1   100.35    0.01    0.02       0   100.36    0.01    0.02       0
        2048           512     float     sum      -1   100.47    0.02    0.04       0   100.45    0.02    0.04       0
        4096          1024     float     sum      -1   100.35    0.04    0.07       0   100.41    0.04    0.07       0
        8192          2048     float     sum      -1   100.66    0.08    0.14       0   100.71    0.08    0.14       0
       16384          4096     float     sum      -1   101.13    0.16    0.28       0   101.05    0.16    0.28       0
       32768          8192     float     sum      -1   101.84    0.32    0.56       0   101.75    0.32    0.56       0
       65536         16384     float     sum      -1   103.86    0.63    1.10       0   103.92    0.63    1.10       0
      131072         32768     float     sum      -1   114.58    1.14    2.00       0   114.42    1.15    2.00       0
      262144         65536     float     sum      -1   117.56    2.23    3.90       0   117.59    2.23    3.90       0
      524288        131072     float     sum      -1   121.24    4.32    7.57       0   121.32    4.32    7.56       0
          64            16     float     sum      -1   100.28    0.00    0.00       0   100.43    0.00    0.00       0
         128            32     float     sum      -1   100.45    0.00    0.00       0   100.39    0.00    0.00       0
         256            64     float     sum      -1   100.45    0.00    0.00       0   100.44    0.00    0.00       0
         512           128     float     sum      -1   100.43    0.01    0.01       0   100.44    0.01    0.01       0
        1024           256     float     sum      -1   100.46    0.01    0.02       0   100.46    0.01    0.02       0
        2048           512     float     sum      -1   100.42    0.02    0.04       0   100.27    0.02    0.04       0
        4096          1024     float     sum      -1   100.41    0.04    0.07       0   100.45    0.04    0.07       0
        8192          2048     float     sum      -1   100.65    0.08    0.14       0   100.67    0.08    0.14       0
       16384          4096     float     sum      -1   101.12    0.16    0.28       0   101.14    0.16    0.28       0
       32768          8192     float     sum      -1   101.83    0.32    0.56       0   101.84    0.32    0.56       0
       65536         16384     float     sum      -1   104.01    0.63    1.10       0   103.87    0.63    1.10       0
      131072         32768     float     sum      -1   114.39    1.15    2.01       0   114.45    1.15    2.00       0
      262144         65536     float     sum      -1   117.59    2.23    3.90       0   117.61    2.23    3.90       0
      524288        131072     float     sum      -1   121.34    4.32    7.56       0   121.42    4.32    7.56       0
          64            16     float     sum      -1   100.42    0.00    0.00       0   100.43    0.00    0.00       0
         128            32     float     sum      -1   100.39    0.00    0.00       0   100.44    0.00    0.00       0
         256            64     float     sum      -1   100.44    0.00    0.00       0   100.44    0.00    0.00       0
         512           128     float     sum      -1   100.44    0.01    0.01       0   100.44    0.01    0.01       0
        1024           256     float     sum      -1   100.40    0.01    0.02       0   100.40    0.01    0.02       0
        2048           512     float     sum      -1   100.47    0.02    0.04       0   100.48    0.02    0.04       0
        4096          1024     float     sum      -1   100.54    0.04    0.07       0   100.55    0.04    0.07       0
        8192          2048     float     sum      -1   100.65    0.08    0.14       0   100.69    0.08    0.14       0
       16384          4096     float     sum      -1   101.07    0.16    0.28       0   101.09    0.16    0.28       0
       32768          8192     float     sum      -1   101.84    0.32    0.56       0   101.85    0.32    0.56       0
       65536         16384     float     sum      -1   104.02    0.63    1.10       0   104.01    0.63    1.10       0
      131072         32768     float     sum      -1   114.59    1.14    2.00       0   114.50    1.14    2.00       0
      262144         65536     float     sum      -1   117.62    2.23    3.90       0   117.68    2.23    3.90       0
      524288        131072     float     sum      -1   121.26    4.32    7.57       0   121.39    4.32    7.56       0
# Out of bounds values : 0 OK
# Avg bus bandwidth    : 1.12146

===== Mooncake PG OneShot + LL =====
#                                                              out-of-place                       in-place
#       size         count      type   redop    root     time   algbw   busbw  #wrong     time   algbw   busbw  #wrong
#        (B)    (elements)                               (us)  (GB/s)  (GB/s)             (us)  (GB/s)  (GB/s)
          64            16     float     sum      -1     5.94    0.01    0.02       0     5.90    0.01    0.02       0
         128            32     float     sum      -1     6.24    0.02    0.04       0     6.23    0.02    0.04       0
         256            64     float     sum      -1     6.46    0.04    0.07       0     6.40    0.04    0.07       0
         512           128     float     sum      -1     7.31    0.07    0.12       0     7.30    0.07    0.12       0
        1024           256     float     sum      -1     8.38    0.12    0.21       0     8.38    0.12    0.21       0
        2048           512     float     sum      -1    10.07    0.20    0.36       0    10.08    0.20    0.36       0
        4096          1024     float     sum      -1     8.83    0.46    0.81       0     8.88    0.46    0.81       0
        8192          2048     float     sum      -1     9.75    0.84    1.47       0     9.74    0.84    1.47       0
       16384          4096     float     sum      -1    10.82    1.51    2.65       0    10.81    1.52    2.65       0
       32768          8192     float     sum      -1    12.39    2.64    4.63       0    12.39    2.64    4.63       0
       65536         16384     float     sum      -1    17.07    3.84    6.72       0    17.08    3.84    6.72       0
      131072         32768     float     sum      -1    27.17    4.82    8.44       0    27.18    4.82    8.44       0
      262144         65536     float     sum      -1    47.33    5.54    9.69       0    47.35    5.54    9.69       0
      524288        131072     float     sum      -1    87.51    5.99   10.48       0    87.96    5.96   10.43       0
          64            16     float     sum      -1     6.07    0.01    0.02       0     6.08    0.01    0.02       0
         128            32     float     sum      -1     6.25    0.02    0.04       0     6.21    0.02    0.04       0
         256            64     float     sum      -1     6.44    0.04    0.07       0     6.42    0.04    0.07       0
         512           128     float     sum      -1     7.27    0.07    0.12       0     7.30    0.07    0.12       0
        1024           256     float     sum      -1     8.47    0.12    0.21       0     8.48    0.12    0.21       0
        2048           512     float     sum      -1    10.09    0.20    0.36       0    10.08    0.20    0.36       0
        4096          1024     float     sum      -1     8.89    0.46    0.81       0     8.89    0.46    0.81       0
        8192          2048     float     sum      -1     9.75    0.84    1.47       0     9.73    0.84    1.47       0
       16384          4096     float     sum      -1    10.81    1.52    2.65       0    10.81    1.52    2.65       0
       32768          8192     float     sum      -1    12.42    2.64    4.62       0    12.42    2.64    4.62       0
       65536         16384     float     sum      -1    17.09    3.84    6.71       0    17.07    3.84    6.72       0
      131072         32768     float     sum      -1    27.17    4.82    8.44       0    27.18    4.82    8.44       0
      262144         65536     float     sum      -1    47.31    5.54    9.70       0    47.33    5.54    9.69       0
      524288        131072     float     sum      -1    87.56    5.99   10.48       0    88.11    5.95   10.41       0
          64            16     float     sum      -1     6.07    0.01    0.02       0     6.07    0.01    0.02       0
         128            32     float     sum      -1     6.25    0.02    0.04       0     6.22    0.02    0.04       0
         256            64     float     sum      -1     6.46    0.04    0.07       0     6.47    0.04    0.07       0
         512           128     float     sum      -1     7.29    0.07    0.12       0     7.29    0.07    0.12       0
        1024           256     float     sum      -1     8.43    0.12    0.21       0     8.47    0.12    0.21       0
        2048           512     float     sum      -1    10.01    0.20    0.36       0     9.96    0.21    0.36       0
        4096          1024     float     sum      -1     8.86    0.46    0.81       0     8.84    0.46    0.81       0
        8192          2048     float     sum      -1     9.63    0.85    1.49       0     9.64    0.85    1.49       0
       16384          4096     float     sum      -1    10.74    1.53    2.67       0    10.79    1.52    2.66       0
       32768          8192     float     sum      -1    12.40    2.64    4.62       0    12.41    2.64    4.62       0
       65536         16384     float     sum      -1    16.99    3.86    6.75       0    16.99    3.86    6.75       0
      131072         32768     float     sum      -1    27.18    4.82    8.44       0    27.16    4.83    8.44       0
      262144         65536     float     sum      -1    47.32    5.54    9.69       0    47.33    5.54    9.69       0
      524288        131072     float     sum      -1    87.50    5.99   10.49       0    88.21    5.94   10.40       0
# Out of bounds values : 0 OK
# Avg bus bandwidth    : 3.2635

===== NCCL default =====
#                                                              out-of-place                       in-place
#       size         count      type   redop    root     time   algbw   busbw  #wrong     time   algbw   busbw  #wrong
#        (B)    (elements)                               (us)  (GB/s)  (GB/s)             (us)  (GB/s)  (GB/s)
          64            16     float     sum      -1    13.51    0.00    0.01       0    13.51    0.00    0.01       0
         128            32     float     sum      -1    14.13    0.01    0.02       0    14.19    0.01    0.02       0
         256            64     float     sum      -1    14.24    0.02    0.03       0    14.29    0.02    0.03       0
         512           128     float     sum      -1    14.44    0.04    0.06       0    14.48    0.04    0.06       0
        1024           256     float     sum      -1    14.66    0.07    0.12       0    14.62    0.07    0.12       0
        2048           512     float     sum      -1    14.82    0.14    0.24       0    14.77    0.14    0.24       0
        4096          1024     float     sum      -1    14.98    0.27    0.48       0    14.93    0.27    0.48       0
        8192          2048     float     sum      -1    15.18    0.54    0.94       0    15.19    0.54    0.94       0
       16384          4096     float     sum      -1    15.79    1.04    1.82       0    15.76    1.04    1.82       0
       32768          8192     float     sum      -1    17.17    1.91    3.34       0    17.16    1.91    3.34       0
       65536         16384     float     sum      -1    17.41    3.77    6.59       0    17.37    3.77    6.60       0
      131072         32768     float     sum      -1    17.60    7.45   13.03       0    17.62    7.44   13.02       0
      262144         65536     float     sum      -1    17.80   14.72   25.77       0    17.78   14.74   25.80       0
      524288        131072     float     sum      -1    18.10   28.96   50.68       0    18.07   29.01   50.77       0
          64            16     float     sum      -1    13.49    0.00    0.01       0    13.47    0.00    0.01       0
         128            32     float     sum      -1    14.16    0.01    0.02       0    14.19    0.01    0.02       0
         256            64     float     sum      -1    14.29    0.02    0.03       0    14.28    0.02    0.03       0
         512           128     float     sum      -1    14.46    0.04    0.06       0    14.43    0.04    0.06       0
        1024           256     float     sum      -1    14.62    0.07    0.12       0    14.61    0.07    0.12       0
        2048           512     float     sum      -1    14.79    0.14    0.24       0    14.80    0.14    0.24       0
        4096          1024     float     sum      -1    14.99    0.27    0.48       0    14.96    0.27    0.48       0
        8192          2048     float     sum      -1    15.20    0.54    0.94       0    15.17    0.54    0.95       0
       16384          4096     float     sum      -1    15.75    1.04    1.82       0    15.72    1.04    1.82       0
       32768          8192     float     sum      -1    17.17    1.91    3.34       0    17.19    1.91    3.34       0
       65536         16384     float     sum      -1    17.44    3.76    6.58       0    17.42    3.76    6.58       0
      131072         32768     float     sum      -1    17.60    7.45   13.03       0    17.58    7.45   13.04       0
      262144         65536     float     sum      -1    17.78   14.75   25.81       0    17.74   14.78   25.86       0
      524288        131072     float     sum      -1    18.11   28.94   50.65       0    18.12   28.93   50.63       0
          64            16     float     sum      -1    13.54    0.00    0.01       0    13.48    0.00    0.01       0
         128            32     float     sum      -1    14.19    0.01    0.02       0    14.16    0.01    0.02       0
         256            64     float     sum      -1    14.27    0.02    0.03       0    14.25    0.02    0.03       0
         512           128     float     sum      -1    14.44    0.04    0.06       0    14.46    0.04    0.06       0
        1024           256     float     sum      -1    14.66    0.07    0.12       0    14.63    0.07    0.12       0
        2048           512     float     sum      -1    14.81    0.14    0.24       0    14.78    0.14    0.24       0
        4096          1024     float     sum      -1    14.97    0.27    0.48       0    14.95    0.27    0.48       0
        8192          2048     float     sum      -1    15.22    0.54    0.94       0    15.19    0.54    0.94       0
       16384          4096     float     sum      -1    15.79    1.04    1.82       0    15.76    1.04    1.82       0
       32768          8192     float     sum      -1    17.18    1.91    3.34       0    17.16    1.91    3.34       0
       65536         16384     float     sum      -1    17.41    3.77    6.59       0    17.37    3.77    6.60       0
      131072         32768     float     sum      -1    17.61    7.44   13.03       0    17.63    7.44   13.01       0
      262144         65536     float     sum      -1    17.80   14.72   25.77       0    17.78   14.74   25.80       0
      524288        131072     float     sum      -1    18.11   28.95   50.67       0    18.07   29.01   50.77       0
# Out of bounds values : 0 OK
# Avg bus bandwidth    : 7.36981

===== NCCL symmetric (auto) =====
#                                                              out-of-place                       in-place
#       size         count      type   redop    root     time   algbw   busbw  #wrong     time   algbw   busbw  #wrong
#        (B)    (elements)                               (us)  (GB/s)  (GB/s)             (us)  (GB/s)  (GB/s)
          64            16     float     sum      -1     6.03    0.01    0.02       0     6.02    0.01    0.02       0
         128            32     float     sum      -1     5.73    0.02    0.04       0     5.74    0.02    0.04       0
         256            64     float     sum      -1     5.98    0.04    0.07       0     5.85    0.04    0.08       0
         512           128     float     sum      -1     6.13    0.08    0.15       0     6.05    0.08    0.15       0
        1024           256     float     sum      -1     5.81    0.18    0.31       0     5.95    0.17    0.30       0
        2048           512     float     sum      -1     5.98    0.34    0.60       0     6.05    0.34    0.59       0
        4096          1024     float     sum      -1     6.16    0.66    1.16       0     6.17    0.66    1.16       0
        8192          2048     float     sum      -1     6.39    1.28    2.24       0     6.39    1.28    2.24       0
       16384          4096     float     sum      -1     6.43    2.55    4.46       0     6.46    2.53    4.44       0
       32768          8192     float     sum      -1     7.00    4.68    8.19       0     7.00    4.68    8.19       0
       65536         16384     float     sum      -1     7.11    9.21   16.12       0     7.11    9.21   16.12       0
      131072         32768     float     sum      -1     7.99   16.41   28.72       0     7.34   17.85   31.25       0
      262144         65536     float     sum      -1     8.00   32.75   57.31       0     8.01   32.72   57.26       0
      524288        131072     float     sum      -1     9.24   56.77   99.34       0     9.24   56.72   99.26       0
          64            16     float     sum      -1     5.93    0.01    0.02       0     5.92    0.01    0.02       0
         128            32     float     sum      -1     5.80    0.02    0.04       0     5.84    0.02    0.04       0
         256            64     float     sum      -1     5.87    0.04    0.08       0     5.93    0.04    0.08       0
         512           128     float     sum      -1     6.05    0.08    0.15       0     6.12    0.08    0.15       0
        1024           256     float     sum      -1     5.96    0.17    0.30       0     5.96    0.17    0.30       0
        2048           512     float     sum      -1     6.05    0.34    0.59       0     6.04    0.34    0.59       0
        4096          1024     float     sum      -1     6.09    0.67    1.18       0     6.14    0.67    1.17       0
        8192          2048     float     sum      -1     6.28    1.30    2.28       0     6.44    1.27    2.23       0
       16384          4096     float     sum      -1     6.48    2.53    4.42       0     6.47    2.53    4.43       0
       32768          8192     float     sum      -1     7.01    4.67    8.18       0     7.01    4.67    8.18       0
       65536         16384     float     sum      -1     7.11    9.22   16.14       0     7.11    9.21   16.12       0
      131072         32768     float     sum      -1     7.38   17.75   31.06       0     7.33   17.89   31.31       0
      262144         65536     float     sum      -1     8.00   32.77   57.34       0     8.03   32.63   57.10       0
      524288        131072     float     sum      -1     9.25   56.70   99.23       0     9.24   56.75   99.32       0
          64            16     float     sum      -1     6.03    0.01    0.02       0     6.03    0.01    0.02       0
         128            32     float     sum      -1     5.89    0.02    0.04       0     5.76    0.02    0.04       0
         256            64     float     sum      -1     6.00    0.04    0.07       0     5.95    0.04    0.08       0
         512           128     float     sum      -1     6.15    0.08    0.15       0     6.14    0.08    0.15       0
        1024           256     float     sum      -1     5.84    0.18    0.31       0     5.93    0.17    0.30       0
        2048           512     float     sum      -1     5.99    0.34    0.60       0     6.03    0.34    0.59       0
        4096          1024     float     sum      -1     6.16    0.67    1.16       0     6.16    0.66    1.16       0
        8192          2048     float     sum      -1     6.39    1.28    2.24       0     6.38    1.28    2.25       0
       16384          4096     float     sum      -1     6.43    2.55    4.46       0     6.46    2.53    4.44       0
       32768          8192     float     sum      -1     7.00    4.68    8.19       0     7.01    4.68    8.18       0
       65536         16384     float     sum      -1     7.12    9.21   16.12       0     7.10    9.23   16.15       0
      131072         32768     float     sum      -1     7.34   17.86   31.26       0     7.34   17.86   31.25       0
      262144         65536     float     sum      -1     8.01   32.74   57.29       0     8.02   32.70   57.23       0
      524288        131072     float     sum      -1     9.23   56.80   99.40       0     9.24   56.74   99.30       0
# Out of bounds values : 0 OK
# Avg bus bandwidth    : 15.7658

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit on the files changed in this PR and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

Codex was used to assist in designing and implementing this PR. All code and architectural changes have been thoroughly reviewed and verified by me in person.

@caozhanhao
caozhanhao added this pull request to stack #3915 September 28, 2026 16:08
@caozhanhao
caozhanhao force-pushed the czh/pg-device-collectives-pr3 branch 2 times, most recently from bff86ca to 8b078cb Compare September 29, 2026 02:49
@caozhanhao
caozhanhao marked this pull request as ready for review September 29, 2026 03:44
@alogfans
alogfans force-pushed the czh/pg-device-collectives-pr3 branch from 8b078cb to 8650fd6 Compare September 30, 2026 05:54
@caozhanhao
caozhanhao force-pushed the czh/pg-device-collectives-pr3 branch from 8650fd6 to 2bdcef3 Compare October 11, 2026 07:59
Base automatically changed from czh/pg-device-collectives-pr2 to main October 12, 2026 03:50
@caozhanhao
caozhanhao force-pushed the czh/pg-device-collectives-pr3 branch from 2bdcef3 to 3d0fa1f Compare October 12, 2026 03:50
@yuechen-sys

Copy link
Copy Markdown
Member

@niwehao Could you take a look?

@niwehao

niwehao commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Hi! Thanks for the PR! The PR looks great. Just one question: OneShot selection checks native atomic capability, but does it also account for P2P mapping failures? If a peer falls back to HostProxy, remotePtr() returns nullptr, which OneShot appears to use without a check. Should OneShot selection also require successful P2P mappings and otherwise fall back to Ring?

Relevant code:

@caozhanhao

Copy link
Copy Markdown
Collaborator Author

Hi! Thanks for the PR! The PR looks great. Just one question: OneShot selection checks native atomic capability, but does it also account for P2P mapping failures? If a peer falls back to HostProxy, remotePtr() returns nullptr, which OneShot appears to use without a check. Should OneShot selection also require successful P2P mappings and otherwise fall back to Ring?

Relevant code:

Thanks for pointing this out. The eligibility check in this PR uses hardware native-atomic capability and does not account for P2P mapping failures.

This is addressed in #4791 (5/N), building on the coordinated endpoint installation introduced in #4575 (4/N). Under that change, ranks report their actual installed route capabilities. Automatic selection enables OneShot only when every directed pair of active ranks has a directly addressable route with native atomics; otherwise, Ring is selected.

Given that backporting this logic into this PR is non-trivial and downstream PRs (#4747, #5099) already build on this base, would it make sense to leave route-aware selection to 5/N? Happy to hear your thoughts!

@niwehao

niwehao commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Hi! Thanks for the PR! The PR looks great. Just one question: OneShot selection checks native atomic capability, but does it also account for P2P mapping failures? If a peer falls back to HostProxy, remotePtr() returns nullptr, which OneShot appears to use without a check. Should OneShot selection also require successful P2P mappings and otherwise fall back to Ring?
Relevant code:

Thanks for pointing this out. The eligibility check in this PR uses hardware native-atomic capability and does not account for P2P mapping failures.

This is addressed in #4791 (5/N), building on the coordinated endpoint installation introduced in #4575 (4/N). Under that change, ranks report their actual installed route capabilities. Automatic selection enables OneShot only when every directed pair of active ranks has a directly addressable route with native atomics; otherwise, Ring is selected.

Given that backporting this logic into this PR is non-trivial and downstream PRs (#4747, #5099) already build on this base, would it make sense to leave route-aware selection to 5/N? Happy to hear your thoughts!

Good, leaving this to to 5/N is good idea! I have no more question about this PR. @yuechen-sys

@UNIDY2002
UNIDY2002 merged commit a453372 into main Nov 6, 2026
27 checks passed
@caozhanhao
caozhanhao deleted the czh/pg-device-collectives-pr3 branch November 10, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants