Skip to content

fix(//core/plugins: Fix plugin debug log while importing trtorch #458

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions core/plugins/register_plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ namespace impl {
class TRTorchPluginRegistry {
public:
TRTorchPluginRegistry() {
trtorch_logger.log(util::logging::LogLevel::kINFO, "Instatiated the TRTorch plugin registry class");
#ifndef NDEBUG
trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Instatiated the TRTorch plugin registry class");
#endif
// register libNvInferPlugins and TRTorch plugins
// trtorch_logger logging level is set to kERROR and reset back to kDEBUG.
// This is because initLibNvInferPlugins initializes only a subset of plugins and logs them.
Expand All @@ -24,21 +26,23 @@ class TRTorchPluginRegistry {
trtorch_logger.set_reportable_log_level(util::logging::LogLevel::kERROR);
initLibNvInferPlugins(&trtorch_logger, "");
trtorch_logger.set_reportable_log_level(util::logging::LogLevel::kDEBUG);

#ifndef NDEBUG
int numCreators = 0;
auto pluginsList = getPluginRegistry()->getPluginCreatorList(&numCreators);
for (int k = 0; k < numCreators; ++k) {
if (!pluginsList[k]) {
trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Plugin creator for plugin " + str(k) + " is a nullptr");
continue;
}

std::string pluginNamespace = pluginsList[k]->getPluginNamespace();
trtorch_logger.log(
util::logging::LogLevel::kDEBUG,
"Registered plugin creator - " + std::string(pluginsList[k]->getPluginName()) +
", Namespace: " + pluginNamespace);
}
trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Total number of plugins registered: " + str(numCreators));
#endif
}

public:
Expand Down