Skip to content

Commit

Permalink
Revert "#4171: Remove duplicate call to deallocate input to move op a…
Browse files Browse the repository at this point in the history
…nd early exit when tensor cannot be allocated at higher address in L1 or lower address in DRAM"

This reverts commit be73208.
  • Loading branch information
abhullar-tt committed Dec 27, 2023
1 parent 8ad0abc commit ba4a1e7
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions tt_eager/tt_dnn/op_library/move/move_op.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ inline Tensor move(Tensor& input_tensor, std::optional<MemoryConfig>& mem_config
uint32_t num_units = tilized ? input_tensor.volume() / TILE_HW : input_tensor.volume() / input_tensor.shape()[-1];

bool move_within_same_mem_space = input_mem_config.buffer_type == output_mem_config.buffer_type;

// A tensor moved within L1 it is meant to reallocate at higher addresses and a tensor moved within DRAM is meant to reallocate at lower addresses
// If the tensor is not allocated in a new address, there is no need to move the data
if (move_within_same_mem_space and input_address == output_tensor.buffer()->address()) {
return output_tensor;
}

// Input and output addresses won't overlap if they are in different memory substrates
bool non_overlap = not move_within_same_mem_space;
const auto num_banks = input_tensor.device()->num_banks(output_tensor.buffer()->buffer_type());
Expand Down Expand Up @@ -109,6 +102,7 @@ inline Tensor move(Tensor& input_tensor, std::optional<MemoryConfig>& mem_config
}

auto output = operation::run(Move{output_mem_config, move_op_parallelization_strategy}, {input_tensor, output_tensor}).at(0);
input_tensor.deallocate();
return output;
}

Expand Down Expand Up @@ -139,6 +133,7 @@ inline Tensor move_sharded(Tensor& input_tensor, std::optional<MemoryConfig>& me
}
MoveOpParallelizationStrategy move_op_parallelization_strategy = MoveOpParallelizationStrategy::MULTI_CORE_SHARDED;
auto output = operation::run(Move{output_mem_config, move_op_parallelization_strategy}, {input_tensor, output_tensor}).at(0);
input_tensor.deallocate();
return output;
}

Expand Down

0 comments on commit ba4a1e7

Please sign in to comment.