mbs-octoml commented on a change in pull request #9012:
URL: https://github.com/apache/tvm/pull/9012#discussion_r711610916
##########
File path: src/runtime/logging.cc
##########
@@ -166,10 +167,118 @@ namespace tvm {
namespace runtime {
namespace detail {
+namespace {
+constexpr const char* kSrcPrefix = "/src/";
+constexpr const size_t kSrcPrefixLength = 5;
+constexpr const char* kDefaultKeyword = "DEFAULT";
+} // namespace
+
+// Parse \p opt_spec as a VLOG specification as per comment in
+// DebugLoggingEnabled and VerboseLoggingEnabled.
+std::unordered_map<std::string, int> ParseTvmLogDebugSpec(const char*
opt_spec) {
+ std::unordered_map<std::string, int> map;
+ if (opt_spec == nullptr) {
+ // DLOG and VLOG disabled.
+ return map;
+ }
+ std::string spec(opt_spec);
+ if (spec.empty() || spec == "0") {
+ // DLOG and VLOG disabled.
+ return map;
+ }
+ if (spec == "1") {
+ // Legacy specification for enabling just DLOG.
+ // A wildcard entry in the map will signal DLOG is on, but all VLOG levels
are disabled.
+ LOG(INFO) << "TVM_LOG_DEBUG enables DLOG statements only";
+ map.emplace(kDefaultKeyword, -1);
Review comment:
Everything is gated on TVM_LOG_DEBUG, signalling this is a developer
build for the purposes of debugging. If this were on prod code paths then we'd
need to do some very special tricks to cache the lookup per file.
--
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]