Skip to content

Commit

Permalink
#0: Bugfix to previous v2
Browse files Browse the repository at this point in the history
  • Loading branch information
tt-dma committed Dec 6, 2024
1 parent 1d048bd commit a56206e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tt_metal/impl/dispatch/arch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,45 +141,49 @@ void populate_fd_kernels(const std::set<chip_id_t> &device_ids, uint32_t num_hw_
nodes = (num_hw_cqs == 1) ? two_card_arch_1cq : two_card_arch_2cq;
}
} else if (total_devices == 8) { // T3K
// Need to determine the submesh of devices that are being used
uint32_t mmio_count = 0;
uint32_t remote_count = 0;
// Need to determine the submesh of devices that are being used. TODO: user to pass in the correct architecture?
std::set<chip_id_t> mmio_devices;
std::set<chip_id_t> remote_devices;
for (auto id : device_ids) {
if (tt::Cluster::instance().get_associated_mmio_device(id) == id)
mmio_count++;
mmio_devices.insert(id);
else
remote_count++;
remote_devices.insert(id);
}
tt::log_warning("T3000, mmio_count={}, remote_count={}", mmio_count, remote_count);
tt::log_warning("T3000, mmio_count={}, remote_count={}", mmio_devices.size(), remote_devices.size());

// Supported grid either has one remote per mmio or none
TT_ASSERT(mmio_count == remote_count or remote_count == 0, "Unexpected device grid");
if (remote_count == 0) {
TT_ASSERT(mmio_devices.size() == remote_devices.size() or remote_devices.empty(), "Unexpected device grid");
if (remote_devices.empty()) {
// All mmio chips, replicate as required
std::vector<dispatch_kernel_node_t> nodes_for_one_mmio = populate_single_device();
uint32_t num_nodes_for_one_mmio = nodes_for_one_mmio.size();
for (auto id : device_ids) {
uint32_t index_offset = 0;
for (auto id : mmio_devices) {
for (auto node : nodes_for_one_mmio) {
node.device_id = id;
increment_node_ids(node, id * num_nodes_for_one_mmio);
increment_node_ids(node, index_offset);
nodes.push_back(node);
}
index_offset += nodes_for_one_mmio.size();
}
} else {
// Paired mmio/remote chips
// Here we assume that the mmio chips are enumerated first, and the remote chips are enumerated afterwards
// in the same order as they are connected. TODO: This seems to always be the case, but may need to change in the future.
const std::vector<dispatch_kernel_node_t> *nodes_for_one_mmio = (num_hw_cqs == 1) ? &two_card_arch_1cq : &two_card_arch_2cq;
uint32_t num_mmio_devices = 4;
uint32_t num_nodes_for_one_mmio = nodes_for_one_mmio->size();
for (int mmio_device_id = 0; mmio_device_id < (num_devices / 2); mmio_device_id++) {
uint32_t index_offset = 0;
for (auto mmio_device_id : mmio_devices) {
for (dispatch_kernel_node_t node : *nodes_for_one_mmio) {
TT_ASSERT(node.device_id == 0 || node.device_id == 1);
if (node.device_id == 0)
node.device_id = mmio_device_id;
else
node.device_id = mmio_device_id + num_mmio_devices;
increment_node_ids(node, mmio_device_id * num_nodes_for_one_mmio);
increment_node_ids(node, index_offset);
nodes.push_back(node);
}
index_offset += nodes_for_one_mmio->size();
}
}
} else { // TG, TGG
Expand Down

0 comments on commit a56206e

Please sign in to comment.