Skip to content

cuda-async: non-blocking drop for in-flight device futures (reaper) - #1417

Draft
elibol wants to merge 1 commit into
mainfrom
feat/drop-reaper
Draft

elibol wants to merge 1 commit into
mainfrom
feat/drop-reaper

Conversation

@elibol

@elibol elibol commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Transplant of NVlabs/cutile-rs#305 (NVlabs/cutile-rs#305) onto cuda-rust after the repository move: one commit, original author and sign-off, host-crate paths following the move to the repository root.

Draft for review and record; not targeted at 0.4.0.

Dropping an in-flight DeviceFuture no longer synchronizes the stream on the dropping thread (an executor thread under select!/timeout). The result is released immediately: by the DeviceOp::execute contract every device-visible resource is already retained by the submission, so the result is a handle. The execution context is parked with the completion reactor behind a flag write enqueued after the abandoned work and released on a dedicated reaper thread when the flag lands; the reactor only hands off. Fallbacks are unchanged in effect: a context the reactor cannot take is dropped inline (the previous blocking wait), and faulted or capturing streams still leak the owners with a report, quiet when the fault was already delivered.

  • No 'static bound on outputs and no user Drop on our threads: only the ExecutionContext is parked.
  • cuda_async::reaper::parked() / reaped_total() for observability.
  • Behavior change for callers that used a future's drop as a barrier before touching a buffer through a raw device pointer; documented in the CHANGELOG.

…nstead of blocking

Dropping a DeviceFuture whose work is still in flight used to synchronize
the stream on the dropping thread, which under select!/timeout is an
executor thread. The result is a handle by the DeviceOp::execute contract
(every device-visible resource is retained by the submission), so it is
released immediately; the execution context is parked with the completion
reactor behind a flag write enqueued after the abandoned work and released
on a dedicated reaper thread when the flag lands. The reactor only hands
off, never releases. If the context cannot be parked it is dropped inline,
which is the previous blocking wait; faulted and capturing streams still
leak the owners with a report (quiet when the fault was already delivered).
reaper::parked() and reaper::reaped_total() expose the counts.

Signed-off-by: Melih Elibol <elibol@users.noreply.github.com>
@elibol elibol added post-migration-pr cutile-rs Tile programming model: cutile crates, compiler, macros, IR, kernels, and book labels Oct 8, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

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 post-migration-pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant