TensorRT  8.2.0
NvInferRuntime.h
Go to the documentation of this file.
1 /*
2  * Copyright 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_H
51 #define NV_INFER_RUNTIME_H
52 
58 
59 #include "NvInferImpl.h"
60 #include "NvInferRuntimeCommon.h"
61 
62 namespace nvinfer1
63 {
64 
65 class IExecutionContext;
66 class ICudaEngine;
67 class IPluginFactory;
68 class IEngineInspector;
69 
78 
79 class INoCopy
80 {
81 protected:
82  INoCopy() = default;
83  virtual ~INoCopy() = default;
84  INoCopy(const INoCopy& other) = delete;
85  INoCopy& operator=(const INoCopy& other) = delete;
86  INoCopy(INoCopy&& other) = delete;
87  INoCopy& operator=(INoCopy&& other) = delete;
88 };
89 
104 
105 enum class EngineCapability : int32_t
106 {
111  kSTANDARD = 0,
112  kDEFAULT TRT_DEPRECATED_ENUM = kSTANDARD,
113 
119  kSAFETY = 1,
120  kSAFE_GPU TRT_DEPRECATED_ENUM = kSAFETY,
121 
127  kDLA_STANDALONE = 2,
128  kSAFE_DLA TRT_DEPRECATED_ENUM = kDLA_STANDALONE,
129 };
130 
131 namespace impl
132 {
134 template <>
136 {
137  static constexpr int32_t kVALUE = 3;
138 };
139 } // namespace impl
140 
155 class Weights
156 {
157 public:
159  const void* values;
160  int64_t count;
161 };
162 
173 class IHostMemory : public INoCopy
174 {
175 public:
176  virtual ~IHostMemory() noexcept = default;
177 
179  void* data() const noexcept
180  {
181  return mImpl->data();
182  }
183 
185  std::size_t size() const noexcept
186  {
187  return mImpl->size();
188  }
189 
191  DataType type() const noexcept
192  {
193  return mImpl->type();
194  }
202  TRT_DEPRECATED void destroy() noexcept
203  {
204  delete this;
205  }
206 
207 protected:
208  apiv::VHostMemory* mImpl;
209 };
210 
221 enum class DimensionOperation : int32_t
222 {
223  kSUM = 0,
224  kPROD = 1,
225  kMAX = 2,
226  kMIN = 3,
227  kSUB = 4,
228  kEQUAL = 5,
229  kLESS = 6,
230  kFLOOR_DIV = 7,
231  kCEIL_DIV = 8
232 };
233 
235 template <>
236 constexpr inline int32_t EnumMax<DimensionOperation>() noexcept
237 {
238  return 9;
239 }
240 
245 enum class TensorLocation : int32_t
246 {
247  kDEVICE = 0,
248  kHOST = 1,
249 };
250 
251 namespace impl
252 {
254 template <>
256 {
257  static constexpr int32_t kVALUE = 2;
258 };
259 } // namespace impl
260 
273 class IDimensionExpr : public INoCopy
274 {
275 public:
277  bool isConstant() const noexcept
278  {
279  return mImpl->isConstant();
280  }
281 
284  int32_t getConstantValue() const noexcept
285  {
286  return mImpl->getConstantValue();
287  }
288 
289 protected:
290  apiv::VDimensionExpr* mImpl;
291  virtual ~IDimensionExpr() noexcept = default;
292 };
293 
311 class IExprBuilder : public INoCopy
312 {
313 public:
315  const IDimensionExpr* constant(int32_t value) noexcept
316  {
317  return mImpl->constant(value);
318  }
319 
323  DimensionOperation op, const IDimensionExpr& first, const IDimensionExpr& second) noexcept
324  {
325  return mImpl->operation(op, first, second);
326  }
327 
328 protected:
329  apiv::VExprBuilder* mImpl;
330  virtual ~IExprBuilder() noexcept = default;
331 };
332 
339 {
340 public:
341  int32_t nbDims;
343 };
344 
351 {
354 
357 
360 };
361 
381 {
382 public:
383  IPluginV2DynamicExt* clone() const noexcept override = 0;
384 
409  virtual DimsExprs getOutputDimensions(
410  int32_t outputIndex, const DimsExprs* inputs, int32_t nbInputs, IExprBuilder& exprBuilder) noexcept
411  = 0;
412 
416  static constexpr int32_t kFORMAT_COMBINATION_LIMIT = 100;
417 
450  virtual bool supportsFormatCombination(
451  int32_t pos, const PluginTensorDesc* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept
452  = 0;
453 
492  virtual void configurePlugin(const DynamicPluginTensorDesc* in, int32_t nbInputs,
493  const DynamicPluginTensorDesc* out, int32_t nbOutputs) noexcept
494  = 0;
495 
505  virtual size_t getWorkspaceSize(const PluginTensorDesc* inputs, int32_t nbInputs, const PluginTensorDesc* outputs,
506  int32_t nbOutputs) const noexcept
507  = 0;
508 
521  virtual int32_t enqueue(const PluginTensorDesc* inputDesc, const PluginTensorDesc* outputDesc,
522  const void* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept
523  = 0;
524 
525 protected:
533  int32_t getTensorRTVersion() const noexcept override
534  {
535  return (static_cast<int32_t>(PluginVersion::kV2_DYNAMICEXT) << 24 | (NV_TENSORRT_VERSION & 0xFFFFFF));
536  }
537 
538  virtual ~IPluginV2DynamicExt() noexcept {}
539 
540 private:
541  // Following are obsolete base class methods, and must not be implemented or used.
542 
543  void configurePlugin(Dims const*, int32_t, Dims const*, int32_t, DataType const*, DataType const*, bool const*,
544  bool const*, PluginFormat, int32_t) noexcept override final
545  {
546  }
547 
548  bool supportsFormat(DataType, PluginFormat) const noexcept override final
549  {
550  return false;
551  }
552 
553  Dims getOutputDimensions(int32_t, Dims const*, int32_t) noexcept override final
554  {
555  return Dims{-1, {}};
556  }
557 
558  bool isOutputBroadcastAcrossBatch(int32_t, bool const*, int32_t) const noexcept override final
559  {
560  return false;
561  }
562 
563  bool canBroadcastInputAcrossBatch(int32_t) const noexcept override final
564  {
565  return true;
566  }
567 
568  size_t getWorkspaceSize(int32_t) const noexcept override final
569  {
570  return 0;
571  }
572 
573  int32_t enqueue(int32_t, const void* const*, void* const*, void*, cudaStream_t) noexcept override final
574  {
575  return 1;
576  }
577 };
578 
590 {
591 public:
598  virtual void reportLayerTime(const char* layerName, float ms) noexcept = 0;
599 
600  virtual ~IProfiler() noexcept {}
601 };
602 
609 enum class WeightsRole : int32_t
610 {
611  kKERNEL = 0,
612  kBIAS = 1,
613  kSHIFT = 2,
614  kSCALE = 3,
615  kCONSTANT = 4,
616  kANY = 5,
617 };
618 
620 template <>
621 constexpr inline int32_t EnumMax<WeightsRole>() noexcept
622 {
623  return 6;
624 }
625 
631 enum class DeviceType : int32_t
632 {
633  kGPU,
634  kDLA,
635 };
636 
638 template <>
639 constexpr inline int32_t EnumMax<DeviceType>() noexcept
640 {
641  return 2;
642 }
643 
651 class IRuntime : public INoCopy
652 {
653 public:
654  virtual ~IRuntime() noexcept = default;
655 
672  const void* blob, std::size_t size, IPluginFactory* pluginFactory) noexcept
673  {
674  return mImpl->deserializeCudaEngine(blob, size, nullptr);
675  }
676 
684  void setDLACore(int32_t dlaCore) noexcept
685  {
686  mImpl->setDLACore(dlaCore);
687  }
688 
695  int32_t getDLACore() const noexcept
696  {
697  return mImpl->getDLACore();
698  }
699 
703  int32_t getNbDLACores() const noexcept
704  {
705  return mImpl->getNbDLACores();
706  }
707 
715  TRT_DEPRECATED void destroy() noexcept
716  {
717  delete this;
718  }
719 
729  void setGpuAllocator(IGpuAllocator* allocator) noexcept
730  {
731  mImpl->setGpuAllocator(allocator);
732  }
733 
745  //
748  void setErrorRecorder(IErrorRecorder* recorder) noexcept
749  {
750  mImpl->setErrorRecorder(recorder);
751  }
752 
764  {
765  return mImpl->getErrorRecorder();
766  }
767 
778  ICudaEngine* deserializeCudaEngine(const void* blob, std::size_t size) noexcept
779  {
780  return mImpl->deserializeCudaEngine(blob, size, nullptr);
781  }
782 
788  ILogger* getLogger() const noexcept
789  {
790  return mImpl->getLogger();
791  }
792 
793 protected:
794  apiv::VRuntime* mImpl;
795 };
796 
804 class IRefitter : public INoCopy
805 {
806 public:
807  virtual ~IRefitter() noexcept = default;
808 
819  bool setWeights(const char* layerName, WeightsRole role, Weights weights) noexcept
820  {
821  return mImpl->setWeights(layerName, role, weights);
822  }
823 
834  bool refitCudaEngine() noexcept
835  {
836  return mImpl->refitCudaEngine();
837  }
838 
855  int32_t getMissing(int32_t size, const char** layerNames, WeightsRole* roles) noexcept
856  {
857  return mImpl->getMissing(size, layerNames, roles);
858  }
859 
872  int32_t getAll(int32_t size, const char** layerNames, WeightsRole* roles) noexcept
873  {
874  return mImpl->getAll(size, layerNames, roles);
875  }
876 
882  TRT_DEPRECATED void destroy() noexcept
883  {
884  delete this;
885  }
886 
899  bool setDynamicRange(const char* tensorName, float min, float max) noexcept
900  {
901  return mImpl->setDynamicRange(tensorName, min, max);
902  }
903 
911  float getDynamicRangeMin(const char* tensorName) const noexcept
912  {
913  return mImpl->getDynamicRangeMin(tensorName);
914  }
915 
923  float getDynamicRangeMax(const char* tensorName) const noexcept
924  {
925  return mImpl->getDynamicRangeMax(tensorName);
926  }
927 
939  int32_t getTensorsWithDynamicRange(int32_t size, const char** tensorNames) const noexcept
940  {
941  return mImpl->getTensorsWithDynamicRange(size, tensorNames);
942  }
943 
955  //
958  void setErrorRecorder(IErrorRecorder* recorder) noexcept
959  {
960  mImpl->setErrorRecorder(recorder);
961  }
962 
974  {
975  return mImpl->getErrorRecorder();
976  }
977 
991  bool setNamedWeights(const char* name, Weights weights) noexcept
992  {
993  return mImpl->setNamedWeights(name, weights);
994  }
995 
1011  int32_t getMissingWeights(int32_t size, const char** weightsNames) noexcept
1012  {
1013  return mImpl->getMissingWeights(size, weightsNames);
1014  }
1015 
1027  int32_t getAllWeights(int32_t size, const char** weightsNames) noexcept
1028  {
1029  return mImpl->getAllWeights(size, weightsNames);
1030  }
1031 
1037  ILogger* getLogger() const noexcept
1038  {
1039  return mImpl->getLogger();
1040  }
1041 
1042 protected:
1043  apiv::VRefitter* mImpl;
1044 };
1045 
1056 enum class OptProfileSelector : int32_t
1057 {
1058  kMIN = 0,
1059  kOPT = 1,
1060  kMAX = 2
1061 };
1062 
1064 template <>
1065 constexpr inline int32_t EnumMax<OptProfileSelector>() noexcept
1066 {
1067  return 3;
1068 }
1069 
1093 {
1094 public:
1120  bool setDimensions(const char* inputName, OptProfileSelector select, Dims dims) noexcept
1121  {
1122  return mImpl->setDimensions(inputName, select, dims);
1123  }
1124 
1130  Dims getDimensions(const char* inputName, OptProfileSelector select) const noexcept
1131  {
1132  return mImpl->getDimensions(inputName, select);
1133  }
1134 
1174  const char* inputName, OptProfileSelector select, const int32_t* values, int32_t nbValues) noexcept
1175  {
1176  return mImpl->setShapeValues(inputName, select, values, nbValues);
1177  }
1178 
1185  int32_t getNbShapeValues(const char* inputName) const noexcept
1186  {
1187  return mImpl->getNbShapeValues(inputName);
1188  }
1189 
1195  int32_t const* getShapeValues(const char* inputName, OptProfileSelector select) const noexcept
1196  {
1197  return mImpl->getShapeValues(inputName, select);
1198  }
1199 
1213  bool setExtraMemoryTarget(float target) noexcept
1214  {
1215  return mImpl->setExtraMemoryTarget(target);
1216  }
1217 
1221  float getExtraMemoryTarget() const noexcept
1222  {
1223  return mImpl->getExtraMemoryTarget();
1224  }
1225 
1237  bool isValid() const noexcept
1238  {
1239  return mImpl->isValid();
1240  }
1241 
1242 protected:
1243  apiv::VOptimizationProfile* mImpl;
1244  virtual ~IOptimizationProfile() noexcept = default;
1245 };
1246 
1254 enum class TacticSource : int32_t
1255 {
1257  kCUBLAS = 0,
1258  kCUBLAS_LT = 1,
1259  kCUDNN = 2
1260 };
1261 
1262 template <>
1263 constexpr inline int32_t EnumMax<TacticSource>() noexcept
1264 {
1265  return 3;
1266 }
1267 
1274 using TacticSources = uint32_t;
1275 
1285 enum class ProfilingVerbosity : int32_t
1286 {
1287  kLAYER_NAMES_ONLY = 0,
1288  kNONE = 1,
1289  kDETAILED = 2,
1290  kDEFAULT TRT_DEPRECATED_ENUM = kLAYER_NAMES_ONLY,
1291  kVERBOSE TRT_DEPRECATED_ENUM = kDETAILED
1292 };
1293 
1295 template <>
1296 constexpr inline int32_t EnumMax<ProfilingVerbosity>() noexcept
1297 {
1298  return 3;
1299 }
1300 
1308 class ICudaEngine : public INoCopy
1309 {
1310 public:
1311  virtual ~ICudaEngine() noexcept = default;
1312 
1323  int32_t getNbBindings() const noexcept
1324  {
1325  return mImpl->getNbBindings();
1326  }
1327 
1345  int32_t getBindingIndex(const char* name) const noexcept
1346  {
1347  return mImpl->getBindingIndex(name);
1348  }
1349 
1365  const char* getBindingName(int32_t bindingIndex) const noexcept
1366  {
1367  return mImpl->getBindingName(bindingIndex);
1368  }
1369 
1378  bool bindingIsInput(int32_t bindingIndex) const noexcept
1379  {
1380  return mImpl->bindingIsInput(bindingIndex);
1381  }
1382 
1403  Dims getBindingDimensions(int32_t bindingIndex) const noexcept
1404  {
1405  return mImpl->getBindingDimensions(bindingIndex);
1406  }
1407 
1416  DataType getBindingDataType(int32_t bindingIndex) const noexcept
1417  {
1418  return mImpl->getBindingDataType(bindingIndex);
1419  }
1420 
1428  int32_t getMaxBatchSize() const noexcept
1429  {
1430  return mImpl->getMaxBatchSize();
1431  }
1432 
1442  int32_t getNbLayers() const noexcept
1443  {
1444  return mImpl->getNbLayers();
1445  }
1446 
1456  IHostMemory* serialize() const noexcept
1457  {
1458  return mImpl->serialize();
1459  }
1460 
1473  {
1474  return mImpl->createExecutionContext();
1475  }
1476 
1484  TRT_DEPRECATED void destroy() noexcept
1485  {
1486  delete this;
1487  }
1488 
1499  TensorLocation getLocation(int32_t bindingIndex) const noexcept
1500  {
1501  return mImpl->getLocation(bindingIndex);
1502  }
1503 
1509  {
1510  return mImpl->createExecutionContextWithoutDeviceMemory();
1511  }
1512 
1518  size_t getDeviceMemorySize() const noexcept
1519  {
1520  return mImpl->getDeviceMemorySize();
1521  }
1522 
1528  bool isRefittable() const noexcept
1529  {
1530  return mImpl->isRefittable();
1531  }
1532 
1542  int32_t getBindingBytesPerComponent(int32_t bindingIndex) const noexcept
1543  {
1544  return mImpl->getBindingBytesPerComponent(bindingIndex);
1545  }
1546 
1556  int32_t getBindingComponentsPerElement(int32_t bindingIndex) const noexcept
1557  {
1558  return mImpl->getBindingComponentsPerElement(bindingIndex);
1559  }
1560 
1566  TensorFormat getBindingFormat(int32_t bindingIndex) const noexcept
1567  {
1568  return mImpl->getBindingFormat(bindingIndex);
1569  }
1570 
1585  const char* getBindingFormatDesc(int32_t bindingIndex) const noexcept
1586  {
1587  return mImpl->getBindingFormatDesc(bindingIndex);
1588  }
1589 
1597  int32_t getBindingVectorizedDim(int32_t bindingIndex) const noexcept
1598  {
1599  return mImpl->getBindingVectorizedDim(bindingIndex);
1600  }
1601 
1612  const char* getName() const noexcept
1613  {
1614  return mImpl->getName();
1615  }
1616 
1623  int32_t getNbOptimizationProfiles() const noexcept
1624  {
1625  return mImpl->getNbOptimizationProfiles();
1626  }
1627 
1650  Dims getProfileDimensions(int32_t bindingIndex, int32_t profileIndex, OptProfileSelector select) const noexcept
1651  {
1652  return mImpl->getProfileDimensions(bindingIndex, profileIndex, select);
1653  }
1654 
1676  const int32_t* getProfileShapeValues(int32_t profileIndex, int32_t inputIndex, OptProfileSelector select) const
1677  noexcept
1678  {
1679  return mImpl->getProfileShapeValues(profileIndex, inputIndex, select);
1680  }
1681 
1713  bool isShapeBinding(int32_t bindingIndex) const noexcept
1714  {
1715  return mImpl->isShapeBinding(bindingIndex);
1716  }
1717 
1727  bool isExecutionBinding(int32_t bindingIndex) const noexcept
1728  {
1729  return mImpl->isExecutionBinding(bindingIndex);
1730  }
1731 
1743  {
1744  return mImpl->getEngineCapability();
1745  }
1746 
1757  //
1760  void setErrorRecorder(IErrorRecorder* recorder) noexcept
1761  {
1762  return mImpl->setErrorRecorder(recorder);
1763  }
1764 
1776  {
1777  return mImpl->getErrorRecorder();
1778  }
1779 
1794  bool hasImplicitBatchDimension() const noexcept
1795  {
1796  return mImpl->hasImplicitBatchDimension();
1797  }
1798 
1804  {
1805  return mImpl->getTacticSources();
1806  }
1807 
1815  {
1816  return mImpl->getProfilingVerbosity();
1817  }
1818 
1825  {
1826  return mImpl->createEngineInspector();
1827  }
1828 
1829 protected:
1830  apiv::VCudaEngine* mImpl;
1831 };
1832 
1844 {
1845 public:
1846  virtual ~IExecutionContext() noexcept = default;
1847 
1865  bool execute(int32_t batchSize, void* const* bindings) noexcept
1866  {
1867  return mImpl->execute(batchSize, bindings);
1868  }
1869 
1894  bool enqueue(int32_t batchSize, void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept
1895  {
1896  return mImpl->enqueue(batchSize, bindings, stream, inputConsumed);
1897  }
1898 
1907  void setDebugSync(bool sync) noexcept
1908  {
1909  mImpl->setDebugSync(sync);
1910  }
1911 
1917  bool getDebugSync() const noexcept
1918  {
1919  return mImpl->getDebugSync();
1920  }
1921 
1927  void setProfiler(IProfiler* profiler) noexcept
1928  {
1929  mImpl->setProfiler(profiler);
1930  }
1931 
1937  IProfiler* getProfiler() const noexcept
1938  {
1939  return mImpl->getProfiler();
1940  }
1941 
1947  const ICudaEngine& getEngine() const noexcept
1948  {
1949  return mImpl->getEngine();
1950  }
1951 
1959  TRT_DEPRECATED void destroy() noexcept
1960  {
1961  delete this;
1962  }
1963 
1971  void setName(const char* name) noexcept
1972  {
1973  mImpl->setName(name);
1974  }
1975 
1981  const char* getName() const noexcept
1982  {
1983  return mImpl->getName();
1984  }
1985 
1997  void setDeviceMemory(void* memory) noexcept
1998  {
1999  mImpl->setDeviceMemory(memory);
2000  }
2001 
2018  Dims getStrides(int32_t bindingIndex) const noexcept
2019  {
2020  return mImpl->getStrides(bindingIndex);
2021  }
2022 
2023 public:
2060  bool setOptimizationProfile(int32_t profileIndex) noexcept
2061  {
2062  return mImpl->setOptimizationProfile(profileIndex);
2063  }
2064 
2072  int32_t getOptimizationProfile() const noexcept
2073  {
2074  return mImpl->getOptimizationProfile();
2075  }
2076 
2109  bool setBindingDimensions(int32_t bindingIndex, Dims dimensions) noexcept
2110  {
2111  return mImpl->setBindingDimensions(bindingIndex, dimensions);
2112  }
2113 
2139  Dims getBindingDimensions(int32_t bindingIndex) const noexcept
2140  {
2141  return mImpl->getBindingDimensions(bindingIndex);
2142  }
2143 
2169  bool setInputShapeBinding(int32_t bindingIndex, int32_t const* data) noexcept
2170  {
2171  return mImpl->setInputShapeBinding(bindingIndex, data);
2172  }
2173 
2191  bool getShapeBinding(int32_t bindingIndex, int32_t* data) const noexcept
2192  {
2193  return mImpl->getShapeBinding(bindingIndex, data);
2194  }
2195 
2206  bool allInputDimensionsSpecified() const noexcept
2207  {
2208  return mImpl->allInputDimensionsSpecified();
2209  }
2210 
2220  bool allInputShapesSpecified() const noexcept
2221 
2222  {
2223  return mImpl->allInputShapesSpecified();
2224  }
2225 
2237  //
2240  void setErrorRecorder(IErrorRecorder* recorder) noexcept
2241  {
2242  mImpl->setErrorRecorder(recorder);
2243  }
2244 
2256  {
2257  return mImpl->getErrorRecorder();
2258  }
2259 
2272  bool executeV2(void* const* bindings) noexcept
2273  {
2274  return mImpl->executeV2(bindings);
2275  }
2276 
2300  bool enqueueV2(void* const* bindings, cudaStream_t stream, cudaEvent_t* inputConsumed) noexcept
2301  {
2302  return mImpl->enqueueV2(bindings, stream, inputConsumed);
2303  }
2304 
2348  bool setOptimizationProfileAsync(int32_t profileIndex, cudaStream_t stream) noexcept
2349  {
2350  return mImpl->setOptimizationProfileAsync(profileIndex, stream);
2351  }
2352 
2363  void setEnqueueEmitsProfile(bool enqueueEmitsProfile) noexcept
2364  {
2365  mImpl->setEnqueueEmitsProfile(enqueueEmitsProfile);
2366  }
2367 
2374  bool getEnqueueEmitsProfile() const noexcept
2375  {
2376  return mImpl->getEnqueueEmitsProfile();
2377  }
2378 
2401  bool reportToProfiler() const noexcept
2402  {
2403  return mImpl->reportToProfiler();
2404  }
2405 
2406 protected:
2407  apiv::VExecutionContext* mImpl;
2408 }; // class IExecutionContext
2409 
2417 enum class LayerInformationFormat : int32_t
2418 {
2419  kONELINE = 0,
2420  kJSON = 1,
2421 };
2422 
2425 template <>
2426 constexpr inline int32_t EnumMax<LayerInformationFormat>() noexcept
2427 {
2428  return 2;
2429 }
2430 
2447 {
2448 public:
2449  virtual ~IEngineInspector() noexcept = default;
2450 
2463  bool setExecutionContext(IExecutionContext const* context) noexcept
2464  {
2465  return mImpl->setExecutionContext(context);
2466  }
2467 
2475  IExecutionContext const* getExecutionContext() const noexcept
2476  {
2477  return mImpl->getExecutionContext();
2478  }
2479 
2500  AsciiChar const* getLayerInformation(int32_t layerIndex, LayerInformationFormat format) const noexcept
2501  {
2502  return mImpl->getLayerInformation(layerIndex, format);
2503  }
2504 
2526  {
2527  return mImpl->getEngineInformation(format);
2528  }
2529 
2541  //
2544  void setErrorRecorder(IErrorRecorder* recorder) noexcept
2545  {
2546  mImpl->setErrorRecorder(recorder);
2547  }
2548 
2560  {
2561  return mImpl->getErrorRecorder();
2562  }
2563 
2564 protected:
2565  apiv::VEngineInspector* mImpl;
2566 }; // class IEngineInspector
2567 
2568 } // namespace nvinfer1
2569 
2574 extern "C" TENSORRTAPI void* createInferRuntime_INTERNAL(void* logger, int32_t version) noexcept;
2575 
2580 extern "C" TENSORRTAPI void* createInferRefitter_INTERNAL(void* engine, void* logger, int32_t version) noexcept;
2581 
2585 extern "C" TENSORRTAPI nvinfer1::IPluginRegistry* getPluginRegistry() noexcept;
2586 
2592 extern "C" TENSORRTAPI nvinfer1::ILogger* getLogger() noexcept;
2593 
2594 namespace nvinfer1
2595 {
2596 namespace // unnamed namespace avoids linkage surprises when linking objects built with different versions of this
2597  // header.
2598 {
2604 inline IRuntime* createInferRuntime(ILogger& logger) noexcept
2605 {
2606  return static_cast<IRuntime*>(createInferRuntime_INTERNAL(&logger, NV_TENSORRT_VERSION));
2607 }
2608 
2614 inline IRefitter* createInferRefitter(ICudaEngine& engine, ILogger& logger) noexcept
2615 {
2616  return static_cast<IRefitter*>(createInferRefitter_INTERNAL(&engine, &logger, NV_TENSORRT_VERSION));
2617 }
2618 
2619 } // namespace
2620 
2632 template <typename T>
2634 {
2635 public:
2636  PluginRegistrar()
2637  {
2638  getPluginRegistry()->registerCreator(instance, "");
2639  }
2640 
2641 private:
2643  T instance{};
2644 };
2645 
2646 } // namespace nvinfer1
2647 
2648 #define REGISTER_TENSORRT_PLUGIN(name) \
2649  static nvinfer1::PluginRegistrar<name> pluginRegistrar##name {}
2650 #endif // NV_INFER_RUNTIME_H
nvinfer1::IOptimizationProfile::getNbShapeValues
int32_t getNbShapeValues(const char *inputName) const noexcept
Get the number of values for an input shape tensor.
Definition: NvInferRuntime.h:1185
nvinfer1::IExecutionContext::allInputDimensionsSpecified
bool allInputDimensionsSpecified() const noexcept
Whether all dynamic dimensions of input tensors have been specified.
Definition: NvInferRuntime.h:2206
nvinfer1::IDimensionExpr::getConstantValue
int32_t getConstantValue() const noexcept
Definition: NvInferRuntime.h:284
Dims
Structure to define the dimensions of a tensor.
nvinfer1::DynamicPluginTensorDesc
Definition: NvInferRuntime.h:350
nvinfer1::DeviceType::kGPU
GPU Device.
nvinfer1::ProfilingVerbosity::kLAYER_NAMES_ONLY
Print only the layer names. This is the default setting.
nvinfer1::AsciiChar
char_t AsciiChar
AsciiChar is the type used by TensorRT to represent valid ASCII characters.
Definition: NvInferRuntimeCommon.h:125
nvinfer1::IRefitter::getLogger
ILogger * getLogger() const noexcept
get the logger with which the refitter was created
Definition: NvInferRuntime.h:1037
nvinfer1::IEngineInspector::setErrorRecorder
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:2544
nvinfer1::IRuntime::getErrorRecorder
IErrorRecorder * getErrorRecorder() const noexcept
get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:763
nvinfer1::DimensionOperation
DimensionOperation
An operation on two IDimensionExpr, which represent integer expressions used in dimension computation...
Definition: NvInferRuntime.h:221
nvinfer1::ElementWiseOperation::kMIN
Minimum of the two elements.
nvinfer1::IExecutionContext::getEnqueueEmitsProfile
bool getEnqueueEmitsProfile() const noexcept
Get the enqueueEmitsProfile state.
Definition: NvInferRuntime.h:2374
getLogger
nvinfer1::ILogger * getLogger() noexcept
Return the logger object.
nvinfer1::IExecutionContext::getShapeBinding
bool getShapeBinding(int32_t bindingIndex, int32_t *data) const noexcept
Get values of an input tensor required for shape calculations or an output tensor produced by shape c...
Definition: NvInferRuntime.h:2191
nvinfer1::IExecutionContext::setName
void setName(const char *name) noexcept
Set the name of the execution context.
Definition: NvInferRuntime.h:1971
nvinfer1::IPluginV2DynamicExt::getTensorRTVersion
int32_t getTensorRTVersion() const noexcept override
Return the API version with which this plugin was built. The upper byte reserved by TensorRT and is u...
Definition: NvInferRuntime.h:533
nvinfer1::Weights
An array of weights used as a layer parameter.
Definition: NvInferRuntime.h:155
nvinfer1::LayerInformationFormat
LayerInformationFormat
The format in which the IEngineInspector prints the layer information.
Definition: NvInferRuntime.h:2417
nvinfer1::ICudaEngine::getDeviceMemorySize
size_t getDeviceMemorySize() const noexcept
Return the amount of device memory required by an execution context.
Definition: NvInferRuntime.h:1518
nvinfer1::EngineCapability::kSAFETY
nvinfer1::PluginRegistrar
Register the plugin creator to the registry The static registry object will be instantiated when the ...
Definition: NvInferRuntime.h:2633
getPluginRegistry
nvinfer1::IPluginRegistry * getPluginRegistry() noexcept
Return the plugin registry.
nvinfer1::IDimensionExpr::isConstant
bool isConstant() const noexcept
Return true if expression is a build-time constant.
Definition: NvInferRuntime.h:277
nvinfer1::IHostMemory
Class to handle library allocated memory that is accessible to the user.
Definition: NvInferRuntime.h:173
nvinfer1::IHostMemory::data
void * data() const noexcept
A pointer to the raw data that is owned by the library.
Definition: NvInferRuntime.h:179
nvinfer1::IHostMemory::destroy
TRT_DEPRECATED void destroy() noexcept
Definition: NvInferRuntime.h:202
nvinfer1::DeviceType
DeviceType
The device that this layer/network will execute on.
Definition: NvInferRuntime.h:631
nvinfer1::ProfilingVerbosity
ProfilingVerbosity
List of verbosity levels of layer information exposed in NVTX annotations and in IEngineInspector.
Definition: NvInferRuntime.h:1285
nvinfer1::IRefitter::getDynamicRangeMin
float getDynamicRangeMin(const char *tensorName) const noexcept
Get minimum of dynamic range.
Definition: NvInferRuntime.h:911
nvinfer1::IExecutionContext::getErrorRecorder
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:2255
nvinfer1::IRefitter::getDynamicRangeMax
float getDynamicRangeMax(const char *tensorName) const noexcept
Get maximum of dynamic range.
Definition: NvInferRuntime.h:923
nvinfer1::ICudaEngine::serialize
IHostMemory * serialize() const noexcept
Serialize the network to a stream.
Definition: NvInferRuntime.h:1456
nvinfer1::impl::EnumMaxImpl
Declaration of EnumMaxImpl struct to store maximum number of elements in an enumeration type.
Definition: NvInferRuntimeCommon.h:136
nvinfer1::EnumMax< WeightsRole >
constexpr int32_t EnumMax< WeightsRole >() noexcept
Maximum number of elements in WeightsRole enum.
Definition: NvInferRuntime.h:621
nvinfer1::ICudaEngine::getBindingDimensions
Dims getBindingDimensions(int32_t bindingIndex) const noexcept
Get the dimensions of a binding.
Definition: NvInferRuntime.h:1403
nvinfer1::LayerType::kSCALE
Scale layer.
nvinfer1::IRefitter
Updates weights in an engine.
Definition: NvInferRuntime.h:804
nvinfer1::Dims32
Definition: NvInferRuntimeCommon.h:189
nvinfer1::TacticSource
TacticSource
List of tactic sources for TensorRT.
Definition: NvInferRuntime.h:1254
nvinfer1::IOptimizationProfile::getShapeValues
int32_t const * getShapeValues(const char *inputName, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum values for an input shape tensor.
Definition: NvInferRuntime.h:1195
nvinfer1::WeightsRole::kKERNEL
kernel for IConvolutionLayer, IDeconvolutionLayer, or IFullyConnectedLayer
nvinfer1::DeviceType::kDLA
DLA Core.
nvinfer1::EngineCapability::kSTANDARD
nvinfer1::IEngineInspector::getExecutionContext
IExecutionContext const * getExecutionContext() const noexcept
Get the context currently being inspected.
Definition: NvInferRuntime.h:2475
nvinfer1::ICudaEngine::getProfileDimensions
Dims getProfileDimensions(int32_t bindingIndex, int32_t profileIndex, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum dimensions for a particular binding under an optimization profile...
Definition: NvInferRuntime.h:1650
nvinfer1::ICudaEngine::getLocation
TensorLocation getLocation(int32_t bindingIndex) const noexcept
Get location of binding.
Definition: NvInferRuntime.h:1499
nvinfer1::PluginVersion::kV2_DYNAMICEXT
IPluginV2DynamicExt.
nvinfer1::ICudaEngine::getProfileShapeValues
const int32_t * getProfileShapeValues(int32_t profileIndex, int32_t inputIndex, OptProfileSelector select) const noexcept
Get minimum / optimum / maximum values for an input shape binding under an optimization profile.
Definition: NvInferRuntime.h:1676
nvinfer1::IExecutionContext::reportToProfiler
bool reportToProfiler() const noexcept
Calculate layer timing info for the current optimization profile in IExecutionContext and update the ...
Definition: NvInferRuntime.h:2401
nvinfer1::ICudaEngine::destroy
TRT_DEPRECATED void destroy() noexcept
Destroy this object;.
Definition: NvInferRuntime.h:1484
nvinfer1::IOptimizationProfile::setDimensions
bool setDimensions(const char *inputName, OptProfileSelector select, Dims dims) noexcept
Set the minimum / optimum / maximum dimensions for a dynamic input tensor.
Definition: NvInferRuntime.h:1120
nvinfer1::IRuntime::deserializeCudaEngine
ICudaEngine * deserializeCudaEngine(const void *blob, std::size_t size) noexcept
Deserialize an engine from a stream.
Definition: NvInferRuntime.h:778
nvinfer1::IRefitter::setDynamicRange
bool setDynamicRange(const char *tensorName, float min, float max) noexcept
Definition: NvInferRuntime.h:899
nvinfer1::TensorFormat
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntimeCommon.h:220
nvinfer1::EnumMax< LayerInformationFormat >
constexpr int32_t EnumMax< LayerInformationFormat >() noexcept
Definition: NvInferRuntime.h:2426
nvinfer1::IRuntime::destroy
TRT_DEPRECATED void destroy() noexcept
Destroy this object.
Definition: NvInferRuntime.h:715
nvinfer1::Weights::count
int64_t count
The number of weights in the array.
Definition: NvInferRuntime.h:160
nvinfer1::IPluginRegistry
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:1034
nvinfer1::IExecutionContext::enqueueV2
bool enqueueV2(void *const *bindings, cudaStream_t stream, cudaEvent_t *inputConsumed) noexcept
Asynchronously execute inference.
Definition: NvInferRuntime.h:2300
nvinfer1::ILogger
Application-implemented logging interface for the builder, refitter and runtime.
Definition: NvInferRuntimeCommon.h:1256
nvinfer1::DimensionOperation::kCEIL_DIV
Division rounding up.
nvinfer1::LayerInformationFormat::kONELINE
Print layer information in one line per layer.
nvinfer1::ICudaEngine
An engine for executing inference on a built network, with functionally unsafe features.
Definition: NvInferRuntime.h:1308
nvinfer1::ICudaEngine::getBindingComponentsPerElement
int32_t getBindingComponentsPerElement(int32_t bindingIndex) const noexcept
Return the number of components included in one element.
Definition: NvInferRuntime.h:1556
nvinfer1::IHostMemory::type
DataType type() const noexcept
The type of the memory that was allocated.
Definition: NvInferRuntime.h:191
nvinfer1::IRefitter::refitCudaEngine
bool refitCudaEngine() noexcept
Updates associated engine. Return true if successful.
Definition: NvInferRuntime.h:834
nvinfer1::anonymous_namespace{NvInferRuntime.h}::createInferRuntime
IRuntime * createInferRuntime(ILogger &logger) noexcept
Create an instance of an IRuntime class.
Definition: NvInferRuntime.h:2604
nvinfer1::IOptimizationProfile::isValid
bool isValid() const noexcept
Check whether the optimization profile can be passed to an IBuilderConfig object.
Definition: NvInferRuntime.h:1237
nvinfer1::IExecutionContext::enqueue
bool enqueue(int32_t batchSize, void *const *bindings, cudaStream_t stream, cudaEvent_t *inputConsumed) noexcept
Asynchronously execute inference on a batch.
Definition: NvInferRuntime.h:1894
nvinfer1::TacticSource::kCUBLAS
cuBLAS tactics.
nvinfer1::IExecutionContext::getDebugSync
bool getDebugSync() const noexcept
Get the debug sync flag.
Definition: NvInferRuntime.h:1917
nvinfer1::IRefitter::getAll
int32_t getAll(int32_t size, const char **layerNames, WeightsRole *roles) noexcept
Get description of all weights that could be refit.
Definition: NvInferRuntime.h:872
nvinfer1::IExecutionContext::execute
bool execute(int32_t batchSize, void *const *bindings) noexcept
Synchronously execute inference on a batch.
Definition: NvInferRuntime.h:1865
nvinfer1::IRuntime::deserializeCudaEngine
TRT_DEPRECATED nvinfer1::ICudaEngine * deserializeCudaEngine(const void *blob, std::size_t size, IPluginFactory *pluginFactory) noexcept
Deserialize an engine from a stream.
Definition: NvInferRuntime.h:671
nvinfer1::ICudaEngine::setErrorRecorder
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:1760
nvinfer1::IHostMemory::size
std::size_t size() const noexcept
The size in bytes of the data that was allocated.
Definition: NvInferRuntime.h:185
nvinfer1::EnumMax< TacticSource >
constexpr int32_t EnumMax< TacticSource >() noexcept
Maximum number of tactic sources in TacticSource enum.
Definition: NvInferRuntime.h:1263
nvinfer1::DimsExprs::nbDims
int32_t nbDims
The number of dimensions.
Definition: NvInferRuntime.h:341
nvinfer1::ICudaEngine::isExecutionBinding
bool isExecutionBinding(int32_t bindingIndex) const noexcept
True if pointer to tensor data is required for execution phase, false if nullptr can be supplied.
Definition: NvInferRuntime.h:1727
nvinfer1
The TensorRT API version 1 namespace.
nvinfer1::IOptimizationProfile::setShapeValues
bool setShapeValues(const char *inputName, OptProfileSelector select, const int32_t *values, int32_t nbValues) noexcept
Set the minimum / optimum / maximum values for an input shape tensor.
Definition: NvInferRuntime.h:1173
nvinfer1::EnumMax< DeviceType >
constexpr int32_t EnumMax< DeviceType >() noexcept
Maximum number of elements in DeviceType enum.
Definition: NvInferRuntime.h:639
nvinfer1::EnumMax< DimensionOperation >
constexpr int32_t EnumMax< DimensionOperation >() noexcept
Maximum number of elements in DimensionOperation enum.
Definition: NvInferRuntime.h:236
nvinfer1::IExecutionContext::executeV2
bool executeV2(void *const *bindings) noexcept
Synchronously execute inference a network.
Definition: NvInferRuntime.h:2272
nvinfer1::IRefitter::getTensorsWithDynamicRange
int32_t getTensorsWithDynamicRange(int32_t size, const char **tensorNames) const noexcept
Get names of all tensors that have refittable dynamic ranges.
Definition: NvInferRuntime.h:939
nvinfer1::IPluginV2DynamicExt
Definition: NvInferRuntime.h:380
nvinfer1::IRuntime::setGpuAllocator
void setGpuAllocator(IGpuAllocator *allocator) noexcept
Set the GPU allocator.
Definition: NvInferRuntime.h:729
nvinfer1::IRuntime::getNbDLACores
int32_t getNbDLACores() const noexcept
Returns number of DLA hardware cores accessible.
Definition: NvInferRuntime.h:703
nvinfer1::IOptimizationProfile::getExtraMemoryTarget
float getExtraMemoryTarget() const noexcept
Get the extra memory target that has been defined for this profile.
Definition: NvInferRuntime.h:1221
nvinfer1::ICudaEngine::getNbOptimizationProfiles
int32_t getNbOptimizationProfiles() const noexcept
Get the number of optimization profiles defined for this engine.
Definition: NvInferRuntime.h:1623
nvinfer1::EnumMax< ProfilingVerbosity >
constexpr int32_t EnumMax< ProfilingVerbosity >() noexcept
Maximum number of profile verbosity levels in ProfilingVerbosity enum.
Definition: NvInferRuntime.h:1296
nvinfer1::TensorLocation::kHOST
Data stored on host.
nvinfer1::EngineCapability::kDLA_STANDALONE
nvinfer1::IRuntime::getLogger
ILogger * getLogger() const noexcept
get the logger with which the runtime was created
Definition: NvInferRuntime.h:788
nvinfer1::OptProfileSelector::kOPT
This is used to set or get the value that is used in the optimization (kernel selection).
nvinfer1::IExprBuilder::constant
const IDimensionExpr * constant(int32_t value) noexcept
Return pointer to IDimensionExp for given value.
Definition: NvInferRuntime.h:315
nvinfer1::ICudaEngine::getErrorRecorder
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:1775
nvinfer1::ICudaEngine::getBindingDataType
DataType getBindingDataType(int32_t bindingIndex) const noexcept
Determine the required data type for a buffer from its binding index.
Definition: NvInferRuntime.h:1416
nvinfer1::DynamicPluginTensorDesc::max
Dims max
Upper bounds on tensor’s dimensions.
Definition: NvInferRuntime.h:359
nvinfer1::ElementWiseOperation::kEQUAL
Check if two elements are equal.
nvinfer1::IExecutionContext::setErrorRecorder
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:2240
nvinfer1::IExecutionContext::setOptimizationProfile
TRT_DEPRECATED bool setOptimizationProfile(int32_t profileIndex) noexcept
Select an optimization profile for the current context.
Definition: NvInferRuntime.h:2060
nvinfer1::IExecutionContext::setProfiler
void setProfiler(IProfiler *profiler) noexcept
Set the profiler.
Definition: NvInferRuntime.h:1927
nvinfer1::MatrixOperation::kNONE
nvinfer1::ICudaEngine::getNbLayers
int32_t getNbLayers() const noexcept
Get the number of layers in the network.
Definition: NvInferRuntime.h:1442
nvinfer1::Weights::type
DataType type
The type of the weights.
Definition: NvInferRuntime.h:158
nvinfer1::WeightsRole::kBIAS
bias for IConvolutionLayer, IDeconvolutionLayer, or IFullyConnectedLayer
nvinfer1::ICudaEngine::getBindingBytesPerComponent
int32_t getBindingBytesPerComponent(int32_t bindingIndex) const noexcept
Return the number of bytes per component of an element.
Definition: NvInferRuntime.h:1542
nvinfer1::IEngineInspector
An engine inspector which prints out the layer information of an engine or an execution context.
Definition: NvInferRuntime.h:2446
nvinfer1::DynamicPluginTensorDesc::min
Dims min
Lower bounds on tensor’s dimensions.
Definition: NvInferRuntime.h:356
nvinfer1::WeightsRole::kANY
Any other weights role.
nvinfer1::IEngineInspector::setExecutionContext
bool setExecutionContext(IExecutionContext const *context) noexcept
Set an execution context as the inspection source.
Definition: NvInferRuntime.h:2463
nvinfer1::ICudaEngine::getBindingIndex
int32_t getBindingIndex(const char *name) const noexcept
Retrieve the binding index for a named tensor.
Definition: NvInferRuntime.h:1345
nvinfer1::ICudaEngine::getNbBindings
int32_t getNbBindings() const noexcept
Get the number of binding indices.
Definition: NvInferRuntime.h:1323
nvinfer1::IRuntime::setDLACore
void setDLACore(int32_t dlaCore) noexcept
Set the DLA core that the deserialized engine must execute on.
Definition: NvInferRuntime.h:684
nvinfer1::ProfilingVerbosity::kDETAILED
Print detailed layer information including layer names and layer parameters.
nvinfer1::IExecutionContext::getEngine
const ICudaEngine & getEngine() const noexcept
Get the associated engine.
Definition: NvInferRuntime.h:1947
nvinfer1::IRefitter::getErrorRecorder
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:973
nvinfer1::WeightsRole::kSHIFT
shift part of IScaleLayer
nvinfer1::IOptimizationProfile
Optimization profile for dynamic input dimensions and shape tensors.
Definition: NvInferRuntime.h:1092
nvinfer1::ICudaEngine::createExecutionContextWithoutDeviceMemory
IExecutionContext * createExecutionContextWithoutDeviceMemory() noexcept
create an execution context without any device memory allocated
Definition: NvInferRuntime.h:1508
nvinfer1::ElementWiseOperation::kSUM
Sum of the two elements.
nvinfer1::TacticSources
uint32_t TacticSources
Represents a collection of one or more TacticSource values combine using bitwise-OR operations.
Definition: NvInferRuntime.h:1274
nvinfer1::ICudaEngine::createEngineInspector
IEngineInspector * createEngineInspector() const noexcept
Create a new engine inspector which prints the layer information in an engine or an execution context...
Definition: NvInferRuntime.h:1824
nvinfer1::DataType
DataType
The type of weights and tensors.
Definition: NvInferRuntimeCommon.h:150
nvinfer1::ICudaEngine::getTacticSources
TacticSources getTacticSources() const noexcept
return the tactic sources required by this engine
Definition: NvInferRuntime.h:1803
nvinfer1::ICudaEngine::getBindingVectorizedDim
int32_t getBindingVectorizedDim(int32_t bindingIndex) const noexcept
Return the dimension index that the buffer is vectorized.
Definition: NvInferRuntime.h:1597
nvinfer1::DimsExprs
Definition: NvInferRuntime.h:338
nvinfer1::IExecutionContext::setOptimizationProfileAsync
bool setOptimizationProfileAsync(int32_t profileIndex, cudaStream_t stream) noexcept
Select an optimization profile for the current context with async semantics.
Definition: NvInferRuntime.h:2348
nvinfer1::ElementWiseOperation::kFLOOR_DIV
Floor division of the first element by the second.
nvinfer1::DynamicPluginTensorDesc::desc
PluginTensorDesc desc
Information required to interpret a pointer to tensor data, except that desc.dims has -1 in place of ...
Definition: NvInferRuntime.h:353
nvinfer1::ElementWiseOperation::kSUB
Substract the second element from the first.
nvinfer1::INoCopy
Forward declaration of IEngineInspector for use by other interfaces.
Definition: NvInferRuntime.h:79
nvinfer1::TensorLocation::kDEVICE
Data stored on device.
NvInferRuntimeCommon.h
nvinfer1::LayerType::kCONSTANT
Constant layer.
nvinfer1::ICudaEngine::getName
const char * getName() const noexcept
Returns the name of the network associated with the engine.
Definition: NvInferRuntime.h:1612
nvinfer1::ICudaEngine::getBindingFormat
TensorFormat getBindingFormat(int32_t bindingIndex) const noexcept
Return the binding format.
Definition: NvInferRuntime.h:1566
nvinfer1::IErrorRecorder
Reference counted application-implemented error reporting interface for TensorRT objects.
Definition: NvInferRuntimeCommon.h:1439
nvinfer1::IExecutionContext::getProfiler
IProfiler * getProfiler() const noexcept
Get the profiler.
Definition: NvInferRuntime.h:1937
nvinfer1::IRefitter::getAllWeights
int32_t getAllWeights(int32_t size, const char **weightsNames) noexcept
Get names of all weights that could be refit.
Definition: NvInferRuntime.h:1027
nvinfer1::OptProfileSelector
OptProfileSelector
When setting or querying optimization profile parameters (such as shape tensor inputs or dynamic dime...
Definition: NvInferRuntime.h:1056
nvinfer1::WeightsRole
WeightsRole
How a layer uses particular Weights.
Definition: NvInferRuntime.h:609
nvinfer1::GatherMode::kDEFAULT
Similar to ONNX Gather.
nvinfer1::IPluginRegistry::registerCreator
virtual bool registerCreator(IPluginCreator &creator, AsciiChar const *const pluginNamespace) noexcept=0
Register a plugin creator. Returns false if one with same type is already registered.
nvinfer1::ICudaEngine::isShapeBinding
bool isShapeBinding(int32_t bindingIndex) const noexcept
True if tensor is required as input for shape calculations or output from them.
Definition: NvInferRuntime.h:1713
nvinfer1::ICudaEngine::getMaxBatchSize
int32_t getMaxBatchSize() const noexcept
Get the maximum batch size which can be used for inference.
Definition: NvInferRuntime.h:1428
nvinfer1::ICudaEngine::getBindingFormatDesc
const char * getBindingFormatDesc(int32_t bindingIndex) const noexcept
Return the human readable description of the tensor format.
Definition: NvInferRuntime.h:1585
nvinfer1::IRuntime::setErrorRecorder
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:748
nvinfer1::IPluginV2Ext
Plugin class for user-implemented layers.
Definition: NvInferRuntimeCommon.h:618
nvinfer1::IExecutionContext::setInputShapeBinding
bool setInputShapeBinding(int32_t bindingIndex, int32_t const *data) noexcept
Set values of input tensor required by shape calculations.
Definition: NvInferRuntime.h:2169
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::TacticSource::kCUBLAS_LT
cuBLAS LT tactics
nvinfer1::IDimensionExpr
Definition: NvInferRuntime.h:273
nvinfer1::IExecutionContext::getBindingDimensions
Dims getBindingDimensions(int32_t bindingIndex) const noexcept
Get the dynamic dimensions of a binding.
Definition: NvInferRuntime.h:2139
nvinfer1::ElementWiseOperation::kPROD
Product of the two elements.
nvinfer1::IEngineInspector::getEngineInformation
AsciiChar const * getEngineInformation(LayerInformationFormat format) const noexcept
Get a string describing the information about all the layers in the current engine or the execution c...
Definition: NvInferRuntime.h:2525
nvinfer1::EngineCapability
EngineCapability
List of supported engine capability flows.
Definition: NvInferRuntime.h:105
nvinfer1::ICudaEngine::hasImplicitBatchDimension
bool hasImplicitBatchDimension() const noexcept
Query whether the engine was built with an implicit batch dimension.
Definition: NvInferRuntime.h:1794
nvinfer1::IProfiler
Application-implemented interface for profiling.
Definition: NvInferRuntime.h:589
nvinfer1::IExecutionContext::setEnqueueEmitsProfile
void setEnqueueEmitsProfile(bool enqueueEmitsProfile) noexcept
Set whether enqueue emits layer timing to the profiler.
Definition: NvInferRuntime.h:2363
nvinfer1::LayerInformationFormat::kJSON
Print layer information in JSON format.
nvinfer1::ElementWiseOperation::kLESS
Check if element in first tensor is less than corresponding element in second tensor.
nvinfer1::ICudaEngine::bindingIsInput
bool bindingIsInput(int32_t bindingIndex) const noexcept
Determine whether a binding is an input binding.
Definition: NvInferRuntime.h:1378
nvinfer1::IOptimizationProfile::setExtraMemoryTarget
bool setExtraMemoryTarget(float target) noexcept
Set a target for extra GPU memory that may be used by this profile.
Definition: NvInferRuntime.h:1213
nvinfer1::IExecutionContext::allInputShapesSpecified
bool allInputShapesSpecified() const noexcept
Whether all input shape bindings have been specified.
Definition: NvInferRuntime.h:2220
nvinfer1::PluginTensorDesc
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimeCommon.h:368
nvinfer1::IRefitter::destroy
TRT_DEPRECATED void destroy() noexcept
Definition: NvInferRuntime.h:882
nvinfer1::Weights::values
const void * values
The weight values, in a contiguous array.
Definition: NvInferRuntime.h:159
nvinfer1::PluginFormat
TensorFormat PluginFormat
PluginFormat is reserved for backward compatibility.
Definition: NvInferRuntimeCommon.h:345
nvinfer1::ICudaEngine::getProfilingVerbosity
ProfilingVerbosity getProfilingVerbosity() const noexcept
Return the ProfilingVerbosity the builder config was set to when the engine was built.
Definition: NvInferRuntime.h:1814
nvinfer1::IRuntime::getDLACore
int32_t getDLACore() const noexcept
Get the DLA core that the engine executes on.
Definition: NvInferRuntime.h:695
nvinfer1::ICudaEngine::getBindingName
const char * getBindingName(int32_t bindingIndex) const noexcept
Retrieve the name corresponding to a binding index.
Definition: NvInferRuntime.h:1365
nvinfer1::IRefitter::setNamedWeights
bool setNamedWeights(const char *name, Weights weights) noexcept
Specify new weights of given name.
Definition: NvInferRuntime.h:991
nvinfer1::IExecutionContext::setDeviceMemory
void setDeviceMemory(void *memory) noexcept
Set the device memory for use by this execution context.
Definition: NvInferRuntime.h:1997
nvinfer1::IExecutionContext::getName
const char * getName() const noexcept
Return the name of the execution context.
Definition: NvInferRuntime.h:1981
nvinfer1::TacticSource::kCUDNN
cuDNN tactics
nvinfer1::IGpuAllocator
Application-implemented class for controlling allocation on the GPU.
Definition: NvInferRuntimeCommon.h:1138
nvinfer1::IOptimizationProfile::getDimensions
Dims getDimensions(const char *inputName, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum dimensions for a dynamic input tensor.
Definition: NvInferRuntime.h:1130
nvinfer1::anonymous_namespace{NvInferRuntime.h}::createInferRefitter
IRefitter * createInferRefitter(ICudaEngine &engine, ILogger &logger) noexcept
Create an instance of an IRefitter class.
Definition: NvInferRuntime.h:2614
nvinfer1::ICudaEngine::isRefittable
bool isRefittable() const noexcept
Return true if an engine can be refit.
Definition: NvInferRuntime.h:1528
nvinfer1::IRefitter::getMissing
int32_t getMissing(int32_t size, const char **layerNames, WeightsRole *roles) noexcept
Get description of missing weights.
Definition: NvInferRuntime.h:855
nvinfer1::IRuntime
Allows a serialized functionally unsafe engine to be deserialized.
Definition: NvInferRuntime.h:651
nvinfer1::IExecutionContext::setDebugSync
void setDebugSync(bool sync) noexcept
Set the debug sync flag.
Definition: NvInferRuntime.h:1907
nvinfer1::ICudaEngine::getEngineCapability
EngineCapability getEngineCapability() const noexcept
Determine what execution capability this engine has.
Definition: NvInferRuntime.h:1742
nvinfer1::TensorLocation
TensorLocation
The location for tensor data storage, device or host.
Definition: NvInferRuntime.h:245
nvinfer1::IExecutionContext
Context for executing inference using an engine, with functionally unsafe features.
Definition: NvInferRuntime.h:1843
nvinfer1::IRefitter::getMissingWeights
int32_t getMissingWeights(int32_t size, const char **weightsNames) noexcept
Get names of missing weights.
Definition: NvInferRuntime.h:1011
nvinfer1::IExecutionContext::destroy
TRT_DEPRECATED void destroy() noexcept
Destroy this object.
Definition: NvInferRuntime.h:1959
nvinfer1::IExprBuilder::operation
const IDimensionExpr * operation(DimensionOperation op, const IDimensionExpr &first, const IDimensionExpr &second) noexcept
Definition: NvInferRuntime.h:322
nvinfer1::IExecutionContext::getStrides
Dims getStrides(int32_t bindingIndex) const noexcept
Return the strides of the buffer for the given binding.
Definition: NvInferRuntime.h:2018
TRT_DEPRECATED
#define TRT_DEPRECATED
< Items that are marked as deprecated will be removed in a future release.
Definition: NvInferRuntimeCommon.h:77
nvinfer1::IEngineInspector::getErrorRecorder
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:2559
nvinfer1::IEngineInspector::getLayerInformation
AsciiChar const * getLayerInformation(int32_t layerIndex, LayerInformationFormat format) const noexcept
Get a string describing the information about a specific layer in the current engine or the execution...
Definition: NvInferRuntime.h:2500
nvinfer1::IRefitter::setWeights
bool setWeights(const char *layerName, WeightsRole role, Weights weights) noexcept
Specify new weights for a layer of given name. Returns true on success, or false if new weights are r...
Definition: NvInferRuntime.h:819
nvinfer1::IExecutionContext::getOptimizationProfile
int32_t getOptimizationProfile() const noexcept
Get the index of the currently selected optimization profile.
Definition: NvInferRuntime.h:2072
nvinfer1::IRefitter::setErrorRecorder
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:958
nvinfer1::IExprBuilder
Definition: NvInferRuntime.h:311
nvinfer1::ICudaEngine::createExecutionContext
IExecutionContext * createExecutionContext() noexcept
Create an execution context.
Definition: NvInferRuntime.h:1472
nvinfer1::IExecutionContext::setBindingDimensions
bool setBindingDimensions(int32_t bindingIndex, Dims dimensions) noexcept
Set the dynamic dimensions of a binding.
Definition: NvInferRuntime.h:2109