Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trtexec Fails to Build TensorRT Engine with Custom Plugins on Windows but Succeeds on Linux #4274

Closed
laugh12321 opened this issue Dec 6, 2024 · 1 comment

Comments

@laugh12321
Copy link

laugh12321 commented Dec 6, 2024

Description

In my project TensorRT-YOLO, I have developed two custom plugins: Efficient Rotated NMS Plugin and Efficient NMS Plugin With Indices. These plugins have been compiled and integrated into a dynamic link library named custom_plugins.

To enable trtexec to use these custom plugins properly (by serializing the shared plugin library as part of the engine itself), I implemented setLoggerFinder, getCreators, and getPluginCreators functions in TensorRT-YOLO/plugin/common/vfcCommon.cpp following the guidance from Using trtexec - Using your own Plugin and Plugin Shared Libraries.

However, when attempting to build an engine with custom plugins using the following commands in the Windows environment, I encountered errors:

# Windows
trtexec --onnx=yolo11n-obb.onnx --saveEngine=yolo11n-obb.engine --staticPlugins=custom_plugins.dll --setPluginsToSerialize=custom_plugins.dll

# Linux
trtexec --onnx=yolo11n-obb.onnx --saveEngine=yolo11n-obb.engine --staticPlugins=libcustom_plugins.so --setPluginsToSerialize=libcustom_plugins.so

The specific error messages are: Error[3]: IRuntime::deserializeCudaEngine: Error Code 3: API Usage Error (SymbolAddress for getCreators could not be loaded, check function name against library symbol) or Error[3]: IRuntime::deserializeCudaEngine: Error Code 3: API Usage Error (SymbolAddress for getPluginCreators could not be loaded, check function name against library symbol).

In contrast, no issues were encountered when performing the same operations in the Linux environment.

Image

Image

Environment

TensorRT Version: Windows and Linux: Tested on v8.6.0.12 ~ v10.7.0.23

NVIDIA GPU: NVIDIA GeForce RTX 2080 Ti, NVIDIA GeForce RTX 3060 Ti

NVIDIA Driver Version: Windows: 528.33 Linux: 550.120

CUDA Version: Windows and Linux: 12.0.1

CUDNN Version: Windows and Linux: 8.9.7.29

Relevant Files

Model link: yolo11n-obb.onnx yolo11n-seg.onnx yolo11n-pose.onnx

@laugh12321
Copy link
Author

The issue has been resolved. Simply add the __declspec(dllexport) attribute before the setLoggerFinder, getCreators, or getPluginCreators functions to achieve the desired functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant