Skip to content

Commit

Permalink
Dummy func -> CSourceModule with empty code str
Browse files Browse the repository at this point in the history
  • Loading branch information
kumasento committed Feb 11, 2020
1 parent d6301d6 commit b3b15f2
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/relay/backend/build_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@
#include <tvm/tir/ir_pass.h>
#include <memory>

#include "../../target/source/codegen_source_base.h"
#include "utils.h"

namespace tvm {
namespace relay {
namespace backend {

using tir::LoweredFunc;
using tir::Stmt;
using tir::MakeAPI;
using tir::EvaluateNode;

using TargetsMap = Map<tvm::Integer, tvm::Target>;
using namespace tvm::relay::transform;
Expand Down Expand Up @@ -442,19 +440,14 @@ class RelayBuildModule : public runtime::ModuleNode {

auto lowered_funcs = graph_codegen_->GetLoweredFunc();
if (lowered_funcs.size() == 0) {
LOG(WARNING) << "No lowered funcs exist in the compiled module, "
<< "a dummy function \"__dummy__\" will be created.";
Stmt body = EvaluateNode::make(0);
Array<ObjectRef> api_args;
auto dummy_func = MakeAPI(body, "__dummy__", api_args, 0, false);
lowered_funcs.Set("llvm", Array<LoweredFunc>({dummy_func}));
ret_.mod = tvm::codegen::CSourceModuleCreate(std::string(), std::string());
} else {
ret_.mod = tvm::build(
lowered_funcs,
target_host_,
BuildConfig::Current());
}

ret_.mod = tvm::build(
lowered_funcs,
target_host_,
BuildConfig::Current());

Array<tvm::runtime::Module> ext_mods = graph_codegen_->GetExternalModules();
if (!ext_mods.empty()) {
CHECK(lowered_funcs.size() > 0 || ext_mods.size() == 1)
Expand Down

0 comments on commit b3b15f2

Please sign in to comment.