Skip to content

Commit

Permalink
Truncate function name (apache#2863)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajtulloch authored and wweic committed Mar 24, 2019
1 parent 7e12b28 commit 1330da0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/relay/backend/compile_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@ class ScheduleGetter :
}
readable_name_stream_ << "fused";
cache_node->outputs = this->VisitExpr(prim_func->body);
cache_node->func_name = readable_name_stream_.str();
auto candidate_name = readable_name_stream_.str();
constexpr static size_t kMaxFuncNameLength = 80;
if (candidate_name.size() > kMaxFuncNameLength) {
std::stringstream truncated_name;
truncated_name << candidate_name.substr(0, kMaxFuncNameLength);
truncated_name << "_" << std::hash<std::string>{}(candidate_name) << "_";
candidate_name = truncated_name.str();
}
cache_node->func_name = candidate_name;

CachedFunc cfunc(cache_node);
CHECK(master_op_.defined());
// Fusion over tupled results may leave identity relationships
Expand Down

0 comments on commit 1330da0

Please sign in to comment.