From 196219bae8cb6296947786c0e45146553cabccd5 Mon Sep 17 00:00:00 2001 From: pjanevski Date: Wed, 5 Mar 2025 10:14:17 +0000 Subject: [PATCH 1/2] Hide create-ethernet-map call from public API --- device/api/umd/device/tt_cluster_descriptor.h | 3 ++- tests/api/test_cluster_descriptor.cpp | 7 +++++-- tests/galaxy/test_umd_concurrent_threads.cpp | 6 +++--- tests/galaxy/test_umd_remote_api.cpp | 6 +++--- tests/galaxy/test_umd_remote_api_stability.cpp | 2 +- tests/wormhole/test_cluster_wh.cpp | 2 +- tests/wormhole/test_umd_remote_api_stability.cpp | 2 +- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/device/api/umd/device/tt_cluster_descriptor.h b/device/api/umd/device/tt_cluster_descriptor.h index 0993dfc6..89c0896d 100644 --- a/device/api/umd/device/tt_cluster_descriptor.h +++ b/device/api/umd/device/tt_cluster_descriptor.h @@ -78,6 +78,8 @@ class tt_ClusterDescriptor { void fill_chips_grouped_by_closest_mmio(); + static std::unique_ptr create(); + std::map dram_harvesting_masks = {}; std::map eth_harvesting_masks = {}; @@ -98,7 +100,6 @@ class tt_ClusterDescriptor { // get_cluster_descriptor_file_path will create ethernet map in the background. static std::string get_cluster_descriptor_file_path(); static std::unique_ptr create_from_yaml(const std::string &cluster_descriptor_file_path); - static std::unique_ptr create(); static tt::ARCH detect_arch(const chip_id_t chip_id); // This function is used to create mock cluster descriptor yaml files, for example for simulation. diff --git a/tests/api/test_cluster_descriptor.cpp b/tests/api/test_cluster_descriptor.cpp index e12a1cbf..a865838e 100644 --- a/tests/api/test_cluster_descriptor.cpp +++ b/tests/api/test_cluster_descriptor.cpp @@ -10,11 +10,14 @@ #include "disjoint_set.hpp" #include "tests/test_utils/generate_cluster_desc.hpp" +#include "umd/device/cluster.h" #include "umd/device/pci_device.hpp" #include "umd/device/tt_cluster_descriptor.h" +using namespace tt::umd; + TEST(ApiClusterDescriptorTest, DetectArch) { - std::unique_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::unique_ptr cluster_desc = Cluster::create_cluster_descriptor(); if (cluster_desc->get_number_of_chips() == 0) { // Expect it to be invalid if no devices are found. @@ -46,7 +49,7 @@ TEST(ApiClusterDescriptorTest, DetectArch) { } TEST(ApiClusterDescriptorTest, BasicFunctionality) { - std::unique_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::unique_ptr cluster_desc = Cluster::create_cluster_descriptor(); if (cluster_desc == nullptr) { GTEST_SKIP() << "No chips present on the system. Skipping test."; diff --git a/tests/galaxy/test_umd_concurrent_threads.cpp b/tests/galaxy/test_umd_concurrent_threads.cpp index 1b13a0ca..763c3d83 100644 --- a/tests/galaxy/test_umd_concurrent_threads.cpp +++ b/tests/galaxy/test_umd_concurrent_threads.cpp @@ -24,7 +24,7 @@ static const std::string SOC_DESC_PATH = "tests/soc_descs/wormhole_b0_8x10.yaml" TEST(GalaxyConcurrentThreads, WriteToAllChipsL1) { // Galaxy Setup - std::shared_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::shared_ptr cluster_desc = Cluster::create_cluster_descriptor(); std::set target_devices_th1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; std::set target_devices_th2 = {17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}; std::set all_devices = {}; @@ -122,7 +122,7 @@ TEST(GalaxyConcurrentThreads, WriteToAllChipsL1) { TEST(GalaxyConcurrentThreads, WriteToAllChipsDram) { // Galaxy Setup - std::shared_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::shared_ptr cluster_desc = Cluster::create_cluster_descriptor(); std::set target_devices_th1 = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32}; std::set target_devices_th2 = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}; std::set all_devices = {}; @@ -219,7 +219,7 @@ TEST(GalaxyConcurrentThreads, WriteToAllChipsDram) { TEST(GalaxyConcurrentThreads, PushInputsWhileSignalingCluster) { // Galaxy Setup - std::shared_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::shared_ptr cluster_desc = Cluster::create_cluster_descriptor(); std::set target_devices = {0, 1, 2, 3, 4, 5, 6, 7, 8}; for (const auto& chip : target_devices) { // Verify that selected chips are in the cluster diff --git a/tests/galaxy/test_umd_remote_api.cpp b/tests/galaxy/test_umd_remote_api.cpp index d166e24d..e0d2b28e 100644 --- a/tests/galaxy/test_umd_remote_api.cpp +++ b/tests/galaxy/test_umd_remote_api.cpp @@ -21,7 +21,7 @@ static const std::string SOC_DESC_PATH = "tests/soc_descs/wormhole_b0_8x10.yaml" void run_remote_read_write_test(uint32_t vector_size, bool dram_write) { // Galaxy Setup - std::shared_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::shared_ptr cluster_desc = Cluster::create_cluster_descriptor(); std::set target_devices = {}; for (const auto& chip : cluster_desc->get_all_chips()) { target_devices.insert(chip); @@ -127,7 +127,7 @@ TEST(GalaxyBasicReadWrite, LargeRemoteDramBlockReadWrite) { run_remote_read_writ void run_data_mover_test( uint32_t vector_size, tt_multichip_core_addr sender_core, tt_multichip_core_addr receiver_core) { // Galaxy Setup - std::shared_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::shared_ptr cluster_desc = Cluster::create_cluster_descriptor(); std::set target_devices = {}; for (const auto& chip : cluster_desc->get_all_chips()) { target_devices.insert(chip); @@ -246,7 +246,7 @@ TEST(GalaxyDataMovement, TwoChipMoveData4) { void run_data_broadcast_test( uint32_t vector_size, tt_multichip_core_addr sender_core, std::vector receiver_cores) { // Galaxy Setup - std::shared_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::shared_ptr cluster_desc = Cluster::create_cluster_descriptor(); std::set target_devices = {}; for (const auto& chip : cluster_desc->get_all_chips()) { target_devices.insert(chip); diff --git a/tests/galaxy/test_umd_remote_api_stability.cpp b/tests/galaxy/test_umd_remote_api_stability.cpp index 9da5a0d3..c84cf87d 100644 --- a/tests/galaxy/test_umd_remote_api_stability.cpp +++ b/tests/galaxy/test_umd_remote_api_stability.cpp @@ -33,7 +33,7 @@ class WormholeGalaxyStabilityTestFixture : public WormholeTestFixture { static uint32_t scale_number_of_tests; static void SetUpTestSuite() { - std::unique_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::unique_ptr cluster_desc = Cluster::create_cluster_descriptor(); detected_num_chips = cluster_desc->get_number_of_chips(); if (detected_num_chips < EXPECTED_MIN_CHIPS) { skip_tests = true; diff --git a/tests/wormhole/test_cluster_wh.cpp b/tests/wormhole/test_cluster_wh.cpp index 6ca69a8e..feaddaa8 100644 --- a/tests/wormhole/test_cluster_wh.cpp +++ b/tests/wormhole/test_cluster_wh.cpp @@ -73,7 +73,7 @@ std::int32_t get_static_tlb_index(tt_xy_pair target) { std::set get_target_devices() { std::set target_devices; - std::unique_ptr cluster_desc_uniq = tt_ClusterDescriptor::create(); + std::unique_ptr cluster_desc_uniq = Cluster::create_cluster_descriptor(); for (int i = 0; i < cluster_desc_uniq->get_number_of_chips(); i++) { target_devices.insert(i); } diff --git a/tests/wormhole/test_umd_remote_api_stability.cpp b/tests/wormhole/test_umd_remote_api_stability.cpp index 18fe7cbc..b22d592a 100644 --- a/tests/wormhole/test_umd_remote_api_stability.cpp +++ b/tests/wormhole/test_umd_remote_api_stability.cpp @@ -33,7 +33,7 @@ class WormholeNebulaX2TestFixture : public WormholeTestFixture { static uint32_t scale_number_of_tests; static void SetUpTestSuite() { - std::unique_ptr cluster_desc = tt_ClusterDescriptor::create(); + std::unique_ptr cluster_desc = Cluster::create_cluster_descriptor(); detected_num_chips = cluster_desc->get_number_of_chips(); if (detected_num_chips != EXPECTED_NUM_CHIPS) { skip_tests = true; From c3b60a66fc26c80018b326079ecac8485c2e532c Mon Sep 17 00:00:00 2001 From: pjanevski Date: Wed, 5 Mar 2025 10:30:00 +0000 Subject: [PATCH 2/2] Fix CI --- tests/blackhole/test_cluster_bh.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/blackhole/test_cluster_bh.cpp b/tests/blackhole/test_cluster_bh.cpp index 59d9b340..1d6c4b2d 100644 --- a/tests/blackhole/test_cluster_bh.cpp +++ b/tests/blackhole/test_cluster_bh.cpp @@ -72,7 +72,7 @@ std::int32_t get_static_tlb_index(tt_xy_pair target) { std::set get_target_devices() { std::set target_devices; - std::unique_ptr cluster_desc_uniq = tt_ClusterDescriptor::create(); + std::unique_ptr cluster_desc_uniq = Cluster::create_cluster_descriptor(); for (int i = 0; i < cluster_desc_uniq->get_number_of_chips(); i++) { target_devices.insert(i); } @@ -104,7 +104,7 @@ TEST(SiliconDriverBH, CreateDestroy) { // { // std::unique_ptr cluster_desc_uniq = -// tt_ClusterDescriptor::create(); +// Cluster::create_cluster_descriptor(); // if (cluster_desc_uniq->get_number_of_chips() != target_devices.size()) { // GTEST_SKIP() << "SiliconDriverWH.Harvesting skipped because it can only be run on a two chip nebula // system"; @@ -136,7 +136,7 @@ TEST(SiliconDriverBH, CreateDestroy) { // std::unordered_map simulated_harvesting_masks = {{0, 30}, {1, 60}}; // { // std::unique_ptr cluster_desc_uniq = -// tt_ClusterDescriptor::create(); +// Cluster::create_cluster_descriptor(); // if (cluster_desc_uniq->get_number_of_chips() != target_devices.size()) { // GTEST_SKIP() << "SiliconDriverWH.Harvesting skipped because it can only be run on a two chip nebula // system"; @@ -166,7 +166,7 @@ TEST(SiliconDriverBH, CreateDestroy) { // std::unordered_map simulated_harvesting_masks = {{0, 30}, {1, 60}}; // { // std::unique_ptr cluster_desc_uniq = -// tt_ClusterDescriptor::create(); +// Cluster::create_cluster_descriptor(); // if (cluster_desc_uniq->get_number_of_chips() != target_devices.size()) { // GTEST_SKIP() << "SiliconDriverWH.Harvesting skipped because it can only be run on a two chip nebula // system";