NvSci Interoperability#
APIs for interoperability using NvSci.
NvSciSync and NvSciBuf objects may be imported into cuPVA to allow synchronization and data sharing between PVA engine and other engines.
Functions#
- cupvaError_t CupvaFenceExport(cupvaFence_t const *const fence, NvSciSyncFence *const sciFence)
Export to an NvSciSyncFence.
- cupvaError_t CupvaFenceImport(cupvaFence_t *const fence, NvSciSyncFence const *const sciFence)
Import from an NvSciSyncFence.
- cupvaError_t CupvaMemFillAttributes(NvSciBufAttrList const sciBufAttr)
Fills NvSciBufAttrList with attributes used in NvSciBuf creation.
- cupvaError_t CupvaMemImport(void **const pvaPtr, NvSciBufObj const buff, cupvaMemAccessType_t const accessType)
Create a PVA pointer from a NvSci buffer object.
- cupvaError_t CupvaSyncObjCreateFromNvsci(cupvaSyncObj_t *const syncObj, NvSciSyncObj const sciSyncobj, cupvaSyncClientType_t const clientType)
Import from a NvSciSyncObj.
- cupvaError_t CupvaSyncObjFillAttributes(NvSciSyncAttrList *const attrList, cupvaSyncClientType_t const clientType)
Fills NvSciSyncAttrList with attributes used in NvSciSync creation.
Functions#
- cupvaError_t CupvaFenceExport(
- cupvaFence_t const *const fence,
- NvSciSyncFence *const sciFence,
Export to an NvSciSyncFence.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: No
Runtime: Yes
De-Init: No
- Parameters:
fence – [in] The pointer to a cupvaFence_t object.
sciFence – [out] the pointer to a NvSciSyncFence 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.
sciFence was a NULL pointer.
CUPVA_DRIVER_API_ERROR if failed to fill a NvSciSyncFence from a given PvaFence due to driver API error.
- cupvaError_t CupvaFenceImport(
- cupvaFence_t *const fence,
- NvSciSyncFence const *const sciFence,
Import from an NvSciSyncFence.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: No
Runtime: Yes
De-Init: No
- Parameters:
fence – [out] The pointer to a cupvaFence_t object.
sciFence – [in] Pointer to NvSciSyncFence to import
- Returns:
cupvaError_t The completion status of the operation. Possible values are:
CUPVA_ERROR_NONE if the operation was successful.
CUPVA_INVALID_ARGUMENT if fence was a NULL pointer.
CUPVA_DRIVER_API_ERROR if failed to fill a NvSciSyncFence from a given PvaFence due to driver API error.
- cupvaError_t CupvaMemFillAttributes(
- NvSciBufAttrList const sciBufAttr,
Fills NvSciBufAttrList with attributes used in NvSciBuf creation.
Calling this function before reconciliation stage allows CUPVA to import the resulting NvSciObj object. This API fills only the internal attributes required to indicate that the buffer will be accessed by the PVA engine. The user is expected to set all other attributes on their side as required.
When CUPVA is the late attaching peer of a NvSciBufObj, the user shall use NvSciBufHwEngName_PVA as the NvSciBufHwEngName type while setting NvSciBufGeneralAttrKey_PeerHwEngineArray attribute.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: Yes
Runtime: No
De-Init: No
- Parameters:
sciBufAttr – [out] Attribute list object
- Returns:
cupvaError_t The completion status of the operation. Possible values are:
CUPVA_ERROR_NONE if the operation was successful.
CUPVA_DRIVER_API_ERROR The PVA driver returned an unexpected error.
- cupvaError_t CupvaMemImport(
- void **const pvaPtr,
- NvSciBufObj const buff,
- cupvaMemAccessType_t const accessType,
Create a PVA pointer from a NvSci buffer object.
Importing a NvSci buffer creates a mapping which must be released by calling CupvaMemFree() when the application has finished using the buffer.
Usage considerations
Allowed context for the API call
Thread-safe: Yes
API group
Init: Yes
Runtime: No
De-Init: No
- Parameters:
pvaPtr – [out] The double pointer to return the device pointer to the imported memory.
buff – [in] The copy of NvSci buffer object.
accessType – [in] Specifies the access type of the mapped memory.
- 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:
pvaPtr was a NULL pointer.
The number of planes exceeded the maximum.
The image buffer size was invalid.
The line pitch of a block linear plane was not aligned to 64B.
The offset of a block linear plane was not aligned to 64B.
The raw buffer size was invalid.
The tensor size was invalid.
CUPVA_INTERNAL_ERROR indicates possible following errors:
VA allocation failed.
Failed to get the attr list from NvSci object.
Failed to get the buffer type attribute from NvSci object.
Failed to get the image attributes from NvSci object.
Failed to get the raw buffer attributes from NvSci object.
Failed to get the tensor attributes from NvSci object.
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”
- cupvaError_t CupvaSyncObjCreateFromNvsci(
- cupvaSyncObj_t *const syncObj,
- NvSciSyncObj const sciSyncobj,
- cupvaSyncClientType_t const clientType,
Import from a NvSciSyncObj.
Usage considerations
Allowed context for the API call
Thread-safe: Yes
API group
Init: Yes
Runtime: No
De-Init: No
- Parameters:
syncObj – [out] The pointer to return a newly constructed cupvaSyncObj_t object.
sciSyncobj – [in] The copy of sciSyncobj.
clientType – [in] The synchronization client type.
- 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_NOT_ALLOWED_IN_OPERATIONAL_STATE if called when NVIDIA DRIVE OS VM state is “Operational”
- cupvaError_t CupvaSyncObjFillAttributes(
- NvSciSyncAttrList *const attrList,
- cupvaSyncClientType_t const clientType,
Fills NvSciSyncAttrList with attributes used in NvSciSync creation.
Calling this function before reconciliation stage causes NvSci to use appropriate attributes during reconciliation which will allow CUPVA to import the resulting NvSciSync object.
CUPVA supports NvSciSyncAttrValPrimitiveType_Syncpoint and NvSciSyncAttrValPrimitiveType_SysmemSemaphore primitive types.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: Yes
Runtime: No
De-Init: No
- Parameters:
attrList – [out] Attribute list pointer.
clientType – [in] The synchronization client type.
- Returns:
cupvaError_t The completion status of the operation. Possible values are:
CUPVA_ERROR_NONE if the operation was successful.
CUPVA_INVALID_ARGUMENT if attrList was a NULL pointer.
CUPVA_DRIVER_API_ERROR if getting sync attribute list failed due to driver API error.