Skip to content

Commit 54cb3cb

Browse files
committed
Fix Minor Issues
1 parent fc2945f commit 54cb3cb

7 files changed

Lines changed: 12 additions & 37 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ $ cmake -B build
3333
$ cmake --build build --config Release --parallel
3434
```
3535

36-
Under the `build/src/plugins` directory, the custom plugin library will be saved as `libidentity_conv_iplugin_v2_io_ext.so` for `IPluginV2Ext` and `libidentity_conv_iplugin_v3.so` for `IPluginV3`, respectively. The `IPluginV2Ext` has been deprecated since TensorRT 10.0.0 and will be removed in the future. The `IPluginV3` is the only recommended interface for custom plugin development.
36+
Under the `build/src/plugins` directory, the custom plugin library will be saved as `libidentity_conv_iplugin_v2_io_ext.so` for `IPluginV2Ext` and `libidentity_conv_iplugin_v3.so` for `IPluginV3`, respectively. The `IPluginV2Ext` plugin interface has been deprecated since TensorRT 10.0.0 and will be removed in the future. The `IPluginV3` plugin interface is the only recommended interface for custom plugin development.
3737

3838
Under the `build/src/apps` directory, the engine builder will be saved as `build_engine`, and the engine runner will be saved as `run_engine`.
3939

python/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
## Unit Test
44

5+
Assuming the `IPluginV2IOExt` and `IPluginV3` plugins have been built, the engine that uses each of the plugins have been built, the unit tests can be run.
6+
57
To run the unit test, please run the following command.
68

79
```bash
8-
python -m unittest test_plugin
9-
python -m unittest test_engine
10+
$ python -m unittest test_plugin
11+
$ python -m unittest test_engine
1012
```
1113

1214
## Run TensorRT Engine

src/CMakeLists.txt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
cmake_minimum_required(VERSION 3.28)
22

3-
project(TENSORRT-CUSTOM-PLUGIN-IDENTITY-CONV-EXAMPLE VERSION 0.0.1 LANGUAGES CXX CUDA)
3+
project(TENSORRT-CUSTOM-PLUGIN-IDENTITY-CONV-EXAMPLE VERSION 0.0.1 LANGUAGES CXX)
44

55
set(CMAKE_CXX_STANDARD 14)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77

8-
# Find CUDA Toolkit
9-
find_package(CUDAToolkit REQUIRED)
10-
11-
# add_executable(build_engine build_engine.cpp)
12-
# target_link_libraries(build_engine PRIVATE ${NVINFER_LIB} ${NVONNXPARSER_LIB} ${NVINFER_PLUGIN_LIB} CUDA::cudart)
13-
14-
# add_executable(run_engine run_engine.cpp)
15-
# target_link_libraries(run_engine PRIVATE ${NVINFER_LIB} CUDA::cudart)
16-
178
add_subdirectory(plugins)
189
add_subdirectory(apps)

src/apps/build_engine.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ int main(int argc, char** argv)
7171

7272
// Create the network.
7373
uint32_t flag{0U};
74+
// For TensorRT < 10.0, explicit dimension has to be specified to
75+
// distinguish from the implicit dimension. For TensorRT >= 10.0, explicit
76+
// dimension is the only choice and this flag has been deprecated.
7477
if (getInferLibVersion() < 100000)
7578
{
7679
flag |= 1U << static_cast<uint32_t>(

src/plugins/IdentityConvIPluginV3/IdentityConvPlugin.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@ namespace nvinfer1
1515
namespace plugin
1616
{
1717

18-
// TODO(leimao): Handle noexcept later.
19-
20-
// Write values into buffer
21-
template <typename Type, typename BufferType>
22-
void write(BufferType*& buffer, Type const& val)
23-
{
24-
static_assert(sizeof(BufferType) == 1, "BufferType must be a 1 byte type.");
25-
std::memcpy(buffer, &val, sizeof(Type));
26-
buffer += sizeof(Type);
27-
}
28-
29-
// Read values from buffer
30-
template <typename OutType, typename BufferType>
31-
OutType read(BufferType const*& buffer)
32-
{
33-
static_assert(sizeof(BufferType) == 1, "BufferType must be a 1 byte type.");
34-
OutType val{};
35-
std::memcpy(&val, static_cast<void const*>(buffer), sizeof(OutType));
36-
buffer += sizeof(OutType);
37-
return val;
38-
}
39-
4018
IdentityConv::IdentityConv(IdentityConvParameters const& params)
4119
: mParams{params}
4220
{
@@ -85,7 +63,6 @@ IPluginV3* IdentityConv::clone() noexcept
8563
try
8664
{
8765
IPluginV3* const plugin{new IdentityConv{mParams}};
88-
// plugin->setPluginNamespace(mPluginNamespace);
8966
return plugin;
9067
}
9168
catch (std::exception const& e)

src/plugins/IdentityConvIPluginV3/IdentityConvPlugin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <NvInferRuntime.h>
1010
#include <NvInferRuntimePlugin.h>
1111

12+
// In IPluginV3 interface, the plugin name, version, and name space must be
13+
// specified for the plugin and plugin creator exactly the same.
1214
constexpr char const* const kIDENTITY_CONV_PLUGIN_NAME{"IdentityConv"};
1315
constexpr char const* const kIDENTITY_CONV_PLUGIN_VERSION{"1"};
1416
constexpr char const* const kIDENTITY_CONV_PLUGIN_NAMESPACE{""};

src/plugins/IdentityConvIPluginV3/PluginRegistration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
extern "C" void setLoggerFinder(nvinfer1::ILoggerFinder* finder);
99

10-
extern "C" nvinfer1::IPluginCreator* const*
10+
extern "C" nvinfer1::IPluginCreatorInterface* const*
1111
getPluginCreators(int32_t& nbCreators);
1212

1313
#endif // TENSORRT_PLUGIN_REGISTRATION_H

0 commit comments

Comments
 (0)