TensorRT 11.5.0
NvInferPluginBase.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2024-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_PLUGIN_BASE_H
19#define NV_INFER_PLUGIN_BASE_H
20
21#if !defined(NV_INFER_INTERNAL_INCLUDE)
22static_assert(false, "Do not directly include this file. Include NvInferRuntime.h or NvInferPluginUtils.h");
23#endif
24
25#define NV_INFER_INTERNAL_INCLUDE 1
26#include "NvInferRuntimeBase.h" // IWYU pragma: exports
27#undef NV_INFER_INTERNAL_INCLUDE
28namespace nvinfer1
29{
30
36enum class PluginFieldType : int32_t
37{
39 kFLOAT16 = 0,
41 kFLOAT32 = 1,
43 kFLOAT64 = 2,
45 kINT8 = 3,
47 kINT16 = 4,
49 kINT32 = 5,
51 kCHAR = 6,
53 kDIMS = 7,
55 kUNKNOWN = 8,
57 kBF16 = 9,
59 kINT64 = 10,
61 kFP8 = 11,
63 kINT4 = 12,
65 kFP4 = 13,
66};
67
73{
74public:
78 void const* data;
82 int32_t length;
83
94 // coverity[misra_cpp_2023_rule_15_1_3_violation] TID-5021 allowed for PluginField {$nv-internal-release}
95 PluginField(AsciiChar const* const name_ = nullptr, void const* const data_ = nullptr,
96 PluginFieldType const type_ = PluginFieldType::kUNKNOWN, int32_t const length_ = 0) noexcept
97 : name(name_)
98 , data(data_)
99 , type(type_)
100 , length(length_)
101 {
102 }
103};
104
111{
113 int32_t nbFields{};
116};
117
123enum class TensorRTPhase : int32_t
124{
126 kBUILD = 0,
128 kRUNTIME = 1
129};
130
136enum class PluginCapabilityType : int32_t
137{
139 kCORE = 0,
141 kBUILD = 1,
143 kRUNTIME = 2
144};
145
146namespace v_1_0
147{
149{
150};
151
153{
154public:
158 InterfaceInfo getInterfaceInfo() const noexcept override
159 {
160 return InterfaceInfo{"IPluginResource", 1, 0};
161 }
175 virtual int32_t release() noexcept = 0;
176
189 virtual IPluginResource* clone() noexcept = 0;
190
191 ~IPluginResource() noexcept override = default;
192
193 IPluginResource() = default;
196 IPluginResource& operator=(IPluginResource const&) & = default;
197 IPluginResource& operator=(IPluginResource&&) & = default;
198}; // class IPluginResource
199
201{
202public:
203 ~IPluginCreatorInterface() noexcept override = default;
204
205protected:
209 IPluginCreatorInterface& operator=(IPluginCreatorInterface const&) & = default;
211};
212
223{
224public:
228 InterfaceInfo getInterfaceInfo() const noexcept override
229 {
230 return InterfaceInfo{"PLUGIN", 1, 0};
231 }
232
245
256 virtual IPluginV3* clone() noexcept = 0;
257};
258} // namespace v_1_0
259
269
278
279using IPluginV3 = v_1_0::IPluginV3;
280
295} // namespace nvinfer1
296
297#endif /* NV_INFER_PLUGIN_BASE_H */
An Interface class for version control.
Definition: NvInferRuntimeBase.h:293
Holds version and kind information for a TensorRT interface.
Definition: NvInferRuntimeBase.h:258
Class containing plugin attribute field names and associated data.
Definition: NvInferPluginBase.h:73
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferPluginBase.h:76
PluginField(AsciiChar const *const name_=nullptr, void const *const data_=nullptr, PluginFieldType const type_=PluginFieldType::kUNKNOWN, int32_t const length_=0) noexcept
Construct a PluginField with optional name, data, type, and length.
Definition: NvInferPluginBase.h:95
void const * data
Plugin field attribute data.
Definition: NvInferPluginBase.h:78
int32_t length
Number of data entries in the plugin attribute.
Definition: NvInferPluginBase.h:82
PluginFieldType type
Plugin field attribute type.
Definition: NvInferPluginBase.h:80
Definition: NvInferPluginBase.h:149
Definition: NvInferPluginBase.h:201
~IPluginCreatorInterface() noexcept override=default
Definition: NvInferPluginBase.h:153
virtual IPluginResource * clone() noexcept=0
Clone the resource object.
virtual int32_t release() noexcept=0
Free the underlying resource.
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferPluginBase.h:158
Plugin class for the V3 generation of user-implemented layers.
Definition: NvInferPluginBase.h:223
virtual IPluginV3 * clone() noexcept=0
Clone the plugin object. This copies over internal plugin parameters and returns a new plugin object ...
virtual IPluginCapability * getCapabilityInterface(PluginCapabilityType type) noexcept=0
Return a pointer to plugin object implementing the specified PluginCapabilityType.
InterfaceInfo getInterfaceInfo() const noexcept override
Return version information associated with this interface. Applications must not override this method...
Definition: NvInferPluginBase.h:228
The TensorRT API version 1 namespace.
Definition: NvInferSafePlugin.h:33
PluginFieldType
The possible field types for custom layer.
Definition: NvInferPluginBase.h:37
@ kUNKNOWN
Unknown field type.
@ kINT64
INT64 field type.
@ kFLOAT32
FP32 field type.
@ kCHAR
char field type.
@ kFP4
FP4 field type.
@ kINT16
INT16 field type.
@ kDIMS
nvinfer1::Dims field type.
@ kINT8
INT8 field type.
@ kFP8
FP8 field type.
@ kBF16
BF16 field type.
@ kINT4
INT4 field type.
@ kFLOAT64
FP64 field type.
@ kFLOAT16
FP16 field type.
@ kINT32
INT32 field type.
PluginCapabilityType
Enumerates the different capability types a IPluginV3 object may have.
Definition: NvInferPluginBase.h:137
@ kBUILD
Build capability. IPluginV3 objects provided to TensorRT build phase must have this.
@ kRUNTIME
Runtime capability. IPluginV3 objects provided to TensorRT build and execution phases must have this.
@ kCORE
Core capability. Every IPluginV3 object must have this.
char_t AsciiChar
Definition: NvInferRuntimeBase.h:126
TensorRTPhase
Indicates a phase of operation of TensorRT.
Definition: NvInferPluginBase.h:124
@ kBUILD
Build phase of TensorRT.
@ kRUNTIME
Execution phase of TensorRT.
Plugin field collection struct.
Definition: NvInferPluginBase.h:111
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferPluginBase.h:115
int32_t nbFields
Number of PluginField entries.
Definition: NvInferPluginBase.h:113

  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