Skip to content

CUDA_IPC: Don't show CUDA error on exit, from static destroy - #11846

Open
iyastreb wants to merge 1 commit into
openucx:masterfrom
iyastreb:iyastreb/cuda-error-exit
Open

CUDA_IPC: Don't show CUDA error on exit, from static destroy#11846
iyastreb wants to merge 1 commit into
openucx:masterfrom
iyastreb:iyastreb/cuda-error-exit

Conversation

@iyastreb

@iyastreb iyastreb commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What?

Address ai-dynamo/nixl#2171

Why?

We should ignore this diagnostic on cleanup, because it's not a real issue, as all this mem handles will be destroyed anyway, as the cuda driver is shutting down

How?

Add log_level param

@svc-nvidia-pr-review

Copy link
Copy Markdown

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

status = uct_cuda_ipc_primary_ctx_retain_and_push(region->cu_dev,
log_level);
if (status != UCS_OK) {
return status;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uct_cuda_ipc_close_memhandle_legacy() now takes log_level, but this cuIpcCloseMemHandle() still logs at WARN. This is the call the STATIC_CLEANUP comment says is expected to fail during driver shutdown, so pls use UCT_CUDADRV_FUNC(..., log_level) here, otherwise the warning is not silenced.

@@ -157,11 +158,13 @@ static void uct_cuda_ipc_primary_ctx_pop_and_release(CUdevice cuda_device)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uct_cuda_ipc_primary_ctx_pop_and_release runs in the shutdown close path too, but ignores log_level and both cuCtxPopCurrent / cuDevicePrimaryCtxRelease log at WARN. pls thread log_level here as well so the driver-deinit failures are demoted consistently.

static ucs_status_t uct_cuda_ipc_close_memhandle(uct_cuda_ipc_cache_region_t *region)
static ucs_status_t
uct_cuda_ipc_close_memhandle(uct_cuda_ipc_cache_region_t *region,
ucs_log_level_t log_level)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

close_memhandle() takes log_level but only the legacy branch forwards it; the VMM/POSIX_FD (cuMemUnmap, cuMemAddressFree) and mempool (cuMemFree) branches still log at WARN. pls pass log_level here too, otherwise VMM/mempool regions still warn during driver shutdown.


status = UCT_CUDADRV_FUNC_LOG_ERR(cuCtxPushCurrent(cuda_ctx));
status = UCT_CUDADRV_FUNC(cuCtxPushCurrent(cuda_ctx), log_level);
if (status != UCS_OK) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

minor: after cuCtxPushCurrent fails, the compensating cuDevicePrimaryCtxRelease still logs at WARN even though the function now has log_level. pass log_level to this release too for consistency with the push above.

@svc-nvidia-pr-review

Copy link
Copy Markdown

Overall: the refactor threads log_level through the API correctly, but the implementation is incomplete relative to its stated goal. The operations that fail during CUDA driver shutdown (cuIpcCloseMemHandle, the ctx pop/release, and the VMM/mempool unmap/free calls) still log at WARN, so UCS_STATIC_CLEANUP will still emit warnings and the change does not fully deliver the intended log suppression.

Test coverage note: the only test update is a signature fix in test_cuda_ipc_md.cc; there is no test verifying the shutdown log level. This is hard to test in gtest, so the gap is acceptable but worth noting.

* releases all the mappings during its shutdown. */
kh_foreach_value(&uct_cuda_ipc_remote_cache.hash, rem_cache, {
uct_cuda_ipc_destroy_cache(rem_cache);
uct_cuda_ipc_destroy_cache(rem_cache, UCS_LOG_LEVEL_DEBUG);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe to reduce the amount of changes do the following:

  1. call some dummy cuda driver api method, e.g. cuDeviceGetCount
  2. if it returns CUDA_ERROR_DEINITIALIZED pass an option to uct_cuda_ipc_destroy_cache
  3. in uct_cuda_ipc_cache_purge close mem handles only if the option is true.

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.

3 participants