-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 4073: Fix for host-side hanging when an invalid DPRINT WAIT command is running on the device. #4103
Merged
Merged
Issue 4073: Fix for host-side hanging when an invalid DPRINT WAIT command is running on the device. #4103
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "debug/dprint.h" | ||
#include "debug/dprint_test_common.h" | ||
|
||
/* | ||
* Test kernel that wait for a signal that never raises. | ||
*/ | ||
|
||
void kernel_main() { | ||
DPRINT << WAIT{1}; | ||
print_test_data(); | ||
} |
59 changes: 59 additions & 0 deletions
59
tests/tt_metal/tt_metal/unit_tests_fast_dispatch/dprint/test_print_hanging.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "command_queue_fixture.hpp" | ||
#include "common/bfloat16.hpp" | ||
#include "impl/debug/dprint_server.hpp" | ||
#include "gtest/gtest.h" | ||
#include "test_utils.hpp" | ||
#include "tt_metal/detail/tt_metal.hpp" | ||
#include "tt_metal/host_api.hpp" | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////// | ||
// A test for checking that we can handle an invalid WAIT command. | ||
////////////////////////////////////////////////////////////////////////////////////////// | ||
using namespace tt; | ||
using namespace tt::tt_metal; | ||
|
||
const std::string golden_output = | ||
R"(DPRINT server timed out on core (1,1) riscv 4, waiting on a RAISE signal: 1 | ||
)"; | ||
|
||
TEST_F(CommandQueueWithDPrintFixture, TestPrintHanging) { | ||
// Device already set up by gtest fixture. | ||
Device *device = this->device_; | ||
|
||
// Set up program and command queue | ||
CommandQueue& cq = *tt::tt_metal::detail::GLOBAL_CQ; | ||
Program program = Program(); | ||
|
||
// Run a kernel that just waits on a signal that never comes (BRISC only). | ||
constexpr CoreCoord core = {0, 0}; // Print on first core only | ||
KernelHandle brisc_print_kernel_id = CreateKernel( | ||
program, | ||
"tests/tt_metal/tt_metal/test_kernels/misc/print_hang.cpp", | ||
core, | ||
DataMovementConfig{.processor = DataMovementProcessor::RISCV_0, .noc = NOC::RISCV_0_default} | ||
); | ||
|
||
// 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( | ||
FilesMatchesString( | ||
CommandQueueWithDPrintFixture::dprint_file_name, | ||
golden_output | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot do this since it's not like we have one Finish at the end of every run. We can call finish an arbitrary amount of times, and if we break and continue enqueueing more commands, this could lead to undefined behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed up a fix to change this to a throw (throw here instead of in the print server so that the exception comes from Finish()), which should still work for CI (running that now).