Skip to content

UCT/IB/MLX5/GDAKI: Try VMM Fabric Allocation. - #11795

Merged
ofirfarjun7 merged 22 commits into
openucx:masterfrom
rakhmets:topic/rc-gda-alloc-vmm
Sep 14, 2026
Merged

ofirfarjun7 merged 22 commits into
openucx:masterfrom
rakhmets:topic/rc-gda-alloc-vmm

Conversation

@rakhmets

@rakhmets rakhmets commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

What?

GDAKI now tries CUDA VMM fabric allocation and falls back to cuMemAlloc if it is not available.

Why?

GDAKI previously always allocated with cuMemAlloc. VMM fabric allocations are created RDMA capability.
UCS_TRY keeps the old cuMemAlloc path on systems where CUDA VMM fabric allocation is not available.

@rakhmets
rakhmets force-pushed the topic/rc-gda-alloc-vmm branch from 5d499f0 to 4a5f958 Compare August 19, 2026 14:30
@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

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

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.h Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.h Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Test coverage: This is primarily a refactor plus the GDAKI fabric-path enablement (finding 4). The extracted uct_cuda_mem_alloc/uct_cuda_mem_free are exercised by existing cuda_copy allocation tests, but the new GDAKI-over-fabric-VMM path (VMM buffer + umem/dmabuf registration) has no obvious dedicated coverage. If finding 4 is intentional, please confirm which CI job or test validates GDAKI with fabric-VMM device memory.

@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

src/uct/ib/mlx5/gdaki/gdaki.c

GDAKI now takes the context-wide sync-memops write-lock (potential deadlock). Before this PR, GDAKI set sync-memops per pointer via cuPointerSetAttribute(SYNC_MEMOPS), which takes no context lock. After the change, uct_rc_gdaki_alloc calls uct_cuda_mem_alloc(), which internally calls uct_cuda_copy_sync_memops() -> uct_cuda_copy_set_ctx_sync_memops(), which may call cuCtxSetFlags(CU_CTX_SYNC_MEMOPS) and take the context write-lock. The comment at that call site documents that this deadlocks a progress thread against an application thread inside cudaLaunchKernel(), and the hazard is only pre-empted for the context current at cuda_copy MD open. GDAKI allocations happen at ep/channel-pool init on the GDAKI primary context (a different context) and can run concurrently with application kernels, so this path can now hit the documented deadlock the old per-pointer call avoided. Blocker-level question: can this deadlock against an app thread in cudaLaunchKernel()?

src/uct/cuda/cuda_copy/cuda_copy_md.c

Return value of fabric release is now silently dropped. uct_cuda_copy_mem_free previously propagated the status from uct_cuda_copy_mem_release_fabric. Now uct_cuda_mem_free is void and uct_cuda_copy_mem_free always returns UCS_OK, so a real fabric-release failure (e.g. cuMemRelease/cuMemUnmap error) is no longer reported to the uct_md_mem_free caller. Minor behavior change; if intentional, fine, but worth confirming since VMM release errors used to be surfaced.

src/uct/cuda/cuda_copy/cuda_copy_md.h

Doc typo: '@PARAM [in,out] granularity_p Allocation granularity,if fabric VMM is used' is missing a space after the comma — should be 'granularity, if fabric VMM is used'.

@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

src/uct/ib/mlx5/gdaki/gdaki.c

sync-memops context deadlock (blocker-level question): GDAKI's uct_rc_gdaki_alloc now routes through uct_cuda_mem_alloc → uct_cuda_copy_sync_memops → uct_cuda_copy_set_ctx_sync_memops, which can take the context write-lock. The code already contains a cuCtxGetFlags read-first mitigation that only calls cuCtxSetFlags when the flag is not yet set, which reduces (but does not fully eliminate, per its own comment) the documented hazard on non-MD-open contexts. Worth confirming this mitigation is considered sufficient for the GDAKI primary context.

Dropped fabric-release status: uct_cuda_mem_free is now void and uct_cuda_copy_mem_free always returns UCS_OK, so VMM release errors are no longer surfaced to the MD caller.

src/uct/cuda/cuda_copy/cuda_copy_md.h

Doc typo: missing space after comma in the granularity_p doc line.

Test coverage gap: the newly enabled GDAKI-over-fabric-VMM path (VMM buffer + umem/dmabuf registration, now that enable_fabric is UCS_TRY in uct_rc_gdaki_alloc) has no obvious dedicated CI coverage.

@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.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
@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

src/uct/ib/mlx5/gdaki/gdaki.c

Removed ep->mem.gpu_raw = 0 reset in uct_rc_gdaki_ep_reset_channels. Since gpu_raw is now a struct, it can no longer be zeroed with = 0, and the reset was dropped. I traced all paths: pooled mode never frees ep->mem.gpu_raw, and direct mode always populates it before any free. So there is no concrete double-free or use-after-free; the struct just carries stale bytes after cleanup.

Test coverage gap: The newly enabled GDAKI-over-fabric-VMM path (uct_rc_gdaki_alloc with enable_fabric == UCS_TRY, followed by umem/dmabuf registration of the VMM buffer) has no dedicated coverage. Existing fabric tests (test_switch_cuda_device.cc) only exercise CUDA_COPY_ENABLE_FABRIC via the cuda_copy MD, not the GDAKI registration path. Worth confirming which CI job validates GDAKI with fabric-VMM device memory.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.h Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.h Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage (already raised in earlier rounds): the GDAKI-over-fabric-VMM path has no dedicated CI coverage. Finding 1 makes that gap more relevant, since the peermem-only configuration is exactly the one no existing test or capability probe exercises.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.h Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage: no dedicated CI coverage for the GDAKI-over-fabric-VMM path (VMM buffer + umem/dmabuf registration). The direct ep_alloc_mode memory footprint with fabric enabled is also untested.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.h Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

Residual coverage (already raised in earlier rounds, not a new comment): the GDAKI-over-fabric-VMM path (VMM buffer + umem/dmabuf registration, enable_fabric == UCS_TRY) and the direct ep_alloc_mode footprint with granularity-rounded allocations still have no dedicated CI coverage.

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.h Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

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

Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
Comment thread src/uct/cuda/cuda_copy/cuda_copy_md.c Resolved
Comment thread src/uct/ib/mlx5/gdaki/gdaki.c Resolved
@ofirfarjun7
ofirfarjun7 merged commit a115492 into openucx:master Sep 14, 2026
162 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