Skip to content

Use pinned memory for split and ensure_started - #2414

Merged
ericniebler merged 1 commit into
NVIDIA:mainfrom
vasama:fix-cuda-managed-memory-access
Nov 5, 2026
Merged

ericniebler merged 1 commit into
NVIDIA:mainfrom
vasama:fix-cuda-managed-memory-access

Conversation

@vasama

@vasama vasama commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

The following tests crash in WSL:

  • nvexec ensure_started can succeed a sender
  • nvexec ensure_started destroys completion storage
  • nvexec split can succeed a sender

This is because cudaDevAttrConcurrentManagedAccess is 0 and how the shared completion storage is allocated causes SIGSEGV in the continuation when a kernel is still running. This PR fixes the issue by using pinned host memory instead.

The shared completion storage of `split` and `ensure_started` was
allocated with `cudaMallocManaged`. The continuation task reads it on
the host as soon as the kernel that enqueues the task links it into the
queue, so the read overlaps that kernel. On devices where
`cudaDevAttrConcurrentManagedAccess` is 0, the host must not access
managed memory while a kernel is running, and the access fails with
SIGSEGV.

Allocate the storage from the context's pinned memory resource instead,
as the other users of continuation_task already do. Because that
resource is a pool that does not synchronize with the device on
deallocation, `split` now waits for its completion-copy event before
the storage is released.
@copy-pr-bot

copy-pr-bot Bot commented Nov 5, 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.

@ericniebler

Copy link
Copy Markdown
Collaborator

/ok to test 7e54987

@ericniebler
ericniebler merged commit 081ab7f into NVIDIA:main Nov 5, 2026
40 checks passed
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.

2 participants