VPI - Vision Programming Interface

3.0 Release

The main entry-point to the API is the VPIStream object. More...

Typedefs

typedef struct VPIStreamImpl * VPIStream
 A handle to a stream.
 

Functions

VPIStatus vpiStreamCreateWrapperCUDA (CUstream cudaStream, uint64_t flags, VPIStream *stream)
 Wraps an existing cudaStream_t into a VPI stream. More...
 
VPIStatus vpiStreamCreate (uint64_t flags, VPIStream *stream)
 Create a stream instance. More...
 
void vpiStreamDestroy (VPIStream stream)
 Destroy a stream instance and deallocate all HW resources. More...
 
VPIStatus vpiStreamFlush (VPIStream stream)
 Submits all pending operations for execution. More...
 
VPIStatus vpiStreamSync (VPIStream stream)
 Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty). More...
 
VPIStatus vpiStreamWaitEvent (VPIStream stream, VPIEvent event)
 Pushes a command that blocks the processing of all future commands submitted to the stream until the event is signaled. More...
 
VPIStatus vpiStreamGetThreadHandle (VPIStream stream, VPINativeThreadHandle *handle)
 Returns OS-specific handle of the background stream processing thread. More...
 
VPIStatus vpiStreamGetFlags (VPIStream stream, uint64_t *flags)
 Gets the VPIStream flags passed during its creation. More...
 

Memory creation flags.

These flags can be used when creating images, pyramids or arrays.

enum  VPIBackend
 VPI Backend types. More...
 

Stream-specific flags.

#define VPI_STREAM_GREEDY   (1ULL << 63)
 Flushes operations to the backend at every submission.
 

Detailed Description

The main entry-point to the API is the VPIStream object.

This object represents a command queue (FIFO) storing a list of commands to execute. Commands might comprise running a particular CV algorithm or signaling an event in a particular backend. This allows the API functions to be executed asynchronously with respect to the calling thread. Invoking any CV function simply pushes a corresponding command to the command queue in the VPIStream instance and immediately returns. The queued commands then get consumed and dispatched to the associated backend device.

Enumeration Type Documentation

◆ VPIBackend

enum VPIBackend

#include </opt/nvidia/vpi3/include/vpi/Types.h>

VPI Backend types.

Enumerator
VPI_BACKEND_CPU 

CPU backend.

VPI_BACKEND_CUDA 

CUDA backend.

VPI_BACKEND_PVA 

PVA backend.

VPI_BACKEND_VIC 

VIC backend.

VPI_BACKEND_NVENC 

NVENC backend.

VPI_BACKEND_OFA 

OFA backend.

VPI_BACKEND_INVALID 

Invalid backend.

Definition at line 90 of file Types.h.

Function Documentation

◆ vpiStreamCreateWrapperCUDA()

VPIStatus vpiStreamCreateWrapperCUDA ( CUstream  cudaStream,
uint64_t  flags,
VPIStream stream 
)

#include </opt/nvidia/vpi3/include/vpi/CUDAInterop.h>

Wraps an existing cudaStream_t into a VPI stream.

CUDA algorithms are submitted for execution in the wrapped cudaStream_t. This allows to insert a VPI-driven processing into an existing CUDA pipeline. Algorithms can still be submitted to other backends.

The VPIStream doesn't own the cudaStream_t. It must be valid during VPIStream lifetime.

CUDA kernels can only be submitted directly to cudaStream_t if it's guaranteed that all tasks submitted to VPIStream are finished.

Parameters
[in]cudaStreamThe CUDA stream handle to be wrapped.
  • Mandatory, it can't be NULL.
[in]flagsBit field specifying the desired characteristics of the stream. VPI_BACKEND_CUDA is always added internally.
  • The field must be a combination of zero or more of the following flags:
  • If flag VPI_REQUIRE_BACKENDS is given, user must pass at least one valid backend that is enabled in current context.
[out]streamPointer that will receive the newly created VPIStream.
Return values
VPI_ERROR_INVALID_ARGUMENTOutput stream is NULL.
VPI_ERROR_INVALID_ARGUMENTInput cudaStream is NULL.
VPI_ERROR_INVALID_ARGUMENTNo backend were given and VPI_REQUIRE_BACKENDS is set.
VPI_ERROR_OUT_OF_MEMORYNot enough resources to create array.
VPI_ERROR_INVALID_OPERATIONRequested backend isn't enabled in current context.
VPI_ERROR_INVALID_CONTEXTCurrent context is destroyed.
VPI_SUCCESSOperation executed successfully.

◆ vpiStreamCreate()

VPIStatus vpiStreamCreate ( uint64_t  flags,
VPIStream stream 
)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Create a stream instance.

Parameters
[in]flagsBit field specifying the desired characteristics of the stream.
[out]streamPointer to memory that will receive the created stream handle.
Return values
VPI_ERROR_INVALID_ARGUMENTOutput stream handle is NULL.
VPI_ERROR_INVALID_ARGUMENTflags is invalid.
VPI_ERROR_INVALID_ARGUMENTNo backend were given and VPI_REQUIRE_BACKENDS is set.
VPI_ERROR_OUT_OF_MEMORYNot enough resources to allocate image.
VPI_ERROR_INVALID_CONTEXTCurrent context is destroyed.
VPI_ERROR_INVALID_OPERATIONRequested backend isn't enabled in current context.
VPI_SUCCESSOperation executed successfully.

◆ vpiStreamDestroy()

void vpiStreamDestroy ( VPIStream  stream)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Destroy a stream instance and deallocate all HW resources.

This operation will implicitly synchronize the stream to guarantee that all operations submitted to it are completed.

Parameters
[in]streamStream handle to be destroyed. Passing NULL is allowed, to which the function simply does nothing.

◆ vpiStreamFlush()

VPIStatus vpiStreamFlush ( VPIStream  stream)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Submits all pending operations for execution.

Parameters
[in]streamStream handle.
  • Mandatory, it can't be NULL.
Return values
VPI_ERROR_INVALID_ARGUMENTstream is NULL or doesn't represent a VPIStream instance.
VPI_SUCCESSOperation executed successfully

◆ vpiStreamSync()

VPIStatus vpiStreamSync ( VPIStream  stream)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty).

This function call is equivalent to atomically calling vpiEventRecord followed by vpiStreamWaitEvent.

The operation will implicitly flush the stream.

Parameters
[in]streamStream handle.
  • Mandatory, it can't be NULL.
Return values
VPI_ERROR_INVALID_ARGUMENTstream is NULL or doesn't represent a VPIStream instance.
VPI_SUCCESSOperation executed successfully

◆ vpiStreamWaitEvent()

VPIStatus vpiStreamWaitEvent ( VPIStream  stream,
VPIEvent  event 
)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Pushes a command that blocks the processing of all future commands submitted to the stream until the event is signaled.

Parameters
[in]streamStream handle.
  • Mandatory, it can't be NULL.
[in]eventEvent handle.
Return values
VPI_ERROR_INVALID_ARGUMENTOutput event is invalid.
VPI_ERROR_INVALID_ARGUMENTstream is NULL or doesn't represent a VPIStream instance.
VPI_SUCCESSOperation executed successfully

◆ vpiStreamGetThreadHandle()

VPIStatus vpiStreamGetThreadHandle ( VPIStream  stream,
VPINativeThreadHandle handle 
)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Returns OS-specific handle of the background stream processing thread.

Parameters
[in]streamStream handle.
  • Mandatory, it can't be NULL.
[out]handleStream processing thread handle.
Return values
VPI_ERROR_INVALID_ARGUMENTstream is NULL or doesn't represent a VPIStream instance.
VPI_ERROR_INVALID_ARGUMENTOutput handle pointer is NULL.
VPI_SUCCESSOperation executed successfully.

◆ vpiStreamGetFlags()

VPIStatus vpiStreamGetFlags ( VPIStream  stream,
uint64_t *  flags 
)

#include </opt/nvidia/vpi3/include/vpi/Stream.h>

Gets the VPIStream flags passed during its creation.

Parameters
[in]streamStream handle.
  • Mandatory, it can't be NULL.
[out]flagsPointer to variable where the flags will be stored into.
Return values
VPI_ERROR_INVALID_ARGUMENTstream is NULL or doesn't represent a VPIStream instance.
VPI_ERROR_INVALID_ARGUMENTOutput flags pointer is NULL.
VPI_SUCCESSOperation executed successfully.