Skip to content

Commit

Permalink
Fix translation of ETH coordinates (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanevskiTT authored Dec 16, 2024
1 parent 85bf5c4 commit 80205b0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion device/coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void CoordinateManager::translate_dram_coords() {
void CoordinateManager::translate_eth_coords() {
for (size_t x = 0; x < eth_grid_size.x; x++) {
for (size_t y = 0; y < eth_grid_size.y; y++) {
const tt_xy_pair eth_core = eth_cores[x * eth_grid_size.y + y];
const tt_xy_pair eth_core = eth_cores[y * eth_grid_size.x + x];

CoreCoord logical_coord = CoreCoord(x, y, CoreType::ETH, CoordSystem::LOGICAL);
CoreCoord virtual_coord = CoreCoord(eth_core.x, eth_core.y, CoreType::ETH, CoordSystem::VIRTUAL);
Expand Down
29 changes: 29 additions & 0 deletions tests/api/test_soc_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,35 @@ TEST(SocDescriptor, SocDescriptorWormholeOneRowHarvesting) {
ASSERT_TRUE(soc_desc.get_harvested_cores(CoreType::DRAM).empty());
}

// Test ETH translation from logical to physical coordinates.
TEST(SocDescriptor, SocDescriptorWormholeETHLogicalToPhysical) {
tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/wormhole_b0_8x10.yaml"));

const std::vector<tt_xy_pair>& wormhole_eth_cores = tt::umd::wormhole::ETH_CORES;
const tt_xy_pair eth_grid_size = soc_desc.get_grid_size(CoreType::ETH);
const std::vector<CoreCoord> eth_cores = soc_desc.get_cores(CoreType::ETH);

size_t index = 0;
for (size_t y = 0; y < eth_grid_size.y; y++) {
for (size_t x = 0; x < eth_grid_size.x; x++) {
const CoreCoord eth_logical = CoreCoord(x, y, CoreType::ETH, CoordSystem::LOGICAL);
const CoreCoord eth_physical = soc_desc.to(eth_logical, CoordSystem::PHYSICAL);
const CoreCoord eth_virtual = soc_desc.to(eth_logical, CoordSystem::VIRTUAL);

EXPECT_EQ(eth_physical.x, wormhole_eth_cores[index].x);
EXPECT_EQ(eth_physical.y, wormhole_eth_cores[index].y);

EXPECT_EQ(eth_virtual.x, wormhole_eth_cores[index].x);
EXPECT_EQ(eth_virtual.y, wormhole_eth_cores[index].y);

EXPECT_EQ(eth_cores[index].x, wormhole_eth_cores[index].x);
EXPECT_EQ(eth_cores[index].y, wormhole_eth_cores[index].y);

index++;
}
}
}

// Test soc descriptor API for Blackhole when there is no harvesting.
TEST(SocDescriptor, SocDescriptorBlackholeNoHarvesting) {
tt_SocDescriptor soc_desc(test_utils::GetAbsPath("tests/soc_descs/blackhole_140_arch_no_eth.yaml"));
Expand Down
4 changes: 2 additions & 2 deletions tests/soc_descs/wormhole_b0_8x10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ dram:

eth:
[
9-0, 1-0, 8-0, 2-0, 7-0, 3-0, 6-0, 4-0,
9-6, 1-6, 8-6, 2-6, 7-6, 3-6, 6-6, 4-6,
1-0, 2-0, 3-0, 4-0, 6-0, 7-0, 8-0, 9-0,
1-6, 2-6, 3-6, 4-6, 6-6, 7-6, 8-6, 9-6,
]

functional_workers:
Expand Down

0 comments on commit 80205b0

Please sign in to comment.