Repository navigation
[MUSA]Feat: musa support - #12107
[MUSA]Feat: musa support#12107superleo wants to merge 39 commits into
Conversation
|
🤖 CI Triage Agent — TL;DR: The "AUTHORS file check" failed because PR #12107's author ( Full analysisSummary: Codestyle stage "AUTHORS file check" exited with code 1 — Root cause: The pipeline step computes and inserted Implicated commit: [REDACTED:Hex High Entropy String] (PR #12107, branch File: Suggested fix: On the ./contrib/authors_update.sh <upstream-base>..HEAD
git add AUTHORS && git commit --amend --no-edit # or a separate "AUTHORS: add superleo" commitwhich adds Related: PR #12107 (openucx/ucx); no existing issue found for this failure signature — it is a per-PR onboarding step, expected for every first-time contributor.
|
|
hi @yosefe @shamisp @tonycurtis @brminich @hoopoepg This patch contains three logical areas: MUSA memory type/UCM integration, UCT MUSA and Would you prefer to review this as one dependent commit series, or should we split it into three PRs before review? |
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 Starting review — findings will be posted here when done. |
|
This is ~1.8k added lines in a single PR; pls split it (e.g. memory type + ucm hooks, uct base/md, musa_copy transport + tests) so each part can be reviewed on its own. How is the MUSA build validated? There is no Mode: REQUEST_CHANGES Residual coverage gaps:
|
Tested provider capabilitiesMemory-type and pointer contractThe integration test confirmed that:
A critical implementation contract was identified: on a memtype-cache miss, the current UCX path assumes host memory instead of taking the MUSA detection slow path. Consequently, MUSA buffers must be allocated after the UCX context and its memory hooks exist. This is now enforced by the NIXL driver ordering and documented for integrators. MUSA transport and data correctnessThe provider passed 17/17 hardware scenarios covering:
The transfer data uses non-zero patterns that encode peer, operation, descriptor index and offset. Both receiver-side notification validation and sender-side READ-back validation are byte-exact. Progress and error handlingThe caller-progress path was exercised without a backend progress thread. The target side periodically calls Peer-exit testing produced a bounded failure rather than an infinite wait. The NIXL layer exposes this as Resource behaviorA 1,000-cycle register/transfer/release/deregister test completed with stable device memory and a process RSS plateau. The observed RSS plateau is attributed to UCX pools rather than an unbounded leak, but it is material for multi-process deployments and should be included in capacity planning. |
|
🤖 Starting review — findings will be posted here when done. |
|
Suggested mode: Checked and not reported: Checked and not reported: Appending Checked and not reported: Duplicate Checked and not reported: Repeated Residual coverage gap: Residual coverage gap: |
|
🤖 CI Triage Agent — TL;DR: The ASan "roce on worker 0" job did not fail on any test or compile error — the Azure agent was shut down mid-build ("The agent has received a shutdown signal"), cancelling the Full analysisSummary: Build 141575, job "AddressSanitizer roce on worker 0", was cancelled by the CI agent during the gtest compilation phase of Root cause: Infrastructure, not code. The log shows uninterrupted compiler activity from 13:16:14 through 13:30:43 (largest gap between consecutive lines is only ~10 s, e.g. Implicated commit: none — commit [REDACTED:Hex High Entropy String] (PR #12107) is not implicated; the failure is agent-side cancellation. File: n/a (last compiled unit: Suggested fix: Re-run the "AddressSanitizer roce on worker 0" job — no code change is warranted. If it reproduces on this PR, check agent-pool health/preemption for that worker rather than UCX code. Secondary observation (not the failure, but it widens the window for such cancellations): the ASan configuration spends ~14.5 minutes of the job purely compiling Related:
|
|
🤖 Starting review — findings will be posted here when done. |
|
Do you have CLA signed? |
hi @iyastreb , the contributor guidance currently points to openucx.org/license, but the URL is not reachable now. |
|
🤖 Starting review — findings will be posted here when done. |
| ucm_reloc_patch_t *patch; | ||
| ucs_status_t status = UCS_OK; | ||
|
|
||
| if (!(events & (UCM_EVENT_MEM_TYPE_ALLOC | UCM_EVENT_MEM_TYPE_FREE))) { |
There was a problem hiding this comment.
Hooks cannot be disabled: cudamem.c/rocmmem.c gate installation on ucm_global_opts.cuda_hook_modes/rocm_hook_modes (and support bistro); the MUSA installer ignores configuration entirely. Can we gate this on a hook-mode option so the MUSA hooks can be disabled by configuration?
|
Residual coverage gap (new): nothing exercises the multi-GPU path — |
|
🤖 Starting review — findings will be posted here when done. |
| return UCS_ERR_UNSUPPORTED; | ||
| } | ||
|
|
||
| return uct_musa_base_query_pointer(address, length, info); |
There was a problem hiding this comment.
on a memtype-cache miss (the usual case for plain host buffers — the cache only tracks GPU allocations) every copy falls through to uct_musa_base_query_pointer(), so each put/get costs two musaPointerGetAttributes() plus muMemGetAddressRange()/musaGetDevice()/musaSetDevice(). cuda_copy treats UCS_ERR_NO_ELEM as host without any runtime call (uct_cuda_copy_get_mem_type()); can we do the same here?
There was a problem hiding this comment.
@svc-nvidia-pr-review This was implemented as suggested, but a later safety review found that a memtype-cache miss must not be classified as host memory in this TL: unlike cuda_copy, whose every copy is issued through the driver, the host-to-host path here is a CPU memcpy(), so a device pointer misclassified as host would crash the process when the hooks are disabled or bypassed. The upcoming change keeps the essence of this suggestion — the miss path no longer calls musaSetDevice()/muMemGetAddressRange(), and a cache hit still short-circuits — but adds one lightweight muPointerGetAttribute()-based classification on a miss. See the blocking thread on the same function for details.
|
Residual coverage gap: nothing exercises Residual coverage gap: |
|
🤖 Starting review — findings will be posted here when done. |
| return UCS_ERR_UNSUPPORTED; | ||
| } | ||
|
|
||
| return uct_musa_base_query_pointer(address, length, info); |
There was a problem hiding this comment.
on a memtype-cache miss (UCS_ERR_NO_ELEM, i.e. every plain host buffer) this falls back to the full pointer query — musaPointerGetAttributes + musaGetDevice/musaSetDevice/restore + muMemGetAddressRange — on each put/get. uct_cuda_copy_get_mem_type() assumes host memory for NO_ELEM and issues the copy directly; can we do the same to keep the data path free of driver calls?
|
Residual coverage gap: nothing exercises Residual coverage gap: |
|
🤖 CI Triage Agent — TL;DR: The gtest binary aborted on a debug assertion in the registration cache — Full analysisSummary: Azure job "Tests new on worker 0" (build 141739) failed with Root cause: Evidence from the log backtrace:
A cached region is created with This is not plausibly caused by the PR under test: the failing case is pure host memory over TCP with SW RMA emulation; the MUSA additions in this branch are an extra Implicated commit: unknown (not the PR head File: Suggested fix:
Related: PR #12107 (branch under test, |
|
🤖 Starting review — findings will be posted here when done. |
|
Coverage gap: nothing exercises the flush path with a completion (
Coverage gap: |
|
🤖 Starting review — findings will be posted here when done. |
|
🤖 Starting review — findings will be posted here when done. |
| * "domain:bus:slot.function" string (no per-attribute query). */ | ||
| err = musaDeviceGetPCIBusId(pci_bus_id, sizeof(pci_bus_id), (int)device); | ||
| if (err != musaSuccess) { | ||
| ucs_debug("musaDeviceGetPCIBusId(device=%u) failed: %s", device, |
There was a problem hiding this comment.
minor: pls use the NULL-safe helper added just above, so a runtime returning NULL does not reach the format string.
| ucs_debug("musaDeviceGetPCIBusId(device=%u) failed: %s", device, | |
| ucs_debug("musaDeviceGetPCIBusId(device=%u) failed: %s", device, | |
| uct_musa_error_string(err)); |
There was a problem hiding this comment.
fixed.Current code uses:uct_musa_error_string(err) instead of calling musaGetErrorString(err) directly
| return; | ||
| } | ||
|
|
||
| if (uct_musa_base_status(musaEventDestroy(event_desc->event), |
There was a problem hiding this comment.
minor: double warning - uct_musa_base_status() already prints "musaEventDestroy failed: " at warn level, so this adds a second line for one event. pls fold the device into the operation string instead (same pattern at the musaSetDevice/musaStreamDestroy calls in the iface cleanup).
| "musaGetDevice"); | ||
| } | ||
|
|
||
| ucs_status_t uct_musa_base_set_device(int device) |
There was a problem hiding this comment.
why not switch the device with muCtxPushCurrent()/muCtxPopCurrent() and issue the copies with the driver API, like cuda_copy does? The data path here uses musaSetDevice()/musaMemcpyAsync()/musaStreamSynchronize(), which consume and overwrite the application's runtime last-error - exactly the property uct_musa_md_mem_reg() and uct_musa_base_query_copy_pointer() take care to preserve.
There was a problem hiding this comment.
@svc-nvidia-pr-review . We kept the runtime API here: the streams (musaStreamCreateWithFlags) and buffers (musaMalloc/musaMallocManaged) are runtime-created, and muCtxPushCurrent() does not change the runtime's current device, so runtime async copies still need musaSetDevice(). Moving to driver copies would require primary-context push/pop infrastructure, driver streams, and reworking host registration in musa_copy_md — a cross-module change we'd rather do as a separate follow-up.
On last-error: it is only affected on failure, and the error is returned to the caller. On success it is untouched, which we now check in test_musa_copy.data_path_preserves_runtime_error (poison last-error, then put_zcopy + flush).
will follow up with the driver-API variant if that's preferred.
|
Residual coverage gap: the runtime-API data path is only covered by Residual coverage gap: Residual coverage gap: |
Signed-off-by: superleo <xlei.boll@gmail.com>
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| {"MUSA_HOOK_MODE", | ||
| #if UCM_BISTRO_HOOKS | ||
| UCM_MMAP_HOOK_BISTRO_STR "," UCM_MMAP_HOOK_RELOC_STR, |
There was a problem hiding this comment.
why is the default both bistro and reloc, unlike CUDA_HOOK_MODE?
ucm_musamem_install() installs bistro on the driver table and reloc on the runtime table, so a single musaMalloc() looks like it would dispatch two MEM_TYPE_ALLOC events - one from the runtime hook and one from the muMemAlloc* call the runtime makes internally (rocm can default to both because both modes hook the same single table).
| unsigned i; | ||
|
|
||
| uct_musa_base_sys_dev_status = | ||
| uct_musa_base_get_device_count(&uct_musa_base_num_devices); |
There was a problem hiding this comment.
minor: pls pass a local variable here; uct_musa_base_get_device_count() already writes uct_musa_base_num_devices into the out-param, so this assigns the global to itself.
|
Residual coverage gap: nothing exercises the hook-mode combination above - Residual coverage gap: |
Signed-off-by: superleo <xlei.boll@gmail.com>
|
🤖 Starting review — findings will be posted here when done. |
| @@ -104,6 +104,21 @@ static ucs_config_field_t ucm_global_config_table[] = { | |||
| ,ucs_offsetof(ucm_global_config_t, rocm_hook_modes), | |||
There was a problem hiding this comment.
New MUSA_HOOK_MODE entry with UCM_MMAP_HOOK_BISTRO_STR default: ucm_musa_runtime_funcs is installed only with UCM_MMAP_HOOK_RELOC, and ucm_install_hooks() returns early when the mode is not in the bitmap, so with this default the runtime hooks (musaMalloc/musaFree/...) are never installed. rocm, whose installer also uses both modes, defaults to bistro,reloc. Is bistro on the driver symbols enough to catch runtime allocations here?
| AC_SUBST([MUSA_ROOT]) | ||
| ], [ | ||
| AS_IF([test "x$with_musa" != "xguess"], [ | ||
| AC_MSG_ERROR([MUSA support was requested but MUSA headers and libraries were not found]) |
There was a problem hiding this comment.
minor: when the headers are found but one mandatory symbol is missing, the big mandatory AC_LINK_IFELSE fails without printing anything and this message still says headers and libraries were not found. pls add AC_MSG_CHECKING/AC_MSG_RESULT around that check so the real cause is visible.
|
Residual coverage gap: Residual coverage gap: nothing in Residual coverage gap: |
|
🤖 CI Triage Agent — TL;DR: The "Codestyle (commit title)" check failed because PR #12107 contains a commit titled Full analysisSummary: Azure Pipelines build 146850, job "commit title", exited with code 1 after the commit-title linter rejected one of the 37 commits in the PR. Summary of evidence: The Bash step output lists every commit title; all 36 others pass ( No build, hang, or timeout is involved — the step ran for ~0.2 s and failed deterministically on a title-format rule. Root cause: UCX CI enforces the commit-title convention Implicated commit: The offending commit is the one titled File: The failing check is the Codestyle "commit title" Bash step in the PR pipeline ( Suggested fix: Reword the bad commit so it matches the convention, then force-push: Since this branch already carries 37 incremental "Address review feedback" commits, the cleaner option is to squash the whole series into a few logically-scoped commits ( Related: PR #12107 (openucx/ucx) — no existing issue tracks this; the failure is specific to this branch's commit history.
|
|
🤖 Starting review — findings will be posted here when done. |
5bdb26b to
0835ad2
Compare
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| {"MUSA_HOOK_MODE", | ||
| #if UCM_BISTRO_HOOKS | ||
| UCM_MMAP_HOOK_BISTRO_STR, |
There was a problem hiding this comment.
With the default bistro, is ucm_musa_runtime_funcs ever installed? ucm_musamem_install() passes the runtime table only with UCM_MMAP_HOOK_RELOC, and ucm_install_hooks() silently returns UCS_OK when the mode bit is off, so musaMalloc/musaFree/musaMallocManaged/musaFreeHost get no hook by default (and the "installed partially" warning does not fire). ROCM_HOOK_MODE uses both modes for the same reason.
Suggested change:
UCM_MMAP_HOOK_BISTRO_STR "," UCM_MMAP_HOOK_RELOC_STR,
| return UCS_INPROGRESS; | ||
| } | ||
|
|
||
| flush = ucs_malloc(sizeof(*flush), "musa_copy_flush"); |
There was a problem hiding this comment.
can we take the flush descriptor from an mpool instead of ucs_malloc()? uct_cuda_iface_t keeps a flush_mpool for exactly this, and iface_flush(comp != NULL) is on the UCP flush path.
| /* Priority 10 matches cuda_util.c and rocm_base.c, so a GPU name replaces | ||
| * the bus-id label in ucx_info and the transport tables. */ | ||
| ucs_snprintf_safe(device_name, sizeof(device_name), "GPU%u", device); | ||
| status = ucs_topo_sys_device_set_name(sys_dev, device_name, 10); |
There was a problem hiding this comment.
minor: pls use a named constant for the name priority (cuda has UCT_CUDA_SYS_DEVICE_NAME_PRIORITY); the literal 10 right after char device_name[10] reads like a buffer length.
|
Residual coverage gap: Residual coverage gap: nothing covers the hook-mode selection above: Residual coverage gap: |
|
🤖 CI Triage Agent — TL;DR: The gtest run on the BlueField ASan job failed because LeakSanitizer reported 68 KB in 17 allocations all belonging to Full analysisSummary: Root cause: All leaked blocks are UCT/mlx5 resources created for that single test case:
The UCP context/worker structures themselves are not in the leak list (only 17 blocks), so this is not a wholesale "entity never destroyed" case: a specific iface/lane that is replaced when the test injects Implicated commit: [REDACTED:Hex High Entropy String] — "UCP/RMA: Balance GET by the path bandwidth samples of PUT (#12387)", dmitrygx, 2026-11-21 (landed ~22 h before this build; it added both File: test/gtest/ucp/test_ucp_proto_mock.cc:5216 (failing test) / src/ucp/core/ucp_worker.c:1119-1124 and 1077-1160 (speed-change reconfiguration path that leaks the UCT ep/iface) Suggested fix:
Related: #12387 (implicated), #12384, #12362, #12334, #12107 (this PR, unrelated to the leak)
|
What?
Add initial MUSA support to UCX .
The series includes:
UCS_MEMORY_TYPE_MUSAmemory type andmusaname;musaMallocandmusaFree;musa_copystaging transport for local MUSA/host transfers;musatransport selection throughmusa_copy;The MUSA component no longer exposes a zero-capability stub TL. The copy path is provided by
musa_copy, while large-message direct RDMA remains selected through the IB transports when available.Why?
NIXL requires UCX to distinguish MUSA device allocations from host memory and to select a real transport path for MUSA buffers. Without this support, MUSA allocations can be classified as host memory, the wrong protocol can be
selected, or the worker can select a zero-capability MUSA interface and abort.
This series provides the minimum UCX-side support needed to identify MUSA memory and use either local staging or the existing IB direct-RDMA path.
How?
The implementation is intentionally limited to ordinary MUSA device allocations.
Supported paths:
musa_copy;Managed memory, VMM allocations, IPC-specific paths, heterogeneous devices, and provider-specific direct-RDMA extensions are not claimed as complete features.
Test:
The MUSA test bed /S5000 demonstrated: