Submits a user-defined function that receives the stream's CUDA stream handle, so that custom CUDA kernels or external library CUDA calls can run in the same order as VPI work (including Tegra backends). More...
Typedefs | |
| typedef void(* | VPICUDAHostFunction) (cudaStream_t cudaStream, void *userData) |
| Pointer to a CUDA host function invoked with the stream's CUDA stream. More... | |
Functions | |
| VPIStatus | vpiSubmitCUDAHostFunction (VPIStream stream, VPICUDAHostFunction hostFunc, void *userData) |
| Submits a CUDA host function to run on the stream in submission order. More... | |
Submits a user-defined function that receives the stream's CUDA stream handle, so that custom CUDA kernels or external library CUDA calls can run in the same order as VPI work (including Tegra backends).
| typedef void(* VPICUDAHostFunction) (cudaStream_t cudaStream, void *userData) |
#include <vpi/CUDAInterop.h>
Pointer to a CUDA host function invoked with the stream's CUDA stream.
The callback runs on VPI's stream worker thread after all prior commands (VPI algorithms, Tegra backends, and previous callbacks) have been submitted. Launch custom CUDA kernels or call external libraries (e.g. cuBLAS, cuFFT) using cudaStream so that they execute in submission order with VPI work.
| [in] | cudaStream | The CUDA stream for this VPIStream's CUDA backend. |
| [in] | userData | Callback data passed to the submission function. |
Definition at line 93 of file CUDAInterop.h.
| VPIStatus vpiSubmitCUDAHostFunction | ( | VPIStream | stream, |
| VPICUDAHostFunction | hostFunc, | ||
| void * | userData | ||
| ) |
#include <vpi/CUDAInterop.h>
Submits a CUDA host function to run on the stream in submission order.
The callback is executed after all prior commands on the stream (including VPI Tegra and CUDA work) have been submitted. The callback receives the stream's CUDA stream so the user can launch custom kernels or call external CUDA libraries on it. Subsequent VPI submissions run after the callback, preserving order.
The stream must have the CUDA backend enabled (e.g. created with vpiStreamCreate or vpiStreamCreateWrapperCUDA with CUDA enabled). This call implicitly flushes the stream before enqueueing the callback.
| [in] | stream | Stream that will execute the callback (mandatory). |
| [in] | hostFunc | Callback to run with the CUDA stream (mandatory). |
| [in] | userData | Pointer passed unchanged to hostFunc. |
userData must remain valid until the callback has executed (for example, after vpiStreamSync).| VPI_ERROR_INVALID_ARGUMENT | stream or hostFunc is NULL. |
| VPI_ERROR_INVALID_OPERATION | Stream does not have CUDA backend enabled. |
| VPI_ERROR_INVALID_OPERATION | VPI not built with CUDA support. |
| VPI_ERROR_INVALID_CONTEXT | Current context was destroyed. |
| VPI_SUCCESS | Callback enqueued successfully. |