Skip to content

Commit

Permalink
Fix Grayskull tests (#138)
Browse files Browse the repository at this point in the history
Simulated harvesting was hardcoded but it is expected to cover real
harvesting mask, which means it won't work on each card. This PR fixes
this.

For grayskull only, add real harvesting mask to the simulated one. This
will be fixed after the redesign naturally, since harvesting info will
come from tt::umd::ClusterDescriptor, so you could join it with
simulated one in test instead.
  • Loading branch information
broskoTT authored Oct 10, 2024
1 parent 8b96ca4 commit 2ec64f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions device/tt_silicon_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,21 +686,21 @@ tt_SiliconDevice::tt_SiliconDevice(const std::string &sdesc_path, const std::str
for (auto device_id = target_devices.begin(); device_id != target_devices.end(); device_id++) {
log_assert(simulated_harvesting_masks.find(*device_id) != simulated_harvesting_masks.end(), "Could not find harvesting mask for device_id {}", *device_id);
if(arch_name == tt::ARCH::GRAYSKULL) {
log_assert((simulated_harvesting_masks.at(*device_id) & harvested_rows_per_target[*device_id]) == harvested_rows_per_target[*device_id],
"Simulated harvesting config for device {} does not include the actual harvesting config (real config must be contained in simulated config when running on device). Actual Harvested Rows : {} Simulated Harvested Rows : {}",
*device_id, harvested_rows_per_target[*device_id], simulated_harvesting_masks.at(*device_id));

if ((simulated_harvesting_masks.at(*device_id) & harvested_rows_per_target[*device_id]) != harvested_rows_per_target[*device_id]) {
log_warning(LogSiliconDriver,
"Simulated harvesting config for device {} does not include the actual harvesting config. Simulated harvesting mask will be added to the real harvesting mask. Actual Harvested Rows : {} Simulated Harvested Rows : {}",
*device_id, harvested_rows_per_target[*device_id], simulated_harvesting_masks.at(*device_id));
}
simulated_harvesting_masks.at(*device_id) |= harvested_rows_per_target[*device_id];
}
else if(arch_name == tt::ARCH::WORMHOLE_B0 || arch_name == tt::ARCH::WORMHOLE) {
log_assert(std::bitset<32>(simulated_harvesting_masks.at(*device_id)).count() >= std::bitset<32>(harvested_rows_per_target[*device_id]).count(),
"Simulated Harvesting for WH must contain at least as many rows as the actual harvesting config. Actual Harvested Rows : {} Simulated Harvested Rows : {}",
harvested_rows_per_target[*device_id], simulated_harvesting_masks.at(*device_id));
num_rows_harvested.at(*device_id) = std::bitset<32>(simulated_harvesting_masks.at(*device_id)).count();
}
harvested_rows_per_target[*device_id] = simulated_harvesting_masks.at(*device_id);
if(arch_name == tt::ARCH::WORMHOLE or arch_name == tt::ARCH::WORMHOLE_B0) {
log_assert(performed_harvesting ? translation_tables_en : true, "Using a harvested WH cluster with NOC translation disabled.");
}
harvested_rows_per_target[*device_id] = simulated_harvesting_masks.at(*device_id);
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/grayskull/test_silicon_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ TEST(SiliconDriverGS, Harvesting) {

ASSERT_EQ(device.using_harvested_soc_descriptors(), true) << "Expected Driver to have performed harvesting";
for(const auto& chip : sdesc_per_chip) {
ASSERT_EQ(chip.second.workers.size(), 96) << "Expected SOC descriptor with harvesting to have 96 workers for chip " << chip.first;
ASSERT_LE(chip.second.workers.size(), 96) << "Expected SOC descriptor with harvesting to have less than or equal to 96 workers for chip " << chip.first;
}
ASSERT_EQ(device.get_harvesting_masks_for_soc_descriptors().at(0), 6) << "Expected first chip to have harvesting mask of 6";
ASSERT_EQ(device.get_harvesting_masks_for_soc_descriptors().at(0) & simulated_harvesting_masks[0], 6) << "Expected first chip to include simulated harvesting mask of 6";
// ASSERT_EQ(device.get_harvesting_masks_for_soc_descriptors().at(1), 12) << "Expected second chip to have harvesting mask of 12";
device.close_device();
}
Expand Down

0 comments on commit 2ec64f0

Please sign in to comment.