Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions buildlib/az-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,23 @@ check_nv_peer_mem() {
fi
}

# UCM modules (libucm_cuda, libucm_rocm, ...) must not call into libucs: they
# are loaded with dlopen and do not link libucs, so when UCX itself is loaded
# with RTLD_LOCAL the symbol is not found, and lazy binding hides this until
# the call runs. Run from the build directory.
check_ucm_no_ucs_symbols() {
Comment thread
ankith117 marked this conversation as resolved.
Resolved
ucm_modules=$(find src/ucm -path '*/.libs/libucm_*.so*' -type f)
if [ -z "${ucm_modules}" ]; then
azure_log_error "No UCM modules found in $(pwd)/src/ucm"
exit 1
fi

if nm -D --undefined-only ${ucm_modules} | grep -E '\bU ucs_'; then
Comment thread
ankith117 marked this conversation as resolved.
Resolved
azure_log_error "UCM modules have undefined libucs symbols"
exit 1
fi
}

#
# try load cuda modules if nvidia driver is installed
#
Expand Down
1 change: 1 addition & 0 deletions buildlib/pr/cuda/test_malloc_hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ test_malloc_hook() {
check_gpu 'gpu'
prepare
build
check_ucm_no_ucs_symbols
check_cuda_driver
test_malloc_hook
1 change: 1 addition & 0 deletions buildlib/pr/rocm/test_malloc_hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ test_malloc_hook() {

prepare
build
check_ucm_no_ucs_symbols
check_rocm_driver
test_malloc_hook
4 changes: 3 additions & 1 deletion src/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ layer boundaries below.
specific transport backend unless the existing code already does so.
- `ucm`: memory allocation/event interception and memory hook logic. Be careful
with initialization order, async-signal-safety assumptions, and interactions
with external allocators.
with external allocators. UCM modules (`libucm_cuda`, `libucm_rocm`, ...)
must not link or call into `libucs`; use UCS headers only for macros and
inline functions.
- `tools`: user-facing utilities. Keep command-line behavior and output stable
unless the task explicitly changes it.

Expand Down
2 changes: 1 addition & 1 deletion src/ucm/cuda/cudamem.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ static ucs_status_t ucm_cudamem_install(int events)

out_unlock:
if (status != UCS_OK) {
ucm_diag("failed to install cuda hooks: %s", ucs_status_string(status));
ucm_diag("failed to install cuda hooks: status %d", status);
}
pthread_mutex_unlock(&install_mutex);
out:
Expand Down
7 changes: 3 additions & 4 deletions src/ucm/rocm/rocmmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,14 @@ static ucs_status_t ucm_rocmmem_install(int events)
if (installed_hooks & UCM_GPU_HOOK_MODES_MASK) {
status = UCS_OK;
if ((bistro_status != UCS_OK) || (reloc_status != UCS_OK)) {
ucm_warn("rocm hooks installed with one mechanism only (bistro: %s, "
"reloc: %s)", ucs_status_string(bistro_status),
ucs_status_string(reloc_status));
Comment thread
ankith117 marked this conversation as resolved.
Resolved
ucm_warn("rocm hooks installed with one mechanism only (bistro: %d, "
"reloc: %d)", bistro_status, reloc_status);
Comment thread
ankith117 marked this conversation as resolved.
Resolved
} else {
ucm_info("rocm hooks are ready");
}
} else {
status = (bistro_status != UCS_OK) ? bistro_status : reloc_status;
ucm_diag("failed to install rocm hooks: %s", ucs_status_string(status));
ucm_diag("failed to install rocm hooks: status %d", status);
Comment thread
tvegas1 marked this conversation as resolved.
Resolved
Comment thread
ankith117 marked this conversation as resolved.
Resolved
}

pthread_mutex_unlock(&install_mutex);
Expand Down
Loading