Skip to content

Commit

Permalink
[Bugfix] Fix usages of logging-related macros (apache#7748)
Browse files Browse the repository at this point in the history
  • Loading branch information
junrushao authored and Trevor Morris committed May 6, 2021
1 parent 44e87e1 commit 63aa942
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion apps/android_camera/app/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include $(config)
APP_ABI ?= all
APP_STL := c++_shared

APP_CPPFLAGS += -DTVM4J_ANDROID=1 -std=c++14 -Oz -frtti
APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DTVM4J_ANDROID=1 -std=c++14 -Oz -frtti
ifeq ($(USE_OPENCL), 1)
APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1
endif
Expand Down
2 changes: 1 addition & 1 deletion apps/android_camera/app/src/main/jni/tvm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <fstream>

#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_BACKTRACE_DISABLED 1
#define TVM_USE_LIBBACKTRACE 0
/* Enable custom logging - this will cause TVM to use a custom implementation
* of tvm::runtime::detail::LogMessage. We use this to pass TVM log messages to
* Android logcat.
Expand Down
2 changes: 1 addition & 1 deletion apps/android_deploy/app/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include $(config)

APP_STL := c++_static

APP_CPPFLAGS += -DTVM4J_ANDROID=1 -std=c++14 -Oz -frtti
APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DTVM4J_ANDROID=1 -std=c++14 -Oz -frtti
ifeq ($(USE_OPENCL), 1)
APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1
endif
2 changes: 1 addition & 1 deletion apps/android_deploy/app/src/main/jni/tvm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <fstream>

#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_BACKTRACE_DISABLED 1
#define TVM_USE_LIBBACKTRACE 0

#include "../src/runtime/c_runtime_api.cc"
#include "../src/runtime/cpu_device_api.cc"
Expand Down
2 changes: 1 addition & 1 deletion apps/android_rpc/app/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include $(config)
APP_ABI ?= armeabi-v7a arm64-v8a x86 x86_64 mips
APP_STL := c++_shared

APP_CPPFLAGS += -DTVM4J_ANDROID=1 -std=c++14 -Oz -frtti
APP_CPPFLAGS += -DDMLC_LOG_STACK_TRACE=0 -DTVM4J_ANDROID=1 -std=c++14 -Oz -frtti
ifeq ($(USE_OPENCL), 1)
APP_CPPFLAGS += -DTVM_OPENCL_RUNTIME=1
endif
Expand Down
2 changes: 1 addition & 1 deletion apps/android_rpc/app/src/main/jni/tvm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <fstream>

#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_BACKTRACE_DISABLED 1
#define TVM_USE_LIBBACKTRACE 0
/* Enable custom logging - this will cause TVM to use a custom implementation
* of tvm::runtime::detail::LogMessage. We use this to pass TVM log messages to
* Android logcat.
Expand Down
4 changes: 2 additions & 2 deletions apps/ios_rpc/tvmrpc.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
"DEBUG=1",
"$(inherited)",
"DMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>",
"TVM_BACKTRACE_DISABLED=1",
"TVM_USE_LIBBACKTRACE=0",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Expand Down Expand Up @@ -397,7 +397,7 @@
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DMLC_USE_LOGGING_LIBRARY=<tvm/runtime/logging.h>",
"TVM_BACKTRACE_DISABLED=1",
"TVM_USE_LIBBACKTRACE=0",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class TypeContext {
}
// try to allocate from parent's type table.
ICHECK_LT(parent_tindex, type_table_.size())
<< " skey= " << skey << "static_index=" << static_tindex;
<< " skey=" << skey << ", static_index=" << static_tindex;
TypeInfo& pinfo = type_table_[parent_tindex];
ICHECK_EQ(pinfo.index, parent_tindex);

Expand Down
2 changes: 0 additions & 2 deletions tests/lint/check_file_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@
# microTVM Virtual Machines
"apps/microtvm/reference-vm/zephyr/Vagrantfile",
"apps/microtvm/reference-vm/zephyr/base-box/Vagrantfile.packer-template",
# patch file for libbacktrace
"cmake/modules/libbacktrace_macos.patch",
}


Expand Down
9 changes: 7 additions & 2 deletions web/emcc/tvmjs_support.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@
* We do not need to link this file in standalone wasm.
*/

// configurations for the dmlc log.
// configurations for tvm logging
#define DMLC_LOG_CUSTOMIZE 0
#define DMLC_LOG_STACK_TRACE 0
#define DMLC_LOG_DEBUG 0
#define DMLC_LOG_NODATE 1
#define DMLC_LOG_FATAL_THROW 0
#define TVM_LOG_DEBUG 0
#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_BACKTRACE_DISABLED 1
#define TVM_USE_LIBBACKTRACE 0

#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/container.h>
Expand Down
9 changes: 7 additions & 2 deletions web/emcc/wasm_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
* \brief TVM wasm runtime library pack.
*/

// configurations for the dmlc log.
// configurations for tvm logging
#define DMLC_LOG_CUSTOMIZE 0
#define DMLC_LOG_STACK_TRACE 0
#define DMLC_LOG_DEBUG 0
#define DMLC_LOG_NODATE 1
#define DMLC_LOG_FATAL_THROW 0
#define TVM_LOG_DEBUG 0
#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_BACKTRACE_DISABLED 1
#define TVM_USE_LIBBACKTRACE 0

#include <tvm/runtime/c_runtime_api.h>
#include <tvm/runtime/logging.h>
Expand Down
5 changes: 4 additions & 1 deletion web/emcc/webgpu_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
* \brief WebGPU runtime based on the TVM JS.
*/

// configurations for tvm logging.
// configurations for tvm logging
#define TVM_LOG_DEBUG 0
#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_BACKTRACE_DISABLED 1
#define TVM_LOG_DEBUG 0
#define DMLC_USE_LOGGING_LIBRARY <tvm/runtime/logging.h>
#define TVM_USE_LIBBACKTRACE 0

#include <dmlc/thread_local.h>
#include <tvm/runtime/c_runtime_api.h>
Expand Down

0 comments on commit 63aa942

Please sign in to comment.