REGISTER_TENSORRT_PLUGIN, defined near https://github.com/NVIDIA/TensorRT/blob/master/include/NvInferRuntimeCommon.h#L1272, defines a static instance of PluginRegistrar. The ctor of PluginRegistrar calls getPluginRegistry(), which retrieves the global plugin registry. If the global plugin registry is a usual global, then we have a dependency between statics defined in different translation units, and hence are potentially susceptible to the static initialization order fiasco (https://isocpp.org/wiki/faq/ctors#static-init-order), no? Note if the global registry is implemented as a function-local static, we don’t have this issue (because they are initialized on first use). We also wouldn’t have this issue if, as I’ve argued before (in 1, 2), TensorRT clients could own their own IPluginRegistry. The absence of bug reports on this issue is reassuring, but UB can strike at any time.
Thanks for the feedback, we will look into it and update you.
The implementation uses a function local static.
Thanks for the clarification, Dilip.