-
Notifications
You must be signed in to change notification settings - Fork 363
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
Conversation
Signed-off-by: Dheeraj Peri <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/plugins/register_plugins.cpp b/tmp/changes.txt
index f48214b..99c290f 100644
--- a/workspace/core/plugins/register_plugins.cpp
+++ b/tmp/changes.txt
@@ -14,9 +14,9 @@ namespace impl {
class TRTorchPluginRegistry {
public:
TRTorchPluginRegistry() {
- #ifndef NDEBUG
- trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Instatiated the TRTorch plugin registry class");
- #endif
+#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.
@@ -26,22 +26,22 @@ 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);
+#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;
}
- trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Total number of plugins registered: " + str(numCreators));
- #endif
+ 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:
ERROR: Some files do not conform to style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some changes that do not conform to C++ style guidelines:
diff --git a/workspace/core/plugins/register_plugins.cpp b/tmp/changes.txt
index f48214b..99c290f 100644
--- a/workspace/core/plugins/register_plugins.cpp
+++ b/tmp/changes.txt
@@ -14,9 +14,9 @@ namespace impl {
class TRTorchPluginRegistry {
public:
TRTorchPluginRegistry() {
- #ifndef NDEBUG
- trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Instatiated the TRTorch plugin registry class");
- #endif
+#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.
@@ -26,22 +26,22 @@ 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);
+#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;
}
- trtorch_logger.log(util::logging::LogLevel::kDEBUG, "Total number of plugins registered: " + str(numCreators));
- #endif
+ 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:
ERROR: Some files do not conform to style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
Signed-off-by: Dheeraj Peri <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to Python style guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code conforms to C++ style guidelines
I think this PR is unnecessary. The logger will already gate messages based on severity |
#463 I think is a better implementation of this, closing in favor of that |
Description
import trtorch unnecessarily prints plugin debug info
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: