Skip to content

Commit

Permalink
#10531: Move Tensor code from experimental to TT-NN (#10551)
Browse files Browse the repository at this point in the history
#10531: Move Tensor into ttnn
  • Loading branch information
ayerofieiev-tt authored Jul 22, 2024
1 parent 1cc8a2d commit 00324ac
Show file tree
Hide file tree
Showing 249 changed files with 360 additions and 363 deletions.
4 changes: 2 additions & 2 deletions tests/tt_eager/integration_tests/test_bert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <chrono>

#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operation.hpp"
#include "ttnn/cpp/ttnn/operations/normalization/softmax/softmax.hpp"
#include "ttnn/experimental/tt_dnn/op_library/transformer_tms/transformer_tms.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_average_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "tt_dnn/op_library/auto_format.hpp"
#include "tt_numpy/functions.hpp"

#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "common/constants.hpp"

using tt::tt_metal::Host;
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_bcast_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "tt_metal/host_api.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/experimental/tt_dnn/op_library/bcast/bcast_op.hpp"
#include "common/constants.hpp"
#include "third_party/magic_enum/magic_enum.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_bmm_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "tt_metal/host_api.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/matmul/device/matmul_op.hpp"
#include "common/constants.hpp"
#include "tt_numpy/functions.hpp"
Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_eltwise_binary_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// SPDX-License-Identifier: Apache-2.0

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/eltwise/binary/binary.hpp"
#include "tt_numpy/functions.hpp"

Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_eltwise_unary_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <cmath>

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/eltwise/unary/unary.hpp"
#include "ttnn/operations/eltwise/unary/device/unary_op.hpp"
#include "ttnn/operations/data_movement/pad/pad.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_fold_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <random>
#include <tt_numpy/functions.hpp>

#include "ttnn/experimental/tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/experimental/tt_dnn/op_library/fold/fold_op.hpp"
#include "tt_metal/host_api.hpp"

Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_layernorm_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "tt_metal/host_api.hpp"
#include "ttnn/experimental/tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/normalization/layernorm/layernorm.hpp"
#include <tt_numpy/functions.hpp>

Expand Down
4 changes: 2 additions & 2 deletions tests/tt_eager/ops/test_pad_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <cmath>

#include "common/constants.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operation.hpp"
#include "ttnn/cpp/ttnn/operations/data_movement/pad/pad.hpp"
#include "tt_metal/host_api.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_reduce_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "ttnn/experimental/tt_dnn/op_library/reduce/reduce_op.hpp"
#include "tt_numpy/functions.hpp"

#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "common/constants.hpp"

using tt::tt_metal::Device;
Expand Down
8 changes: 4 additions & 4 deletions tests/tt_eager/ops/test_sliding_window_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#include <tuple>

#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/experimental/tt_dnn/op_library/sliding_window_op_infra/reference_sliding_window.hpp"
#include "ttnn/experimental/tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "tt_metal/host_api.hpp"
#include "ttnn/experimental/tt_numpy/functions.hpp"

Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_softmax_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "tt_metal/host_api.hpp"
#include "ttnn/experimental/tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/normalization/softmax/softmax.hpp"
#include "ttnn/experimental/tt_numpy/functions.hpp"

Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_tilize_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <tt_numpy/functions.hpp>

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/data_movement/tilize/tilize.hpp"
#include "tt_metal/host_api.hpp"

Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_tilize_op_channels_last.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <random>

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/data_movement/tilize/tilize.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"
Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_tilize_zero_padding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <random>

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/data_movement/tilize_with_val_padding/tilize_with_val_padding.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"
Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_tilize_zero_padding_channels_last.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <random>

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/operations/data_movement/tilize_with_val_padding/tilize_with_val_padding.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/tt_eager/ops/test_transpose_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "tt_metal/host_api.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/experimental/tt_dnn/op_library/transpose/transpose_op.hpp"
#include <tt_numpy/functions.hpp>

Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_transpose_wh_multi_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <random>
#include <tt_numpy/functions.hpp>

#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/experimental/tt_dnn/op_library/transpose/transpose_op.hpp"
#include "tt_metal/host_api.hpp"

Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/ops/test_transpose_wh_single_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <random>
#include <tt_numpy/functions.hpp>

#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/experimental/tt_dnn/op_library/transpose/transpose_op.hpp"
#include "tt_metal/host_api.hpp"

Expand Down
10 changes: 5 additions & 5 deletions tests/tt_eager/tensors/test_async_tensor_apis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

#include "common/bfloat16.hpp"
#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "tensor/tensor_impl.hpp"
#include "tensor/types.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/tensor/tensor_impl.hpp"
#include "ttnn/tensor/types.hpp"
#include "tests/tt_metal/tt_metal/unit_tests_common/common/common_fixture.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"
Expand Down
8 changes: 4 additions & 4 deletions tests/tt_eager/tensors/test_copy_and_move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#include "common/bfloat16.hpp"
#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "tensor/tensor_impl.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/tensor/tensor_impl.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"

Expand Down
6 changes: 3 additions & 3 deletions tests/tt_eager/tensors/test_host_device_loopback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <random>

#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"

Expand Down
8 changes: 4 additions & 4 deletions tests/tt_eager/tensors/test_ranks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#include "common/bfloat16.hpp"
#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "tensor/tensor_impl.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/tensor/tensor_impl.hpp"
#include "tt_metal/host_api.hpp"
#include "tt_numpy/functions.hpp"

Expand Down
8 changes: 4 additions & 4 deletions tests/tt_eager/tensors/test_raw_host_memory_pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#include "common/bfloat16.hpp"
#include "common/constants.hpp"
#include "tensor/host_buffer/functions.hpp"
#include "tensor/host_buffer/types.hpp"
#include "tensor/tensor.hpp"
#include "tensor/tensor_impl.hpp"
#include "ttnn/tensor/host_buffer/functions.hpp"
#include "ttnn/tensor/host_buffer/types.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/tensor/tensor_impl.hpp"
#include "ttnn/operations/eltwise/binary/binary.hpp"
#include "ttnn/operations/eltwise/unary/unary.hpp"
#include "tt_metal/host_api.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/ttnn/unit_tests/gtests/test_async_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0

#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn_multi_command_queue_fixture.hpp"
#include "ttnn/operations/eltwise/binary/binary.hpp"
#include "ttnn/operations/eltwise/unary/device/unary_op.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/ttnn/unit_tests/gtests/test_multi_cq_multi_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0

#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn_multi_command_queue_fixture.hpp"
#include "ttnn/operations/eltwise/binary/binary.hpp"
#include "ttnn/operations/eltwise/unary/device/unary_op.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tests/ttnn/unit_tests/gtests/test_multiprod_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0

#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn_multi_command_queue_fixture.hpp"
#include "tt_metal/detail/tt_metal.hpp"
#include "ttnn/operations/eltwise/binary/binary.hpp"
Expand Down
2 changes: 1 addition & 1 deletion tt_metal/tools/profiler/op_profiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <tuple>
#include <type_traits>

#include "tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "third_party/json/json.hpp"
#include "third_party/magic_enum/magic_enum.hpp"
#include "tools/profiler/profiler.hpp"
Expand Down
3 changes: 1 addition & 2 deletions ttnn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ set(TTNN_SRCS

### Setup TTNN as a shared library with optional Python bindings
add_subdirectory(cpp/ttnn/experimental)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cpp/ttnn/tensor)
set(TTNN_FINAL_SRC
${TTNN_SRCS}
${QUEUE_SRCS}
Expand All @@ -83,8 +84,6 @@ set(TTNN_PUBLIC_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/tt_metal
${CMAKE_CURRENT_SOURCE_DIR} # ${PROJECT_SOURCE_DIR}/ttnn
${CMAKE_CURRENT_SOURCE_DIR}/cpp/ttnn/experimental # symlink to tt_eager; should become native folder once merge complete
${CMAKE_CURRENT_SOURCE_DIR}/cpp/ttnn/experimental/tensor
${CMAKE_CURRENT_SOURCE_DIR}/cpp/ttnn/experimental/queue
${CMAKE_CURRENT_SOURCE_DIR}/cpp
${PROJECT_SOURCE_DIR}/tt_metal/third_party/fmt)
set(TTNN_PUBLIC_LINK_LIBRARIES compiler_flags metal_header_directories metal_common_libs tt_metal linker_flags) # linker_flags = -rdynamic if tracy enabled
Expand Down
2 changes: 1 addition & 1 deletion ttnn/cpp/pybind11/activation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "ttnn/experimental/tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/cpp/ttnn/operations/eltwise/unary/device/unary_op.hpp"
#include "export_enum.hpp"

Expand Down
2 changes: 1 addition & 1 deletion ttnn/cpp/pybind11/multi_device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "ttnn/experimental/tensor/tensor_utils.hpp"
#include "ttnn/tensor/tensor_utils.hpp"
#include "ttnn/multi_device.hpp"

namespace py = pybind11;
Expand Down
2 changes: 1 addition & 1 deletion ttnn/cpp/pybind11/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include "ttnn/experimental/tensor/tensor.hpp"
#include "ttnn/tensor/tensor.hpp"
#include "ttnn/types.hpp"

namespace py = pybind11;
Expand Down
4 changes: 2 additions & 2 deletions ttnn/cpp/ttnn/async_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "async_runtime.hpp"

#include "ttnn/experimental/tensor/tensor_impl.hpp"
#include "ttnn/experimental/tensor/tensor_impl_wrapper.hpp"
#include "ttnn/tensor/tensor_impl.hpp"
#include "ttnn/tensor/tensor_impl_wrapper.hpp"

namespace ttnn {
using DeviceBuffer = std::shared_ptr<Buffer>;
Expand Down
2 changes: 1 addition & 1 deletion ttnn/cpp/ttnn/async_runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "ttnn/experimental/tensor/types.hpp"
#include "ttnn/tensor/types.hpp"
#include "ttnn/run_operation.hpp"
#include "types.hpp"

Expand Down
File renamed without changes.
Loading

0 comments on commit 00324ac

Please sign in to comment.