Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 95242d8
Author: Masahiro Masuda <masahi129@gmail.com>
Date:   Thu May 27 15:45:19 2021 +0900

    Add function attribute for shape func for profiling
  • Loading branch information
masahi committed May 27, 2021
1 parent b8ede24 commit 667011f
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 667011f

Please sign in to comment.