From 80205b03b7c884ec2e0ca10c46d55a970505a524 Mon Sep 17 00:00:00 2001 From: Pavle Janevski <165378935+pjanevskiTT@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:21:40 +0100 Subject: [PATCH] Fix translation of ETH coordinates (#404) --- device/coordinate_manager.cpp | 2 +- tests/api/test_soc_descriptor.cpp | 29 +++++++++++++++++++++++++++ tests/soc_descs/wormhole_b0_8x10.yaml | 4 ++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/device/coordinate_manager.cpp b/device/coordinate_manager.cpp index 88e08693..3102dab2 100644 --- a/device/coordinate_manager.cpp +++ b/device/coordinate_manager.cpp @@ -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); diff --git a/tests/api/test_soc_descriptor.cpp b/tests/api/test_soc_descriptor.cpp index f094443c..993d028e 100644 --- a/tests/api/test_soc_descriptor.cpp +++ b/tests/api/test_soc_descriptor.cpp @@ -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& 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 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")); diff --git a/tests/soc_descs/wormhole_b0_8x10.yaml b/tests/soc_descs/wormhole_b0_8x10.yaml index 1bf2d5f9..f8ae3e27 100644 --- a/tests/soc_descs/wormhole_b0_8x10.yaml +++ b/tests/soc_descs/wormhole_b0_8x10.yaml @@ -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: