From cf2f0603b3547dc9a3d7241fec9e1d75100464c8 Mon Sep 17 00:00:00 2001 From: Jeffrey Jiang Date: Mon, 3 Mar 2025 21:54:18 +0000 Subject: [PATCH] simplify borrowed aggregate --- ttnn/cpp/ttnn/distributed/api.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ttnn/cpp/ttnn/distributed/api.cpp b/ttnn/cpp/ttnn/distributed/api.cpp index f682b1b810e..aafb81814a1 100644 --- a/ttnn/cpp/ttnn/distributed/api.cpp +++ b/ttnn/cpp/ttnn/distributed/api.cpp @@ -7,14 +7,17 @@ #include #include +#include "tt-metalium/assert.hpp" #include "tt-metalium/mesh_coord.hpp" #include "ttnn/tensor/tensor.hpp" +#include "ttnn/tensor/host_buffer/functions.hpp" #include "ttnn/tensor/tensor_utils.hpp" #include "ttnn/distributed/distributed_tensor_config.hpp" #include #include #include "ttnn/distributed/distributed_tensor_config.hpp" + using namespace tt::tt_metal; namespace ttnn::distributed { @@ -101,15 +104,9 @@ Tensor aggregate_as_tensor( specs.push_back(shard.get_tensor_spec()); auto visitor = tt::stl::overloaded{[&shard, &host_owned_buffers](const auto& buffer) -> OwnedBuffer { - using BufferType = std::decay_t; - using ValueType = typename BufferType::value_type; - - std::vector physical_data(buffer.begin(), buffer.end()); - - std::vector logical_data = - tensor_impl::decode_tensor_data(std::move(physical_data), shard.get_tensor_spec()); + using BorrowedBufferType = std::vector::value_type>; - return owned_buffer::create(std::move(logical_data)); + return owned_buffer::create(BorrowedBufferType(buffer.begin(), buffer.end())); }}; host_owned_buffers.push_back(std::visit(visitor, buffer));