Skip to content

Commit

Permalink
Minor translate modification (#467)
Browse files Browse the repository at this point in the history
### Issue
Continuation of #446 

### Description
Minor fixes

### List of the changes
- Added the translate_coord_to api to soc descriptor as well
- Added more verbose fatal messages for translation.

### Testing
No additional tests

### API Changes
There are no API changes in this PR.
  • Loading branch information
broskoTT authored Jan 22, 2025
1 parent 8ec6354 commit 809311d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
4 changes: 4 additions & 0 deletions device/api/umd/device/tt_soc_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class tt_SocDescriptor {

// CoreCoord conversions.
tt::umd::CoreCoord translate_coord_to(const tt::umd::CoreCoord core_coord, const CoordSystem coord_system) const;
tt::umd::CoreCoord translate_coord_to(
const tt_xy_pair core_location,
const CoordSystem input_coord_system,
const CoordSystem target_coord_system) const;

static std::string get_soc_descriptor_path(
tt::ARCH arch, const BoardType board_type = BoardType::UNKNOWN, const bool is_chip_remote = false);
Expand Down
21 changes: 20 additions & 1 deletion device/coordinate_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,26 @@ void CoordinateManager::identity_map_physical_cores() {

CoreCoord CoordinateManager::translate_coord_to(
const CoreCoord core_coord, const CoordSystem target_coord_system) const {
return from_physical_map.at({to_physical_map.at(core_coord), target_coord_system});
auto physical_coord_it = to_physical_map.find(core_coord);
log_assert(
physical_coord_it != to_physical_map.end(),
"No core coordinate found at location: ({}, {}, {}, {})",
core_coord.x,
core_coord.y,
to_str(core_coord.core_type),
to_str(core_coord.coord_system));

tt_xy_pair physical_coord = physical_coord_it->second;
auto coord_it = from_physical_map.find({physical_coord, target_coord_system});
log_assert(
coord_it != from_physical_map.end(),
"No core coordinate found for system {} at location: ({}, {}, {}, {})",
to_str(target_coord_system),
core_coord.x,
core_coord.y,
to_str(core_coord.core_type),
to_str(core_coord.coord_system));
return coord_it->second;
}

CoreCoord CoordinateManager::translate_coord_to(
Expand Down
5 changes: 5 additions & 0 deletions device/tt_soc_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ tt::umd::CoreCoord tt_SocDescriptor::translate_coord_to(
return coordinate_manager->translate_coord_to(core_coord, coord_system);
}

tt::umd::CoreCoord tt_SocDescriptor::translate_coord_to(
const tt_xy_pair core_location, const CoordSystem input_coord_system, const CoordSystem target_coord_system) const {
return coordinate_manager->translate_coord_to(core_location, input_coord_system, target_coord_system);
}

tt_SocDescriptor::tt_SocDescriptor(
std::string device_descriptor_path,
const bool noc_translation_enabled,
Expand Down

0 comments on commit 809311d

Please sign in to comment.