UCT/CUDA_COPY: Avoid dmabuf export probe when registrability is known - v1.23.x #12490
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #12490"
general
weight: 0.35
tvegas1
What?
Backport of #12333 (fixes #12331) to v1.23.x. #12333 avoids the dmabuf export probe in
uct_cuda_copy_md_is_registrable()when the allocation properties already determine the outcome.This PR also contains the two changes #12333 builds on, each as a separate commit:
1. #12176
GTEST/UCT: Skip tests which assume GDR capable memory under MPS MLOPart2. #12055
UCT/CUDA_COPY: Non GDR capable memory is non-registrable without DMABUF3. #12333
UCT/CUDA_COPY: Avoid dmabuf export probe when registrability is knownWhy?
Since #11553 (in v1.23.0), detecting
UCS_MEM_FLAG_REGISTRABLEexports and closes a dmabuf fd (cuMemGetHandleForAddressRange+close) for every new CUDA buffer. This makes rendezvous transfers from new CUDA buffers 4-5x slower (#12331).Measured on GB200 (Polyphe, driver 615.74, CUDA 13.2, DMA-BUF supported):
UCX_TLS=^ib,ud:aux, master with and without #12333:| | pool | cudaMalloc |
|---|---|---|
| without | 77.8 | 180.5 |
| with #12333 | 17.2 (4.5x) | 97.0 (1.9x) |
Pool memory then matches
UCX_CUDA_COPY_DMABUF=no(17.2).- reproducer pool memory: 86 -> 17.3 µs; cudaMalloc: 165-178 -> 78-91 µs;
- 2-node rapidsmpf shuffle benchmark: 283 -> 116 ms (v1.20.1: 140 ms);
- cudf-polars PDS-H Q9, SF30K, 4 x 4 GB200: 140.2 / 116.7 s -> 49.1 / 42.1 s per iteration (v1.20.1: 48.8 / 41.7 s).
#12055 also fixes a bug of its own. On systems without DMA-BUF, CUDA memory that is not GPUDirect RDMA capable was reported as registrable, and its registration failed with
ibv_reg_mr(): Bad address. This affects e.g. stream-ordered pools withCUDA_COPY_ASYNC_MEM_TYPE=cuda, asucx.confsets for Grace Hopper and Vera Rubin.How?
The changes are the same as on master:
uct_cuda_copy_alloc_props_twhile detecting the memory type. When dmabuf is supported,uct_cuda_copy_md_is_registrable()uses them to skip the export where the answer is known:- Memory that is GPUDirect RDMA capable, not localized and not allocated for PCIe only is registrable, without probing. This covers regular
cudaMallocmemory.- On a device that is not shared through MPS (
CU_DEVICE_ATTRIBUTE_MPS_ENABLED= 0), memory that is not localized is also registrable without probing. This covers stream-ordered pool memory.- Localized memory (VMM localized to a locality domain, or a pool whose pointers report a locality domain):
- without a sibling device, the result is the device's
GPU_DIRECT_RDMA_WITH_LOCALIZED_MEMORY_SUPPORTEDattribute;- with a sibling device, a pool or memory allocated for GDR over PCIe is registrable, because the dmabuf is then mapped through PCIe.
- Everything else, e.g. memory under MPS MLOPart, is still probed with a dmabuf export, as before.
- The pool locality is queried only for pool memory, and only when the CUDA headers support it. A configure check is added for
CU_DEVICE_ATTRIBUTE_GPU_DIRECT_RDMA_WITH_LOCALIZED_MEMORY_SUPPORTED.- New tests check that registrability matches an actual dmabuf export for regular, pool, VMM, multi-handle, localized and PCIe-only memory. They also check the non-dmabuf case.
mem_buffer::cuda_mem_is_gdr_capable(),test_md::check_registrable()andtest_md::check_dmabuf_export(). Tests that assume GDR capable memory are skipped when the driver reports none, e.g. under MPS MLOPart.Why #12055 and #12176 are in this PR
#12333 cannot be applied or tested without them, so they are prerequisites rather than independent backports:
is_gdr_capableregistrability logic that #12055 adds touct_cuda_copy_md_is_registrable(). Without #12055, the cherry-pick conflicts in four places incuda_copy_md.c, and resolving those conflicts would effectively mean backporting #12055 inside #12333.test_md::check_registrable(), which #12176 adds. #12055's test uses #12176'scuda_mem_is_gdr_capable()andcheck_dmabuf_export().With separate PRs, the #12333 PR could not build its tests until the other two were merged, in order. #12461 also bundled two master PRs (#11979 + #12344) into one v1.23.x backport. Each change stays a separate
cherry-pick -xcommit, so a rebase merge keeps them apart, and a squash merge lists all three.Backport notes
-
vmm_locality_domain_mem_type: on master the test istest_cuda_copy_md.vmm_locality_domain_mem_typeintest_cuda_ipc_md.cc. On v1.23.x it is stilltest_mem_alloc_device.vmm_locality_domain_mem_typeintest_switch_cuda_device.cc, so the hunk is applied there. It skips when locality domain 1 is missing, and fails when domain 0 cannot be allocated although domain 1 was.-
test_md.cc: the skip conditions are applied to thetest_gdr_copytests. On master they are also inside#if HAVE_DECL_GDR_PIN_BUFFER_V2, which v1.23.x does not have.- The lines this commit changes are identical to #12176 on master; only their location differs.
cuda_copy_md.c, because #12204 (not on v1.23.x) moveduct_cuda_copy_mem_release_fabric()tocuda/baseon master. Both sides are kept: the function stays where it is on v1.23.x, and the newuct_cuda_copy_alloc_props_tfollows it.test_switch_cuda_device.ccandcuda_vmm_mem_buffer.happly cleanly. Apart from context lines, the result is identical to e8427a295.