Skip to content

fix(cuda-core): make no driver call on the retirement thread after exit - #1788

Open
physwkim wants to merge 1 commit into
NVIDIA:mainfrom
physwkim:fix/retire-at-exit
Open

physwkim wants to merge 1 commit into
NVIDIA:mainfrom
physwkim:fix/retire-at-exit

Conversation

@physwkim

Copy link
Copy Markdown

Fixes #1783. With this change the issue's repro under ncu with MALLOC_CHECK_=3 exits cleanly in 30 of 30 runs; 28 of 30 crashed before.

@copy-pr-bot

copy-pr-bot Bot commented Nov 12, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

The last Arc<Context> can drop inside a deferred cleanup, so the
retirement thread could call cuDevicePrimaryCtxRelease while exit() runs
the driver's own exit handlers. An atexit handler now waits for the
batch in flight, and the worker leaks whatever is retired after it.

Signed-off-by: Sang Woo Kim <[email protected]>
@elibol elibol added the cutile-rs Tile programming model: cutile crates, compiler, macros, IR, kernels, and book label Nov 12, 2026
@elibol

elibol commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

/ok to test 8ab280a

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cutile-rs Tile programming model: cutile crates, compiler, macros, IR, kernels, and book

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: cuda-core Context::drop runs on the detached retirement thread and races exit()

2 participants