From 3e84f540180a019947148f413bd7be90d420ee39 Mon Sep 17 00:00:00 2001 From: pjanevski Date: Fri, 25 Oct 2024 15:00:32 +0000 Subject: [PATCH] Rename conversion functions --- device/coordinate_manager.cpp | 40 ++++++++-------- device/coordinate_manager.h | 24 +++++----- device/tt_soc_descriptor.cpp | 48 +++++++++---------- device/tt_soc_descriptor.h | 24 +++++----- .../wormhole/wormhole_coordinate_manager.cpp | 4 +- device/wormhole/wormhole_coordinate_manager.h | 4 +- tests/api/test_soc_descriptor_bh.cpp | 16 +++---- tests/api/test_soc_descriptor_gs.cpp | 22 ++++----- tests/api/test_soc_descriptor_wh.cpp | 26 +++++----- 9 files changed, 104 insertions(+), 104 deletions(-) diff --git a/device/coordinate_manager.cpp b/device/coordinate_manager.cpp index a046c8e6..e9b2c8f6 100644 --- a/device/coordinate_manager.cpp +++ b/device/coordinate_manager.cpp @@ -3,56 +3,56 @@ #include "coordinate_manager.h" #include "grayskull/grayskull_coordinate_manager.h" -tt_physical_coords CoordinateManager::logical_to_physical_coords(tt_logical_coords logical_coords) { +tt_physical_coords CoordinateManager::to_physical_coords(tt_logical_coords logical_coords) { return tt_physical_coords(logical_x_to_physical_x[logical_coords.x], logical_y_to_physical_y[logical_coords.y]); } // TODO(pjanevski): this is different for Wormhole and Blackhole. // investigate and implement -tt_translated_coords CoordinateManager::logical_to_translated_coords(tt_logical_coords logical_coords) { - tt_physical_coords physical_coords = logical_to_physical_coords(logical_coords); +tt_translated_coords CoordinateManager::to_translated_coords(tt_logical_coords logical_coords) { + tt_physical_coords physical_coords = to_physical_coords(logical_coords); return tt_translated_coords(physical_coords.x, physical_coords.y); } -tt_virtual_coords CoordinateManager::logical_to_virtual_coords(tt_logical_coords logical_coords) { +tt_virtual_coords CoordinateManager::to_virtual_coords(tt_logical_coords logical_coords) { return tt_virtual_coords(logical_x_to_virtual_x[logical_coords.x], logical_y_to_virtual_y[logical_coords.y]); } -tt_logical_coords CoordinateManager::physical_to_logical_coords(tt_physical_coords physical_coords) { +tt_logical_coords CoordinateManager::to_logical_coords(tt_physical_coords physical_coords) { return tt_logical_coords(physical_x_to_logical_x[physical_coords.x], physical_y_to_logical_y[physical_coords.y]); } -tt_virtual_coords CoordinateManager::physical_to_virtual_coords(tt_physical_coords physical_coords) { - return logical_to_virtual_coords(physical_to_logical_coords(physical_coords)); +tt_virtual_coords CoordinateManager::to_virtual_coords(tt_physical_coords physical_coords) { + return to_virtual_coords(to_logical_coords(physical_coords)); } -tt_translated_coords CoordinateManager::physical_to_translated_coords(tt_physical_coords physical_coords) { - return logical_to_translated_coords(physical_to_logical_coords(physical_coords)); +tt_translated_coords CoordinateManager::to_translated_coords(tt_physical_coords physical_coords) { + return to_translated_coords(to_logical_coords(physical_coords)); } -tt_logical_coords CoordinateManager::virtual_to_logical_coords(tt_virtual_coords virtual_coords) { +tt_logical_coords CoordinateManager::to_logical_coords(tt_virtual_coords virtual_coords) { return tt_logical_coords(virtual_x_to_logical_x[virtual_coords.x], virtual_y_to_logical_y[virtual_coords.y]); } -tt_physical_coords CoordinateManager::virtual_to_physical_coords(tt_virtual_coords virtual_coords) { - return logical_to_physical_coords(virtual_to_logical_coords(virtual_coords)); +tt_physical_coords CoordinateManager::to_physical_coords(tt_virtual_coords virtual_coords) { + return to_physical_coords(to_logical_coords(virtual_coords)); } -tt_translated_coords CoordinateManager::virtual_to_translated_coords(tt_virtual_coords virtual_coords) { - return logical_to_translated_coords(virtual_to_logical_coords(virtual_coords)); +tt_translated_coords CoordinateManager::to_translated_coords(tt_virtual_coords virtual_coords) { + return to_translated_coords(to_logical_coords(virtual_coords)); } -tt_logical_coords CoordinateManager::translated_to_logical_coords(tt_translated_coords translated_coords) { +tt_logical_coords CoordinateManager::to_logical_coords(tt_translated_coords translated_coords) { tt_physical_coords physical_coords = tt_physical_coords(translated_coords.x, translated_coords.y); - return physical_to_logical_coords(physical_coords); + return to_logical_coords(physical_coords); } -tt_physical_coords CoordinateManager::translated_to_physical_coords(tt_translated_coords translated_coords) { - return logical_to_physical_coords(translated_to_logical_coords(translated_coords)); +tt_physical_coords CoordinateManager::to_physical_coords(tt_translated_coords translated_coords) { + return to_physical_coords(to_logical_coords(translated_coords)); } -tt_virtual_coords CoordinateManager::translated_to_virtual_coords(tt_translated_coords translated_coords) { - return logical_to_virtual_coords(translated_to_logical_coords(translated_coords)); +tt_virtual_coords CoordinateManager::to_virtual_coords(tt_translated_coords translated_coords) { + return to_virtual_coords(to_logical_coords(translated_coords)); } void CoordinateManager::clear_harvesting_structures() { diff --git a/device/coordinate_manager.h b/device/coordinate_manager.h index 0e0b15bc..04ef67c5 100644 --- a/device/coordinate_manager.h +++ b/device/coordinate_manager.h @@ -25,21 +25,21 @@ class CoordinateManager { virtual void perform_harvesting(std::size_t harvesting_mask); - virtual tt_physical_coords logical_to_physical_coords(tt_logical_coords logical_coords); - virtual tt_translated_coords logical_to_translated_coords(tt_logical_coords logical_coords); - virtual tt_virtual_coords logical_to_virtual_coords(tt_logical_coords logical_coords); + virtual tt_physical_coords to_physical_coords(tt_logical_coords logical_coords); + virtual tt_translated_coords to_translated_coords(tt_logical_coords logical_coords); + virtual tt_virtual_coords to_virtual_coords(tt_logical_coords logical_coords); - virtual tt_logical_coords physical_to_logical_coords(tt_physical_coords physical_coords); - virtual tt_virtual_coords physical_to_virtual_coords(tt_physical_coords physical_coords); - virtual tt_translated_coords physical_to_translated_coords(tt_physical_coords physical_coords); + virtual tt_logical_coords to_logical_coords(tt_physical_coords physical_coords); + virtual tt_virtual_coords to_virtual_coords(tt_physical_coords physical_coords); + virtual tt_translated_coords to_translated_coords(tt_physical_coords physical_coords); - virtual tt_logical_coords virtual_to_logical_coords(tt_virtual_coords virtual_coords); - virtual tt_physical_coords virtual_to_physical_coords(tt_virtual_coords virtual_coords); - virtual tt_translated_coords virtual_to_translated_coords(tt_virtual_coords virtual_coords); + virtual tt_logical_coords to_logical_coords(tt_virtual_coords virtual_coords); + virtual tt_physical_coords to_physical_coords(tt_virtual_coords virtual_coords); + virtual tt_translated_coords to_translated_coords(tt_virtual_coords virtual_coords); - virtual tt_logical_coords translated_to_logical_coords(tt_translated_coords translated_coords); - virtual tt_physical_coords translated_to_physical_coords(tt_translated_coords translated_coords); - virtual tt_virtual_coords translated_to_virtual_coords(tt_translated_coords translated_coords); + virtual tt_logical_coords to_logical_coords(tt_translated_coords translated_coords); + virtual tt_physical_coords to_physical_coords(tt_translated_coords translated_coords); + virtual tt_virtual_coords to_virtual_coords(tt_translated_coords translated_coords); static std::unique_ptr get_coordinate_manager( tt::ARCH arch, diff --git a/device/tt_soc_descriptor.cpp b/device/tt_soc_descriptor.cpp index d691d7d7..5cdf5989 100644 --- a/device/tt_soc_descriptor.cpp +++ b/device/tt_soc_descriptor.cpp @@ -174,52 +174,52 @@ void tt_SocDescriptor::perform_harvesting(std::size_t harvesting_mask) { coordinate_manager->perform_harvesting(harvesting_mask); } -tt_physical_coords tt_SocDescriptor::logical_to_physical_coords(tt_logical_coords logical_coords) { - return coordinate_manager->logical_to_physical_coords(logical_coords); +tt_physical_coords tt_SocDescriptor::to_physical_coords(tt_logical_coords logical_coords) { + return coordinate_manager->to_physical_coords(logical_coords); } -tt_virtual_coords tt_SocDescriptor::logical_to_virtual_coords(tt_logical_coords logical_coords) { - return coordinate_manager->logical_to_virtual_coords(logical_coords); +tt_virtual_coords tt_SocDescriptor::to_virtual_coords(tt_logical_coords logical_coords) { + return coordinate_manager->to_virtual_coords(logical_coords); } -tt_translated_coords tt_SocDescriptor::logical_to_translated_coords(tt_logical_coords logical_coords) { - return coordinate_manager->logical_to_translated_coords(logical_coords); +tt_translated_coords tt_SocDescriptor::to_translated_coords(tt_logical_coords logical_coords) { + return coordinate_manager->to_translated_coords(logical_coords); } -tt_logical_coords tt_SocDescriptor::physical_to_logical_coords(tt_physical_coords physical_coords) { - return coordinate_manager->physical_to_logical_coords(physical_coords); +tt_logical_coords tt_SocDescriptor::to_logical_coords(tt_physical_coords physical_coords) { + return coordinate_manager->to_logical_coords(physical_coords); } -tt_virtual_coords tt_SocDescriptor::physical_to_virtual_coords(tt_physical_coords physical_coords) { - return coordinate_manager->physical_to_virtual_coords(physical_coords); +tt_virtual_coords tt_SocDescriptor::to_virtual_coords(tt_physical_coords physical_coords) { + return coordinate_manager->to_virtual_coords(physical_coords); } -tt_translated_coords tt_SocDescriptor::physical_to_translated_coords(tt_physical_coords physical_coords) { - return coordinate_manager->physical_to_translated_coords(physical_coords); +tt_translated_coords tt_SocDescriptor::to_translated_coords(tt_physical_coords physical_coords) { + return coordinate_manager->to_translated_coords(physical_coords); } -tt_logical_coords tt_SocDescriptor::virtual_to_logical_coords(tt_virtual_coords virtual_coords) { - return coordinate_manager->virtual_to_logical_coords(virtual_coords); +tt_logical_coords tt_SocDescriptor::to_logical_coords(tt_virtual_coords virtual_coords) { + return coordinate_manager->to_logical_coords(virtual_coords); } -tt_physical_coords tt_SocDescriptor::virtual_to_physical_coords(tt_virtual_coords virtual_coords) { - return coordinate_manager->virtual_to_physical_coords(virtual_coords); +tt_physical_coords tt_SocDescriptor::to_physical_coords(tt_virtual_coords virtual_coords) { + return coordinate_manager->to_physical_coords(virtual_coords); } -tt_translated_coords tt_SocDescriptor::virtual_to_translated_coords(tt_virtual_coords virtual_coords) { - return coordinate_manager->virtual_to_translated_coords(virtual_coords); +tt_translated_coords tt_SocDescriptor::to_translated_coords(tt_virtual_coords virtual_coords) { + return coordinate_manager->to_translated_coords(virtual_coords); } -tt_logical_coords tt_SocDescriptor::translated_to_logical_coords(tt_translated_coords translated_coords) { - return coordinate_manager->translated_to_logical_coords(translated_coords); +tt_logical_coords tt_SocDescriptor::to_logical_coords(tt_translated_coords translated_coords) { + return coordinate_manager->to_logical_coords(translated_coords); } -tt_physical_coords tt_SocDescriptor::translated_to_physical_coords(tt_translated_coords translated_coords) { - return coordinate_manager->translated_to_physical_coords(translated_coords); +tt_physical_coords tt_SocDescriptor::to_physical_coords(tt_translated_coords translated_coords) { + return coordinate_manager->to_physical_coords(translated_coords); } -tt_virtual_coords tt_SocDescriptor::translated_to_virtual_coords(tt_translated_coords translated_coords) { - return coordinate_manager->translated_to_virtual_coords(translated_coords); +tt_virtual_coords tt_SocDescriptor::to_virtual_coords(tt_translated_coords translated_coords) { + return coordinate_manager->to_virtual_coords(translated_coords); } tt_SocDescriptor::tt_SocDescriptor(std::string device_descriptor_path, std::size_t harvesting_mask) { diff --git a/device/tt_soc_descriptor.h b/device/tt_soc_descriptor.h index 6bf5a55f..965de290 100644 --- a/device/tt_soc_descriptor.h +++ b/device/tt_soc_descriptor.h @@ -167,21 +167,21 @@ class tt_SocDescriptor { // Coordinate conversions. // Conversions from logical coordinates should be used just for worker cores. - tt_physical_coords logical_to_physical_coords(tt_logical_coords logical_coords); - tt_virtual_coords logical_to_virtual_coords(tt_logical_coords logical_coords); - tt_translated_coords logical_to_translated_coords(tt_logical_coords logical_coords); + tt_physical_coords to_physical_coords(tt_logical_coords logical_coords); + tt_virtual_coords to_virtual_coords(tt_logical_coords logical_coords); + tt_translated_coords to_translated_coords(tt_logical_coords logical_coords); - tt_logical_coords physical_to_logical_coords(tt_physical_coords physical_coords); - tt_virtual_coords physical_to_virtual_coords(tt_physical_coords physical_coords); - tt_translated_coords physical_to_translated_coords(tt_physical_coords physical_coords); + tt_logical_coords to_logical_coords(tt_physical_coords physical_coords); + tt_virtual_coords to_virtual_coords(tt_physical_coords physical_coords); + tt_translated_coords to_translated_coords(tt_physical_coords physical_coords); - tt_logical_coords virtual_to_logical_coords(tt_virtual_coords virtual_coords); - tt_physical_coords virtual_to_physical_coords(tt_virtual_coords virtual_coords); - tt_translated_coords virtual_to_translated_coords(tt_virtual_coords virtual_coords); + tt_logical_coords to_logical_coords(tt_virtual_coords virtual_coords); + tt_physical_coords to_physical_coords(tt_virtual_coords virtual_coords); + tt_translated_coords to_translated_coords(tt_virtual_coords virtual_coords); - tt_logical_coords translated_to_logical_coords(tt_translated_coords translated_coords); - tt_physical_coords translated_to_physical_coords(tt_translated_coords translated_coords); - tt_virtual_coords translated_to_virtual_coords(tt_translated_coords translated_coords); + tt_logical_coords to_logical_coords(tt_translated_coords translated_coords); + tt_physical_coords to_physical_coords(tt_translated_coords translated_coords); + tt_virtual_coords to_virtual_coords(tt_translated_coords translated_coords); void perform_harvesting(std::size_t harvesting_mask); diff --git a/device/wormhole/wormhole_coordinate_manager.cpp b/device/wormhole/wormhole_coordinate_manager.cpp index a1c9ab0e..eccc0a70 100644 --- a/device/wormhole/wormhole_coordinate_manager.cpp +++ b/device/wormhole/wormhole_coordinate_manager.cpp @@ -13,10 +13,10 @@ std::set WormholeCoordinateManager::get_y_coordinates_to_harvest(st return y_to_harvest; } -tt_translated_coords WormholeCoordinateManager::logical_to_translated_coords(tt_logical_coords logical_coords) { +tt_translated_coords WormholeCoordinateManager::to_translated_coords(tt_logical_coords logical_coords) { return tt_translated_coords(logical_coords.x + translated_coordinate_start_x, logical_coords.y + translated_coordinate_start_y); } -tt_logical_coords WormholeCoordinateManager::translated_to_logical_coords(tt_translated_coords translated_coords) { +tt_logical_coords WormholeCoordinateManager::to_logical_coords(tt_translated_coords translated_coords) { return tt_logical_coords(translated_coords.x - translated_coordinate_start_x, translated_coords.y - translated_coordinate_start_y); } \ No newline at end of file diff --git a/device/wormhole/wormhole_coordinate_manager.h b/device/wormhole/wormhole_coordinate_manager.h index 477b5a53..73edee66 100644 --- a/device/wormhole/wormhole_coordinate_manager.h +++ b/device/wormhole/wormhole_coordinate_manager.h @@ -21,9 +21,9 @@ class WormholeCoordinateManager : public CoordinateManager { WormholeCoordinateManager(const tt_xy_pair& worker_grid_size, const std::vector& workers, std::size_t harvesting_mask) : CoordinateManager(worker_grid_size, workers, harvesting_mask) {} - tt_translated_coords logical_to_translated_coords(tt_logical_coords logical_coords) override; + tt_translated_coords to_translated_coords(tt_logical_coords logical_coords) override; - tt_logical_coords translated_to_logical_coords(tt_translated_coords translated_coords) override; + tt_logical_coords to_logical_coords(tt_translated_coords translated_coords) override; protected: std::set get_y_coordinates_to_harvest(std::size_t harvesting_mask) override; diff --git a/tests/api/test_soc_descriptor_bh.cpp b/tests/api/test_soc_descriptor_bh.cpp index 46c5269d..fb6293c5 100644 --- a/tests/api/test_soc_descriptor_bh.cpp +++ b/tests/api/test_soc_descriptor_bh.cpp @@ -31,8 +31,8 @@ TEST(SocDescriptor, SocDescriptorBHNoHarvesting) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); // Virtual and physical coordinates should be the same. EXPECT_EQ(physical_coords, virtual_coords); @@ -50,11 +50,11 @@ TEST(SocDescriptor, SocDescriptorBHTopLeftCore) { tt_logical_coords logical_coords = tt_logical_coords(0, 0); // Always expect same virtual coordinate for (0, 0) logical coordinate. - tt_virtual_coords virtual_cords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_virtual_coords virtual_cords = soc_desc.to_virtual_coords(logical_coords); EXPECT_EQ(virtual_cords, tt_virtual_coords(1, 2)); // This depends on harvesting mask. So expected physical coord is specific to this test and Blackhole arch. - tt_physical_coords physical_cords = soc_desc.logical_to_physical_coords(logical_coords); + tt_physical_coords physical_cords = soc_desc.to_physical_coords(logical_coords); EXPECT_EQ(physical_cords, tt_physical_coords(2, 2)); } @@ -78,7 +78,7 @@ TEST(SocDescriptor, SocDescriptorBHLogicalPhysicalMapping) { for (size_t x = 0; x < worker_grid_size.x - num_harvested_x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); logical_to_physical[logical_coords] = physical_coords; // Expect that logical to physical translation is 1-1 mapping. No duplicates for physical coordinates. @@ -91,7 +91,7 @@ TEST(SocDescriptor, SocDescriptorBHLogicalPhysicalMapping) { for (auto it : logical_to_physical) { tt_physical_coords physical_coords = it.second; - tt_logical_coords logical_coords = soc_desc.physical_to_logical_coords(physical_coords); + tt_logical_coords logical_coords = soc_desc.to_logical_coords(physical_coords); // Expect that reverse mapping of physical coordinates gives the same logical coordinates // using which we got the physical coordinates. @@ -120,7 +120,7 @@ TEST(SocDescriptor, SocDescriptorBHLogicalVirtualMapping) { for (size_t x = 0; x < worker_grid_size.x - num_harvested_x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); logical_to_virtual[logical_coords] = virtual_coords; // Expect that logical to virtual translation is 1-1 mapping. No duplicates for virtual coordinates. @@ -133,7 +133,7 @@ TEST(SocDescriptor, SocDescriptorBHLogicalVirtualMapping) { for (auto it : logical_to_virtual) { tt_virtual_coords virtual_coords = it.second; - tt_logical_coords logical_coords = soc_desc.virtual_to_logical_coords(virtual_coords); + tt_logical_coords logical_coords = soc_desc.to_logical_coords(virtual_coords); // Expect that reverse mapping of virtual coordinates gives the same logical coordinates // using which we got the virtual coordinates. diff --git a/tests/api/test_soc_descriptor_gs.cpp b/tests/api/test_soc_descriptor_gs.cpp index b122ce56..8f787232 100644 --- a/tests/api/test_soc_descriptor_gs.cpp +++ b/tests/api/test_soc_descriptor_gs.cpp @@ -30,8 +30,8 @@ TEST(SocDescriptor, SocDescriptorGSNoHarvesting) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); // Virtual and physical coordinates should be the same. EXPECT_EQ(physical_coords, virtual_coords); @@ -50,11 +50,11 @@ TEST(SocDescriptor, SocDescriptorGSTopLeftCore) { tt_logical_coords logical_coords = tt_logical_coords(0, 0); // Always expect same virtual coordinate for (0, 0) logical coordinate. - tt_virtual_coords virtual_cords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_virtual_coords virtual_cords = soc_desc.to_virtual_coords(logical_coords); EXPECT_EQ(virtual_cords, tt_virtual_coords(1, 1)); // This depends on harvesting mask. So expected physical coord is specific to this test and Wormhole arch. - tt_physical_coords physical_cords = soc_desc.logical_to_physical_coords(logical_coords); + tt_physical_coords physical_cords = soc_desc.to_physical_coords(logical_coords); EXPECT_EQ(physical_cords, tt_physical_coords(1, 1)); } @@ -67,9 +67,9 @@ TEST(SocDescriptor, SocDescriptorGSTranslatingCoords) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); - tt_translated_coords translated_coords = soc_desc.logical_to_translated_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); + tt_translated_coords translated_coords = soc_desc.to_translated_coords(logical_coords); // Virtual, physical and translated coordinates should be the same. EXPECT_EQ(physical_coords, virtual_coords); @@ -92,7 +92,7 @@ TEST(SocDescriptor, SocDescriptorGSLogicalPhysicalMapping) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); logical_to_physical[logical_coords] = physical_coords; // Expect that logical to physical translation is 1-1 mapping. No duplicates for physical coordinates. @@ -105,7 +105,7 @@ TEST(SocDescriptor, SocDescriptorGSLogicalPhysicalMapping) { for (auto it : logical_to_physical) { tt_physical_coords physical_coords = it.second; - tt_logical_coords logical_coords = soc_desc.physical_to_logical_coords(physical_coords); + tt_logical_coords logical_coords = soc_desc.to_logical_coords(physical_coords); // Expect that reverse mapping of physical coordinates gives the same logical coordinates // using which we got the physical coordinates. @@ -127,7 +127,7 @@ TEST(SocDescriptor, SocDescriptorGSLogicalVirtualMapping) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); logical_to_virtual[logical_coords] = virtual_coords; // Expect that logical to virtual translation is 1-1 mapping. No duplicates for virtual coordinates. @@ -140,7 +140,7 @@ TEST(SocDescriptor, SocDescriptorGSLogicalVirtualMapping) { for (auto it : logical_to_virtual) { tt_virtual_coords virtual_coords = it.second; - tt_logical_coords logical_coords = soc_desc.virtual_to_logical_coords(virtual_coords); + tt_logical_coords logical_coords = soc_desc.to_logical_coords(virtual_coords); // Expect that reverse mapping of virtual coordinates gives the same logical coordinates // using which we got the virtual coordinates. diff --git a/tests/api/test_soc_descriptor_wh.cpp b/tests/api/test_soc_descriptor_wh.cpp index b7ed5088..6cc3d790 100644 --- a/tests/api/test_soc_descriptor_wh.cpp +++ b/tests/api/test_soc_descriptor_wh.cpp @@ -33,8 +33,8 @@ TEST(SocDescriptor, SocDescriptorWHNoHarvesting) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); // Virtual and physical coordinates should be the same. EXPECT_EQ(physical_coords, virtual_coords); @@ -55,11 +55,11 @@ TEST(SocDescriptor, SocDescriptorWHTopLeftCore) { tt_logical_coords logical_coords = tt_logical_coords(0, 0); // Always expect same virtual coordinate for (0, 0) logical coordinate. - tt_virtual_coords virtual_cords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_virtual_coords virtual_cords = soc_desc.to_virtual_coords(logical_coords); EXPECT_EQ(virtual_cords, tt_virtual_coords(1, 1)); // This depends on harvesting mask. So expected physical coord is specific to this test and Wormhole arch. - tt_physical_coords physical_cords = soc_desc.logical_to_physical_coords(logical_coords); + tt_physical_coords physical_cords = soc_desc.to_physical_coords(logical_coords); EXPECT_EQ(physical_cords, tt_physical_coords(1, 2)); } @@ -83,7 +83,7 @@ TEST(SocDescriptor, SocDescriptorWHLogicalPhysicalMapping) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y - num_harvested_y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); logical_to_physical[logical_coords] = physical_coords; // Expect that logical to physical translation is 1-1 mapping. No duplicates for physical coordinates. @@ -97,7 +97,7 @@ TEST(SocDescriptor, SocDescriptorWHLogicalPhysicalMapping) { for (auto it : logical_to_physical) { tt_physical_coords physical_coords = it.second; - tt_logical_coords logical_coords = soc_desc.physical_to_logical_coords(physical_coords); + tt_logical_coords logical_coords = soc_desc.to_logical_coords(physical_coords); // Expect that reverse mapping of physical coordinates gives the same logical coordinates // using which we got the physical coordinates. @@ -126,7 +126,7 @@ TEST(SocDescriptor, SocDescriptorWHLogicalVirtualMapping) { for (size_t x = 0; x < worker_grid_size.x; x++) { for (size_t y = 0; y < worker_grid_size.y - num_harvested_y; y++) { tt_logical_coords logical_coords = tt_logical_coords(x, y); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); logical_to_virtual[logical_coords] = virtual_coords; // Expect that logical to virtual translation is 1-1 mapping. No duplicates for virtual coordinates. @@ -137,7 +137,7 @@ TEST(SocDescriptor, SocDescriptorWHLogicalVirtualMapping) { for (auto it : logical_to_virtual) { tt_virtual_coords virtual_coords = it.second; - tt_logical_coords logical_coords = soc_desc.virtual_to_logical_coords(virtual_coords); + tt_logical_coords logical_coords = soc_desc.to_logical_coords(virtual_coords); // Expect that reverse mapping of virtual coordinates gives the same logical coordinates // using which we got the virtual coordinates. @@ -164,12 +164,12 @@ TEST(SocDescriptor, SocDescriptorWHLogicalTranslatedTopLeft) { std::size_t num_harvested_y = test_utils::get_num_harvested(harvesting_mask); tt_logical_coords logical_coords = tt_logical_coords(0, 0); - tt_physical_coords physical_coords = soc_desc.logical_to_physical_coords(logical_coords); - tt_virtual_coords virtual_coords = soc_desc.logical_to_virtual_coords(logical_coords); + tt_physical_coords physical_coords = soc_desc.to_physical_coords(logical_coords); + tt_virtual_coords virtual_coords = soc_desc.to_virtual_coords(logical_coords); - tt_translated_coords translated_from_logical = soc_desc.logical_to_translated_coords(logical_coords); - tt_translated_coords translated_from_physical = soc_desc.physical_to_translated_coords(physical_coords); - tt_translated_coords translated_from_virtual = soc_desc.virtual_to_translated_coords(virtual_coords); + tt_translated_coords translated_from_logical = soc_desc.to_translated_coords(logical_coords); + tt_translated_coords translated_from_physical = soc_desc.to_translated_coords(physical_coords); + tt_translated_coords translated_from_virtual = soc_desc.to_translated_coords(virtual_coords); EXPECT_EQ(translated_from_logical, expected_translated_coords); EXPECT_EQ(translated_from_physical, expected_translated_coords);