TensorRT 10.7.0
NvInferPluginBase.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2024 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"
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,
64};
65
74{
75public:
79 void const* data;
83 int32_t length;
84
85 PluginField(AsciiChar const* const name_ = nullptr, void const* const data_ = nullptr,
86 PluginFieldType const type_ = PluginFieldType::kUNKNOWN, int32_t const length_ = 0) noexcept
87 : name(name_)
88 , data(data_)
89 , type(type_)
90 , length(length_)
91 {
92 }
93};
94
101{
103 int32_t nbFields{};
106};
107
113enum class TensorRTPhase : int32_t
114{
116 kBUILD = 0,
118 kRUNTIME = 1
119};
120
126enum class PluginCapabilityType : int32_t
127{
129 kCORE = 0,
131 kBUILD = 1,
133 kRUNTIME = 2
134};
135
136namespace v_1_0
137{
139{
140};
141
143{
144public:
148 InterfaceInfo getInterfaceInfo() const noexcept override
149 {
150 return InterfaceInfo{"IPluginResource", 1, 0};
151 }
165 virtual int32_t release() noexcept = 0;
166
179 virtual IPluginResource* clone() noexcept = 0;
180
181 ~IPluginResource() noexcept override = default;
182
183 IPluginResource() = default;
186 IPluginResource& operator=(IPluginResource const&) & = default;
187 IPluginResource& operator=(IPluginResource&&) & = default;
188}; // class IPluginResource
189
191{
192public:
193 ~IPluginCreatorInterface() noexcept override = default;
194
195protected:
199 IPluginCreatorInterface& operator=(IPluginCreatorInterface const&) & = default;
201};
202
204{
205public:
209 InterfaceInfo getInterfaceInfo() const noexcept override
210 {
211 return InterfaceInfo{"PLUGIN", 1, 0};
212 }
213
226
237 virtual IPluginV3* clone() noexcept = 0;
238};
239} // namespace v_1_0
240
250
259
271using IPluginV3 = v_1_0::IPluginV3;
272
287} // namespace nvinfer1
288
289#endif /* NV_INFER_PLUGIN_BASE_H */
An Interface class for version control.
Definition: NvInferRuntimeBase.h:260
Version information associated with a TRT interface.
Definition: NvInferRuntimeBase.h:225
Structure containing plugin attribute field names and associated data This information can be parsed ...
Definition: NvInferPluginBase.h:74
AsciiChar const * name
Plugin field attribute name.
Definition: NvInferPluginBase.h:77
PluginField(AsciiChar const *const name_=nullptr, void const *const data_=nullptr, PluginFieldType const type_=PluginFieldType::kUNKNOWN, int32_t const length_=0) noexcept
Definition: NvInferPluginBase.h:85
void const * data
Plugin field attribute data.
Definition: NvInferPluginBase.h:79
int32_t length
Number of data entries in the Plugin attribute.
Definition: NvInferPluginBase.h:83
PluginFieldType type
Plugin field attribute type.
Definition: NvInferPluginBase.h:81
Definition: NvInferPluginBase.h:139
Definition: NvInferPluginBase.h:191
~IPluginCreatorInterface() noexcept override=default
Definition: NvInferPluginBase.h:143
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:148
Definition: NvInferPluginBase.h:204
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:209
The TensorRT API version 1 namespace.
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.
@ 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:127
@ 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:105
TensorRTPhase
Indicates a phase of operation of TensorRT.
Definition: NvInferPluginBase.h:114
@ kBUILD
Build phase of TensorRT.
@ kRUNTIME
Execution phase of TensorRT.
Plugin field collection struct.
Definition: NvInferPluginBase.h:101
PluginField const * fields
Pointer to PluginField entries.
Definition: NvInferPluginBase.h:105
int32_t nbFields
Number of PluginField entries.
Definition: NvInferPluginBase.h:103

  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