Synchronization Requirements

Setting up synchronization resources begins by determining the requirements of each endpoint. The producer and consumers must query the NVIDIA drivers they are going to use with the appropriate APIs to obtain separate NvSciSyncAttrList handles representing the requirements for signaling (writing to) and waiting for (reading from) synchronization objects.

If an endpoint directly writes to or reads from the stream packets with the CPU instead of using an NVIDIA API, it does not generate any fences, and therefore does not need synchronization signaling requirements. It needs to perform CPU waits for fences from the other endpoint, and therefore must create a waiting requirement attribute list with the NeedCpuAccess flag set.

In some use cases, an application endpoint may require that packets it receives be available immediately, without waiting for any fence. In this case, it does not need to provide any synchronization waiting requirement attributes. Instead, it indicates to the other endpoint that it must do a CPU wait before sending the packets. This is not common but is provided to support these cases when they arise.

Once an endpoint has determined its signal and wait requirements for synchronization objects, it stores the signal requirements locally, and passes the wait requirements, one NvSciSyncAttrList per packet element, to the other endpoint through the stream. It passes an NvSciSyncAttrList with the wait requirement attribute if fences are supported into the endpoint block by calling NvSciStreamBlockElementWaiterAttrSet(). If the waiter for the element referenced by elemIndex does not support fences, NULL pointer is passed. The function call is the same for both producer and consumer endpoints. Ownership of the sync attributes' handle remains with the caller. The stream creates a duplicate before the function returns.

After indicating their waiter requirements for all the elements, the producer and consumer applications call the NvSciStreamBlockSetupStatusSet() function with a value of NvSciStreamSetup_WaiterAttrExport to inform NvSciStream they are done specifying waiter requirements.

NvSciError
NvSciStreamBlockElementWaiterAttrSet(
NvSciStreamBlock  const block,
Uint32_t          const elemIndex,
NvSciSyncAttrList const waitSyncAttrList
)