Skip to content

UCT/CUDA/CUDA_IPC: Unmap memhandle mapped at rkey unpack & rkey ptr. - #11288

Merged
rakhmets merged 17 commits into
openucx:masterfrom
rakhmets:topic/uct-cuda-ipc-destroy-rkey
Aug 4, 2026
Merged

rakhmets merged 17 commits into
openucx:masterfrom
rakhmets:topic/uct-cuda-ipc-destroy-rkey

Conversation

@rakhmets

@rakhmets rakhmets commented Mar 23, 2026 •

Copy link
Copy Markdown
Contributor

What?

Unregistered the CUDA IPC memory handle that was registered when unpacking the remote memory key and/or getting local pointer to remote memory.

Why?

CUDA IPC component does peer reachability check when unpacking the remote memory key. At the first reachability check it opens an inter process memory handle exported from another process. The component also may open an inter process memory handle exported from another process at getting local pointer to remote memory. If this handle is not closed, then the memory on the remote side cannot be released.

@rakhmets
rakhmets force-pushed the topic/uct-cuda-ipc-destroy-rkey branch 2 times, most recently from 93e5320 to 373daae Compare March 23, 2026 15:32
yosefe
yosefe previously requested changes Mar 24, 2026
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc_md.c Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc_cache.c Resolved
@rakhmets
rakhmets requested a review from yosefe March 24, 2026 15:40
@rakhmets
rakhmets marked this pull request as draft March 24, 2026 17:30
@rakhmets

rakhmets commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Converted to draft to prevent merging before #11292 to avoid merge conflicts in #11292.

@rakhmets
rakhmets force-pushed the topic/uct-cuda-ipc-destroy-rkey branch 7 times, most recently from 90d3956 to 3dffc60 Compare March 31, 2026 11:29
@rakhmets
rakhmets marked this pull request as ready for review March 31, 2026 11:35
@rakhmets rakhmets changed the title UCT/CUDA/CUDA_IPC: Unmap memhandle mapped at rkey unpack. UCT/CUDA/CUDA_IPC: Unmap memhandle mapped at rkey unpack & rkey ptr. Mar 31, 2026
@rakhmets

Copy link
Copy Markdown
Contributor Author

Converted to draft to prevent merging before #11292 to avoid merge conflicts in #11292.

Rebased and updated to cover ucp_rkey_ptr flow.

@rakhmets
rakhmets force-pushed the topic/uct-cuda-ipc-destroy-rkey branch from 3dffc60 to dcb2923 Compare March 31, 2026 14:17
@rakhmets
rakhmets force-pushed the topic/uct-cuda-ipc-destroy-rkey branch from dcb2923 to 01eca31 Compare March 31, 2026 14:20
Artemy-Mellanox
Artemy-Mellanox previously approved these changes Apr 9, 2026
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc_iface.c Resolved
Comment thread test/mpi/test_ucp_rkey_destroy.c Resolved
ofirfarjun7
ofirfarjun7 previously approved these changes Apr 9, 2026

@yosefe yosefe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this PR solve the leak when IPC cache is enabled (which is the default)?

Comment thread contrib/test_jenkins.sh Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc.inl Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc.inl Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc.inl Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc_ep.c Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc_md.c Resolved
Comment thread src/uct/cuda/cuda_ipc/cuda_ipc_md.c Resolved
@rakhmets

Copy link
Copy Markdown
Contributor Author

does this PR solve the leak when IPC cache is enabled (which is the default)?

No, it does not. This only solves when cache is disabled in order not to break the existing default behavior.

@rakhmets
rakhmets dismissed stale reviews from ofirfarjun7 and Artemy-Mellanox via 06e57c8 April 10, 2026 13:50
@openucx openucx deleted a comment from svc-nixl May 4, 2026
@rakhmets
rakhmets force-pushed the topic/uct-cuda-ipc-destroy-rkey branch from dfc13f1 to eb6bb06 Compare June 30, 2026 14:30
@rakhmets
rakhmets marked this pull request as draft June 30, 2026 14:30
@rakhmets
rakhmets marked this pull request as ready for review July 7, 2026 13:34
@rakhmets
rakhmets requested a review from ofirfarjun7 July 7, 2026 13:34
Comment thread test/mpi/test_ucp.c Resolved
Comment thread test/mpi/test_ucp_rkey_destroy.c Resolved
Comment thread test/mpi/test_ucp_rkey_destroy.c Resolved
@rakhmets
rakhmets merged commit 2f18f39 into openucx:master Aug 4, 2026
161 checks passed
michal-shalev added a commit to michal-shalev/ucx that referenced this pull request Aug 19, 2026
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