Repository navigation
Conversation
|
🤖 Starting review — findings will be posted here when done. |
| const CUuuid *uuid, CUdevice cu_dev, | ||
| int *is_local_p) | ||
| { | ||
| CUuuid local_uuid; |
There was a problem hiding this comment.
pls check the pid first and query the UUID only when it matches - every unmap now makes a cuDeviceGetUuid() driver call from the completion path (and per sgl entry), while for a remote peer the pid/pid_ns alone already decides.
| CUuuid local_uuid; | |
| CUuuid local_uuid; | |
| ucs_status_t status; | |
| if (!uct_cuda_ipc_is_rkey_local(pid, pid_ns)) { | |
| *is_local_p = 0; | |
| return UCS_OK; | |
| } | |
| status = UCT_CUDADRV_FUNC_LOG_ERR(cuDeviceGetUuid(&local_uuid, cu_dev)); | |
| if (status != UCS_OK) { | |
| return status; | |
| } | |
| *is_local_p = (memcmp(local_uuid.bytes, uuid->bytes, | |
| sizeof(local_uuid.bytes)) == 0); | |
| return UCS_OK; |
(docs/OptimizationStyle.md: "Cache expensive capability queries when the result is stable"; this also keeps the map path from paying for it on every operation.)
| return; | ||
| /* Match the cache bypass in uct_cuda_ipc_map_memhandle. */ | ||
| status = uct_cuda_ipc_is_local_mapping(pid, pid_ns, uuid, cu_dev, &is_local); | ||
| if ((status != UCS_OK) || is_local) { |
There was a problem hiding this comment.
on a cuDeviceGetUuid() failure we return before the cache lookup, so region->refcount is never decremented: the region stays pinned (uct_cuda_ipc_cache_evict_lru skips refcount>0) and is never closed, and all callers ignore the status. can we fall through to the cache path and treat a failed query as not-local, like uct_ze_ipc_unmap_memhandle which only returns early when there is nothing to release?
| ucs_sys_ns_t pid_ns; | ||
| uintptr_t d_bptr; | ||
| const void *mapped_addr; | ||
| CUuuid uuid; |
There was a problem hiding this comment.
which case does the old (d_bptr == mapped_addr) && uct_cuda_ipc_is_rkey_local() check get wrong? a same-process import always lands on a fresh VA, so the two conditions look equivalent, and the UUID now has to be copied into the event desc, every sgl entry and the release handle.
|
|
||
| status = UCT_CUDADRV_FUNC_LOG_ERR(cuDeviceGetUuid(&uuid, cu_dev)); | ||
| status = uct_cuda_ipc_is_local_mapping(key->pid, ext_key->pid_ns, | ||
| &key->uuid, cu_dev, &is_local); |
There was a problem hiding this comment.
minor: pls align continuation args to the open parenthesis (one more space); same in the new uct_cuda_ipc_is_local_mapping() declaration and in the new tests.
|
PR size and scope are fine (~200 added lines, fix + tests only). The new tests only exercise the same-process/same-device bypass and the invalid-device error path. The behavior change for a real remote peer (where the UUID differs) is covered only indirectly by the existing cuda_ipc UCP/UCT suites;
No secrets in the diff. |
What? / Why?
Use the same PID, PID namespace, and GPU UUID predicate to decide whether CUDA IPC map and unmap bypass the remote cache. This removes address equality from the release decision and makes it match the path that acquired the reference.
Master already restricts the equal-address shortcut to the local process and PID namespace (#11291). Map also checks the GPU UUID; unmap still uses virtual-address equality. This change makes those decisions consistent for every mapping.
How?
Validation
UCX_CUDA_IPC_ENABLE_SAME_PROCESS=y. The selection excludesmkey_pack_mempoolandmnnvl_disabled.The selected IPC coverage is 613 cases per setup, split into 612 tests using default reachability and one loopback test with same-process IPC enabled: A100 has 278 executed passes / 335 skips; GB200 has 282 executed passes / 331 skips. Both final groups have zero failures.
CUDA-disabled developer build and gtest build pass; none of the five CUDA-only tests are registered in that build.
The tests verify the identity predicate and metadata lifetime; they do not establish a real same-process cross-GPU equal-VA import.