Skip to content

Commit

Permalink
Move constructor to cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanevskiTT committed Nov 28, 2024
1 parent 6b47f8b commit 6c949c0
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 73 deletions.
21 changes: 1 addition & 20 deletions device/api/umd/device/blackhole_coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,7 @@ class BlackholeCoordinateManager : public CoordinateManager {
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
CoordinateManager(
tensix_grid_size,
tensix_cores,
tensix_harvesting_mask,
dram_grid_size,
dram_cores,
dram_harvesting_mask,
eth_grid_size,
eth_cores,
arc_grid_size,
arc_cores,
pcie_grid_size,
pcie_cores) {
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}
const std::vector<tt_xy_pair>& pcie_cores);

protected:
void translate_dram_coords() override;
Expand Down
14 changes: 1 addition & 13 deletions device/api/umd/device/coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,7 @@ class CoordinateManager {
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
tensix_grid_size(tensix_grid_size),
tensix_cores(tensix_cores),
tensix_harvesting_mask(tensix_harvesting_mask),
dram_grid_size(dram_grid_size),
dram_cores(dram_cores),
dram_harvesting_mask(dram_harvesting_mask),
eth_grid_size(eth_grid_size),
eth_cores(eth_cores),
arc_grid_size(arc_grid_size),
arc_cores(arc_cores),
pcie_grid_size(pcie_grid_size),
pcie_cores(pcie_cores) {}
const std::vector<tt_xy_pair>& pcie_cores);

static std::shared_ptr<CoordinateManager> get_coordinate_manager(
tt::ARCH arch,
Expand Down
21 changes: 1 addition & 20 deletions device/api/umd/device/grayskull_coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,7 @@ class GrayskullCoordinateManager : public CoordinateManager {
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
CoordinateManager(
tensix_grid_size,
tensix_cores,
tensix_harvesting_mask,
dram_grid_size,
dram_cores,
dram_harvesting_mask,
eth_grid_size,
eth_cores,
arc_grid_size,
arc_cores,
pcie_grid_size,
pcie_cores) {
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}
const std::vector<tt_xy_pair>& pcie_cores);

protected:
void fill_eth_logical_to_translated() override;
Expand Down
21 changes: 1 addition & 20 deletions device/api/umd/device/wormhole_coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,7 @@ class WormholeCoordinateManager : public CoordinateManager {
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
CoordinateManager(
tensix_grid_size,
tensix_cores,
tensix_harvesting_mask,
dram_grid_size,
dram_cores,
dram_harvesting_mask,
eth_grid_size,
eth_cores,
arc_grid_size,
arc_cores,
pcie_grid_size,
pcie_cores) {
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}
const std::vector<tt_xy_pair>& pcie_cores);

protected:
void fill_tensix_logical_to_translated() override;
Expand Down
33 changes: 33 additions & 0 deletions device/blackhole/blackhole_coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,39 @@

using namespace tt::umd;

BlackholeCoordinateManager::BlackholeCoordinateManager(
const tt_xy_pair& tensix_grid_size,
const std::vector<tt_xy_pair>& tensix_cores,
const size_t tensix_harvesting_mask,
const tt_xy_pair& dram_grid_size,
const std::vector<tt_xy_pair>& dram_cores,
const size_t dram_harvesting_mask,
const tt_xy_pair& eth_grid_size,
const std::vector<tt_xy_pair>& eth_cores,
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
CoordinateManager(
tensix_grid_size,
tensix_cores,
tensix_harvesting_mask,
dram_grid_size,
dram_cores,
dram_harvesting_mask,
eth_grid_size,
eth_cores,
arc_grid_size,
arc_cores,
pcie_grid_size,
pcie_cores) {
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}

void BlackholeCoordinateManager::translate_tensix_coords() {
size_t num_harvested_x = __builtin_popcount(tensix_harvesting_mask);
size_t grid_size_x = tensix_grid_size.x;
Expand Down
26 changes: 26 additions & 0 deletions device/coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@

using namespace tt::umd;

CoordinateManager::CoordinateManager(
const tt_xy_pair& tensix_grid_size,
const std::vector<tt_xy_pair>& tensix_cores,
const size_t tensix_harvesting_mask,
const tt_xy_pair& dram_grid_size,
const std::vector<tt_xy_pair>& dram_cores,
const size_t dram_harvesting_mask,
const tt_xy_pair& eth_grid_size,
const std::vector<tt_xy_pair>& eth_cores,
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
tensix_grid_size(tensix_grid_size),
tensix_cores(tensix_cores),
tensix_harvesting_mask(tensix_harvesting_mask),
dram_grid_size(dram_grid_size),
dram_cores(dram_cores),
dram_harvesting_mask(dram_harvesting_mask),
eth_grid_size(eth_grid_size),
eth_cores(eth_cores),
arc_grid_size(arc_grid_size),
arc_cores(arc_cores),
pcie_grid_size(pcie_grid_size),
pcie_cores(pcie_cores) {}

std::map<tt_xy_pair, CoreCoord>& CoordinateManager::get_logical_to_translated(CoreType core_type) {
switch (core_type) {
case CoreType::TENSIX:
Expand Down
33 changes: 33 additions & 0 deletions device/grayskull/grayskull_coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,39 @@

using namespace tt::umd;

GrayskullCoordinateManager::GrayskullCoordinateManager(
const tt_xy_pair& tensix_grid_size,
const std::vector<tt_xy_pair>& tensix_cores,
const size_t tensix_harvesting_mask,
const tt_xy_pair& dram_grid_size,
const std::vector<tt_xy_pair>& dram_cores,
const size_t dram_harvesting_mask,
const tt_xy_pair& eth_grid_size,
const std::vector<tt_xy_pair>& eth_cores,
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
CoordinateManager(
tensix_grid_size,
tensix_cores,
tensix_harvesting_mask,
dram_grid_size,
dram_cores,
dram_harvesting_mask,
eth_grid_size,
eth_cores,
arc_grid_size,
arc_cores,
pcie_grid_size,
pcie_cores) {
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}

void GrayskullCoordinateManager::fill_eth_logical_to_translated() {
for (size_t x = 0; x < eth_grid_size.x; x++) {
for (size_t y = 0; y < eth_grid_size.y; y++) {
Expand Down
33 changes: 33 additions & 0 deletions device/wormhole/wormhole_coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,39 @@

using namespace tt::umd;

WormholeCoordinateManager::WormholeCoordinateManager(
const tt_xy_pair& tensix_grid_size,
const std::vector<tt_xy_pair>& tensix_cores,
const size_t tensix_harvesting_mask,
const tt_xy_pair& dram_grid_size,
const std::vector<tt_xy_pair>& dram_cores,
const size_t dram_harvesting_mask,
const tt_xy_pair& eth_grid_size,
const std::vector<tt_xy_pair>& eth_cores,
const tt_xy_pair& arc_grid_size,
const std::vector<tt_xy_pair>& arc_cores,
const tt_xy_pair& pcie_grid_size,
const std::vector<tt_xy_pair>& pcie_cores) :
CoordinateManager(
tensix_grid_size,
tensix_cores,
tensix_harvesting_mask,
dram_grid_size,
dram_cores,
dram_harvesting_mask,
eth_grid_size,
eth_cores,
arc_grid_size,
arc_cores,
pcie_grid_size,
pcie_cores) {
this->translate_tensix_coords();
this->translate_dram_coords();
this->translate_eth_coords();
this->translate_arc_coords();
this->translate_pcie_coords();
}

void WormholeCoordinateManager::fill_tensix_logical_to_translated() {
size_t num_harvested_y = __builtin_popcount(tensix_harvesting_mask);

Expand Down

0 comments on commit 6c949c0

Please sign in to comment.