Skip to content

Allow host function call during CUDA graph capture#9279

Merged
kmaehashi merged 3 commits into
cupy:mainfrom
kmaehashi:fix-9274
Aug 4, 2025
Merged

Allow host function call during CUDA graph capture#9279
kmaehashi merged 3 commits into
cupy:mainfrom
kmaehashi:fix-9274

Conversation

@kmaehashi
Copy link
Copy Markdown
Member

This allows use of Stream.launch_host_func() during CUDA graph capture.
Closes #9274.

Comment on lines +918 to +921
# N.B. Currently this function should not be called during CUDA graph
# capture, as the reference to the callback/arg will be DECREFed on the
# first callback.
# Eventually this should be replaced by `_launchHostFuncUnmanaged`.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This PR keeps cupy.cuda.runtime.launchHostFunc backward-compatible as the fix needs to be backported to v13. Maybe we can change this in v14 in a follow-up PR.

@kmaehashi kmaehashi added cat:bug Bugs to-be-backported Pull-requests to be backported to stable branch prio:medium labels Aug 2, 2025
@kmaehashi
Copy link
Copy Markdown
Member Author

/test mini

@kmaehashi kmaehashi added this to the v14.0.0a2 milestone Aug 2, 2025
@kmaehashi kmaehashi merged commit 7dc9dc4 into cupy:main Aug 4, 2025
75 checks passed
@kmaehashi kmaehashi deleted the fix-9274 branch August 4, 2025 11:58
@chainer-ci
Copy link
Copy Markdown
Member

@kmaehashi Failed to backport automatically.


Not cleanly cherry-picked

kmaehashi added a commit to kmaehashi/cupy that referenced this pull request Aug 4, 2025
Allow host function call during CUDA graph capture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:bug Bugs prio:medium to-be-backported Pull-requests to be backported to stable branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launch_host_func doesn't work with CUDA Graph

3 participants