Skip to content

Commit ae1c13e

Browse files
committed
Fix debug printing
1 parent 141ad48 commit ae1c13e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/glow/Backends/Interpreter/InterpreterNodes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,10 +1197,10 @@ void Interpreter::fwdDeallocActivationInst(bool isTrain,
11971197
/// tensor.
11981198
void Interpreter::fwdDebugPrintInst(bool isTrain, const DebugPrintInst *I) {
11991199
auto *V = I->getSrc();
1200+
llvm::outs() << I->getName() << ": ";
12001201
// Dump the content of a value.
12011202
V->dump();
12021203
llvm::outs() << "\n";
1203-
auto WH = getWeightHandle(V);
1204-
WH.dump();
1204+
dumpImpl(getTensor(V));
12051205
llvm::outs() << "\n";
12061206
}

src/glow/Optimizer/IROptimizer.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,19 +884,24 @@ static void performDebugInstrumentation(Module &M) {
884884
it = next;
885885
continue;
886886
}
887+
auto instrName = (*it)->getName();
887888
for (auto const &Op : (*it)->getOperands()) {
888889
// Dump inputs of the current instruction before the instruction.
889890
if (Op.second != OperandKind::Out) {
890-
std::string name = "print_input_";
891+
std::string name = "debug_print.before.";
891892
name += Op.first->getName();
893+
name += ".";
894+
name += instrName;
892895
auto *dumpInstr = new DebugPrintInst(&M, name, Op.first);
893896
M.insertInstruction(it, dumpInstr);
894897
}
895898

896899
// Dump outputs of the current instruction after the instruction.
897900
if (Op.second != OperandKind::In) {
898-
std::string name = "print_output_";
901+
std::string name = "debug_print.after.";
899902
name += Op.first->getName();
903+
name += ".";
904+
name += instrName;
900905
auto *dumpInstr = new DebugPrintInst(&M, name, Op.first);
901906
M.insertInstruction(next, dumpInstr);
902907
}

0 commit comments

Comments
 (0)