mbs-octoml commented on a change in pull request #9012:
URL: https://github.com/apache/tvm/pull/9012#discussion_r708733647



##########
File path: include/tvm/runtime/logging.h
##########
@@ -409,6 +413,68 @@ inline bool DebugLoggingEnabled() {
   return state == 1;
 }
 
+/*! \brief Helpers for \p VerboseLoggingEnabled. Exposed for unit testing 
only. */
+std::unordered_map<std::string, int> ParseTvmLogDebugSpec(const char* 
opt_spec);
+bool VerboseEnabledInMap(const char* filename, int level,
+                         const std::unordered_map<std::string, int>& map);
+
+/*!
+ * \brief Returns true if a VLOG statement in \p filename is enabled by the \p 
TVM_LOG_DEBUG

Review comment:
       I'm using that as a convention to quote parameters or code. Looks nicer 
in the formatted comments.

##########
File path: include/tvm/runtime/logging.h
##########
@@ -409,6 +413,68 @@ inline bool DebugLoggingEnabled() {
   return state == 1;
 }
 
+/*! \brief Helpers for \p VerboseLoggingEnabled. Exposed for unit testing 
only. */
+std::unordered_map<std::string, int> ParseTvmLogDebugSpec(const char* 
opt_spec);
+bool VerboseEnabledInMap(const char* filename, int level,
+                         const std::unordered_map<std::string, int>& map);
+
+/*!
+ * \brief Returns true if a VLOG statement in \p filename is enabled by the \p 
TVM_LOG_DEBUG
+ * environment variable for logging at verbosity \p level.
+ *
+ * Filenames are canonicalized to be w.r.t. the src/ dir of the TVM tree. 
(VLOG's should not
+ * appear under include/).
+ *
+ * To enable file \p relay/foo.cc up to level 2 and \p ir/bar.cc for level 0 
only set:
+ * \code
+ * TVM_LOG_DEBUG="1;relay/foo.cc=2;ir/bar.cc=0;"
+ * \endcode
+ *
+ * To enable all files up to level 3 but disable \p ir/bar.cc set:
+ * \code
+ * TVM_LOG_DEBUG="1;*=2;ir/bar.cc=-1;"
+ * \endcode
+ */
+bool VerboseLoggingEnabled(const char* filename, int level);
+
+/*!
+ * \brief A stack of VLOG context messages.
+ *
+ * For use by \p VLOG_CONTEXT macro only.
+ */
+class VLogContext {
+ public:
+  void Push(std::stringstream* stream) { context_stack.push_back(stream); }
+  void Pop() {
+    if (!context_stack.empty()) {
+      context_stack.pop_back();
+    }
+  }
+
+  std::string str() const;
+
+ private:
+  std::vector<std::stringstream*> context_stack;

Review comment:
       Done , thx.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to