fix(cuda-core): require 'static on simt launch_host_function - #1388
Open
Rachit2323 wants to merge 1 commit into
Open
Rachit2323 wants to merge 1 commit into
Rachit2323 wants to merge 1 commit into
Conversation
The callback runs later on a driver thread, so it can't borrow locals. Fixes NVIDIA#1387 Signed-off-by: Rachit2323 <atreyrachit23@gmail.com>
Rachit2323
requested review from
elibol,
kkraus14,
nihalpasham and
rparolin
as code owners
October 5, 2026 10:17
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1387
Summary
launch_host_functionincuda-core/src/simt/stream.rsruns the callback later on a driver thread, but it didn't require'static. So a closure could borrow a local that's already dropped by the time it runs. The version inruntime.rsalready has the bound.Changes
'statictolaunch_host_functionandcallback_wrappercompile_faildoc test for a borrowing closureAll existing callers already pass
moveclosures, so nothing else needed changing.Testing
just -f cuda-oxide/Justfile checkpasses (the local mirror of CI: fmt, clippy, tests, guards, docs)cargo oxide run <example>passes, orcuda-oxide/scripts/smoketest.sh -o '^<example>$'On macOS (CUDA headers only, no GPU):
cargo check,cargo clippyandcargo fmt --checkpass for cuda-core and cuda-async. The new doc test passes, and the same snippet compiles on current main, so the test is checking the right thing. Haven't run it on a GPU.Checklist
git commit -s)