Skip to content

UCP/RNDV: Add opt-in intra-node CUDA staging policy - #11641

Merged
nbellalou merged 6 commits into
openucx:masterfrom
nbellalou:rndv-intra-cuda-staging-force
Aug 6, 2026
Merged

nbellalou merged 6 commits into
openucx:masterfrom
nbellalou:rndv-intra-cuda-staging-force

Conversation

@nbellalou

@nbellalou nbellalou commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

What?

This PR adds an opt-in UCP rendezvous policy knob for intra-node CUDA tag transfers. When enabled, the policy prefers the shared-memory staged CUDA-copy pipeline path for CUDA-to-CUDA rendezvous on the same node, while keeping the default behavior unchanged.

Why?

internal issue

Workaround for a performance issue caused by a bad wireup bandwidth estimation model. Wireup model makes the RC/IB path look better than the staged CUDA-copy path, so UCX selects RC for intra-node GPU-to-GPU transfers even though the staged shared-memory path performs significantly better.
Existing UCX rendezvous knobs are not sufficient for this case. Broad knobs such as UCX_RNDV_SCHEME select a rendezvous scheme globally, but they do not express the policy needed here:

  • apply only to intra-node CUDA tag rendezvous;
  • prefer the staged shared-memory CUDA-copy pipeline;
  • preserve explicit user-selected rendezvous schemes;
  • avoid changing AM/RMA rendezvous internals;
  • avoid disabling RC/IB globally, which would also affect unrelated and inter-node traffic.

The new knob keeps this behavior opt-in and scoped, so it can be used as a tactical workaround without changing default protocol selection for other environments.

How?

  • Add UCX_RNDV_PIPELINE_SHM_CUDA_STAGING_FORCE as an opt-in policy knob.
  • Scope the policy to intra-node CUDA tag rendezvous while RNDV_SCHEME=auto.
  • Force only the relevant staged receiver pipeline envelope and sender-side child selection needed for the copy-to-attached host-staged path.
  • Preserve AM/RMA rendezvous provenance so those flows are not redirected by the tag-only policy.
  • Keep synthetic proto-estimation rkey configs separate from normal runtime rkey configs.
  • Add focused gtests for enabled, disabled, explicit-scheme, AM/RMA, and rkey-identity behavior.

Allow users to prefer the copy-to-attached host-staged path for intra-node CUDA-to-CUDA tag rendezvous while leaving explicit schemes and unrelated traffic unchanged. Force only the staged receiver envelope and the sender-side rndv/rkey_ptr/mtype child when that child initializes, with normal UCX fallback otherwise.

Mark internal RMA and AM rendezvous selections with local-only provenance and preserve it across pipeline fragment selection, so RMA PUT/GET reuse of RNDV_RECV and Active Message rendezvous remain outside the tag-only policy without changing the wire format.

Scope synthetic receiver-estimation rkey identity to matching forced intra-node CUDA modeling, so disabled and unrelated flows reuse the legacy rkey configuration.
@nbellalou

Copy link
Copy Markdown
Contributor Author

@svc-nvidia-pr-review

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/rndv/proto_rndv.inl Resolved
Comment thread src/ucp/rndv/proto_rndv.h Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Behavioral note: ucp_proto_rndv_receive_start now passes op_flags = ucp_proto_rndv_rts_op_flags(rts->opcode), so AM rendezvous receives select with UCP_OP_ID_RNDV_RECV | UCP_PROTO_SELECT_OP_FLAG_AM_RNDV where they previously used 0. The flag is only consumed by the new force-shm-pipeline scope check and creates additional (provenance-distinguished) select-hash keys; other RNDV_RECV probes ignore unknown flags, so the actually-selected protocol is unchanged. No action needed — flagging only so it's on record that the selection key changed for the existing AM path, which rndv_force_cuda_preserves_am_rma_fragments covers.

Coverage note: the force path (RNDV_PIPELINE_SHM_FORCE=y) is exercised via test_ucp_proto_rndv_force_cuda and test_ucp_proto_rma_rndv, both gated on CUDA availability (RMA test also on ib). These verify protocol selection, not an end-to-end CUDA-to-CUDA transfer over the forced path. Acceptable for a selection-logic change, but there's no CI wiring for the new config option's enabled path beyond these selection tests — worth confirming the GPU CI variant that runs test_ucp_proto_rndv_force_cuda actually has CUDA present, otherwise these all skip.

@nbellalou
nbellalou requested review from gleon99 and yosefe July 12, 2026 14:56
@gleon99
gleon99 requested a review from evgeny-leksikov July 13, 2026 08:18
@gleon99

gleon99 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@evgeny-leksikov please review

Comment thread src/ucp/rndv/proto_rndv.inl Resolved
Comment thread src/ucp/core/ucp_context.c Resolved
Comment thread NEWS Outdated

## Current
### Features:
#### UCP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove

Comment thread src/ucp/rndv/proto_rndv.c Resolved
Comment thread src/ucp/rndv/proto_rndv.c Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread src/ucp/proto/proto_debug.c Resolved
Comment thread src/ucp/rndv/proto_rndv.c Resolved
Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread src/ucp/rndv/proto_rndv.inl Resolved
Comment thread src/ucp/rndv/proto_rndv.c Resolved
Comment thread src/ucp/core/ucp_context.c Resolved
@nbellalou
nbellalou requested a review from gleon99 July 19, 2026 06:47
@gleon99

gleon99 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Minor: UCX_RNDV_PIPELINE_SHM_FORCE -> UCX_RNDV_PIPELINE_SHM_CUDA_STAGING_FORCE in the PR description.

@gleon99
gleon99 requested a review from rakhmets July 19, 2026 14:53
@gleon99

gleon99 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

+ @rakhmets

"Use two stage pipeline rendezvous protocol for intra-node GPU to GPU transfers",
ucs_offsetof(ucp_context_config_t, rndv_shm_ppln_enable), UCS_CONFIG_TYPE_BOOL},

{"RNDV_PIPELINE_SHM_CUDA_STAGING_FORCE", "n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called FORCE, but if staging is unavailable proto-select silently falls back to RC. Maybe rename / change type from BOOL to ternary

Comment thread src/ucp/rndv/proto_rndv.inl Outdated
}

/* Check that AM and RMA rendezvous flows are excluded. */
if (op_id_flags & (UCP_PROTO_SELECT_OP_FLAG_AM_RNDV |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we mark tag RNDV explicitly?

const ucp_proto_init_params_t *init_params = &params->super.super;
uint8_t op_id_flags = init_params->select_param->op_id_flags;

if (force_shm_pipeline) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matching RECV + PPLN_FRAG + host + threshold here couples generic rndv control code to the current child layout. Better mark the intended pipeline child explicitly.

Comment thread src/ucp/am/rndv.c Outdated
}

/* When forced staging is enabled, preserve AM RNDV provenance for the nested remote receive model. */
if (init_params->worker->context->config.ext.rndv_shm_cuda_staging_force) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: With an explicit RNDV_SCHEME, forcing is inactive but we still add the AM provenance flag and create another selection key.

Comment thread src/ucp/rndv/proto_rndv.c
if (remote_proto->cfg_thresh != UCS_MEMUNITS_AUTO) {
force_shm_pipeline =
ucp_proto_rndv_shm_pipeline_force(&params->super.super);
if ((context->config.ext.rndv_mode != UCP_RNDV_MODE_AUTO) &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls keep the old invariant check in auto mode and exempt only the known forced child. Otherwise an unexpected finite remote threshold is silently accepted.

Comment thread test/gtest/ucp/test_ucp_proto.cc Outdated
UCS_TEST_SKIP_R("CUDA memory is not supported");
}

threshold = select_rndv_ppln_frag_protocol(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add coverage for this runtime mapping? Current tests only exercise model-side flags or inject them directly.

Comment thread src/ucp/rndv/proto_rndv.inl Outdated
static UCS_F_ALWAYS_INLINE int
ucp_proto_rndv_shm_pipeline_force_scope(
const ucp_proto_init_params_t *init_params, ucp_operation_id_t op_id,
ucs_memory_type_t remote_mem_type, int allow_proto_estimation)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: allow_proto_estimation is always passed as 1

Replace the earlier AM/RMA rendezvous flags with one
TAG_RNDV signal that is propagated only for tag rendezvous flows.
Comment thread src/ucp/core/ucp_context.c Resolved
Comment thread src/ucp/core/ucp_rkey.h Resolved
@nbellalou
nbellalou merged commit d9c844a into openucx:master Aug 6, 2026
161 checks passed
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.

5 participants