Skip to content

Commit b2fa508

Browse files
Martin Yuanfacebook-github-bot
authored andcommitted
Add operator name and arg type in Error message (#188)
Summary: Pull Request resolved: #188 Operator name would be useful for debugging purpose. Add it in the error message. Reviewed By: larryliu0820 Differential Revision: D48828789 fbshipit-source-id: caa845c4d16207d01912da4e2923762aecd34dd9
1 parent d2e6750 commit b2fa508

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

runtime/executor/method.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,16 +790,27 @@ Error Method::execute_instruction() {
790790
// TODO(T147221312): Also expose the temp allocator and tensor resizer
791791
// via the context.
792792
KernelRuntimeContext context;
793-
chain.kernels_[step_state_.instr_idx](
794-
context, chain.argument_lists_[step_state_.instr_idx].data());
793+
auto args = chain.argument_lists_[step_state_.instr_idx];
794+
chain.kernels_[step_state_.instr_idx](context, args.data());
795795
Error err = context.failure_state();
796796
if (err != Error::Ok) {
797+
auto op_index = instruction->instr_args_as_KernelCall()->op_index();
798+
auto op = serialization_plan_->operators()->Get(op_index);
797799
ET_LOG(
798800
Error,
799-
"KernelCall failed at instruction %zu:%zu: 0x%x",
801+
"KernelCall failed at instruction %zu:%zu in operator %s.%s: 0x%x",
800802
step_state_.chain_idx,
801803
step_state_.instr_idx,
804+
op->name()->c_str(),
805+
op->overload()->c_str(),
802806
(unsigned int)err);
807+
for (size_t i = 0; i < args.size(); ++i) {
808+
ET_LOG(
809+
Error,
810+
"arg %u with type id %u",
811+
(unsigned int)i,
812+
(unsigned int)args[i]->tag);
813+
}
803814
// TODO(T153804650): Consider logging the EValues to help with
804815
// debugging. This is a failure path, and it doesn't matter if it's a
805816
// little slow. Do the same for DelegateCall errors.

0 commit comments

Comments
 (0)