TensorRT 10.6.0
nvinfer1::v_1_0::IErrorRecorder Class Referenceabstract

#include <NvInferRuntimeBase.h>

Inheritance diagram for nvinfer1::v_1_0::IErrorRecorder:
nvinfer1::IVersionedInterface

Public Types

using ErrorDesc = char const *
 A typedef of a C-style string for reporting error descriptions. More...
 
using RefCount = int32_t
 A typedef of a 32-bit integer for reference counting. More...
 

Public Member Functions

InterfaceInfo getInterfaceInfo () const noexcept override
 Return version information associated with this interface. Applications must not override this method. More...
 
 IErrorRecorder ()=default
 
 ~IErrorRecorder () noexcept override=default
 
virtual int32_t getNbErrors () const noexcept=0
 Return the number of errors. More...
 
virtual ErrorCode getErrorCode (int32_t errorIdx) const noexcept=0
 Returns the ErrorCode enumeration. More...
 
virtual ErrorDesc getErrorDesc (int32_t errorIdx) const noexcept=0
 Returns a null-terminated C-style string description of the error. More...
 
virtual bool hasOverflowed () const noexcept=0
 Determine if the error stack has overflowed. More...
 
virtual void clear () noexcept=0
 Clear the error stack on the error recorder. More...
 
virtual bool reportError (ErrorCode val, ErrorDesc desc) noexcept=0
 Report an error to the error recorder with the corresponding enum and description. More...
 
virtual RefCount incRefCount () noexcept=0
 Increments the refcount for the current ErrorRecorder. More...
 
virtual RefCount decRefCount () noexcept=0
 Decrements the refcount for the current ErrorRecorder. More...
 
- Public Member Functions inherited from nvinfer1::IVersionedInterface
virtual APILanguage getAPILanguage () const noexcept
 The language used to build the implementation of this Interface. More...
 
virtual ~IVersionedInterface () noexcept=default
 

Static Public Attributes

static constexpr size_t kMAX_DESC_LENGTH {127U}
 The length limit for an error description in bytes, excluding the '\0' string terminator. Only applicable to safe runtime. General error recorder implementation can use any size appropriate for the use case. More...
 

Additional Inherited Members

- Protected Member Functions inherited from nvinfer1::IVersionedInterface
 IVersionedInterface ()=default
 
 IVersionedInterface (IVersionedInterface const &)=default
 
 IVersionedInterface (IVersionedInterface &&)=default
 
IVersionedInterfaceoperator= (IVersionedInterface const &) &=default
 
IVersionedInterfaceoperator= (IVersionedInterface &&) &=default
 

Member Typedef Documentation

◆ ErrorDesc

A typedef of a C-style string for reporting error descriptions.

◆ RefCount

A typedef of a 32-bit integer for reference counting.

Constructor & Destructor Documentation

◆ IErrorRecorder()

nvinfer1::v_1_0::IErrorRecorder::IErrorRecorder ( )
default

◆ ~IErrorRecorder()

nvinfer1::v_1_0::IErrorRecorder::~IErrorRecorder ( )
overridedefaultnoexcept

Member Function Documentation

◆ clear()

virtual void nvinfer1::v_1_0::IErrorRecorder::clear ( )
pure virtualnoexcept

Clear the error stack on the error recorder.

Removes all the tracked errors by the error recorder. The implementation must guarantee that after this function is called, and as long as no error occurs, the next call to getNbErrors will return zero and hasOverflowed will return false.

See also
getNbErrors(), hasOverflowed()


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ decRefCount()

virtual RefCount nvinfer1::v_1_0::IErrorRecorder::decRefCount ( )
pure virtualnoexcept

Decrements the refcount for the current ErrorRecorder.

Decrements the reference count for the object by one and returns the current value. This reference count allows the application to know that an object inside of TensorRT has taken a reference to the ErrorRecorder. TensorRT guarantees that every call to IErrorRecorder::decRefCount() will be preceded by a call to IErrorRecorder::incRefCount(). It is undefined behavior to destruct the ErrorRecorder when incRefCount() has been called without a corresponding decRefCount().

Returns
The reference counted value after the decrement completes.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ getErrorCode()

virtual ErrorCode nvinfer1::v_1_0::IErrorRecorder::getErrorCode ( int32_t  errorIdx) const
pure virtualnoexcept

Returns the ErrorCode enumeration.

Parameters
errorIdxA 32-bit integer that indexes into the error array.

The errorIdx specifies what error code from 0 to getNbErrors()-1 that the application wants to analyze and return the error code enum.

Returns
Returns the enum corresponding to errorIdx if errorIdx is in range (between 0 and getNbErrors()-1). ErrorCode::kUNSPECIFIED_ERROR must be returned if errorIdx is not in range.
See also
getErrorDesc(), ErrorCode


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ getErrorDesc()

virtual ErrorDesc nvinfer1::v_1_0::IErrorRecorder::getErrorDesc ( int32_t  errorIdx) const
pure virtualnoexcept

Returns a null-terminated C-style string description of the error.

Parameters
errorIdxA 32-bit integer that indexes into the error array.

For the error specified by the idx value, return the string description of the error. The error string is a null-terminated C-style string. In the safety context there is a constant length requirement to remove any dynamic memory allocations and the error message will be truncated if it exceeds kMAX_DESC_LENGTH bytes. The format of the string is "<EnumAsStr> - <Description>".

Returns
Returns a string representation of the error along with a description of the error if errorIdx is in range (between 0 and getNbErrors()-1). An empty string will be returned if errorIdx is not in range.
See also
getErrorCode()


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ getInterfaceInfo()

InterfaceInfo nvinfer1::v_1_0::IErrorRecorder::getInterfaceInfo ( ) const
inlineoverridevirtualnoexcept

Return version information associated with this interface. Applications must not override this method.

Implements nvinfer1::IVersionedInterface.

◆ getNbErrors()

virtual int32_t nvinfer1::v_1_0::IErrorRecorder::getNbErrors ( ) const
pure virtualnoexcept

Return the number of errors.

Determines the number of errors that occurred between the current point in execution and the last time that the clear() was executed. Due to the possibility of asynchronous errors occurring, a TensorRT API can return correct results, but still register errors with the Error Recorder. The value of getNbErrors() must increment by 1 after each reportError() call until clear() is called, or the maximum number of errors that can be stored is exceeded.

Returns
Returns the number of errors detected, or 0 if there are no errors. If the upper bound of errors that can be stored is exceeded, the upper bound value must be returned.

For example, if the error recorder can store up to 16 error descriptions but reportError() has been called 20 times, getNbErrors() must return 16.

See also
clear(), hasOverflowed()


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ hasOverflowed()

virtual bool nvinfer1::v_1_0::IErrorRecorder::hasOverflowed ( ) const
pure virtualnoexcept

Determine if the error stack has overflowed.

In the case when the number of errors is large, this function is used to query if one or more errors have been dropped due to lack of storage capacity. This is especially important in the automotive safety case where the internal error handling mechanisms cannot allocate memory.

Returns
true if errors have been dropped due to overflowing the error stack.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ incRefCount()

virtual RefCount nvinfer1::v_1_0::IErrorRecorder::incRefCount ( )
pure virtualnoexcept

Increments the refcount for the current ErrorRecorder.

Increments the reference count for the object by one and returns the current value. This reference count allows the application to know that an object inside of TensorRT has taken a reference to the ErrorRecorder. TensorRT guarantees that every call to IErrorRecorder::incRefCount() will be paired with a call to IErrorRecorder::decRefCount() when the reference is released. It is undefined behavior to destruct the ErrorRecorder when incRefCount() has been called without a corresponding decRefCount().

Returns
The reference counted value after the increment completes.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

◆ reportError()

virtual bool nvinfer1::v_1_0::IErrorRecorder::reportError ( ErrorCode  val,
ErrorDesc  desc 
)
pure virtualnoexcept

Report an error to the error recorder with the corresponding enum and description.

Parameters
valThe error code enum that is being reported.
descThe string description of the error, which will be a NULL-terminated string. For safety use cases its length is limited to kMAX_DESC_LENGTH bytes (excluding the NULL terminator) and descriptions that exceed this limit will be silently truncated.

Report an error to the user that has a given value and human readable description. The function returns false if processing can continue, which implies that the reported error is not fatal. This does not guarantee that processing continues, but provides a hint to TensorRT. The desc C-string data is only valid during the call to reportError and may be immediately deallocated by the caller when reportError returns. The implementation must not store the desc pointer in the ErrorRecorder object or otherwise access the data from desc after reportError returns.

Returns
True if the error is determined to be fatal and processing of the current function must end.
Warning
If the error recorder's maximum number of storable errors is exceeded, the error description will be silently dropped and the value returned by getNbErrors() will not be incremented. However, the return value will still signal whether the error must be considered fatal.


Usage considerations

  • Allowed context for the API call
    • Thread-safe: Yes, this method is required to be thread-safe and may be called from multiple threads when multiple execution contexts are used during runtime.

Member Data Documentation

◆ kMAX_DESC_LENGTH

constexpr size_t nvinfer1::v_1_0::IErrorRecorder::kMAX_DESC_LENGTH {127U}
staticconstexpr

The length limit for an error description in bytes, excluding the '\0' string terminator. Only applicable to safe runtime. General error recorder implementation can use any size appropriate for the use case.


The documentation for this class was generated from the following file:

  Copyright © 2024 NVIDIA Corporation
  Privacy Policy | Manage My Privacy | Do Not Sell or Share My Data | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact