Skip to content

Commit

Permalink
remove unrelated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hypercubestart committed Jun 22, 2020
1 parent 38558f1 commit ada67f2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
5 changes: 0 additions & 5 deletions include/tvm/ir/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ class IRModuleNode : public Object {
*/
TVM_DLL void AddUnchecked(const GlobalVar& var, const BaseFunc& func);

/*!
* \brief Infer the type of all global functions
*/
TVM_DLL void Check();

/*!
* \brief Add a type-level definition to the global environment.
* \param var The var of the global type definition.
Expand Down
39 changes: 0 additions & 39 deletions src/ir/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,45 +236,6 @@ void IRModuleNode::AddUnchecked(const GlobalVar& var, const BaseFunc& func) {
global_var_map_.Set(var->name_hint, var);
}

void IRModuleNode::Check() {
const auto& mod = GetRef<IRModule>(this);
const auto& globalvars = this->GetGlobalVars();

// first pass: fill in type for all functions
for (const auto& var : globalvars) {
relay::Function f = Downcast<relay::Function>(this->Lookup(var));
auto func = Downcast<relay::Function>(relay::DeDup(std::move(f)));

auto fv = relay::FreeVars(func);
auto ftv = relay::FreeTypeVars(func, mod);
if (fv.size() != 0) {
LOG(WARNING) << "There are free variables: " << fv << " in function: " << AsText(func, false)
<< std::endl;
}
if (ftv.size() != 0) {
LOG(WARNING) << "There are free type variables: " << ftv
<< " in function: " << AsText(func, false) << std::endl;
}
auto func_copy = relay::Function(concat(func->params, fv), func->body, func->ret_type,
concat(func->type_params, ftv), func->attrs);

func_copy->checked_type_ = func_copy->func_type_annotation();
mod->AddUnchecked(var, func_copy);
}

// second pass: type inference on every function
for (const auto& var : globalvars) {
auto func = Downcast<relay::Function>(this->Lookup(var));
relay::Function checked_func = InferType(func, mod, var);

Type type = checked_func->checked_type();
CHECK(type.as<relay::IncompleteTypeNode>() == nullptr) << "NULL";

var->checked_type_ = type;
mod->AddUnchecked(var, func);
}
}

void IRModuleNode::RegisterConstructors(const GlobalTypeVar& var, const TypeData& type) {
// We hash the global type var name to use as a globally unique prefix for tags.
// The hash will be used as the most significant byte of the tag, with the index of
Expand Down

0 comments on commit ada67f2

Please sign in to comment.