Skip to content

cudax sharded: places communicator -- a places-backed model of the multi-GPU communicator concept + the engine-bindings adapter - #10973

Open
caugonnet wants to merge 2 commits into
NVIDIA:pull-request/10957from
caugonnet:upstream/communicator
Open

cudax sharded: places communicator -- a places-backed model of the multi-GPU communicator concept + the engine-bindings adapter#10973
caugonnet wants to merge 2 commits into
NVIDIA:pull-request/10957from
caugonnet:upstream/communicator

Conversation

@caugonnet

Copy link
Copy Markdown
Contributor

Description

Motivation

The MGMN algorithms (__multi_gpu) program the ranks rung against a
duck-typed communicator concept, with NCCL as the shipped model. Code
written against that concept cannot currently run on the rung below —
several places inside one process — even though nothing in the concept
requires a network: a second, in-process model would let users prototype
rank-scoped code on one node (e.g. two locality domains) and scale it
unchanged to multi-process NCCL ranks, and would let in-process
containers drive the MGMN constructs as engines.

This PR connects the two rungs at the top of the cooperation-scope
ladder. The MGMN algorithms (__multi_gpu) program the ranks rung
against a duck-typed communicator concept; this PR adds a
places-backed model of that concept, so the same constructs run
unmodified over in-process places (locality domains, green-context
places, devices-as-places) — and the adapter that lets sharded
containers drive them.

What's in the PR

  • __sharded/communicator.cuh:
    • places_communicator / basic_places_communicator: each place of
      a place_group is one rank (rank = place index, native_handle()
      = the place). Because the places of one process share a virtual
      address space, the verbs lower to device-to-device copies
      (send/recv rendezvous-matched inside a group guard,
      all_gather[_v], all_to_all[_v]) and all_reduce to a single
      fold kernel
      that combines every rank's partial in fixed rank
      order — bit-identical results run to run for a fixed place list.
      The basic variant omits all_reduce, so both MGMN combine paths
      (direct all_reduce, and all_gather + local combine) stay reachable
      and tested.
    • logical_device() returns a place-backed model of the
      {context(), underlying_device()} pair the MGMN algorithms
      activate and select resources through.
    • make_communicators(place_group&) (and an explicit-place-list
      overload): one communicator per place, one shared group state.
      Groups spanning devices are refused with a diagnostic — that
      composition belongs to a hierarchical transport tier, not to this
      rung.
    • Concept conformance stated in code: static_asserts against
      the __multi_gpu concepts (__communicator, __has_all_reduce
      present/absent per variant, __has_all_gather[_v],
      __has_all_to_all[_v]).
    • bind_engine(group, sharded_array): the two-tier seam. The
      container tier owns placement and resources; the engine tier owns
      cross-place choreography. This adapter manufactures what an MGMN
      engine consumes — one communicator, environment (stream + per-place
      memory resource), iterator and size per shard.
  • __places/place_group.cuh: place_memory_resource gains
    default_queries (device_accessible) and host/device-annotated
    stream-ordered allocate/deallocate (terminating on device, the CUB
    device_memory_resource idiom), so the per-place resources travel
    through environments into CUB_RUNTIME_FUNCTION dispatch and
    cuda::buffer-based engine temporaries. Net effect: engine scratch
    is allocated on the place whose rank uses it.
  • Only the vendor-free __multi_gpu/concepts.h is included; the
    umbrella sharded.cuh stays buildable with NCCL disabled.

Tests (cudax/test/sharded/communicator/)

  • concepts.cu: the conformance static_asserts + factory contract
    (rank/size/order, native handle identity, empty-list refusal).
  • verbs.cu (2 locality domains): send/recv rendezvous, all_gather
    correctness, all_reduce correctness on random fp32 + broadcast
    bitwise agreement across ranks + bit-determinism over 5 repeated
    runs
    (the fixed fold order, checked).
  • bridge.cu — the conformance evidence as CI:
    cuda::experimental::reduce (the MGMN range API) running over
    communicators and environments manufactured from a sharded_array
    by bind_engine, on 2 locality domains with uneven shards, checked
    against a single-place CUB DeviceReduce reference and an fp64 host
    reference, through both combine paths, with bit-determinism
    across 5 runs per path.

Verified on a 2-locality-domain GB300 node (sm_103a, CUDA 13.4), built
with -Dcudax_ENABLE_NCCL=OFF.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

🤖 Generated with Claude Code

caugonnet and others added 2 commits August 24, 2026 12:39
…lti-GPU communicator concept + the engine-bindings adapter

The MGMN algorithms (__multi_gpu) program the ranks rung against a
duck-typed communicator concept, with NCCL as the shipped model. Code
written against that concept cannot currently run on the rung below --
several places inside one process -- even though nothing in the
concept requires a network: a second, in-process model lets users
prototype rank-scoped code on one node (e.g. two locality domains) and
scale it unchanged to multi-process NCCL ranks, and lets in-process
containers drive the MGMN constructs as engines.

places_communicator / basic_places_communicator: each place of a
place_group is one rank (rank = place index, native_handle() = the
place). Because the places of one process share a virtual address
space, the verbs lower to device-to-device copies (send/recv
rendezvous-matched inside a group guard, all_gather[_v], all_to_all[_v])
and all_reduce to a single fold kernel that combines every rank's
partial in fixed rank order -- bit-identical results run to run for a
fixed place list. The basic variant omits all_reduce, so both MGMN
combine paths (direct all_reduce, and all_gather + local combine) stay
reachable and tested. Concept conformance is stated in code:
static_asserts against the __multi_gpu concepts.

bind_engine(group, sharded_array): the two-tier seam. The container
tier owns placement and resources; the engine tier owns cross-place
choreography. This adapter manufactures what an MGMN engine consumes --
one communicator, environment (stream + per-place memory resource),
iterator and size per shard.

Only the vendor-free __multi_gpu/concepts.h is included; the umbrella
sharded.cuh stays buildable with NCCL disabled.

Tests: concept conformance static_asserts (all_reduce present/absent
per variant), verbs correctness on locality domains (send/recv
rendezvous, all_gather, all_reduce + bit-determinism over repeated
runs), and the bridge test: cuda::experimental::reduce over
communicators and environments manufactured from a sharded_array on 2
locality domains, checked against a single-place CUB reference,
through both combine paths.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…essible)

The communicator's bind_engine adapter hands place_memory_resource to
callers through a cuda::std::execution::env, which the MGMN reduce()
entry point folds into a CUB-dispatch buffer type computed from the
environment's memory-resource property set. Without a declared
device_accessible property, that type computation fails to resolve
(observed as cascading <error-type> template-instantiation errors
through std::vector's move-insertion traits, bottoming out in a
deleted default constructor for the buffer type) -- so any consumer
threading place_memory_resource through an environment into a CUB
single-call algorithm needs this to be able to typecheck at all, not
just to run correctly.

Every data_place already hands out device-accessible memory (device,
locality-domain, managed, and pinned host allocations), so
device_accessible is the honest common denominator. Purely additive:
a default_queries alias and a get_property friend, both new API
surface, nothing existing changed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@caugonnet
caugonnet requested review from a team as code owners August 24, 2026 12:41
@caugonnet
caugonnet requested review from gonidelis and miscco and removed request for a team August 24, 2026 12:41
@copy-pr-bot

copy-pr-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-project-automation github-project-automation Bot moved this to Todo in CCCL Aug 24, 2026
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

1 participant