Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanevskiTT committed Dec 26, 2024
1 parent b759bcc commit a831c65
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
11 changes: 8 additions & 3 deletions device/api/umd/device/blackhole_implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ static const std::vector<tt_xy_pair> ARC_CORES = {{8, 0}};
static const std::vector<tt_xy_pair> ARC_LOCATIONS = ARC_CORES;

static const tt_xy_pair PCIE_GRID_SIZE = {1, 1};
static const std::vector<tt_xy_pair> PCIE_CORES_LOCAL = {{{2, 0}}};
static const std::vector<tt_xy_pair> PCI_LOCATIONS = PCIE_CORES_LOCAL;
static const std::vector<tt_xy_pair> PCIE_CORES_REMOTE = {{{11, 0}}};
static const std::vector<tt_xy_pair> PCIE_CORES_TYPE2 = {{{2, 0}}};
static const std::vector<tt_xy_pair> PCI_LOCATIONS = PCIE_CORES_TYPE2;
static const std::vector<tt_xy_pair> PCIE_CORES_TYPE1 = {{{11, 0}}};

static const tt_xy_pair ETH_GRID_SIZE = {14, 1};
static const std::vector<tt_xy_pair> ETH_CORES = {
Expand Down Expand Up @@ -197,6 +197,11 @@ static const size_t pcie_translated_coordinate_start_y = 24;
static const size_t dram_translated_coordinate_start_x = 17;
static const size_t dram_translated_coordinate_start_y = 12;

/*
* Ge the PCIE core that can be used for communication with host
* based on the board type and whether the chip is remote or not.
* Information on remote chip is used only if the board type is P300.
*/
std::vector<tt_xy_pair> get_pcie_cores(const BoardType board_type, const bool is_chip_remote);

} // namespace blackhole
Expand Down
5 changes: 5 additions & 0 deletions device/api/umd/device/coordinate_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@

class CoordinateManager {
public:
/*
* Creates a Coordinate Manager object.
* Board type and is_chip_remote are used only for Blackhole, since PCIe cores are different
* for different boards and whether the chip is remote or not.
*/
static std::shared_ptr<CoordinateManager> create_coordinate_manager(
tt::ARCH arch,
const tt_xy_pair& tensix_grid_size,
Expand Down
13 changes: 9 additions & 4 deletions device/blackhole/blackhole_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "blackhole/eth_l1_address_map.h"
#include "blackhole/host_mem_address_map.h"
#include "blackhole/l1_address_map.h"
#include "logger.hpp"
#include "umd/device/cluster.h"

constexpr std::uint32_t NOC_ADDR_LOCAL_BITS = 36; // source: noc_parameters.h, common for WH && BH
Expand Down Expand Up @@ -106,15 +107,19 @@ tt_driver_noc_params blackhole_implementation::get_noc_params() const {

namespace blackhole {
std::vector<tt_xy_pair> get_pcie_cores(const BoardType board_type, const bool is_chip_remote) {
if (is_chip_remote) {
log_assert(board_type == BoardType::P300, "Remote chip is supported only for Blackhole P300 board.");
}

if (board_type == BoardType::UNKNOWN || board_type == BoardType::P100) {
return PCIE_CORES_REMOTE;
return PCIE_CORES_TYPE1;
} else if (board_type == BoardType::P150A) {
return PCIE_CORES_LOCAL;
return PCIE_CORES_TYPE2;
} else if (board_type == BoardType::P300) {
return is_chip_remote ? PCIE_CORES_REMOTE : PCIE_CORES_LOCAL;
return is_chip_remote ? PCIE_CORES_TYPE1 : PCIE_CORES_TYPE2;
}

return PCIE_CORES_LOCAL;
return PCIE_CORES_TYPE2;
}
} // namespace blackhole

Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_core_coord_translation_bh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholePCIETranslationLocal) {
std::shared_ptr<CoordinateManager> coordinate_manager =
CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, 0, 0, 0, BoardType::P300, false);
const tt_xy_pair pcie_grid_size = tt::umd::blackhole::PCIE_GRID_SIZE;
const std::vector<tt_xy_pair> pcie_cores = tt::umd::blackhole::PCIE_CORES_LOCAL;
const std::vector<tt_xy_pair> pcie_cores = tt::umd::blackhole::PCIE_CORES_TYPE2;

for (size_t x = 0; x < pcie_grid_size.x; x++) {
for (size_t y = 0; y < pcie_grid_size.y; y++) {
Expand All @@ -523,7 +523,7 @@ TEST(CoordinateManager, CoordinateManagerBlackholePCIETranslationRemote) {
std::shared_ptr<CoordinateManager> coordinate_manager =
CoordinateManager::create_coordinate_manager(tt::ARCH::BLACKHOLE, 0, 0, 0, BoardType::P300, true);
const tt_xy_pair pcie_grid_size = tt::umd::blackhole::PCIE_GRID_SIZE;
const std::vector<tt_xy_pair> pcie_cores = tt::umd::blackhole::PCIE_CORES_REMOTE;
const std::vector<tt_xy_pair> pcie_cores = tt::umd::blackhole::PCIE_CORES_TYPE1;

for (size_t x = 0; x < pcie_grid_size.x; x++) {
for (size_t y = 0; y < pcie_grid_size.y; y++) {
Expand Down

0 comments on commit a831c65

Please sign in to comment.