diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e4f0088..5bf1dade 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ message(STATUS "UMD build type: ${CMAKE_BUILD_TYPE}") include(dependencies) +add_subdirectory(common) add_subdirectory(device) add_subdirectory(src) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 00000000..69a6eef6 --- /dev/null +++ b/common/CMakeLists.txt @@ -0,0 +1,13 @@ +add_library(umd_common INTERFACE) +add_library(${PROJECT_NAME}::Common ALIAS umd_common) + +target_sources( + umd_common + INTERFACE + assert.hpp + backtrace.hpp + gtest_initializer.hpp # FIXME: this should be tucked away with the tests + logger.hpp +) + +target_include_directories(umd_common INTERFACE .) diff --git a/common/assert.hpp b/common/assert.hpp index 3189cec3..66ad6686 100644 --- a/common/assert.hpp +++ b/common/assert.hpp @@ -13,7 +13,7 @@ #include #include -#include "common/logger.hpp" +#include "logger.hpp" namespace tt { template diff --git a/common/logger.hpp b/common/logger.hpp index 9529d162..942a5208 100644 --- a/common/logger.hpp +++ b/common/logger.hpp @@ -20,7 +20,7 @@ #include #endif -#include "common/backtrace.hpp" +#include "backtrace.hpp" #include "fmt/color.h" #include "fmt/core.h" #include "fmt/ostream.h" diff --git a/common/utils.hpp b/common/utils.hpp index b8cba9f5..f8e8cbef 100644 --- a/common/utils.hpp +++ b/common/utils.hpp @@ -18,10 +18,10 @@ std::string get_abs_path(std::string path) { std::filesystem::path current_file_path = std::filesystem::path(__FILE__); std::filesystem::path umd_root; if (current_file_path.is_absolute()) { - umd_root = current_file_path.parent_path().parent_path(); + umd_root = current_file_path.parent_path().parent_path().parent_path(); } else { std::filesystem::path umd_root_relative = - std::filesystem::relative(std::filesystem::path(__FILE__).parent_path().parent_path(), "../"); + std::filesystem::relative(std::filesystem::path(__FILE__).parent_path().parent_path().parent_path(), "../"); umd_root = std::filesystem::canonical(umd_root_relative); } std::filesystem::path abs_path = umd_root / path; diff --git a/device/CMakeLists.txt b/device/CMakeLists.txt index 499e521e..9f0d0738 100644 --- a/device/CMakeLists.txt +++ b/device/CMakeLists.txt @@ -2,41 +2,41 @@ set(POSITION_INDEPENDENT_CODE ON) generate_fbs_header(${PROJECT_SOURCE_DIR}/device/simulation/tt_simulation_device.fbs) -set(UMD_DEVICE_SRCS - architecture_implementation.cpp - cpuset_lib.cpp - tlb.cpp - tt_cluster_descriptor.cpp - cluster.cpp - tt_silicon_driver_common.cpp - tt_soc_descriptor.cpp - xy_pair.cpp - simulation/tt_simulation_device.cpp - simulation/tt_simulation_host.cpp - blackhole/blackhole_implementation.cpp - grayskull/grayskull_implementation.cpp - wormhole/wormhole_implementation.cpp - coordinate_manager.cpp - blackhole/blackhole_coordinate_manager.cpp - wormhole/wormhole_coordinate_manager.cpp - pcie/pci_device.cpp - hugepage.cpp -) - -add_library(device SHARED ${UMD_DEVICE_SRCS}) +add_library(device SHARED) add_library(${PROJECT_NAME}::device ALIAS device) -add_library(${PROJECT_NAME}_device ALIAS device) # For legacy I guess -target_sources(device PRIVATE ${FBS_GENERATED_HEADER}) +target_sources( + device + PRIVATE + architecture_implementation.cpp + blackhole/blackhole_coordinate_manager.cpp + blackhole/blackhole_implementation.cpp + cluster.cpp + coordinate_manager.cpp + cpuset_lib.cpp + grayskull/grayskull_implementation.cpp + hugepage.cpp + pcie/pci_device.cpp + simulation/tt_simulation_device.cpp + simulation/tt_simulation_host.cpp + tlb.cpp + tt_cluster_descriptor.cpp + tt_silicon_driver_common.cpp + tt_soc_descriptor.cpp + wormhole/wormhole_coordinate_manager.cpp + wormhole/wormhole_implementation.cpp + xy_pair.cpp + ${FBS_GENERATED_HEADER} +) target_include_directories( device PUBLIC - $ - $ + $ $ $ PRIVATE + $ $ ) @@ -49,6 +49,8 @@ target_link_libraries( flatbuffers uv PRIVATE + umd::Common + umd::Firmware hwloc rt Boost::interprocess diff --git a/device/architecture_implementation.h b/device/api/umd/device/architecture_implementation.h similarity index 97% rename from device/architecture_implementation.h rename to device/api/umd/device/architecture_implementation.h index f715fd3e..60ce5368 100644 --- a/device/architecture_implementation.h +++ b/device/api/umd/device/architecture_implementation.h @@ -11,9 +11,9 @@ #include #include -#include "device/tlb.h" -#include "device/tt_arch_types.h" -#include "device/xy_pair.h" +#include "umd/device/tlb.h" +#include "umd/device/tt_arch_types.h" +#include "umd/device/xy_pair.h" struct tt_driver_host_address_params; struct tt_driver_eth_interface_params; diff --git a/device/blackhole/blackhole_implementation.h b/device/api/umd/device/blackhole_implementation.h similarity index 99% rename from device/blackhole/blackhole_implementation.h rename to device/api/umd/device/blackhole_implementation.h index 74789233..3ff3493b 100644 --- a/device/blackhole/blackhole_implementation.h +++ b/device/api/umd/device/blackhole_implementation.h @@ -9,8 +9,8 @@ #include #include -#include "device/architecture_implementation.h" -#include "device/tlb.h" +#include "umd/device/architecture_implementation.h" +#include "umd/device/tlb.h" namespace tt::umd { diff --git a/device/cluster.h b/device/api/umd/device/cluster.h similarity index 99% rename from device/cluster.h rename to device/api/umd/device/cluster.h index 130150b7..3f5ab3c7 100644 --- a/device/cluster.h +++ b/device/api/umd/device/cluster.h @@ -13,14 +13,14 @@ #include #include -#include "device/tlb.h" -#include "device/tt_cluster_descriptor_types.h" -#include "device/tt_io.hpp" #include "fmt/core.h" -#include "pcie/pci_device.hpp" #include "tt_silicon_driver_common.hpp" #include "tt_soc_descriptor.h" #include "tt_xy_pair.h" +#include "umd/device/pci_device.hpp" +#include "umd/device/tlb.h" +#include "umd/device/tt_cluster_descriptor_types.h" +#include "umd/device/tt_io.hpp" using TLB_DATA = tt::umd::tlb_data; diff --git a/device/coordinate_manager.h b/device/api/umd/device/coordinate_manager.h similarity index 97% rename from device/coordinate_manager.h rename to device/api/umd/device/coordinate_manager.h index 53ad266f..bf98be70 100644 --- a/device/coordinate_manager.h +++ b/device/api/umd/device/coordinate_manager.h @@ -10,8 +10,8 @@ #include #include -#include "device/tt_arch_types.h" -#include "device/tt_xy_pair.h" +#include "umd/device/tt_arch_types.h" +#include "umd/device/tt_xy_pair.h" class CoordinateManager { public: diff --git a/device/device_api_metal.h b/device/api/umd/device/device_api_metal.h similarity index 62% rename from device/device_api_metal.h rename to device/api/umd/device/device_api_metal.h index 656397dc..a751d046 100644 --- a/device/device_api_metal.h +++ b/device/api/umd/device/device_api_metal.h @@ -5,5 +5,5 @@ */ #pragma once -#include "device/cluster.h" -#include "device/driver_atomics.h" +#include "umd/device/cluster.h" +#include "umd/device/driver_atomics.h" diff --git a/device/driver_atomics.h b/device/api/umd/device/driver_atomics.h similarity index 100% rename from device/driver_atomics.h rename to device/api/umd/device/driver_atomics.h diff --git a/device/grayskull/grayskull_implementation.h b/device/api/umd/device/grayskull_implementation.h similarity index 99% rename from device/grayskull/grayskull_implementation.h rename to device/api/umd/device/grayskull_implementation.h index 5984710c..0a93e9b2 100644 --- a/device/grayskull/grayskull_implementation.h +++ b/device/api/umd/device/grayskull_implementation.h @@ -8,8 +8,8 @@ #include -#include "device/architecture_implementation.h" -#include "device/tlb.h" +#include "architecture_implementation.h" +#include "umd/device/tlb.h" namespace tt::umd { diff --git a/device/hugepage.h b/device/api/umd/device/hugepage.h similarity index 95% rename from device/hugepage.h rename to device/api/umd/device/hugepage.h index 6aa1838b..1bf37dac 100644 --- a/device/hugepage.h +++ b/device/api/umd/device/hugepage.h @@ -9,7 +9,7 @@ #include #include -#include "device/tt_cluster_descriptor_types.h" +#include "umd/device/tt_cluster_descriptor_types.h" namespace tt::umd { diff --git a/device/pcie/pci_device.hpp b/device/api/umd/device/pci_device.hpp similarity index 97% rename from device/pcie/pci_device.hpp rename to device/api/umd/device/pci_device.hpp index 62ffb4c2..5966b5cb 100644 --- a/device/pcie/pci_device.hpp +++ b/device/api/umd/device/pci_device.hpp @@ -12,12 +12,12 @@ #include #include -#include "common/semver.hpp" -#include "device/tlb.h" -#include "device/tt_arch_types.h" -#include "device/tt_cluster_descriptor_types.h" -#include "device/tt_xy_pair.h" #include "fmt/format.h" +#include "umd/device/semver.hpp" +#include "umd/device/tlb.h" +#include "umd/device/tt_arch_types.h" +#include "umd/device/tt_cluster_descriptor_types.h" +#include "umd/device/tt_xy_pair.h" // TODO: this is used up in cluster.cpp but that logic ought to be // lowered into the PCIDevice class since it is specific to PCIe cards. diff --git a/common/semver.hpp b/device/api/umd/device/semver.hpp similarity index 100% rename from common/semver.hpp rename to device/api/umd/device/semver.hpp diff --git a/device/tlb.h b/device/api/umd/device/tlb.h similarity index 100% rename from device/tlb.h rename to device/api/umd/device/tlb.h diff --git a/device/tt_arch_types.h b/device/api/umd/device/tt_arch_types.h similarity index 100% rename from device/tt_arch_types.h rename to device/api/umd/device/tt_arch_types.h diff --git a/device/tt_cluster_descriptor.h b/device/api/umd/device/tt_cluster_descriptor.h similarity index 97% rename from device/tt_cluster_descriptor.h rename to device/api/umd/device/tt_cluster_descriptor.h index 834f8e23..82618671 100644 --- a/device/tt_cluster_descriptor.h +++ b/device/api/umd/device/tt_cluster_descriptor.h @@ -16,9 +16,9 @@ #include #include -#include "device/tt_cluster_descriptor_types.h" -#include "device/tt_xy_pair.h" -#include "tt_arch_types.h" +#include "umd/device/tt_arch_types.h" +#include "umd/device/tt_cluster_descriptor_types.h" +#include "umd/device/tt_xy_pair.h" namespace YAML { class Node; diff --git a/device/tt_cluster_descriptor_types.h b/device/api/umd/device/tt_cluster_descriptor_types.h similarity index 100% rename from device/tt_cluster_descriptor_types.h rename to device/api/umd/device/tt_cluster_descriptor_types.h diff --git a/device/tt_io.hpp b/device/api/umd/device/tt_io.hpp similarity index 100% rename from device/tt_io.hpp rename to device/api/umd/device/tt_io.hpp diff --git a/device/tt_silicon_driver_common.hpp b/device/api/umd/device/tt_silicon_driver_common.hpp similarity index 100% rename from device/tt_silicon_driver_common.hpp rename to device/api/umd/device/tt_silicon_driver_common.hpp diff --git a/device/simulation/tt_simulation_device.h b/device/api/umd/device/tt_simulation_device.h similarity index 97% rename from device/simulation/tt_simulation_device.h rename to device/api/umd/device/tt_simulation_device.h index 5f468a11..9b4778aa 100644 --- a/device/simulation/tt_simulation_device.h +++ b/device/api/umd/device/tt_simulation_device.h @@ -10,8 +10,8 @@ #include #include -#include "device/cluster.h" -#include "device/simulation/tt_simulation_host.hpp" +#include "umd/device/cluster.h" +#include "umd/device/tt_simulation_host.hpp" class tt_SimulationDevice : public tt_device { public: diff --git a/device/simulation/tt_simulation_host.hpp b/device/api/umd/device/tt_simulation_host.hpp similarity index 94% rename from device/simulation/tt_simulation_host.hpp rename to device/api/umd/device/tt_simulation_host.hpp index 26897a44..2db54394 100644 --- a/device/simulation/tt_simulation_host.hpp +++ b/device/api/umd/device/tt_simulation_host.hpp @@ -5,7 +5,7 @@ #include #include -#include "device/tt_xy_pair.h" +#include "umd/device/tt_xy_pair.h" #define NNG_SOCKET_PREFIX "ipc:///tmp/" diff --git a/device/tt_soc_descriptor.h b/device/api/umd/device/tt_soc_descriptor.h similarity index 98% rename from device/tt_soc_descriptor.h rename to device/api/umd/device/tt_soc_descriptor.h index 4d3c2ad5..e59d4416 100644 --- a/device/tt_soc_descriptor.h +++ b/device/api/umd/device/tt_soc_descriptor.h @@ -14,10 +14,11 @@ #include #include -#include "device/coordinate_manager.h" -#include "device/tt_arch_types.h" #include "fmt/core.h" #include "tt_xy_pair.h" +#include "umd/device/coordinate_manager.h" +#include "umd/device/tt_arch_types.h" +#include "umd/device/tt_xy_pair.h" namespace YAML { class Node; diff --git a/device/tt_xy_pair.h b/device/api/umd/device/tt_xy_pair.h similarity index 98% rename from device/tt_xy_pair.h rename to device/api/umd/device/tt_xy_pair.h index 3d982ac9..9375182f 100644 --- a/device/tt_xy_pair.h +++ b/device/api/umd/device/tt_xy_pair.h @@ -8,7 +8,7 @@ #include -#include "device/xy_pair.h" +#include "umd/device/xy_pair.h" using tt_xy_pair = tt::umd::xy_pair; using tt_cxy_pair = tt::umd::cxy_pair; diff --git a/device/wormhole/wormhole_implementation.h b/device/api/umd/device/wormhole_implementation.h similarity index 99% rename from device/wormhole/wormhole_implementation.h rename to device/api/umd/device/wormhole_implementation.h index f8bf6f14..3dfebb96 100644 --- a/device/wormhole/wormhole_implementation.h +++ b/device/api/umd/device/wormhole_implementation.h @@ -8,8 +8,8 @@ #include -#include "device/architecture_implementation.h" -#include "device/tlb.h" +#include "architecture_implementation.h" +#include "umd/device/tlb.h" namespace tt::umd { diff --git a/device/xy_pair.h b/device/api/umd/device/xy_pair.h similarity index 100% rename from device/xy_pair.h rename to device/api/umd/device/xy_pair.h diff --git a/device/architecture_implementation.cpp b/device/architecture_implementation.cpp index 186c6c14..dc0c0b00 100644 --- a/device/architecture_implementation.cpp +++ b/device/architecture_implementation.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "device/architecture_implementation.h" +#include "umd/device/architecture_implementation.h" -#include "device/blackhole/blackhole_implementation.h" -#include "device/grayskull/grayskull_implementation.h" -#include "device/wormhole/wormhole_implementation.h" +#include "umd/device/blackhole_implementation.h" +#include "umd/device/grayskull_implementation.h" +#include "umd/device/wormhole_implementation.h" namespace tt::umd { diff --git a/device/blackhole/blackhole_coordinate_manager.h b/device/blackhole/blackhole_coordinate_manager.h index 5a316f8c..9a00b46d 100644 --- a/device/blackhole/blackhole_coordinate_manager.h +++ b/device/blackhole/blackhole_coordinate_manager.h @@ -6,7 +6,7 @@ #pragma once -#include "device/coordinate_manager.h" +#include "umd/device/coordinate_manager.h" class BlackholeCoordinateManager : public CoordinateManager { public: diff --git a/device/blackhole/blackhole_implementation.cpp b/device/blackhole/blackhole_implementation.cpp index 3d0b19fe..14de739e 100644 --- a/device/blackhole/blackhole_implementation.cpp +++ b/device/blackhole/blackhole_implementation.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "blackhole_implementation.h" +#include "umd/device/blackhole_implementation.h" -#include "device/cluster.h" -#include "src/firmware/riscv/blackhole/eth_interface.h" -#include "src/firmware/riscv/blackhole/host_mem_address_map.h" +#include "blackhole/eth_interface.h" +#include "blackhole/host_mem_address_map.h" +#include "umd/device/cluster.h" constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 36; // source: noc_parameters.h, common for WH && BH constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for WH && BH diff --git a/device/cluster.cpp b/device/cluster.cpp index 1e8e1ffc..4295b8bd 100644 --- a/device/cluster.cpp +++ b/device/cluster.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: (c) 2023 Tenstorrent Inc. // // SPDX-License-Identifier: Apache-2.0 -#include "cluster.h" +#include "umd/device/cluster.h" #include #include @@ -36,15 +36,13 @@ #include #include -#include "common/logger.hpp" -#include "device/architecture_implementation.h" -#include "device/driver_atomics.h" -#include "device/hugepage.h" -#include "device/tlb.h" -#include "device/tt_arch_types.h" -#include "device/tt_cluster_descriptor.h" -#include "tt_arch_types.h" -#include "tt_cluster_descriptor.h" +#include "logger.hpp" +#include "umd/device/architecture_implementation.h" +#include "umd/device/driver_atomics.h" +#include "umd/device/hugepage.h" +#include "umd/device/tlb.h" +#include "umd/device/tt_arch_types.h" +#include "umd/device/tt_cluster_descriptor.h" #include "yaml-cpp/yaml.h" using namespace boost::interprocess; @@ -119,8 +117,8 @@ const tt_SocDescriptor& tt_device::get_soc_descriptor(chip_id_t chip_id) const { #include #include -#include "tt_silicon_driver_common.hpp" -#include "tt_xy_pair.h" +#include "umd/device/tt_silicon_driver_common.hpp" +#include "umd/device/tt_xy_pair.h" struct routing_cmd_t { uint64_t sys_addr; diff --git a/device/coordinate_manager.cpp b/device/coordinate_manager.cpp index b2eac485..eb3bda7e 100644 --- a/device/coordinate_manager.cpp +++ b/device/coordinate_manager.cpp @@ -3,12 +3,12 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include "device/coordinate_manager.h" +#include "umd/device/coordinate_manager.h" #include -#include "coordinate_manager.h" #include "grayskull/grayskull_coordinate_manager.h" +#include "umd/device/coordinate_manager.h" tt_physical_coords CoordinateManager::to_physical_coords(tt_logical_coords logical_coords) { return tt_physical_coords(logical_x_to_physical_x[logical_coords.x], logical_y_to_physical_y[logical_coords.y]); @@ -168,9 +168,9 @@ void CoordinateManager::fill_logical_to_virtual_mapping( } } -#include "device/blackhole/blackhole_coordinate_manager.h" -#include "device/grayskull/grayskull_coordinate_manager.h" -#include "device/wormhole/wormhole_coordinate_manager.h" +#include "blackhole/blackhole_coordinate_manager.h" +#include "grayskull/grayskull_coordinate_manager.h" +#include "wormhole/wormhole_coordinate_manager.h" std::unique_ptr CoordinateManager::get_coordinate_manager( tt::ARCH arch, diff --git a/device/cpuset_lib.cpp b/device/cpuset_lib.cpp index e09591d3..5c9f278b 100644 --- a/device/cpuset_lib.cpp +++ b/device/cpuset_lib.cpp @@ -8,9 +8,10 @@ #include #include -#include "common/logger.hpp" -#include "device/cluster.h" +#include "cpuset_lib.hpp" #include "fmt/core.h" +#include "logger.hpp" +#include "umd/device/cluster.h" namespace tt { diff --git a/device/cpuset_lib.hpp b/device/cpuset_lib.hpp index 46994833..01210c02 100644 --- a/device/cpuset_lib.hpp +++ b/device/cpuset_lib.hpp @@ -14,8 +14,8 @@ #include #include -#include "device/tt_cluster_descriptor.h" // For chip_id_t #include "hwloc.h" +#include "umd/device/tt_cluster_descriptor.h" // For chip_id_t using tt_cluster_description = tt_ClusterDescriptor; diff --git a/device/grayskull/grayskull_coordinate_manager.h b/device/grayskull/grayskull_coordinate_manager.h index ba7eebe2..cac8b29a 100644 --- a/device/grayskull/grayskull_coordinate_manager.h +++ b/device/grayskull/grayskull_coordinate_manager.h @@ -6,7 +6,7 @@ #pragma once -#include "device/coordinate_manager.h" +#include "umd/device/coordinate_manager.h" class GrayskullCoordinateManager : public CoordinateManager { public: diff --git a/device/grayskull/grayskull_implementation.cpp b/device/grayskull/grayskull_implementation.cpp index 415de229..209f1c42 100644 --- a/device/grayskull/grayskull_implementation.cpp +++ b/device/grayskull/grayskull_implementation.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "grayskull_implementation.h" +#include "umd/device/grayskull_implementation.h" -#include "device/cluster.h" -#include "src/firmware/riscv/grayskull/eth_interface.h" -#include "src/firmware/riscv/grayskull/host_mem_address_map.h" +#include "grayskull/eth_interface.h" +#include "grayskull/host_mem_address_map.h" +#include "umd/device/cluster.h" constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 32; // source: noc_parameters.h, unique for GS constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for GS && WH && BH diff --git a/device/hugepage.cpp b/device/hugepage.cpp index 9010ed37..8883bff2 100644 --- a/device/hugepage.cpp +++ b/device/hugepage.cpp @@ -4,13 +4,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "hugepage.h" +#include "umd/device/hugepage.h" #include // for O_RDWR and other constants #include // for umask -#include "common/logger.hpp" -#include "device/cpuset_lib.hpp" +#include "cpuset_lib.hpp" +#include "logger.hpp" const uint32_t g_MAX_HOST_MEM_CHANNELS = 4; diff --git a/device/mockup/tt_mockup_device.hpp b/device/mockup/tt_mockup_device.hpp index ef1e7e5a..15107ebc 100644 --- a/device/mockup/tt_mockup_device.hpp +++ b/device/mockup/tt_mockup_device.hpp @@ -9,8 +9,8 @@ #include #include -#include "device/cluster.h" -#include "device/tt_cluster_descriptor.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" class tt_MockupDevice : public tt_device { public: diff --git a/device/pcie/pci_device.cpp b/device/pcie/pci_device.cpp index bc2fd5f6..5afb33fa 100644 --- a/device/pcie/pci_device.cpp +++ b/device/pcie/pci_device.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "pci_device.hpp" +#include "umd/device/pci_device.hpp" #include // for ::open #include // for PCI_SLOT, PCI_FUNC @@ -17,14 +17,14 @@ #include // for memcpy #include -#include "common/assert.hpp" -#include "common/logger.hpp" -#include "device/architecture_implementation.h" -#include "device/cpuset_lib.hpp" -#include "device/driver_atomics.h" -#include "device/hugepage.h" -#include "device/tt_arch_types.h" +#include "assert.hpp" +#include "cpuset_lib.hpp" #include "ioctl.h" +#include "logger.hpp" +#include "umd/device/architecture_implementation.h" +#include "umd/device/driver_atomics.h" +#include "umd/device/hugepage.h" +#include "umd/device/tt_arch_types.h" static const uint16_t GS_PCIE_DEVICE_ID = 0xfaca; static const uint16_t WH_PCIE_DEVICE_ID = 0x401e; diff --git a/device/simulation/tt_simulation_device.cpp b/device/simulation/tt_simulation_device.cpp index e703b26e..086eb520 100644 --- a/device/simulation/tt_simulation_device.cpp +++ b/device/simulation/tt_simulation_device.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "tt_simulation_device.h" +#include "umd/device/tt_simulation_device.h" #include #include @@ -14,11 +14,11 @@ #include #include -#include "common/assert.hpp" -#include "common/logger.hpp" -#include "device/driver_atomics.h" -#include "device/tt_cluster_descriptor.h" +#include "assert.hpp" +#include "logger.hpp" #include "tt_simulation_device_generated.h" +#include "umd/device/driver_atomics.h" +#include "umd/device/tt_cluster_descriptor.h" flatbuffers::FlatBufferBuilder create_flatbuffer( DEVICE_COMMAND rw, std::vector vec, tt_cxy_pair core_, uint64_t addr, uint64_t size_ = 0) { diff --git a/device/simulation/tt_simulation_host.cpp b/device/simulation/tt_simulation_host.cpp index 309bb7be..7e5fe8be 100644 --- a/device/simulation/tt_simulation_host.cpp +++ b/device/simulation/tt_simulation_host.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tt_simulation_host.hpp" +#include "umd/device/tt_simulation_host.hpp" #include #include @@ -14,8 +14,8 @@ #include #include -#include "common/assert.hpp" -#include "common/logger.hpp" +#include "assert.hpp" +#include "logger.hpp" tt_SimulationHost::tt_SimulationHost() { // Initialize socket and dialer diff --git a/device/tlb.cpp b/device/tlb.cpp index 22d0a3c9..b4423e05 100644 --- a/device/tlb.cpp +++ b/device/tlb.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "device/tlb.h" +#include "umd/device/tlb.h" namespace tt::umd { diff --git a/device/tt_cluster_descriptor.cpp b/device/tt_cluster_descriptor.cpp index 70e18111..1dde5383 100644 --- a/device/tt_cluster_descriptor.cpp +++ b/device/tt_cluster_descriptor.cpp @@ -2,16 +2,16 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tt_cluster_descriptor.h" +#include "umd/device/tt_cluster_descriptor.h" #include #include #include -#include "common/disjoint_set.hpp" -#include "common/logger.hpp" +#include "disjoint_set.hpp" #include "fmt/core.h" #include "libs/create_ethernet_map.h" +#include "logger.hpp" #include "yaml-cpp/yaml.h" using namespace tt; diff --git a/device/tt_silicon_driver_common.cpp b/device/tt_silicon_driver_common.cpp index 53f87753..0d6c8b62 100644 --- a/device/tt_silicon_driver_common.cpp +++ b/device/tt_silicon_driver_common.cpp @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "device/tt_silicon_driver_common.hpp" +#include "umd/device/tt_silicon_driver_common.hpp" -#include "cluster.h" -#include "tt_xy_pair.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_xy_pair.h" std::string TensixSoftResetOptionsToString(TensixSoftResetOptions value) { std::string output; diff --git a/device/tt_soc_descriptor.cpp b/device/tt_soc_descriptor.cpp index ac9b31ad..0aa80685 100644 --- a/device/tt_soc_descriptor.cpp +++ b/device/tt_soc_descriptor.cpp @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "tt_soc_descriptor.h" +#include "umd/device/tt_soc_descriptor.h" #include @@ -12,8 +12,8 @@ #include #include -#include "common/utils.hpp" #include "fmt/core.h" +#include "utils.hpp" #include "yaml-cpp/yaml.h" // #include "l1_address_map.h" diff --git a/device/wormhole/wormhole_coordinate_manager.h b/device/wormhole/wormhole_coordinate_manager.h index e3e35886..eda84809 100644 --- a/device/wormhole/wormhole_coordinate_manager.h +++ b/device/wormhole/wormhole_coordinate_manager.h @@ -6,7 +6,7 @@ #pragma once -#include "device/coordinate_manager.h" +#include "umd/device/coordinate_manager.h" class WormholeCoordinateManager : public CoordinateManager { public: diff --git a/device/wormhole/wormhole_implementation.cpp b/device/wormhole/wormhole_implementation.cpp index 2a4c5048..bd6e32e7 100644 --- a/device/wormhole/wormhole_implementation.cpp +++ b/device/wormhole/wormhole_implementation.cpp @@ -2,11 +2,11 @@ // // SPDX-License-Identifier: Apache-2.0 -#include "wormhole_implementation.h" +#include "umd/device/wormhole_implementation.h" -#include "device/cluster.h" -#include "src/firmware/riscv/wormhole/eth_interface.h" -#include "src/firmware/riscv/wormhole/host_mem_address_map.h" +#include "umd/device/cluster.h" +#include "wormhole/eth_interface.h" +#include "wormhole/host_mem_address_map.h" constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 36; // source: noc_parameters.h, common for WH && BH constexpr std::uint32_t NOC_ADDR_NODE_ID_BITS = 6; // source: noc_parameters.h, common for WH && BH diff --git a/device/xy_pair.cpp b/device/xy_pair.cpp index 44b0ad8f..ff9b7f95 100644 --- a/device/xy_pair.cpp +++ b/device/xy_pair.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include "xy_pair.h" +#include "umd/device/xy_pair.h" #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 44ca9f2f..cb81fef1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,4 +7,5 @@ target_include_directories( $<$:${CMAKE_CURRENT_SOURCE_DIR}/firmware/riscv/wormhole> $<$:${CMAKE_CURRENT_SOURCE_DIR}/firmware/riscv/grayskull> $<$:${CMAKE_CURRENT_SOURCE_DIR}/firmware/riscv/blackhole> + firmware/riscv ) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 91d2e917..f37d1718 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,6 +19,7 @@ target_include_directories( INTERFACE ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} + "$" ) # Download noc_parameters.h for tests diff --git a/tests/api/test_chip.cpp b/tests/api/test_chip.cpp index ceeac384..2e9a268f 100644 --- a/tests/api/test_chip.cpp +++ b/tests/api/test_chip.cpp @@ -15,9 +15,9 @@ #include "tests/test_utils/generate_cluster_desc.hpp" // TODO: change to tt_cluster -#include "device/architecture_implementation.h" -#include "device/cluster.h" -#include "device/tt_cluster_descriptor.h" +#include "umd/device/architecture_implementation.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" using namespace tt::umd; diff --git a/tests/api/test_cluster.cpp b/tests/api/test_cluster.cpp index 9ed1589e..9b53494b 100644 --- a/tests/api/test_cluster.cpp +++ b/tests/api/test_cluster.cpp @@ -11,10 +11,10 @@ #include #include -#include "device/cluster.h" -#include "device/tt_cluster_descriptor.h" #include "fmt/xchar.h" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" // TODO: obviously we need some other way to set this up #include "noc/noc_parameters.h" diff --git a/tests/api/test_cluster_descriptor.cpp b/tests/api/test_cluster_descriptor.cpp index f4a6f136..5545a1eb 100644 --- a/tests/api/test_cluster_descriptor.cpp +++ b/tests/api/test_cluster_descriptor.cpp @@ -8,13 +8,13 @@ #include #include -#include "common/disjoint_set.hpp" -#include "device/pcie/pci_device.hpp" -#include "device/tt_cluster_descriptor.h" +#include "disjoint_set.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/pci_device.hpp" +#include "umd/device/tt_cluster_descriptor.h" // TODO: Needed for detect_arch, remove when it is part of cluster descriptor. -#include "device/cluster.h" +#include "umd/device/cluster.h" inline std::unique_ptr get_cluster_desc() { // TODO: remove getting manually cluster descriptor from yaml. diff --git a/tests/api/test_mockup_device.cpp b/tests/api/test_mockup_device.cpp index 71ab4140..bb8001ea 100644 --- a/tests/api/test_mockup_device.cpp +++ b/tests/api/test_mockup_device.cpp @@ -11,8 +11,8 @@ #include #include "device/mockup/tt_mockup_device.hpp" -#include "device/tt_arch_types.h" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/tt_arch_types.h" namespace test::mockup_device { diff --git a/tests/api/test_soc_descriptor_bh.cpp b/tests/api/test_soc_descriptor_bh.cpp index 1a74608b..7007a98f 100644 --- a/tests/api/test_soc_descriptor_bh.cpp +++ b/tests/api/test_soc_descriptor_bh.cpp @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include "device/tt_soc_descriptor.h" #include "gtest/gtest.h" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/test_utils/soc_desc_test_utils.hpp" +#include "umd/device/tt_soc_descriptor.h" // Blackhole workers - x-y annotation // functional_workers: diff --git a/tests/api/test_soc_descriptor_gs.cpp b/tests/api/test_soc_descriptor_gs.cpp index d1760df6..b5cabc7c 100644 --- a/tests/api/test_soc_descriptor_gs.cpp +++ b/tests/api/test_soc_descriptor_gs.cpp @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include "device/tt_soc_descriptor.h" #include "gtest/gtest.h" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/test_utils/soc_desc_test_utils.hpp" +#include "umd/device/tt_soc_descriptor.h" // Grayskull workers - x-y annotation // functional_workers: diff --git a/tests/api/test_soc_descriptor_wh.cpp b/tests/api/test_soc_descriptor_wh.cpp index 32721965..a10afbdc 100644 --- a/tests/api/test_soc_descriptor_wh.cpp +++ b/tests/api/test_soc_descriptor_wh.cpp @@ -3,10 +3,10 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include "device/tt_soc_descriptor.h" #include "gtest/gtest.h" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/test_utils/soc_desc_test_utils.hpp" +#include "umd/device/tt_soc_descriptor.h" // Wormhole workers - x-y annotation // functional_workers: diff --git a/tests/blackhole/test_bh_common.h b/tests/blackhole/test_bh_common.h index 7d89dfe5..0297b191 100644 --- a/tests/blackhole/test_bh_common.h +++ b/tests/blackhole/test_bh_common.h @@ -3,11 +3,11 @@ // SPDX-License-Identifier: Apache-2.0 #pragma once -#include "cluster.h" #include "eth_l1_address_map.h" #include "tests/test_utils/stimulus_generators.hpp" #include "tt_cluster_descriptor.h" #include "tt_xy_pair.h" +#include "umd/device/cluster.h" using namespace tt::umd; diff --git a/tests/blackhole/test_silicon_driver_bh.cpp b/tests/blackhole/test_silicon_driver_bh.cpp index 39b3c89e..735bad0d 100644 --- a/tests/blackhole/test_silicon_driver_bh.cpp +++ b/tests/blackhole/test_silicon_driver_bh.cpp @@ -2,19 +2,19 @@ // // SPDX-License-Identifier: Apache-2.0 -#include +#include #include #include -#include "device/blackhole/blackhole_implementation.h" -#include "device/tt_cluster_descriptor.h" #include "eth_l1_address_map.h" #include "gtest/gtest.h" #include "host_mem_address_map.h" #include "l1_address_map.h" #include "tests/test_utils/device_test_utils.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/blackhole_implementation.h" +#include "umd/device/tt_cluster_descriptor.h" using namespace tt::umd; diff --git a/tests/galaxy/test_galaxy_common.h b/tests/galaxy/test_galaxy_common.h index c9febe0a..01ecc704 100644 --- a/tests/galaxy/test_galaxy_common.h +++ b/tests/galaxy/test_galaxy_common.h @@ -12,9 +12,9 @@ #include #include -#include "device/cluster.h" -#include "device/tt_xy_pair.h" #include "fmt/core.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_xy_pair.h" // static const std::string SOC_DESC_PATH = "./tests/soc_descs/wormhole_b0_8x10.yaml"; diff --git a/tests/galaxy/test_umd_concurrent_threads.cpp b/tests/galaxy/test_umd_concurrent_threads.cpp index a8b1c6f7..e668160f 100644 --- a/tests/galaxy/test_umd_concurrent_threads.cpp +++ b/tests/galaxy/test_umd_concurrent_threads.cpp @@ -6,7 +6,6 @@ #include #include -#include "cluster.h" #include "common/logger.hpp" #include "eth_interface.h" #include "gtest/gtest.h" @@ -16,7 +15,8 @@ #include "tests/test_utils/device_test_utils.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/wormhole/test_wh_common.h" -#include "tt_cluster_descriptor.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" static const std::string SOC_DESC_PATH = "tests/soc_descs/wormhole_b0_8x10.yaml"; diff --git a/tests/galaxy/test_umd_remote_api.cpp b/tests/galaxy/test_umd_remote_api.cpp index 8904ec6f..366ea05d 100644 --- a/tests/galaxy/test_umd_remote_api.cpp +++ b/tests/galaxy/test_umd_remote_api.cpp @@ -5,7 +5,6 @@ #include #include -#include "cluster.h" #include "common/logger.hpp" #include "eth_interface.h" #include "gtest/gtest.h" @@ -15,7 +14,8 @@ #include "tests/test_utils/device_test_utils.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/wormhole/test_wh_common.h" -#include "tt_cluster_descriptor.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" static const std::string SOC_DESC_PATH = "tests/soc_descs/wormhole_b0_8x10.yaml"; diff --git a/tests/galaxy/test_umd_remote_api_stability.cpp b/tests/galaxy/test_umd_remote_api_stability.cpp index af2cc5fb..86416e4d 100644 --- a/tests/galaxy/test_umd_remote_api_stability.cpp +++ b/tests/galaxy/test_umd_remote_api_stability.cpp @@ -7,7 +7,6 @@ #include #include -#include "cluster.h" #include "common/logger.hpp" #include "eth_interface.h" #include "filesystem" @@ -18,8 +17,9 @@ #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/test_utils/stimulus_generators.hpp" #include "tests/wormhole/test_wh_common.h" -#include "tt_cluster_descriptor.h" -#include "tt_soc_descriptor.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" +#include "umd/device/tt_soc_descriptor.h" namespace tt::umd::test::utils { diff --git a/tests/grayskull/test_silicon_driver.cpp b/tests/grayskull/test_silicon_driver.cpp index 4d90b931..04af85bb 100644 --- a/tests/grayskull/test_silicon_driver.cpp +++ b/tests/grayskull/test_silicon_driver.cpp @@ -4,14 +4,14 @@ #include -#include "cluster.h" -#include "device/tt_cluster_descriptor.h" -#include "device/tt_soc_descriptor.h" -#include "device/wormhole/wormhole_implementation.h" #include "gtest/gtest.h" #include "l1_address_map.h" #include "tests/test_utils/device_test_utils.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" +#include "umd/device/tt_soc_descriptor.h" +#include "umd/device/wormhole_implementation.h" using namespace tt::umd; diff --git a/tests/misc/test_semver.cpp b/tests/misc/test_semver.cpp index 1d1a179a..315af05a 100644 --- a/tests/misc/test_semver.cpp +++ b/tests/misc/test_semver.cpp @@ -8,7 +8,7 @@ #include -#include "common/semver.hpp" +#include "umd/device/semver.hpp" using tt::umd::semver_t; diff --git a/tests/pcie/test_pcie_device.cpp b/tests/pcie/test_pcie_device.cpp index f2922103..02de5fe1 100644 --- a/tests/pcie/test_pcie_device.cpp +++ b/tests/pcie/test_pcie_device.cpp @@ -11,8 +11,8 @@ #include #include -#include "device/pcie/pci_device.hpp" #include "fmt/xchar.h" +#include "umd/device/pci_device.hpp" TEST(PcieDeviceTest, Numa) { std::vector nodes; diff --git a/tests/simulation/device_fixture.hpp b/tests/simulation/device_fixture.hpp index 36e981e4..4d76c308 100644 --- a/tests/simulation/device_fixture.hpp +++ b/tests/simulation/device_fixture.hpp @@ -12,7 +12,7 @@ #include "common/logger.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" -#include "tt_simulation_device.h" +#include "umd/device/tt_simulation_device.h" class SimulationDeviceFixture : public ::testing::Test { protected: diff --git a/tests/test_utils/device_test_utils.hpp b/tests/test_utils/device_test_utils.hpp index ae9292e9..842e4ce5 100644 --- a/tests/test_utils/device_test_utils.hpp +++ b/tests/test_utils/device_test_utils.hpp @@ -10,7 +10,7 @@ #include #include -#include "cluster.h" +#include "umd/device/cluster.h" namespace test_utils { diff --git a/tests/test_utils/stimulus_generators.hpp b/tests/test_utils/stimulus_generators.hpp index 320156a5..025284bc 100644 --- a/tests/test_utils/stimulus_generators.hpp +++ b/tests/test_utils/stimulus_generators.hpp @@ -12,9 +12,9 @@ #include #include -#include "cluster.h" -#include "tt_cluster_descriptor.h" -#include "tt_xy_pair.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" +#include "umd/device/tt_xy_pair.h" /* Sizes: * Distribution (including min/max) diff --git a/tests/wormhole/test_silicon_driver_wh.cpp b/tests/wormhole/test_silicon_driver_wh.cpp index 8cb6f44e..8ad98b5a 100644 --- a/tests/wormhole/test_silicon_driver_wh.cpp +++ b/tests/wormhole/test_silicon_driver_wh.cpp @@ -4,15 +4,15 @@ #include #include -#include "cluster.h" -#include "device/tt_cluster_descriptor.h" -#include "device/wormhole/wormhole_implementation.h" #include "eth_l1_address_map.h" #include "gtest/gtest.h" #include "host_mem_address_map.h" #include "l1_address_map.h" #include "tests/test_utils/device_test_utils.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" +#include "umd/device/wormhole_implementation.h" using namespace tt::umd; diff --git a/tests/wormhole/test_umd_remote_api_stability.cpp b/tests/wormhole/test_umd_remote_api_stability.cpp index 39ebf39f..26978a2b 100644 --- a/tests/wormhole/test_umd_remote_api_stability.cpp +++ b/tests/wormhole/test_umd_remote_api_stability.cpp @@ -9,7 +9,6 @@ #include #include -#include "cluster.h" #include "common/logger.hpp" #include "eth_interface.h" #include "filesystem" @@ -19,8 +18,9 @@ #include "test_wh_common.h" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/test_utils/stimulus_generators.hpp" -#include "tt_cluster_descriptor.h" -#include "tt_soc_descriptor.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" +#include "umd/device/tt_soc_descriptor.h" namespace tt::umd::test::utils { class WormholeNebulaX2TestFixture : public WormholeTestFixture { diff --git a/tests/wormhole/test_wh_common.h b/tests/wormhole/test_wh_common.h index c358cb3a..fe76e3c2 100644 --- a/tests/wormhole/test_wh_common.h +++ b/tests/wormhole/test_wh_common.h @@ -5,12 +5,12 @@ */ #pragma once -#include "cluster.h" #include "eth_l1_address_map.h" #include "tests/test_utils/generate_cluster_desc.hpp" #include "tests/test_utils/stimulus_generators.hpp" -#include "tt_cluster_descriptor.h" -#include "tt_xy_pair.h" +#include "umd/device/cluster.h" +#include "umd/device/tt_cluster_descriptor.h" +#include "umd/device/tt_xy_pair.h" namespace tt::umd::test::utils {