Skip to content

Commit

Permalink
add assert for configuring same tlb_index twice
Browse files Browse the repository at this point in the history
  • Loading branch information
broskoTT committed Dec 17, 2024
1 parent 8ed9c36 commit 96ed817
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions device/cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,13 +1377,15 @@ void Cluster::configure_tlb(
log_assert(
ordering == TLB_DATA::Strict || ordering == TLB_DATA::Posted || ordering == TLB_DATA::Relaxed,
"Invalid ordering specified in Cluster::configure_tlb");
TTDevice* tt_device = get_tt_device(logical_device_id);
tt_device->set_dynamic_tlb(tlb_index, core, address, harvested_coord_translation.at(logical_device_id), ordering);
auto tlb_size = std::get<1>(tt_device->get_architecture_implementation()->describe_tlb(tlb_index).value());
if (tlb_config_map.find(logical_device_id) == tlb_config_map.end()) {
tlb_config_map.insert({logical_device_id, {}});
map_core_to_tlb_per_chip.insert({logical_device_id, {}});
}
log_assert(tlb_config_map.find(tlb_index) == tlb_config_map.end(), "TLB index already configured.");

TTDevice* tt_device = get_tt_device(logical_device_id);
tt_device->set_dynamic_tlb(tlb_index, core, address, harvested_coord_translation.at(logical_device_id), ordering);
auto tlb_size = std::get<1>(tt_device->get_architecture_implementation()->describe_tlb(tlb_index).value());
tlb_config_map.at(logical_device_id).insert({tlb_index, (address / tlb_size) * tlb_size});
map_core_to_tlb_per_chip.at(logical_device_id).insert({core, tlb_index});
}
Expand Down

0 comments on commit 96ed817

Please sign in to comment.