You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cuda.core accepts any ctypes._CFuncPtr as a CUDA host callback and casts its address to CUhostFn without validating the declared ctypes signature. CUDA requires a callback compatible with void (*)(void*); passing an incompatible return type, argument list, or calling convention can cause undefined behavior when CUDA invokes it.
The shared callback resolver is used by both host callback node construction and HostCallbackNode.update().
Scope
Validate ctypes callback argument and return types against the CUhostFn ABI.
Handle platform-specific calling-convention requirements, including Windows.
Define behavior for untyped or explicitly cast _CFuncPtr objects without rejecting compatible existing use cases unnecessarily.
Apply the same validation to construction and update paths.
Add positive and negative tests, including an incompatible CFUNCTYPE.
Acceptance criteria
Clearly incompatible ctypes callback signatures are rejected before being passed to CUDA.
Valid callbacks continue to work on supported platforms.
The error identifies the required callback signature.
Activity
mdboom commentedon Jul 29, 2026
cuda-bindingshave a related issue. Callbacks usually take anintptr_tas a pointer to a callback function, and there is no type-checking done.