Skip to content

Commit

Permalink
add noc entry and exit points to stats output route lists
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrady-tt committed Feb 6, 2025
1 parent 8f942fe commit 6580b70
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tt_npe/cpp/src/npeStats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,27 @@ void npeStats::emitSimStatsToFile(
transfer["end_cycle"] = tr.end_cycle;
transfer["noc_event_type"] = tr.params.noc_event_type;

std::string route_src_entrypoint = tr.params.noc_type == nocType::NOC0 ? "NOC0_IN" : "NOC1_IN";
std::string route_dst_exitpoint = tr.params.noc_type == nocType::NOC0 ? "NOC0_OUT" : "NOC1_OUT";

transfer["route"] = nlohmann::json::array();
transfer["route"].push_back({tr.params.src.row, tr.params.src.col, route_src_entrypoint});
for (const auto &link : tr.route) {
transfer["route"].push_back(
{link.coord.row, link.coord.col, magic_enum::enum_name(nocLinkType(link.type))});
}

// add destination exitpoint elements to route
if (std::holds_alternative<Coord>(tr.params.dst)) {
auto dst = std::get<Coord>(tr.params.dst);
transfer["route"].push_back({dst.row, dst.col, route_dst_exitpoint});
} else {
auto mcast_pair = std::get<MCastCoordPair>(tr.params.dst);
for (const auto &dst : mcast_pair) {
transfer["route"].push_back({dst.row, dst.col, route_dst_exitpoint});
}
}

j["noc_transfers"].push_back(transfer);
}

Expand Down Expand Up @@ -156,4 +171,4 @@ double npeStats::getCongestionImpact() const {
}
}

} // namespace tt_npe
} // namespace tt_npe

0 comments on commit 6580b70

Please sign in to comment.