diff --git a/device/api/umd/device/blackhole_coordinate_manager.h b/device/api/umd/device/blackhole_coordinate_manager.h index cb40381c..6924e48c 100644 --- a/device/api/umd/device/blackhole_coordinate_manager.h +++ b/device/api/umd/device/blackhole_coordinate_manager.h @@ -36,16 +36,16 @@ class BlackholeCoordinateManager : public CoordinateManager { arc_cores, pcie_grid_size, pcie_cores) { - this->tensix_harvesting(tensix_harvesting_mask); - this->dram_harvesting(dram_harvesting_mask); + this->translate_tensix_coords(); + this->translate_dram_coords(); this->translate_eth_coords(); this->translate_arc_coords(); this->translate_pcie_coords(); } protected: - void dram_harvesting(const size_t dram_harvesting_mask) override; - void tensix_harvesting(const size_t tensix_harvesting_mask) override; + void translate_dram_coords() override; + void translate_tensix_coords() override; void fill_tensix_logical_to_translated() override; void fill_eth_logical_to_translated() override; diff --git a/device/api/umd/device/coordinate_manager.h b/device/api/umd/device/coordinate_manager.h index 0077e46c..e2e0e189 100644 --- a/device/api/umd/device/coordinate_manager.h +++ b/device/api/umd/device/coordinate_manager.h @@ -73,15 +73,12 @@ class CoordinateManager { tt::umd::CoreCoord to_translated(const tt::umd::CoreCoord core_coord); protected: - virtual void tensix_harvesting(const size_t harvesting_mask); - virtual void dram_harvesting(const size_t dram_harvesting_mask); + virtual void translate_tensix_coords(); + virtual void translate_dram_coords(); virtual void translate_eth_coords(); virtual void translate_arc_coords(); virtual void translate_pcie_coords(); - void clear_tensix_harvesting_structures(); - void clear_dram_harvesting_structures(); - /* * Fills the logical to translated mapping for the tensix cores. * By default, translated coordinates are the same as physical coordinates. diff --git a/device/api/umd/device/grayskull_coordinate_manager.h b/device/api/umd/device/grayskull_coordinate_manager.h index f532b32c..b0af1dce 100644 --- a/device/api/umd/device/grayskull_coordinate_manager.h +++ b/device/api/umd/device/grayskull_coordinate_manager.h @@ -36,8 +36,8 @@ class GrayskullCoordinateManager : public CoordinateManager { arc_cores, pcie_grid_size, pcie_cores) { - this->tensix_harvesting(tensix_harvesting_mask); - this->dram_harvesting(dram_harvesting_mask); + this->translate_tensix_coords(); + this->translate_dram_coords(); this->translate_eth_coords(); this->translate_arc_coords(); this->translate_pcie_coords(); diff --git a/device/api/umd/device/wormhole_coordinate_manager.h b/device/api/umd/device/wormhole_coordinate_manager.h index e8c960f7..c8741d00 100644 --- a/device/api/umd/device/wormhole_coordinate_manager.h +++ b/device/api/umd/device/wormhole_coordinate_manager.h @@ -36,8 +36,8 @@ class WormholeCoordinateManager : public CoordinateManager { arc_cores, pcie_grid_size, pcie_cores) { - this->tensix_harvesting(tensix_harvesting_mask); - this->dram_harvesting(dram_harvesting_mask); + this->translate_tensix_coords(); + this->translate_dram_coords(); this->translate_eth_coords(); this->translate_arc_coords(); this->translate_pcie_coords(); diff --git a/device/blackhole/blackhole_coordinate_manager.cpp b/device/blackhole/blackhole_coordinate_manager.cpp index 8f10a74b..3cde6ba2 100644 --- a/device/blackhole/blackhole_coordinate_manager.cpp +++ b/device/blackhole/blackhole_coordinate_manager.cpp @@ -7,19 +7,16 @@ using namespace tt::umd; -void BlackholeCoordinateManager::tensix_harvesting(const size_t tensix_harvesting_mask) { - CoordinateManager::tensix_harvesting_mask = tensix_harvesting_mask; - CoordinateManager::clear_tensix_harvesting_structures(); - +void BlackholeCoordinateManager::translate_tensix_coords() { size_t num_harvested_x = __builtin_popcount(tensix_harvesting_mask); - size_t grid_size_x = CoordinateManager::tensix_grid_size.x; - size_t grid_size_y = CoordinateManager::tensix_grid_size.y; + size_t grid_size_x = tensix_grid_size.x; + size_t grid_size_y = tensix_grid_size.y; size_t logical_x = 0; for (size_t x = 0; x < grid_size_x; x++) { if (!(tensix_harvesting_mask & (1 << x))) { for (size_t y = 0; y < grid_size_y; y++) { - const tt_xy_pair& tensix_core = CoordinateManager::tensix_cores[x + y * grid_size_x]; + const tt_xy_pair& tensix_core = tensix_cores[x + y * grid_size_x]; tensix_logical_to_physical[{logical_x, y}] = CoreCoord(tensix_core.x, tensix_core.y, CoreType::TENSIX, CoordSystem::PHYSICAL); tensix_physical_to_logical[tensix_core] = @@ -31,7 +28,7 @@ void BlackholeCoordinateManager::tensix_harvesting(const size_t tensix_harvestin for (size_t x = 0; x < grid_size_x - num_harvested_x; x++) { for (size_t y = 0; y < grid_size_y; y++) { - const tt_xy_pair& tensix_core = CoordinateManager::tensix_cores[x + y * grid_size_x]; + const tt_xy_pair& tensix_core = tensix_cores[x + y * grid_size_x]; tensix_logical_to_virtual[{x, y}] = CoreCoord(tensix_core.x, tensix_core.y, CoreType::TENSIX, CoordSystem::VIRTUAL); tensix_virtual_to_logical[tensix_core] = CoreCoord(x, y, CoreType::TENSIX, CoordSystem::LOGICAL); @@ -42,36 +39,31 @@ void BlackholeCoordinateManager::tensix_harvesting(const size_t tensix_harvestin } void BlackholeCoordinateManager::fill_tensix_logical_to_translated() { - const size_t num_harvested_x = __builtin_popcount(CoordinateManager::tensix_harvesting_mask); - const size_t grid_size_x = CoordinateManager::tensix_grid_size.x; - const size_t grid_size_y = CoordinateManager::tensix_grid_size.y; + const size_t num_harvested_x = __builtin_popcount(tensix_harvesting_mask); + const size_t grid_size_x = tensix_grid_size.x; + const size_t grid_size_y = tensix_grid_size.y; for (size_t x = 0; x < grid_size_x - num_harvested_x; x++) { for (size_t y = 0; y < grid_size_y; y++) { - const CoreCoord virtual_coord = CoordinateManager::tensix_logical_to_virtual[{x, y}]; + const CoreCoord virtual_coord = tensix_logical_to_virtual[{x, y}]; const size_t translated_x = virtual_coord.x; const size_t translated_y = virtual_coord.y; - CoordinateManager::tensix_logical_to_translated[{x, y}] = + tensix_logical_to_translated[{x, y}] = CoreCoord(translated_x, translated_y, CoreType::TENSIX, CoordSystem::TRANSLATED); - CoordinateManager::tensix_translated_to_logical[{translated_x, translated_y}] = + tensix_translated_to_logical[{translated_x, translated_y}] = CoreCoord(x, y, CoreType::TENSIX, CoordSystem::LOGICAL); } } } -void BlackholeCoordinateManager::dram_harvesting(const size_t dram_harvesting_mask) { - CoordinateManager::dram_harvesting_mask = dram_harvesting_mask; - CoordinateManager::clear_dram_harvesting_structures(); - +void BlackholeCoordinateManager::translate_dram_coords() { size_t num_harvested_banks = __builtin_popcount(dram_harvesting_mask); for (size_t x = 0; x < dram_grid_size.x - num_harvested_banks; x++) { for (size_t y = 0; y < dram_grid_size.y; y++) { - const tt_xy_pair& dram_core = CoordinateManager::dram_cores[x * dram_grid_size.y + y]; - CoordinateManager::dram_logical_to_virtual[{x, y}] = - CoreCoord(dram_core.x, dram_core.y, CoreType::DRAM, CoordSystem::VIRTUAL); - CoordinateManager::dram_virtual_to_logical[dram_core] = - CoreCoord(x, y, CoreType::DRAM, CoordSystem::LOGICAL); + const tt_xy_pair& dram_core = dram_cores[x * dram_grid_size.y + y]; + dram_logical_to_virtual[{x, y}] = CoreCoord(dram_core.x, dram_core.y, CoreType::DRAM, CoordSystem::VIRTUAL); + dram_virtual_to_logical[dram_core] = CoreCoord(x, y, CoreType::DRAM, CoordSystem::LOGICAL); } } @@ -79,11 +71,10 @@ void BlackholeCoordinateManager::dram_harvesting(const size_t dram_harvesting_ma for (size_t x = 0; x < dram_grid_size.x; x++) { if (!(dram_harvesting_mask & (1 << x))) { for (size_t y = 0; y < dram_grid_size.y; y++) { - const tt_xy_pair& dram_core = CoordinateManager::dram_cores[x * dram_grid_size.y + y]; - CoordinateManager::dram_logical_to_physical[{logical_x, y}] = + const tt_xy_pair& dram_core = dram_cores[x * dram_grid_size.y + y]; + dram_logical_to_physical[{logical_x, y}] = CoreCoord(dram_core.x, dram_core.y, CoreType::DRAM, CoordSystem::PHYSICAL); - CoordinateManager::dram_physical_to_logical[dram_core] = - CoreCoord(logical_x, y, CoreType::DRAM, CoordSystem::LOGICAL); + dram_physical_to_logical[dram_core] = CoreCoord(logical_x, y, CoreType::DRAM, CoordSystem::LOGICAL); } logical_x++; } @@ -91,25 +82,24 @@ void BlackholeCoordinateManager::dram_harvesting(const size_t dram_harvesting_ma } void BlackholeCoordinateManager::fill_eth_logical_to_translated() { - for (size_t x = 0; x < CoordinateManager::eth_grid_size.x; x++) { - for (size_t y = 0; y < CoordinateManager::eth_grid_size.y; y++) { + for (size_t x = 0; x < eth_grid_size.x; x++) { + for (size_t y = 0; y < eth_grid_size.y; y++) { const size_t translated_x = x + eth_translated_coordinate_start_x; const size_t translated_y = y + eth_translated_coordinate_start_y; - CoordinateManager::eth_logical_to_translated[{x, y}] = + eth_logical_to_translated[{x, y}] = CoreCoord(translated_x, translated_y, CoreType::ETH, CoordSystem::TRANSLATED); - CoordinateManager::eth_translated_to_logical[{translated_x, translated_y}] = + eth_translated_to_logical[{translated_x, translated_y}] = CoreCoord(x, y, CoreType::ETH, CoordSystem::LOGICAL); } } } void BlackholeCoordinateManager::fill_pcie_logical_to_translated() { - CoordinateManager::pcie_logical_to_translated[{0, 0}] = CoreCoord( + pcie_logical_to_translated[{0, 0}] = CoreCoord( pcie_translated_coordinate_start_x, pcie_translated_coordinate_start_y, CoreType::PCIE, CoordSystem::TRANSLATED); - CoordinateManager::pcie_translated_to_logical[{ - pcie_translated_coordinate_start_x, pcie_translated_coordinate_start_y}] = + pcie_translated_to_logical[{pcie_translated_coordinate_start_x, pcie_translated_coordinate_start_y}] = CoreCoord(0, 0, CoreType::PCIE, CoordSystem::LOGICAL); } diff --git a/device/coordinate_manager.cpp b/device/coordinate_manager.cpp index f6c911ea..ed112c59 100644 --- a/device/coordinate_manager.cpp +++ b/device/coordinate_manager.cpp @@ -198,35 +198,14 @@ CoreCoord CoordinateManager::to(const CoreCoord core_coord, const CoordSystem co } } -void CoordinateManager::clear_tensix_harvesting_structures() { - tensix_logical_to_physical.clear(); - tensix_logical_to_virtual.clear(); - tensix_physical_to_logical.clear(); - tensix_virtual_to_logical.clear(); - tensix_logical_to_translated.clear(); - tensix_translated_to_logical.clear(); -} - -void CoordinateManager::clear_dram_harvesting_structures() { - dram_logical_to_virtual.clear(); - dram_logical_to_physical.clear(); - dram_virtual_to_logical.clear(); - dram_physical_to_logical.clear(); - dram_logical_to_translated.clear(); - dram_translated_to_logical.clear(); -} - -void CoordinateManager::tensix_harvesting(const size_t harvesting_mask) { - this->tensix_harvesting_mask = harvesting_mask; - clear_tensix_harvesting_structures(); - - size_t num_harvested_y = __builtin_popcount(harvesting_mask); +void CoordinateManager::translate_tensix_coords() { + size_t num_harvested_y = __builtin_popcount(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; for (size_t y = 0; y < grid_size_y; y++) { - if (!(harvesting_mask & (1 << y))) { + if (!(tensix_harvesting_mask & (1 << y))) { for (size_t x = 0; x < grid_size_x; x++) { const tt_xy_pair& tensix_core = tensix_cores[y * grid_size_x + x]; tensix_logical_to_physical[{x, logical_y}] = @@ -266,10 +245,7 @@ void CoordinateManager::fill_tensix_logical_to_translated() { } } -void CoordinateManager::dram_harvesting(const size_t dram_harvesting_mask) { - this->dram_harvesting_mask = dram_harvesting_mask; - clear_dram_harvesting_structures(); - +void CoordinateManager::translate_dram_coords() { for (size_t x = 0; x < dram_grid_size.x; 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]; diff --git a/device/grayskull/grayskull_coordinate_manager.cpp b/device/grayskull/grayskull_coordinate_manager.cpp index f7a3cf6e..3e4d11fd 100644 --- a/device/grayskull/grayskull_coordinate_manager.cpp +++ b/device/grayskull/grayskull_coordinate_manager.cpp @@ -8,14 +8,14 @@ using namespace tt::umd; void GrayskullCoordinateManager::fill_eth_logical_to_translated() { - for (size_t x = 0; x < CoordinateManager::eth_grid_size.x; x++) { - for (size_t y = 0; y < CoordinateManager::eth_grid_size.y; y++) { - const CoreCoord physical_coord = CoordinateManager::eth_logical_to_physical[{x, y}]; + for (size_t x = 0; x < eth_grid_size.x; x++) { + for (size_t y = 0; y < eth_grid_size.y; y++) { + const CoreCoord physical_coord = eth_logical_to_physical[{x, y}]; const size_t translated_x = physical_coord.x; const size_t translated_y = physical_coord.y; - CoordinateManager::eth_logical_to_translated[{x, y}] = + eth_logical_to_translated[{x, y}] = CoreCoord(translated_x, translated_y, CoreType::ETH, CoordSystem::TRANSLATED); - CoordinateManager::eth_translated_to_logical[{translated_x, translated_y}] = + eth_translated_to_logical[{translated_x, translated_y}] = CoreCoord(x, y, CoreType::ETH, CoordSystem::LOGICAL); } } diff --git a/device/wormhole/wormhole_coordinate_manager.cpp b/device/wormhole/wormhole_coordinate_manager.cpp index 553647e7..b2fc262d 100644 --- a/device/wormhole/wormhole_coordinate_manager.cpp +++ b/device/wormhole/wormhole_coordinate_manager.cpp @@ -8,28 +8,28 @@ using namespace tt::umd; void WormholeCoordinateManager::fill_tensix_logical_to_translated() { - size_t num_harvested_y = __builtin_popcount(CoordinateManager::tensix_harvesting_mask); + size_t num_harvested_y = __builtin_popcount(tensix_harvesting_mask); - for (size_t y = 0; y < CoordinateManager::tensix_grid_size.y - num_harvested_y; y++) { - for (size_t x = 0; x < CoordinateManager::tensix_grid_size.x; x++) { + 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++) { const size_t translated_x = x + tensix_translated_coordinate_start_x; const size_t translated_y = y + tensix_translated_coordinate_start_y; - CoordinateManager::tensix_logical_to_translated[{x, y}] = + tensix_logical_to_translated[{x, y}] = CoreCoord(translated_x, translated_y, CoreType::TENSIX, CoordSystem::TRANSLATED); - CoordinateManager::tensix_translated_to_logical[tt_xy_pair(translated_x, translated_y)] = + tensix_translated_to_logical[tt_xy_pair(translated_x, translated_y)] = CoreCoord(x, y, CoreType::TENSIX, CoordSystem::LOGICAL); } } } void WormholeCoordinateManager::fill_eth_logical_to_translated() { - for (size_t x = 0; x < CoordinateManager::eth_grid_size.x; x++) { - for (size_t y = 0; y < CoordinateManager::eth_grid_size.y; y++) { + for (size_t x = 0; x < eth_grid_size.x; x++) { + for (size_t y = 0; y < eth_grid_size.y; y++) { const size_t translated_x = x + eth_translated_coordinate_start_x; const size_t translated_y = y + eth_translated_coordinate_start_y; - CoordinateManager::eth_logical_to_translated[{x, y}] = + eth_logical_to_translated[{x, y}] = CoreCoord(translated_x, translated_y, CoreType::ETH, CoordSystem::TRANSLATED); - CoordinateManager::eth_translated_to_logical[{translated_x, translated_y}] = + eth_translated_to_logical[{translated_x, translated_y}] = CoreCoord(x, y, CoreType::ETH, CoordSystem::LOGICAL); } }