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#
- void cupva::nvsci::Export(Fence const &cupvaFence, NvSciSyncFence &sciFence)
Export to an NvSciSyncFence.
- void cupva::nvsci::FillAttributes(NvSciSyncAttrList const attrList, SyncClientType const clientType=SyncClientType::SIGNALER_WAITER)
Fills NvSciSyncAttrList with attributes used in NvSciSync creation.
- SyncObj cupva::nvsci::Import(NvSciSyncObj obj, SyncClientType clientType=SyncClientType::SIGNALER_WAITER)
Import from a NvSciSyncObj.
- void cupva::nvsci::Import(Fence &cupvaFence, NvSciSyncFence const &sciFence)
Import from an NvSciSyncFence.
- void cupva::nvsci::mem::FillAttributes(NvSciBufAttrList const sciBufAttr)
Fills NvSciBufAttrList with attributes used in NvSciBuf creation.
- void * cupva::nvsci::mem::Import(NvSciBufObj const buff, cupva::mem::AccessType const access=cupva::mem::AccessType::READ_WRITE)
Create a PVA pointer from a NvSci buffer object.
Functions#
- void cupva::nvsci::Export(
- Fence const &cupvaFence,
- NvSciSyncFence &sciFence,
Export to an NvSciSyncFence.
Calling this function will fill an NvSciSyncFence object with data from a Fence object. The Fence object must have been created with a SyncObj which has been imported from NvSci with CreateSyncObjFromNvSci. The Fence object must have been initialized by submitting a CmdRequestFence. This API transfers the ownership from cupvaFence to sciFence, therefore the caller must explicitly call NvSciSyncFenceClear to release the memory of sciFence.
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: No
Runtime: Yes
De-Init: No
- void cupva::nvsci::FillAttributes(
- NvSciSyncAttrList const attrList,
- SyncClientType const clientType = SyncClientType::SIGNALER_WAITER,
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
- SyncObj cupva::nvsci::Import(
- NvSciSyncObj obj,
- SyncClientType clientType = SyncClientType::SIGNALER_WAITER,
Import from a NvSciSyncObj.
Usage considerations
Allowed context for the API call
Thread-safe: Yes
API group
Init: Yes
Runtime: No
De-Init: No
- void cupva::nvsci::Import(
- Fence &cupvaFence,
- NvSciSyncFence const &sciFence,
Import from an NvSciSyncFence.
Calling this function will fill a cupva::Fence object from an NvSciSyncFence object. The Fence object must have been created with a SyncObj which has been imported from the same NvSciSyncObj used to create the NvSciSyncFence, via CreateSyncObjFromNvSci
Usage considerations
Allowed context for the API call
Thread-safe: No
API group
Init: No
Runtime: Yes
De-Init: No
- void cupva::nvsci::mem::FillAttributes(
- 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
- void *cupva::nvsci::mem::Import(
- NvSciBufObj const buff,
- cupva::mem::AccessType const access = cupva::mem::AccessType::READ_WRITE,
Create a PVA pointer from a NvSci buffer object.
Importing a NvSci buffer creates a mapping which must be released by calling cupva::mem::Free() 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:
buff – [in] The copy of NvSci buffer object.
access – [in] Specifies the access type of the mapped memory.
- Throws:
cupva::Exception(DriverAPIError) – Getting a device pointer failed due to driver API error.
cupva::Exception(InternalError) – Failed to get the attr list from NvSci object.
cupva::Exception(InternalError) – Failed to get the buffer type attribute from NvSci object.
cupva::Exception(InternalError) – Failed to get the image attributes from NvSci object.
cupva::Exception(InternalError) – Failed to get the raw buffer attributes from NvSci object.
cupva::Exception(InternalError) – Failed to get the tensor attributes from NvSci object.
cupva::Exception(InvalidArgument) – The number of planes exceeds the maximum.
cupva::Exception(InvalidArgument) – The image buffer size is invalid.
cupva::Exception(InvalidArgument) – The line pitch of a block linear plane is not aligned to 64B.
cupva::Exception(InvalidArgument) – The offset of a block linear plane is not aligned to 64B.
cupva::Exception(InvalidArgument) – The raw buffer size is invalid.
cupva::Exception(InvalidArgument) – The tensor size is invalid.
cupva::Exception(NotAllowedInOperationalState) – if called when NVIDIA DRIVE OS VM state is “Operational”
- Returns:
The device pointer pointing to the imported memory.