-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
### Ticket #14974 ### Problem description Extensions to `Tensor` creation APIs to support `MeshDevice`. ### What's changed Overload for `ttnn::empty` to support `MeshDevice`. The tensor distribution currently uses replication strategy. Minor formatting fixes / code comments. ### Checklist - [x] Post commit CI passes - [ ] Blackhole Post commit (if applicable) - [ ] Model regression CI testing passes (if applicable) - [ ] Device performance regression CI testing passes (if applicable) - [x] New/Existing tests provide coverage for changes
- Loading branch information
1 parent
75d7107
commit eacb47a
Showing
12 changed files
with
146 additions
and
47 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
49 changes: 49 additions & 0 deletions
49
tests/ttnn/unit_tests/gtests/tensor/test_create_tensor_multi_device.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,49 @@ | ||
|
||
// SPDX-FileCopyrightText: © 2023 Tenstorrent Inc. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <variant> | ||
|
||
#include "buffers/buffer_constants.hpp" | ||
#include "gtest/gtest.h" | ||
#include "ttnn/cpp/ttnn/operations/creation.hpp" | ||
#include "ttnn/cpp/ttnn/tensor/types.hpp" | ||
#include "ttnn/distributed/api.hpp" | ||
#include "ttnn/tensor/enum_types.hpp" | ||
#include "ttnn_test_fixtures.hpp" | ||
|
||
namespace ttnn::distributed::test { | ||
namespace { | ||
|
||
using ::tt::tt_metal::BufferType; | ||
using ::tt::tt_metal::Layout; | ||
using ::tt::tt_metal::MemoryConfig; | ||
using ::tt::tt_metal::StorageType; | ||
using ::tt::tt_metal::TensorMemoryLayout; | ||
|
||
class MultiDeviceTensorCreationTest : public T3kMultiDeviceFixture, public ::testing::WithParamInterface<bool> {}; | ||
|
||
TEST_P(MultiDeviceTensorCreationTest, CreateEmpty) { | ||
MeshDevice* mesh_device = this->mesh_device_.get(); | ||
mesh_device->enable_async(GetParam()); | ||
|
||
const auto mesh_replicated_tensor = ttnn::empty( | ||
ttnn::Shape(std::array<uint32_t, 2>{32, 32}), | ||
DataType::BFLOAT16, | ||
Layout::ROW_MAJOR, | ||
mesh_device, | ||
MemoryConfig{TensorMemoryLayout::INTERLEAVED, BufferType::DRAM, std::nullopt}); | ||
|
||
EXPECT_EQ(mesh_replicated_tensor.storage_type(), StorageType::MULTI_DEVICE); | ||
EXPECT_EQ(mesh_replicated_tensor.get_workers().size(), mesh_device->num_devices()); | ||
|
||
const auto distributed_tensor_config = get_distributed_tensor_config_from_tensor(mesh_replicated_tensor); | ||
|
||
EXPECT_TRUE(std::holds_alternative<ReplicateTensor>(distributed_tensor_config)); | ||
} | ||
|
||
INSTANTIATE_TEST_SUITE_P(AllTests, MultiDeviceTensorCreationTest, ::testing::Bool()); | ||
|
||
} // namespace | ||
} // namespace ttnn::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