Skip to content

Commit

Permalink
Fixing tests and addressing comments
Browse files Browse the repository at this point in the history
Change-Id: I00c79d65a6a4915b5cf6c0e522c30d3cf5d30710
  • Loading branch information
Giuseppe Rossini committed May 11, 2021
1 parent 654c43f commit fcb2548
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion include/tvm/runtime/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ constexpr const char* tvm_param_prefix = "__tvm_param__";
/*! \brief A PackedFunc that looks up linked parameters by storage_id. */
constexpr const char* tvm_lookup_linked_param = "_lookup_linked_param";
/*! \brief The main AOT executor function */
constexpr const char* tvm_run_func_prefix = "run_func";
constexpr const char* tvm_run_func_suffix = "run_func";
} // namespace symbol

// implementations of inline functions.
Expand Down
4 changes: 0 additions & 4 deletions include/tvm/tir/builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ TVM_DLL const Op& tvm_stack_make_array();
*/
TVM_DLL const Op& tvm_call_packed();

// This achieve the same of a packed call, but with an extern call
// directly to the operator
TVM_DLL const Op& tvm_call_unpacked();

/*!
* \brief See pesudo code
*
Expand Down
6 changes: 3 additions & 3 deletions src/relay/backend/aot_executor_codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ class AOTExecutorCodegen : public ExprVisitor {
// Define the PrimFunc attributes
Map<String, ObjectRef> dict_attrs;
String run_func_name =
runtime::get_name_mangled(mod_name_, runtime::symbol::tvm_run_func_prefix);
runtime::get_name_mangled(mod_name_, runtime::symbol::tvm_run_func_suffix);
dict_attrs.Set("global_symbol", run_func_name);

// Make the PrimFunc
Expand Down Expand Up @@ -640,10 +640,10 @@ class AOTExecutorCodegen : public ExprVisitor {
auto target_host_str = target_host_->str();
if (ret.lowered_funcs.find(target_host_str) != ret.lowered_funcs.end()) {
ret.lowered_funcs[target_host_str]->Add(
GlobalVar(::tvm::runtime::symbol::tvm_run_func_prefix), prim_func);
GlobalVar(::tvm::runtime::symbol::tvm_run_func_suffix), prim_func);
} else {
Map<GlobalVar, BaseFunc> symbol_map;
symbol_map.Set(GlobalVar(::tvm::runtime::symbol::tvm_run_func_prefix), prim_func);
symbol_map.Set(GlobalVar(::tvm::runtime::symbol::tvm_run_func_suffix), prim_func);
ret.lowered_funcs.Set(target_host_str, IRModule(symbol_map));
}
ret.function_metadata = std::move(function_metadata_);
Expand Down
2 changes: 1 addition & 1 deletion src/target/source/codegen_c_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ runtime::Module BuildCHost(IRModule mod, Target target) {
// symbols are available to tvm_run_func
auto fun_name = std::string(kv.first->name_hint);
const bool is_aot_executor_fn =
(fun_name.rfind(::tvm::runtime::symbol::tvm_run_func_prefix) != std::string::npos);
(fun_name.rfind(::tvm::runtime::symbol::tvm_run_func_suffix) != std::string::npos);

if (is_aot_executor_fn) {
aot_executor_fn = Downcast<PrimFunc>(kv.second);
Expand Down
2 changes: 1 addition & 1 deletion src/target/source/source_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class CSourceCrtMetadataModuleNode : public runtime::ModuleNode {
}

void GenerateAOTDescriptor() {
const std::string run_func = ::tvm::runtime::symbol::tvm_run_func_prefix;
const std::string run_func = ::tvm::runtime::symbol::tvm_run_func_suffix;
const std::string run_func_mangled = runtime::get_name_mangled(metadata_->mod_name, run_func);
const std::string network_mangled = runtime::get_name_mangled(metadata_->mod_name, "network");
code_ << "#include \"tvm/runtime/crt/internal/aot_executor/aot_executor.h\"\n";
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/relay_build_module_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ TEST(Relay, BuildModule) {
targets.Set(0, llvm_tgt);
auto relay_mod = tvm::IRModule::FromExpr(func);
ICHECK(relay_mod.defined()) << "Module must be defined";
build_f(relay_mod, targets, llvm_tgt, runtime::kTvmExecutorGraph);
build_f(relay_mod, targets, llvm_tgt, runtime::kTvmExecutorGraph, "");
std::string json = json_f();
tvm::runtime::Module mod = mod_f();
// run
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/utvm_runtime_standalone_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ TEST(MicroStandaloneRuntime, BuildModule) {

Target llvm_tgt = Target("llvm");
targets.Set(0, llvm_tgt);
build_f(func, targets, llvm_tgt, runtime::kTvmExecutorGraph);
build_f(func, targets, llvm_tgt, runtime::kTvmExecutorGraph, "");
std::string json = json_f();
tvm::runtime::Module mod = mod_f();
std::string o_fname = std::tmpnam(nullptr);
Expand Down

0 comments on commit fcb2548

Please sign in to comment.