NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
CUPVA_Synchronization_C

Detailed Description

Data Structures

struct  cupvaFence_t
 Used synchronize PVA workloads with other engines, including CPU. More...
 

Typedefs

typedef struct cupvaSyncObjRec * cupvaSyncObj_t
 A synchronization object which holds resources needed by fences. More...
 

Enumerations

enum  cupvaSyncClientType_t {
  CUPVA_SYNC_CLIENT_TYPE_INVALID = 0,
  CUPVA_SIGNALER,
  CUPVA_WAITER,
  CUPVA_SIGNALER_WAITER,
  CUPVA_SYNC_CLIENT_TYPE_MAX
}
 The synchronization client type. More...
 
enum  cupvaSyncWaitMode_t {
  CUPVA_SYNC_WAIT_MODE_INVALID = 0,
  CUPVA_SYNC_YIELD,
  CUPVA_SYNC_SPIN,
  CUPVA_SYNC_WAIT_MODE_MAX
}
 The sync object wait mode. More...
 

Functions

DLL_EXPORT cupvaError_t CupvaSyncObjCreate (cupvaSyncObj_t *const syncObj, bool const isTimeStamp, cupvaSyncClientType_t const clientType, cupvaSyncWaitMode_t const waitMode)
 Create and set syncObj to be an empty cupva sync object. More...
 
DLL_EXPORT cupvaError_t CupvaSyncObjDestroy (cupvaSyncObj_t const syncObj)
 Destroy a cupva sync object. More...
 
DLL_EXPORT cupvaError_t CupvaCmdBarrierInit (cupvaCmd_t *const cmdBarrier)
 Create a Barrier command. More...
 
DLL_EXPORT cupvaError_t CupvaCmdWaitOnFencesInit (cupvaCmd_t *const command, cupvaFence_t const *const fence, int32_t const count)
 Initialize a WaitOnFence command from the given fence. More...
 
DLL_EXPORT cupvaError_t CupvaFenceInit (cupvaFence_t *const fence, cupvaSyncObj_t const syncObj)
 Initialize an empty fence. More...
 
DLL_EXPORT cupvaError_t CupvaFenceGetTimeStamp (cupvaFence_t const *const fence, uint64_t *const timeStamp)
 Gets the time at which current fence expired (in nanoseconds). More...
 
DLL_EXPORT cupvaError_t CupvaFenceWait (cupvaFence_t const *const fence, int64_t const timeout, bool *const waitSuccess)
 Block the calling thread until the fence is triggered or time out. More...
 
DLL_EXPORT cupvaError_t CupvaCmdRequestFencesInit (cupvaCmd_t *const command, cupvaFence_t *const fence, int32_t const count)
 Initialize a Request Fence command from the given fence. More...
 

Typedef Documentation

◆ cupvaSyncObj_t

typedef struct cupvaSyncObjRec* cupvaSyncObj_t

A synchronization object which holds resources needed by fences.

Definition at line 97 of file cupva_host_types.h.

Enumeration Type Documentation

◆ cupvaSyncClientType_t

The synchronization client type.

Enumerator
CUPVA_SYNC_CLIENT_TYPE_INVALID 

Sentinel value.

CUPVA_SIGNALER 
CUPVA_WAITER 
CUPVA_SIGNALER_WAITER 
CUPVA_SYNC_CLIENT_TYPE_MAX 

One greater than max valid value.

Definition at line 113 of file cupva_host_types_scheduling.h.

◆ cupvaSyncWaitMode_t

The sync object wait mode.

This controls how an app interacts with the OS scheduler while blocked by calling Fence::wait().

Enumerator
CUPVA_SYNC_WAIT_MODE_INVALID 

Sentinel value.

CUPVA_SYNC_YIELD 

Yield the caller thread while blocked by calling CupvaFenceWait().

CUPVA_SYNC_SPIN 

Actively spin while blocked by calling CupvaFenceWait().

CUPVA_SYNC_WAIT_MODE_MAX 

One greater than max valid value.

Definition at line 133 of file cupva_host_types_scheduling.h.

Function Documentation

◆ CupvaCmdBarrierInit()

DLL_EXPORT cupvaError_t CupvaCmdBarrierInit ( cupvaCmd_t *const  cmdBarrier)

Create a Barrier command.

Parameters
[in]cmdBarrierThe pointer to a cupvaCmd_t object.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT if cmdBarrier was a NULL pointer.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ CupvaCmdRequestFencesInit()

DLL_EXPORT cupvaError_t CupvaCmdRequestFencesInit ( cupvaCmd_t *const  command,
cupvaFence_t *const  fence,
int32_t const  count 
)

Initialize a Request Fence command from the given fence.

Parameters
[in]commandThe pointer to a cupvaCmd_t object.
[in]fenceThe pointer to a cupvaFence_t array.
[in]countThe number of fences in the array.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT indicates one of the followings:
    • command was a NULL pointer.
    • fence was a NULL pointer.
    • count > MAX_CMD_REQUEST_FENCES_ARRAY_SIZE.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ CupvaCmdWaitOnFencesInit()

DLL_EXPORT cupvaError_t CupvaCmdWaitOnFencesInit ( cupvaCmd_t *const  command,
cupvaFence_t const *const  fence,
int32_t const  count 
)

Initialize a WaitOnFence command from the given fence.

Parameters
[in]commandThe pointer to a cupvaCmd_t object.
[in]fenceThe pointer to a cupvaFence_t array.
[in]countThe number of fences in the array.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT indicates one of the followings:
    • command was a NULL pointer.
    • fence was a NULL pointer.
    • count > MAX_CMD_REQUEST_FENCES_ARRAY_SIZE.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ CupvaFenceGetTimeStamp()

DLL_EXPORT cupvaError_t CupvaFenceGetTimeStamp ( cupvaFence_t const *const  fence,
uint64_t *const  timeStamp 
)

Gets the time at which current fence expired (in nanoseconds).

Parameters
[in]fenceThe pointer to a cupvaFence_t object.
[out]timeStampAn uint64_t pointer to return the timestamp.

CupvaFenceWait() must return with success and set waitSuccess argument to true prior to calling this API or the timestamp value cannot be considered valid.

Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT indicates one of the followings:
    • fence was a NULL pointer.
    • timeStamp was a NULL pointer.
  • CUPVA_DRIVER_API_ERROR The PVA driver returned an unexpected error.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ CupvaFenceInit()

DLL_EXPORT cupvaError_t CupvaFenceInit ( cupvaFence_t *const  fence,
cupvaSyncObj_t const  syncObj 
)

Initialize an empty fence.

Parameters
[in]fenceThe pointer to a cupvaFence_t object.
[in]syncObjThe pointer to a CUPVA sync object.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT indicates one of the followings:
    • fence was a NULL pointer.
    • syncObj was a NULL pointer.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ CupvaFenceWait()

DLL_EXPORT cupvaError_t CupvaFenceWait ( cupvaFence_t const *const  fence,
int64_t const  timeout,
bool *const  waitSuccess 
)

Block the calling thread until the fence is triggered or time out.

Parameters
[in]fenceThe pointer to a cupvaFence_t object.
[in]timeoutThe maximum time to wait in micro seconds. -1 will wait forever.
[out]waitSuccessThe pointer a boolean variable used to store wait status - true if wait was successful; false if timeout occurred before the fence was triggered. Can be NULL, in which case it will be ignored.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT indicates one of the followings:
    • fence was a NULL pointer.
  • CUPVA_DRIVER_API_ERROR The PVA driver returned an unexpected error.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes
  • API group
    • Init: No
    • Runtime: Yes
    • De-Init: No

◆ CupvaSyncObjCreate()

DLL_EXPORT cupvaError_t CupvaSyncObjCreate ( cupvaSyncObj_t *const  syncObj,
bool const  isTimeStamp,
cupvaSyncClientType_t const  clientType,
cupvaSyncWaitMode_t const  waitMode 
)

Create and set syncObj to be an empty cupva sync object.

Parameters
[out]syncObjThe pointer to return the newly constructed Sync object.
[in]isTimeStampThe flag to turn on/off the time-stamp in the SyncObj.
[in]clientTypeThe synchronization client type.
[in]waitModeThe sync object wait mode.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT indicates one of the followings:
    • syncObj was a NULL pointer.
    • clientType was invalid.
    • waitMode was invalid.
  • CUPVA_DRIVER_API_ERROR The PVA driver returned an unexpected error.
  • CUPVA_NOT_ALLOWED_IN_OPERATIONAL_STATE if called when NVIDIA DRIVE OS VM state is "Operational"


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes
  • API group
    • Init: Yes
    • Runtime: No
    • De-Init: No

◆ CupvaSyncObjDestroy()

DLL_EXPORT cupvaError_t CupvaSyncObjDestroy ( cupvaSyncObj_t const  syncObj)

Destroy a cupva sync object.

Parameters
[in]syncObjThe pointer to a cupvaSyncObj_t object.
Returns
cupvaError_t The completion status of the operation. Possible values are:
  • CUPVA_ERROR_NONE if the operation was successful.
  • CUPVA_INVALID_ARGUMENT if syncObj was a NULL pointer.
  • CUPVA_DRIVER_API_ERROR The PVA driver returned an unexpected error.
  • CUPVA_NOT_ALLOWED_IN_OPERATIONAL_STATE if called when NVIDIA DRIVE OS VM state is "Operational"


Usage considerations

  • Allowed context for the API call
    • Thread-safe: No
  • API group
    • Init: No
    • Runtime: No
    • De-Init: Yes