Skip to content

Commit

Permalink
Add function attribute for shape func for profiling (apache#8148)
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi authored and trevor-m committed Jun 17, 2021
1 parent cde63f3 commit e5d269e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/relay/backend/vm/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ class VMFunctionCompiler : ExprFunctor<void(const Expr& expr)> {
argument_registers.push_back(reg->second);
}

// Extract functions attrs
op_attrs[op_index] = func->attrs->dict;

Emit(Instruction::InvokePacked(op_index, argument_registers.size(), outputs.size(),
argument_registers));
}
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/vm/profiler/vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ void VirtualMachineDebug::InvokePacked(Index packed_index, const PackedFunc& fun
}

std::unordered_map<std::string, ObjectRef> metrics;

ICHECK(exec_->op_attrs.find(packed_index) != exec_->op_attrs.end())
<< packed_index_map_[packed_index] << " not found in op attrs";

auto& op_attrs = exec_->op_attrs.at(packed_index);
for (auto p : op_attrs) {
if (std::string(p.first).find("layout") != std::string::npos) {
Expand Down

0 comments on commit e5d269e

Please sign in to comment.