Skip to content

Commit

Permalink
[Minor] Fix Clang compilation warning in fuse_tir.cc and codegen_c_ho…
Browse files Browse the repository at this point in the history
…st.cc (apache#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]                ^
```
  • Loading branch information
Hzfengsy authored Feb 3, 2024
1 parent 6ab99df commit a3ec544
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/relax/transform/fuse_tir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/target/source/codegen_c_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/target/source/codegen_c_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a3ec544

Please sign in to comment.