Skip to content

Commit

Permalink
#4073: Throw instead of continue on DPRINT WAIT hang
Browse files Browse the repository at this point in the history
  • Loading branch information
tt-dma committed Dec 11, 2023
1 parent 3bc5d4d commit 6702969
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,17 @@ TEST_F(CommandQueueWithDPrintFixture, TestPrintHanging) {
DataMovementConfig{.processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default}
);

// Run the program
// Run the program, we expect it to throw on waiting for CQ to finish
EnqueueProgram(cq, program, false);
try {
Finish(cq);
tt_await_debug_print_server();
} catch (std::runtime_error& e) {
const string expected = "Command Queue could not finish: device hang due to unanswered DPRINT WAIT.";
const string error = string(e.what());
log_info(tt::LogTest, "Caught exception (one is expected in this test): {}", error);
EXPECT_TRUE(error.find(expected) != string::npos);
}

// Check the print log against golden output.
EXPECT_TRUE(
Expand Down
4 changes: 2 additions & 2 deletions tt_metal/impl/dispatch/command_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,9 @@ void CommandQueue::finish() {
tt::Cluster::instance().read_sysmem(&finish, 4, HOST_CQ_FINISH_PTR, 0);

// There's also a case where the device can be hung due to an unanswered DPRINT WAIT and
// a full print buffer. Poll the print server for this case and finish if it happens.
// a full print buffer. Poll the print server for this case and throw if it happens.
if (tt_print_hang_detected()) {
break;
TT_THROW("Command Queue could not finish: device hang due to unanswered DPRINT WAIT.");
}
} while (finish != 1);

Expand Down

0 comments on commit 6702969

Please sign in to comment.