This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new a8d1055  [FIX] Fix clang12 warnings (#7593)
a8d1055 is described below

commit a8d1055208bd4412018685609c81bb76e107aeef
Author: Tristan Konolige <[email protected]>
AuthorDate: Mon Mar 8 21:40:57 2021 -0800

    [FIX] Fix clang12 warnings (#7593)
---
 src/relay/backend/contrib/tensorrt/codegen.cc | 3 +++
 src/runtime/contrib/cublas/cublas.cc          | 4 ++--
 src/runtime/contrib/cublas/cublas_utils.cc    | 2 +-
 src/runtime/contrib/json/json_runtime.h       | 6 +++---
 src/runtime/micro/micro_session.cc            | 2 +-
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/relay/backend/contrib/tensorrt/codegen.cc 
b/src/relay/backend/contrib/tensorrt/codegen.cc
index cb64833..059dbc1 100644
--- a/src/relay/backend/contrib/tensorrt/codegen.cc
+++ b/src/relay/backend/contrib/tensorrt/codegen.cc
@@ -156,6 +156,9 @@ class TensorRTJSONSerializer : public 
backend::contrib::JSONSerializer {
         // with slice_mode = "size", attrs->end_value mean the size of the 
slice
         int end_value = attrs->end.value()[i].as<IntImmNode>()->value;
         size_value = (end_value == -1) ? ishape[i] - begin_value : end_value;
+      } else {
+        LOG(FATAL) << "Unexpected slice_mode " << attrs->slice_mode << ", 
expected end or size";
+        throw;
       }
       ICHECK_GT(size_value, 0);
       size.push_back(std::to_string(size_value));
diff --git a/src/runtime/contrib/cublas/cublas.cc 
b/src/runtime/contrib/cublas/cublas.cc
index ce69d4c..b12992f 100644
--- a/src/runtime/contrib/cublas/cublas.cc
+++ b/src/runtime/contrib/cublas/cublas.cc
@@ -167,7 +167,7 @@ inline void CallLtIgemm(TVMArgs args, TVMRetValue* ret, 
cublasLtHandle_t hdl) {
   ICHECK(CheckMixPrecisionType(A->dtype, C->dtype)) << "Unsupported data type";
   int32_t alpha = args.size() > 5 ? args[5] : 1;
   int32_t beta = args.size() > 6 ? args[6] : 0;
-  cublasLtMatrixLayout_t Adesc = NULL, Bdesc = NULL, Cdesc = NULL;
+  cublasLtMatrixLayout_t Adesc = nullptr, Bdesc = nullptr, Cdesc = nullptr;
   auto A_data = reinterpret_cast<void*>(static_cast<char*>(A->data) + 
A->byte_offset);
   auto B_data = reinterpret_cast<void*>(static_cast<char*>(B->data) + 
B->byte_offset);
   auto C_data = reinterpret_cast<void*>(static_cast<char*>(C->data) + 
C->byte_offset);
@@ -204,7 +204,7 @@ inline void CallLtIgemm(TVMArgs args, TVMRetValue* ret, 
cublasLtHandle_t hdl) {
                                                       &order_COL32, 
sizeof(order_COL32)));
 
   CHECK_CUBLAS_ERROR(cublasLtMatmul(hdl, operationDesc, &alpha, B_data, Adesc, 
A_data, Bdesc, &beta,
-                                    C_data, Cdesc, C_data, Cdesc, NULL, NULL, 
0, 0));
+                                    C_data, Cdesc, C_data, Cdesc, nullptr, 
nullptr, 0, nullptr));
 }
 #endif
 
diff --git a/src/runtime/contrib/cublas/cublas_utils.cc 
b/src/runtime/contrib/cublas/cublas_utils.cc
index d4ec087..4b4a1b7 100644
--- a/src/runtime/contrib/cublas/cublas_utils.cc
+++ b/src/runtime/contrib/cublas/cublas_utils.cc
@@ -35,7 +35,7 @@ CuBlasThreadEntry::CuBlasThreadEntry() { 
CHECK_CUBLAS_ERROR(cublasCreate(&handle
 CuBlasThreadEntry::~CuBlasThreadEntry() {
   if (handle) {
     cublasDestroy(handle);
-    handle = 0;
+    handle = nullptr;
   }
 }
 
diff --git a/src/runtime/contrib/json/json_runtime.h 
b/src/runtime/contrib/json/json_runtime.h
index 3ae652c..55f1663 100644
--- a/src/runtime/contrib/json/json_runtime.h
+++ b/src/runtime/contrib/json/json_runtime.h
@@ -55,7 +55,7 @@ class JSONRuntimeBase : public ModuleNode {
     LoadGraph(graph_json_);
   }
 
-  const char* type_key() const { return "json"; }
+  const char* type_key() const override { return "json"; }
 
   /*! \brief Initialize a specific json runtime. */
   virtual void Init(const Array<NDArray>& consts) = 0;
@@ -69,7 +69,7 @@ class JSONRuntimeBase : public ModuleNode {
    * \param sptr_to_self The pointer to the module node.
    * \return The packed function.
    */
-  virtual PackedFunc GetFunction(const std::string& name, const 
ObjectPtr<Object>& sptr_to_self) {
+  PackedFunc GetFunction(const std::string& name, const ObjectPtr<Object>& 
sptr_to_self) override {
     if (name == "get_symbol") {
       return PackedFunc(
           [sptr_to_self, this](TVMArgs args, TVMRetValue* rv) { *rv = 
this->symbol_name_; });
@@ -98,7 +98,7 @@ class JSONRuntimeBase : public ModuleNode {
     }
   }
 
-  virtual void SaveToBinary(dmlc::Stream* stream) {
+  void SaveToBinary(dmlc::Stream* stream) override {
     // Save the symbol
     stream->Write(symbol_name_);
     // Save the graph
diff --git a/src/runtime/micro/micro_session.cc 
b/src/runtime/micro/micro_session.cc
index f26a717..6c0d0c4 100644
--- a/src/runtime/micro/micro_session.cc
+++ b/src/runtime/micro/micro_session.cc
@@ -172,7 +172,7 @@ class MicroTransportChannel : public RPCChannel {
     // confusion.
     unsigned int seed = random_seed.load();
     if (seed == 0) {
-      seed = (unsigned int)time(NULL);
+      seed = (unsigned int)time(nullptr);
     }
     uint8_t initial_nonce = 0;
     for (int i = 0; i < kNumRandRetries && initial_nonce == 0; ++i) {

Reply via email to