-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#15290: Fix UAF issue with Singleton destruction order
- Decouple MeshDevice destruction from SystemMesh destruction. - Refactor SystemMesh to encapsulate internals in pImpl class. - Added a new test case for SystemMesh tear down with static mesh in the distributed tests.
- Loading branch information
Showing
4 changed files
with
254 additions
and
169 deletions.
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,32 @@ | ||
// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <cstddef> | ||
#include <ttnn/core.hpp> | ||
#include <ttnn/distributed/api.hpp> | ||
|
||
namespace ttnn::distributed::test { | ||
|
||
class DistributedTest : public ::testing::Test { | ||
protected: | ||
void SetUp() override {} | ||
void TearDown() override {} | ||
}; | ||
|
||
// Test that the mesh device is properly cleaned up when the program exits | ||
static std::shared_ptr<ttnn::MeshDevice> mesh; | ||
|
||
TEST_F(DistributedTest, TestSystemMeshTearDownWithoutClose_StaticMesh) { | ||
auto& sys = tt::tt_metal::distributed::SystemMesh::instance(); | ||
mesh = ttnn::distributed::open_mesh_device( | ||
{2, 4}, DEFAULT_L1_SMALL_SIZE, DEFAULT_TRACE_REGION_SIZE, 1, tt::tt_metal::DispatchCoreType::WORKER); | ||
|
||
auto [rows, cols] = sys.get_shape(); | ||
EXPECT_GT(rows, 0); | ||
EXPECT_GT(cols, 0); | ||
} | ||
|
||
} // namespace ttnn::distributed::test |
Oops, something went wrong.