From 5c5e7e33eb682743c398a208b99219594d08421a Mon Sep 17 00:00:00 2001 From: Stanislav Minakov Date: Thu, 12 Dec 2024 20:04:10 +0000 Subject: [PATCH] Fix failing test --- .../ttnn/operations/core/to_layout/to_layout_op.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ttnn/cpp/ttnn/operations/core/to_layout/to_layout_op.cpp b/ttnn/cpp/ttnn/operations/core/to_layout/to_layout_op.cpp index 6f14fbb0e4d..696ac33d2ec 100644 --- a/ttnn/cpp/ttnn/operations/core/to_layout/to_layout_op.cpp +++ b/ttnn/cpp/ttnn/operations/core/to_layout/to_layout_op.cpp @@ -44,10 +44,15 @@ inline bool use_multicore_device_tilize( bool requires_padding_change(const ttnn::Tensor& tensor, ttnn::Layout layout) { auto tile = tensor.get_tensor_spec().tile(); - TensorSpec upd_spec( - tensor.logical_shape(), + if (layout == Layout::ROW_MAJOR) { + // There shouldn't be extra paddings for Row Major layout + return tensor.logical_shape() != tensor.padded_shape(); + } + // It's okay for conversion to tile layout to preserve arbitrary padding as long as it satisfies the alignment + TensorSpec padded_spec( + tensor.padded_shape(), TensorLayout(tensor.dtype(), PageConfig(layout, std::move(tile)), tensor.memory_config())); - return tensor.get_padded_shape().volume() != upd_spec.padded_shape().volume(); + return tensor.get_padded_shape() != padded_spec.padded_shape(); } template