Skip to content

UCT/CUDA_COPY: Fix reachability between interfaces - #11783

Open
usberkeley wants to merge 2 commits into
openucx:masterfrom
usberkeley:cuda_copy_reachability
Open

usberkeley wants to merge 2 commits into
openucx:masterfrom
usberkeley:cuda_copy_reachability

Conversation

@usberkeley

Copy link
Copy Markdown

What?

Allow different cuda_copy interfaces in the same process to reach each other.

Why?

Each interface had its own UUID, so interfaces in the same process were treated as unreachable.

How?

Use one process-wide UUID for all cuda_copy interfaces and update the reachability test to use two separate interfaces.

@svc-ucx

svc-ucx commented Aug 23, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR · commit 83dc3d06

TL;DR: All 8 GPU jobs of build 132017 aborted in gtest ib/test_ucp_rma_rndv_cuda_async.get_blocking/1 on ucs_assert(ep->flags & UCP_EP_FLAG_FLUSH_STATE_VALID) (ucp_ep.inl:173) reached from ucp_rma_rndv_flush_close(); the PR's change of the cuda_copy iface address to a process-wide UUID makes cuda_copy ifaces of two different workers in the same process mutually reachable, so a cuda_copy lane is now selected as an RMA-BW lane on a regular inter-worker EP and the new RMA GET/RNDV flush accounting runs on an EP whose flush state isn't valid.

Full analysis

Summary: make -C test/gtest test aborted (core dumped) in `ib/test_ucp_rma_rndv_cuda_

@svc-ucx

svc-ucx commented Aug 24, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests gpu on worker 1) · commit 96997ba3

TL;DR: The gtest cuda_copy/test_uct_loopback_cuda.envelope/0 fails because PR #11783's commit 96997ba makes cuda_copy reject host→host transfers with UCS_ERR_UNSUPPORTED, while the test still exercises the host/host memory-type pair — the send error is only logged, so the perf pingpong then hung 15 min until the gtest watchdog aborted. Fix: exclude the host→host pair from test_uct_loopback_cuda for cuda_copy (and make send_b abort instead of hang).

Full analysis

Summary: cuda_copy/test_uct_loopback_cuda.envelope/0 <cuda_copy/cuda> printed uct_tests.cc:374 UCX ERROR Failed to send: Unsupported operation for "send mem type: host / recv mem type: host", then produced no output for exactly 15 minutes (07:50:28 → 08:06:28) until Connection timed out - abort testing / SIGABRT, failing the job.

Root cause: The PR introduces an explicit host→host rejection in the cuda_copy transport:

  • src/uct/cuda/cuda_copy/cuda_copy_ep.c:274-278 — uct_cuda_copy_ep_get_ctx() returns UCS_ERR_UNSUPPORTED when both src and dst resolve to UCS_MEMORY_TYPE_HOST, so every uct_ep_put_short/get_short/zcopy on a host↔host buffer pair now fails.
  • Matching check in src/uct/cuda/cuda_copy/cuda_copy_iface.c:216-222 (uct_cuda_copy_estimate_perf returns UCS_ERR_UNSUPPORTED for host→host).

The gtest was not updated: test_uct_loopback_cuda::mem_type_pairs() (test/gtest/uct/test_uct_perf.cc:258-277) only special-cases gdr_copy and cuda_ipc; for cuda_copy it falls through to ucs::make_pairs({HOST, CUDA}), which includes the now-unsupported {host, host} pair. That is the very first pair executed, hence the immediate error.

The 15-minute silence is a secondary defect, not a slow test: uct_perf_test_runner::send_b() (src/tools/perf/lib/uct_tests.cc:373-376) only calls ucs_error(...) and returns on a hard send failure, so the pingpong loop keeps waiting for a reply that was never sent — a hang until the gtest connect/watchdog timeout fires and aborts (backtrace stuck in uct_cuda_base_iface_progress). Do not raise the timeout.

Implicated commit: [REDACTED:Hex High Entropy String] — Mason Pitt, "UCP/RNDV: Fix direct CUDA copy protocol selection" (same series as 83dc3d0 / 665292b "UCT/CUDA_COPY: Fix reachability between interfaces")

File: src/uct/cuda/cuda_copy/cuda_copy_ep.c:274 (rejection) and test/gtest/uct/test_uct_perf.cc:258-277 (test still using host/host)

Suggested fix:

  1. Update test_uct_loopback_cuda::mem_type_pairs() to drop the {host, host} combination when the transport is cuda_copy (cuda_copy no longer supports host-to-host), e.g. build ucs::make_pairs(input) and filter out pairs where both entries are UCS_MEMORY_TYPE_HOST, or add an explicit has_transport("cuda_copy") branch listing {host,cuda}, {cuda,host}, {cuda,cuda}.
  2. Better, make the perf runner skip gracefully: have libperf query uct_iface_estimate_perf() / capabilities for the requested local/remote memory types up-front and return UCS_ERR_UNSUPPORTED so gtest reports SKIP instead of running.
  3. Independently, make uct_perf_test_runner::send_b() propagate the fatal status (abort the run loop) instead of only logging, so an unsupported/failed send fails fast rather than hanging for the full watchdog interval.

Related: PR #11783 (UCT/CUDA_COPY: Fix reachability between interfaces) — this is the PR under test; commits 665292b, 83dc3d0, 96997ba.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 6049e2fc-629b-44fe-b6cc-ed362cbb6b31 in the triage console for the audit trail.

@svc-ucx

svc-ucx commented Aug 24, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer gpu on worker 0) · commit 98411d3e

[incomplete: stop_reason=max_tokens]

@svc-ucx

svc-ucx commented Aug 24, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer gpu on worker 2) · commit 1bb43210

TL;DR: cuda_copy/test_uct_stats.{put_short,put_zcopy,get_zcopy}/1 <cuda_copy/cuda/loopback> fail because the PR's new host→host guard in uct_cuda_copy_ep_get_ctx() returns UCS_ERR_UNSUPPORTED, while test_uct_stats::init_bufs() always allocates host buffers for cuda_copy (lowest bit of access_mem_types); fix the test to pick a non-host memory type (or skip cuda_copy host→host) and make wait_for_completion() bail out on error instead of polling for 11 minutes.

Full analysis

Summary: ASAN gpu gtest job failed with 3 failing tests — cuda_copy/test_uct_stats.get_zcopy/1, put_zcopy/1, put_short/1 (GetParam() = cuda_copy/cuda/loopback) — causing make test to exit 1 (Makefile:4713: test Error 1).

Root cause: The PR head commit adds an early unsupported-path to cuda_copy RMA:

if ((src_type == UCS_MEMORY_TYPE_HOST) && (dst_type == UCS_MEMORY_TYPE_HOST)) {
    ucs_trace("host to host memory copy is not supported");
    return UCS_ERR_UNSUPPORTED;
}

(src/uct/cuda/cuda_copy/cuda_copy_ep.c:274-278, reached from ep_rma_short and post_cuda_async_copy).

test_uct_stats::init_bufs() chooses the buffer memory type as ucs_ffs64(sender().md_attr().access_mem_types). For the cuda_copy MD access_mem_types = HOST|CUDA|CUDA_MANAGED (cuda_copy_md.c:130-132), and UCS_MEMORY_TYPE_HOST is bit 0 — so both lbuf and rbuf are host memory. Previously cuMemcpyAsync() happily did the host→host copy and the stats tests passed; now the ops return UCS_ERR_UNSUPPORTED, so:

  • put_short: EXPECT_UCS_OK(status) fails,
  • put_zcopy: EXPECT_FALSE(UCS_STATUS_IS_ERR(status)) fails,
  • get_zcopy: same, and because the op errored, m_comp.count never drops, so wait_for_completion() spins in short_progress_loop() until ucs::get_deadline() expires — that is the 674998 ms entry in the "TOP-20 longest tests" list (a bounded deadline loop, not a real hang), then EXPECT_EQ(1, m_comp.count) fails.

Implicated commit: 1bb4321 — "UCT/CUDA: Fix zero-length and unsupported host transfers", Mason Pitt (PR #11783 head; related earlier commits on the same branch: 665292b, 83dc3d0 "UCT/CUDA_COPY: Fix reachability between interfaces / endpoint connectivity detection", which is what exposes the cuda_copy/cuda/loopback p2p variant).

File: src/uct/cuda/cuda_copy/cuda_copy_ep.c:274 (new guard) and test/gtest/uct/test_stats.cc:98-108 (init_bufs picks HOST via ucs_ffs64), with the long spin at test/gtest/uct/test_stats.cc:182-194.

Suggested fix:

  1. Make test_uct_stats::init_bufs() pick a memory type the transport can actually copy: e.g. prefer a non-host type when access_mem_types contains more than HOST (mask out UCS_BIT(UCS_MEMORY_TYPE_HOST) if other bits are set), or add an explicit skip for cuda_copy when both sides would be host (UCS_TEST_SKIP_R("host to host is not supported")).
  2. Alternatively, if host→host must stay unsupported, advertise it — the iface still reports PUT_SHORT/PUT_ZCOPY/GET_ZCOPY unconditionally (cuda_copy_iface.c:124-129), so any generic test using host buffers on a cuda_copy ep will break; consider keeping host→host working (plain memcpy/cuMemcpyAsync) instead of failing the operation.
  3. Independently, add an early return in wait_for_completion() when UCS_STATUS_IS_ERR(status) so a failing op fails fast instead of burning ~11 minutes of CI wall time per test.

Related: PR #11783 ("UCT/CUDA_COPY: Fix reachability between interfaces"); no existing issue found for this test failure.

@usberkeley
usberkeley marked this pull request as draft August 25, 2026 08:18
@svc-ucx

svc-ucx commented Aug 25, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Coverity coverity devel on coverity_rh7) · commit 373283c8

TL;DR: The Coverity devel job failed the gate because analysis reported one new defect — a TAINTED_SCALAR ("untrusted loop bound") at test/gtest/ucp/test_ucp_proto.cc:917, where the new test helper loops over rpriv->mpriv.num_lanes taken from a void const* downcast; clamp/validate num_lanes against UCP_MAX_LANES before using it as a loop bound.

Full analysis

Summary: coverity devel on coverity_rh7 build 132394 failed with ##[error]Coverity found 1 issues: /__w/1/s/test/gtest/ucp/test_ucp_proto.cc:917 Type: Untrusted loop bound (TAINTED_SCALAR); the build/compile itself succeeded (737/737 units, cov-build completed successfully) and the job exited non-zero only because nerrors=1 > 0.

Root cause: In the new gtest helper test_ucp_proto_cuda_async_non_reg::get_rndv_get_zcopy_md_map(), proto_config->priv (typed const void *) is static_cast to const ucp_proto_rndv_bulk_priv_t *. Coverity treats data reached through that opaque-pointer downcast as tainted (step 2 tainted_data_downcast, step 3 var_assign_var), and then flags rpriv->mpriv.num_lanes being used directly as the bound of the loop at line 917 that indexes rpriv->mpriv.lanes[lane_index] (step 5 tainted_data). Nothing in the helper bounds num_lanes to the declared array size UCP_MAX_LANES (ucp_proto_multi_priv_t.num_lanes is a ucp_lane_index_t/uint8_t, lanes[UCP_MAX_LANES] — see src/ucp/proto/proto_multi.h:106-109), so the checker has no evidence the index stays in range. This is a new-code defect introduced by this PR's test additions, not a pre-existing one (the other 1553 occurrences are baselined).

Implicated commit: 373283c8 "UCP/RNDV: Restrict legacy direct access to same memory type" (Mason Pitt), on top of 96997ba3 "UCP/RNDV: Fix direct CUDA copy protocol selection" (Mason Pitt) — both add/modify this helper in test/gtest/ucp/test_ucp_proto.cc.

File: test/gtest/ucp/test_ucp_proto.cc:917 (helper at lines 903–922)

Suggested fix: Sanitize the loop bound so Coverity can see it is range-checked, e.g.:

rpriv = static_cast<const ucp_proto_rndv_bulk_priv_t*>(proto_config->priv);

const ucp_lane_index_t num_lanes = ucs_min(rpriv->mpriv.num_lanes,
                                           static_cast<ucp_lane_index_t>(UCP_MAX_LANES));
EXPECT_LE(rpriv->mpriv.num_lanes, UCP_MAX_LANES);

for (lane_index = 0; lane_index < num_lanes; ++lane_index) {
    md_map |= UCS_BIT(rpriv->mpriv.lanes[lane_index].super.md_index);
}

An explicit ucs_assertv(rpriv->mpriv.num_lanes <= UCP_MAX_LANES, ...) before the loop would also satisfy the checker. Prefer this over adding a Coverity suppression/model, since the same clamp documents the array bound. Re-run the Coverity stage after the change and confirm nerrors=0; the published coverity_devel artifact (output/errors/index.html) can be used to verify no new defects remain.

Related: PR #11783 (branch cuda_copy_reachability); no existing issue found for this Coverity signature.

@svc-ucx

svc-ucx commented Aug 26, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer gpu on worker 0) · commit ebdba9d4

TL;DR: The gtest udx/test_ucp_tag_mem_type.realloc_buffers/96 (cuda:cuda-managed, nogdr, proto_v1) aborted with a fatal request-ID assertion in ucp_rndv_rtr_handler, because this PR's new "same memory type only" restriction on legacy direct-access lanes makes both GET-zcopy (receiver) and PUT-pipeline (sender) unusable for cuda↔cuda-managed: the receiver commits to a multi-fragment RTR pipeline while the sender falls back to single-shot PUT/AM and releases the send request ID, so the second fragment RTR hits a request whose ID was already released.

Full analysis

Summary: make test aborted (core dumped) on udx/test_ucp_tag_mem_type.realloc_buffers/96 <ud_x,cuda_copy,rocm_copy/cuda:cuda-managed,nogdr,proto_v1,connect_all_to_all> with ucp_request.inl:934 Assertion '(*req_p)->id == (id)' failed: req=0x62f0001a22c0 req->id=0x0 id=0x62f0001a22c0 from ucp_rndv_rtr_handler.

Root cause: From the log backtrace the fatal is in ucp_rndv_rtr_handler → ucp_send_request_get_by_id (src/ucp/core/ucp_request.inl:934). The id equals the request pointer (direct ptr-map key), so the lookup still resolves even after ucp_send_request_id_release() reset req->id to 0 — i.e. the sender received a second RTR for a send request whose ID was already released. That happens when the receiver uses the fragmented (pipeline) RTR path (ucp_rndv_send_frag_rtr, one RTR per fragment) while the sender bails out of the pipeline: ucp_rndv_send_start_put_pipeline() returns UCS_ERR_UNSUPPORTED when ucp_rndv_zcopy_get_lane() yields UCP_NULL_LANE (rndv.c:2152-2156), and ucp_rndv_rtr_handler then falls through to PUT_ZCOPY/AM and calls ucp_send_request_id_release(sreq) at rndv.c:2402. The next fragment RTR then trips the assertion.

The reason no lane is found is the restriction added on this branch in ucp_rndv_req_init_zcopy_lane_map():

/* Legacy rendezvous supports direct access between the same memory types only. */
if (((rkey == NULL) || (mem_type == rkey->mem_type)) &&
    ucp_rkey_is_direct_access_supported(md_attr, mem_type, rkey)) {

For this test the local and remote types differ (cuda vs cuda-managed), so the no-rkey (cuda_copy) direct-access lane is dropped on both sides: the receiver's ucp_rndv_req_send_rma_get() fails (UCS_ERR_UNREACHABLE, rndv.c:974) → is_get_zcopy_failed=1 → frag-RTR pipeline; the sender's put pipeline fails the identical check → protocol switch mid-pipeline → fatal.

Implicated commit: 373283c "UCP/RNDV: Restrict legacy direct access to same memory type" (Mason Pitt), part of PR #11783 branch cuda_copy_reachability (related: 96997ba, 83dc3d0, 665292b by the same author).

File: src/ucp/rndv/rndv.c:772 (new same-mem-type condition); failure surfaces at src/ucp/rndv/rndv.c:2152-2156 and src/ucp/rndv/rndv.c:2402, asserted at src/ucp/core/ucp_request.inl:934.

Suggested fix:

  1. Relax the new check so it reflects actual direct-access capability instead of exact type equality — e.g. require that the MD's access_mem_types (already validated by ucp_rkey_is_direct_access_supported()) covers both mem_type and rkey->mem_type, so cuda ↔ cuda-managed (both accessible by the same cuda_copy MD) remains a valid direct-access lane. This restores the pre-PR behaviour for the failing configuration.
  2. Independently, harden the legacy RTR path so a protocol switch can never happen mid-pipeline: in ucp_rndv_rtr_handler, do not release the send request ID (and do not fall back to single-shot PUT/AM) when the RTR is a fragment RTR (rndv_rtr_hdr->offset != 0 || rndv_rtr_hdr->size < sreq->send.length); make ucp_rndv_send_start_put_pipeline() decide supported/unsupported only on the offset == 0 RTR and keep that decision for the remaining fragments. Otherwise this fatal is reachable any time the receiver picks the pipeline and the sender finds no PUT-zcopy lane.

Related: PR #11783 (this PR). Similar historical request-ID/ptr-map leak in the rndv pipeline: PR #5769, issue #6836.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/ucp/core/ucp_ep.inl Resolved
Comment thread src/ucp/core/ucp_rkey.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Coverage note: The functional data-path (actual RMA GET over cuda_copy between host and CUDA in the same process, and the h2h UCS_ERR_UNSUPPORTED path) is exercised indirectly via test_uct_perf/test_p2p_* and the proto-selection gtests; there is no new end-to-end UCP RMA GET test that drives the ucp_rma_rndv_flush_open/close + RNDV_FLUSH_EP_TRACKED accounting on an endpoint that is on the match context. If practical, a focused UCP-level test that issues RMA GET before the endpoint is fully connected (so ON_MATCH_CTX is set) would directly protect the flush-accounting fix; otherwise confirm which existing CI job covers that ordering.

@svc-ucx

svc-ucx commented Aug 27, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (AddressSanitizer gpu on worker 0) · commit c34afe36

TL;DR: The rc/test_ucp_perf_cuda.am_recv_copy gtest aborted on a fatal assertion in uct_cuda_copy_get_mem_types() (cuda_copy_ep.c:131) because the rndv receive path selected a cuda_copy get_zcopy lane for a copy whose source is on GPU1 and destination on GPU0 — cuda_copy only supports a single sys_dev per operation. The branch commit c34afe36 ("UCP/RNDV: Allow direct access across memory types") relaxed direct-access selection while cuda_copy reachability still ignores the GPU device, so the cross-device pair is now considered valid.

Full analysis

Summary: ASAN GPU job failed: make test aborted (core dumped) on rc/test_ucp_perf_cuda.am_recv_copy/0 <rc_v,cuda_copy,rocm_copy> with Assertion '(src_sys_dev == dst_sys_dev) || ...' failed: src mtype cuda, sys_dev GPU1; dst mtype cuda, sys_dev GPU0.

Root cause: From the backtrace: ucp_worker_progress → ucp_rndv_rts_handler → ucp_am_rndv_process_rts → ucp_am_recv_data_nbx → ucp_proto_rndv_receive_start → uct_cuda_copy_ep_get_zcopy → ucs_fatal_error. The rndv receiver chose a cuda_copy direct-access (get_zcopy) lane to pull data from a peer buffer on GPU1 into a local buffer on GPU0. uct_cuda_copy_get_mem_types() (src/uct/cuda/cuda_copy/cuda_copy_ep.c:112-139) can only represent one device: it picks src_sys_dev, or dst_sys_dev if src is unknown, pushes that single primary context (uct_cuda_copy_ctx_rsc_get, line 180-207) and picks one stream, and therefore hard-asserts that src/dst are on the same GPU. Nothing prevents that selection: uct_cuda_copy_iface_is_reachable_v2() (src/uct/cuda/cuda_copy/cuda_copy_iface.c:87-112) only compares a process-wide UUID (uct_cuda_copy_iface_addr_t id, cuda_copy_iface.h:63-64) — it carries no device identity — and ucp_proto_rndv_ctrl_get_md_map() (src/ucp/rndv/proto_rndv.c:91-94) only calls ucs_topo_is_reachable(ep_sys_dev, mem_sys_dev), which passes for a cuda_copy lane with unknown/other sys_dev. In gtest both entities live in one process, so the cuda_copy loopback lane is reachable and is now picked after the branch's relaxation of the same-memory-type restriction.

Implicated commit: [REDACTED:Hex High Entropy String] — Mason Pitt, "UCP/RNDV: Allow direct access across memory types" (same PR series: 373283c8 "Restrict legacy direct access to same memory type", 96997ba3 "UCP/RNDV: Fix direct CUDA copy protocol selection")

File: src/uct/cuda/cuda_copy/cuda_copy_ep.c:131 (selection side: src/uct/cuda/cuda_copy/cuda_copy_iface.c:87-112 and src/ucp/rndv/proto_rndv.c:91-94)

Suggested fix: Make cross-device pairs unreachable/unsupported rather than assertable:

  1. Encode the device identity in uct_cuda_copy_iface_addr_t (e.g. UUID + sys_dev/CUDA device UUID) and reject in uct_cuda_copy_iface_is_reachable_v2() when the peer's device differs — this is exactly the gap the "cuda_copy reachability" PR is meant to close, and it currently only checks the process UUID.
  2. As a defensive guard, in uct_cuda_copy_ep_get_ctx()/uct_cuda_copy_get_mem_types() replace the ucs_assertv with a graceful return UCS_ERR_UNSUPPORTED (trace-logged) when src_sys_dev != dst_sys_dev and both are known — otherwise release builds silently push the wrong CUDA context instead of aborting.
  3. If cross-GPU cuda_copy is actually intended by this PR, the operation must be extended to select the context/stream per device pair (and verify peer access) before c34afe36's relaxation can stand; alternatively narrow c34afe36 so direct access is not allowed when local and remote sys_dev differ.

Related: PR #11783 (UCT/CUDA_COPY: Fix reachability between interfaces); possibly related device-reachability issue #11048

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 46249c97-eaf5-4f23-8a3f-ba13697665c3 in the triage console for the audit trail.

@usberkeley
usberkeley force-pushed the cuda_copy_reachability branch from c34afe3 to 8313e70 Compare August 27, 2026 13:11
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@usberkeley
usberkeley force-pushed the cuda_copy_reachability branch from 8313e70 to 57a8f1d Compare August 27, 2026 13:12
@svc-nvidia-pr-review

Copy link
Copy Markdown

Coverage note: The functional UCP-level RMA GET path that exercises ucp_rma_rndv_flush_open/close + RNDV_FLUSH_EP_TRACKED on an endpoint that is actually on the match context (ON_MATCH_CTX set) is not directly covered by a new end-to-end test; it is exercised only indirectly. A focused UCP test issuing RMA GET before the endpoint is fully connected would directly protect the flush-accounting fix. Otherwise, confirm which CI job covers that ordering.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread test/gtest/ucp/test_ucp_proto.cc Resolved
Comment thread test/gtest/ucp/test_ucp_dt.cc Resolved
@svc-ucx

svc-ucx commented Aug 27, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests gpu on worker 1) · commit 57a8f1db

TL;DR: The gtest udx/test_ucp_tag_mem_type.reuse_buffers_mrail/36 (cuda-managed, proto_v1) aborted on the fatal assert (*req_p)->id == (id) in ucp_rndv_rtr_handler, because the PR's new process-wide cuda_copy reachability changes lane selection so the receiver commits to the fragmented-RTR PUT pipeline while the sender falls back to non-pipeline PUT/AM and releases the send-request ID (rndv.c:2398) after the first RTR — the second fragment RTR then looks up a request whose ID was already released.

Full analysis

Summary: make test aborted (core dumped) in udx/test_ucp_tag_mem_type.reuse_buffers_mrail/36 <ud_x,cuda_copy,rocm_copy/cuda-managed:cuda-managed,proto_v1> with ucp_request.inl:934 Assertion '(*req_p)->id == (id)' failed: req=0x[REDACTED:Hex High Entropy String] req->id=0x0 id=0x55642bae1ec0, backtrace ucp_rndv_rtr_handler -> uct_ud_ep_process_rx -> ucp_worker_progress.

Root cause: With proto_v1 rndv over GPU memory the receiver may pipeline via ucp_rndv_send_frag_rtr() (src/ucp/rndv/rndv.c:1349-1424), which emits one RTR per fragment, all carrying the same rndv_rts_hdr->sreq.req_id (1MB message / 512K frag ⇒ 2 RTRs). On the sender, ucp_rndv_rtr_handler() first tries ucp_rndv_send_start_put_pipeline(); if that returns UCS_ERR_UNSUPPORTED (its err_unsupported checks at rndv.c:2140-2166 — no usable PUT-zcopy lane / lane MD can't register the host frag type / no memtype ep) it falls through to the whole-message PUT_ZCOPY / AM path and executes ucp_send_request_id_release(sreq) at src/ucp/rndv/rndv.c:2398 ("if it is not a PUT pipeline protocol, delete the send request ID"). When the second fragment RTR arrives for the same sreq_id, UCP_SEND_REQUEST_GET_BY_ID → ucp_send_request_get_by_id() succeeds (the ep uses direct request IDs — note id equals the request pointer in the log), but req->id is already 0, so ucp_request_id_check() at src/ucp/core/ucp_request.inl:934 fires a fatal error.

What made this latent v1 bug appear on this branch: commit [REDACTED:Hex High Entropy String] replaces the per-iface cuda_copy address with a process-wide UUID (uct_cuda_copy_iface_get_uuid(), cuda_copy_iface.c:62-72, assigned at :358) plus the new uct_cuda_copy_iface_is_reachable_v2() (:87-112), and also touches src/ucp/wireup/select.c. Two workers in the same process (exactly the gtest topology) now consider each other's cuda_copy ifaces reachable, so cuda_copy becomes an inter-endpoint rma_bw / rndv PUT-GET lane for cuda-managed buffers. That changes the receiver's ucp_rndv_is_recv_pipeline_needed()/ucp_rndv_is_put_pipeline_needed() decision vs. the sender's pipeline eligibility, creating the sender/receiver asymmetry described above. Nothing in the log indicates a hang or infrastructure issue — the abort is deterministic at the 1MB size of that test variant.

Implicated commit: [REDACTED:Hex High Entropy String] — "UCT/CUDA_COPY: Fix reachability between interfaces", Mason Pitt (touches src/uct/cuda/cuda_copy/cuda_copy_iface.{c,h}, src/ucp/wireup/select.c, src/ucp/rndv/rndv.c, test/gtest/ucp)

File: src/ucp/rndv/rndv.c:2398 (ID released while frag RTRs are still in flight); assert site src/ucp/core/ucp_request.inl:934; trigger src/uct/cuda/cuda_copy/cuda_copy_iface.c:62-112,358

Suggested fix:

  1. Make the v1 RTR fallback safe (recommended, fixes the crash class): in ucp_rndv_rtr_handler(), do not release the send-request ID at the out_send: label when the RTR is a fragment RTR (rndv_rtr_hdr->offset != 0 || rndv_rtr_hdr->size < sreq->send.length); keep the ID until the last fragment's data has been consumed, e.g. track remaining bytes on the sreq and only call ucp_send_request_id_release() when offset + size == sreq->send.length.
  2. Keep sender/receiver pipeline decisions symmetric: the receiver's ucp_rndv_is_put_pipeline_needed()/ucp_rndv_is_recv_pipeline_needed() must apply the same lane/MD constraints the sender enforces in ucp_rndv_send_start_put_pipeline() (usable PUT-zcopy lane whose MD can register the rndv frag mem type, memtype ep present), so the sender never rejects a pipeline the receiver already committed to.
  3. For this PR specifically: restrict the new reachability so cuda_copy is not promoted into inter-endpoint rndv/rma_bw lane sets (e.g. exclude memtype-copy TLs from rma_bw/rndv.put_zcopy lane selection in src/ucp/wireup/select.c, or limit the process-wide-UUID match to memtype/loopback endpoints), then re-run the test_ucp_tag_mem_type proto_v1 cuda-managed variants.

Related: PR #11783 (this build); similar rndv-pipeline fallback issue #6836

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id c2ed560d-aaf4-41a4-9c3c-615498734229 in the triage console for the audit trail.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Signed-off-by: Mason Pitt <bradley.b.pitt@gmail.com>
@usberkeley
usberkeley force-pushed the cuda_copy_reachability branch from 7ba6ad0 to 594e9cd Compare August 28, 2026 10:08
@svc-nvidia-pr-review

Copy link
Copy Markdown

src/uct/cuda/cuda_copy/cuda_copy_iface.c

In uct_cuda_copy_iface_get_uuid: ucs_generate_uuid() already mixes in tid/time/bootid entropy, so the (uintptr_t)getpid() seed is somewhat redundant for uniqueness. It's harmless, but the added #include <unistd.h> and pid seed could be dropped in favor of ucs_generate_uuid(0) to match ucs_rand_seed's usage. Not important.

Coverage note (not a code issue): the change is exercised by proto-selection and UCT gtests, but there is no new end-to-end UCP functional test that actually issues an RMA/staging transfer over cuda_copy between host and CUDA in the same process. The behavior is covered indirectly by test_uct_perf/test_p2p_*; if a GPU CI job runs those, that's sufficient — worth confirming which job covers the same-worker cuda_copy data path.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Review complete — no issues found.

Signed-off-by: Mason Pitt <bradley.b.pitt@gmail.com>
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

@usberkeley
usberkeley marked this pull request as ready for review August 30, 2026 15:47
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Review complete — no issues found.

@usberkeley

Copy link
Copy Markdown
Author

Hi @michal-shalev

We’ve added a process-wide UUID to all cuda_copy interfaces. Feel free to take a look when you have a chance.

This branch has not been deployed

No deployments
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.

3 participants