Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanevskiTT committed Dec 11, 2024
1 parent df74728 commit 51ee2e5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
4 changes: 4 additions & 0 deletions device/api/umd/device/coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class CoordinateManager {
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores);

void initialize();

virtual void translate_tensix_coords();
virtual void translate_dram_coords();
virtual void translate_eth_coords();
Expand Down Expand Up @@ -136,3 +138,5 @@ class CoordinateManager {
const tt_xy_pair pcie_grid_size;
const std::vector<tt_xy_pair>& pcie_cores;
};

// friend
12 changes: 2 additions & 10 deletions device/blackhole/blackhole_coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ BlackholeCoordinateManager::BlackholeCoordinateManager(
arc_cores,
pcie_grid_size,
pcie_cores) {
this->identity_map_physical_cores();
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
initialize();
}

void BlackholeCoordinateManager::translate_tensix_coords() {
Expand All @@ -50,17 +45,14 @@ void BlackholeCoordinateManager::translate_tensix_coords() {
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)) {
size_t y_index = 0;
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_index * grid_size_x];
const tt_xy_pair& virtual_core = tensix_cores[x_index + y * grid_size_x];

CoreCoord virtual_coord =
CoreCoord(virtual_core.x, virtual_core.y, CoreType::TENSIX, CoordSystem::VIRTUAL);

add_core_translation(virtual_coord, physical_core);

y_index++;
}
x_index++;
} else {
Expand Down
11 changes: 10 additions & 1 deletion device/coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ CoordinateManager::CoordinateManager(
pcie_grid_size(pcie_grid_size),
pcie_cores(pcie_cores) {}

void CoordinateManager::initialize() {
this->identity_map_physical_cores();
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}

void CoordinateManager::add_core_translation(const CoreCoord& core_coord, const tt_xy_pair& physical_pair) {
to_physical_map.insert({core_coord, physical_pair});
from_physical_map.insert({{{physical_pair.x, physical_pair.y}, core_coord.coord_system}, core_coord});
Expand Down Expand Up @@ -108,7 +117,7 @@ void CoordinateManager::translate_tensix_coords() {
}
}

fill_tensix_physical_translated_mapping();
this->fill_tensix_physical_translated_mapping();
}

void CoordinateManager::fill_tensix_physical_translated_mapping() {
Expand Down
7 changes: 1 addition & 6 deletions device/grayskull/grayskull_coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ GrayskullCoordinateManager::GrayskullCoordinateManager(
arc_cores,
pcie_grid_size,
pcie_cores) {
this->identity_map_physical_cores();
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
initialize();
}

void GrayskullCoordinateManager::fill_eth_physical_translated_mapping() {
Expand Down
7 changes: 1 addition & 6 deletions device/wormhole/wormhole_coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ WormholeCoordinateManager::WormholeCoordinateManager(
arc_cores,
pcie_grid_size,
pcie_cores) {
this->identity_map_physical_cores();
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
initialize();
}

void WormholeCoordinateManager::fill_tensix_physical_translated_mapping() {
Expand Down

0 comments on commit 51ee2e5

Please sign in to comment.