TensorRT  8.0.2
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 
101 extern "C"
102 {
104  struct cublasContext;
106  struct cudnnContext;
107 
109  using cudaStream_t = struct CUstream_st*;
110 
112  using cudaEvent_t = struct CUevent_st*;
113 }
114 
115 #define NV_TENSORRT_VERSION nvinfer1::kNV_TENSORRT_VERSION_IMPL
116 namespace nvinfer1
122 {
123 
124 static constexpr int32_t kNV_TENSORRT_VERSION_IMPL
125  = (NV_TENSORRT_MAJOR * 1000) + (NV_TENSORRT_MINOR * 100) + NV_TENSORRT_PATCH; // major, minor, patch
126 
128 using char_t = char;
131 
133 class IErrorRecorder;
135 class IGpuAllocator;
136 
137 namespace impl
138 {
140 template <typename T>
141 struct EnumMaxImpl;
142 } // namespace impl
143 
145 template <typename T>
146 constexpr int32_t EnumMax() noexcept
147 {
148  return impl::EnumMaxImpl<T>::kVALUE;
149 }
150 
155 enum class DataType : int32_t
156 {
158  kFLOAT = 0,
159 
161  kHALF = 1,
162 
164  kINT8 = 2,
165 
167  kINT32 = 3,
168 
170  kBOOL = 4
171 };
172 
173 namespace impl
174 {
176 template <>
178 {
179  // Declaration of kVALUE that represents maximum number of elements in DataType enum
180  static constexpr int32_t kVALUE = 5;
181 };
182 } // namespace impl
183 
194 class Dims32
195 {
196 public:
198  static constexpr int32_t MAX_DIMS{8};
200  int32_t nbDims;
202  int32_t d[MAX_DIMS];
203 };
204 
210 using Dims = Dims32;
211 
225 enum class TensorFormat : int32_t
226 {
234  kLINEAR = 0,
235 
242  kCHW2 = 1,
243 
250  kHWC8 = 2,
251 
267  kCHW4 = 3,
268 
279  kCHW16 = 4,
280 
290  kCHW32 = 5,
291 
298  kDHWC8 = 6,
299 
306  kCDHW32 = 7,
307 
310  kHWC = 8,
311 
320  kDLA_LINEAR = 9,
321 
334  kDLA_HWC4 = 10,
335 
342  kHWC16 = 11
343 };
344 
351 
352 namespace impl
353 {
355 template <>
357 {
359  static constexpr int32_t kVALUE = 12;
360 };
361 } // namespace impl
362 
374 {
382  float scale;
383 };
384 
391 enum class PluginVersion : uint8_t
392 {
394  kV2 = 0,
396  kV2_EXT = 1,
398  kV2_IOEXT = 2,
400  kV2_DYNAMICEXT = 3,
401 };
402 
415 {
416 public:
422  virtual int32_t getTensorRTVersion() const noexcept
423  {
424  return NV_TENSORRT_VERSION;
425  }
426 
431  virtual AsciiChar const* getPluginType() const noexcept = 0;
432 
437  virtual AsciiChar const* getPluginVersion() const noexcept = 0;
438 
447  virtual int32_t getNbOutputs() const noexcept = 0;
448 
459  virtual Dims getOutputDimensions(int32_t index, Dims const* inputs, int32_t nbInputDims) noexcept = 0;
460 
478  virtual bool supportsFormat(DataType type, PluginFormat format) const noexcept = 0;
479 
503  virtual void configureWithFormat(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
504  DataType type, PluginFormat format, int32_t maxBatchSize) noexcept = 0;
505 
511  virtual int32_t initialize() noexcept = 0;
512 
518  virtual void terminate() noexcept = 0;
519 
528  virtual size_t getWorkspaceSize(int32_t maxBatchSize) const noexcept = 0;
529 
541  virtual int32_t enqueue(int32_t batchSize, void const* const* inputs, void* const* outputs, void* workspace,
542  cudaStream_t stream) noexcept
543  = 0;
544 
550  virtual size_t getSerializationSize() const noexcept = 0;
551 
560  virtual void serialize(void* buffer) const noexcept = 0;
561 
565  virtual void destroy() noexcept = 0;
566 
575  virtual IPluginV2* clone() const noexcept = 0;
576 
581  virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
582 
586  virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
587 
588  IPluginV2() = default;
589  virtual ~IPluginV2() noexcept = default;
590 
591 protected:
592  IPluginV2(IPluginV2 const&) = default;
593  IPluginV2(IPluginV2&&) = default;
594  IPluginV2& operator=(IPluginV2 const&) & = default;
595  IPluginV2& operator=(IPluginV2&&) & = default;
596 };
597 
608 class IPluginV2Ext : public IPluginV2
609 {
610 public:
619  virtual nvinfer1::DataType getOutputDataType(
620  int32_t index, nvinfer1::DataType const* inputTypes, int32_t nbInputs) const noexcept = 0;
621 
632  virtual bool isOutputBroadcastAcrossBatch(
633  int32_t outputIndex, bool const* inputIsBroadcasted, int32_t nbInputs) const noexcept = 0;
634 
648  virtual bool canBroadcastInputAcrossBatch(int32_t inputIndex) const noexcept = 0;
649 
678 
679  virtual void configurePlugin(Dims const* inputDims, int32_t nbInputs, Dims const* outputDims, int32_t nbOutputs,
680  DataType const* inputTypes, DataType const* outputTypes, bool const* inputIsBroadcast,
681  bool const* outputIsBroadcast, PluginFormat floatFormat, int32_t maxBatchSize) noexcept = 0;
682 
683  IPluginV2Ext() = default;
684  ~IPluginV2Ext() override = default;
685 
703  virtual void attachToContext(cudnnContext* /*cudnn*/, cublasContext* /*cublas*/, IGpuAllocator* /*allocator*/) noexcept {}
704 
713  virtual void detachFromContext() noexcept {}
714 
720  IPluginV2Ext* clone() const noexcept override = 0;
721 
722 protected:
723  IPluginV2Ext(IPluginV2Ext const&) = default;
724  IPluginV2Ext(IPluginV2Ext&&) = default;
725  IPluginV2Ext& operator=(IPluginV2Ext const&) & = default;
726  IPluginV2Ext& operator=(IPluginV2Ext&&) & = default;
727 
735  int32_t getTensorRTVersion() const noexcept override
736  {
737  return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_EXT) << 24U)
738  | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
739  }
740 
744  void configureWithFormat(Dims const* /*inputDims*/, int32_t /*nbInputs*/, Dims const* /*outputDims*/,
745  int32_t /*nbOutputs*/, DataType /*type*/, PluginFormat /*format*/, int32_t /*maxBatchSize*/) noexcept override
746  {
747  }
748 };
749 
760 {
761 public:
773  virtual void configurePlugin(
774  PluginTensorDesc const* in, int32_t nbInput, PluginTensorDesc const* out, int32_t nbOutput) noexcept = 0;
775 
808  virtual bool supportsFormatCombination(
809  int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) const noexcept = 0;
810 
811  IPluginV2IOExt() = default;
812  ~IPluginV2IOExt() override = default;
813 
814 protected:
815  IPluginV2IOExt(IPluginV2IOExt const&) = default;
816  IPluginV2IOExt(IPluginV2IOExt&&) = default;
817  IPluginV2IOExt& operator=(IPluginV2IOExt const&) & = default;
818  IPluginV2IOExt& operator=(IPluginV2IOExt&&) & = default;
819 
827  int32_t getTensorRTVersion() const noexcept override
828  {
829  return static_cast<int32_t>((static_cast<uint32_t>(PluginVersion::kV2_IOEXT) << 24U)
830  | (static_cast<uint32_t>(NV_TENSORRT_VERSION) & 0xFFFFFFU));
831  }
832 
833 private:
834  // Following are obsolete base class methods, and must not be implemented or used.
835 
836  void configurePlugin(Dims const*, int32_t, Dims const*, int32_t, DataType const*, DataType const*, bool const*,
837  bool const*, PluginFormat, int32_t) noexcept override final
838  {
839  }
840 
841  bool supportsFormat(DataType, PluginFormat) const noexcept override final
842  {
843  return false;
844  }
845 };
846 
851 
852 enum class PluginFieldType : int32_t
853 {
855  kFLOAT16 = 0,
857  kFLOAT32 = 1,
859  kFLOAT64 = 2,
861  kINT8 = 3,
863  kINT16 = 4,
865  kINT32 = 5,
867  kCHAR = 6,
869  kDIMS = 7,
871  kUNKNOWN = 8
872 };
873 
882 {
883 public:
887  AsciiChar const* name;
891  void const* data;
900  int32_t length;
901 
902  PluginField(AsciiChar const* const name_ = nullptr, void const* const data_ = nullptr,
903  PluginFieldType const type_ = PluginFieldType::kUNKNOWN, int32_t const length_ = 0) noexcept
904  : name(name_)
905  , data(data_)
906  , type(type_)
907  , length(length_)
908  {
909  }
910 };
911 
914 {
916  int32_t nbFields;
919 };
920 
928 
930 {
931 public:
935  virtual int32_t getTensorRTVersion() const noexcept
936  {
937  return NV_TENSORRT_VERSION;
938  }
939 
943  virtual AsciiChar const* getPluginName() const noexcept = 0;
944 
948  virtual AsciiChar const* getPluginVersion() const noexcept = 0;
949 
954  virtual PluginFieldCollection const* getFieldNames() noexcept = 0;
955 
959  virtual IPluginV2* createPlugin(AsciiChar const* name, PluginFieldCollection const* fc) noexcept = 0;
960 
964  virtual IPluginV2* deserializePlugin(AsciiChar const* name, void const* serialData, size_t serialLength) noexcept = 0;
965 
972  virtual void setPluginNamespace(AsciiChar const* pluginNamespace) noexcept = 0;
973 
977  virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
978 
979  IPluginCreator() = default;
980  virtual ~IPluginCreator() = default;
981 
982 protected:
983  IPluginCreator(IPluginCreator const&) = default;
984  IPluginCreator(IPluginCreator&&) = default;
985  IPluginCreator& operator=(IPluginCreator const&) & = default;
986  IPluginCreator& operator=(IPluginCreator&&) & = default;
987 };
988 
1006 
1008 {
1009 public:
1014  virtual bool registerCreator(IPluginCreator& creator, AsciiChar const* const pluginNamespace) noexcept = 0;
1015 
1020  virtual IPluginCreator* const* getPluginCreatorList(int32_t* const numCreators) const noexcept = 0;
1021 
1026  virtual IPluginCreator* getPluginCreator(
1027  AsciiChar const* const pluginName, AsciiChar const* const pluginVersion, AsciiChar const* const pluginNamespace = "") noexcept
1028  = 0;
1029 
1030  IPluginRegistry() = default;
1031  IPluginRegistry(IPluginRegistry const&) = delete;
1032  IPluginRegistry(IPluginRegistry&&) = delete;
1033  IPluginRegistry& operator=(IPluginRegistry const&) & = delete;
1034  IPluginRegistry& operator=(IPluginRegistry&&) & = delete;
1035 
1036 protected:
1037  virtual ~IPluginRegistry() noexcept = default;
1038 
1039 public:
1049  //
1052  virtual void setErrorRecorder(IErrorRecorder* const recorder) noexcept = 0;
1053 
1065  virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
1066 
1078  virtual bool deregisterCreator(IPluginCreator const& creator) noexcept = 0;
1079 };
1080 
1081 enum class AllocatorFlag : int32_t
1082 {
1083  kRESIZABLE = 0,
1084 };
1085 
1086 namespace impl
1087 {
1089 template <>
1091 {
1092  static constexpr int32_t kVALUE = 1;
1093 };
1094 } // namespace impl
1095 
1096 using AllocatorFlags = uint32_t;
1097 
1104 {
1105 public:
1123  virtual void* allocate(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept = 0;
1124 
1135  virtual void free(void* const memory) noexcept = 0;
1136 
1141  virtual ~IGpuAllocator() = default;
1142  IGpuAllocator() = default;
1143 
1173  virtual void* reallocate(void* baseAddr, uint64_t alignment, uint64_t newSize) noexcept
1174  {
1175  return nullptr;
1176  }
1177 
1178 protected:
1179  IGpuAllocator(IGpuAllocator const&) = default;
1180  IGpuAllocator(IGpuAllocator&&) = default;
1181  IGpuAllocator& operator=(IGpuAllocator const&) & = default;
1182  IGpuAllocator& operator=(IGpuAllocator&&) & = default;
1183 };
1184 
1194 class ILogger
1195 {
1196 public:
1202  enum class Severity : int32_t
1203  {
1205  kINTERNAL_ERROR = 0,
1207  kERROR = 1,
1209  kWARNING = 2,
1211  kINFO = 3,
1213  kVERBOSE = 4,
1214  };
1215 
1222  virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
1223 
1224  ILogger() = default;
1225  virtual ~ILogger() = default;
1226 
1227 protected:
1228  ILogger(ILogger const&) = default;
1229  ILogger(ILogger&&) = default;
1230  ILogger& operator=(ILogger const&) & = default;
1231  ILogger& operator=(ILogger&&) & = default;
1232 };
1233 
1234 namespace impl
1235 {
1237 template <>
1238 struct EnumMaxImpl<ILogger::Severity>
1239 {
1241  static constexpr int32_t kVALUE = 5;
1242 };
1243 } // namespace impl
1244 
1250 enum class ErrorCode : int32_t
1251 {
1255  kSUCCESS = 0,
1256 
1260  kUNSPECIFIED_ERROR = 1,
1261 
1266  kINTERNAL_ERROR = 2,
1267 
1272  kINVALID_ARGUMENT = 3,
1273 
1281  kINVALID_CONFIG = 4,
1282 
1288  kFAILED_ALLOCATION = 5,
1289 
1295 
1302  kFAILED_EXECUTION = 7,
1303 
1311  kFAILED_COMPUTATION = 8,
1312 
1325  kINVALID_STATE = 9,
1326 
1337  kUNSUPPORTED_STATE = 10,
1338 
1339 };
1340 
1341 namespace impl
1342 {
1344 template <>
1346 {
1348  static constexpr int32_t kVALUE = 11;
1349 };
1350 } // namespace impl
1351 
1374 {
1375 public:
1379  using ErrorDesc = char const*;
1380 
1384  static constexpr size_t kMAX_DESC_LENGTH = 127U;
1385 
1389  using RefCount = int32_t;
1390 
1391  IErrorRecorder() = default;
1392  virtual ~IErrorRecorder() noexcept = default;
1393 
1394  // Public API used to retrieve information from the error recorder.
1395 
1409  virtual int32_t getNbErrors() const noexcept = 0;
1410 
1423  virtual ErrorCode getErrorCode(int32_t errorIdx) const noexcept = 0;
1424 
1439  virtual ErrorDesc getErrorDesc(int32_t errorIdx) const noexcept = 0;
1440 
1450  virtual bool hasOverflowed() const noexcept = 0;
1451 
1461  virtual void clear() noexcept = 0;
1462 
1463  // API used by TensorRT to report Error information to the application.
1464 
1477  virtual bool reportError(ErrorCode val, ErrorDesc desc) noexcept = 0;
1478 
1491  virtual RefCount incRefCount() noexcept = 0;
1492 
1504  virtual RefCount decRefCount() noexcept = 0;
1505 
1506 protected:
1507  IErrorRecorder(IErrorRecorder const&) = default;
1508  IErrorRecorder(IErrorRecorder&&) = default;
1509  IErrorRecorder& operator=(IErrorRecorder const&) & = default;
1510  IErrorRecorder& operator=(IErrorRecorder&&) & = default;
1511 
1512 }; // class IErrorRecorder
1513 
1514 } // namespace nvinfer1
1515 
1521 extern "C" TENSORRTAPI int32_t getInferLibVersion() noexcept;
1522 
1523 #endif // NV_INFER_RUNTIME_COMMON_H
cudaEvent_t
struct CUevent_st * cudaEvent_t
Forward declaration of cudaEvent_t.
Definition: NvInferRuntimeCommon.h:112
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:130
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:128
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:1250
nvinfer1::PluginTensorDesc::scale
float scale
Scale for INT8 data type.
Definition: NvInferRuntimeCommon.h:382
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:141
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:703
nvinfer1::IPluginV2
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:414
nvinfer1::Dims32
Definition: NvInferRuntimeCommon.h:194
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:1389
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:225
nvinfer1::IPluginCreator
Plugin creator class for user implemented layers.
Definition: NvInferRuntimeCommon.h:929
nvinfer1::IPluginRegistry
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:1007
nvinfer1::TensorFormat::kDHWC8
nvinfer1::PluginVersion::kV2_EXT
IPluginV2Ext.
NvInferVersion.h
nvinfer1::PluginFieldType
PluginFieldType
Definition: NvInferRuntimeCommon.h:852
nvinfer1::ILogger
Application-implemented logging interface for the builder, engine and runtime.
Definition: NvInferRuntimeCommon.h:1194
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:202
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:900
nvinfer1::PluginField::type
PluginFieldType type
Plugin field attribute type.
Definition: NvInferRuntimeCommon.h:896
nvinfer1::PluginTensorDesc::type
DataType type
Definition: NvInferRuntimeCommon.h:378
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:744
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:380
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:200
nvinfer1::IGpuAllocator::reallocate
virtual void * reallocate(void *baseAddr, uint64_t alignment, uint64_t newSize) noexcept
Definition: NvInferRuntimeCommon.h:1173
nvinfer1::IErrorRecorder::ErrorDesc
char const * ErrorDesc
Definition: NvInferRuntimeCommon.h:1379
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:713
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:916
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:155
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:827
nvinfer1::TensorFormat::kCHW4
nvinfer1::ILogger::Severity
Severity
Definition: NvInferRuntimeCommon.h:1202
nvinfer1::EnumMax
constexpr int32_t EnumMax() noexcept
Maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:146
nvinfer1::IPluginV2::getTensorRTVersion
virtual int32_t getTensorRTVersion() const noexcept
Return the API version with which this plugin was built.
Definition: NvInferRuntimeCommon.h:422
nvinfer1::IPluginV2IOExt
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:759
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:1373
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:608
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:198
nvinfer1::DataType::kFLOAT
32-bit floating point format.
nvinfer1::TensorFormat::kCHW2
nvinfer1::PluginField::name
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferRuntimeCommon.h:887
nvinfer1::PluginVersion::kV2
IPluginV2.
cudaStream_t
struct CUstream_st * cudaStream_t
Forward declaration of cudaStream_t.
Definition: NvInferRuntimeCommon.h:109
nvinfer1::PluginFieldCollection::fields
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferRuntimeCommon.h:918
nvinfer1::PluginTensorDesc::dims
Dims dims
Dimensions.
Definition: NvInferRuntimeCommon.h:376
nvinfer1::PluginFieldType::kFLOAT32
FP32 field type.
nvinfer1::PluginTensorDesc
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimeCommon.h:373
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:350
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:1081
nvinfer1::IGpuAllocator
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:1103
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:913
nvinfer1::PluginField
Structure containing plugin attribute field names and associated data This information can be parsed ...
Definition: NvInferRuntimeCommon.h:881
nvinfer1::IPluginCreator::getTensorRTVersion
virtual int32_t getTensorRTVersion() const noexcept
Return the version of the API the plugin creator was compiled with.
Definition: NvInferRuntimeCommon.h:935
getInferLibVersion
int32_t getInferLibVersion() noexcept
Return the library version number.
nvinfer1::PluginField::data
void const * data
Plugin field attribute data.
Definition: NvInferRuntimeCommon.h:891