TensorRT  8.2.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 #include <cuda_runtime_api.h>
57 
59 #if __cplusplus >= 201402L
60 #define TRT_DEPRECATED [[deprecated]]
61 #if __GNUC__ < 6
62 #define TRT_DEPRECATED_ENUM
63 #else
64 #define TRT_DEPRECATED_ENUM TRT_DEPRECATED
65 #endif
66 #ifdef _MSC_VER
67 #define TRT_DEPRECATED_API __declspec(dllexport)
68 #else
69 #define TRT_DEPRECATED_API [[deprecated]] __attribute__((visibility("default")))
70 #endif
71 #else
72 #ifdef _MSC_VER
73 #define TRT_DEPRECATED
74 #define TRT_DEPRECATED_ENUM
75 #define TRT_DEPRECATED_API __declspec(dllexport)
76 #else
77 #define TRT_DEPRECATED __attribute__((deprecated))
78 #define TRT_DEPRECATED_ENUM
79 #define TRT_DEPRECATED_API __attribute__((deprecated, visibility("default")))
80 #endif
81 #endif
82 
84 #ifdef TENSORRT_BUILD_LIB
85 #ifdef _MSC_VER
86 #define TENSORRTAPI __declspec(dllexport)
87 #else
88 #define TENSORRTAPI __attribute__((visibility("default")))
89 #endif
90 #else
91 #define TENSORRTAPI
92 #endif
93 #define TRTNOEXCEPT
94 
100 // forward declare some CUDA types to avoid an include dependency
101 
102 extern "C"
103 {
105  struct cublasContext;
107  struct cudnnContext;
108 }
109 
110 #define NV_TENSORRT_VERSION nvinfer1::kNV_TENSORRT_VERSION_IMPL
111 namespace nvinfer1
117 {
118 
119 static constexpr int32_t kNV_TENSORRT_VERSION_IMPL
120  = (NV_TENSORRT_MAJOR * 1000) + (NV_TENSORRT_MINOR * 100) + NV_TENSORRT_PATCH; // major, minor, patch
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 
429  virtual AsciiChar const* getPluginType() const noexcept = 0;
430 
438  virtual AsciiChar const* getPluginVersion() const noexcept = 0;
439 
448  virtual int32_t getNbOutputs() const noexcept = 0;
449 
460  virtual Dims getOutputDimensions(int32_t index, Dims const* inputs, int32_t nbInputDims) noexcept = 0;
461 
479  virtual bool supportsFormat(DataType type, PluginFormat format) const noexcept = 0;
480 
504  virtual void configureWithFormat(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
505  DataType type, PluginFormat format, int32_t maxBatchSize) noexcept = 0;
506 
512  virtual int32_t initialize() noexcept = 0;
513 
519  virtual void terminate() noexcept = 0;
520 
529  virtual size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept = 0;
530 
542  virtual int32_t enqueue(int32_t batchSize, void const* const* inputs, void* const* outputs, void* workspace,
543  cudaStream_t stream) noexcept
544  = 0;
545 
551  virtual size_t getSerializationSize() const noexcept = 0;
552 
561  virtual void serialize(void* buffer) const noexcept = 0;
562 
566  virtual void destroy() noexcept = 0;
567 
576  virtual IPluginV2* clone() const noexcept = 0;
577 
587  virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
588 
592  virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
593 
594 // @cond SuppressDoxyWarnings
595  IPluginV2() = default;
596  virtual ~IPluginV2() noexcept = default;
597 // @endcond
598 
599 protected:
600 // @cond SuppressDoxyWarnings
601  IPluginV2(IPluginV2 const&) = default;
602  IPluginV2(IPluginV2&&) = default;
603  IPluginV2& operator=(IPluginV2 const&) & = default;
604  IPluginV2& operator=(IPluginV2&&) & = default;
605 // @endcond
606 };
607 
618 class IPluginV2Ext : public IPluginV2
619 {
620 public:
629  virtual nvinfer1::DataType getOutputDataType(
630  int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept = 0;
631 
642  virtual bool isOutputBroadcastAcrossBatch(
643  int32_t outputIndex, bool const* inputIsBroadcasted, int32_t nbInputs) const noexcept = 0;
644 
658  virtual bool canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept = 0;
659 
688 
689  virtual void configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
690  DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
691  bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept = 0;
692 
693  IPluginV2Ext() = default;
694  ~IPluginV2Ext() override = default;
695 
713  virtual void attachToContext(cudnnContext* /*cudnn*/, cublasContext* /*cublas*/, IGpuAllocator* /*allocator*/) noexcept {}
714 
723  virtual void detachFromContext() noexcept {}
724 
730  IPluginV2Ext* clone() const noexcept override = 0;
731 
732 protected:
733 // @cond SuppressDoxyWarnings
734  IPluginV2Ext(IPluginV2Ext const&) = default;
735  IPluginV2Ext(IPluginV2Ext&&) = default;
736  IPluginV2Ext& operator=(IPluginV2Ext const&) & = default;
737  IPluginV2Ext& operator=(IPluginV2Ext&&) & = default;
738 // @endcond
739 
747  int32_t getTensorRTVersion() const noexcept override
748  {
749  return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_EXT) << 24U)
750  | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
751  }
752 
756  void configureWithFormat(Dims const* /*inputDims*/, int32_t /*nbInputs*/, Dims const* /*outputDims*/,
757  int32_t /*nbOutputs*/, DataType /*type*/, PluginFormat /*format*/, int32_t /*maxBatchSize*/) noexcept override
758  {
759  }
760 };
761 
772 {
773 public:
785  virtual void configurePlugin(
786  PluginTensorDesc const* in, int32_t nbInput, PluginTensorDesc const* out, int32_t nbOutput) noexcept = 0;
787 
820  virtual bool supportsFormatCombination(
821  int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) const noexcept = 0;
822 
823 // @cond SuppressDoxyWarnings
824  IPluginV2IOExt() = default;
825  ~IPluginV2IOExt() override = default;
826 // @endcond
827 
828 protected:
829 // @cond SuppressDoxyWarnings
830  IPluginV2IOExt(IPluginV2IOExt const&) = default;
831  IPluginV2IOExt(IPluginV2IOExt&&) = default;
832  IPluginV2IOExt& operator=(IPluginV2IOExt const&) & = default;
833  IPluginV2IOExt& operator=(IPluginV2IOExt&&) & = default;
834 // @endcond
835 
843  int32_t getTensorRTVersion() const noexcept override
844  {
845  return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_IOEXT) << 24U)
846  | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
847  }
848 
849 private:
850  // Following are obsolete base class methods, and must not be implemented or used.
851 
852  void configurePlugin(Dims const*, int32_t, Dims const*, int32_t, DataType const*, DataType const*, bool const*,
853  bool const*, PluginFormat, int32_t) noexcept final
854  {
855  }
856 
857  bool supportsFormat(DataType, PluginFormat) const noexcept final
858  {
859  return false;
860  }
861 };
862 
867 
868 enum class PluginFieldType : int32_t
869 {
871  kFLOAT16 = 0,
873  kFLOAT32 = 1,
875  kFLOAT64 = 2,
877  kINT8 = 3,
879  kINT16 = 4,
881  kINT32 = 5,
883  kCHAR = 6,
885  kDIMS = 7,
887  kUNKNOWN = 8
888 };
889 
898 {
899 public:
903  AsciiChar const* name;
907  void const* data;
916  int32_t length;
917 
918  PluginField(AsciiChar const* const name_ = nullptr, void const* const data_ = nullptr,
919  PluginFieldType const type_ = PluginFieldType::kUNKNOWN, int32_t const length_ = 0) noexcept
920  : name(name_)
921  , data(data_)
922  , type(type_)
923  , length(length_)
924  {
925  }
926 };
927 
930 {
932  int32_t nbFields;
935 };
936 
944 
946 {
947 public:
951  virtual int32_t getTensorRTVersion() const noexcept
952  {
953  return NV_TENSORRT_VERSION;
954  }
955 
962  virtual AsciiChar const* getPluginName() const noexcept = 0;
963 
970  virtual AsciiChar const* getPluginVersion() const noexcept = 0;
971 
976  virtual PluginFieldCollection const* getFieldNames() noexcept = 0;
977 
981  virtual IPluginV2* createPlugin(AsciiChar const* name, PluginFieldCollection const* fc) noexcept = 0;
982 
986  virtual IPluginV2* deserializePlugin(AsciiChar const* name, void const* serialData, size_t serialLength) noexcept = 0;
987 
994  virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
995 
1002  virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
1003 
1004  IPluginCreator() = default;
1005  virtual ~IPluginCreator() = default;
1006 
1007 protected:
1008 // @cond SuppressDoxyWarnings
1009  IPluginCreator(IPluginCreator const&) = default;
1010  IPluginCreator(IPluginCreator&&) = default;
1011  IPluginCreator& operator=(IPluginCreator const&) & = default;
1012  IPluginCreator& operator=(IPluginCreator&&) & = default;
1013 // @endcond
1014 };
1015 
1033 
1035 {
1036 public:
1044  virtual bool registerCreator(IPluginCreator& creator, AsciiChar const* const pluginNamespace) noexcept = 0;
1045 
1050  virtual IPluginCreator* const* getPluginCreatorList(int32_t* const numCreators) const noexcept = 0;
1051 
1059  virtual IPluginCreator* getPluginCreator(AsciiChar const* const pluginName, AsciiChar const* const pluginVersion,
1060  AsciiChar const* const pluginNamespace = "") noexcept
1061  = 0;
1062 
1063  // @cond SuppressDoxyWarnings
1064  IPluginRegistry() = default;
1065  IPluginRegistry(IPluginRegistry const&) = delete;
1066  IPluginRegistry(IPluginRegistry&&) = delete;
1067  IPluginRegistry& operator=(IPluginRegistry const&) & = delete;
1068  IPluginRegistry& operator=(IPluginRegistry&&) & = delete;
1069 // @endcond
1070 
1071 protected:
1072  virtual ~IPluginRegistry() noexcept = default;
1073 
1074 public:
1084  //
1087  virtual void setErrorRecorder(IErrorRecorder* const recorder) noexcept = 0;
1088 
1100  virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
1101 
1113  virtual bool deregisterCreator(IPluginCreator const& creator) noexcept = 0;
1114 };
1115 
1116 enum class AllocatorFlag : int32_t
1117 {
1118  kRESIZABLE = 0,
1119 };
1120 
1121 namespace impl
1122 {
1124 template <>
1126 {
1127  static constexpr int32_t kVALUE = 1;
1128 };
1129 } // namespace impl
1130 
1131 using AllocatorFlags = uint32_t;
1132 
1139 {
1140 public:
1158  virtual void* allocate(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept = 0;
1159 
1174  TRT_DEPRECATED virtual void free(void* const memory) noexcept = 0;
1175 
1180  virtual ~IGpuAllocator() = default;
1181  IGpuAllocator() = default;
1182 
1212  virtual void* reallocate(void* /*baseAddr*/, uint64_t /*alignment*/, uint64_t /*newSize*/) noexcept
1213  {
1214  return nullptr;
1215  }
1216 
1233  virtual bool deallocate(void* const memory) noexcept
1234  {
1235  this->free(memory);
1236  return true;
1237  }
1238 
1239 protected:
1240 // @cond SuppressDoxyWarnings
1241  IGpuAllocator(IGpuAllocator const&) = default;
1242  IGpuAllocator(IGpuAllocator&&) = default;
1243  IGpuAllocator& operator=(IGpuAllocator const&) & = default;
1244  IGpuAllocator& operator=(IGpuAllocator&&) & = default;
1245 // @endcond
1246 };
1247 
1256 class ILogger
1257 {
1258 public:
1264  enum class Severity : int32_t
1265  {
1267  kINTERNAL_ERROR = 0,
1269  kERROR = 1,
1271  kWARNING = 2,
1273  kINFO = 3,
1275  kVERBOSE = 4,
1276  };
1277 
1284  virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
1285 
1286  ILogger() = default;
1287  virtual ~ILogger() = default;
1288 
1289 protected:
1290 // @cond SuppressDoxyWarnings
1291  ILogger(ILogger const&) = default;
1292  ILogger(ILogger&&) = default;
1293  ILogger& operator=(ILogger const&) & = default;
1294  ILogger& operator=(ILogger&&) & = default;
1295 // @endcond
1296 };
1297 
1298 namespace impl
1299 {
1301 template <>
1302 struct EnumMaxImpl<ILogger::Severity>
1303 {
1305  static constexpr int32_t kVALUE = 5;
1306 };
1307 } // namespace impl
1308 
1314 enum class ErrorCode : int32_t
1315 {
1319  kSUCCESS = 0,
1320 
1324  kUNSPECIFIED_ERROR = 1,
1325 
1330  kINTERNAL_ERROR = 2,
1331 
1336  kINVALID_ARGUMENT = 3,
1337 
1345  kINVALID_CONFIG = 4,
1346 
1352  kFAILED_ALLOCATION = 5,
1353 
1359 
1366  kFAILED_EXECUTION = 7,
1367 
1375  kFAILED_COMPUTATION = 8,
1376 
1389  kINVALID_STATE = 9,
1390 
1401  kUNSUPPORTED_STATE = 10,
1402 
1403 };
1404 
1405 namespace impl
1406 {
1408 template <>
1410 {
1412  static constexpr int32_t kVALUE = 11;
1413 };
1414 } // namespace impl
1415 
1440 {
1441 public:
1445  using ErrorDesc = char const*;
1446 
1450  static constexpr size_t kMAX_DESC_LENGTH = 127U;
1451 
1455  using RefCount = int32_t;
1456 
1457  IErrorRecorder() = default;
1458  virtual ~IErrorRecorder() noexcept = default;
1459 
1460  // Public API used to retrieve information from the error recorder.
1461 
1475  virtual int32_t getNbErrors() const noexcept = 0;
1476 
1489  virtual ErrorCode getErrorCode(int32_t errorIdx) const noexcept = 0;
1490 
1505  virtual ErrorDesc getErrorDesc(int32_t errorIdx) const noexcept = 0;
1506 
1516  virtual bool hasOverflowed() const noexcept = 0;
1517 
1527  virtual void clear() noexcept = 0;
1528 
1529  // API used by TensorRT to report Error information to the application.
1530 
1546  virtual bool reportError(ErrorCode val, ErrorDesc desc) noexcept = 0;
1547 
1559  virtual RefCount incRefCount() noexcept = 0;
1560 
1572  virtual RefCount decRefCount() noexcept = 0;
1573 
1574 protected:
1575 // @cond SuppressDoxyWarnings
1576  IErrorRecorder(IErrorRecorder const&) = default;
1577  IErrorRecorder(IErrorRecorder&&) = default;
1578  IErrorRecorder& operator=(IErrorRecorder const&) & = default;
1579  IErrorRecorder& operator=(IErrorRecorder&&) & = default;
1580  // @endcond
1581 }; // class IErrorRecorder
1582 } // namespace nvinfer1
1583 
1589 extern "C" TENSORRTAPI int32_t getInferLibVersion() noexcept;
1590 
1591 #endif // NV_INFER_RUNTIME_COMMON_H
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:1314
nvinfer1::PluginTensorDesc::scale
float scale
Scale for INT8 data type.
Definition: NvInferRuntimeCommon.h:377
nvinfer1::PluginFieldType::kDIMS
nvinfer1::Dims field type.
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:713
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:1455
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:945
nvinfer1::IPluginRegistry
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:1034
nvinfer1::TensorFormat::kDHWC8
nvinfer1::PluginVersion::kV2_EXT
IPluginV2Ext.
NvInferVersion.h
nvinfer1::PluginFieldType
PluginFieldType
Definition: NvInferRuntimeCommon.h:868
nvinfer1::ILogger
Application-implemented logging interface for the builder, refitter and runtime.
Definition: NvInferRuntimeCommon.h:1256
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::IGpuAllocator::reallocate
virtual void * reallocate(void *, uint64_t, uint64_t) noexcept
Definition: NvInferRuntimeCommon.h:1212
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:916
nvinfer1::PluginField::type
PluginFieldType type
Plugin field attribute type.
Definition: NvInferRuntimeCommon.h:912
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:756
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 rank (number of dimensions).
Definition: NvInferRuntimeCommon.h:195
nvinfer1::IErrorRecorder::ErrorDesc
char const * ErrorDesc
Definition: NvInferRuntimeCommon.h:1445
nvinfer1::ErrorCode::kUNSUPPORTED_STATE
nvinfer1::TensorFormat::kHWC
nvinfer1::IPluginV2Ext::detachFromContext
virtual void detachFromContext() noexcept
Detach the plugin object from its execution context.
Definition: NvInferRuntimeCommon.h:723
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:932
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:843
nvinfer1::TensorFormat::kCHW4
nvinfer1::ILogger::Severity
Severity
Definition: NvInferRuntimeCommon.h:1264
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:771
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:1439
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:618
nvinfer1::ErrorCode::kUNSPECIFIED_ERROR
nvinfer1::Dims32::MAX_DIMS
static constexpr int32_t MAX_DIMS
The maximum rank (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:903
nvinfer1::PluginVersion::kV2
IPluginV2.
nvinfer1::PluginFieldCollection::fields
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferRuntimeCommon.h:934
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:1116
nvinfer1::IGpuAllocator
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:1138
nvinfer1::TensorFormat::kDLA_LINEAR
nvinfer1::IGpuAllocator::deallocate
virtual bool deallocate(void *const memory) noexcept
Definition: NvInferRuntimeCommon.h:1233
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:929
nvinfer1::PluginField
Structure containing plugin attribute field names and associated data This information can be parsed ...
Definition: NvInferRuntimeCommon.h:897
nvinfer1::IPluginCreator::getTensorRTVersion
virtual int32_t getTensorRTVersion() const noexcept
Return the version of the API the plugin creator was compiled with.
Definition: NvInferRuntimeCommon.h:951
TRT_DEPRECATED
#define TRT_DEPRECATED
< Items that are marked as deprecated will be removed in a future release.
Definition: NvInferRuntimeCommon.h:77
getInferLibVersion
int32_t getInferLibVersion() noexcept
Return the library version number.
nvinfer1::PluginField::data
void const * data
Plugin field attribute data.
Definition: NvInferRuntimeCommon.h:907