VPI - Vision Programming Interface

0.2.0 Release

Typedefs

typedef struct VPIEventImpl * VPIEvent
 

Functions

VPIStatus vpiEventCreate (uint32_t flags, VPIEvent *event)
 Create an event instance with the specified flags. More...
 
void vpiEventDestroy (VPIEvent event)
 Destroy an event instance as well as all resources it owns. More...
 
VPIStatus vpiEventWrapCudaEvent (CUevent cudaEvent, VPIEvent *event)
 Create an event object by wrapping around an existing CUDA CUevent object. More...
 
VPIStatus vpiEventRecord (VPIEvent event, VPIStream stream)
 Captures in the event the contents of the stream command queue at the time of this call. More...
 
VPIStatus vpiEventSync (VPIEvent event)
 Blocks the calling thread until the event is completed. More...
 
VPIStatus vpiEventQuery (VPIEvent event)
 Queries the status of all work currently captured by the event. More...
 
VPIStatus vpiEventElapsedTime (VPIEvent start, VPIEvent end, float *msec)
 Computes the elapsed time in (msec) between two completed events. More...
 

Event creation flags

#define VPI_EVENT_DISABLE_PVA   VPI_BACKEND_DISABLE_PVA
 Event can't be used by PVA backend.
 
#define VPI_EVENT_DISABLE_CPU   VPI_BACKEND_DISABLE_CPU
 Event can't be used by CPU backend.
 
#define VPI_EVENT_DISABLE_CUDA   VPI_BACKEND_DISABLE_CUDA
 Event can't be used by CUDA backend.
 
#define VPI_EVENT_DISABLE_TIMESTAMP   0x08
 disable time-stamping of event signaled state-change for better performance
 
#define VPI_EVENT_ONLY_PVA   VPI_BACKEND_ONLY_PVA
 shared helper flags More...
 
#define VPI_EVENT_ONLY_CPU   VPI_BACKEND_ONLY_CPU
 Event can only be used by CPU backend.
 
#define VPI_EVENT_ONLY_CUDA   VPI_BACKEND_ONLY_CUDA
 Event can only be used by CUDA backend.
 

Deprecated event creation flags

#define VPI_EVENT_NO_PVA   VPI_EVENT_DISABLE_PVA
 Deprecated.
 
#define VPI_EVENT_NO_CPU   VPI_EVENT_DISABLE_CPU
 Deprecated.
 
#define VPI_EVENT_NO_CUDA   VPI_EVENT_DISABLE_CUDA
 Deprecated.
 

Detailed Description

Each compute function in the API is executed asynchronously with respect to the calling thread, i.e., returns immediately without waiting for the completion. There are two ways of synchronizing with the backend. One is to wait until all the commands in the VPIStream queue are finished, with the vpiStreamSync call. This approach, while simple, doesn't allow for fine-grained ("wait for until function X is completed") or inter-device ("before running function A in device B, wait until function C in device D finishes") synchronization. That's where VPIEvent objects come in. Conceptually, they correspond to binary semaphores and are designed to closely mimic events in CUDA API:

Macro Definition Documentation

◆ VPI_EVENT_ONLY_PVA

#define VPI_EVENT_ONLY_PVA   VPI_BACKEND_ONLY_PVA

#include <vpi/Event.h>

shared helper flags

Event can only be used by PVA backend

Definition at line 113 of file Event.h.

Typedef Documentation

◆ VPIEvent

typedef struct VPIEventImpl* VPIEvent

#include <vpi/Types.h>

A handle to an event.

Definition at line 158 of file Types.h.

Function Documentation

◆ vpiEventCreate()

VPIStatus vpiEventCreate ( uint32_t  flags,
VPIEvent event 
)

#include <vpi/Event.h>

Create an event instance with the specified flags.

Parameters
flags[in] flags
event[out] pointer to event handle
Returns
an error code on failure else VPI_SUCCESS

◆ vpiEventDestroy()

void vpiEventDestroy ( VPIEvent  event)

#include <vpi/Event.h>

Destroy an event instance as well as all resources it owns.

Parameters
event[in] event handle

◆ vpiEventElapsedTime()

VPIStatus vpiEventElapsedTime ( VPIEvent  start,
VPIEvent  end,
float *  msec 
)

#include <vpi/Event.h>

Computes the elapsed time in (msec) between two completed events.

If one or both are not completed at the time of the call, VPI_ERROR_NOT_READY is returned, otherwise VPI_SUCCESS.

Parameters
start[in] an event handle marking the start of the time interval
end[in] an event handle marking the end of the time interval
msec[out] a pointer to a variable which will be set to the time difference between the events
Returns
an error code on failure, VPI_ERROR_NOT_READY if at least one event is not ready, else VPI_SUCCESS

◆ vpiEventQuery()

VPIStatus vpiEventQuery ( VPIEvent  event)

#include <vpi/Event.h>

Queries the status of all work currently captured by the event.

If all commands are complete, VPI_SUCCESS is returned, otherwise VPI_ERROR_NOT_READY.

Parameters
event[in] an event handle
Returns
an error code on failure, VPI_ERROR_NOT_READY if the event is not signaled, else VPI_SUCCESS

◆ vpiEventRecord()

VPIStatus vpiEventRecord ( VPIEvent  event,
VPIStream  stream 
)

#include <vpi/Event.h>

Captures in the event the contents of the stream command queue at the time of this call.

This function can be called multiple times on the same event, however, vpiEventSync / vpiStreamWaitFor are not affected by later calls to vpiEventRecord. This means they will wait for the event completion of the command queue tasks described by the event at the time of the initial vpiEventSync / vpiStreamWaitFor call.

Parameters
event[in] an event handle
stream[in] a stream handle
Returns
an error code on failure else VPI_SUCCESS

◆ vpiEventSync()

VPIStatus vpiEventSync ( VPIEvent  event)

#include <vpi/Event.h>

Blocks the calling thread until the event is completed.

The event is considered completed when all the commands captured with vpiEventRecord() are complete or when no commands were captured.

Parameters
event[in] an event handle
Returns
an error code on failure else VPI_SUCCESS

◆ vpiEventWrapCudaEvent()

VPIStatus vpiEventWrapCudaEvent ( CUevent  cudaEvent,
VPIEvent event 
)

#include <vpi/Event.h>

Create an event object by wrapping around an existing CUDA CUevent object.

The created event can be used by vpiEventSync / vpiStreamWaitFor to synchronize on a previously recorded CUDA event, or CUDA synchronization functions can be used to synchronize on events captured with vpiEventRecord().

Warning
This function is currently not implemented.
Parameters
cudaEvent[in] CUDA event handle
event[out] pointer to an event handle
Returns
Always returns VPI_ERROR_NOT_IMPLEMENTED