Defines the tensor streamer function, enabling streaming tensors between different APIs.
- Note
- SW Release Applicability: These APIs are available in both NVIDIA DriveWorks and NVIDIA DRIVE Software releases.
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_consumerReceive (dwDNNTensorHandle_t *tensor, dwTime_t timeout_us, dwDNNTensorStreamerHandle_t streamer) |
| Receive a pointer to a dwDNNTensorHandle_t from the streamer, acting as a consumer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_consumerReturn (dwDNNTensorHandle_t *tensor, dwDNNTensorStreamerHandle_t streamer) |
| Return the received tensor back to the producer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_getCUDAStream (cudaStream_t *stream, dwDNNTensorStreamerHandle_t streamer) |
| Get CUDA stream used by the tensor streamer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_getOutputProperties (dwDNNTensorProperties *props, dwDNNTensorStreamerHandle_t streamer) |
| Get tensor properties of the tensor received from the streamer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_initialize (dwDNNTensorStreamerHandle_t *streamer, const dwDNNTensorProperties *from, dwDNNTensorType to, dwContextHandle_t ctx) |
| Creates and initializes the tensor streamer capable of moving tensors between different API types. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_producerReturn (dwDNNTensorHandle_t *tensor, dwTime_t timeout_us, dwDNNTensorStreamerHandle_t streamer) |
| The producer streamer waits for the tensor sent to be returned by the consumer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_producerSend (dwDNNTensorHandle_t tensor, dwDNNTensorStreamerHandle_t streamer) |
| Sends an tensor through the streamer acting as the producer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_release (dwDNNTensorStreamerHandle_t streamer) |
| Releases the tensor streamer. More...
|
|
DW_API_PUBLIC dwStatus | dwDNNTensorStreamer_setCUDAStream (cudaStream_t stream, dwDNNTensorStreamerHandle_t streamer) |
| Sets the CUDA stream for CUDA related streaming operations such as post and receive. More...
|
|
◆ dwDNNTensorStreamerHandle_t
◆ dwDNNTensorStreamer_consumerReceive()
Receive a pointer to a dwDNNTensorHandle_t from the streamer, acting as a consumer.
Can wait until timeout before failing.
- Parameters
-
[out] | tensor | A pointer to a dwDNNTensorHandle_t sent by the producer, not null if successfully converted. |
[in] | timeout_us | Timeout in milliseconds before interrupting the waiting for producer. |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_ARGUMENT if the given tensor handle is NULL
DW_INVALID_HANDLE if the given streamer handle (consumer) is invalid, i.e. null or of wrong type
DW_TIME_OUT if times out
or DW_SUCCESS otherwise.
◆ dwDNNTensorStreamer_consumerReturn()
Return the received tensor back to the producer.
Ownership is given back and tensor goes back to null
- Parameters
-
[in] | tensor | A pointer to the dwDNNTensorHandle_t to return to the producer. |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_HANDLE if the given streamer handle (consumer) is invalid, i.e. null or of wrong type
DW_INTERNAL_ERROR if the tensor has been received yet or an underlying error depending on the producer/consumer combination has occurred
or DW_SUCCESS otherwise.
◆ dwDNNTensorStreamer_getCUDAStream()
Get CUDA stream used by the tensor streamer.
- Parameters
-
[out] | stream | CUDA stream used by the streamer |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_HANDLE if the given context handle is invalid,i.e null or of wrong type
DW_NOT_SUPPORTED if the streamer does not work with CUDA tensors,
or DW_SUCCESS otherwise.
◆ dwDNNTensorStreamer_getOutputProperties()
Get tensor properties of the tensor received from the streamer.
- Parameters
-
[out] | props | Properties of the resulting tensors. |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_HANDLE if the given context handle is invalid,i.e null or of wrong type
DW_SUCCESS if successful.
◆ dwDNNTensorStreamer_initialize()
Creates and initializes the tensor streamer capable of moving tensors between different API types.
For example an tensor can be moved from NvMedia API into GL textured type or from CPU memory to CUDA.
- Parameters
-
[out] | streamer | A handle to the tensor streamer (if successfully initialized.) |
[in] | from | The properties of the source tensor for streaming. |
[in] | to | The type of the destination tensor. |
[in] | ctx | The DriveWorks context. |
- Returns
- DW_SUCCESS if the translator was created,
DW_INVALID_ARGUMENT if the given tensor types are invalid or the streamer pointer is null,
DW_INVALID_HANDLE if the given context handle is invalid,i.e null or of wrong type
DW_NOT_IMPLEMENTED if the desired streamer between given types is not implemented,
DW_NOT_AVAILABLE if the desired streamer between given two types is currently not available due to missing resources or non-initialized APIs,
or DW_NOT_SUPPORTED if the desired streamer cannot work with given pixel format or type.
◆ dwDNNTensorStreamer_producerReturn()
The producer streamer waits for the tensor sent to be returned by the consumer.
Waits for a max timeout. Returns a pointer to the dwDNNTensorHandle of the returned tensor, if the pointer passed is not null, otherwise it does not return a pointer
- Parameters
-
[out] | tensor | A pointer to a dwDNNTensorHandle_t returned by the producer |
[in] | timeout_us | Timeout in milliseconds before interrupting the waiting and return a timeout error. |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_ARGUMENT if the given streamer handle (producer) is null
DW_INVALID_HANDLE if the given streamer handle (producer) is invalid,i.e. of wrong type
DW_TIME_OUT if times out
or DW_SUCCESS otherwise.
◆ dwDNNTensorStreamer_producerSend()
Sends an tensor through the streamer acting as the producer.
- Note
- The ownership of the tensor remains by the caller.
- Parameters
-
[in] | tensor | A dwTensorHandle_t to send through the streamer |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_HANDLE if the given streamer handle (producer) is invalid,i.e. of wrong type
DW_INVALID_ARGUMENT if the given streamer handle (producer) or the tensor handle is NULL
DW_INVALID_HANDLE if the dwDNNTensorType of the input tensor doesn't match the streamer's
DW_BUSY_WAITING if the tensor cannot be sent. Non fatal error, it is possible to retry
or DW_SUCCESS otherwise.
◆ dwDNNTensorStreamer_release()
Releases the tensor streamer.
This releases all memory and closes all related resources. The handle is set to null.
- Parameters
-
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_SUCCESS if successful.
◆ dwDNNTensorStreamer_setCUDAStream()
Sets the CUDA stream for CUDA related streaming operations such as post and receive.
- Note
- The ownership of the stream remains by the callee.
- Parameters
-
[in] | stream | The CUDA stream to be used. Default is 0. |
[in] | streamer | A handle to the tensor streamer. |
- Returns
- DW_INVALID_HANDLE if the given context handle is invalid,i.e null or of wrong type
DW_NOT_SUPPORTED if the streamer does not work with CUDA tensors,
or DW_SUCCESS otherwise.