REGISTER_TENSORRT_PLUGIN and the static initialization order fiasco

REGISTER_TENSORRT_PLUGIN, defined near, 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 (, 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.


Hi Tom,

Thanks for the feedback, we will look into it and update you.


The implementation uses a function local static.

1 Like

Thanks for the clarification, Dilip.