TensorRT 8.6.1
|
Functionally safe context for executing inference using an engine. More...
#include <NvInferSafeRuntime.h>
Public Member Functions | |
virtual ICudaEngine const & | getEngine () const noexcept=0 |
Get the associated engine. More... | |
virtual void | setName (AsciiChar const *const name) noexcept=0 |
Set the name of the execution context. More... | |
virtual AsciiChar const * | getName () const noexcept=0 |
Return the name of the execution context. More... | |
virtual void | setDeviceMemory (void *const memory) noexcept=0 |
Set the device memory for use by this execution context. More... | |
virtual TRT_DEPRECATED Dims | getStrides (std::int32_t const bindingIndex) const noexcept=0 |
Return the strides of the buffer for the given binding. More... | |
virtual void | setErrorRecorder (IErrorRecorder *const recorder) noexcept=0 |
Set the ErrorRecorder for this interface. More... | |
virtual IErrorRecorder * | getErrorRecorder () const noexcept=0 |
get the ErrorRecorder assigned to this interface. More... | |
virtual TRT_DEPRECATED bool | enqueueV2 (void *const *const bindings, cudaStream_t const stream, cudaEvent_t const *const inputConsumed) noexcept=0 |
Enqueue inference of a batch on a stream. More... | |
IExecutionContext ()=default | |
virtual | ~IExecutionContext () noexcept=default |
IExecutionContext (IExecutionContext const &)=delete | |
IExecutionContext (IExecutionContext &&)=delete | |
IExecutionContext & | operator= (IExecutionContext const &) &=delete |
IExecutionContext & | operator= (IExecutionContext &&) &=delete |
virtual void | setErrorBuffer (FloatingPointErrorInformation *const buffer) noexcept=0 |
Set error buffer output for floating point errors. More... | |
virtual FloatingPointErrorInformation * | getErrorBuffer () const noexcept=0 |
Get error buffer output for floating point errors. More... | |
virtual Dims | getTensorStrides (AsciiChar const *tensorName) const noexcept=0 |
Return the strides of the buffer for the given tensor name. More... | |
virtual bool | setInputTensorAddress (AsciiChar const *tensorName, void const *data) noexcept=0 |
Set memory address for given input tensor. More... | |
virtual bool | setOutputTensorAddress (AsciiChar const *tensorName, void *data) noexcept=0 |
Set memory address for given output tensor. More... | |
virtual bool | setInputConsumedEvent (cudaEvent_t event) noexcept=0 |
Mark input as consumed. More... | |
virtual cudaEvent_t | getInputConsumedEvent () const noexcept=0 |
Return the event associated with consuming the input. More... | |
virtual void const * | getInputTensorAddress (AsciiChar const *tensorName) const noexcept=0 |
Get memory address for given input tensor. More... | |
virtual void * | getOutputTensorAddress (AsciiChar const *tensorName) const noexcept=0 |
Get memory address for given output tensor. More... | |
virtual bool | enqueueV3 (cudaStream_t stream) noexcept=0 |
Enqueue inference on a stream. More... | |
Functionally safe context for executing inference using an engine.
Multiple safe execution contexts may exist for one safe::ICudaEngine instance, allowing the same engine to be used for the execution of multiple inputs simultaneously.
|
default |
|
virtualdefaultnoexcept |
|
delete |
|
delete |
|
pure virtualnoexcept |
Enqueue inference of a batch on a stream.
This method requires an array of input and output buffers. The mapping from tensor names to indices can be queried using safe::ICudaEngine::getBindingIndex(). This method only works for an execution context built from a network without an implicit batch dimension.
bindings | An array of pointers to input and output buffers for the network. |
stream | A cuda stream on which the inference kernels will be enqueued. |
inputConsumed | An optional event which will be signaled when the input buffers can be refilled with new data. |
Usage considerations
|
pure virtualnoexcept |
Enqueue inference on a stream.
Modifying or releasing memory that has been registered for the tensors before stream synchronization or the event passed to setInputConsumedEvent has been being triggered results in undefined behavior.
stream | A cuda stream on which the inference kernels will be enqueued. |
Usage considerations
|
pure virtualnoexcept |
Get the associated engine.
Usage considerations
|
pure virtualnoexcept |
Get error buffer output for floating point errors.
Usage considerations
|
pure virtualnoexcept |
get the ErrorRecorder assigned to this interface.
Retrieves the assigned error recorder object for the given class. A default error recorder does not exist, so a nullptr will be returned if setErrorRecorder has not been called.
Usage considerations
|
pure virtualnoexcept |
Return the event associated with consuming the input.
Usage considerations
|
pure virtualnoexcept |
Get memory address for given input tensor.
tensorName | The name of an input tensor. |
Usage considerations
|
pure virtualnoexcept |
Return the name of the execution context.
Usage considerations
|
pure virtualnoexcept |
Get memory address for given output tensor.
tensorName | The name of an output tensor. |
Usage considerations
|
pure virtualnoexcept |
Return the strides of the buffer for the given binding.
bindingIndex | The binding index. |
Usage considerations
|
pure virtualnoexcept |
Return the strides of the buffer for the given tensor name.
The strides are in units of elements, not components or bytes. For example, for TensorFormat::kHWC8, a stride of one spans 8 scalars.
tensorName | The name of an input or output tensor. |
Usage considerations
|
delete |
|
delete |
|
pure virtualnoexcept |
Set the device memory for use by this execution context.
If using enqueueV2() to run the network, The memory is in use from the invocation of enqueueV2() until network execution is complete. Releasing or otherwise using the memory for other purposes during this time will result in undefined behavior.
Usage considerations
|
pure virtualnoexcept |
Set error buffer output for floating point errors.
The error buffer output must be allocated in device memory and will be used for subsequent calls to enqueueV2. Checking the contents of the error buffer after inference is the responsibility of the application. The pointer passed here must have alignment adequate for the FloatingPointErrorInformation struct.
buffer | The device memory to use as floating point error buffer |
Usage considerations
|
pure virtualnoexcept |
Set the ErrorRecorder for this interface.
Assigns the ErrorRecorder to this interface. The ErrorRecorder will track all errors during execution. This function will call incRefCount of the registered ErrorRecorder at least once. Setting recorder to nullptr unregisters the recorder with the interface, resulting in a call to decRefCount if a recorder has been registered.
recorder | The error recorder to register with this interface. |
Usage considerations
|
pure virtualnoexcept |
Mark input as consumed.
Passing event==nullptr removes whatever event was set, if any.
event | The cuda event that is triggered after all input tensors have been consumed. |
Usage considerations
|
pure virtualnoexcept |
Set memory address for given input tensor.
An address defaults to nullptr.
Before calling enqueueV3(), each input must have a non-null address.
tensorName | The name of an input tensor. |
data | The pointer (void const*) to the const data owned by the user. |
Usage considerations
|
pure virtualnoexcept |
Set the name of the execution context.
This method copies the name string.
Usage considerations
|
pure virtualnoexcept |
Set memory address for given output tensor.
An address defaults to nullptr.
Before calling enqueueV3(), each output must have a non-null address.
tensorName | The name of an output tensor. |
data | The pointer (void*) to the data owned by the user. |
Usage considerations