TensorRT  8.0.0
NvInferRuntimeCommon.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1993-2021 NVIDIA Corporation. All rights reserved.
3  *
4  * NOTICE TO LICENSEE:
5  *
6  * This source code and/or documentation ("Licensed Deliverables") are
7  * subject to NVIDIA intellectual property rights under U.S. and
8  * international Copyright laws.
9  *
10  * These Licensed Deliverables contained herein is PROPRIETARY and
11  * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12  * conditions of a form of NVIDIA software license agreement by and
13  * between NVIDIA and Licensee ("License Agreement") or electronically
14  * accepted by Licensee. Notwithstanding any terms or conditions to
15  * the contrary in the License Agreement, reproduction or disclosure
16  * of the Licensed Deliverables to any third party without the express
17  * written consent of NVIDIA is prohibited.
18  *
19  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20  * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21  * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22  * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23  * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24  * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25  * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26  * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27  * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28  * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32  * OF THESE LICENSED DELIVERABLES.
33  *
34  * U.S. Government End Users. These Licensed Deliverables are a
35  * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36  * 1995), consisting of "commercial computer software" and "commercial
37  * computer software documentation" as such terms are used in 48
38  * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39  * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40  * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41  * U.S. Government End Users acquire the Licensed Deliverables with
42  * only those rights set forth herein.
43  *
44  * Any use of the Licensed Deliverables in individual and commercial
45  * software must include, in the user documentation and internal
46  * comments to the code, the above Disclaimer and U.S. Government End
47  * Users Notice.
48  */
49 
50 #ifndef NV_INFER_RUNTIME_COMMON_H
51 #define NV_INFER_RUNTIME_COMMON_H
52 
53 #include "NvInferVersion.h"
54 #include <cstddef>
55 #include <cstdint>
56 
58 #if __cplusplus >= 201402L
59 #define TRT_DEPRECATED [[deprecated]]
60 #if __GNUC__ < 6
61 #define TRT_DEPRECATED_ENUM
62 #else
63 #define TRT_DEPRECATED_ENUM TRT_DEPRECATED
64 #endif
65 #ifdef _MSC_VER
66 #define TRT_DEPRECATED_API __declspec(dllexport)
67 #else
68 #define TRT_DEPRECATED_API [[deprecated]] __attribute__((visibility("default")))
69 #endif
70 #else
71 #ifdef _MSC_VER
72 #define TRT_DEPRECATED
73 #define TRT_DEPRECATED_ENUM
74 #define TRT_DEPRECATED_API __declspec(dllexport)
75 #else
76 #define TRT_DEPRECATED __attribute__((deprecated))
77 #define TRT_DEPRECATED_ENUM
78 #define TRT_DEPRECATED_API __attribute__((deprecated, visibility("default")))
79 #endif
80 #endif
81 
83 #ifdef TENSORRT_BUILD_LIB
84 #ifdef _MSC_VER
85 #define TENSORRTAPI __declspec(dllexport)
86 #else
87 #define TENSORRTAPI __attribute__((visibility("default")))
88 #endif
89 #else
90 #define TENSORRTAPI
91 #endif
92 #define TRTNOEXCEPT
93 
99 // forward declare some CUDA types to avoid an include dependency
100 
102 struct cublasContext;
104 struct cudnnContext;
105 
107 typedef struct CUstream_st* cudaStream_t;
108 
110 typedef struct CUevent_st* cudaEvent_t;
111 
112 static constexpr int32_t NV_TENSORRT_VERSION
113  = (NV_TENSORRT_MAJOR * 1000) + (NV_TENSORRT_MINOR * 100) + NV_TENSORRT_PATCH; // major, minor, patch
114 
120 namespace nvinfer1
121 {
123 using char_t = char;
126 
128 class IErrorRecorder;
130 class IGpuAllocator;
131 
132 namespace impl
133 {
135 template <typename T>
136 struct EnumMaxImpl;
137 } // namespace impl
138 
140 template <typename T>
141 constexpr int32_t EnumMax() noexcept
142 {
143  return impl::EnumMaxImpl<T>::kVALUE;
144 }
145 
150 enum class DataType : int32_t
151 {
153  kFLOAT = 0,
154 
156  kHALF = 1,
157 
159  kINT8 = 2,
160 
162  kINT32 = 3,
163 
165  kBOOL = 4
166 };
167 
168 namespace impl
169 {
171 template <>
173 {
174  // Declaration of kVALUE that represents maximum number of elements in DataType enum
175  static constexpr int32_t kVALUE = 5;
176 };
177 } // namespace impl
178 
189 class Dims32
190 {
191 public:
193  static constexpr int32_t MAX_DIMS{8};
195  int32_t nbDims;
197  int32_t d[MAX_DIMS];
198 };
199 
205 using Dims = Dims32;
206 
220 enum class TensorFormat : int32_t
221 {
229  kLINEAR = 0,
230 
237  kCHW2 = 1,
238 
245  kHWC8 = 2,
246 
262  kCHW4 = 3,
263 
274  kCHW16 = 4,
275 
285  kCHW32 = 5,
286 
293  kDHWC8 = 6,
294 
301  kCDHW32 = 7,
302 
305  kHWC = 8,
306 
315  kDLA_LINEAR = 9,
316 
329  kDLA_HWC4 = 10,
330 
337  kHWC16 = 11
338 };
339 
346 
347 namespace impl
348 {
350 template <>
352 {
354  static constexpr int32_t kVALUE = 12;
355 };
356 } // namespace impl
357 
369 {
377  float scale;
378 };
379 
386 enum class PluginVersion : uint8_t
387 {
389  kV2 = 0,
391  kV2_EXT = 1,
393  kV2_IOEXT = 2,
395  kV2_DYNAMICEXT = 3,
396 };
397 
410 {
411 public:
417  virtual int32_t getTensorRTVersion() const noexcept
418  {
419  return NV_TENSORRT_VERSION;
420  }
421 
426  virtual AsciiChar const* getPluginType() const noexcept = 0;
427 
432  virtual AsciiChar const* getPluginVersion() const noexcept = 0;
433 
442  virtual int32_t getNbOutputs() const noexcept = 0;
443 
454  virtual Dims getOutputDimensions(int32_t index, Dims const* inputs, int32_t nbInputDims) noexcept = 0;
455 
473  virtual bool supportsFormat(DataType type, PluginFormat format) const noexcept = 0;
474 
498  virtual void configureWithFormat(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
499  DataType type, PluginFormat format, int32_t maxBatchSize) noexcept = 0;
500 
506  virtual int32_t initialize() noexcept = 0;
507 
513  virtual void terminate() noexcept = 0;
514 
523  virtual size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept = 0;
524 
536  virtual int32_t enqueue(int32_t batchSize, void const* const* inputs, void* const* outputs, void* workspace,
537  cudaStream_t stream) noexcept
538  = 0;
539 
545  virtual size_t getSerializationSize() const noexcept = 0;
546 
555  virtual void serialize(void* buffer) const noexcept = 0;
556 
560  virtual void destroy() noexcept = 0;
561 
566  virtual IPluginV2* clone() const noexcept = 0;
567 
572  virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
573 
577  virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
578 
579  IPluginV2() = default;
580  virtual ~IPluginV2() noexcept = default;
581 
582 protected:
583  IPluginV2(IPluginV2 const&) = default;
584  IPluginV2(IPluginV2&&) = default;
585  IPluginV2& operator=(IPluginV2 const&) & = default;
586  IPluginV2& operator=(IPluginV2&&) & = default;
587 };
588 
599 class IPluginV2Ext : public IPluginV2
600 {
601 public:
610  virtual nvinfer1::DataType getOutputDataType(
611  int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept = 0;
612 
623  virtual bool isOutputBroadcastAcrossBatch(
624  int32_t outputIndex, bool const* inputIsBroadcasted, int32_t nbInputs) const noexcept = 0;
625 
639  virtual bool canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept = 0;
640 
669 
670  virtual void configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
671  DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
672  bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept = 0;
673 
674  IPluginV2Ext() = default;
675  ~IPluginV2Ext() override = default;
676 
694  virtual void attachToContext(cudnnContext* /*cudnn*/, cublasContext* /*cublas*/, IGpuAllocator* /*allocator*/) noexcept {}
695 
704  virtual void detachFromContext() noexcept {}
705 
711  IPluginV2Ext* clone() const noexcept override = 0;
712 
713 protected:
714  IPluginV2Ext(IPluginV2Ext const&) = default;
715  IPluginV2Ext(IPluginV2Ext&&) = default;
716  IPluginV2Ext& operator=(IPluginV2Ext const&) & = default;
717  IPluginV2Ext& operator=(IPluginV2Ext&&) & = default;
718 
726  int32_t getTensorRTVersion() const noexcept override
727  {
728  return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_EXT) << 24U)
729  | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
730  }
731 
735  void configureWithFormat(Dims const* /*inputDims*/, int32_t /*nbInputs*/, Dims const* /*outputDims*/,
736  int32_t /*nbOutputs*/, DataType /*type*/, PluginFormat /*format*/, int32_t /*maxBatchSize*/) noexcept override
737  {
738  }
739 };
740 
751 {
752 public:
764  virtual void configurePlugin(
765  PluginTensorDesc const* in, int32_t nbInput, PluginTensorDesc const* out, int32_t nbOutput) noexcept = 0;
766 
799  virtual bool supportsFormatCombination(
800  int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) const noexcept = 0;
801 
802  IPluginV2IOExt() = default;
803  ~IPluginV2IOExt() override = default;
804 
805 protected:
806  IPluginV2IOExt(IPluginV2IOExt const&) = default;
807  IPluginV2IOExt(IPluginV2IOExt&&) = default;
808  IPluginV2IOExt& operator=(IPluginV2IOExt const&) & = default;
809  IPluginV2IOExt& operator=(IPluginV2IOExt&&) & = default;
810 
818  int32_t getTensorRTVersion() const noexcept override
819  {
820  return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_IOEXT) << 24U)
821  | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
822  }
823 
824 private:
825  // Following are obsolete base class methods, and must not be implemented or used.
826 
827  void configurePlugin(Dims const*, int32_t, Dims const*, int32_t, DataType const*, DataType const*, bool const*,
828  bool const*, PluginFormat, int32_t) noexcept override final
829  {
830  }
831 
832  bool supportsFormat(DataType, PluginFormat) const noexcept override final
833  {
834  return false;
835  }
836 };
837 
842 
843 enum class PluginFieldType : int32_t
844 {
846  kFLOAT16 = 0,
848  kFLOAT32 = 1,
850  kFLOAT64 = 2,
852  kINT8 = 3,
854  kINT16 = 4,
856  kINT32 = 5,
858  kCHAR = 6,
860  kDIMS = 7,
862  kUNKNOWN = 8
863 };
864 
873 {
874 public:
878  AsciiChar const* name;
882  void const* data;
891  int32_t length;
892 
893  PluginField(AsciiChar const* name_ = nullptr, void const* data_ = nullptr, PluginFieldType const type_ = PluginFieldType::kUNKNOWN, int32_t length_ = 0) noexcept
894  : name(name_)
895  , data(data_)
896  , type(type_)
897  , length(length_)
898  {
899  }
900 };
901 
904 {
906  int32_t nbFields;
909 };
910 
918 
920 {
921 public:
925  virtual int32_t getTensorRTVersion() const noexcept
926  {
927  return NV_TENSORRT_VERSION;
928  }
929 
933  virtual AsciiChar const* getPluginName() const noexcept = 0;
934 
938  virtual AsciiChar const* getPluginVersion() const noexcept = 0;
939 
944  virtual PluginFieldCollection const* getFieldNames() noexcept = 0;
945 
949  virtual IPluginV2* createPlugin(AsciiChar const* name, PluginFieldCollection const* fc) noexcept = 0;
950 
954  virtual IPluginV2* deserializePlugin(AsciiChar const* name, void const* serialData, size_t serialLength) noexcept = 0;
955 
962  virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
963 
967  virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
968 
969  IPluginCreator() = default;
970  virtual ~IPluginCreator() = default;
971 
972 protected:
973  IPluginCreator(IPluginCreator const&) = default;
974  IPluginCreator(IPluginCreator&&) = default;
975  IPluginCreator& operator=(IPluginCreator const&) & = default;
976  IPluginCreator& operator=(IPluginCreator&&) & = default;
977 };
978 
996 
998 {
999 public:
1004  virtual bool registerCreator(IPluginCreator& creator, AsciiChar const* pluginNamespace) noexcept = 0;
1005 
1010  virtual IPluginCreator* const* getPluginCreatorList(int32_t* numCreators) const noexcept = 0;
1011 
1016  virtual IPluginCreator* getPluginCreator(
1017  AsciiChar const* pluginName, AsciiChar const* pluginVersion, AsciiChar const* pluginNamespace = "") noexcept
1018  = 0;
1019 
1020  IPluginRegistry() = default;
1021  IPluginRegistry(IPluginRegistry const&) = delete;
1022  IPluginRegistry(IPluginRegistry&&) = delete;
1023  IPluginRegistry& operator=(IPluginRegistry const&) & = delete;
1024  IPluginRegistry& operator=(IPluginRegistry&&) & = delete;
1025 
1026 protected:
1027  virtual ~IPluginRegistry() noexcept = default;
1028 
1029 public:
1039  //
1042  virtual void setErrorRecorder(IErrorRecorder* recorder) noexcept = 0;
1043 
1055  virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
1056 
1068  virtual bool deregisterCreator(IPluginCreator const& creator) noexcept = 0;
1069 };
1070 
1071 enum class AllocatorFlag : int32_t
1072 {
1073  kRESIZABLE = 0,
1074 };
1075 
1076 namespace impl
1077 {
1079 template <>
1081 {
1082  static constexpr int32_t kVALUE = 1;
1083 };
1084 } // namespace impl
1085 
1086 using AllocatorFlags = uint32_t;
1087 
1094 {
1095 public:
1110  virtual void* allocate(uint64_t size, uint64_t alignment, AllocatorFlags flags) noexcept = 0;
1111 
1119  virtual void free(void* memory) noexcept = 0;
1120 
1125  virtual ~IGpuAllocator() = default;
1126  IGpuAllocator() = default;
1127 
1154  virtual void* reallocate(void* baseAddr, uint64_t alignment, uint64_t newSize) noexcept
1155  {
1156  return nullptr;
1157  }
1158 
1159 protected:
1160  IGpuAllocator(IGpuAllocator const&) = default;
1161  IGpuAllocator(IGpuAllocator&&) = default;
1162  IGpuAllocator& operator=(IGpuAllocator const&) & = default;
1163  IGpuAllocator& operator=(IGpuAllocator&&) & = default;
1164 };
1165 
1175 class ILogger
1176 {
1177 public:
1183  enum class Severity : int32_t
1184  {
1186  kINTERNAL_ERROR = 0,
1188  kERROR = 1,
1190  kWARNING = 2,
1192  kINFO = 3,
1194  kVERBOSE = 4,
1195  };
1196 
1203  virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
1204 
1205  ILogger() = default;
1206  virtual ~ILogger() = default;
1207 
1208 protected:
1209  ILogger(ILogger const&) = default;
1210  ILogger(ILogger&&) = default;
1211  ILogger& operator=(ILogger const&) & = default;
1212  ILogger& operator=(ILogger&&) & = default;
1213 };
1214 
1215 namespace impl
1216 {
1218 template <>
1219 struct EnumMaxImpl<ILogger::Severity>
1220 {
1222  static constexpr int32_t kVALUE = 5;
1223 };
1224 } // namespace impl
1225 
1231 enum class ErrorCode : int32_t
1232 {
1236  kSUCCESS = 0,
1237 
1241  kUNSPECIFIED_ERROR = 1,
1242 
1247  kINTERNAL_ERROR = 2,
1248 
1253  kINVALID_ARGUMENT = 3,
1254 
1262  kINVALID_CONFIG = 4,
1263 
1269  kFAILED_ALLOCATION = 5,
1270 
1276 
1283  kFAILED_EXECUTION = 7,
1284 
1291  kFAILED_COMPUTATION = 8,
1292 
1305  kINVALID_STATE = 9,
1306 
1317  kUNSUPPORTED_STATE = 10,
1318 
1319 };
1320 
1321 namespace impl
1322 {
1324 template <>
1326 {
1328  static constexpr int32_t kVALUE = 11;
1329 };
1330 } // namespace impl
1331 
1354 {
1355 public:
1359  using ErrorDesc = char const*;
1360 
1364  static constexpr size_t kMAX_DESC_LENGTH = 127U;
1365 
1369  using RefCount = int32_t;
1370 
1371  IErrorRecorder() = default;
1372  virtual ~IErrorRecorder() noexcept = default;
1373 
1374  // Public API used to retrieve information from the error recorder.
1375 
1389  virtual int32_t getNbErrors() const noexcept = 0;
1390 
1403  virtual ErrorCode getErrorCode(int32_t errorIdx) const noexcept = 0;
1404 
1419  virtual ErrorDesc getErrorDesc(int32_t errorIdx) const noexcept = 0;
1420 
1430  virtual bool hasOverflowed() const noexcept = 0;
1431 
1441  virtual void clear() noexcept = 0;
1442 
1443  // API used by TensorRT to report Error information to the application.
1444 
1457  virtual bool reportError(ErrorCode val, ErrorDesc desc) noexcept = 0;
1458 
1471  virtual RefCount incRefCount() noexcept = 0;
1472 
1484  virtual RefCount decRefCount() noexcept = 0;
1485 
1486 protected:
1487  IErrorRecorder(IErrorRecorder const&) = default;
1488  IErrorRecorder(IErrorRecorder&&) = default;
1489  IErrorRecorder& operator=(IErrorRecorder const&) & = default;
1490  IErrorRecorder& operator=(IErrorRecorder&&) & = default;
1491 
1492 }; // class IErrorRecorder
1493 
1494 } // namespace nvinfer1
1495 
1499 extern "C" TENSORRTAPI nvinfer1::ILogger* getLogger() noexcept;
1500 
1506 extern "C" TENSORRTAPI int32_t getInferLibVersion() noexcept;
1507 
1508 #endif // NV_INFER_RUNTIME_COMMON_H
getLogger
nvinfer1::ILogger * getLogger() noexcept
Return the logger object.
nvinfer1::ErrorCode::kINVALID_ARGUMENT
nvinfer1::ErrorCode::kFAILED_ALLOCATION
nvinfer1::AsciiChar
char_t AsciiChar
AsciiChar is the type used by TensorRT to represent valid ASCII characters.
Definition: NvInferRuntimeCommon.h:125
nvinfer1::TensorFormat::kCDHW32
nvinfer1::TensorFormat::kCHW16
nvinfer1::TensorFormat::kCHW32
nvinfer1::char_t
char char_t
char_t is the type used by TensorRT to represent all valid characters.
Definition: NvInferRuntimeCommon.h:123
nvinfer1::DataType::kINT32
Signed 32-bit integer format.
nvinfer1::PluginVersion::kV2_IOEXT
IPluginV2IOExt.
nvinfer1::IPluginV2::getPluginType
virtual AsciiChar const * getPluginType() const noexcept=0
Return the plugin type. Should match the plugin name returned by the corresponding plugin creator.
nvinfer1::IPluginV2::getOutputDimensions
virtual Dims getOutputDimensions(int32_t index, Dims const *inputs, int32_t nbInputDims) noexcept=0
Get the dimension of an output tensor.
nvinfer1::ErrorCode
ErrorCode
Error codes that can be returned by TensorRT during execution.
Definition: NvInferRuntimeCommon.h:1231
nvinfer1::PluginTensorDesc::scale
float scale
Scale for INT8 data type.
Definition: NvInferRuntimeCommon.h:377
nvinfer1::PluginFieldType::kDIMS
nvinfer1::Dims field type.
nvinfer1::ProfilingVerbosity::kVERBOSE
Register layer names in NVTX message field and register layer detail in NVTX JSON payload field.
nvinfer1::DataType::kBOOL
8-bit boolean. 0 = false, 1 = true, other values undefined.
nvinfer1::impl::EnumMaxImpl
Declaration of EnumMaxImpl struct to store maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:136
nvinfer1::IPluginV2Ext::attachToContext
virtual void attachToContext(cudnnContext *, cublasContext *, IGpuAllocator *) noexcept
Attach the plugin object to an execution context and grant the plugin the access to some context reso...
Definition: NvInferRuntimeCommon.h:694
nvinfer1::IPluginV2
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:409
nvinfer1::Dims32
Definition: NvInferRuntimeCommon.h:189
nvinfer1::IPluginV2::clone
virtual IPluginV2 * clone() const noexcept=0
Clone the plugin object. This copies over internal plugin parameters and returns a new plugin object ...
nvinfer1::IPluginV2::getPluginVersion
virtual AsciiChar const * getPluginVersion() const noexcept=0
Return the plugin version. Should match the plugin version returned by the corresponding plugin creat...
nvinfer1::IPluginV2::setPluginNamespace
virtual void setPluginNamespace(AsciiChar const *pluginNamespace) noexcept=0
Set the namespace that this plugin object belongs to. Ideally, all plugin objects from the same plugi...
nvinfer1::IErrorRecorder::RefCount
int32_t RefCount
Definition: NvInferRuntimeCommon.h:1369
nvinfer1::DataType::kHALF
IEEE 16-bit floating-point format.
nvinfer1::PluginVersion::kV2_DYNAMICEXT
IPluginV2DynamicExt.
nvinfer1::BuilderFlag::kINT8
Enable Int8 layer selection, with FP32 fallback with FP16 fallback if kFP16 also specified.
nvinfer1::PluginFieldType::kCHAR
char field type.
nvinfer1::TensorFormat
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntimeCommon.h:220
nvinfer1::IPluginCreator
Plugin creator class for user implemented layers.
Definition: NvInferRuntimeCommon.h:919
nvinfer1::IPluginRegistry
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:997
nvinfer1::TensorFormat::kDHWC8
nvinfer1::PluginVersion::kV2_EXT
IPluginV2Ext.
NvInferVersion.h
nvinfer1::PluginFieldType
PluginFieldType
Definition: NvInferRuntimeCommon.h:843
nvinfer1::ILogger
Application-implemented logging interface for the builder, engine and runtime.
Definition: NvInferRuntimeCommon.h:1175
nvinfer1::TensorFormat::kHWC16
nvinfer1::IPluginV2::getWorkspaceSize
virtual size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept=0
Find the workspace size required by the layer.
nvinfer1::PluginFieldType::kUNKNOWN
Unknown field type.
nvinfer1::Dims32::d
int32_t d[MAX_DIMS]
The extent of each dimension.
Definition: NvInferRuntimeCommon.h:197
nvinfer1::IPluginV2::getPluginNamespace
virtual AsciiChar const * getPluginNamespace() const noexcept=0
Return the namespace of the plugin object.
nvinfer1::PluginField::length
int32_t length
Number of data entries in the Plugin attribute.
Definition: NvInferRuntimeCommon.h:891
nvinfer1::PluginField::type
PluginFieldType type
Plugin field attribute type.
Definition: NvInferRuntimeCommon.h:887
nvinfer1::PluginTensorDesc::type
DataType type
Definition: NvInferRuntimeCommon.h:373
nvinfer1::IPluginV2Ext::configureWithFormat
void configureWithFormat(Dims const *, int32_t, Dims const *, int32_t, DataType, PluginFormat, int32_t) noexcept override
Derived classes should not implement this. In a C++11 API it would be override final.
Definition: NvInferRuntimeCommon.h:735
nvinfer1::TensorFormat::kDLA_HWC4
nvinfer1::PluginFieldType::kINT16
INT16 field type.
nvinfer1::TensorFormat::kHWC8
nvinfer1
The TensorRT API version 1 namespace.
nvinfer1::PluginTensorDesc::format
TensorFormat format
Tensor format.
Definition: NvInferRuntimeCommon.h:375
NV_TENSORRT_MINOR
#define NV_TENSORRT_MINOR
TensorRT minor version.
Definition: NvInferVersion.h:60
nvinfer1::Dims32::nbDims
int32_t nbDims
The number of dimensions.
Definition: NvInferRuntimeCommon.h:195
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: NvInferRuntimeCommon.h:107
nvinfer1::IGpuAllocator::reallocate
virtual void * reallocate(void *baseAddr, uint64_t alignment, uint64_t newSize) noexcept
Definition: NvInferRuntimeCommon.h:1154
nvinfer1::IErrorRecorder::ErrorDesc
char const * ErrorDesc
Definition: NvInferRuntimeCommon.h:1359
nvinfer1::ErrorCode::kUNSUPPORTED_STATE
nvinfer1::TensorFormat::kHWC
cudaEvent_t
struct CUevent_st * cudaEvent_t
Forward declaration of cudaEvent_t.
Definition: NvInferRuntimeCommon.h:110
nvinfer1::IPluginV2Ext::detachFromContext
virtual void detachFromContext() noexcept
Detach the plugin object from its execution context.
Definition: NvInferRuntimeCommon.h:704
nvinfer1::ErrorCode::kINVALID_CONFIG
nvinfer1::ErrorCode::kSUCCESS
PluginVersion
Definition of plugin versions.
nvinfer1::RNNInputMode::kLINEAR
Perform the normal matrix multiplication in the first recurrent layer.
nvinfer1::PluginFieldType::kFLOAT64
FP64 field type.
nvinfer1::PluginFieldCollection::nbFields
int32_t nbFields
Number of PluginField entries.
Definition: NvInferRuntimeCommon.h:906
nvinfer1::IPluginV2::getNbOutputs
virtual int32_t getNbOutputs() const noexcept=0
Get the number of outputs from the layer.
nvinfer1::PluginFieldType::kFLOAT16
FP16 field type.
nvinfer1::DataType
DataType
The type of weights and tensors.
Definition: NvInferRuntimeCommon.h:150
nvinfer1::IPluginV2IOExt::getTensorRTVersion
int32_t getTensorRTVersion() const noexcept override
Return the API version with which this plugin was built. The upper byte is reserved by TensorRT and i...
Definition: NvInferRuntimeCommon.h:818
nvinfer1::TensorFormat::kCHW4
nvinfer1::ILogger::Severity
Severity
Definition: NvInferRuntimeCommon.h:1183
nvinfer1::EnumMax
constexpr int32_t EnumMax() noexcept
Maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:141
nvinfer1::IPluginV2::getTensorRTVersion
virtual int32_t getTensorRTVersion() const noexcept
Return the API version with which this plugin was built.
Definition: NvInferRuntimeCommon.h:417
nvinfer1::IPluginV2IOExt
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:750
nvinfer1::IPluginV2::enqueue
virtual int32_t enqueue(int32_t batchSize, void const *const *inputs, void *const *outputs, void *workspace, cudaStream_t stream) noexcept=0
Execute the layer.
nvinfer1::ErrorCode::kFAILED_INITIALIZATION
nvinfer1::IErrorRecorder
Reference counted application-implemented error reporting interface for TensorRT objects.
Definition: NvInferRuntimeCommon.h:1353
nvinfer1::AllocatorFlag::kRESIZABLE
TensorRT may call realloc() on this allocation.
nvinfer1::ErrorCode::kFAILED_COMPUTATION
nvinfer1::IPluginV2::configureWithFormat
virtual void configureWithFormat(Dims const *inputDims, int32_t nbInputs, Dims const *outputDims, int32_t nbOutputs, DataType type, PluginFormat format, int32_t maxBatchSize) noexcept=0
Configure the layer.
nvinfer1::IPluginV2::getSerializationSize
virtual size_t getSerializationSize() const noexcept=0
Find the size of the serialization buffer required.
nvinfer1::IPluginV2::serialize
virtual void serialize(void *buffer) const noexcept=0
Serialize the layer.
nvinfer1::IPluginV2Ext
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:599
nvinfer1::ErrorCode::kUNSPECIFIED_ERROR
nvinfer1::Dims32::MAX_DIMS
static constexpr int32_t MAX_DIMS
The maximum number of dimensions supported for a tensor.
Definition: NvInferRuntimeCommon.h:193
nvinfer1::DataType::kFLOAT
32-bit floating point format.
nvinfer1::TensorFormat::kCHW2
nvinfer1::PluginField::name
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferRuntimeCommon.h:878
nvinfer1::PluginVersion::kV2
IPluginV2.
nvinfer1::PluginFieldCollection::fields
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferRuntimeCommon.h:908
nvinfer1::PluginTensorDesc::dims
Dims dims
Dimensions.
Definition: NvInferRuntimeCommon.h:371
nvinfer1::PluginFieldType::kFLOAT32
FP32 field type.
nvinfer1::PluginTensorDesc
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimeCommon.h:368
nvinfer1::IPluginV2::initialize
virtual int32_t initialize() noexcept=0
Initialize the layer for execution. This is called when the engine is created.
NV_TENSORRT_MAJOR
#define NV_TENSORRT_MAJOR
TensorRT major version.
Definition: NvInferVersion.h:59
nvinfer1::ErrorCode::kINVALID_STATE
nvinfer1::PluginFormat
TensorFormat PluginFormat
PluginFormat is reserved for backward compatibility.
Definition: NvInferRuntimeCommon.h:345
nvinfer1::IPluginV2::destroy
virtual void destroy() noexcept=0
Destroy the plugin object. This will be called when the network, builder or engine is destroyed.
nvinfer1::IPluginV2::supportsFormat
virtual bool supportsFormat(DataType type, PluginFormat format) const noexcept=0
Check format support.
nvinfer1::IPluginV2::terminate
virtual void terminate() noexcept=0
Release resources acquired during plugin layer initialization. This is called when the engine is dest...
nvinfer1::AllocatorFlag
AllocatorFlag
Definition: NvInferRuntimeCommon.h:1071
nvinfer1::IGpuAllocator
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:1093
nvinfer1::TensorFormat::kDLA_LINEAR
nvinfer1::ErrorCode::kINTERNAL_ERROR
NV_TENSORRT_PATCH
#define NV_TENSORRT_PATCH
TensorRT patch version.
Definition: NvInferVersion.h:61
nvinfer1::ErrorCode::kFAILED_EXECUTION
nvinfer1::PluginFieldCollection
Plugin field collection struct.
Definition: NvInferRuntimeCommon.h:903
nvinfer1::PluginField
Structure containing plugin attribute field names and associated data This information can be parsed ...
Definition: NvInferRuntimeCommon.h:872
nvinfer1::IPluginCreator::getTensorRTVersion
virtual int32_t getTensorRTVersion() const noexcept
Return the version of the API the plugin creator was compiled with.
Definition: NvInferRuntimeCommon.h:925
getInferLibVersion
int32_t getInferLibVersion() noexcept
Return the library version number.
nvinfer1::PluginField::data
void const * data
Plugin field attribute data.
Definition: NvInferRuntimeCommon.h:882