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

syfeng 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 a3ec544124 [Minor] Fix Clang compilation warning in fuse_tir.cc and 
codegen_c_host.cc (#16511)
a3ec544124 is described below

commit a3ec544124fc882e8933568fc3256788cf3a9dad
Author: Siyuan Feng <[email protected]>
AuthorDate: Sat Feb 3 22:25:13 2024 +0800

    [Minor] Fix Clang compilation warning in fuse_tir.cc and codegen_c_host.cc 
(#16511)
    
    The original warning is:
    ```
    [build] /Users/syfeng/tvm/src/relax/transform/fuse_tir.cc:685:48: warning: 
lambda capture 'param' is not used [-Wunused-lambda-capture]
    [build]       auto unify_name_hints = [this, &buffer, &param]() {
    [build]                                             ~~~^~~~~
    
    [build] /Users/syfeng/tvm/src/target/source/codegen_c_host.h:47:8: warning: 
'tvm::codegen::CodeGenCHost::AddFunction' hides overloaded virtual function 
[-Woverloaded-virtual]
    [build]   void AddFunction(const GlobalVar& gvar, const PrimFunc& f, bool 
emit_fwd_func_decl = false);
    [build]        ^
    [build] /Users/syfeng/tvm/src/target/source/codegen_c.h:86:16: note: hidden 
overloaded virtual function 'tvm::codegen::CodeGenC::AddFunction' declared 
here: different number of parameters (2 vs 3)
    [build]   virtual void AddFunction(const GlobalVar& gvar, const PrimFunc& 
func);
    [build]                ^
    ```
---
 src/relax/transform/fuse_tir.cc     | 2 +-
 src/target/source/codegen_c_host.cc | 4 ++++
 src/target/source/codegen_c_host.h  | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/relax/transform/fuse_tir.cc b/src/relax/transform/fuse_tir.cc
index fc3d79ae62..1c25229d88 100644
--- a/src/relax/transform/fuse_tir.cc
+++ b/src/relax/transform/fuse_tir.cc
@@ -682,7 +682,7 @@ class FusedTIRConstructor : public ExprVisitor {
       const tir::Var& param = output_params[i];
       const tir::Buffer& buffer = func->buffer_map.at(param);
 
-      auto unify_name_hints = [this, &buffer, &param]() {
+      auto unify_name_hints = [this, &buffer]() {
         String base_name = buffer->name;
         String unique_name = base_name + "_intermediate";
         size_t unique_id = 0;
diff --git a/src/target/source/codegen_c_host.cc 
b/src/target/source/codegen_c_host.cc
index caef43e8af..d16d749e9b 100644
--- a/src/target/source/codegen_c_host.cc
+++ b/src/target/source/codegen_c_host.cc
@@ -75,6 +75,10 @@ void CodeGenCHost::InitGlobalContext() {
 
 void CodeGenCHost::DefineModuleName() { decl_stream << "void* " << 
module_name_ << " = NULL;\n"; }
 
+void CodeGenCHost::AddFunction(const GlobalVar& gvar, const PrimFunc& func) {
+  return AddFunction(gvar, func, /*emit_fwd_func_decl=*/false);
+}
+
 void CodeGenCHost::AddFunction(const GlobalVar& gvar, const PrimFunc& func,
                                bool emit_fwd_func_decl) {
   auto global_symbol = func->GetAttr<String>(tvm::attr::kGlobalSymbol);
diff --git a/src/target/source/codegen_c_host.h 
b/src/target/source/codegen_c_host.h
index aeba685f74..3e013492ef 100644
--- a/src/target/source/codegen_c_host.h
+++ b/src/target/source/codegen_c_host.h
@@ -44,7 +44,8 @@ class CodeGenCHost : public CodeGenC {
             const std::unordered_set<std::string>& devices);
 
   void InitGlobalContext();
-  void AddFunction(const GlobalVar& gvar, const PrimFunc& f, bool 
emit_fwd_func_decl = false);
+  void AddFunction(const GlobalVar& gvar, const PrimFunc& f) override;
+  void AddFunction(const GlobalVar& gvar, const PrimFunc& f, bool 
emit_fwd_func_decl);
   /*!
    * \brief Add functions from the (unordered) range to the current module in 
a deterministic
    * order. This helps with debugging.

Reply via email to