diff --git a/device/api/umd/device/blackhole_coordinate_manager.h b/device/api/umd/device/blackhole_coordinate_manager.h index 488b0a5b..50ed0a22 100644 --- a/device/api/umd/device/blackhole_coordinate_manager.h +++ b/device/api/umd/device/blackhole_coordinate_manager.h @@ -13,14 +13,13 @@ class BlackholeCoordinateManager : public CoordinateManager { public: BlackholeCoordinateManager( const bool noc_translation_enabled, + + tt::umd::HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, diff --git a/device/api/umd/device/cluster.h b/device/api/umd/device/cluster.h index 5adc8710..518ce1e8 100644 --- a/device/api/umd/device/cluster.h +++ b/device/api/umd/device/cluster.h @@ -16,8 +16,6 @@ #include "fmt/core.h" #include "tt_silicon_driver_common.hpp" -#include "tt_soc_descriptor.h" -#include "tt_xy_pair.h" #include "umd/device/blackhole_arc_message_queue.h" #include "umd/device/chip/chip.h" #include "umd/device/tt_device/tt_device.h" @@ -25,7 +23,6 @@ #include "umd/device/types/arch.h" #include "umd/device/types/cluster_descriptor_types.h" #include "umd/device/types/cluster_types.h" -#include "umd/device/types/harvesting.h" #include "umd/device/types/tlb.h" using TLB_DATA = tt::umd::tlb_data; @@ -500,7 +497,7 @@ class Cluster : public tt_device { const bool skip_driver_allocs = false, const bool clean_system_resources = false, bool perform_harvesting = true, - std::unordered_map simulated_harvesting_masks = {}); + std::unordered_map simulated_harvesting_masks = {}); /** * Cluster constructor. @@ -520,7 +517,7 @@ class Cluster : public tt_device { const bool skip_driver_allocs = false, const bool clean_system_resources = false, bool perform_harvesting = true, - std::unordered_map simulated_harvesting_masks = {}); + std::unordered_map simulated_harvesting_masks = {}); /** * Cluster constructor. @@ -544,7 +541,7 @@ class Cluster : public tt_device { const bool skip_driver_allocs = false, const bool clean_system_resources = false, bool perform_harvesting = true, - std::unordered_map simulated_harvesting_masks = {}); + std::unordered_map simulated_harvesting_masks = {}); /** * Cluster constructor. @@ -566,7 +563,7 @@ class Cluster : public tt_device { const bool skip_driver_allocs = false, const bool clean_system_resources = false, bool perform_harvesting = true, - std::unordered_map simulated_harvesting_masks = {}); + std::unordered_map simulated_harvesting_masks = {}); /** * Cluster constructor which creates a cluster with Mock chips. @@ -878,36 +875,41 @@ class Cluster : public tt_device { chip_id_t chip_id, tt_ClusterDescriptor* cluster_desc, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks); + std::unordered_map& simulated_harvesting_masks); std::unique_ptr construct_chip_from_cluster( chip_id_t logical_device_id, tt_ClusterDescriptor* cluster_desc, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks); + std::unordered_map& simulated_harvesting_masks); void add_chip(chip_id_t chip_id, std::unique_ptr chip); + HarvestingMasks get_harvesting_masks( + chip_id_t chip_id, + tt_ClusterDescriptor* cluster_desc, + bool perfrom_harvesting, + std::unordered_map& simulated_harvesting_masks); uint32_t get_tensix_harvesting_mask( chip_id_t chip_id, tt_ClusterDescriptor* cluster_desc, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks); + std::unordered_map& simulated_harvesting_masks); // TODO: this function returns only software harvesting mask for DRAM. // Combine this with silicon harvesting mask once gathering silicon harvesting mask is implemented. uint32_t get_dram_harvesting_mask( chip_id_t chip_id, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks); + std::unordered_map& simulated_harvesting_masks); // TODO: this function returns only software harvesting mask for ETH. // Combine this with silicon harvesting mask once gathering silicon harvesting mask is implemented. uint32_t get_eth_harvesting_mask( chip_id_t chip_id, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks); + std::unordered_map& simulated_harvesting_masks); void construct_cluster( const uint32_t& num_host_mem_ch_per_mmio_device, const bool skip_driver_allocs, const bool clean_system_resources, bool perform_harvesting, - std::unordered_map simulated_harvesting_masks); + std::unordered_map simulated_harvesting_masks); // Helper function for translating chip coordinates. tt_xy_pair translate_to_api_coords(const chip_id_t chip, const tt::umd::CoreCoord core_coord) const; diff --git a/device/api/umd/device/coordinate_manager.h b/device/api/umd/device/coordinate_manager.h index c9bee261..c07e633b 100644 --- a/device/api/umd/device/coordinate_manager.h +++ b/device/api/umd/device/coordinate_manager.h @@ -14,6 +14,7 @@ #include "umd/device/tt_xy_pair.h" #include "umd/device/types/arch.h" #include "umd/device/types/cluster_descriptor_types.h" +#include "umd/device/types/harvesting.h" class CoordinateManager { public: @@ -28,14 +29,12 @@ class CoordinateManager { static std::shared_ptr create_coordinate_manager( tt::ARCH arch, const bool noc_translation_enabled, + tt::umd::HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, @@ -45,9 +44,7 @@ class CoordinateManager { static std::shared_ptr create_coordinate_manager( tt::ARCH arch, const bool noc_translation_enabled, - const size_t tensix_harvesting_mask = 0, - const size_t dram_harvesting_mask = 0, - const size_t eth_harvesting_mask = 0, + const tt::umd::HarvestingMasks harvesting_masks = {0, 0, 0}, const BoardType board_type = BoardType::UNKNOWN, const bool is_chip_remote = false); @@ -72,9 +69,7 @@ class CoordinateManager { std::vector get_harvested_cores(const CoreType core_type) const; tt_xy_pair get_harvested_grid_size(const CoreType core_type) const; - size_t get_tensix_harvesting_mask() const; - size_t get_dram_harvesting_mask() const; - size_t get_eth_harvesting_mask() const; + tt::umd::HarvestingMasks get_harvesting_masks() const; uint32_t get_num_eth_channels() const; @@ -95,14 +90,12 @@ class CoordinateManager { */ CoordinateManager( const bool noc_translation_enabled, + const tt::umd::HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, @@ -201,19 +194,16 @@ class CoordinateManager { // interface it with a coordinate system which abstracts away harvested cores. If it is not enabled, then we need to // interface it with noc0 coordinates. bool noc_translation_enabled; + tt::umd::HarvestingMasks harvesting_masks; tt_xy_pair tensix_grid_size; const std::vector tensix_cores; - size_t tensix_harvesting_mask; - const size_t physical_layout_tensix_harvesting_mask; tt_xy_pair dram_grid_size; const std::vector dram_cores; - size_t dram_harvesting_mask; const size_t num_eth_channels; const std::vector eth_cores; - const size_t eth_harvesting_mask; tt_xy_pair arc_grid_size; const std::vector arc_cores; diff --git a/device/api/umd/device/grayskull_coordinate_manager.h b/device/api/umd/device/grayskull_coordinate_manager.h index 3847c014..b653987e 100644 --- a/device/api/umd/device/grayskull_coordinate_manager.h +++ b/device/api/umd/device/grayskull_coordinate_manager.h @@ -12,14 +12,12 @@ class GrayskullCoordinateManager : public CoordinateManager { public: GrayskullCoordinateManager( + tt::umd::HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, diff --git a/device/api/umd/device/tt_soc_descriptor.h b/device/api/umd/device/tt_soc_descriptor.h index 8f2805a3..002b62be 100644 --- a/device/api/umd/device/tt_soc_descriptor.h +++ b/device/api/umd/device/tt_soc_descriptor.h @@ -53,9 +53,7 @@ class tt_SocDescriptor { tt_SocDescriptor( std::string device_descriptor_path, const bool noc_translation_enabled, - const size_t tensix_harvesting_mask = 0, - const size_t dram_harvesting_mask = 0, - const size_t eth_harvesting_mask = 0); + const tt::umd::HarvestingMasks harvesting_masks = {0, 0, 0}); // CoreCoord conversions. tt::umd::CoreCoord translate_coord_to(const tt::umd::CoreCoord core_coord, const CoordSystem coord_system) const; @@ -124,14 +122,10 @@ class tt_SocDescriptor { int eth_l1_size; bool noc_translation_id_enabled; uint64_t dram_bank_size; - uint32_t tensix_harvesting_mask; + tt::umd::HarvestingMasks harvesting_masks; private: - void create_coordinate_manager( - const bool noc_translation_enabled, - const size_t tensix_harvesting_mask, - const size_t dram_harvesting_mask, - const size_t eth_harvesting_mask); + void create_coordinate_manager(const bool noc_translation_enabled, const tt::umd::HarvestingMasks harvesting_masks); void load_core_descriptors_from_device_descriptor(YAML::Node &device_descriptor_yaml); void load_soc_features_from_device_descriptor(YAML::Node &device_descriptor_yaml); void get_cores_and_grid_size_from_coordinate_manager(); diff --git a/device/api/umd/device/types/harvesting.h b/device/api/umd/device/types/harvesting.h index f702a404..177fd4a3 100644 --- a/device/api/umd/device/types/harvesting.h +++ b/device/api/umd/device/types/harvesting.h @@ -10,10 +10,10 @@ namespace tt::umd { -struct SoftwareHarvesting { - uint32_t tensix_harvesting_mask; - uint32_t eth_harvesting_mask; - uint32_t dram_harvesting_mask; +struct HarvestingMasks { + size_t tensix_harvesting_mask = 0; + size_t dram_harvesting_mask = 0; + size_t eth_harvesting_mask = 0; }; } // namespace tt::umd diff --git a/device/api/umd/device/wormhole_coordinate_manager.h b/device/api/umd/device/wormhole_coordinate_manager.h index 0b8030fc..eadb4d37 100644 --- a/device/api/umd/device/wormhole_coordinate_manager.h +++ b/device/api/umd/device/wormhole_coordinate_manager.h @@ -13,14 +13,12 @@ class WormholeCoordinateManager : public CoordinateManager { public: WormholeCoordinateManager( const bool noc_translation_enabled, + tt::umd::HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, diff --git a/device/blackhole/blackhole_coordinate_manager.cpp b/device/blackhole/blackhole_coordinate_manager.cpp index cf416986..f8a205a7 100644 --- a/device/blackhole/blackhole_coordinate_manager.cpp +++ b/device/blackhole/blackhole_coordinate_manager.cpp @@ -11,14 +11,12 @@ using namespace tt::umd; BlackholeCoordinateManager::BlackholeCoordinateManager( const bool noc_translation_enabled, + HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, @@ -26,14 +24,12 @@ BlackholeCoordinateManager::BlackholeCoordinateManager( const std::vector& router_cores) : CoordinateManager( noc_translation_enabled, + harvesting_masks, tensix_grid_size, tensix_cores, - tensix_harvesting_mask, dram_grid_size, dram_cores, - dram_harvesting_mask, eth_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, @@ -43,28 +39,30 @@ BlackholeCoordinateManager::BlackholeCoordinateManager( } void BlackholeCoordinateManager::assert_coordinate_manager_constructor() { - log_assert(get_num_harvested(dram_harvesting_mask) <= 1, "Only one DRAM bank can be harvested on Blackhole"); + log_assert( + get_num_harvested(harvesting_masks.dram_harvesting_mask) <= 1, + "Only one DRAM bank can be harvested on Blackhole"); // TODO: assert that exactly 2 or all 14 (P100) ETH cores are harvested for Blackhole. This is // going to be true both for all Blackhole products. - // const size_t num_harvested_eth_cores = get_num_harvested(eth_harvesting_mask); + // const size_t num_harvested_eth_cores = get_num_harvested(harvesting_masks.eth_harvesting_mask); // log_assert( // num_harvested_eth_cores == 2 || num_harvested_eth_cores == blackhole::ETH_GRID_SIZE.x, "Exactly 2 or 14 ETH // cores should be harvested on Blackhole"); } void BlackholeCoordinateManager::translate_tensix_coords() { - if (CoordinateManager::get_num_harvested(tensix_harvesting_mask) > tensix_grid_size.x) { - tensix_harvesting_mask = 0; + if (CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask) > tensix_grid_size.x) { + harvesting_masks.tensix_harvesting_mask = 0; } - size_t num_harvested_x = CoordinateManager::get_num_harvested(tensix_harvesting_mask); + size_t num_harvested_x = CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask); size_t grid_size_x = tensix_grid_size.x; size_t grid_size_y = tensix_grid_size.y; size_t logical_x = 0; size_t x_index = grid_size_x - num_harvested_x; for (size_t x = 0; x < grid_size_x; x++) { - if (tensix_harvesting_mask & (1 << x)) { + if (harvesting_masks.tensix_harvesting_mask & (1 << x)) { for (size_t y = 0; y < grid_size_y; y++) { const tt_xy_pair& physical_core = tensix_cores[x + y * grid_size_x]; const tt_xy_pair& virtual_core = tensix_cores[x_index + y * grid_size_x]; @@ -109,11 +107,11 @@ void BlackholeCoordinateManager::fill_tensix_physical_translated_mapping() { } void BlackholeCoordinateManager::translate_dram_coords() { - size_t num_harvested_banks = CoordinateManager::get_num_harvested(dram_harvesting_mask); + size_t num_harvested_banks = CoordinateManager::get_num_harvested(harvesting_masks.dram_harvesting_mask); size_t logical_x = 0; for (size_t x = 0; x < dram_grid_size.x; x++) { - if (!(dram_harvesting_mask & (1 << x))) { + if (!(harvesting_masks.dram_harvesting_mask & (1 << x))) { for (size_t y = 0; y < dram_grid_size.y; y++) { const tt_xy_pair& dram_core = dram_cores[x * dram_grid_size.y + y]; @@ -139,7 +137,7 @@ void BlackholeCoordinateManager::translate_dram_coords() { size_t harvested_index = (dram_grid_size.x - num_harvested_banks) * dram_grid_size.y; for (size_t x = 0; x < dram_grid_size.x; x++) { - if (dram_harvesting_mask & (1 << x)) { + if (harvesting_masks.dram_harvesting_mask & (1 << x)) { for (size_t y = 0; y < dram_grid_size.y; y++) { const tt_xy_pair& dram_core = dram_cores[x * dram_grid_size.y + y]; const tt_xy_pair& virtual_core = dram_cores[harvested_index++]; @@ -160,12 +158,12 @@ void BlackholeCoordinateManager::translate_dram_coords() { } void BlackholeCoordinateManager::translate_eth_coords() { - size_t num_harvested_channels = CoordinateManager::get_num_harvested(eth_harvesting_mask); + size_t num_harvested_channels = CoordinateManager::get_num_harvested(harvesting_masks.eth_harvesting_mask); size_t harvested_eth_channel_start = eth_cores.size() - num_harvested_channels; size_t unharvested_logical_eth_channel = 0; for (size_t eth_channel = 0; eth_channel < eth_cores.size(); eth_channel++) { - if (eth_harvesting_mask & (1 << eth_channel)) { + if (harvesting_masks.eth_harvesting_mask & (1 << eth_channel)) { const tt_xy_pair& physical_core = eth_cores[eth_channel]; const tt_xy_pair& virtual_core = eth_cores[harvested_eth_channel_start++]; @@ -194,7 +192,7 @@ void BlackholeCoordinateManager::translate_eth_coords() { } void BlackholeCoordinateManager::fill_eth_physical_translated_mapping() { - const size_t num_harvested_channels = CoordinateManager::get_num_harvested(eth_harvesting_mask); + const size_t num_harvested_channels = CoordinateManager::get_num_harvested(harvesting_masks.eth_harvesting_mask); for (size_t eth_channel = 0; eth_channel < eth_cores.size() - num_harvested_channels; eth_channel++) { const size_t translated_x = eth_channel + blackhole::eth_translated_coordinate_start_x; const size_t translated_y = blackhole::eth_translated_coordinate_start_y; @@ -209,7 +207,7 @@ void BlackholeCoordinateManager::fill_eth_physical_translated_mapping() { // Harvested ETH cores should be mapped to the same physical coordinates. for (size_t eth_channel = 0; eth_channel < eth_cores.size(); eth_channel++) { - if (eth_harvesting_mask & (1 << eth_channel)) { + if (harvesting_masks.eth_harvesting_mask & (1 << eth_channel)) { const tt_xy_pair& physical_pair = eth_cores[eth_channel]; const CoreCoord translated_coord = CoreCoord(physical_pair.x, physical_pair.y, CoreType::ETH, CoordSystem::TRANSLATED); @@ -275,7 +273,8 @@ void BlackholeCoordinateManager::fill_dram_physical_translated_mapping() { return; } - const std::vector harvested_banks = CoordinateManager::get_harvested_indices(dram_harvesting_mask); + const std::vector harvested_banks = + CoordinateManager::get_harvested_indices(harvesting_masks.dram_harvesting_mask); if (harvested_banks.empty()) { map_column_of_dram_banks(0, blackhole::NUM_DRAM_BANKS / 2, blackhole::dram_translated_coordinate_start_x); @@ -331,7 +330,7 @@ void BlackholeCoordinateManager::fill_dram_physical_translated_mapping() { } std::vector BlackholeCoordinateManager::get_tensix_cores() const { - std::vector harvested_x_coords = get_harvested_indices(tensix_harvesting_mask); + std::vector harvested_x_coords = get_harvested_indices(harvesting_masks.tensix_harvesting_mask); std::vector unharvested_tensix_cores; for (size_t y = 0; y < tensix_grid_size.y; y++) { for (size_t x = 0; x < tensix_grid_size.x; x++) { @@ -346,7 +345,7 @@ std::vector BlackholeCoordinateManager::get_tensix_cores() const { } std::vector BlackholeCoordinateManager::get_harvested_tensix_cores() const { - std::vector harvested_x_coords = get_harvested_indices(tensix_harvesting_mask); + std::vector harvested_x_coords = get_harvested_indices(harvesting_masks.tensix_harvesting_mask); std::vector harvested_tensix_cores; for (size_t y = 0; y < tensix_grid_size.y; y++) { for (size_t x = 0; x < tensix_grid_size.x; x++) { @@ -361,7 +360,7 @@ std::vector BlackholeCoordinateManager::get_harvested_tensix_cores() } std::vector BlackholeCoordinateManager::get_dram_cores() const { - std::vector harvested_banks = get_harvested_indices(dram_harvesting_mask); + std::vector harvested_banks = get_harvested_indices(harvesting_masks.dram_harvesting_mask); std::vector unharvested_dram_cores; for (size_t x = 0; x < dram_grid_size.x; x++) { if (std::find(harvested_banks.begin(), harvested_banks.end(), x) == harvested_banks.end()) { @@ -376,7 +375,7 @@ std::vector BlackholeCoordinateManager::get_dram_cores() const { } std::vector BlackholeCoordinateManager::get_harvested_dram_cores() const { - std::vector harvested_banks = get_harvested_indices(dram_harvesting_mask); + std::vector harvested_banks = get_harvested_indices(harvesting_masks.dram_harvesting_mask); std::vector harvested_dram_cores; for (size_t x = 0; x < dram_grid_size.x; x++) { if (std::find(harvested_banks.begin(), harvested_banks.end(), x) != harvested_banks.end()) { @@ -391,7 +390,7 @@ std::vector BlackholeCoordinateManager::get_harvested_dram_cores() co } std::vector BlackholeCoordinateManager::get_eth_cores() const { - std::vector harvested_channels = get_harvested_indices(eth_harvesting_mask); + std::vector harvested_channels = get_harvested_indices(harvesting_masks.eth_harvesting_mask); std::vector unharvested_eth_cores; for (size_t eth_channel = 0; eth_channel < num_eth_channels; eth_channel++) { const tt_xy_pair core = eth_cores[eth_channel]; @@ -404,7 +403,7 @@ std::vector BlackholeCoordinateManager::get_eth_cores() const { } std::vector BlackholeCoordinateManager::get_harvested_eth_cores() const { - std::vector harvested_channels = get_harvested_indices(eth_harvesting_mask); + std::vector harvested_channels = get_harvested_indices(harvesting_masks.eth_harvesting_mask); std::vector harvested_eth_cores; for (size_t eth_channel = 0; eth_channel < num_eth_channels; eth_channel++) { const tt_xy_pair core = eth_cores[eth_channel]; @@ -418,17 +417,21 @@ std::vector BlackholeCoordinateManager::get_harvested_eth_cores() con } tt_xy_pair BlackholeCoordinateManager::get_harvested_tensix_grid_size() const { - return {CoordinateManager::get_num_harvested(tensix_harvesting_mask), tensix_grid_size.y}; + return {CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask), tensix_grid_size.y}; } tt_xy_pair BlackholeCoordinateManager::get_harvested_dram_grid_size() const { - return {CoordinateManager::get_num_harvested(dram_harvesting_mask), dram_grid_size.y}; + return {CoordinateManager::get_num_harvested(harvesting_masks.dram_harvesting_mask), dram_grid_size.y}; } tt_xy_pair BlackholeCoordinateManager::get_tensix_grid_size() const { - return {tensix_grid_size.x - CoordinateManager::get_num_harvested(tensix_harvesting_mask), tensix_grid_size.y}; + return { + tensix_grid_size.x - CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask), + tensix_grid_size.y}; } tt_xy_pair BlackholeCoordinateManager::get_dram_grid_size() const { - return {dram_grid_size.x - CoordinateManager::get_num_harvested(dram_harvesting_mask), dram_grid_size.y}; + return { + dram_grid_size.x - CoordinateManager::get_num_harvested(harvesting_masks.dram_harvesting_mask), + dram_grid_size.y}; } diff --git a/device/cluster.cpp b/device/cluster.cpp index fafbc7ee..111a5eb2 100644 --- a/device/cluster.cpp +++ b/device/cluster.cpp @@ -270,7 +270,7 @@ std::unordered_map Cluster::get_harvesting_masks_for_soc_de std::unordered_map harvesting_masks = {}; for (const auto& [chip_id, chip] : chips_) { uint32_t noc0_harvesting_mask = CoordinateManager::shuffle_tensix_harvesting_mask_to_noc0_coords( - chip->get_soc_descriptor().arch, chip->get_soc_descriptor().tensix_harvesting_mask); + chip->get_soc_descriptor().arch, chip->get_soc_descriptor().harvesting_masks.tensix_harvesting_mask); harvesting_masks.insert({chip_id, noc0_harvesting_mask}); } return harvesting_masks; @@ -281,7 +281,7 @@ void Cluster::construct_cluster( const bool skip_driver_allocs, const bool clean_system_resources, bool perform_harvesting, - std::unordered_map simulated_harvesting_masks) { + std::unordered_map simulated_harvesting_masks) { if (!skip_driver_allocs) { auto available_device_ids = detect_available_device_ids(); log_info(LogSiliconDriver, "Detected PCI devices: {}", available_device_ids); @@ -442,17 +442,11 @@ std::unique_ptr Cluster::construct_chip_from_cluster( chip_id_t chip_id, tt_ClusterDescriptor* cluster_desc, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks) { - uint32_t tensix_harvesting_mask = - get_tensix_harvesting_mask(chip_id, cluster_desc, perform_harvesting, simulated_harvesting_masks); - size_t dram_harvesting_mask = get_dram_harvesting_mask(chip_id, perform_harvesting, simulated_harvesting_masks); - size_t eth_harvesting_mask = get_eth_harvesting_mask(chip_id, perform_harvesting, simulated_harvesting_masks); - tt_SocDescriptor soc_desc = tt_SocDescriptor( - soc_desc_path, - cluster_desc->get_noc_translation_table_en().at(chip_id), - tensix_harvesting_mask, - dram_harvesting_mask, - eth_harvesting_mask); + std::unordered_map& simulated_harvesting_masks) { + HarvestingMasks harvesting_masks = + get_harvesting_masks(chip_id, cluster_desc, perform_harvesting, simulated_harvesting_masks); + tt_SocDescriptor soc_desc = + tt_SocDescriptor(soc_desc_path, cluster_desc->get_noc_translation_table_en().at(chip_id), harvesting_masks); return construct_chip_from_cluster(chip_id, cluster_desc, soc_desc); } @@ -460,7 +454,7 @@ std::unique_ptr Cluster::construct_chip_from_cluster( chip_id_t chip_id, tt_ClusterDescriptor* cluster_desc, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks) { + std::unordered_map& simulated_harvesting_masks) { tt::ARCH arch = cluster_desc->get_arch(chip_id); const BoardType chip_board_type = cluster_desc->get_board_type(chip_id); std::string soc_desc_path = tt_SocDescriptor::get_soc_descriptor_path(arch, chip_board_type); @@ -486,7 +480,7 @@ uint32_t Cluster::get_tensix_harvesting_mask( chip_id_t chip_id, tt_ClusterDescriptor* cluster_desc, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks) { + std::unordered_map& simulated_harvesting_masks) { if (!perform_harvesting) { log_info(LogSiliconDriver, "Skipping harvesting for chip {}.", chip_id); return 0; @@ -519,7 +513,7 @@ uint32_t Cluster::get_tensix_harvesting_mask( uint32_t Cluster::get_dram_harvesting_mask( chip_id_t chip_id, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks) { + std::unordered_map& simulated_harvesting_masks) { if (!perform_harvesting) { log_info(LogSiliconDriver, "Skipping DRAM harvesting for chip {}.", chip_id); return 0; @@ -533,7 +527,7 @@ uint32_t Cluster::get_dram_harvesting_mask( uint32_t Cluster::get_eth_harvesting_mask( chip_id_t chip_id, bool perform_harvesting, - std::unordered_map& simulated_harvesting_masks) { + std::unordered_map& simulated_harvesting_masks) { if (!perform_harvesting) { log_info(LogSiliconDriver, "Skipping ETH harvesting for chip {}.", chip_id); return 0; @@ -544,12 +538,24 @@ uint32_t Cluster::get_eth_harvesting_mask( : 0; } +HarvestingMasks Cluster::get_harvesting_masks( + chip_id_t chip_id, + tt_ClusterDescriptor* cluster_desc, + bool perfrom_harvesting, + std::unordered_map& simulated_harvesting_masks) { + return HarvestingMasks{ + .tensix_harvesting_mask = + get_tensix_harvesting_mask(chip_id, cluster_desc, perfrom_harvesting, simulated_harvesting_masks), + .dram_harvesting_mask = get_dram_harvesting_mask(chip_id, perfrom_harvesting, simulated_harvesting_masks), + .eth_harvesting_mask = get_eth_harvesting_mask(chip_id, perfrom_harvesting, simulated_harvesting_masks)}; +} + Cluster::Cluster( const uint32_t& num_host_mem_ch_per_mmio_device, const bool skip_driver_allocs, const bool clean_system_resources, bool perform_harvesting, - std::unordered_map simulated_harvesting_masks) { + std::unordered_map simulated_harvesting_masks) { cluster_desc = tt_ClusterDescriptor::create(); for (auto& chip_id : cluster_desc->get_all_chips()) { @@ -575,7 +581,7 @@ Cluster::Cluster( const bool skip_driver_allocs, const bool clean_system_resources, bool perform_harvesting, - std::unordered_map simulated_harvesting_masks) { + std::unordered_map simulated_harvesting_masks) { cluster_desc = tt_ClusterDescriptor::create(); for (auto& chip_id : target_devices) { @@ -606,7 +612,7 @@ Cluster::Cluster( const bool skip_driver_allocs, const bool clean_system_resources, bool perform_harvesting, - std::unordered_map simulated_harvesting_masks) { + std::unordered_map simulated_harvesting_masks) { cluster_desc = tt_ClusterDescriptor::create(); for (auto& chip_id : target_devices) { @@ -643,7 +649,7 @@ Cluster::Cluster( const bool skip_driver_allocs, const bool clean_system_resources, bool perform_harvesting, - const std::unordered_map simulated_harvesting_masks) { + const std::unordered_map simulated_harvesting_masks) { cluster_desc = tt_ClusterDescriptor::create(); for (auto& [chip_id, chip] : chips) { diff --git a/device/coordinate_manager.cpp b/device/coordinate_manager.cpp index e4d684e7..0d5aa7ae 100644 --- a/device/coordinate_manager.cpp +++ b/device/coordinate_manager.cpp @@ -15,30 +15,25 @@ using namespace tt::umd; CoordinateManager::CoordinateManager( const bool noc_translation_enabled, + HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, const std::vector& pcie_cores, const std::vector& router_cores) : noc_translation_enabled(noc_translation_enabled), + harvesting_masks(harvesting_masks), tensix_grid_size(tensix_grid_size), tensix_cores(tensix_cores), - tensix_harvesting_mask(tensix_harvesting_mask), - physical_layout_tensix_harvesting_mask(tensix_harvesting_mask), dram_grid_size(dram_grid_size), dram_cores(dram_cores), - dram_harvesting_mask(dram_harvesting_mask), num_eth_channels(eth_cores.size()), eth_cores(eth_cores), - eth_harvesting_mask(eth_harvesting_mask), arc_grid_size(arc_grid_size), arc_cores(arc_cores), pcie_grid_size(pcie_grid_size), @@ -57,9 +52,9 @@ void CoordinateManager::initialize() { } void CoordinateManager::assert_coordinate_manager_constructor() { - log_assert(dram_harvesting_mask == 0, "DRAM harvesting is supported only for Blackhole"); + log_assert(harvesting_masks.dram_harvesting_mask == 0, "DRAM harvesting is supported only for Blackhole"); - log_assert(eth_harvesting_mask == 0, "ETH harvesting is supported only for Blackhole"); + log_assert(harvesting_masks.eth_harvesting_mask == 0, "ETH harvesting is supported only for Blackhole"); } void CoordinateManager::add_core_translation(const CoreCoord& core_coord, const tt_xy_pair& physical_pair) { @@ -146,17 +141,17 @@ CoreCoord CoordinateManager::translate_coord_to( } void CoordinateManager::translate_tensix_coords() { - if (CoordinateManager::get_num_harvested(tensix_harvesting_mask) > tensix_grid_size.y) { - tensix_harvesting_mask = 0; + if (CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask) > tensix_grid_size.y) { + harvesting_masks.tensix_harvesting_mask = 0; } - size_t num_harvested_y = CoordinateManager::get_num_harvested(tensix_harvesting_mask); + size_t num_harvested_y = CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask); size_t grid_size_x = tensix_grid_size.x; size_t grid_size_y = tensix_grid_size.y; size_t logical_y = 0; size_t harvested_index = (grid_size_y - num_harvested_y) * grid_size_x; for (size_t y = 0; y < grid_size_y; y++) { - if (tensix_harvesting_mask & (1 << y)) { + if (harvesting_masks.tensix_harvesting_mask & (1 << y)) { for (size_t x = 0; x < grid_size_x; x++) { const tt_xy_pair& physical_core = tensix_cores[y * grid_size_x + x]; const tt_xy_pair& virtual_core = tensix_cores[harvested_index++]; @@ -190,7 +185,7 @@ void CoordinateManager::translate_tensix_coords() { } void CoordinateManager::fill_tensix_default_physical_translated_mapping() { - size_t num_harvested_y = CoordinateManager::get_num_harvested(tensix_harvesting_mask); + size_t num_harvested_y = CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask); for (size_t x = 0; x < tensix_grid_size.x; x++) { for (size_t y = 0; y < tensix_grid_size.y - num_harvested_y; y++) { @@ -208,7 +203,7 @@ void CoordinateManager::fill_tensix_default_physical_translated_mapping() { size_t harvested_index = (tensix_grid_size.y - num_harvested_y) * tensix_grid_size.x; for (size_t y = 0; y < tensix_grid_size.y; y++) { - if (tensix_harvesting_mask & (1 << y)) { + if (harvesting_masks.tensix_harvesting_mask & (1 << y)) { for (size_t x = 0; x < tensix_grid_size.x; x++) { const tt_xy_pair& physical_core = tensix_cores[y * tensix_grid_size.x + x]; const size_t translated_x = physical_core.x; @@ -370,9 +365,7 @@ void CoordinateManager::fill_arc_default_physical_translated_mapping() { } } -size_t CoordinateManager::get_tensix_harvesting_mask() const { return physical_layout_tensix_harvesting_mask; } - -size_t CoordinateManager::get_dram_harvesting_mask() const { return dram_harvesting_mask; } +HarvestingMasks CoordinateManager::get_harvesting_masks() const { return harvesting_masks; } uint32_t CoordinateManager::shuffle_tensix_harvesting_mask(tt::ARCH arch, uint32_t tensix_harvesting_physical_layout) { std::vector harvesting_locations = @@ -446,7 +439,7 @@ std::vector CoordinateManager::get_all_physical_cores(const CoreType } std::vector CoordinateManager::get_tensix_cores() const { - std::vector harvested_y_coords = get_harvested_indices(tensix_harvesting_mask); + std::vector harvested_y_coords = get_harvested_indices(harvesting_masks.tensix_harvesting_mask); std::vector unharvested_tensix_cores; for (size_t y = 0; y < tensix_grid_size.y; y++) { if (std::find(harvested_y_coords.begin(), harvested_y_coords.end(), y) == harvested_y_coords.end()) { @@ -462,7 +455,7 @@ std::vector CoordinateManager::get_tensix_cores() const { } std::vector CoordinateManager::get_harvested_tensix_cores() const { - std::vector harvested_y_coords = get_harvested_indices(tensix_harvesting_mask); + std::vector harvested_y_coords = get_harvested_indices(harvesting_masks.tensix_harvesting_mask); std::vector harvested_tensix_cores; for (size_t y = 0; y < tensix_grid_size.y; y++) { if (std::find(harvested_y_coords.begin(), harvested_y_coords.end(), y) != harvested_y_coords.end()) { @@ -503,7 +496,9 @@ std::vector CoordinateManager::get_cores(const CoreType core } tt_xy_pair CoordinateManager::get_tensix_grid_size() const { - return {tensix_grid_size.x, tensix_grid_size.y - CoordinateManager::get_num_harvested(tensix_harvesting_mask)}; + return { + tensix_grid_size.x, + tensix_grid_size.y - CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask)}; } tt_xy_pair CoordinateManager::get_dram_grid_size() const { return dram_grid_size; } @@ -541,7 +536,7 @@ std::vector CoordinateManager::get_harvested_cores(const Cor } tt_xy_pair CoordinateManager::get_harvested_tensix_grid_size() const { - return {tensix_grid_size.x, CoordinateManager::get_num_harvested(tensix_harvesting_mask)}; + return {tensix_grid_size.x, CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask)}; } tt_xy_pair CoordinateManager::get_harvested_dram_grid_size() const { return {0, 0}; } @@ -561,19 +556,17 @@ tt_xy_pair CoordinateManager::get_harvested_grid_size(const CoreType core_type) } uint32_t CoordinateManager::get_num_eth_channels() const { - return num_eth_channels - CoordinateManager::get_num_harvested(eth_harvesting_mask); + return num_eth_channels - CoordinateManager::get_num_harvested(harvesting_masks.eth_harvesting_mask); } uint32_t CoordinateManager::get_num_harvested_eth_channels() const { - return CoordinateManager::get_num_harvested(eth_harvesting_mask); + return CoordinateManager::get_num_harvested(harvesting_masks.eth_harvesting_mask); } std::shared_ptr CoordinateManager::create_coordinate_manager( tt::ARCH arch, const bool noc_translation_enabled, - const size_t tensix_harvesting_mask, - const size_t dram_harvesting_mask, - const size_t eth_harvesting_mask, + const HarvestingMasks harvesting_masks, const BoardType board_type, bool is_chip_remote) { switch (arch) { @@ -581,14 +574,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( return create_coordinate_manager( arch, noc_translation_enabled, + harvesting_masks, tt::umd::grayskull::TENSIX_GRID_SIZE, tt::umd::grayskull::TENSIX_CORES, - tensix_harvesting_mask, tt::umd::grayskull::DRAM_GRID_SIZE, tt::umd::grayskull::DRAM_CORES, - dram_harvesting_mask, tt::umd::grayskull::ETH_CORES, - eth_harvesting_mask, tt::umd::grayskull::ARC_GRID_SIZE, tt::umd::grayskull::ARC_CORES, tt::umd::grayskull::PCIE_GRID_SIZE, @@ -598,14 +589,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( return create_coordinate_manager( arch, noc_translation_enabled, + harvesting_masks, tt::umd::wormhole::TENSIX_GRID_SIZE, tt::umd::wormhole::TENSIX_CORES, - tensix_harvesting_mask, tt::umd::wormhole::DRAM_GRID_SIZE, tt::umd::wormhole::DRAM_CORES, - dram_harvesting_mask, tt::umd::wormhole::ETH_CORES, - eth_harvesting_mask, tt::umd::wormhole::ARC_GRID_SIZE, tt::umd::wormhole::ARC_CORES, tt::umd::wormhole::PCIE_GRID_SIZE, @@ -617,14 +606,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( return create_coordinate_manager( arch, noc_translation_enabled, + harvesting_masks, tt::umd::blackhole::TENSIX_GRID_SIZE, tt::umd::blackhole::TENSIX_CORES, - tensix_harvesting_mask, tt::umd::blackhole::DRAM_GRID_SIZE, tt::umd::blackhole::DRAM_CORES, - dram_harvesting_mask, tt::umd::blackhole::ETH_CORES, - eth_harvesting_mask, tt::umd::blackhole::ARC_GRID_SIZE, tt::umd::blackhole::ARC_CORES, tt::umd::blackhole::PCIE_GRID_SIZE, @@ -641,14 +628,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( std::shared_ptr CoordinateManager::create_coordinate_manager( tt::ARCH arch, const bool noc_translation_enabled, + const HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, @@ -658,14 +643,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( case tt::ARCH::GRAYSKULL: log_assert(!noc_translation_enabled, "NOC translation is not supported for Grayskull"); return std::make_shared( + harvesting_masks, tensix_grid_size, tensix_cores, - tensix_harvesting_mask, dram_grid_size, dram_cores, - dram_harvesting_mask, eth_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, @@ -674,14 +657,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( case tt::ARCH::WORMHOLE_B0: return std::make_shared( noc_translation_enabled, + harvesting_masks, tensix_grid_size, tensix_cores, - tensix_harvesting_mask, dram_grid_size, dram_cores, - dram_harvesting_mask, eth_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, @@ -691,14 +672,12 @@ std::shared_ptr CoordinateManager::create_coordinate_manager( case tt::ARCH::BLACKHOLE: return std::make_shared( noc_translation_enabled, + harvesting_masks, tensix_grid_size, tensix_cores, - tensix_harvesting_mask, dram_grid_size, dram_cores, - dram_harvesting_mask, eth_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, diff --git a/device/grayskull/grayskull_coordinate_manager.cpp b/device/grayskull/grayskull_coordinate_manager.cpp index 6b452e9d..522652fb 100644 --- a/device/grayskull/grayskull_coordinate_manager.cpp +++ b/device/grayskull/grayskull_coordinate_manager.cpp @@ -10,14 +10,12 @@ using namespace tt::umd; GrayskullCoordinateManager::GrayskullCoordinateManager( + HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, @@ -25,14 +23,12 @@ GrayskullCoordinateManager::GrayskullCoordinateManager( const std::vector& router_cores) : CoordinateManager( false, + harvesting_masks, tensix_grid_size, tensix_cores, - tensix_harvesting_mask, dram_grid_size, dram_cores, - dram_harvesting_mask, eth_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, diff --git a/device/tt_soc_descriptor.cpp b/device/tt_soc_descriptor.cpp index eb55d503..a940dff1 100644 --- a/device/tt_soc_descriptor.cpp +++ b/device/tt_soc_descriptor.cpp @@ -186,10 +186,7 @@ tt_xy_pair tt_SocDescriptor::calculate_grid_size(const std::vector & } void tt_SocDescriptor::create_coordinate_manager( - const bool noc_translation_enabled, - const size_t tensix_harvesting_mask, - const size_t dram_harvesting_mask, - const size_t eth_harvesting_mask) { + const bool noc_translation_enabled, const HarvestingMasks harvesting_masks) { const tt_xy_pair dram_grid_size = tt_xy_pair(dram_cores.size(), dram_cores.empty() ? 0 : dram_cores[0].size()); const tt_xy_pair arc_grid_size = tt_SocDescriptor::calculate_grid_size(arc_cores); const tt_xy_pair pcie_grid_size = tt_SocDescriptor::calculate_grid_size(pcie_cores); @@ -204,14 +201,12 @@ void tt_SocDescriptor::create_coordinate_manager( coordinate_manager = CoordinateManager::create_coordinate_manager( arch, noc_translation_enabled, + harvesting_masks, worker_grid_size, workers, - tensix_harvesting_mask, dram_grid_size, dram_cores_unpacked, - dram_harvesting_mask, ethernet_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, @@ -235,12 +230,8 @@ tt::umd::CoreCoord tt_SocDescriptor::translate_coord_to( } tt_SocDescriptor::tt_SocDescriptor( - std::string device_descriptor_path, - const bool noc_translation_enabled, - const size_t tensix_harvesting_mask, - const size_t dram_harvesting_mask, - const size_t eth_harvesting_mask) : - tensix_harvesting_mask(tensix_harvesting_mask) { + std::string device_descriptor_path, const bool noc_translation_enabled, const HarvestingMasks harvesting_masks) : + harvesting_masks(harvesting_masks) { std::ifstream fdesc(device_descriptor_path); if (fdesc.fail()) { throw std::runtime_error( @@ -259,8 +250,7 @@ tt_SocDescriptor::tt_SocDescriptor( arch_name_value = trim(arch_name_value); arch = tt::arch_from_str(arch_name_value); load_soc_features_from_device_descriptor(device_descriptor_yaml); - create_coordinate_manager( - noc_translation_enabled, tensix_harvesting_mask, dram_harvesting_mask, eth_harvesting_mask); + create_coordinate_manager(noc_translation_enabled, harvesting_masks); } int tt_SocDescriptor::get_num_dram_channels() const { diff --git a/device/wormhole/wormhole_coordinate_manager.cpp b/device/wormhole/wormhole_coordinate_manager.cpp index f000398c..accd63a4 100644 --- a/device/wormhole/wormhole_coordinate_manager.cpp +++ b/device/wormhole/wormhole_coordinate_manager.cpp @@ -9,14 +9,12 @@ using namespace tt::umd; WormholeCoordinateManager::WormholeCoordinateManager( const bool noc_translation_enabled, + const HarvestingMasks harvesting_masks, const tt_xy_pair& tensix_grid_size, const std::vector& tensix_cores, - const size_t tensix_harvesting_mask, const tt_xy_pair& dram_grid_size, const std::vector& dram_cores, - const size_t dram_harvesting_mask, const std::vector& eth_cores, - const size_t eth_harvesting_mask, const tt_xy_pair& arc_grid_size, const std::vector& arc_cores, const tt_xy_pair& pcie_grid_size, @@ -24,14 +22,12 @@ WormholeCoordinateManager::WormholeCoordinateManager( const std::vector& router_cores) : CoordinateManager( noc_translation_enabled, + harvesting_masks, tensix_grid_size, tensix_cores, - tensix_harvesting_mask, dram_grid_size, dram_cores, - dram_harvesting_mask, eth_cores, - eth_harvesting_mask, arc_grid_size, arc_cores, pcie_grid_size, @@ -41,7 +37,7 @@ WormholeCoordinateManager::WormholeCoordinateManager( } void WormholeCoordinateManager::fill_tensix_physical_translated_mapping() { - size_t num_harvested_y = CoordinateManager::get_num_harvested(tensix_harvesting_mask); + size_t num_harvested_y = CoordinateManager::get_num_harvested(harvesting_masks.tensix_harvesting_mask); for (size_t y = 0; y < tensix_grid_size.y - num_harvested_y; y++) { for (size_t x = 0; x < tensix_grid_size.x; x++) { @@ -60,7 +56,7 @@ void WormholeCoordinateManager::fill_tensix_physical_translated_mapping() { size_t harvested_index = (tensix_grid_size.y - num_harvested_y) * tensix_grid_size.x; size_t translated_y = wormhole::tensix_translated_coordinate_start_y + tensix_grid_size.y - num_harvested_y; for (size_t y = 0; y < tensix_grid_size.y; y++) { - if (tensix_harvesting_mask & (1 << y)) { + if (harvesting_masks.tensix_harvesting_mask & (1 << y)) { for (size_t x = 0; x < tensix_grid_size.x; x++) { const tt_xy_pair physical_core = tensix_cores[y * tensix_grid_size.x + x]; const size_t translated_x = x + wormhole::tensix_translated_coordinate_start_x; diff --git a/tests/api/test_core_coord_translation_bh.cpp b/tests/api/test_core_coord_translation_bh.cpp index dedcebfb..0ea17f3f 100644 --- a/tests/api/test_core_coord_translation_bh.cpp +++ b/tests/api/test_core_coord_translation_bh.cpp @@ -37,7 +37,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeTopLeftCore) { // This is targeting first row of Tensix cores on NOC layout. const size_t harvesting_mask = (1 << 0); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {harvesting_mask}); tt_xy_pair tensix_grid_size = tt::umd::blackhole::TENSIX_GRID_SIZE; CoreCoord logical_coords = CoreCoord(0, 0, CoreType::TENSIX, CoordSystem::LOGICAL); @@ -60,7 +60,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeLogicalPhysicalMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_x); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {harvesting_mask}); std::map logical_to_physical; std::set physical_coords_set; @@ -103,7 +103,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeLogicalVirtualMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_x); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {harvesting_mask}); std::map logical_to_virtual; std::set virtual_coords_set; @@ -145,7 +145,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeLogicalTranslatedMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_x); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {harvesting_mask}); std::map logical_to_translated; std::set translated_coords_set; @@ -187,7 +187,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeVirtualEqualTranslated) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_x); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {harvesting_mask}); size_t num_harvested_x = CoordinateManager::get_num_harvested(harvesting_mask); @@ -210,7 +210,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeVirtualEqualTranslated) { TEST(CoordinateManager, CoordinateManagerBlackholeTransltedMappingHarvested) { const size_t harvesting_mask = (1 << 0) | (1 << 1); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {harvesting_mask}); const tt_xy_pair tensix_grid_size = tt::umd::blackhole::TENSIX_GRID_SIZE; const std::vector tensix_cores = tt::umd::blackhole::TENSIX_CORES; @@ -281,7 +281,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMNoHarvesting) { // Test top left corner translation from logical to physical coordinates. TEST(CoordinateManager, CoordinateManagerBlackholeDRAMTopLeft) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, 1); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {0, 1}); const CoreCoord top_left_dram_logical = CoreCoord(0, 0, CoreType::DRAM, CoordSystem::LOGICAL); const CoreCoord expected_top_left_physical = CoreCoord(0, 2, CoreType::DRAM, CoordSystem::PHYSICAL); @@ -308,7 +308,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMLogicalPhysicalMapping) { } std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {0, harvesting_mask}); std::map logical_to_physical; std::set physical_coords_set; @@ -357,7 +357,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMLogicalVirtualMapping) { } std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {0, harvesting_mask}); std::map logical_to_virtual; std::set virtual_coords_set; @@ -399,7 +399,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMTranslatedMapping) { } std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {0, harvesting_mask}); std::map logical_to_translated; std::set translated_coord_set; @@ -446,8 +446,9 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMVirtualPhysicalMapping) { const size_t dram_harvesting_mask = 1; + const HarvestingMasks harvesting_masks = {.dram_harvesting_mask = dram_harvesting_mask}; std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, dram_harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_masks); const size_t physical_index = 0; const size_t virtual_index = (num_dram_banks - 1) * num_noc_ports_per_bank; @@ -489,8 +490,9 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMPMoreThanOneDRAMBankHarves continue; } + const HarvestingMasks harvesting_masks = {.dram_harvesting_mask = harvesting_mask}; EXPECT_THROW( - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, harvesting_mask), + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_masks), std::runtime_error); } } @@ -498,7 +500,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholeDRAMPMoreThanOneDRAMBankHarves // Test that virtual, physical and translated coordinates are the same for all logical PCIE coordinates. TEST(CoordinateManager, CoordinateManagerBlackholePCIETranslationLocal) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, 0, 0, BoardType::P300, false); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, {0, 0, 0}, BoardType::P300, false); const tt_xy_pair pcie_grid_size = tt::umd::blackhole::PCIE_GRID_SIZE; const std::vector pcie_cores = tt::umd::blackhole::PCIE_CORES_TYPE2; @@ -598,8 +600,10 @@ TEST(CoordinateManager, CoordinateManagerBlackholeETHHarvesting) { continue; } + const HarvestingMasks harvesting_masks = {.eth_harvesting_mask = harvesting_mask}; + std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, 0, 0, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_masks); for (size_t eth_channel = 0; eth_channel < num_eth_channels - num_harvested_cores; eth_channel++) { const CoreCoord eth_logical = CoreCoord(0, eth_channel, CoreType::ETH, CoordSystem::LOGICAL); @@ -633,10 +637,11 @@ TEST(CoordinateManager, CoordinateManagerBlackholePhysicalLayoutTensixHarvesting const size_t max_num_harvested_x = 14; for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_x); harvesting_mask++) { + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = harvesting_mask}; std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, true, harvesting_masks); - EXPECT_EQ(coordinate_manager->get_tensix_harvesting_mask(), harvesting_mask); + EXPECT_EQ(coordinate_manager->get_harvesting_masks().tensix_harvesting_mask, harvesting_mask); } } diff --git a/tests/api/test_core_coord_translation_gs.cpp b/tests/api/test_core_coord_translation_gs.cpp index 0035cca4..f30acc00 100644 --- a/tests/api/test_core_coord_translation_gs.cpp +++ b/tests/api/test_core_coord_translation_gs.cpp @@ -55,7 +55,7 @@ TEST(CoordinateManager, CoordinateManagerGrayskullTopLeftCoreHarvesting) { // This is targeting first row of Tensix cores on NOC layout. const size_t harvesting_mask = (1 << 0); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {harvesting_mask}); CoreCoord logical_coords = CoreCoord(0, 0, CoreType::TENSIX, CoordSystem::LOGICAL); @@ -103,7 +103,7 @@ TEST(CoordinateManager, CoordinateManagerGrayskullLogicalPhysicalMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {harvesting_mask}); std::map logical_to_physical; std::set physical_coords_set; @@ -148,7 +148,7 @@ TEST(CoordinateManager, CoordinateManagerGrayskullLogicalVirtualMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {harvesting_mask}); std::map logical_to_virtual; std::set virtual_coords_set; @@ -184,7 +184,7 @@ TEST(CoordinateManager, CoordinateManagerGrayskullPhysicalHarvestedMapping) { const size_t harvesting_mask = (1 << 0) | (1 << 1); const size_t num_harvested = CoordinateManager::get_num_harvested(harvesting_mask); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {harvesting_mask}); const std::vector tensix_cores = tt::umd::grayskull::TENSIX_CORES; const tt_xy_pair tensix_grid_size = tt::umd::grayskull::TENSIX_GRID_SIZE; @@ -209,7 +209,7 @@ TEST(CoordinateManager, CoordinateManagerGrayskullPhysicalTranslatedHarvestedMap const size_t harvesting_mask = (1 << 0) | (1 << 1); const size_t num_harvested = CoordinateManager::get_num_harvested(harvesting_mask); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {harvesting_mask}); const std::vector tensix_cores = tt::umd::grayskull::TENSIX_CORES; const tt_xy_pair tensix_grid_size = tt::umd::grayskull::TENSIX_GRID_SIZE; @@ -304,12 +304,13 @@ TEST(CoordinateManager, CoordinateManagerGrayskullARCTranslation) { // Test that we assert properly if DRAM harvesting mask is non-zero for Grayskull. TEST(CoordinateManager, CoordinateManagerGrayskullDRAMHarvestingAssert) { - EXPECT_THROW(CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, 0, 1), std::runtime_error); + EXPECT_THROW(CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {0, 1}), std::runtime_error); } // Test that we assert properly if ETH harvesting mask is non-zero for Grayskull. TEST(CoordinateManager, CoordinateManagerGrayskullETHHarvestingAssert) { - EXPECT_THROW(CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, 0, 0, 1), std::runtime_error); + EXPECT_THROW( + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, {0, 0, 1}), std::runtime_error); } // Test that we properly get harvesting mask that is based on the physical layout of the chip. @@ -317,10 +318,11 @@ TEST(CoordinateManager, CoordinateManagerGrayskullPhysicalLayoutTensixHarvesting const size_t max_num_harvested_y = 10; for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y); harvesting_mask++) { + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = harvesting_mask}; std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::GRAYSKULL, false, harvesting_masks); - EXPECT_EQ(coordinate_manager->get_tensix_harvesting_mask(), harvesting_mask); + EXPECT_EQ(coordinate_manager->get_harvesting_masks().tensix_harvesting_mask, harvesting_mask); } } diff --git a/tests/api/test_core_coord_translation_wh.cpp b/tests/api/test_core_coord_translation_wh.cpp index 2e624fbf..791e76cf 100644 --- a/tests/api/test_core_coord_translation_wh.cpp +++ b/tests/api/test_core_coord_translation_wh.cpp @@ -41,7 +41,7 @@ TEST(CoordinateManager, CoordinateManagerWormholeTopLeftCore) { const size_t harvesting_mask = (1 << 0); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {harvesting_mask}); tt_xy_pair tensix_grid_size = tt::umd::wormhole::TENSIX_GRID_SIZE; CoreCoord logical_coords = CoreCoord(0, 0, CoreType::TENSIX, CoordSystem::LOGICAL); @@ -64,7 +64,7 @@ TEST(CoordinateManager, CoordinateManagerWormholeLogicalPhysicalMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {harvesting_mask}); std::map logical_to_physical; std::set physical_coords_set; @@ -109,7 +109,7 @@ TEST(CoordinateManager, CoordinateManagerWormholeLogicalVirtualMapping) { for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y); harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {harvesting_mask}); std::map logical_to_virtual; std::set virtual_coords_set; @@ -153,7 +153,7 @@ TEST(CoordinateManager, CoordinateManagerWormholeLogicalTranslatedTopLeft) { // if everything is harvested. for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y) - 1; harvesting_mask++) { std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {harvesting_mask}); tt_xy_pair tensix_grid_size = tt::umd::wormhole::TENSIX_GRID_SIZE; @@ -182,7 +182,7 @@ TEST(CoordinateManager, CoordinateManagerWormholePhysicalVirtualHarvestedMapping const size_t harvesting_mask = (1 << 0) | (1 << 1); const size_t num_harvested = CoordinateManager::get_num_harvested(harvesting_mask); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {harvesting_mask}); const std::vector tensix_cores = tt::umd::wormhole::TENSIX_CORES; const tt_xy_pair tensix_grid_size = tt::umd::wormhole::TENSIX_GRID_SIZE; @@ -207,7 +207,7 @@ TEST(CoordinateManager, CoordinateManagerWormholePhysicalTranslatedHarvestedMapp const size_t harvesting_mask = (1 << 0) | (1 << 1); const size_t num_harvested = CoordinateManager::get_num_harvested(harvesting_mask); std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {harvesting_mask}); const std::vector tensix_cores = tt::umd::wormhole::TENSIX_CORES; const tt_xy_pair tensix_grid_size = tt::umd::wormhole::TENSIX_GRID_SIZE; @@ -355,13 +355,13 @@ TEST(CoordinateManager, CoordinateManagerWormholePCIETranslation) { // Test that we assert properly if DRAM harvesting mask is non-zero for Wormhole. TEST(CoordinateManager, CoordinateManagerWormholeDRAMHarvestingAssert) { - EXPECT_THROW(CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, 0, 1), std::runtime_error); + EXPECT_THROW(CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {0, 1}), std::runtime_error); } // Test that we assert properly if ETH harvesting mask is non-zero for Wormhole. TEST(CoordinateManager, CoordinateManagerWormholeETHHarvestingAssert) { EXPECT_THROW( - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, 0, 0, 1), std::runtime_error); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, {0, 0, 1}), std::runtime_error); } // Test that we properly get harvesting mask that is based on the physical layout of the chip. @@ -369,10 +369,11 @@ TEST(CoordinateManager, CoordinateManagerWormholePhysicalLayoutTensixHarvestingM const size_t max_num_harvested_y = 10; for (size_t harvesting_mask = 0; harvesting_mask < (1 << max_num_harvested_y); harvesting_mask++) { + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = harvesting_mask}; std::shared_ptr coordinate_manager = - CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_mask); + CoordinateManager::create_coordinate_manager(tt::ARCH::WORMHOLE_B0, true, harvesting_masks); - EXPECT_EQ(coordinate_manager->get_tensix_harvesting_mask(), harvesting_mask); + EXPECT_EQ(coordinate_manager->get_harvesting_masks().tensix_harvesting_mask, harvesting_mask); } } diff --git a/tests/api/test_soc_descriptor.cpp b/tests/api/test_soc_descriptor.cpp index 88034d67..4ef364b1 100644 --- a/tests/api/test_soc_descriptor.cpp +++ b/tests/api/test_soc_descriptor.cpp @@ -35,7 +35,7 @@ TEST(SocDescriptor, SocDescriptorGrayskullNoHarvesting) { TEST(SocDescriptor, SocDescriptorGrayskullOneRowHarvesting) { const tt_xy_pair grayskull_tensix_grid_size = tt::umd::grayskull::TENSIX_GRID_SIZE; const std::vector grayskull_tensix_cores = tt::umd::grayskull::TENSIX_CORES; - const size_t harvesting_mask = (1 << 0); + const HarvestingMasks harvesting_mask = {.tensix_harvesting_mask = (1 << 0)}; tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/grayskull_10x12.yaml"), false, harvesting_mask); @@ -110,7 +110,7 @@ TEST(SocDescriptor, SocDescriptorWormholeDRAM) { TEST(SocDescriptor, SocDescriptorWormholeOneRowHarvesting) { const tt_xy_pair wormhole_tensix_grid_size = tt::umd::wormhole::TENSIX_GRID_SIZE; const std::vector wormhole_tensix_cores = tt::umd::wormhole::TENSIX_CORES; - const size_t harvesting_mask = (1 << 0); + const HarvestingMasks harvesting_mask = {.tensix_harvesting_mask = (1 << 0)}; tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/wormhole_b0_8x10.yaml"), true, harvesting_mask); @@ -175,8 +175,10 @@ TEST(SocDescriptor, SocDescriptorBlackholeETHHarvesting) { continue; } + const HarvestingMasks harvesting_masks = {.eth_harvesting_mask = eth_harvesting_mask}; + tt_SocDescriptor soc_desc( - test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_type2.yaml"), true, 0, 0, eth_harvesting_mask); + test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_type2.yaml"), true, harvesting_masks); const std::vector eth_cores = soc_desc.get_cores(CoreType::ETH); @@ -229,7 +231,10 @@ TEST(SocDescriptor, SocDescriptorBlackholeOneRowHarvesting) { const tt_xy_pair blackhole_tensix_grid_size = tt::umd::blackhole::TENSIX_GRID_SIZE; const std::vector blackhole_tensix_cores = tt::umd::blackhole::TENSIX_CORES; - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 1}; + + tt_SocDescriptor soc_desc( + test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, harvesting_masks); const std::vector tensix_cores = soc_desc.get_cores(CoreType::TENSIX); @@ -278,7 +283,10 @@ TEST(SocDescriptor, SocDescriptorBlackholeDRAMHarvesting) { const size_t num_dram_banks = tt::umd::blackhole::NUM_DRAM_BANKS; const size_t num_noc_ports_per_bank = tt::umd::blackhole::NUM_NOC_PORTS_PER_DRAM_BANK; - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, 0, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 0, .dram_harvesting_mask = 1}; + + tt_SocDescriptor soc_desc( + test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, harvesting_masks); const std::vector tensix_cores = soc_desc.get_cores(CoreType::TENSIX); @@ -310,7 +318,7 @@ TEST(SocDescriptor, SocDescriptorBlackholeDRAMHarvesting) { } TEST(SocDescriptor, CustomSocDescriptor) { - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_simulation_1x2.yaml"), true, 0, 0); + tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_simulation_1x2.yaml"), true); const CoreCoord tensix_core_01 = CoreCoord(0, 1, CoreType::TENSIX, CoordSystem::PHYSICAL); const CoreCoord tensix_core_01_virtual = soc_desc.translate_coord_to(tensix_core_01, CoordSystem::VIRTUAL); @@ -442,7 +450,8 @@ TEST(SocDescriptor, SocDescriptorBlackholeMultipleCoordinateSystems) { } TEST(SocDescriptor, SocDescriptorGrayskullNoLogicalForHarvestedCores) { - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/grayskull_10x12.yaml"), false, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 1}; + tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/grayskull_10x12.yaml"), false, harvesting_masks); EXPECT_THROW(soc_desc.get_harvested_cores(CoreType::TENSIX, CoordSystem::LOGICAL), std::runtime_error); @@ -452,7 +461,8 @@ TEST(SocDescriptor, SocDescriptorGrayskullNoLogicalForHarvestedCores) { } TEST(SocDescriptor, SocDescriptorWormholeNoLogicalForHarvestedCores) { - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/wormhole_b0_8x10.yaml"), true, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 1}; + tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/wormhole_b0_8x10.yaml"), true, harvesting_masks); EXPECT_THROW(soc_desc.get_harvested_cores(CoreType::TENSIX, CoordSystem::LOGICAL), std::runtime_error); @@ -462,7 +472,9 @@ TEST(SocDescriptor, SocDescriptorWormholeNoLogicalForHarvestedCores) { } TEST(SocDescriptor, SocDescriptorBlackholeNoLogicalForHarvestedCores) { - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 1}; + tt_SocDescriptor soc_desc( + test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, harvesting_masks); EXPECT_THROW(soc_desc.get_harvested_cores(CoreType::TENSIX, CoordSystem::LOGICAL), std::runtime_error); @@ -474,7 +486,9 @@ TEST(SocDescriptor, SocDescriptorBlackholeNoLogicalForHarvestedCores) { TEST(SocDescriptor, NocTranslation) { // Test when noc translation is disabled. { - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), false, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 1}; + tt_SocDescriptor soc_desc( + test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), false, harvesting_masks); const CoreCoord tensix_core = CoreCoord(2, 2, CoreType::TENSIX, CoordSystem::PHYSICAL); const CoreCoord tensix_core_virtual = soc_desc.translate_coord_to(tensix_core, CoordSystem::VIRTUAL); @@ -485,7 +499,9 @@ TEST(SocDescriptor, NocTranslation) { } // Test when noc translation is enabled. { - tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, 1); + const HarvestingMasks harvesting_masks = {.tensix_harvesting_mask = 1}; + tt_SocDescriptor soc_desc( + test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"), true, harvesting_masks); const CoreCoord tensix_core = CoreCoord(2, 2, CoreType::TENSIX, CoordSystem::PHYSICAL); const CoreCoord tensix_core_virtual = soc_desc.translate_coord_to(tensix_core, CoordSystem::VIRTUAL); diff --git a/tests/grayskull/test_cluster_gs.cpp b/tests/grayskull/test_cluster_gs.cpp index 3741cc9a..188fd39e 100644 --- a/tests/grayskull/test_cluster_gs.cpp +++ b/tests/grayskull/test_cluster_gs.cpp @@ -76,28 +76,12 @@ TEST(SiliconDriverGS, Harvesting) { simulated_harvesting_masks.at(chip_id)) << "Expected first chip to include simulated harvesting mask of 6"; } -<<<<<<< HEAD -======= - // harvesting info stored in soc descriptor is in logical coordinates. - ASSERT_EQ( - cluster.get_soc_descriptor(0).tensix_harvesting_mask & simulated_harvesting_masks[0].tensix_harvesting_mask, - simulated_harvesting_masks[0].tensix_harvesting_mask) - << "Expected first chip to include simulated harvesting mask of 6"; - // get_harvesting_masks_for_soc_descriptors will return harvesting info in noc0 coordinates. - simulated_harvesting_masks[0].tensix_harvesting_mask = - CoordinateManager::shuffle_tensix_harvesting_mask_to_noc0_coords( - tt::ARCH::GRAYSKULL, simulated_harvesting_masks[0].tensix_harvesting_mask); - ASSERT_EQ( - cluster.get_harvesting_masks_for_soc_descriptors().at(0) & simulated_harvesting_masks[0].tensix_harvesting_mask, - simulated_harvesting_masks[0].tensix_harvesting_mask) - << "Expected first chip to include simulated harvesting mask of 6"; ->>>>>>> Implement software harvesting cluster.close_device(); } TEST(SiliconDriverGS, CustomSocDesc) { std::set target_devices = {0}; - std::unordered_map simulated_harvesting_masks = {{0, {6, 0, 0}}, {1, {12, 0, 0}}}; + std::unordered_map simulated_harvesting_masks = {{0, {6, 0, 0}}, {1, {12, 0, 0}}}; uint32_t num_host_mem_ch_per_mmio_device = 1; // Initialize the driver with a 1x1 descriptor and explicitly do not perform harvesting Cluster cluster = Cluster( @@ -127,7 +111,7 @@ TEST(SiliconDriverGS, HarvestingRuntime) { }; std::set target_devices = {0}; - std::unordered_map simulated_harvesting_masks = {{0, {6, 0, 0}}, {1, {12, 0, 0}}}; + std::unordered_map simulated_harvesting_masks = {{0, {6, 0, 0}}, {1, {12, 0, 0}}}; uint32_t num_host_mem_ch_per_mmio_device = 1; Cluster cluster = Cluster(num_host_mem_ch_per_mmio_device, false, true, true, simulated_harvesting_masks); diff --git a/tests/wormhole/test_cluster_wh.cpp b/tests/wormhole/test_cluster_wh.cpp index 517e9fc5..a78cc9ca 100644 --- a/tests/wormhole/test_cluster_wh.cpp +++ b/tests/wormhole/test_cluster_wh.cpp @@ -102,7 +102,7 @@ TEST(SiliconDriverWH, CreateDestroy) { TEST(SiliconDriverWH, Harvesting) { std::set target_devices = get_target_devices(); int num_devices = target_devices.size(); - std::unordered_map simulated_harvesting_masks = {{0, {30, 0, 0}}, {1, {60, 0, 0}}}; + std::unordered_map simulated_harvesting_masks = {{0, {30, 0, 0}}, {1, {60, 0, 0}}}; uint32_t num_host_mem_ch_per_mmio_device = 1; Cluster cluster = Cluster(num_host_mem_ch_per_mmio_device, false, true, true, simulated_harvesting_masks); @@ -126,7 +126,7 @@ TEST(SiliconDriverWH, Harvesting) { for (int i = 0; i < num_devices; i++) { // harvesting info stored in soc descriptor is in logical coordinates. ASSERT_EQ( - cluster.get_soc_descriptor(i).tensix_harvesting_mask, + cluster.get_soc_descriptor(i).harvesting_masks.tensix_harvesting_mask, simulated_harvesting_masks.at(i).tensix_harvesting_mask) << "Expecting chip " << i << " to have harvesting mask of " << simulated_harvesting_masks.at(i).tensix_harvesting_mask; @@ -146,7 +146,7 @@ TEST(SiliconDriverWH, Harvesting) { TEST(SiliconDriverWH, CustomSocDesc) { std::set target_devices = get_target_devices(); - std::unordered_map simulated_harvesting_masks = {{0, {30, 0, 0}}, {1, {60, 0, 0}}}; + std::unordered_map simulated_harvesting_masks = {{0, {30, 0, 0}}, {1, {60, 0, 0}}}; uint32_t num_host_mem_ch_per_mmio_device = 1; // Initialize the driver with a 1x1 descriptor and explictly do not perform harvesting @@ -171,7 +171,7 @@ TEST(SiliconDriverWH, HarvestingRuntime) { auto get_static_tlb_index_callback = [](tt_xy_pair target) { return get_static_tlb_index(target); }; std::set target_devices = get_target_devices(); - std::unordered_map simulated_harvesting_masks = {{0, {30, 0, 0}}, {1, {60, 0, 0}}}; + std::unordered_map simulated_harvesting_masks = {{0, {30, 0, 0}}, {1, {60, 0, 0}}}; uint32_t num_host_mem_ch_per_mmio_device = 1;