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
Conversation
…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
requested review from
gonidelis and
miscco
and removed request for
a team
August 24, 2026 12:41
Contributor
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.
Description
Motivation
The MGMN algorithms (
__multi_gpu) program the ranks rung against aduck-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 rungagainst 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 ofa
place_groupis 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/recvrendezvous-matched inside a group guard,all_gather[_v],all_to_all[_v]) andall_reduceto a singlefold kernel that combines every rank's partial in fixed rank
order — bit-identical results run to run for a fixed place list.
The
basicvariant omitsall_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 algorithmsactivate and select resources through.
make_communicators(place_group&)(and an explicit-place-listoverload): 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.
static_asserts againstthe
__multi_gpuconcepts (__communicator,__has_all_reducepresent/absent per variant,
__has_all_gather[_v],__has_all_to_all[_v]).bind_engine(group, sharded_array): the two-tier seam. Thecontainer 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_resourcegainsdefault_queries(device_accessible) and host/device-annotatedstream-ordered allocate/deallocate (terminating on device, the CUB
device_memory_resourceidiom), so the per-place resources travelthrough environments into
CUB_RUNTIME_FUNCTIONdispatch andcuda::buffer-based engine temporaries. Net effect: engine scratchis allocated on the place whose rank uses it.
__multi_gpu/concepts.his included; theumbrella
sharded.cuhstays 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_gathercorrectness, 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 overcommunicators and environments manufactured from a
sharded_arrayby
bind_engine, on 2 locality domains with uneven shards, checkedagainst a single-place CUB
DeviceReducereference and an fp64 hostreference, 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
🤖 Generated with Claude Code