Skip to content

Commit

Permalink
Move fabric to tt_metal
Browse files Browse the repository at this point in the history
  • Loading branch information
aliuTT committed Jan 29, 2025
1 parent 776a92d commit 0636a7d
Show file tree
Hide file tree
Showing 31 changed files with 263 additions and 239 deletions.
10 changes: 0 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ include(tracy)
# Build subdirectories
############################################################################################################################

add_subdirectory(tt_fabric)
add_subdirectory(tt_metal)
add_subdirectory(ttnn)

Expand All @@ -257,15 +256,6 @@ endif()
# Install for build artifacts that will upload build/lib
include(GNUInstallDirs)

install(
TARGETS
tt_fabric
ARCHIVE
DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT dev
)
install(
TARGETS
tt_metal
Expand Down
6 changes: 3 additions & 3 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ tests/scripts/t3000/ @tenstorrent/metalium-developers-infra
tests/scripts/tg/ @tenstorrent/metalium-developers-infra
tests/scripts/tgg/ @tenstorrent/metalium-developers-infra

# fabric
tt_fabric/ @ubcheema @aliuTT @aagarwalTT

# Metalium - public API
tt_metal/api @abhullar-tt @pgkeller @aliuTT @tt-aho @tt-dma @tt-asaigal @ubcheema @cfjchu @omilyutin-tt

Expand All @@ -59,6 +56,9 @@ tt_metal/host_api.hpp @abhullar-tt @pgkeller @aliuTT @tt-aho @tt-dma @tt-asaigal
tt_metal/impl/device/ @abhullar-tt @pgkeller @aliuTT @tt-aho @tt-dma @tt-asaigal @ubcheema @davorchap @cfjchu @omilyutin-tt
tt_metal/**/requirements*.txt @tenstorrent/metalium-developers-infra

# fabric
tt_metal/fabric/ @ubcheema @aliuTT @aagarwalTT

# metal - dispatch
tt_metal/impl/dispatch/kernels/packet_* @ubcheema @aliuTT
tt_metal/impl/dispatch/kernels/eth_* @ubcheema @aliuTT
Expand Down
5 changes: 2 additions & 3 deletions tests/tt_metal/tt_fabric/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ target_link_libraries(
fabric_unit_tests
PRIVATE
tt_metal
tt_fabric
fabric
test_common_libs
)

target_include_directories(
fabric_unit_tests
PRIVATE
${UMD_HOME}
${PROJECT_SOURCE_DIR}/tt_fabric
${PROJECT_SOURCE_DIR}/tests
${PROJECT_SOURCE_DIR}/tt_metal
${CMAKE_CURRENT_SOURCE_DIR}/common
Expand All @@ -23,7 +22,7 @@ set_target_properties(
fabric_unit_tests
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/test/tt_metal/tt_fabric
${PROJECT_BINARY_DIR}/test/tt_metal/fabric
)

gtest_discover_tests(fabric_unit_tests)
25 changes: 16 additions & 9 deletions tests/tt_metal/tt_fabric/fabric_router/test_routing_tables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@

#include <memory>
#include "fabric_fixture.hpp"
#include "tt_fabric/control_plane.hpp"
#include "tt_fabric/mesh_graph.hpp"
#include "tt_fabric/routing_table_generator.hpp"
#include "tt_metal/fabric/control_plane.hpp"
#include "tt_metal/fabric/mesh_graph.hpp"
#include "tt_metal/fabric/routing_table_generator.hpp"

namespace tt::tt_fabric {
namespace fabric_router_tests {

TEST_F(ControlPlaneFixture, TestTGMeshGraphInit) {
const std::filesystem::path tg_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
auto mesh_graph_desc = std::make_unique<MeshGraph>(tg_mesh_graph_desc_path.string());
}

TEST_F(ControlPlaneFixture, TestTGControlPlaneInit) {
const std::filesystem::path tg_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
auto control_plane = std::make_unique<ControlPlane>(tg_mesh_graph_desc_path.string());
}

TEST_F(ControlPlaneFixture, TestTGFabricRoutes) {
const std::filesystem::path tg_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
auto control_plane = std::make_unique<ControlPlane>(tg_mesh_graph_desc_path.string());
auto valid_chans = control_plane->get_valid_eth_chans_on_routing_plane(0, 0, 3);
for (auto chan : valid_chans) {
Expand All @@ -39,21 +39,21 @@ TEST_F(ControlPlaneFixture, TestTGFabricRoutes) {
TEST_F(ControlPlaneFixture, TestT3kMeshGraphInit) {
const std::filesystem::path t3k_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/t3k_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/t3k_mesh_graph_descriptor.yaml";
auto mesh_graph_desc = std::make_unique<MeshGraph>(t3k_mesh_graph_desc_path.string());
}

TEST_F(ControlPlaneFixture, TestT3kControlPlaneInit) {
const std::filesystem::path t3k_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/t3k_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/t3k_mesh_graph_descriptor.yaml";
auto control_plane = std::make_unique<ControlPlane>(t3k_mesh_graph_desc_path.string());
}

TEST_F(ControlPlaneFixture, TestT3kFabricRoutes) {
const std::filesystem::path t3k_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/t3k_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/t3k_mesh_graph_descriptor.yaml";
auto control_plane = std::make_unique<ControlPlane>(t3k_mesh_graph_desc_path.string());
auto valid_chans = control_plane->get_valid_eth_chans_on_routing_plane(0, 0, 0);
for (auto chan : valid_chans) {
Expand All @@ -65,5 +65,12 @@ TEST_F(ControlPlaneFixture, TestT3kFabricRoutes) {
}
}

TEST_F(ControlPlaneFixture, TestQuantaGalaxyControlPlaneInit) {
const std::filesystem::path quanta_galaxy_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_metal/fabric/mesh_graph_descriptors/quanta_galaxy_mesh_graph_descriptor.yaml";
auto control_plane = std::make_unique<ControlPlane>(quanta_galaxy_mesh_graph_desc_path.string());
}

} // namespace fabric_router_tests
} // namespace tt::tt_fabric
3 changes: 1 addition & 2 deletions tests/tt_metal/tt_metal/perf_microbenchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ foreach(arch ${ARCHITECTURES})
test_metal_common_libs
PRIVATE
yaml-cpp::yaml-cpp
tt_fabric
fabric
)
if(${TEST_SRC} STREQUAL "dispatch/test_pgm_dispatch.cpp")
target_link_libraries(${TEST_TARGET} PRIVATE benchmark::benchmark)
Expand All @@ -76,7 +76,6 @@ foreach(arch ${ARCHITECTURES})
PRIVATE
${PROJECT_SOURCE_DIR}/tt_metal/hw/inc/${arch}
"$<TARGET_PROPERTY:Metalium::Metal,INCLUDE_DIRECTORIES>"
${PROJECT_SOURCE_DIR}/tt_fabric
${PROJECT_SOURCE_DIR}/ttnn/cpp/ttnn/deprecated # this all should go away and be replaced with link to ttnn
${PROJECT_SOURCE_DIR}/tests
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// clang-format off
#include "debug/dprint.h"
#include "dataflow_api.h"
#include "tt_fabric/hw/inc/tt_fabric.h"
#include "tt_metal/fabric/hw/inc/tt_fabric.h"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/kernels/tt_fabric_traffic_gen.hpp"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/kernels/tt_fabric_traffic_gen_test.hpp"
#include "tt_fabric/hw/inc/tt_fabric_interface.h"
#include "tt_metal/fabric/hw/inc/tt_fabric_interface.h"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/common/kernel_utils.hpp"
// clang-format on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// clang-format off
#include "dataflow_api.h"
#include "debug/dprint.h"
#include "tt_fabric/hw/inc/tt_fabric.h"
#include "tt_metal/fabric/hw/inc/tt_fabric.h"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/kernels/tt_fabric_traffic_gen.hpp"
#include "tt_fabric/hw/inc/tt_fabric_interface.h"
#include "tt_fabric/hw/inc/tt_fabric_api.h"
#include "tt_metal/fabric/hw/inc/tt_fabric_interface.h"
#include "tt_metal/fabric/hw/inc/tt_fabric_api.h"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/common/kernel_utils.hpp"
// clang-format on

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#include <tt-metalium/tt_metal.hpp>
#include <tt-metalium/device_impl.hpp>
#include <tt-metalium/rtoptions.hpp>
#include "tt_fabric/control_plane.hpp"
#include "tt_metal/fabric/control_plane.hpp"
// #include <tt-metalium/cq_commands.hpp>
// #include "tt_metal/impl/dispatch/kernels/packet_queue_ctrl.hpp"
#include "kernels/tt_fabric_traffic_gen_test.hpp"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/test_common.hpp"
#include "eth_l1_address_map.h"
#include "tt_fabric/hw/inc/tt_fabric_interface.h"
#include "tt_metal/fabric/hw/inc/tt_fabric_interface.h"

using std::vector;
using namespace tt;
Expand Down Expand Up @@ -235,7 +235,7 @@ int main(int argc, char** argv) {
try {
const std::filesystem::path tg_mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
"tt_metal/fabric/mesh_graph_descriptors/tg_mesh_graph_descriptor.yaml";
auto control_plane = std::make_unique<tt::tt_fabric::ControlPlane>(tg_mesh_graph_desc_path.string());

int num_devices = tt_metal::GetNumAvailableDevices();
Expand Down Expand Up @@ -362,7 +362,7 @@ int main(int argc, char** argv) {
for (auto logical_core : device_router_cores) {
auto router_kernel = tt_metal::CreateKernel(
program_map[device.first],
"tt_fabric/impl/kernels/tt_fabric_router.cpp",
"tt_metal/fabric/impl/kernels/tt_fabric_router.cpp",
logical_core,
tt_metal::EthernetConfig{
.noc = tt_metal::NOC::NOC_0, .compile_args = router_compile_args, .defines = defines});
Expand Down Expand Up @@ -393,7 +393,7 @@ int main(int argc, char** argv) {

auto kernel = tt_metal::CreateKernel(
program_map[device.first],
"tt_fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
"tt_metal/fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
{gk_core},
tt_metal::DataMovementConfig{
.processor = tt_metal::DataMovementProcessor::RISCV_0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <tt-metalium/tt_metal.hpp>
#include <tt-metalium/device_impl.hpp>
#include <tt-metalium/rtoptions.hpp>
#include "tt_fabric/control_plane.hpp"
#include "tt_fabric/mesh_graph.hpp"
#include "tt_metal/fabric/mesh_graph.hpp"
#include "tt_metal/fabric/control_plane.hpp"
//#include <tt-metalium/cq_commands.hpp>
//#include "tt_metal/impl/dispatch/kernels/packet_queue_ctrl.hpp"
#include "kernels/tt_fabric_traffic_gen_test.hpp"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/test_common.hpp"
#include "eth_l1_address_map.h"
#include "tt_fabric/hw/inc/tt_fabric_interface.h"
#include "tt_metal/fabric/hw/inc/tt_fabric_interface.h"
#include <numeric>
#include <algorithm>
#include <random>
Expand Down Expand Up @@ -140,7 +140,7 @@ typedef struct test_board {
try {
const std::filesystem::path mesh_graph_desc_path =
std::filesystem::path(tt::llrt::RunTimeOptions::get_instance().get_root_dir()) /
"tt_fabric/mesh_graph_descriptors" / mesh_graph_descriptor;
"tt_metal/fabric/mesh_graph_descriptors" / mesh_graph_descriptor;
control_plane = std::make_unique<tt::tt_fabric::ControlPlane>(mesh_graph_desc_path.string());
} catch (const std::exception& e) {
log_fatal(e.what());
Expand Down Expand Up @@ -425,7 +425,7 @@ typedef struct test_device {

auto kernel = tt_metal::CreateKernel(
program_handle,
"tt_fabric/impl/kernels/tt_fabric_router.cpp",
"tt_metal/fabric/impl/kernels/tt_fabric_router.cpp",
router_logical_cores[i],
tt_metal::EthernetConfig{
.noc = tt_metal::NOC::NOC_0, .compile_args = compile_args, .defines = defines});
Expand All @@ -451,7 +451,7 @@ typedef struct test_device {
if (run_gk_on_idle_ethernet) {
kernel = tt_metal::CreateKernel(
program_handle,
"tt_fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
"tt_metal/fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
{gk_logical_core},
tt_metal::EthernetConfig{
.eth_mode = Eth::IDLE,
Expand All @@ -461,7 +461,7 @@ typedef struct test_device {
} else {
kernel = tt_metal::CreateKernel(
program_handle,
"tt_fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
"tt_metal/fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
{gk_logical_core},
tt_metal::DataMovementConfig{
.processor = tt_metal::DataMovementProcessor::RISCV_0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#include <tt-metalium/tt_metal.hpp>
#include <tt-metalium/device_impl.hpp>
#include <tt-metalium/rtoptions.hpp>
#include "tt_fabric/control_plane.hpp"
#include "tt_metal/fabric/control_plane.hpp"
// #include "tt_metal/impl/dispatch/cq_commands.hpp"
// #include "tt_metal/impl/dispatch/kernels/packet_queue_ctrl.hpp"
#include "kernels/tt_fabric_traffic_gen_test.hpp"
#include "tests/tt_metal/tt_metal/perf_microbenchmark/routing/test_common.hpp"
#include "eth_l1_address_map.h"
#include "tt_fabric/hw/inc/tt_fabric_interface.h"
#include "tt_metal/fabric/hw/inc/tt_fabric_interface.h"

using std::vector;
using namespace tt;
Expand Down Expand Up @@ -391,7 +391,7 @@ int main(int argc, char** argv) {

auto kernel = tt_metal::CreateKernel(
program_map[device.first],
"tt_fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
"tt_metal/fabric/impl/kernels/tt_fabric_gatekeeper.cpp",
{gk_core},
tt_metal::DataMovementConfig{
.processor = tt_metal::DataMovementProcessor::RISCV_0,
Expand Down
75 changes: 0 additions & 75 deletions tt_fabric/control_plane.hpp

This file was deleted.

Loading

0 comments on commit 0636a7d

Please sign in to comment.