Skip to content

Commit

Permalink
[runtime] setting ROW_MAJOR layout for empty op (#470)
Browse files Browse the repository at this point in the history
There seems to be an issue with implementation of `ttnn::empty()`
for `TILE` layout in cases where the tensor needs to be padded.

Switching to `ROW_MAJOR` as a workaround - since we are anyhow
not properly using tensors created via empty.
  • Loading branch information
pilkicTT authored Aug 23, 2024
1 parent 855d49e commit dbd6fd2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions runtime/lib/ttnn/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,13 @@ run(::tt::target::ttnn::EmptyOp const *op, ::ttnn::Device &device,
std::list<::ttnn::Tensor> &tensorPool) {
::ttnn::DataType targetDataTypeTTNN = utils::toTTNNDataType(
op->out()->desc()->layout()->memory_desc()->data_type());
// TODO: determine layout, hardcoding tile_layout for now
auto desiredLayout = ::ttnn::Layout::TILE;

// TODO: ttnn::empty doesn't work properly with tile layout,
// using ROW_MAJOR until we fix it
auto desiredLayout = ::ttnn::Layout::ROW_MAJOR;
auto shape = ::ttnn::Shape(::tt::tt_metal::Shape(
utils::toShapeFromFBShape(*op->out()->desc()->shape())));

tensorPool.push_back(
::ttnn::empty(shape, targetDataTypeTTNN, desiredLayout, device));
// use try emplace here so the program output tensor doesn't get overwritten
Expand Down

0 comments on commit dbd6fd2

Please sign in to comment.