[cuda.core] Add support for host_launch (host callback nodes / host function launches)
@Andy-Jost is already working on this.
Since Jul 9, 2026.
- Dominant language
- Cython
- Stars
- 3.4k
- Forks
- 329
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 116
Description
Feature Request
Add a host_launch (or equivalent) API to cuda.core that allows scheduling
Python callables (or C function pointers) to execute on the host as part of a
stream's work order. This is the cuLaunchHostFunc / cudaLaunchHostFunc
path (and its graph-node counterpart, host nodes via cuGraphAddHostNode).
Motivation
cuda.core currently exposes launch(...) for device kernels but has no
symmetric primitive for host work. This makes it impossible to express
mixed host/device work ordering in pure cuda.core terms — users must drop
to cuda.bindings for cuLaunchHostFunc, which breaks the cuda.core
abstraction boundary (streams, events, graphs).
Common use cases:
- Logging / progress callbacks ordered against GPU work without host-side
stream synchronization. - Triggering Python-side state transitions (e.g. buffer release, metric
updates) at a specific point in a stream. - Host nodes in CUDA graphs for workflows that need host-side compute or
notification steps between kernels.
Proposed Scope
- A top-level
host_launch(stream, fn, *args, **kwargs)(or
stream.launch_host(fn, ...)) that wrapscuLaunchHostFunc. - A corresponding graph node type (
HostNode) added to
cuda.core.graph._subclasses, alongside the existingEmptyNode,
MemcpyNode, etc. - Clear documentation of the callback threading / reentrancy restrictions
imposed by the CUDA driver (host functions run on an internal driver
thread; must not call any CUDA API). - An example under
cuda_core/examples/demonstrating a host callback
ordered between two kernels. - API reference entries in
cuda_core/docs/source/api.rst.
Related
- Driver API:
cuLaunchHostFunc,cuGraphAddHostNode - Runtime API:
cudaLaunchHostFunc - Part of cuda.core feature audit gap list (Nov 2025).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.