-
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.
#13454: namespace tt_metal::distributed; add scaffolding for C++ tests
- Loading branch information
Showing
24 changed files
with
147 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,3 +129,4 @@ ttnn/ttnn/runtime | |
|
||
ClangBuildAnalyzer.ini | ||
ttnn/ttnn/.rpath_checked__ttnn | ||
Testing |
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,2 @@ | ||
add_subdirectory(distributed) | ||
add_subdirectory(tt_metal) |
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 @@ | ||
set(UNIT_TESTS_DISTRIBUTED_SRC | ||
${CMAKE_CURRENT_SOURCE_DIR}/test_distributed.cpp | ||
) | ||
|
||
add_executable(distributed_unit_tests ${UNIT_TESTS_DISTRIBUTED_SRC}) | ||
target_link_libraries(distributed_unit_tests PRIVATE tt_metal test_common_libs) | ||
|
||
target_include_directories(distributed_unit_tests PRIVATE | ||
${PROJECT_SOURCE_DIR}/tt_metal | ||
${PROJECT_SOURCE_DIR}/tt_metal/distributed | ||
) | ||
|
||
set_target_properties(distributed_unit_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/test/tt_metal/distributed) | ||
|
||
gtest_discover_tests(distributed_unit_tests) |
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,45 @@ | ||
// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include "tt_metal/distributed/mesh_device.hpp" | ||
#include "tt_metal/distributed/mesh_device_view.hpp" | ||
#include "tt_metal/llrt/tt_cluster.hpp" | ||
|
||
namespace tt::tt_metal::distributed::test { | ||
|
||
static inline void skip_test_if_not_t3000() { | ||
auto slow_dispatch = getenv("TT_METAL_SLOW_DISPATCH_MODE"); | ||
const auto arch = tt::Cluster::instance().arch(); | ||
const size_t num_devices = tt::Cluster::instance().number_of_devices(); | ||
|
||
if (slow_dispatch) { | ||
GTEST_SKIP() << "Skipping Multi-Device test suite, since it can only be run in Fast Dispatch Mode."; | ||
} | ||
if (num_devices < 8 or arch != tt::ARCH::WORMHOLE_B0) { | ||
GTEST_SKIP() << "Skipping T3K Multi-Device test suite on non T3K machine."; | ||
} | ||
} | ||
class MeshDevice_T3000 : public ::testing::Test { | ||
protected: | ||
void SetUp() override { | ||
skip_test_if_not_t3000(); | ||
this->mesh_device_ = MeshDevice::create(MeshDeviceConfig(MeshShape(2, 4))); | ||
} | ||
|
||
void TearDown() override { | ||
mesh_device_->close_devices(); | ||
mesh_device_.reset(); | ||
} | ||
std::shared_ptr<MeshDevice> mesh_device_; | ||
}; | ||
|
||
TEST_F(MeshDevice_T3000, SimpleMeshDeviceTest) { | ||
EXPECT_EQ(mesh_device_->num_devices(), 8); | ||
EXPECT_EQ(mesh_device_->num_rows(), 2); | ||
EXPECT_EQ(mesh_device_->num_cols(), 4); | ||
} | ||
|
||
} // namespace tt::tt_metal::distributed::test |
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
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
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
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,18 @@ | ||
// SPDX-FileCopyrightText: © 2024 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include "tt_metal/distributed/mesh_device.hpp" | ||
|
||
namespace ttnn::distributed::types { | ||
|
||
using MeshShape = tt::tt_metal::distributed::MeshShape; | ||
using DeviceIds = tt::tt_metal::distributed::DeviceIds; | ||
using MeshDevice = tt::tt_metal::distributed::MeshDevice; | ||
using MeshDeviceView = tt::tt_metal::distributed::MeshDeviceView; | ||
using MeshType = tt::tt_metal::distributed::MeshType; | ||
using MeshDeviceConfig = tt::tt_metal::distributed::MeshDeviceConfig; | ||
|
||
} // namespace ttnn::distributed |
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
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
Oops, something went wrong.