Repository navigation
UCT/CUDA: Reject IPC without P2P read/write support - #11979
Conversation
CUDA IPC handle mapping may succeed even when GPUs do not support native peer access. This can select a very slow driver fallback for GPU pairs connected through different PCIe bridges. Resolve local and remote GPU UUIDs with NVML and require native read and write peer access. Mark unsupported IPC rkeys unreachable and exclude their memory domains from nested rendezvous modeling so UCP can select its host-staged pipeline. Keep the existing handle-mapping probe as a fallback when NVML cannot resolve the peer or returns an unknown status.
|
🤖 Starting review — findings will be posted here when done. |
| bytes[15]); | ||
| } | ||
|
|
||
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, |
There was a problem hiding this comment.
the function returns ternary values, pls use the ternary type instead of int
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, | |
| ucs_ternary_auto_value_t | |
| uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, const CUuuid *remote_uuid) |
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, | ||
| const CUuuid *remote_uuid) | ||
| { | ||
| char local_uuid_string[NVML_DEVICE_UUID_ASCII_LEN]; |
There was a problem hiding this comment.
is NVML_DEVICE_UUID_ASCII_LEN defined in the oldest nvml.h we support? NVML decls that are not always present are guarded by AC_CHECK_DECLS in config/m4/cuda.m4.
There was a problem hiding this comment.
Removed. The buffer now uses NVML_DEVICE_UUID_BUFFER_SIZE.
| return UCS_TRY; | ||
| } | ||
|
|
||
| if (!memcmp(&local_uuid, remote_uuid, sizeof(local_uuid))) { |
There was a problem hiding this comment.
minor: memcmp() is not a boolean, pls compare explicitly (same as cuda_ipc_cache.c:848)
| if (!memcmp(&local_uuid, remote_uuid, sizeof(local_uuid))) { | |
| if (memcmp(&local_uuid, remote_uuid, sizeof(local_uuid)) == 0) { |
| (UCT_CUDA_NVML_WRAP_CALL(nvmlDeviceGetHandleByUUID, | ||
| remote_uuid_string, | ||
| &remote_device) != UCS_OK) || | ||
| (UCT_CUDA_NVML_WRAP_CALL(nvmlDeviceGetP2PStatus, local_device, |
There was a problem hiding this comment.
why do we require both READ and WRITE to be NVML_P2P_STATUS_OK? On topologies where NVML reports read P2P as not supported but the driver still allows peer copies, this silently disables cuda_ipc for the pair.
There was a problem hiding this comment.
is it possible to declare P2P it if any is true, to err on safe side
There was a problem hiding this comment.
The peer is now rejected only if NVML reports that neither READ nor WRITE is supported.
| rkey->stream_id = cache->dev_num; | ||
| accessible = &cache->accessible[cu_dev]; | ||
| if (ucs_unlikely(*accessible == UCS_TRY)) { /* unchecked, add to cache */ | ||
| *accessible = uct_cuda_ipc_nvml_peer_accessible( |
There was a problem hiding this comment.
minor: the value written here is overwritten by the open-memhandle result below, only UCS_NO needs to be cached; maybe keep the NVML result in a local variable to make that clear.
|
|
||
|
|
||
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, | ||
| const CUuuid *remote_uuid); |
There was a problem hiding this comment.
minor: one extra space, pls align with the definition in cuda_ipc_md.c.
| */ | ||
| rkey_config_key.md_map = ucp_proto_rndv_md_map_to_remote(params, | ||
| md_map); | ||
| if (params->super.super.rkey_config_key != NULL) { |
There was a problem hiding this comment.
should this be skipped when UCP_PROTO_COMMON_KEEP_MD_MAP is set, like in ucp_proto_rndv_ctrl_init_priv()? Otherwise rndv/rtr/mtype estimates the remote protocol with a smaller md_map than the one it actually packs.
There was a problem hiding this comment.
I tried this, and it brings back the slow path. On g7e GPU4 -> GPU6 (NODE, no native P2P), RNDV_RECV selected rndv/rtr/mtype with a CUDA staging buffer, and the peer wrote to it through cuda_ipc.
rtr/mtype still packs cuda_ipc for its staging buffer, but the peer cannot unpack it for the same GPU pair. So the estimate without cuda_ipc matches what the peer can actually use. With https://github.com/openucx/ucx/pull/11979/changes#r4131274778, the synthetic key now matches the peer's unpack result: the packed MDs are split into md_map and unreachable_md_map, like ucp_ep_rkey_unpack_internal() does. The new rndv_recv_unreachable test covers this case and fails if the mask is skipped for KEEP_MD_MAP.
|
Residual coverage gap: the new gtest requires ≥2 CUDA devices and skips when NVML is unavailable, and it asserts NVML P2P status equals Residual coverage gap: the |
|
🤖 CI Triage Agent — TL;DR: The WireCompat/gpu build fails to compile Full analysisSummary: Root cause: The build container uses CUDA 11.2 (log: The two "unused variable" errors are secondary fallout from the failed array-size expansion. UCX builds with Implicated commit: [REDACTED:Hex High Entropy String] — "UCT/CUDA: Reject IPC without native peer access", Peter Andreas Entschev File: src/uct/cuda/cuda_ipc/cuda_ipc_md.c:509-510 Suggested fix: Don't depend on the newer NVML macro. The string produced by /* "GPU-" + 32 hex chars + 4 dashes + '\0' */
#define UCT_CUDA_IPC_UUID_STR_LEN 41
...
char local_uuid_string[UCT_CUDA_IPC_UUID_STR_LEN];
char remote_uuid_string[UCT_CUDA_IPC_UUID_STR_LEN];Alternatively use the long-standing #ifndef NVML_DEVICE_UUID_ASCII_LEN
#define NVML_DEVICE_UUID_ASCII_LEN NVML_DEVICE_UUID_BUFFER_SIZE
#endifThe first option is preferable since it keeps the buffer size tied to UCX's own formatter. Also note
|
| */ | ||
| rkey_config_key.md_map = ucp_proto_rndv_md_map_to_remote(params, | ||
| md_map); | ||
| if (params->super.super.rkey_config_key != NULL) { |
There was a problem hiding this comment.
to cover maybe:
UCS_TEST_P(test_ucp_proto_mock_cuda_ipc_unreachable, rtr_md_map)
{
const ucp_md_index_t md_index = cuda_ipc_md_index();
ASSERT_NE(UCP_NULL_RESOURCE, md_index) << "no cuda_ipc lane";
/* cuda_ipc rejected at unpack must not be re-proposed by nested rndv */
EXPECT_TRUE(rtr_md_map(0) & UCS_BIT(md_index));
EXPECT_FALSE(rtr_md_map(UCS_BIT(md_index)) & UCS_BIT(md_index));
}There was a problem hiding this comment.
Added test_ucp_proto_mock_cuda_ipc.rndv_recv_unreachable. rndv/rtr already removed unreachable MDs from its packed RTR map in ucp_proto_rndv_ctrl_init_priv(). The gap was the nested remote estimate, mostly for rndv/rtr/mtype, which keeps its packed MD map. So the test checks the RNDV_RECV selection instead of rtr_md_map().
There was a problem hiding this comment.
Should we also set rkey_config_key.unreachable_md_map here instead of leaving it 0? ucp_ep_rkey_unpack_internal() keeps the two maps disjoint, and mirroring that on the synthetic key would avoid this config aliasing onto a peer config that never had cuda_ipc.
| (UCT_CUDA_NVML_WRAP_CALL(nvmlDeviceGetHandleByUUID, | ||
| remote_uuid_string, | ||
| &remote_device) != UCS_OK) || | ||
| (UCT_CUDA_NVML_WRAP_CALL(nvmlDeviceGetP2PStatus, local_device, |
There was a problem hiding this comment.
is it possible to declare P2P it if any is true, to err on safe side
| *accessible = uct_cuda_ipc_nvml_peer_accessible( | ||
| cu_dev, &rkey->super.super.uuid); | ||
| if (*accessible == UCS_NO) { | ||
| ucs_debug("CUDA IPC peer does not support native P2P access"); |
There was a problem hiding this comment.
can you pls add details of the memory ptr size etc, similar to done inside open mem handle below (specific step to be mentioned in same log where it failed during the new p2p check)?
There was a problem hiding this comment.
Done. The log now names the NVML P2P check step and prints the local device, remote buffer address and length.
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, | ||
| const CUuuid *remote_uuid) | ||
| { | ||
| char local_uuid_string[NVML_DEVICE_UUID_ASCII_LEN]; |
There was a problem hiding this comment.
seems we should use NVML_DEVICE_UUID_BUFFER_SIZE?
| bytes[15]); | ||
| } | ||
|
|
||
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, |
There was a problem hiding this comment.
Done, with the uct_cuda_ipc_nvml_device_by_uuid() structure you proposed and a loop over the READ/WRITE capabilities. The loop returns UCS_YES on the first supported direction as requested in https://github.com/openucx/ucx/pull/11979/changes#r4131304643.
| EXPECT_FALSE(cuda_ipc_md->enable_mnnvl); | ||
| } | ||
|
|
||
| UCS_TEST_P(test_cuda_ipc_md, nvml_peer_accessibility) |
There was a problem hiding this comment.
pls also assert the selected protocol, not only md_map. test_cuda_rma() + check_rkey_config() already compare the protocol desc/config per size range, so a rkey config with unreachable_md_map set on the cuda_ipc MD should show RNDV_RECV moving from "cuda_ipc/cuda" to the cuda_copy host-staged pipeline.
It can reuse the existing flow: take the rkey_cfg_index from send_recv_rma(), copy its rkey_config_key, set unreachable_md_map to the cuda_ipc MD bit, call ucp_worker_rkey_config_get() to get a second index, then check_rkey_config() on it with key.param.op_id_flags = UCP_OP_ID_RNDV_RECV. This is the behavior claimed in the PR description, and it needs no extra GPU.
It could look like:
UCS_TEST_P(test_ucp_proto_mock_cuda_ipc, rndv_recv_ipc_unreachable,
"ZCOPY_THRESH=1")
{
ucp_worker_h worker = sender().worker();
ucp_worker_cfg_index_t rkey_cfg_index, unreachable_cfg_index;
ucp_rkey_config_key_t rkey_config_key;
ucp_md_index_t dst_md_index;
/* Real CUDA RMA to obtain a populated rkey config */
rkey_cfg_index = send_recv_rma(UCS_MBYTE, UCP_OP_ID_PUT,
UCS_MEMORY_TYPE_CUDA);
ASSERT_NE(UCP_WORKER_CFG_INDEX_NULL, rkey_cfg_index);
dst_md_index = cuda_ipc_dst_md_index();
ASSERT_NE(UCP_NULL_RESOURCE, dst_md_index);
/* Same config, but with cuda_ipc rejected at unpack */
rkey_config_key = ucs_array_elem(&worker->rkey_config, rkey_cfg_index).key;
rkey_config_key.md_map &= ~UCS_BIT(dst_md_index);
rkey_config_key.unreachable_md_map = UCS_BIT(dst_md_index);
ASSERT_UCS_OK(ucp_worker_rkey_config_get(worker, &rkey_config_key, NULL,
&unreachable_cfg_index));
ucp_proto_select_key_t key = any_key();
key.param.op_id_flags = UCP_OP_ID_RNDV_RECV;
key.param.op_attr = 0;
key.param.mem_type = UCS_MEMORY_TYPE_CUDA;
/* cuda_ipc must not be selected; host staging is used instead */
check_rkey_config(sender(), {
{1, INF, "pipeline", "cuda_copy"},
}, key, unreachable_cfg_index);
}There was a problem hiding this comment.
Done, following the proposed approach.
| UCS_TEST_SKIP_R("NVML peer accessibility is unavailable"); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
maybe also in UCT to test fallback:
/*
* When NVML cannot resolve the peer, the capability check must not decide
* reachability: it has to return UCS_TRY so the memhandle probe still runs.
*/
UCS_TEST_P(test_cuda_ipc_md, nvml_peer_unresolved_falls_back)
{
constexpr size_t size = 4096;
CUuuid unknown_uuid;
CUdevice cu_dev;
CUdeviceptr ptr;
ASSERT_EQ(CUDA_SUCCESS, cuDeviceGet(&cu_dev, 0));
/* UUID of no device on this system */
memset(unknown_uuid.bytes, 0xAB, sizeof(unknown_uuid.bytes));
EXPECT_EQ(UCS_TRY,
uct_cuda_ipc_nvml_peer_accessible(cu_dev, &unknown_uuid));
/* End-to-end: unpack keeps the pre-existing probe verdict */
ASSERT_EQ(CUDA_SUCCESS, cuMemAlloc(&ptr, size));
unpack_common(md(), 0xABABABABABABABABLL, ptr, size);
EXPECT_EQ(CUDA_SUCCESS, cuMemFree(ptr));
}There was a problem hiding this comment.
Added nvml_peer_unresolved, which checks that an unknown UUID returns UCS_TRY. I didn't add the unpack_common() part, because it expects UCS_ERR_UNREACHABLE in the same process both when NVML returns UCS_TRY and when it returns UCS_NO, so it can't tell the two apart. I believe the existing posix_fd_same_node_ipc test already covers the end-to-end case. It unpacks an rkey with a fake UUID and expects UCS_OK, which passes only if NVML returns UCS_TRY and the handle probe runs.
…t-native-peer-access
When a remote key MD could not be unpacked, the peer is expected to fail unpacking the same MD from the local key. Mirror ucp_ep_rkey_unpack_internal() in the synthetic remote key used for nested protocol estimation by moving such MDs from md_map to unreachable_md_map instead of dropping them, so the two maps stay disjoint and the key matches the configuration the peer creates. This also covers protocols which keep their full packed MD map, such as rndv/rtr/mtype with CUDA staging buffers, which would otherwise estimate the peer write through CUDA IPC for GPU pairs without native P2P access.
Keep CUDA IPC reachable when NVML reports native P2P support in either direction, and reject it only when neither read nor write is supported. Also address review comments: return ucs_ternary_auto_value_t, resolve NVML devices through a shared helper, use NVML_DEVICE_UUID_BUFFER_SIZE instead of NVML_DEVICE_UUID_ASCII_LEN which is missing from older NVML headers, compare memcmp() explicitly, cache only an explicit NVML rejection, and log the rejected remote buffer. Signed-off-by: Peter Andreas Entschev <peter@entschev.com>
| */ | ||
| rkey_config_key.md_map = ucp_proto_rndv_md_map_to_remote(params, | ||
| md_map); | ||
| if (params->super.super.rkey_config_key != NULL) { |
There was a problem hiding this comment.
I tried this, and it brings back the slow path. On g7e GPU4 -> GPU6 (NODE, no native P2P), RNDV_RECV selected rndv/rtr/mtype with a CUDA staging buffer, and the peer wrote to it through cuda_ipc.
rtr/mtype still packs cuda_ipc for its staging buffer, but the peer cannot unpack it for the same GPU pair. So the estimate without cuda_ipc matches what the peer can actually use. With https://github.com/openucx/ucx/pull/11979/changes#r4131274778, the synthetic key now matches the peer's unpack result: the packed MDs are split into md_map and unreachable_md_map, like ucp_ep_rkey_unpack_internal() does. The new rndv_recv_unreachable test covers this case and fails if the mask is skipped for KEEP_MD_MAP.
| */ | ||
| rkey_config_key.md_map = ucp_proto_rndv_md_map_to_remote(params, | ||
| md_map); | ||
| if (params->super.super.rkey_config_key != NULL) { |
There was a problem hiding this comment.
Added test_ucp_proto_mock_cuda_ipc.rndv_recv_unreachable. rndv/rtr already removed unreachable MDs from its packed RTR map in ucp_proto_rndv_ctrl_init_priv(). The gap was the nested remote estimate, mostly for rndv/rtr/mtype, which keeps its packed MD map. So the test checks the RNDV_RECV selection instead of rtr_md_map().
| bytes[15]); | ||
| } | ||
|
|
||
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, |
| bytes[15]); | ||
| } | ||
|
|
||
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, |
There was a problem hiding this comment.
Done, with the uct_cuda_ipc_nvml_device_by_uuid() structure you proposed and a loop over the READ/WRITE capabilities. The loop returns UCS_YES on the first supported direction as requested in https://github.com/openucx/ucx/pull/11979/changes#r4131304643.
| rkey->stream_id = cache->dev_num; | ||
| accessible = &cache->accessible[cu_dev]; | ||
| if (ucs_unlikely(*accessible == UCS_TRY)) { /* unchecked, add to cache */ | ||
| *accessible = uct_cuda_ipc_nvml_peer_accessible( |
| *accessible = uct_cuda_ipc_nvml_peer_accessible( | ||
| cu_dev, &rkey->super.super.uuid); | ||
| if (*accessible == UCS_NO) { | ||
| ucs_debug("CUDA IPC peer does not support native P2P access"); |
There was a problem hiding this comment.
Done. The log now names the NVML P2P check step and prints the local device, remote buffer address and length.
|
|
||
|
|
||
| int uct_cuda_ipc_nvml_peer_accessible(CUdevice cu_dev, | ||
| const CUuuid *remote_uuid); |
| EXPECT_FALSE(cuda_ipc_md->enable_mnnvl); | ||
| } | ||
|
|
||
| UCS_TEST_P(test_cuda_ipc_md, nvml_peer_accessibility) |
There was a problem hiding this comment.
Done, following the proposed approach.
| UCS_TEST_SKIP_R("NVML peer accessibility is unavailable"); | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Added nvml_peer_unresolved, which checks that an unknown UUID returns UCS_TRY. I didn't add the unpack_common() part, because it expects UCS_ERR_UNREACHABLE in the same process both when NVML returns UCS_TRY and when it returns UCS_NO, so it can't tell the two apart. I believe the existing posix_fd_same_node_ipc test already covers the end-to-end case. It unpacks an rkey with a fake UUID and expects UCS_OK, which passes only if NVML returns UCS_TRY and the handle probe runs.
|
🤖 Starting review — findings will be posted here when done. |
|
Tested on Vera Rubin: cuda_ipc is still used at full NVLink bandwidth intra-node and inter-node (MNNVL), including under MPS with MLOPart. New gtests pass. |
PR openucx#11979 marks the MDs which could not be unpacked from the peer's rkey as unreachable also in the nested remote protocol estimation, assuming the peer would fail the same way when accessing local buffers. This holds when the devices cannot access each other, but not when only the remote buffer cannot be mapped, e.g. a memory pool allocation without an exportable handle type (NO_IPC). The peer can then still access local buffers which have their own handle, such as the rndv/rtr/mtype fragments, and excluding cuda_ipc from the estimation makes the receiver fall back to much slower protocols (e.g. sysv copy-in copy-out on GB200, ~7x slower end to end). cuda_ipc rkey unpack now returns UCS_ERR_UNSUPPORTED when the failure is known to be specific to the remote memory handle: the remote buffer has no IPC handle, or mapping failed although NVML reports P2P access between the devices. It keeps returning UCS_ERR_UNREACHABLE when NVML reports no P2P access, and when mapping failed and NVML cannot tell whether P2P access exists, since missing P2P access may then be the cause. The NVML verdict takes precedence over the NO_IPC check. UCP treats both statuses as unreachable for the remote key, so protocol selection for that key does not change, and records UCS_ERR_UNREACHABLE MDs also in a new rkey config field, peer_unreachable_md_map, which is the only one propagated to the remote protocol estimation.
| if (UCT_CUDADRV_FUNC(cuDeviceGetUuid(&local_uuid, cu_dev), | ||
| UCS_LOG_LEVEL_DEBUG) != UCS_OK) { | ||
| return UCS_TRY; | ||
| } | ||
|
|
||
| if (memcmp(&local_uuid, remote_uuid, sizeof(local_uuid)) == 0) { | ||
| return UCS_YES; | ||
| } | ||
|
|
||
| if ((uct_cuda_ipc_nvml_device_by_uuid(&local_uuid, &local_device) != | ||
| UCS_OK) || | ||
| (uct_cuda_ipc_nvml_device_by_uuid(remote_uuid, &remote_device) != | ||
| UCS_OK)) { | ||
| return UCS_TRY; | ||
| } |
There was a problem hiding this comment.
@tvegas1
I'm not sure I understand this logic.
CUDA driver sees two GPUs with MPS with MLOPart, and NVML sees only one. Does cuDeviceGetUuid return the same UUID for two different CUdevices in this case?
There was a problem hiding this comment.
No. Each MLOPart device has its own UUID, different from the UUID of the underlying GPU, and NVML is not aware of these UUIDs (MPS docs, "Limitations of Locality Domains": https://docs.nvidia.com/deploy/mps/when-to-use-mps.html). I also checked it on GB200 with start_server -uid <uid> -mlopart: the driver then exposes 8 CUDA devices, two per GPU with the same PCI address (e.g. devices 0 and 1 are both 0008:01:00.0), cuDeviceGetUuid() returns a different UUID for each of them, and nvmlDeviceGetHandleByUUID() returns NVML_ERROR_NOT_FOUND for all 8. So uct_cuda_ipc_nvml_peer_accessible() returns UCS_TRY, and the handle-mapping probe decides, the same as before this PR.
If two CUdevices did return the same UUID, the memcmp() shortcut would return UCS_YES. That still doesn't skip the probe, because uct_cuda_ipc_is_peer_accessible() only short-circuits on UCS_NO. So with MLOPart this check can't reject a peer, whatever the UUIDs look like: UCS_NO is only possible when NVML resolves both UUIDs to two different physical GPUs and reports that neither P2P read nor write is supported.
With MLOPart, cudaIpcOpenMemHandle() works both between the two partitions of a GPU and across GPUs (~750 GB/s device copy), and ucx_perftest -t tag_bw -m cuda uses rendezvous zero-copy read from remote | cuda_ipc/cuda: 848 GB/s between the two partitions of one GPU, 737 GB/s between partitions of different GPUs. This is consistent with what @tvegas1 saw on Vera Rubin.
| rkey->stream_id = cache->dev_num; | ||
| accessible = &cache->accessible[cu_dev]; | ||
| if (ucs_unlikely(*accessible == UCS_TRY)) { /* unchecked, add to cache */ | ||
| peer_accessible = uct_cuda_ipc_nvml_peer_accessible( |
There was a problem hiding this comment.
What prevents us from completely removing the opening the IPC handle from accessibility check?
Have you faced any cases where it was not enough?
It looks like for cuIpcOpenMemHandle it's enough to check P2P status. There is still an open question: how does it work with MPS/MLOPart.
There was a problem hiding this comment.
The P2P status alone is not enough, for two reasons:
- NVML can't always answer. The check returns
UCS_TRYwhen NVML is not available or fails to initialize, or when a UUID is unknown to NVML. The latter includes MLOPart devices (see UCT/CUDA: Reject IPC without P2P read/write support #11979 (comment), where NVML resolves neither the local nor the remote UUID while IPC works at full NVLink bandwidth) and remote GPUs on another node with multi-node NVLink, whose UUID is never known to the local NVML (nvmlDeviceGetHandleByUUID()returns "Not Found" on GB200 NVL72, and importing the fabric handle is the only check we have). Without the probe we would have to either accept or reject every such peer. - P2P support doesn't mean the buffer can be mapped. Importability depends on the handle type, which is why the device cache key includes the handle type (
uct_cuda_ipc_uuid_hash_key_t). We hit this in UCT/CUDA_IPC/UCP: Propagate only peer-level cuda_ipc unreachability #12344: memory from a pool without an exportable handle type is packed asNO_IPC, and mapping it fails even though NVML reports P2P access. Legacy IPC handles from another node, fabric imports without IMEX channel access and POSIX FD imports from another machine/PID namespace or withoutpidfd_getfd()permission can fail the same way. If the rkey unpacked successfully in these cases, the error would only show up later, whenuct_cuda_ipc_map_remote_addr()fails in put/get, where UCP can no longer switch protocols, so the request would fail. Failing at unpack time lets UCP select a different protocol instead.
The opposite also holds, which is why this PR added the NVML check on top of the probe: on the g7e system in the description cuIpcOpenMemHandle() succeeds between GPUs without native P2P (0.88 GB/s), so the probe alone accepts a pair that should be rejected. On g7e we never saw NVML report P2P support for a pair where cuIpcOpenMemHandle() then failed with cudaMalloc buffers, so for legacy handles NVML is enough on topologies it knows about, but not for the other handle types or the cases above. On other systems the probe also catches missing P2P; e.g. on a DGX-1 V100, for a GPU pair which NVML reports as NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED, cudaIpcOpenMemHandle() fails with "peer access is not supported between these two devices".
The probe is also cheap: it runs once per local device, remote device and handle type, and when it succeeds the mapping goes into the IPC cache and the first put/get reuses it.
For MPS/MLOPart, as in the other thread: NVML returns UCS_TRY for the partition UUIDs and the probe succeeds, so cuda_ipc is used within a GPU and across GPUs at full bandwidth.
What?
Prevent CUDA IPC from being selected when NVML reports that the local and remote GPUs support neither P2P read nor P2P write access.
During CUDA IPC rkey unpack, UCX now looks up the local and remote GPU UUIDs in NVML. If both P2P capabilities are explicitly unsupported, the rkey is marked unreachable. UCP then records the rejected memory domain as unreachable in the remote rkey it models for nested rendezvous selection. This lets the existing host-staged pipeline be selected.
If NVML cannot resolve the peer or reports an unknown P2P status, the existing IPC handle-mapping probe still decides reachability.
Why?
Importing a CUDA IPC handle successfully does not mean the GPU pair supports native P2P access. The test system is an AWS
g7e.48xlargewith 8 x NVIDIA RTX PRO 6000 Blackwell Server Edition GPUs. On it, CUDA allows mapping memory between GPUs behind different PCIe bridges, even though NVML reports P2P access as unsupported. Transfers through that mapping are extremely slow.So with
cuda_ipcenabled, UCX would not select its faster host-staged pipeline. Users had to disable the transport explicitly.The system has eight GPUs arranged as four same-bridge pairs:
GPU0-GPU1,GPU2-GPU3,GPU4-GPU5, andGPU6-GPU7:PIXNODESYSNVML reports P2P read and write as supported for the
PIXpairs andNVML_P2P_STATUS_NOT_SUPPORTEDfor everyNODEandSYSpair. The same capability matrix was seen on a second identicalg7e.48xlarge.Results for
ucx_perftest -t tag_bw -m cudawith 100 MiB messages,-O 2,UCX_TLS=^srd, 100 iterations, and processes pinned to the GPUs' NUMA node:cuda_ipcdisabledNODE, P2P unsupportedNODE, P2P unsupportedcuda_copy/CMA host-staged pipelineNODE, P2P unsupportedcuda_copy/CMA host-staged pipelineNODE, P2P unsupportedcuda_copy/CMA host-staged pipelinePIX, P2P supportedOn unsupported pairs the patched build matches running with
cuda_ipcdisabled, whilecuda_ipcstays enabled and is still used for the supportedPIXpair. Host-staged bandwidth varies between runs, ranging from about 33 to 44 GB/s.How?
The packed CUDA IPC rkey already contains the remote GPU UUID. During rkey unpack, UCX now:
UCS_ERR_UNREACHABLEwhen both capabilities are explicitly unsupported.CUDA IPC has one reachability result that covers both GET and PUT. Rejecting the pair only when neither direction is supported keeps the existing behavior on topologies that support just one direction.
During nested rendezvous selection, UCP models the remote protocol with a synthetic remote rkey that describes the local buffer. The peer is expected to fail to unpack the same memory domains that failed locally. These domains are therefore moved from
md_maptounreachable_md_mapin the synthetic key, matching whatucp_ep_rkey_unpack_internal()produces on the peer. This also covers rndv/rtr/mtype with CUDA staging buffers, which keeps its full packed MD map. Without it, the peer's write through CUDA IPC would still be estimated, and the slow path would be selected again.This is a conservative capability check, not a bandwidth heuristic. GPU pairs for which NVML reports P2P read or write support remain eligible for CUDA IPC.