Skip to content

Commit

Permalink
#8305: cleanup, add print
Browse files Browse the repository at this point in the history
  • Loading branch information
aliuTT committed May 13, 2024
1 parent 13d134f commit a5f72e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
21 changes: 7 additions & 14 deletions tt_metal/llrt/tt_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,6 @@ std::filesystem::path get_cluster_desc_yaml() {
return fs::absolute(cluster_desc_path);
}

void Cluster::get_cluster_type(YAML::Node &yaml) {
is_tg_cluster_ = false;
if(yaml["boardtype"]) {
for (const auto& chip_board_type : yaml["boardtype"].as<std::map<int, std::string>>()) {
chip_id_t chip = chip_board_type.first;
auto board_type = chip_board_type.second;
if (board_type == "GALAXY") {
is_tg_cluster_ = true;
}
}
}
}

bool Cluster::is_galaxy_cluster() const {
return this->is_tg_cluster_;
}
Expand All @@ -148,7 +135,12 @@ void Cluster::generate_cluster_descriptor() {
} else {
this->cluster_desc_ = tt_ClusterDescriptor::create_from_yaml(this->cluster_desc_path_);
YAML::Node yaml = YAML::LoadFile(this->cluster_desc_path_);
get_cluster_type(yaml);
for (const auto &chip_id : this->cluster_desc_->get_all_chips()) {
if (this->cluster_desc_->get_board_type(chip_id) == BoardType::GALAXY) {
this->is_tg_cluster_ = true;
break;
}
}
}

// Use cluster descriptor to map MMIO device id to all devices on the same card (including the MMIO device)
Expand All @@ -167,6 +159,7 @@ void Cluster::generate_cluster_descriptor() {

uint32_t total_num_hugepages = get_num_hugepages();
if (this->is_tg_cluster_) {
// TODO: don't think this check is correct, we want to have total num hugepages == num chips even for Galaxy
TT_FATAL(total_num_hugepages >= this->cluster_desc_->get_all_chips().size()/4,
"Machine setup error: Insufficient number of hugepages available, expected >= {} for {} devices but have {}. Increase number of hugepages!", this->cluster_desc_->get_all_chips().size()/4, this->cluster_desc_->get_all_chips().size(), total_num_hugepages);
} else {
Expand Down
1 change: 0 additions & 1 deletion tt_metal/llrt/tt_cluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ class Cluster {

void detect_arch_and_target();
void generate_cluster_descriptor();
void get_cluster_type(YAML::Node &yaml);
void initialize_device_drivers();
void assert_risc_reset();

Expand Down
11 changes: 11 additions & 0 deletions tt_metal/tt_metal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ std::map<chip_id_t, Device *> CreateDevices(
bool is_galaxy = tt::Cluster::instance().is_galaxy_cluster();
for (const auto &device_id : device_ids) {
const auto &mmio_device_id = tt::Cluster::instance().get_associated_mmio_device(device_id);
if (device_id == mmio_device_id) {
std::cout << " MMIO Device " << device_id
<< " Tunnel Count: " << tt::Cluster::instance().get_mmio_device_tunnel_count(mmio_device_id)
<< std::endl;
std::cout << " MMIO Device " << device_id
<< " Tunnel Depth: " << tt::Cluster::instance().get_mmio_device_max_tunnel_depth(mmio_device_id)
<< std::endl;
} else {
std::cout << " Device " << device_id
<< " Tunnel Depth: " << tt::Cluster::instance().get_device_tunnel_depth(device_id) << std::endl;
}
if (active_devices.find(mmio_device_id) == active_devices.end()) {
for (const auto &mmio_controlled_device_id :
tt::Cluster::instance().get_devices_controlled_by_mmio_device(mmio_device_id)) {
Expand Down

0 comments on commit a5f72e2

Please sign in to comment.