TensorRT for RTX 1.7.1
NvInferRuntime.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef NV_INFER_RUNTIME_H
19#define NV_INFER_RUNTIME_H
20
26
27#include "NvInferImpl.h" // IWYU pragma: export
28#define NV_INFER_INTERNAL_INCLUDE 1
29#include "NvInferPluginBase.h" // IWYU pragma: export
30#undef NV_INFER_INTERNAL_INCLUDE
31#include "NvInferRuntimeCommon.h" // IWYU pragma: export
32
33namespace nvinfer1
34{
35
36class IExecutionContext;
37class ICudaEngine;
38class IPluginFactory;
39class IEngineInspector;
40
49
51{
52protected:
53 INoCopy() = default;
54 virtual ~INoCopy() = default;
55 INoCopy(INoCopy const& other) = delete;
56 INoCopy& operator=(INoCopy const& other) = delete;
57 INoCopy(INoCopy&& other) = delete;
58 INoCopy& operator=(INoCopy&& other) = delete;
59};
60
75enum class EngineCapability : int32_t
76{
81 kSTANDARD = 0,
82
89 kSAFETY = 1,
90
97};
98
100template <>
102{
103 static constexpr int32_t kVALUE = 3;
104};
105
132{
133public:
135 void const* values;
136 int64_t count;
137};
138
149class IHostMemory : public INoCopy
150{
151public:
152 virtual ~IHostMemory() noexcept = 0;
153
155 void* data() const noexcept
156 {
157 return mImpl->data();
158 }
159
161 std::size_t size() const noexcept
162 {
163 return mImpl->size();
164 }
165
167 DataType type() const noexcept
168 {
169 return mImpl->type();
170 }
171
172protected:
173 apiv::VHostMemory* mImpl;
174};
175
176inline IHostMemory::~IHostMemory() noexcept = default;
177
188enum class DimensionOperation : int32_t
189{
190 kSUM = 0,
191 kPROD = 1,
192 kMAX = 2,
193 kMIN = 3,
194 kSUB = 4,
195 kEQUAL = 5,
196 kLESS = 6,
197 kFLOOR_DIV = 7,
198 kCEIL_DIV = 8
199};
200
202template <>
204{
205 static constexpr int32_t kVALUE = 9;
206};
207
213enum class TensorLocation : int32_t
214{
215 kDEVICE = 0,
216 kHOST = 1,
217};
218
220template <>
222{
223 static constexpr int32_t kVALUE = 2;
224};
225
239{
240public:
244 bool isConstant() const noexcept
245 {
246 return mImpl->isConstant();
247 }
248
255 int64_t getConstantValue() const noexcept
256 {
257 return mImpl->getConstantValue();
258 }
259
260protected:
261 apiv::VDimensionExpr* mImpl;
262 virtual ~IDimensionExpr() noexcept = 0;
263
264public:
270 bool isSizeTensor() const noexcept
271 {
272 return mImpl->isSizeTensor();
273 }
274};
275
276inline IDimensionExpr::~IDimensionExpr() noexcept = default;
277
295class IExprBuilder : public INoCopy
296{
297public:
301 IDimensionExpr const* constant(int64_t value) noexcept
302 {
303 return mImpl->constant(value);
304 }
305
313 DimensionOperation op, IDimensionExpr const& first, IDimensionExpr const& second) noexcept
314 {
315 return mImpl->operation(op, first, second);
316 }
317
318protected:
319 apiv::VExprBuilder* mImpl;
320 virtual ~IExprBuilder() noexcept = 0;
321
322public:
347 IDimensionExpr const* declareSizeTensor(int32_t outputIndex, IDimensionExpr const& opt, IDimensionExpr const& upper)
348 {
349 return mImpl->declareSizeTensor(outputIndex, opt, upper);
350 }
351};
352
353inline IExprBuilder::~IExprBuilder() noexcept = default;
354
361{
362public:
363 int32_t nbDims;
365};
366
373{
376
379
382
385};
386
418{
419public:
420 IPluginV2DynamicExt* clone() const noexcept override = 0;
421
446 virtual DimsExprs getOutputDimensions(
447 int32_t outputIndex, DimsExprs const* inputs, int32_t nbInputs, IExprBuilder& exprBuilder) noexcept = 0;
448
452 static constexpr int32_t kFORMAT_COMBINATION_LIMIT = 100;
453
486 virtual bool supportsFormatCombination(
487 int32_t pos, PluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept = 0;
488
524 virtual void configurePlugin(DynamicPluginTensorDesc const* in, int32_t nbInputs,
525 DynamicPluginTensorDesc const* out, int32_t nbOutputs) noexcept = 0;
526
536 virtual size_t getWorkspaceSize(PluginTensorDesc const* inputs, int32_t nbInputs, PluginTensorDesc const* outputs,
537 int32_t nbOutputs) const noexcept = 0;
538
551 virtual int32_t enqueue(PluginTensorDesc const* inputDesc, PluginTensorDesc const* outputDesc,
552 void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept = 0;
553
554protected:
562 int32_t getTensorRTVersion() const noexcept override
563 {
564 return (static_cast<int32_t>(PluginVersion::kV2_DYNAMICEXT) << 24 | (NV_TENSORRT_VERSION & 0xFFFFFF));
565 }
566
567 virtual ~IPluginV2DynamicExt() noexcept {}
568
569private:
570 // Following are obsolete base class methods, and must not be implemented or used.
571
575 void configurePlugin(Dims const*, int32_t, Dims const*, int32_t, DataType const*, DataType const*, bool const*,
576 bool const*, PluginFormat, int32_t) noexcept final
577 {
578 }
579
583 bool supportsFormat(DataType, PluginFormat) const noexcept final
584 {
585 return false;
586 }
587
591 Dims getOutputDimensions(int32_t, Dims const*, int32_t) noexcept final
592 {
593 return Dims{-1, {}};
594 }
595
599 size_t getWorkspaceSize(int32_t) const noexcept final
600 {
601 return 0;
602 }
603
607 int32_t enqueue(int32_t, void const* const*, void* const*, void*, cudaStream_t) noexcept final
608 {
609 return 1;
610 }
611};
612
613namespace v_1_0
614{
619{
620public:
625 ~IStreamReader() override = default;
626 IStreamReader() = default;
627
631 InterfaceInfo getInterfaceInfo() const noexcept override
632 {
633 return InterfaceInfo{"IStreamReader", 1, 0};
634 }
635
644 virtual int64_t read(void* destination, int64_t nbBytes) = 0;
645
646protected:
647 IStreamReader(IStreamReader const&) = default;
651};
652
654{
655public:
660 ~IStreamWriter() override = default;
661 IStreamWriter() = default;
662
666 InterfaceInfo getInterfaceInfo() const noexcept override
667 {
668 return InterfaceInfo{"IStreamWriter", 1, 0};
669 }
670
680 virtual int64_t write(void const* data, int64_t nbBytes) = 0;
681
682protected:
683 IStreamWriter(IStreamWriter const&) = default;
687};
688} // namespace v_1_0
689
701
711
716enum class SeekPosition : int32_t
717{
719 kSET = 0,
720
722 kCUR = 1,
723
725 kEND = 2,
726};
727
728namespace v_1_0
729{
731{
732public:
737 ~IStreamReaderV2() override = default;
738 IStreamReaderV2() = default;
739
743 InterfaceInfo getInterfaceInfo() const noexcept override
744 {
745 return InterfaceInfo{"IStreamReaderV2", 1, 0};
746 }
747
758 virtual int64_t read(void* destination, int64_t nbBytes, cudaStream_t stream) noexcept = 0;
759
768 virtual bool seek(int64_t offset, SeekPosition where) noexcept = 0;
769
770protected:
775};
776} // namespace v_1_0
777
788
803{
804public:
809 virtual IGpuAllocator* getGpuAllocator() const noexcept = 0;
810
815 virtual IErrorRecorder* getErrorRecorder() const noexcept = 0;
816 virtual ~IPluginResourceContext() noexcept = 0;
817
818protected:
822 IPluginResourceContext& operator=(IPluginResourceContext const&) & = default;
824};
825
826inline IPluginResourceContext::~IPluginResourceContext() noexcept = default;
827
828namespace v_1_0
829{
831{
832public:
836 InterfaceInfo getInterfaceInfo() const noexcept override
837 {
838 return InterfaceInfo{"PLUGIN_V3ONE_CORE", 1, 0};
839 }
840
849 virtual AsciiChar const* getPluginName() const noexcept = 0;
850
859 virtual AsciiChar const* getPluginVersion() const noexcept = 0;
860
870 virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
871};
872
874{
875public:
881 static constexpr int32_t kDEFAULT_FORMAT_COMBINATION_LIMIT = 100;
882
886 InterfaceInfo getInterfaceInfo() const noexcept override
887 {
888 return InterfaceInfo{"PLUGIN_V3ONE_BUILD", 1, 0};
889 }
890
910 virtual int32_t configurePlugin(DynamicPluginTensorDesc const* in, int32_t nbInputs,
911 DynamicPluginTensorDesc const* out, int32_t nbOutputs) noexcept = 0;
912
929 virtual int32_t getOutputDataTypes(
930 DataType* outputTypes, int32_t nbOutputs, DataType const* inputTypes, int32_t nbInputs) const noexcept = 0;
931
953 virtual int32_t getOutputShapes(DimsExprs const* inputs, int32_t nbInputs, DimsExprs const* shapeInputs,
954 int32_t nbShapeInputs, DimsExprs* outputs, int32_t nbOutputs, IExprBuilder& exprBuilder) noexcept = 0;
955
991 int32_t pos, DynamicPluginTensorDesc const* inOut, int32_t nbInputs, int32_t nbOutputs) noexcept = 0;
992
998 virtual int32_t getNbOutputs() const noexcept = 0;
999
1009 virtual size_t getWorkspaceSize(DynamicPluginTensorDesc const* /* inputs */, int32_t /* nbInputs */,
1010 DynamicPluginTensorDesc const* /* outputs */, int32_t /* nbOutputs */) const noexcept
1011 {
1012 return 0;
1013 }
1014
1046 virtual int32_t getValidTactics(int32_t* /* tactics */, int32_t /* nbTactics */) noexcept
1047 {
1048 return 0;
1049 }
1050
1054 virtual int32_t getNbTactics() noexcept
1055 {
1056 return 0;
1057 }
1058
1070 virtual char const* getTimingCacheID() noexcept
1071 {
1072 return nullptr;
1073 }
1074
1078 virtual int32_t getFormatCombinationLimit() noexcept
1079 {
1080 return kDEFAULT_FORMAT_COMBINATION_LIMIT;
1081 }
1082
1089 virtual char const* getMetadataString() noexcept
1090 {
1091 return nullptr;
1092 }
1093};
1094
1096{
1097public:
1101 InterfaceInfo getInterfaceInfo() const noexcept override
1102 {
1103 return InterfaceInfo{"PLUGIN_V3ONE_RUNTIME", 1, 0};
1104 }
1105
1113 virtual int32_t setTactic(int32_t /* tactic */) noexcept
1114 {
1115 return 0;
1116 }
1117
1136 virtual int32_t onShapeChange(
1137 PluginTensorDesc const* in, int32_t nbInputs, PluginTensorDesc const* out, int32_t nbOutputs) noexcept = 0;
1138
1152 virtual int32_t enqueue(PluginTensorDesc const* inputDesc, PluginTensorDesc const* outputDesc,
1153 void const* const* inputs, void* const* outputs, void* workspace, cudaStream_t stream) noexcept = 0;
1154
1174 virtual IPluginV3* attachToContext(IPluginResourceContext* context) noexcept = 0;
1175
1181
1185 virtual PluginFieldCollection const* getFieldsToSerialize() noexcept = 0;
1186};
1187} // namespace v_1_0
1188
1189namespace v_2_0
1190{
1191
1193{
1194public:
1195 InterfaceInfo getInterfaceInfo() const noexcept override
1196 {
1197 return InterfaceInfo{"PLUGIN_V3ONE_BUILD", 2, 0};
1198 }
1199
1229 virtual int32_t getAliasedInput(int32_t /* outputIndex */) noexcept
1230 {
1231 return -1;
1232 }
1233};
1234
1235} // namespace v_2_0
1236
1247
1259
1271
1280
1283namespace v_1_0
1284{
1286{
1287public:
1291 InterfaceInfo getInterfaceInfo() const noexcept override
1292 {
1293 return {"IProfiler", 1, 0};
1294 }
1295
1303 virtual void reportLayerTime(char const* layerName, float ms) noexcept = 0;
1304
1305 ~IProfiler() override = default;
1306};
1307} // namespace v_1_0
1308
1321
1329enum class WeightsRole : int32_t
1330{
1331 kKERNEL = 0,
1332 kBIAS = 1,
1333 kSHIFT = 2,
1334 kSCALE = 3,
1335 kCONSTANT = 4,
1336 kANY = 5,
1337};
1338
1340template <>
1342{
1343 static constexpr int32_t kVALUE = 6;
1344};
1345
1351enum class DeviceType : int32_t
1352{
1353 kGPU = 0,
1354 kDLA = 1,
1355};
1356
1358template <>
1360{
1361 static constexpr int32_t kVALUE = 2;
1362};
1363
1374enum class TempfileControlFlag : int32_t
1375{
1378
1383};
1384
1386template <>
1388{
1389 static constexpr int32_t kVALUE = 2;
1390};
1391
1398using TempfileControlFlags = uint32_t;
1399
1431enum class TensorFormat : int32_t
1432{
1439 kLINEAR = 0,
1440
1445 kCHW2 = 1,
1446
1450 kHWC8 = 2,
1451
1465 kCHW4 = 3,
1466
1473 kCHW16 = 4,
1474
1482 kCHW32 = 5,
1483
1488 kDHWC8 = 6,
1489
1494 kCDHW32 = 7,
1495
1499 kHWC = 8,
1500
1509 kDLA_LINEAR = 9,
1510
1524 kDLA_HWC4 = 10,
1525
1530 kHWC16 = 11,
1531
1536 kDHWC = 12
1537};
1538
1540template <>
1542{
1544 static constexpr int32_t kVALUE = 13;
1545};
1546
1552enum class AllocatorFlag : int32_t
1553{
1555 kRESIZABLE = 0,
1556};
1557
1559template <>
1561{
1563 static constexpr int32_t kVALUE = 1;
1564};
1565
1566using AllocatorFlags = uint32_t;
1567
1576{
1578 kDEFAULT = 0,
1585 kSHARED_STATIC = 1,
1586};
1587
1589template <>
1591{
1593 static constexpr int32_t kVALUE = 2;
1594};
1595
1598namespace v_1_0
1599{
1600
1614{
1615public:
1619 InterfaceInfo getInterfaceInfo() const noexcept override
1620 {
1621 return {"ILogger", 1, 0};
1622 }
1623
1629 enum class Severity : int32_t
1630 {
1632 kINTERNAL_ERROR = 0,
1634 kERROR = 1,
1636 kWARNING = 2,
1638 kINFO = 3,
1640 kVERBOSE = 4,
1641 };
1642
1661 virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
1662
1663 ILogger() = default;
1664 ~ILogger() override = default;
1665
1666protected:
1667 // @cond SuppressDoxyWarnings
1668 ILogger(ILogger const&) = default;
1669 ILogger(ILogger&&) = default;
1670 ILogger& operator=(ILogger const&) & = default;
1671 ILogger& operator=(ILogger&&) & = default;
1672 // @endcond
1673};
1674
1675} // namespace v_1_0
1676
1677using ILogger = v_1_0::ILogger;
1678
1680template <>
1682{
1684 static constexpr int32_t kVALUE = 5;
1685};
1686
1687namespace v_1_0
1688{
1689
1691{
1692public:
1718 uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept = 0;
1719
1720 ~IGpuAllocator() override = default;
1721 IGpuAllocator() = default;
1722
1760 virtual void* reallocate(void* const /*baseAddr*/, uint64_t /*alignment*/, uint64_t /*newSize*/) noexcept
1761 {
1762 return nullptr;
1763 }
1764
1783 TRT_DEPRECATED virtual bool deallocate(void* const memory) noexcept = 0;
1784
1813 virtual void* allocateAsync(
1814 uint64_t const size, uint64_t const alignment, AllocatorFlags const flags, cudaStream_t /*stream*/) noexcept
1815 {
1816 return allocate(size, alignment, flags);
1817 }
1846 virtual bool deallocateAsync(void* const memory, cudaStream_t /*stream*/) noexcept
1847 {
1848 return deallocate(memory);
1849 }
1850
1854 InterfaceInfo getInterfaceInfo() const noexcept override
1855 {
1856 return {"IGpuAllocator", 1, 0};
1857 }
1858
1859protected:
1860 // @cond SuppressDoxyWarnings
1861 IGpuAllocator(IGpuAllocator const&) = default;
1862 IGpuAllocator(IGpuAllocator&&) = default;
1863 IGpuAllocator& operator=(IGpuAllocator const&) & = default;
1864 IGpuAllocator& operator=(IGpuAllocator&&) & = default;
1865 // @endcond
1866};
1867
1868} // namespace v_1_0
1869
1891
1897enum class EngineValidity : int32_t
1898{
1900 kVALID = 0,
1901
1903 kSUBOPTIMAL = 1,
1904
1906 kINVALID = 2,
1907};
1908
1910template <>
1912{
1913 static constexpr int32_t kVALUE = 3;
1914};
1915
1920enum class EngineInvalidityDiagnostics : uint64_t
1921{
1923 kVERSION_MISMATCH = 1ULL << 0,
1924
1926 kUNSUPPORTED_CC = 1ULL << 1,
1927
1929 kOLD_CUDA_DRIVER = 1ULL << 2,
1930
1932 kOLD_CUDA_RUNTIME = 1ULL << 3,
1933
1935 kINSUFFICIENT_GPU_MEMORY = 1ULL << 4,
1936
1938 kMALFORMED_ENGINE = 1ULL << 5,
1939
1941 kCUDA_ERROR = 1ULL << 6,
1942};
1943
1944
1952class IRuntime : public INoCopy
1953{
1954public:
1955 virtual ~IRuntime() noexcept = 0;
1956
1971 void setDLACore(int32_t dlaCore) noexcept
1972 {
1973 mImpl->setDLACore(dlaCore);
1974 }
1975
1981 int32_t getDLACore() const noexcept
1982 {
1983 return mImpl->getDLACore();
1984 }
1985
1989 int32_t getNbDLACores() const noexcept
1990 {
1991 return mImpl->getNbDLACores();
1992 }
1993
2007 {
2008 return mImpl->setDLAWorkspaceAllocationStrategy(strategy);
2009 }
2010
2017 {
2018 return mImpl->getDLAWorkspaceAllocationStrategy();
2019 }
2020
2032 void setGpuAllocator(IGpuAllocator* allocator) noexcept
2033 {
2034 mImpl->setGpuAllocator(allocator);
2035 }
2036
2048 //
2051 void setErrorRecorder(IErrorRecorder* recorder) noexcept
2052 {
2053 mImpl->setErrorRecorder(recorder);
2054 }
2055
2067 {
2068 return mImpl->getErrorRecorder();
2069 }
2070
2084 ICudaEngine* deserializeCudaEngine(void const* blob, std::size_t size) noexcept
2085 {
2086 return mImpl->deserializeCudaEngine(blob, size);
2087 }
2088
2108 {
2109 return mImpl->deserializeCudaEngineV2(streamReader);
2110 }
2111
2117 ILogger* getLogger() const noexcept
2118 {
2119 return mImpl->getLogger();
2120 }
2121
2132 bool setMaxThreads(int32_t maxThreads) noexcept
2133 {
2134 return mImpl->setMaxThreads(maxThreads);
2135 }
2136
2146 int32_t getMaxThreads() const noexcept
2147 {
2148 return mImpl->getMaxThreads();
2149 }
2150
2181 void setTemporaryDirectory(char const* path) noexcept
2182 {
2183 return mImpl->setTemporaryDirectory(path);
2184 }
2185
2192 char const* getTemporaryDirectory() const noexcept
2193 {
2194 return mImpl->getTemporaryDirectory();
2195 }
2196
2209 {
2210 return mImpl->setTempfileControlFlags(flags);
2211 }
2212
2221 {
2222 return mImpl->getTempfileControlFlags();
2223 }
2224
2231 {
2232 return mImpl->getPluginRegistry();
2233 }
2234
2248 IRuntime* loadRuntime(char const* path) noexcept
2249 {
2250 return mImpl->loadRuntime(path);
2251 }
2252
2260 void setEngineHostCodeAllowed(bool allowed) noexcept
2261 {
2262 return mImpl->setEngineHostCodeAllowed(allowed);
2263 }
2264
2270 bool getEngineHostCodeAllowed() const noexcept
2271 {
2272 return mImpl->getEngineHostCodeAllowed();
2273 }
2274
2282 int64_t getEngineHeaderSize() const noexcept
2283 {
2284 return mImpl->getEngineHeaderSize();
2285 }
2286
2310 EngineValidity getEngineValidity(void const* blob, int64_t blobSize, uint64_t* diagnostics) const noexcept
2311 {
2312 return mImpl->getEngineValidity(blob, blobSize, diagnostics);
2313 }
2314
2335 void setDeferredWeightsLoading(bool defer) noexcept
2336 {
2337 mImpl->setDeferredWeightsLoading(defer);
2338 }
2339
2344 {
2345 return mImpl->getDeferredWeightsLoading();
2346 }
2347
2348
2349protected:
2350 apiv::VRuntime* mImpl{};
2351};
2352
2353inline IRuntime::~IRuntime() noexcept = default;
2354
2362class IRefitter : public INoCopy
2363{
2364public:
2365 virtual ~IRefitter() noexcept = 0;
2366
2382 bool setWeights(char const* layerName, WeightsRole role, Weights weights) noexcept
2383 {
2384 return mImpl->setWeights(layerName, role, weights);
2385 }
2386
2399 bool refitCudaEngine() noexcept
2400 {
2401 return mImpl->refitCudaEngine();
2402 }
2403
2420 int32_t getMissing(int32_t size, char const** layerNames, WeightsRole* roles) noexcept
2421 {
2422 return mImpl->getMissing(size, layerNames, roles);
2423 }
2424
2437 int32_t getAll(int32_t size, char const** layerNames, WeightsRole* roles) noexcept
2438 {
2439 return mImpl->getAll(size, layerNames, roles);
2440 }
2441
2453 //
2456 void setErrorRecorder(IErrorRecorder* recorder) noexcept
2457 {
2458 mImpl->setErrorRecorder(recorder);
2459 }
2460
2472 {
2473 return mImpl->getErrorRecorder();
2474 }
2475
2496 bool setNamedWeights(char const* name, Weights weights) noexcept
2497 {
2498 return mImpl->setNamedWeights(name, weights);
2499 }
2500
2516 int32_t getMissingWeights(int32_t size, char const** weightsNames) noexcept
2517 {
2518 return mImpl->getMissingWeights(size, weightsNames);
2519 }
2520
2532 int32_t getAllWeights(int32_t size, char const** weightsNames) noexcept
2533 {
2534 return mImpl->getAllWeights(size, weightsNames);
2535 }
2536
2542 ILogger* getLogger() const noexcept
2543 {
2544 return mImpl->getLogger();
2545 }
2546
2558 bool setMaxThreads(int32_t maxThreads) noexcept
2559 {
2560 return mImpl->setMaxThreads(maxThreads);
2561 }
2562
2572 int32_t getMaxThreads() const noexcept
2573 {
2574 return mImpl->getMaxThreads();
2575 }
2576
2599 bool setNamedWeights(char const* name, Weights weights, TensorLocation location) noexcept
2600 {
2601 return mImpl->setNamedWeightsWithLocation(name, weights, location);
2602 }
2603
2615 Weights getNamedWeights(char const* weightsName) const noexcept
2616 {
2617 return mImpl->getNamedWeights(weightsName);
2618 }
2619
2631 TensorLocation getWeightsLocation(char const* weightsName) const noexcept
2632 {
2633 return mImpl->getWeightsLocation(weightsName);
2634 }
2635
2647 bool unsetNamedWeights(char const* weightsName) noexcept
2648 {
2649 return mImpl->unsetNamedWeights(weightsName);
2650 }
2651
2663 void setWeightsValidation(bool weightsValidation) noexcept
2664 {
2665 return mImpl->setWeightsValidation(weightsValidation);
2666 }
2667
2671 bool getWeightsValidation() const noexcept
2672 {
2673 return mImpl->getWeightsValidation();
2674 }
2675
2702 bool refitCudaEngineAsync(cudaStream_t stream) noexcept
2703 {
2704 return mImpl->refitCudaEngineAsync(stream);
2705 }
2706
2720 Weights getWeightsPrototype(char const* weightsName) const noexcept
2721 {
2722 return mImpl->getWeightsPrototype(weightsName);
2723 }
2724
2735 {
2736 return mImpl->releaseRefitResources();
2737 }
2738
2739protected:
2740 apiv::VRefitter* mImpl;
2741};
2742
2743inline IRefitter::~IRefitter() noexcept = default;
2744
2755enum class OptProfileSelector : int32_t
2756{
2757 kMIN = 0,
2758 kOPT = 1,
2759 kMAX = 2
2760};
2761
2763template <>
2765{
2766 static constexpr int32_t kVALUE = 3;
2767};
2768
2792{
2793public:
2821 bool setDimensions(char const* inputName, OptProfileSelector select, Dims const& dims) noexcept
2822 {
2823 return mImpl->setDimensions(inputName, select, dims);
2824 }
2825
2833 Dims getDimensions(char const* inputName, OptProfileSelector select) const noexcept
2834 {
2835 return mImpl->getDimensions(inputName, select);
2836 }
2837
2846 int32_t getNbShapeValues(char const* inputName) const noexcept
2847 {
2848 return mImpl->getNbShapeValues(inputName);
2849 }
2850
2864 bool setExtraMemoryTarget(float target) noexcept
2865 {
2866 return mImpl->setExtraMemoryTarget(target);
2867 }
2868
2876 float getExtraMemoryTarget() const noexcept
2877 {
2878 return mImpl->getExtraMemoryTarget();
2879 }
2880
2893 bool isValid() const noexcept
2894 {
2895 return mImpl->isValid();
2896 }
2897
2941 char const* inputName, OptProfileSelector select, int64_t const* values, int32_t nbValues) noexcept
2942 {
2943 return mImpl->setShapeValuesV2(inputName, select, values, nbValues);
2944 }
2945
2953 int64_t const* getShapeValuesV2(char const* inputName, OptProfileSelector select) const noexcept
2954 {
2955 return mImpl->getShapeValuesV2(inputName, select);
2956 }
2957
2979 void setProfileStream(cudaStream_t stream) noexcept
2980 {
2981 mImpl->setProfileStream(stream);
2982 }
2983
2991 cudaStream_t getProfileStream() const noexcept
2992 {
2993 return mImpl->getProfileStream();
2994 }
2995
2996protected:
2997 apiv::VOptimizationProfile* mImpl;
2998 virtual ~IOptimizationProfile() noexcept = 0;
2999};
3000
3001inline IOptimizationProfile::~IOptimizationProfile() noexcept = default;
3002
3010enum class TacticSource : int32_t
3011{
3016
3020};
3021
3023template <>
3025{
3026 static constexpr int32_t kVALUE = 2;
3027};
3028
3035using TacticSources = uint32_t;
3036
3046enum class ProfilingVerbosity : int32_t
3047{
3048 kLAYER_NAMES_ONLY = 0,
3049 kNONE = 1,
3050 kDETAILED = 2,
3051};
3052
3054template <>
3056{
3057 static constexpr int32_t kVALUE = 3;
3058};
3059
3066using SerializationFlags = uint32_t;
3067
3075enum class SerializationFlag : int32_t
3076{
3077 kEXCLUDE_WEIGHTS = 0,
3079 kINCLUDE_REFIT = 2,
3080};
3081
3083template <>
3085{
3086 static constexpr int32_t kVALUE = 3;
3087};
3088
3097{
3098public:
3099 virtual ~ISerializationConfig() noexcept = 0;
3100
3112 bool setFlags(SerializationFlags serializationFlags) noexcept
3113 {
3114 return mImpl->setFlags(serializationFlags);
3115 }
3116
3125 {
3126 return mImpl->getFlags();
3127 }
3128
3136 bool clearFlag(SerializationFlag serializationFlag) noexcept
3137 {
3138 return mImpl->clearFlag(serializationFlag);
3139 }
3140
3148 bool setFlag(SerializationFlag serializationFlag) noexcept
3149 {
3150 return mImpl->setFlag(serializationFlag);
3151 }
3152
3160 bool getFlag(SerializationFlag serializationFlag) const noexcept
3161 {
3162 return mImpl->getFlag(serializationFlag);
3163 }
3164
3165protected:
3166 apiv::VSerializationConfig* mImpl;
3167};
3168
3169inline ISerializationConfig::~ISerializationConfig() noexcept = default;
3170
3183{
3184 kSTATIC = 0,
3185 kON_PROFILE_CHANGE = 1,
3186 kUSER_MANAGED = 2,
3187};
3188
3191template <>
3193{
3194 static constexpr int32_t kVALUE = 3;
3195};
3196
3205{
3206public:
3207 virtual ~IRuntimeCache() noexcept = 0;
3208
3214 IHostMemory* serialize() const noexcept
3215 {
3216 return mImpl->serialize();
3217 }
3218
3237 bool deserialize(void const* blob, size_t size) noexcept
3238 {
3239 return mImpl->deserialize(blob, size);
3240 }
3241
3245 bool reset() noexcept
3246 {
3247 return mImpl->reset();
3248 }
3249
3250protected:
3251 apiv::VRuntimeCache* mImpl;
3252};
3253
3254inline IRuntimeCache::~IRuntimeCache() noexcept = default;
3255
3268{
3274 kLAZY = 0,
3275
3280 kEAGER = 1,
3281
3285 kNONE = 2,
3286};
3287
3290template <>
3292{
3293 static constexpr int32_t kVALUE = 3;
3294};
3295
3303enum class CudaGraphStrategy : int32_t
3304{
3308 kDISABLED = 0,
3309
3318};
3319
3321template <>
3323{
3324 static constexpr int32_t kVALUE = 2;
3325};
3326
3327
3335{
3336public:
3337 virtual ~IRuntimeConfig() noexcept = 0;
3338
3344 void setExecutionContextAllocationStrategy(ExecutionContextAllocationStrategy strategy) noexcept
3345 {
3346 return mImpl->setExecutionContextAllocationStrategy(strategy);
3347 }
3348
3355 {
3356 return mImpl->getExecutionContextAllocationStrategy();
3357 }
3358
3365 {
3366 return mImpl->createRuntimeCache();
3367 }
3368
3374 bool setRuntimeCache(IRuntimeCache const& cache) noexcept
3375 {
3376 return mImpl->setRuntimeCache(cache);
3377 }
3378
3385 {
3386 return mImpl->getRuntimeCache();
3387 }
3388
3395 DynamicShapesKernelSpecializationStrategy dynamicShapesKernelSpecializationStrategy) noexcept
3396 {
3397 return mImpl->setDynamicShapesKernelSpecializationStrategy(dynamicShapesKernelSpecializationStrategy);
3398 }
3399
3406 {
3407 return mImpl->getDynamicShapesKernelSpecializationStrategy();
3408 }
3409
3430 {
3431 return mImpl->setCudaGraphStrategy(strategy);
3432 }
3433
3440 {
3441 return mImpl->getCudaGraphStrategy();
3442 }
3443
3444protected:
3445 apiv::VRuntimeConfig* mImpl;
3446}; // class IRuntimeConfig
3447
3448inline IRuntimeConfig::~IRuntimeConfig() noexcept = default;
3449
3464{
3465public:
3466 virtual ~IWeightsManager() noexcept = 0;
3467
3474 TRT_NODISCARD int64_t getSize() const noexcept
3475 {
3476 return mImpl->getSize();
3477 }
3478
3492 void* dst, int64_t dstSize, TensorLocation location, cudaStream_t stream) noexcept
3493 {
3494 return mImpl->saveToBuffer(dst, dstSize, location, stream);
3495 }
3496
3510 TRT_NODISCARD bool saveToStream(IStreamWriter& writer, cudaStream_t stream) noexcept
3511 {
3512 return mImpl->saveToStream(writer, stream);
3513 }
3514
3529 TRT_NODISCARD bool unload(cudaStream_t stream) noexcept
3530 {
3531 return mImpl->unload(stream);
3532 }
3533
3548 void const* src, int64_t srcSize, TensorLocation location, cudaStream_t stream) noexcept
3549 {
3550 return mImpl->restoreFromBuffer(src, srcSize, location, stream);
3551 }
3552
3578 uint64_t allocationHandle, int64_t offset, int64_t size, cudaStream_t stream) noexcept
3579 {
3580 return mImpl->restoreFromVmmAllocation(allocationHandle, offset, size, stream);
3581 }
3582
3583protected:
3584 apiv::VWeightsManager* mImpl;
3585};
3586
3587inline IWeightsManager::~IWeightsManager() noexcept = default;
3588
3597enum class EngineStat : int32_t
3598{
3601
3604};
3605
3607template <>
3609{
3610 static constexpr int32_t kVALUE = 2;
3611};
3612
3620class ICudaEngine : public INoCopy
3621{
3622public:
3623 virtual ~ICudaEngine() noexcept = 0;
3624
3635 Dims getTensorShape(char const* tensorName) const noexcept
3636 {
3637 return mImpl->getTensorShape(tensorName);
3638 }
3639
3650 DataType getTensorDataType(char const* tensorName) const noexcept
3651 {
3652 return mImpl->getTensorDataType(tensorName);
3653 }
3654
3664 int32_t getNbLayers() const noexcept
3665 {
3666 return mImpl->getNbLayers();
3667 }
3668
3678 IHostMemory* serialize() const noexcept
3679 {
3680 return mImpl->serialize();
3681 }
3682
3697 {
3698 return mImpl->createExecutionContext(strategy);
3699 }
3700
3713 TensorLocation getTensorLocation(char const* tensorName) const noexcept
3714 {
3715 return mImpl->getTensorLocation(tensorName);
3716 }
3717
3733 bool isShapeInferenceIO(char const* tensorName) const noexcept
3734 {
3735 return mImpl->isShapeInferenceIO(tensorName);
3736 }
3737
3747 TensorIOMode getTensorIOMode(char const* tensorName) const noexcept
3748 {
3749 return mImpl->getTensorIOMode(tensorName);
3750 }
3751
3766 TRT_NODISCARD char const* getAliasedInputTensor(char const* tensorName) const noexcept
3767 {
3768 return mImpl->getAliasedInputTensor(tensorName);
3769 }
3770
3779 {
3780 return mImpl->createExecutionContextWithRuntimeConfig(runtimeConfig);
3781 }
3782
3792 {
3793 return mImpl->createRuntimeConfig();
3794 }
3795
3807 TRT_NODISCARD bool areWeightsLoaded() const noexcept
3808 {
3809 return mImpl->areWeightsLoaded();
3810 }
3811
3834 TRT_NODISCARD bool loadWeights(void const* blob, int64_t size) noexcept
3835 {
3836 return mImpl->loadWeights(blob, size);
3837 }
3838
3885 TRT_NODISCARD bool loadWeightsAsync(IStreamReaderV2& streamReader, cudaStream_t stream) noexcept
3886 {
3887 return mImpl->loadWeightsAsync(streamReader, stream);
3888 }
3889
3912 {
3913 return mImpl->unloadWeights();
3914 }
3915
3925 int64_t getDeviceMemorySizeV2() const noexcept
3926 {
3927 return mImpl->getDeviceMemorySizeV2();
3928 }
3929
3939 int64_t getDeviceMemorySizeForProfileV2(int32_t profileIndex) const noexcept
3940 {
3941 return mImpl->getDeviceMemorySizeForProfileV2(profileIndex);
3942 }
3943
3949 bool isRefittable() const noexcept
3950 {
3951 return mImpl->isRefittable();
3952 }
3953
3970 int32_t getTensorBytesPerComponent(char const* tensorName) const noexcept
3971 {
3972 return mImpl->getTensorBytesPerComponent(tensorName);
3973 }
3974
3988 int32_t getTensorBytesPerComponent(char const* tensorName, int32_t profileIndex) const noexcept
3989 {
3990 return mImpl->getTensorBytesPerComponentV2(tensorName, profileIndex);
3991 }
3992
4009 int32_t getTensorComponentsPerElement(char const* tensorName) const noexcept
4010 {
4011 return mImpl->getTensorComponentsPerElement(tensorName);
4012 }
4013
4027 int32_t getTensorComponentsPerElement(char const* tensorName, int32_t profileIndex) const noexcept
4028 {
4029 return mImpl->getTensorComponentsPerElementV2(tensorName, profileIndex);
4030 }
4031
4042 TensorFormat getTensorFormat(char const* tensorName) const noexcept
4043 {
4044 return mImpl->getTensorFormat(tensorName);
4045 }
4046
4056 TensorFormat getTensorFormat(char const* tensorName, int32_t profileIndex) const noexcept
4057 {
4058 return mImpl->getTensorFormatV2(tensorName, profileIndex);
4059 }
4060
4080 char const* getTensorFormatDesc(char const* tensorName) const noexcept
4081 {
4082 return mImpl->getTensorFormatDesc(tensorName);
4083 }
4084
4103 char const* getTensorFormatDesc(char const* tensorName, int32_t profileIndex) const noexcept
4104 {
4105 return mImpl->getTensorFormatDescV2(tensorName, profileIndex);
4106 }
4107
4120 int32_t getTensorVectorizedDim(char const* tensorName) const noexcept
4121 {
4122 return mImpl->getTensorVectorizedDim(tensorName);
4123 }
4124
4136 int32_t getTensorVectorizedDim(char const* tensorName, int32_t profileIndex) const noexcept
4137 {
4138 return mImpl->getTensorVectorizedDimV2(tensorName, profileIndex);
4139 }
4140
4151 char const* getName() const noexcept
4152 {
4153 return mImpl->getName();
4154 }
4155
4162 int32_t getNbOptimizationProfiles() const noexcept
4163 {
4164 return mImpl->getNbOptimizationProfiles();
4165 }
4166
4182 Dims getProfileShape(char const* tensorName, int32_t profileIndex, OptProfileSelector select) const noexcept
4183 {
4184 return mImpl->getProfileShape(tensorName, profileIndex, select);
4185 }
4186
4198 {
4199 return mImpl->getEngineCapability();
4200 }
4201
4216 void setErrorRecorder(IErrorRecorder* recorder) noexcept
4217 {
4218 return mImpl->setErrorRecorder(recorder);
4219 }
4220
4232 {
4233 return mImpl->getErrorRecorder();
4234 }
4235
4248 {
4249 return mImpl->getTacticSources();
4250 }
4251
4260 {
4261 return mImpl->getProfilingVerbosity();
4262 }
4263
4270 {
4271 return mImpl->createEngineInspector();
4272 }
4273
4282 int32_t getNbIOTensors() const noexcept
4283 {
4284 return mImpl->getNbIOTensors();
4285 }
4286
4294 char const* getIOTensorName(int32_t index) const noexcept
4295 {
4296 return mImpl->getIOTensorName(index);
4297 }
4298
4306 {
4307 return mImpl->getHardwareCompatibilityLevel();
4308 }
4309
4320 int32_t getNbAuxStreams() const noexcept
4321 {
4322 return mImpl->getNbAuxStreams();
4323 }
4324
4331 {
4332 return mImpl->createSerializationConfig();
4333 }
4334
4351 {
4352 return mImpl->serializeWithConfig(config);
4353 }
4354
4366 int64_t getStreamableWeightsSize() const noexcept
4367 {
4368 return mImpl->getStreamableWeightsSize();
4369 }
4370
4405 bool setWeightStreamingBudgetV2(int64_t gpuMemoryBudget) noexcept
4406 {
4407 return mImpl->setWeightStreamingBudgetV2(gpuMemoryBudget);
4408 }
4409
4421 int64_t getWeightStreamingBudgetV2() const noexcept
4422 {
4423 return mImpl->getWeightStreamingBudgetV2();
4424 }
4425
4444 int64_t getWeightStreamingAutomaticBudget() const noexcept
4445 {
4446 return mImpl->getWeightStreamingAutomaticBudget();
4447 }
4448
4471 {
4472 return mImpl->getWeightStreamingScratchMemorySize();
4473 }
4474
4484 bool isDebugTensor(char const* name) const noexcept
4485 {
4486 return mImpl->isDebugTensor(name);
4487 }
4488
4507 char const* tensorName, int32_t profileIndex, OptProfileSelector select) const noexcept
4508 {
4509 return mImpl->getProfileTensorValuesV2(tensorName, profileIndex, select);
4510 }
4511
4534 int64_t getEngineStat(EngineStat stat) const noexcept
4535 {
4536 return mImpl->getEngineStat(stat);
4537 }
4538
4546 {
4547 return mImpl->createWeightsManager();
4548 }
4549
4550protected:
4551 apiv::VCudaEngine* mImpl;
4552};
4553
4554inline ICudaEngine::~ICudaEngine() noexcept = default;
4555
4556namespace v_1_0
4557{
4559{
4560public:
4564 InterfaceInfo getInterfaceInfo() const noexcept override
4565 {
4566 return {"IOutputAllocator", 1, 0};
4567 }
4568
4592 [[maybe_unused]] char const* tensorName, [[maybe_unused]] void* currentMemory, [[maybe_unused]] uint64_t size,
4593 [[maybe_unused]] uint64_t alignment, cudaStream_t /* stream */)
4594 {
4595 return nullptr;
4596 }
4597
4606 virtual void notifyShape(char const* tensorName, Dims const& dims) noexcept = 0;
4607};
4608} // namespace v_1_0
4609
4618
4619namespace v_1_0
4620{
4622{
4623public:
4627 InterfaceInfo getInterfaceInfo() const noexcept override
4628 {
4629 return {"IDebugListener", 1, 0};
4630 }
4631
4645 virtual bool processDebugTensor(void const* addr, TensorLocation location, DataType type, Dims const& shape,
4646 char const* name, cudaStream_t stream)
4647 = 0;
4648
4649 ~IDebugListener() override = default;
4650};
4651} // namespace v_1_0
4652
4659
4671{
4672public:
4673 virtual ~IExecutionContext() noexcept = 0;
4674
4683 void setDebugSync(bool sync) noexcept
4684 {
4685 mImpl->setDebugSync(sync);
4686 }
4687
4693 bool getDebugSync() const noexcept
4694 {
4695 return mImpl->getDebugSync();
4696 }
4697
4703 void setProfiler(IProfiler* profiler) noexcept
4704 {
4705 mImpl->setProfiler(profiler);
4706 }
4707
4713 IProfiler* getProfiler() const noexcept
4714 {
4715 return mImpl->getProfiler();
4716 }
4717
4723 ICudaEngine const& getEngine() const noexcept
4724 {
4725 return mImpl->getEngine();
4726 }
4727
4737 void setName(char const* name) noexcept
4738 {
4739 mImpl->setName(name);
4740 }
4741
4747 char const* getName() const noexcept
4748 {
4749 return mImpl->getName();
4750 }
4751
4773 void setDeviceMemory(void* memory) noexcept
4774 {
4775 mImpl->setDeviceMemory(memory);
4776 }
4777
4794 void setDeviceMemoryV2(void* memory, int64_t size) noexcept
4795 {
4796 return mImpl->setDeviceMemoryV2(memory, size);
4797 }
4798
4815 Dims getTensorStrides(char const* tensorName) const noexcept
4816 {
4817 return mImpl->getTensorStrides(tensorName);
4818 }
4819
4820public:
4830 int32_t getOptimizationProfile() const noexcept
4831 {
4832 return mImpl->getOptimizationProfile();
4833 }
4834
4848 bool setInputShape(char const* tensorName, Dims const& dims) noexcept
4849 {
4850 return mImpl->setInputShape(tensorName, dims);
4851 }
4852
4885 Dims getTensorShape(char const* tensorName) const noexcept
4886 {
4887 return mImpl->getTensorShape(tensorName);
4888 }
4889
4901 bool allInputDimensionsSpecified() const noexcept
4902 {
4903 return mImpl->allInputDimensionsSpecified();
4904 }
4905
4920 void setErrorRecorder(IErrorRecorder* recorder) noexcept
4921 {
4922 mImpl->setErrorRecorder(recorder);
4923 }
4924
4936 {
4937 return mImpl->getErrorRecorder();
4938 }
4939
4952 bool executeV2(void* const* bindings) noexcept
4953 {
4954 return mImpl->executeV2(bindings);
4955 }
4956
4996 bool setOptimizationProfileAsync(int32_t profileIndex, cudaStream_t stream) noexcept
4997 {
4998 return mImpl->setOptimizationProfileAsync(profileIndex, stream);
4999 }
5000
5012 void setEnqueueEmitsProfile(bool enqueueEmitsProfile) noexcept
5013 {
5014 mImpl->setEnqueueEmitsProfile(enqueueEmitsProfile);
5015 }
5016
5024 bool getEnqueueEmitsProfile() const noexcept
5025 {
5026 return mImpl->getEnqueueEmitsProfile();
5027 }
5028
5054 bool reportToProfiler() const noexcept
5055 {
5056 return mImpl->reportToProfiler();
5057 }
5058
5098 bool setTensorAddress(char const* tensorName, void* data) noexcept
5099 {
5100 return mImpl->setTensorAddress(tensorName, data);
5101 }
5102
5115 void const* getTensorAddress(char const* tensorName) const noexcept
5116 {
5117 return mImpl->getTensorAddress(tensorName);
5118 }
5119
5138 bool setOutputTensorAddress(char const* tensorName, void* data) noexcept
5139 {
5140 return mImpl->setOutputTensorAddress(tensorName, data);
5141 }
5142
5160 bool setInputTensorAddress(char const* tensorName, void const* data) noexcept
5161 {
5162 return mImpl->setInputTensorAddress(tensorName, data);
5163 }
5164
5179 void* getOutputTensorAddress(char const* tensorName) const noexcept
5180 {
5181 return mImpl->getOutputTensorAddress(tensorName);
5182 }
5183
5212 int32_t inferShapes(int32_t nbMaxNames, char const** tensorNames) noexcept
5213 {
5214 return mImpl->inferShapes(nbMaxNames, tensorNames);
5215 }
5216
5230 {
5231 return mImpl->updateDeviceMemorySizeForShapes();
5232 }
5233
5245 bool setInputConsumedEvent(cudaEvent_t event) noexcept
5246 {
5247 return mImpl->setInputConsumedEvent(event);
5248 }
5249
5255 cudaEvent_t getInputConsumedEvent() const noexcept
5256 {
5257 return mImpl->getInputConsumedEvent();
5258 }
5259
5274 bool setOutputAllocator(char const* tensorName, IOutputAllocator* outputAllocator) noexcept
5275 {
5276 return mImpl->setOutputAllocator(tensorName, outputAllocator);
5277 }
5278
5287 IOutputAllocator* getOutputAllocator(char const* tensorName) const noexcept
5288 {
5289 return mImpl->getOutputAllocator(tensorName);
5290 }
5291
5305 int64_t getMaxOutputSize(char const* tensorName) const noexcept
5306 {
5307 return mImpl->getMaxOutputSize(tensorName);
5308 }
5309
5326 {
5327 return mImpl->setTemporaryStorageAllocator(allocator);
5328 }
5329
5336 {
5337 return mImpl->getTemporaryStorageAllocator();
5338 }
5339
5372 bool enqueueV3(cudaStream_t stream) noexcept
5373 {
5374 return mImpl->enqueueV3(stream);
5375 }
5376
5388 void setPersistentCacheLimit(size_t size) noexcept
5389 {
5390 mImpl->setPersistentCacheLimit(size);
5391 }
5392
5399 size_t getPersistentCacheLimit() const noexcept
5400 {
5401 return mImpl->getPersistentCacheLimit();
5402 }
5403
5423 bool setNvtxVerbosity(ProfilingVerbosity verbosity) noexcept
5424 {
5425 return mImpl->setNvtxVerbosity(verbosity);
5426 }
5427
5436 {
5437 return mImpl->getNvtxVerbosity();
5438 }
5439
5483 void setAuxStreams(cudaStream_t* auxStreams, int32_t nbStreams) noexcept
5484 {
5485 mImpl->setAuxStreams(auxStreams, nbStreams);
5486 }
5487
5495 bool setDebugListener(IDebugListener* listener) noexcept
5496 {
5497 return mImpl->setDebugListener(listener);
5498 }
5499
5506 {
5507 return mImpl->getDebugListener();
5508 }
5509
5524 bool setTensorDebugState(char const* name, bool flag) noexcept
5525 {
5526 return mImpl->setTensorDebugState(name, flag);
5527 }
5528
5536 bool getDebugState(char const* name) const noexcept
5537 {
5538 return mImpl->getDebugState(name);
5539 }
5540
5547 {
5548 return mImpl->getRuntimeConfig();
5549 }
5550
5559 bool setAllTensorsDebugState(bool flag) noexcept
5560 {
5561 return mImpl->setAllTensorsDebugState(flag);
5562 }
5563
5575 bool setUnfusedTensorsDebugState(bool flag) noexcept
5576 {
5577 return mImpl->setUnfusedTensorsDebugState(flag);
5578 }
5579
5585 bool getUnfusedTensorsDebugState() const noexcept
5586 {
5587 return mImpl->getUnfusedTensorsDebugState();
5588 }
5607 bool isStreamCapturable(cudaStream_t stream) const noexcept {
5608 return mImpl->isStreamCapturable(stream);
5609 }
5610
5624 bool setCommunicator(void* communicator) noexcept
5625 {
5626 return mImpl->setCommunicator(communicator);
5627 }
5628
5629protected:
5630 apiv::VExecutionContext* mImpl;
5631}; // class IExecutionContext
5632
5633inline IExecutionContext::~IExecutionContext() noexcept = default;
5634
5642enum class LayerInformationFormat : int32_t
5643{
5644 kONELINE = 0,
5645 kJSON = 1,
5646};
5647
5649template <>
5651{
5652 static constexpr int32_t kVALUE = 2;
5653};
5654
5671{
5672public:
5673 virtual ~IEngineInspector() noexcept = 0;
5674
5687 bool setExecutionContext(IExecutionContext const* context) noexcept
5688 {
5689 return mImpl->setExecutionContext(context);
5690 }
5691
5700 {
5701 return mImpl->getExecutionContext();
5702 }
5703
5724 char const* getLayerInformation(int32_t layerIndex, LayerInformationFormat format) const noexcept
5725 {
5726 return mImpl->getLayerInformation(layerIndex, format);
5727 }
5728
5747 char const* getEngineInformation(LayerInformationFormat format) const noexcept
5748 {
5749 return mImpl->getEngineInformation(format);
5750 }
5751
5766 void setErrorRecorder(IErrorRecorder* recorder) noexcept
5767 {
5768 mImpl->setErrorRecorder(recorder);
5769 }
5770
5782 {
5783 return mImpl->getErrorRecorder();
5784 }
5785
5786protected:
5787 apiv::VEngineInspector* mImpl;
5788}; // class IEngineInspector
5789
5790inline IEngineInspector::~IEngineInspector() noexcept = default;
5791
5792} // namespace nvinfer1
5793
5798extern "C" TENSORRTAPI void* createInferRuntime_INTERNAL(void* logger, int32_t version) noexcept;
5799
5804extern "C" TENSORRTAPI void* createInferRefitter_INTERNAL(void* engine, void* logger, int32_t version) noexcept;
5805
5809extern "C" TENSORRTAPI nvinfer1::IPluginRegistry* getPluginRegistry() noexcept;
5810
5816extern "C" TENSORRTAPI nvinfer1::ILogger* getLogger() noexcept;
5817
5818namespace nvinfer1
5819{
5820namespace // unnamed namespace avoids linkage surprises when linking objects built with different versions of this
5821 // header.
5822{
5828inline IRuntime* createInferRuntime(ILogger& logger) noexcept
5829{
5830 return static_cast<IRuntime*>(createInferRuntime_INTERNAL(&logger, NV_TENSORRT_VERSION));
5831}
5832
5839inline IRefitter* createInferRefitter(ICudaEngine& engine, ILogger& logger) noexcept
5840{
5841 return static_cast<IRefitter*>(createInferRefitter_INTERNAL(&engine, &logger, NV_TENSORRT_VERSION));
5842}
5843
5844} // namespace
5845
5857template <typename T>
5859{
5860public:
5862 {
5863 getPluginRegistry()->registerCreator(instance, "");
5864 }
5865
5866private:
5868 T instance{};
5869};
5870
5871} // namespace nvinfer1
5872
5873#define REGISTER_TENSORRT_PLUGIN(name) \
5874 static nvinfer1::PluginRegistrar<name> pluginRegistrar##name {}
5875
5876namespace nvinfer1
5877{
5880namespace v_1_0
5881{
5891{
5892public:
5896 InterfaceInfo getInterfaceInfo() const noexcept override
5897 {
5898 return {"ILoggerFinder", 1, 0};
5899 }
5900
5908 virtual ILogger* findLogger() = 0;
5909
5910protected:
5912 ~ILoggerFinder() override = default;
5913};
5914
5915} // namespace v_1_0
5916
5918
5921namespace v_1_0
5922{
5923
5925{
5926public:
5928 ~IGpuAsyncAllocator() override = default;
5929
5959 void* allocateAsync(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags,
5960 cudaStream_t /*stream*/) noexcept override = 0;
5961
5987 bool deallocateAsync(void* const memory, cudaStream_t /*stream*/) noexcept override = 0;
5988
6013 uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept override
6014 {
6015 return allocateAsync(size, alignment, flags, nullptr);
6016 }
6017
6036 TRT_DEPRECATED bool deallocate(void* const memory) noexcept override
6037 {
6038 return deallocateAsync(memory, nullptr);
6039 }
6040
6044 InterfaceInfo getInterfaceInfo() const noexcept override
6045 {
6046 return {"IGpuAllocator", 1, 0};
6047 }
6048};
6049
6051{
6052public:
6056 InterfaceInfo getInterfaceInfo() const noexcept override
6057 {
6058 return InterfaceInfo{"PLUGIN CREATOR_V3ONE", 1, 0};
6059 }
6060
6078 AsciiChar const* name, PluginFieldCollection const* fc, TensorRTPhase phase) noexcept = 0;
6079
6086 virtual PluginFieldCollection const* getFieldNames() noexcept = 0;
6087
6094 virtual AsciiChar const* getPluginName() const noexcept = 0;
6095
6102 virtual AsciiChar const* getPluginVersion() const noexcept = 0;
6103
6110 virtual AsciiChar const* getPluginNamespace() const noexcept = 0;
6111
6113 virtual ~IPluginCreatorV3One() = default;
6114
6115protected:
6118 IPluginCreatorV3One& operator=(IPluginCreatorV3One const&) & = default;
6119 IPluginCreatorV3One& operator=(IPluginCreatorV3One&&) & = default;
6120};
6121
6122} // namespace v_1_0
6123
6138
6148
6149} // namespace nvinfer1
6150
6154extern "C" TENSORRTAPI int32_t getInferLibMajorVersion() noexcept;
6158extern "C" TENSORRTAPI int32_t getInferLibMinorVersion() noexcept;
6162extern "C" TENSORRTAPI int32_t getInferLibPatchVersion() noexcept;
6166extern "C" TENSORRTAPI int32_t getInferLibBuildVersion() noexcept;
6167
6168#endif // NV_INFER_RUNTIME_H
TENSORRTAPI nvinfer1::IPluginRegistry * getPluginRegistry() noexcept
Return the plugin registry.
TENSORRTAPI nvinfer1::ILogger * getLogger() noexcept
Return the logger object.
TENSORRTAPI int32_t getInferLibMinorVersion() noexcept
Return the library minor version number.
TENSORRTAPI int32_t getInferLibMajorVersion() noexcept
Return the library major version number.
TENSORRTAPI int32_t getInferLibPatchVersion() noexcept
Return the library patch version number.
TENSORRTAPI int32_t getInferLibBuildVersion() noexcept
Return the library build version number.
#define TENSORRTAPI
Definition: NvInferRuntimeBase.h:70
#define NV_TENSORRT_VERSION
Definition: NvInferRuntimeBase.h:102
#define TRT_NODISCARD
A stand-in for [[nodiscard]] and [[nodiscard(REASON)]] that works with older compilers.
Definition: NvInferRuntimeBase.h:57
#define TRT_DEPRECATED
Definition: NvInferRuntimeBase.h:42
Structure to define the dimensions of a tensor.
Definition: NvInferRuntimeBase.h:224
static constexpr int32_t MAX_DIMS
The maximum rank (number of dimensions) supported for a tensor.
Definition: NvInferRuntimeBase.h:227
Analog of class Dims with expressions instead of constants for the dimensions.
Definition: NvInferRuntime.h:361
int32_t nbDims
The number of dimensions.
Definition: NvInferRuntime.h:363
An engine for executing inference on a built network, with functionally unsafe features.
Definition: NvInferRuntime.h:3621
int32_t getTensorBytesPerComponent(char const *tensorName) const noexcept
Return the number of bytes per component of an element, or -1 if the tensor is not vectorized or prov...
Definition: NvInferRuntime.h:3970
ISerializationConfig * createSerializationConfig() noexcept
Create a serialization configuration object.
Definition: NvInferRuntime.h:4330
char const * getIOTensorName(int32_t index) const noexcept
Return name of an IO tensor.
Definition: NvInferRuntime.h:4294
int64_t getWeightStreamingBudgetV2() const noexcept
Returns the current weight streaming device memory budget in bytes.
Definition: NvInferRuntime.h:4421
EngineCapability getEngineCapability() const noexcept
Determine what execution capability this engine has.
Definition: NvInferRuntime.h:4197
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:4231
TensorFormat getTensorFormat(char const *tensorName, int32_t profileIndex) const noexcept
Return the tensor format of given profile, or TensorFormat::kLINEAR if the provided name does not map...
Definition: NvInferRuntime.h:4056
int64_t const * getProfileTensorValuesV2(char const *tensorName, int32_t profileIndex, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum values (not dimensions) for an input tensor given its name under ...
Definition: NvInferRuntime.h:4506
TRT_NODISCARD bool areWeightsLoaded() const noexcept
Check whether the engine's weights have been loaded onto the GPU.
Definition: NvInferRuntime.h:3807
apiv::VCudaEngine * mImpl
Definition: NvInferRuntime.h:4551
IExecutionContext * createExecutionContext(ExecutionContextAllocationStrategy strategy=ExecutionContextAllocationStrategy::kSTATIC) noexcept
Create an execution context and specify the strategy for allocating internal activation memory.
Definition: NvInferRuntime.h:3695
char const * getTensorFormatDesc(char const *tensorName) const noexcept
Return the human readable description of the tensor format, or empty string if the provided name does...
Definition: NvInferRuntime.h:4080
Dims getProfileShape(char const *tensorName, int32_t profileIndex, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum dimensions for an input tensor given its name under an optimizati...
Definition: NvInferRuntime.h:4182
bool setWeightStreamingBudgetV2(int64_t gpuMemoryBudget) noexcept
Limit the maximum amount of GPU memory usable for network weights in bytes.
Definition: NvInferRuntime.h:4405
IExecutionContext * createExecutionContext(IRuntimeConfig *runtimeConfig) noexcept
Create an execution context with TensorRT JIT runtime config.
Definition: NvInferRuntime.h:3778
TRT_NODISCARD bool unloadWeights() noexcept
Free the GPU weights of a deferred-loading engine and revert it to the pre-load state.
Definition: NvInferRuntime.h:3911
int32_t getNbAuxStreams() const noexcept
Return the number of auxiliary streams used by this engine.
Definition: NvInferRuntime.h:4320
int64_t getStreamableWeightsSize() const noexcept
Get the total size in bytes of all streamable weights.
Definition: NvInferRuntime.h:4366
DataType getTensorDataType(char const *tensorName) const noexcept
Determine the required data type for a buffer from its tensor name.
Definition: NvInferRuntime.h:3650
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:4216
TacticSources getTacticSources() const noexcept
return the tactic sources required by this engine.
Definition: NvInferRuntime.h:4247
TRT_NODISCARD char const * getAliasedInputTensor(char const *tensorName) const noexcept
Get the input tensor name that an output tensor should alias with.
Definition: NvInferRuntime.h:3766
IHostMemory * serializeWithConfig(ISerializationConfig &config) const noexcept
Serialize the network to a stream with the provided SerializationConfig.
Definition: NvInferRuntime.h:4350
int64_t getWeightStreamingAutomaticBudget() const noexcept
TensorRT automatically determines a device memory budget for the model to run. The budget is close to...
Definition: NvInferRuntime.h:4444
bool isDebugTensor(char const *name) const noexcept
Check if a tensor is marked as a debug tensor.
Definition: NvInferRuntime.h:4484
TRT_NODISCARD IWeightsManager * createWeightsManager() noexcept
Create a weights manager for the engine.
Definition: NvInferRuntime.h:4545
int32_t getTensorVectorizedDim(char const *tensorName, int32_t profileIndex) const noexcept
Return the dimension index that the buffer is vectorized of given profile, or -1 if the provided name...
Definition: NvInferRuntime.h:4136
TRT_NODISCARD bool loadWeightsAsync(IStreamReaderV2 &streamReader, cudaStream_t stream) noexcept
Asynchronously copy weights from a stream to the GPU.
Definition: NvInferRuntime.h:3885
char const * getName() const noexcept
Returns the name of the network associated with the engine.
Definition: NvInferRuntime.h:4151
ProfilingVerbosity getProfilingVerbosity() const noexcept
Return the ProfilingVerbosity the builder config was set to when the engine was built.
Definition: NvInferRuntime.h:4259
bool isShapeInferenceIO(char const *tensorName) const noexcept
True if tensor is required as input for shape calculations or is output from shape calculations.
Definition: NvInferRuntime.h:3733
int64_t getWeightStreamingScratchMemorySize() const noexcept
Returns the size of the scratch memory required by the current weight streaming budget.
Definition: NvInferRuntime.h:4470
int64_t getDeviceMemorySizeV2() const noexcept
Return the maximum device memory required by the context over all profiles.
Definition: NvInferRuntime.h:3925
int32_t getTensorVectorizedDim(char const *tensorName) const noexcept
Return the dimension index that the buffer is vectorized, or -1 if the provided name does not map to ...
Definition: NvInferRuntime.h:4120
int32_t getTensorComponentsPerElement(char const *tensorName, int32_t profileIndex) const noexcept
Return the number of components included in one element of given profile, or -1 if tensor is not vect...
Definition: NvInferRuntime.h:4027
int64_t getDeviceMemorySizeForProfileV2(int32_t profileIndex) const noexcept
Return the maximum device memory required by the context for a profile.
Definition: NvInferRuntime.h:3939
IRuntimeConfig * createRuntimeConfig() noexcept
Create a runtime config for TensorRT JIT. The caller is responsible for ownership of the returned IRu...
Definition: NvInferRuntime.h:3791
TensorFormat getTensorFormat(char const *tensorName) const noexcept
Return the tensor format, or TensorFormat::kLINEAR if the provided name does not map to an input or o...
Definition: NvInferRuntime.h:4042
IHostMemory * serialize() const noexcept
Serialize the network to a stream.
Definition: NvInferRuntime.h:3678
int64_t getEngineStat(EngineStat stat) const noexcept
Get engine statistics according to the given enum value.
Definition: NvInferRuntime.h:4534
TensorLocation getTensorLocation(char const *tensorName) const noexcept
Get whether an input or output tensor must be on GPU or CPU.
Definition: NvInferRuntime.h:3713
IEngineInspector * createEngineInspector() const noexcept
Create a new engine inspector which prints the layer information in an engine or an execution context...
Definition: NvInferRuntime.h:4269
int32_t getTensorBytesPerComponent(char const *tensorName, int32_t profileIndex) const noexcept
Return the number of bytes per component of an element given of given profile, or -1 if the tensor is...
Definition: NvInferRuntime.h:3988
HardwareCompatibilityLevel getHardwareCompatibilityLevel() const noexcept
Return the hardware compatibility level of this engine.
Definition: NvInferRuntime.h:4305
int32_t getNbOptimizationProfiles() const noexcept
Get the number of optimization profiles defined for this engine.
Definition: NvInferRuntime.h:4162
char const * getTensorFormatDesc(char const *tensorName, int32_t profileIndex) const noexcept
Return the human readable description of the tensor format of given profile, or empty string if the p...
Definition: NvInferRuntime.h:4103
TensorIOMode getTensorIOMode(char const *tensorName) const noexcept
Determine whether a tensor is an input or output tensor.
Definition: NvInferRuntime.h:3747
int32_t getNbLayers() const noexcept
Get the number of layers in the network.
Definition: NvInferRuntime.h:3664
TRT_NODISCARD bool loadWeights(void const *blob, int64_t size) noexcept
Synchronously copy weights from the engine plan blob to the GPU.
Definition: NvInferRuntime.h:3834
int32_t getNbIOTensors() const noexcept
Return number of IO tensors.
Definition: NvInferRuntime.h:4282
virtual ~ICudaEngine() noexcept=0
int32_t getTensorComponentsPerElement(char const *tensorName) const noexcept
Return the number of components included in one element, or -1 if tensor is not vectorized or if the ...
Definition: NvInferRuntime.h:4009
bool isRefittable() const noexcept
Return true if an engine can be refit.
Definition: NvInferRuntime.h:3949
An IDimensionExpr represents an integer expression constructed from constants, input dimensions,...
Definition: NvInferRuntime.h:239
bool isConstant() const noexcept
Return true if expression is a build-time constant.
Definition: NvInferRuntime.h:244
bool isSizeTensor() const noexcept
Return true if this denotes the value of a size tensor.
Definition: NvInferRuntime.h:270
virtual ~IDimensionExpr() noexcept=0
apiv::VDimensionExpr * mImpl
Definition: NvInferRuntime.h:261
int64_t getConstantValue() const noexcept
Get the value of the constant.
Definition: NvInferRuntime.h:255
An engine inspector which prints out the layer information of an engine or an execution context.
Definition: NvInferRuntime.h:5671
char 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:5724
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:5781
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:5766
virtual ~IEngineInspector() noexcept=0
IExecutionContext const * getExecutionContext() const noexcept
Get the context currently being inspected.
Definition: NvInferRuntime.h:5699
apiv::VEngineInspector * mImpl
Definition: NvInferRuntime.h:5787
char 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:5747
Context for executing inference using an engine, with functionally unsafe features.
Definition: NvInferRuntime.h:4671
IOutputAllocator * getOutputAllocator(char const *tensorName) const noexcept
Get output allocator associated with output tensor of given name, or nullptr if the provided name doe...
Definition: NvInferRuntime.h:5287
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:4935
bool reportToProfiler() const noexcept
Calculate layer timing info for the current optimization profile in IExecutionContext and update the ...
Definition: NvInferRuntime.h:5054
void setDeviceMemory(void *memory) noexcept
Set the device memory for use by this execution context.
Definition: NvInferRuntime.h:4773
bool setTensorDebugState(char const *name, bool flag) noexcept
Set debug state of tensor given the tensor name.
Definition: NvInferRuntime.h:5524
char const * getName() const noexcept
Return the name of the execution context.
Definition: NvInferRuntime.h:4747
IGpuAllocator * getTemporaryStorageAllocator() const noexcept
Get allocator set by setTemporaryStorageAllocator.
Definition: NvInferRuntime.h:5335
void setEnqueueEmitsProfile(bool enqueueEmitsProfile) noexcept
Set whether enqueue emits layer timing to the profiler.
Definition: NvInferRuntime.h:5012
bool setUnfusedTensorsDebugState(bool flag) noexcept
Turn the debug state of unfused tensors on or off.
Definition: NvInferRuntime.h:5575
Dims getTensorShape(char const *tensorName) const noexcept
Return the shape of the given input or output.
Definition: NvInferRuntime.h:4885
bool getDebugState(char const *name) const noexcept
Get the debug state.
Definition: NvInferRuntime.h:5536
bool setInputShape(char const *tensorName, Dims const &dims) noexcept
Set shape of given input.
Definition: NvInferRuntime.h:4848
bool executeV2(void *const *bindings) noexcept
Synchronously execute a network.
Definition: NvInferRuntime.h:4952
bool getEnqueueEmitsProfile() const noexcept
Get the enqueueEmitsProfile state.
Definition: NvInferRuntime.h:5024
void const * getTensorAddress(char const *tensorName) const noexcept
Get memory address bound to given input or output tensor, or nullptr if the provided name does not ma...
Definition: NvInferRuntime.h:5115
bool setOutputAllocator(char const *tensorName, IOutputAllocator *outputAllocator) noexcept
Set output allocator to use for output tensor of given name. Pass nullptr to outputAllocator to unset...
Definition: NvInferRuntime.h:5274
bool setOptimizationProfileAsync(int32_t profileIndex, cudaStream_t stream) noexcept
Select an optimization profile for the current context with async semantics.
Definition: NvInferRuntime.h:4996
bool isStreamCapturable(cudaStream_t stream) const noexcept
Check if a subsequent call to enqueueV3 is graph-capturable on the provided stream.
Definition: NvInferRuntime.h:5607
apiv::VExecutionContext * mImpl
Definition: NvInferRuntime.h:5630
bool setOutputTensorAddress(char const *tensorName, void *data) noexcept
Set the memory address for a given output tensor.
Definition: NvInferRuntime.h:5138
void setPersistentCacheLimit(size_t size) noexcept
Set the maximum size for persistent cache usage.
Definition: NvInferRuntime.h:5388
virtual ~IExecutionContext() noexcept=0
size_t getPersistentCacheLimit() const noexcept
Get the maximum size for persistent cache usage.
Definition: NvInferRuntime.h:5399
bool setAllTensorsDebugState(bool flag) noexcept
Turn the debug state of all debug tensors on or off.
Definition: NvInferRuntime.h:5559
ICudaEngine const & getEngine() const noexcept
Get the associated engine.
Definition: NvInferRuntime.h:4723
ProfilingVerbosity getNvtxVerbosity() const noexcept
Get the NVTX verbosity of the execution context.
Definition: NvInferRuntime.h:5435
size_t updateDeviceMemorySizeForShapes() noexcept
Recompute the internal activation buffer sizes based on the current input shapes, and return the tota...
Definition: NvInferRuntime.h:5229
void setAuxStreams(cudaStream_t *auxStreams, int32_t nbStreams) noexcept
Set the auxiliary streams that TensorRT should launch kernels on in the next enqueueV3() call.
Definition: NvInferRuntime.h:5483
int64_t getMaxOutputSize(char const *tensorName) const noexcept
Get upper bound on an output tensor's size, in bytes, based on the current optimization profile and i...
Definition: NvInferRuntime.h:5305
int32_t inferShapes(int32_t nbMaxNames, char const **tensorNames) noexcept
Run shape calculations.
Definition: NvInferRuntime.h:5212
bool setDebugListener(IDebugListener *listener) noexcept
Set DebugListener for this execution context.
Definition: NvInferRuntime.h:5495
bool setTensorAddress(char const *tensorName, void *data) noexcept
Set memory address for given input or output tensor.
Definition: NvInferRuntime.h:5098
bool setTemporaryStorageAllocator(IGpuAllocator *allocator) noexcept
Specify allocator to use for internal temporary storage.
Definition: NvInferRuntime.h:5325
void * getOutputTensorAddress(char const *tensorName) const noexcept
Get memory address for given output.
Definition: NvInferRuntime.h:5179
bool enqueueV3(cudaStream_t stream) noexcept
Enqueue inference on a stream.
Definition: NvInferRuntime.h:5372
IDebugListener * getDebugListener() noexcept
Get the DebugListener of this execution context.
Definition: NvInferRuntime.h:5505
int32_t getOptimizationProfile() const noexcept
Get the index of the currently selected optimization profile.
Definition: NvInferRuntime.h:4830
bool setInputTensorAddress(char const *tensorName, void const *data) noexcept
Set memory address for given input.
Definition: NvInferRuntime.h:5160
bool getDebugSync() const noexcept
Get the debug sync flag.
Definition: NvInferRuntime.h:4693
bool setInputConsumedEvent(cudaEvent_t event) noexcept
Mark input as consumed.
Definition: NvInferRuntime.h:5245
Dims getTensorStrides(char const *tensorName) const noexcept
Return the strides of the buffer for the given tensor name.
Definition: NvInferRuntime.h:4815
bool setNvtxVerbosity(ProfilingVerbosity verbosity) noexcept
Set the verbosity of the NVTX markers in the execution context.
Definition: NvInferRuntime.h:5423
IProfiler * getProfiler() const noexcept
Get the profiler.
Definition: NvInferRuntime.h:4713
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:4920
bool setCommunicator(void *communicator) noexcept
Set the NCCL communicator for the execution context.
Definition: NvInferRuntime.h:5624
void setDeviceMemoryV2(void *memory, int64_t size) noexcept
Set the device memory and its corresponding size for use by this execution context.
Definition: NvInferRuntime.h:4794
bool allInputDimensionsSpecified() const noexcept
Whether all dynamic dimensions of input tensors have been specified.
Definition: NvInferRuntime.h:4901
bool getUnfusedTensorsDebugState() const noexcept
Get the debug state of unfused tensors.
Definition: NvInferRuntime.h:5585
void setProfiler(IProfiler *profiler) noexcept
Set the profiler.
Definition: NvInferRuntime.h:4703
void setName(char const *name) noexcept
Set the name of the execution context.
Definition: NvInferRuntime.h:4737
cudaEvent_t getInputConsumedEvent() const noexcept
The event associated with consuming the input.
Definition: NvInferRuntime.h:5255
IRuntimeConfig * getRuntimeConfig() const noexcept
Get the runtime config object used during execution context creation.
Definition: NvInferRuntime.h:5546
Object for constructing IDimensionExpr.
Definition: NvInferRuntime.h:296
IDimensionExpr const * operation(DimensionOperation op, IDimensionExpr const &first, IDimensionExpr const &second) noexcept
Get the operation.
Definition: NvInferRuntime.h:312
IDimensionExpr const * constant(int64_t value) noexcept
Return pointer to IDimensionExpr for given value.
Definition: NvInferRuntime.h:301
apiv::VExprBuilder * mImpl
Definition: NvInferRuntime.h:319
virtual ~IExprBuilder() noexcept=0
Class to handle library allocated memory that is accessible to the user.
Definition: NvInferRuntime.h:150
void * data() const noexcept
A pointer to the raw data that is owned by the library.
Definition: NvInferRuntime.h:155
virtual ~IHostMemory() noexcept=0
DataType type() const noexcept
The type of the memory that was allocated.
Definition: NvInferRuntime.h:167
std::size_t size() const noexcept
The size in bytes of the data that was allocated.
Definition: NvInferRuntime.h:161
apiv::VHostMemory * mImpl
Definition: NvInferRuntime.h:173
Forward declaration of IEngineInspector for use by other interfaces.
Definition: NvInferRuntime.h:51
INoCopy & operator=(INoCopy &&other)=delete
INoCopy(INoCopy const &other)=delete
INoCopy(INoCopy &&other)=delete
virtual ~INoCopy()=default
INoCopy & operator=(INoCopy const &other)=delete
Optimization profile for dynamic input dimensions and shape tensors.
Definition: NvInferRuntime.h:2792
apiv::VOptimizationProfile * mImpl
Definition: NvInferRuntime.h:2997
Dims getDimensions(char const *inputName, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum dimensions for a dynamic input tensor.
Definition: NvInferRuntime.h:2833
float getExtraMemoryTarget() const noexcept
Get the extra memory target that has been defined for this profile.
Definition: NvInferRuntime.h:2876
cudaStream_t getProfileStream() const noexcept
Get the CUDA stream set for this optimization profile.
Definition: NvInferRuntime.h:2991
bool setExtraMemoryTarget(float target) noexcept
Set a target for extra GPU memory that may be used by this profile.
Definition: NvInferRuntime.h:2864
bool setDimensions(char const *inputName, OptProfileSelector select, Dims const &dims) noexcept
Set the minimum / optimum / maximum dimensions for a dynamic input tensor.
Definition: NvInferRuntime.h:2821
virtual ~IOptimizationProfile() noexcept=0
void setProfileStream(cudaStream_t stream) noexcept
Set the CUDA stream that is used to profile this optimization profile.
Definition: NvInferRuntime.h:2979
bool isValid() const noexcept
Check whether the optimization profile can be passed to an IBuilderConfig object.
Definition: NvInferRuntime.h:2893
int64_t const * getShapeValuesV2(char const *inputName, OptProfileSelector select) const noexcept
Get the minimum / optimum / maximum values for an input shape tensor.
Definition: NvInferRuntime.h:2953
bool setShapeValuesV2(char const *inputName, OptProfileSelector select, int64_t const *values, int32_t nbValues) noexcept
Set the minimum / optimum / maximum values for an input shape tensor.
Definition: NvInferRuntime.h:2940
int32_t getNbShapeValues(char const *inputName) const noexcept
Get the number of values for an input shape tensor.
Definition: NvInferRuntime.h:2846
Single registration point for all plugins in an application. It is used to find plugin implementation...
Definition: NvInferRuntimeCommon.h:56
virtual bool registerCreator(IPluginCreatorInterface &creator, AsciiChar const *const pluginNamespace) noexcept=0
Register a plugin creator. Returns false if a plugin creator with the same type is already registered...
Interface for plugins to access per context resources provided by TensorRT.
Definition: NvInferRuntime.h:803
virtual IErrorRecorder * getErrorRecorder() const noexcept=0
Get the error recorder associated with the resource context.
IPluginResourceContext & operator=(IPluginResourceContext const &) &=default
virtual IGpuAllocator * getGpuAllocator() const noexcept=0
Get the GPU allocator associated with the resource context.
Similar to IPluginV2Ext, but with support for dynamic shapes.
Definition: NvInferRuntime.h:418
IPluginV2DynamicExt * clone() const noexcept override=0
Clone the plugin object. This copies over internal plugin parameters as well and returns a new plugin...
virtual ~IPluginV2DynamicExt() noexcept
Definition: NvInferRuntime.h:567
Plugin class for user-implemented layers.
Definition: NvInferRuntimePlugin.h:474
Updates weights in an engine.
Definition: NvInferRuntime.h:2363
bool refitCudaEngineAsync(cudaStream_t stream) noexcept
Enqueue weights refitting of the associated engine on the given stream.
Definition: NvInferRuntime.h:2702
int32_t getMaxThreads() const noexcept
get the maximum number of threads that can be used by the refitter.
Definition: NvInferRuntime.h:2572
TensorLocation getWeightsLocation(char const *weightsName) const noexcept
Get location for the weights associated with the given name.
Definition: NvInferRuntime.h:2631
bool setNamedWeights(char const *name, Weights weights) noexcept
Specify new weights of given name.
Definition: NvInferRuntime.h:2496
bool releaseRefitResources() noexcept
Release resources cached for the engine associated with this refitter.
Definition: NvInferRuntime.h:2734
int32_t getAllWeights(int32_t size, char const **weightsNames) noexcept
Get names of all weights that could be refit.
Definition: NvInferRuntime.h:2532
virtual ~IRefitter() noexcept=0
ILogger * getLogger() const noexcept
get the logger with which the refitter was created
Definition: NvInferRuntime.h:2542
bool refitCudaEngine() noexcept
Refits associated engine.
Definition: NvInferRuntime.h:2399
int32_t getMissingWeights(int32_t size, char const **weightsNames) noexcept
Get names of missing weights.
Definition: NvInferRuntime.h:2516
int32_t getMissing(int32_t size, char const **layerNames, WeightsRole *roles) noexcept
Get description of missing weights.
Definition: NvInferRuntime.h:2420
Weights getNamedWeights(char const *weightsName) const noexcept
Get weights associated with the given name.
Definition: NvInferRuntime.h:2615
bool unsetNamedWeights(char const *weightsName) noexcept
Unset weights associated with the given name.
Definition: NvInferRuntime.h:2647
Weights getWeightsPrototype(char const *weightsName) const noexcept
Get the Weights prototype associated with the given name.
Definition: NvInferRuntime.h:2720
bool setMaxThreads(int32_t maxThreads) noexcept
Set the maximum number of threads.
Definition: NvInferRuntime.h:2558
bool setNamedWeights(char const *name, Weights weights, TensorLocation location) noexcept
Specify new weights on a specified device of given name.
Definition: NvInferRuntime.h:2599
void setWeightsValidation(bool weightsValidation) noexcept
Set whether to validate weights during refitting.
Definition: NvInferRuntime.h:2663
apiv::VRefitter * mImpl
Definition: NvInferRuntime.h:2740
int32_t getAll(int32_t size, char const **layerNames, WeightsRole *roles) noexcept
Get description of all weights that could be refit.
Definition: NvInferRuntime.h:2437
bool getWeightsValidation() const noexcept
Get whether to validate weights values during refitting.
Definition: NvInferRuntime.h:2671
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:2456
IErrorRecorder * getErrorRecorder() const noexcept
Get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:2471
A class for Runtime cache currently used for TensorRT JIT compilation. This cache can be serialized a...
Definition: NvInferRuntime.h:3205
bool deserialize(void const *blob, size_t size) noexcept
Deserialize the Runtime cache from a buffer that contains a serialized Runtime cache.
Definition: NvInferRuntime.h:3237
bool reset() noexcept
Reset the Runtime cache. Clears all content within the cache.
Definition: NvInferRuntime.h:3245
apiv::VRuntimeCache * mImpl
Definition: NvInferRuntime.h:3251
virtual ~IRuntimeCache() noexcept=0
A class for runtime configuration. This class is used during execution context creation.
Definition: NvInferRuntime.h:3335
bool setCudaGraphStrategy(CudaGraphStrategy strategy) noexcept
Set the strategy used for CUDA graphs for JIT (Just-In-Time) inference. Default is kDISABLED.
Definition: NvInferRuntime.h:3429
DynamicShapesKernelSpecializationStrategy getDynamicShapesKernelSpecializationStrategy() const noexcept
Return the dynamic shape specialization strategy of this config.
Definition: NvInferRuntime.h:3405
apiv::VRuntimeConfig * mImpl
Definition: NvInferRuntime.h:3445
IRuntimeCache * createRuntimeCache() const noexcept
Create an empty Runtime cache.
Definition: NvInferRuntime.h:3364
virtual ~IRuntimeConfig() noexcept=0
ExecutionContextAllocationStrategy getExecutionContextAllocationStrategy() const noexcept
Get the execution context allocation strategy.
Definition: NvInferRuntime.h:3354
bool setRuntimeCache(IRuntimeCache const &cache) noexcept
Set Runtime cache to the runtime config. Enables Runtime caching.
Definition: NvInferRuntime.h:3374
void setDynamicShapesKernelSpecializationStrategy(DynamicShapesKernelSpecializationStrategy dynamicShapesKernelSpecializationStrategy) noexcept
Set the dynamic shape kernel specialization strategy for this config.
Definition: NvInferRuntime.h:3394
IRuntimeCache * getRuntimeCache() const noexcept
Get the Runtime cache from the runtime config.
Definition: NvInferRuntime.h:3384
CudaGraphStrategy getCudaGraphStrategy() const noexcept
Return the strategy used for CUDA graphs for JIT (Just-In-Time) inference.
Definition: NvInferRuntime.h:3439
Allows a serialized functionally unsafe engine to be deserialized.
Definition: NvInferRuntime.h:1953
bool setMaxThreads(int32_t maxThreads) noexcept
Set the maximum number of threads.
Definition: NvInferRuntime.h:2132
IRuntime * loadRuntime(char const *path) noexcept
Load IRuntime from the file.
Definition: NvInferRuntime.h:2248
bool getEngineHostCodeAllowed() const noexcept
Get whether the runtime is allowed to deserialize engines with host executable code.
Definition: NvInferRuntime.h:2270
int64_t getEngineHeaderSize() const noexcept
Get size of engine header in bytes.
Definition: NvInferRuntime.h:2282
TempfileControlFlags getTempfileControlFlags() const noexcept
Get the tempfile control flags for this runtime.
Definition: NvInferRuntime.h:2220
void setEngineHostCodeAllowed(bool allowed) noexcept
Set whether the runtime is allowed to deserialize engines with host executable code.
Definition: NvInferRuntime.h:2260
void setTemporaryDirectory(char const *path) noexcept
Set the directory that will be used by this runtime for temporary files.
Definition: NvInferRuntime.h:2181
bool setDLAWorkspaceAllocationStrategy(DLAWorkspaceAllocationStrategy strategy) noexcept
Sets the strategy used for DLA workspace allocation by subsequent engine deserializations.
Definition: NvInferRuntime.h:2006
IPluginRegistry & getPluginRegistry() noexcept
Get the local plugin registry that can be used by the runtime.
Definition: NvInferRuntime.h:2230
TRT_NODISCARD DLAWorkspaceAllocationStrategy getDLAWorkspaceAllocationStrategy() const noexcept
Returns the DLA workspace allocation strategy used for subsequent engine deserializations.
Definition: NvInferRuntime.h:2016
int32_t getNbDLACores() const noexcept
Returns number of DLA hardware cores accessible or 0 if DLA is unavailable.
Definition: NvInferRuntime.h:1989
EngineValidity getEngineValidity(void const *blob, int64_t blobSize, uint64_t *diagnostics) const noexcept
Check for engine validity by inspecting the serialized engine header.
Definition: NvInferRuntime.h:2310
ICudaEngine * deserializeCudaEngine(void const *blob, std::size_t size) noexcept
Deserialize an engine from host memory.
Definition: NvInferRuntime.h:2084
virtual ~IRuntime() noexcept=0
void setTempfileControlFlags(TempfileControlFlags flags) noexcept
Set the tempfile control flags for this runtime.
Definition: NvInferRuntime.h:2208
int32_t getDLACore() const noexcept
Get the DLA core that the engine executes on.
Definition: NvInferRuntime.h:1981
void setGpuAllocator(IGpuAllocator *allocator) noexcept
Set the GPU allocator.
Definition: NvInferRuntime.h:2032
IErrorRecorder * getErrorRecorder() const noexcept
get the ErrorRecorder assigned to this interface.
Definition: NvInferRuntime.h:2066
ICudaEngine * deserializeCudaEngine(IStreamReaderV2 &streamReader)
Deserialize an engine from a stream. IStreamReaderV2 is expected to support reading to both host and ...
Definition: NvInferRuntime.h:2107
ILogger * getLogger() const noexcept
get the logger with which the runtime was created
Definition: NvInferRuntime.h:2117
int32_t getMaxThreads() const noexcept
Get the maximum number of threads that can be used by the runtime.
Definition: NvInferRuntime.h:2146
TRT_NODISCARD bool getDeferredWeightsLoading() const noexcept
Get the deferred-weight-loading flag.
Definition: NvInferRuntime.h:2343
char const * getTemporaryDirectory() const noexcept
Get the directory that will be used by this runtime for temporary files.
Definition: NvInferRuntime.h:2192
void setDeferredWeightsLoading(bool defer) noexcept
Defer GPU weight allocation during deserializeCudaEngine().
Definition: NvInferRuntime.h:2335
void setErrorRecorder(IErrorRecorder *recorder) noexcept
Set the ErrorRecorder for this interface.
Definition: NvInferRuntime.h:2051
Holds properties for configuring an engine to serialize the binary.
Definition: NvInferRuntime.h:3097
bool clearFlag(SerializationFlag serializationFlag) noexcept
clear a serialization flag.
Definition: NvInferRuntime.h:3136
virtual ~ISerializationConfig() noexcept=0
bool setFlag(SerializationFlag serializationFlag) noexcept
Set a serialization flag.
Definition: NvInferRuntime.h:3148
SerializationFlags getFlags() const noexcept
Get the serialization flags for this config.
Definition: NvInferRuntime.h:3124
bool getFlag(SerializationFlag serializationFlag) const noexcept
Returns true if the serialization flag is set.
Definition: NvInferRuntime.h:3160
apiv::VSerializationConfig * mImpl
Definition: NvInferRuntime.h:3166
An Interface class for version control.
Definition: NvInferRuntimeBase.h:284
Manages the saved and loaded weights of a weight-stripped engine.
Definition: NvInferRuntime.h:3464
TRT_NODISCARD bool unload(cudaStream_t stream) noexcept
Unload the engine weights while preserving their virtual address range.
Definition: NvInferRuntime.h:3529
TRT_NODISCARD bool restoreFromVmmAllocation(uint64_t allocationHandle, int64_t offset, int64_t size, cudaStream_t stream) noexcept
Restore a range of engine weights by mapping an application CUDA VMM allocation.
Definition: NvInferRuntime.h:3577
TRT_NODISCARD bool saveToStream(IStreamWriter &writer, cudaStream_t stream) noexcept
Save the engine weights to an application stream.
Definition: NvInferRuntime.h:3510
TRT_NODISCARD bool restoreFromBuffer(void const *src, int64_t srcSize, TensorLocation location, cudaStream_t stream) noexcept
Restore the engine weights by copying from an application buffer.
Definition: NvInferRuntime.h:3547
apiv::VWeightsManager * mImpl
Definition: NvInferRuntime.h:3584
TRT_NODISCARD bool saveToBuffer(void *dst, int64_t dstSize, TensorLocation location, cudaStream_t stream) noexcept
Save the engine weights to an application buffer.
Definition: NvInferRuntime.h:3491
virtual ~IWeightsManager() noexcept=0
Version information associated with a TRT interface.
Definition: NvInferRuntimeBase.h:249
Register the plugin creator to the registry The static registry object will be instantiated when the ...
Definition: NvInferRuntime.h:5859
PluginRegistrar()
Definition: NvInferRuntime.h:5861
An array of weights used as a layer parameter.
Definition: NvInferRuntime.h:132
DataType type
The type of the weights.
Definition: NvInferRuntime.h:134
int64_t count
The number of weights in the array.
Definition: NvInferRuntime.h:136
void const * values
The weight values, in a contiguous array.
Definition: NvInferRuntime.h:135
Definition: NvInferRuntime.h:4622
virtual bool processDebugTensor(void const *addr, TensorLocation location, DataType type, Dims const &shape, char const *name, cudaStream_t stream)=0
Callback function that is called when a debug tensor’s value is updated and the debug state of the te...
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:4627
~IDebugListener() override=default
Definition: NvInferRuntimeBase.h:421
Definition: NvInferRuntime.h:1691
virtual void * allocateAsync(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags, cudaStream_t) noexcept
A thread-safe callback implemented by the application to handle stream-ordered acquisition of GPU mem...
Definition: NvInferRuntime.h:1813
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:1854
virtual TRT_DEPRECATED bool deallocate(void *const memory) noexcept=0
A thread-safe callback implemented by the application to handle release of GPU memory.
~IGpuAllocator() override=default
virtual void * reallocate(void *const, uint64_t, uint64_t) noexcept
A thread-safe callback implemented by the application to resize an existing allocation.
Definition: NvInferRuntime.h:1760
virtual TRT_DEPRECATED void * allocate(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept=0
A thread-safe callback implemented by the application to handle acquisition of GPU memory.
virtual bool deallocateAsync(void *const memory, cudaStream_t) noexcept
A thread-safe callback implemented by the application to handle stream-ordered release of GPU memory.
Definition: NvInferRuntime.h:1846
Definition: NvInferRuntime.h:5925
bool deallocateAsync(void *const memory, cudaStream_t) noexcept override=0
A thread-safe callback implemented by the application to handle stream-ordered asynchronous release o...
void * allocateAsync(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags, cudaStream_t) noexcept override=0
A thread-safe callback implemented by the application to handle stream-ordered asynchronous acquisiti...
TRT_DEPRECATED void * allocate(uint64_t const size, uint64_t const alignment, AllocatorFlags const flags) noexcept override
A thread-safe callback implemented by the application to handle acquisition of GPU memory.
Definition: NvInferRuntime.h:6012
TRT_DEPRECATED bool deallocate(void *const memory) noexcept override
A thread-safe callback implemented by the application to handle release of GPU memory.
Definition: NvInferRuntime.h:6036
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:6044
~IGpuAsyncAllocator() override=default
A virtual base class to find a logger. Allows a plugin to find an instance of a logger if it needs to...
Definition: NvInferRuntime.h:5891
virtual ILogger * findLogger()=0
Get the logger used by the engine or execution context which called the plugin method.
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:5896
~ILoggerFinder() override=default
Protected: TRT owns ILoggerFinder instances and passes non-owning pointers to plugins.
Application-implemented logging interface for the builder, refitter and runtime.
Definition: NvInferRuntime.h:1614
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:1619
~ILogger() override=default
Severity
The severity corresponding to a log message.
Definition: NvInferRuntime.h:1630
virtual void log(Severity severity, AsciiChar const *msg) noexcept=0
A callback implemented by the application to handle logging messages;.
Definition: NvInferRuntime.h:4559
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:4564
virtual void * reallocateOutputAsync(char const *tensorName, void *currentMemory, uint64_t size, uint64_t alignment, cudaStream_t)
Return a pointer to memory for an output tensor, or nullptr if memory cannot be allocated....
Definition: NvInferRuntime.h:4591
virtual void notifyShape(char const *tensorName, Dims const &dims) noexcept=0
Called by TensorRT when the shape of the output tensor is known.
Definition: NvInferPluginBase.h:141
Definition: NvInferPluginBase.h:193
Definition: NvInferRuntime.h:6051
virtual PluginFieldCollection const * getFieldNames() noexcept=0
Return a list of fields that need to be passed to createPlugin() when creating a plugin for use in th...
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:6056
virtual IPluginV3 * createPlugin(AsciiChar const *name, PluginFieldCollection const *fc, TensorRTPhase phase) noexcept=0
Return a plugin object. Return nullptr in case of error.
Definition: NvInferPluginBase.h:206
Definition: NvInferRuntime.h:874
virtual int32_t getFormatCombinationLimit() noexcept
Return the maximum number of format combinations that will be timed by TensorRT during the build phas...
Definition: NvInferRuntime.h:1078
virtual int32_t getNbOutputs() const noexcept=0
Get the number of outputs from the plugin.
virtual int32_t configurePlugin(DynamicPluginTensorDesc const *in, int32_t nbInputs, DynamicPluginTensorDesc const *out, int32_t nbOutputs) noexcept=0
Configure the plugin.
virtual int32_t getOutputDataTypes(DataType *outputTypes, int32_t nbOutputs, DataType const *inputTypes, int32_t nbInputs) const noexcept=0
Provide the data types of the plugin outputs if the input tensors have the data types provided.
virtual int32_t getNbTactics() noexcept
Query for the number of custom tactics the plugin intends to use.
Definition: NvInferRuntime.h:1054
virtual char const * getMetadataString() noexcept
Query for a string representing the configuration of the plugin. May be called anytime after plugin c...
Definition: NvInferRuntime.h:1089
virtual char const * getTimingCacheID() noexcept
Called to query the suffix to use for the timing cache ID. May be called anytime after plugin creatio...
Definition: NvInferRuntime.h:1070
virtual bool supportsFormatCombination(int32_t pos, DynamicPluginTensorDesc const *inOut, int32_t nbInputs, int32_t nbOutputs) noexcept=0
Return true if plugin supports the format and datatype for the input/output indexed by pos.
virtual int32_t getValidTactics(int32_t *, int32_t) noexcept
Query for any custom tactics that the plugin intends to use.
Definition: NvInferRuntime.h:1046
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:886
virtual int32_t getOutputShapes(DimsExprs const *inputs, int32_t nbInputs, DimsExprs const *shapeInputs, int32_t nbShapeInputs, DimsExprs *outputs, int32_t nbOutputs, IExprBuilder &exprBuilder) noexcept=0
Provide expressions for computing dimensions of the output tensors from dimensions of the input tenso...
Definition: NvInferRuntime.h:831
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:836
virtual AsciiChar const * getPluginName() const noexcept=0
Return the plugin name. Should match the plugin name returned by the corresponding plugin creator.
Definition: NvInferRuntime.h:1096
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:1101
virtual int32_t onShapeChange(PluginTensorDesc const *in, int32_t nbInputs, PluginTensorDesc const *out, int32_t nbOutputs) noexcept=0
Called when a plugin is being prepared for execution for specific dimensions. This could happen multi...
virtual PluginFieldCollection const * getFieldsToSerialize() noexcept=0
Get the plugin fields which should be serialized.
virtual int32_t setTactic(int32_t) noexcept
Set the tactic to be used in the subsequent call to enqueue(). If no custom tactics were advertised,...
Definition: NvInferRuntime.h:1113
virtual int32_t enqueue(PluginTensorDesc const *inputDesc, PluginTensorDesc const *outputDesc, void const *const *inputs, void *const *outputs, void *workspace, cudaStream_t stream) noexcept=0
Execute the layer.
virtual IPluginV3 * attachToContext(IPluginResourceContext *context) noexcept=0
Clone the plugin, attach the cloned plugin object to a execution context and grant the cloned plugin ...
Definition: NvInferRuntime.h:1286
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:1291
~IProfiler() override=default
virtual void reportLayerTime(char const *layerName, float ms) noexcept=0
Layer time reporting callback.
Definition: NvInferRuntime.h:619
~IStreamReader() override=default
IStreamReader & operator=(IStreamReader const &) &=default
IStreamReader & operator=(IStreamReader &&) &=default
virtual int64_t read(void *destination, int64_t nbBytes)=0
Read the next number of bytes in the stream.
IStreamReader(IStreamReader &&)=default
IStreamReader(IStreamReader const &)=default
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:631
Definition: NvInferRuntime.h:731
IStreamReaderV2 & operator=(IStreamReaderV2 const &) &=default
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:743
IStreamReaderV2(IStreamReaderV2 &&)=default
~IStreamReaderV2() override=default
virtual int64_t read(void *destination, int64_t nbBytes, cudaStream_t stream) noexcept=0
Read the next number of bytes in the stream asynchronously.
IStreamReaderV2(IStreamReaderV2 const &)=default
virtual bool seek(int64_t offset, SeekPosition where) noexcept=0
Sets the position of the stream to the given offset.
IStreamReaderV2 & operator=(IStreamReaderV2 &&) &=default
Definition: NvInferRuntime.h:654
IStreamWriter & operator=(IStreamWriter const &) &=default
IStreamWriter(IStreamWriter &&)=default
virtual int64_t write(void const *data, int64_t nbBytes)=0
write nbBytes of data into the stream.
IStreamWriter(IStreamWriter const &)=default
IStreamWriter & operator=(IStreamWriter &&) &=default
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:666
~IStreamWriter() override=default
Definition: NvInferRuntime.h:1193
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferRuntime.h:1195
virtual int32_t getAliasedInput(int32_t) noexcept
Communicates to TensorRT that the output at the specified output index is aliased to the input at the...
Definition: NvInferRuntime.h:1229
IRefitter * createInferRefitter(ICudaEngine &engine, ILogger &logger) noexcept
Create an instance of an IRefitter class.
Definition: NvInferRuntime.h:5839
IRuntime * createInferRuntime(ILogger &logger) noexcept
Create an instance of an IRuntime class.
Definition: NvInferRuntime.h:5828
The TensorRT API version 1 namespace.
Definition: NvInferPluginBase.h:29
uint32_t TacticSources
Represents a collection of one or more TacticSource values combine using bitwise-OR operations.
Definition: NvInferRuntime.h:3035
v_1_0::IOutputAllocator IOutputAllocator
Definition: NvInferRuntime.h:4617
EngineCapability
List of supported engine capability flows.
Definition: NvInferRuntime.h:76
DimensionOperation
An operation on two IDimensionExpr, which represent integer expressions used in dimension computation...
Definition: NvInferRuntime.h:189
@ kCEIL_DIV
Division rounding up.
v_1_0::IPluginV3OneCore IPluginV3OneCore
Definition: NvInferRuntime.h:1246
EngineInvalidityDiagnostics
Bitmask indicating the reason(s) why an engine is invalid.
Definition: NvInferRuntime.h:1921
@ kUNSUPPORTED_CC
Unsupported compute capability on current system.
@ kMALFORMED_ENGINE
Serialized engine does not conform to the expected format.
@ kINSUFFICIENT_GPU_MEMORY
Insufficient GPU memory to hold all engine weights.
@ kCUDA_ERROR
Incorrect installation of the CUDA driver or runtime.
@ kOLD_CUDA_DRIVER
CUDA driver too old (driver downgrade compared to when engine was built).
@ kOLD_CUDA_RUNTIME
CUDA runtime too old (runtime downgrade compared to when engine was built).
@ kVERSION_MISMATCH
TensorRT-RTX version mismatch to when engine was built.
TensorIOMode
Definition of tensor IO Mode.
Definition: NvInferRuntimeBase.h:664
@ kNONE
Tensor is not an input or output.
HardwareCompatibilityLevel
Describes requirements of compatibility with GPU architectures other than that of the GPU on which th...
Definition: NvInfer.h:10343
SerializationFlag
List of valid flags that the engine can enable when serializing the bytes.
Definition: NvInferRuntime.h:3076
@ kEXCLUDE_WEIGHTS
Exclude the weights that can be refitted.
@ kINCLUDE_REFIT
Remain refittable if originally so.
DLAWorkspaceAllocationStrategy
Describes how DLA workspace memory is allocated.
Definition: NvInferRuntime.h:1576
v_1_0::IStreamWriter IStreamWriter
Definition: NvInferRuntime.h:710
v_1_0::IProfiler IProfiler
Definition: NvInferRuntime.h:1320
DynamicShapesKernelSpecializationStrategy
Different kernel specialization strategies for dynamic shapes.
Definition: NvInferRuntime.h:3268
SeekPosition
Controls the seek mode of IStreamReaderV2.
Definition: NvInferRuntime.h:717
@ kSET
From the beginning of the file.
@ kCUR
From the current position of the file.
@ kEND
From the tail of the file.
v_1_0::IStreamReaderV2 IStreamReaderV2
Definition: NvInferRuntime.h:787
uint32_t TempfileControlFlags
Represents a collection of one or more TempfileControlFlag values combined using bitwise-OR operation...
Definition: NvInferRuntime.h:1398
EngineStat
The kind of engine statistics that queried from the ICudaEngine.
Definition: NvInferRuntime.h:3598
@ kTOTAL_WEIGHTS_SIZE
Return the total weight size in bytes.
@ kSTRIPPED_WEIGHTS_SIZE
Return the stripped weight size in bytes for engines built with BuilderFlag::kSTRIP_PLAN.
CudaGraphStrategy
Strategies available for CUDA graphs optimizations for JIT (Just-In-Time) inference.
Definition: NvInferRuntime.h:3304
v_1_0::IGpuAllocator IGpuAllocator
Definition: NvInferRuntime.h:1890
EngineValidity
Whether a TensorRT-RTX engine is likely to be valid on the current system.
Definition: NvInferRuntime.h:1898
@ kINVALID
Engine is invalid on the current system.
@ kSUBOPTIMAL
Engine is likely to be valid on the current system, but may show reduced performance.
@ kVALID
Engine is likely to be valid on the current system, based on the information in the header.
v_1_0::ILogger ILogger
Definition: NvInferRuntimeBase.h:125
char_t AsciiChar
Definition: NvInferRuntimeBase.h:116
TensorRTPhase
Indicates a phase of operation of TensorRT.
Definition: NvInferPluginBase.h:116
@ kV2_DYNAMICEXT
IPluginV2DynamicExt.
DataType
The type of weights and tensors. The datatypes other than kBOOL, kINT32, and kINT64 are "activation d...
Definition: NvInferRuntimeBase.h:151
DeviceType
The device that this layer/network will execute on.
Definition: NvInferRuntime.h:1352
@ kSCALE
Scale layer.
@ kCONSTANT
Constant layer.
@ kDEFAULT
Similar to ONNX Gather.
v_1_0::IDebugListener IDebugListener
Definition: NvInferRuntime.h:4658
TempfileControlFlag
Flags used to control TensorRT's behavior when creating executable temporary files.
Definition: NvInferRuntime.h:1375
@ kALLOW_IN_MEMORY_FILES
Allow creating and loading files in-memory (or unnamed files).
WeightsRole
How a layer uses particular Weights.
Definition: NvInferRuntime.h:1330
@ kSHIFT
shift part of IScaleLayer
@ kANY
Any other weights role.
@ kBIAS
bias for IConvolutionLayer or IDeconvolutionLayer
@ kKERNEL
kernel for IConvolutionLayer or IDeconvolutionLayer
ProfilingVerbosity
List of verbosity levels of layer information exposed in NVTX annotations and in IEngineInspector.
Definition: NvInferRuntime.h:3047
@ kLAYER_NAMES_ONLY
Print only the layer names. This is the default setting.
@ kDETAILED
Print detailed layer information including layer names and layer parameters.
TacticSource
List of tactic sources for TensorRT.
Definition: NvInferRuntime.h:3011
TensorFormat PluginFormat
PluginFormat is reserved for backward compatibility.
Definition: NvInferRuntimePlugin.h:54
v_1_0::IPluginV3OneRuntime IPluginV3OneRuntime
Definition: NvInferRuntime.h:1270
@ kSUB
Subtract the second element from the first.
@ kSUM
Sum of the two elements.
@ kPROD
Product of the two elements.
@ kFLOOR_DIV
Floor division of the first element by the second.
@ kEQUAL
Check if two elements are equal.
@ kMIN
Minimum of the two elements.
@ kLESS
Check if element in first tensor is less than corresponding element in second tensor.
uint32_t SerializationFlags
Represents one or more SerializationFlag values using binary OR operations, e.g., 1U << Serialization...
Definition: NvInferRuntime.h:3066
@ kLINEAR
Supports linear (1D), bilinear (2D), and trilinear (3D) interpolation.
v_1_0::IPluginV3OneBuild IPluginV3OneBuild
Definition: NvInferRuntime.h:1258
TensorFormat
Format of the input/output tensors.
Definition: NvInferRuntime.h:1432
ExecutionContextAllocationStrategy
Different memory allocation behaviors for IExecutionContext.
Definition: NvInferRuntime.h:3183
@ kSTATIC
Default static allocation with the maximum size across all profiles.
@ kUSER_MANAGED
The user supplies custom allocation to the execution context.
@ kON_PROFILE_CHANGE
Reallocate for a profile when it's selected.
v_1_0::ILoggerFinder ILoggerFinder
Definition: NvInferRuntime.h:5917
LayerInformationFormat
The format in which the IEngineInspector prints the layer information.
Definition: NvInferRuntime.h:5643
@ kJSON
Print layer information in JSON format.
@ kONELINE
Print layer information in one line per layer.
v_1_0::IStreamReader IStreamReader
Definition: NvInferRuntime.h:700
AllocatorFlag
Allowed type of memory allocation.
Definition: NvInferRuntime.h:1553
@ kRESIZABLE
TensorRT may call realloc() on this allocation.
@ kMAX
Maximum over elements.
TensorLocation
The location for tensor data storage, device or host.
Definition: NvInferRuntime.h:214
@ kHOST
Data stored on host.
@ kDEVICE
Data stored on device.
OptProfileSelector
When setting or querying optimization profile parameters (such as shape tensor inputs or dynamic dime...
Definition: NvInferRuntime.h:2756
@ kOPT
This is used to set or get the value that is used in the optimization (kernel selection).
uint32_t AllocatorFlags
Definition: NvInferRuntime.h:1566
Summarizes tensors that a plugin might see for an input or output.
Definition: NvInferRuntime.h:373
Dims min
Lower bounds on tensor’s dimensions.
Definition: NvInferRuntime.h:378
Dims max
Upper bounds on tensor’s dimensions.
Definition: NvInferRuntime.h:381
Dims opt
Optimum value of tensor’s dimensions specified for auto-tuning.
Definition: NvInferRuntime.h:384
PluginTensorDesc desc
Information required to interpret a pointer to tensor data, except that desc.dims has -1 in place of ...
Definition: NvInferRuntime.h:375
Plugin field collection struct.
Definition: NvInferPluginBase.h:103
Fields that a plugin might see for an input or output.
Definition: NvInferRuntimePlugin.h:73
Declaration of EnumMaxImpl struct to store the exclusive upper bound of an enumeration type.
Definition: NvInferRuntimeBase.h:132

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