Skip to content

Commit

Permalink
[XDP] Fix to manage stream port ID detection in profile for client (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vipangul authored Oct 14, 2024
1 parent cfec0af commit ffe9e25
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace xdp {

aie::profile::configGroupEvents(&aieDevInst, loc, mod, type, metricSet, startEvent, channel0);
if (aie::profile::isStreamSwitchPortEvent(startEvent))
configStreamSwitchPorts(tileMetric.first, loc, type, metricSet, channel0);
configStreamSwitchPorts(tileMetric.first, loc, type, metricSet, channel0, startEvent);

// Convert enums to physical event IDs for reporting purposes
uint8_t tmpStart;
Expand Down Expand Up @@ -257,10 +257,11 @@ namespace xdp {
// NOTE: Used to monitor streams: trace, interfaces, and MEM tiles
void
AieProfile_WinImpl::configStreamSwitchPorts(const tile_type& tile, const XAie_LocType& loc,
const module_type& type, const std::string& metricSet, const uint8_t channel)
const module_type& type, const std::string& metricSet, const uint8_t channel, const XAie_Events startEvent)
{
// Hardcoded
uint8_t rscId = 0;
uint8_t portnum = aie::profile::getPortNumberFromEvent(startEvent);
// AIE Tiles (e.g., trace streams)
if (type == module_type::core) {
auto slaveOrMaster = (metricSet.find("mm2s") != std::string::npos) ?
Expand All @@ -278,7 +279,10 @@ namespace xdp {
// Grab slave/master and stream ID
// NOTE: stored in getTilesForProfiling() above
auto slaveOrMaster = (tile.is_master == 0) ? XAIE_STRMSW_SLAVE : XAIE_STRMSW_MASTER;
auto streamPortId = tile.stream_id;
uint8_t streamPortId = (portnum >= tile.stream_ids.size()) ?
0 : static_cast<uint8_t>(tile.stream_ids.at(portnum));

// auto streamPortId = tile.stream_id;
// Define stream switch port to monitor interface
XAie_EventSelectStrmPort(&aieDevInst, loc, rscId, slaveOrMaster, SOUTH, streamPortId);
std::stringstream msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace xdp {
void configStreamSwitchPorts(
const tile_type& tile, const XAie_LocType& loc,
const module_type& type, const std::string& metricSet,
const uint8_t channel
const uint8_t channel, const XAie_Events startEvent
);
private:
const std::vector<XAie_ModuleType> falModuleTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,65 @@ namespace xdp::aie::profile {

return (tlastEvents.find(event) != tlastEvents.end());
}

uint8_t getPortNumberFromEvent(const XAie_Events event)
{
switch (event) {
case XAIE_EVENT_PORT_RUNNING_7_CORE:
case XAIE_EVENT_PORT_STALLED_7_CORE:
case XAIE_EVENT_PORT_IDLE_7_CORE:
case XAIE_EVENT_PORT_RUNNING_7_PL:
case XAIE_EVENT_PORT_STALLED_7_PL:
case XAIE_EVENT_PORT_IDLE_7_PL:
return 7;
case XAIE_EVENT_PORT_RUNNING_6_CORE:
case XAIE_EVENT_PORT_STALLED_6_CORE:
case XAIE_EVENT_PORT_IDLE_6_CORE:
case XAIE_EVENT_PORT_RUNNING_6_PL:
case XAIE_EVENT_PORT_STALLED_6_PL:
case XAIE_EVENT_PORT_IDLE_6_PL:
return 6;
case XAIE_EVENT_PORT_RUNNING_5_CORE:
case XAIE_EVENT_PORT_STALLED_5_CORE:
case XAIE_EVENT_PORT_IDLE_5_CORE:
case XAIE_EVENT_PORT_RUNNING_5_PL:
case XAIE_EVENT_PORT_STALLED_5_PL:
case XAIE_EVENT_PORT_IDLE_5_PL:
return 5;
case XAIE_EVENT_PORT_RUNNING_4_CORE:
case XAIE_EVENT_PORT_STALLED_4_CORE:
case XAIE_EVENT_PORT_IDLE_4_CORE:
case XAIE_EVENT_PORT_RUNNING_4_PL:
case XAIE_EVENT_PORT_STALLED_4_PL:
case XAIE_EVENT_PORT_IDLE_4_PL:
return 4;
case XAIE_EVENT_PORT_RUNNING_3_CORE:
case XAIE_EVENT_PORT_STALLED_3_CORE:
case XAIE_EVENT_PORT_IDLE_3_CORE:
case XAIE_EVENT_PORT_RUNNING_3_PL:
case XAIE_EVENT_PORT_STALLED_3_PL:
case XAIE_EVENT_PORT_IDLE_3_PL:
return 3;
case XAIE_EVENT_PORT_RUNNING_2_CORE:
case XAIE_EVENT_PORT_STALLED_2_CORE:
case XAIE_EVENT_PORT_IDLE_2_CORE:
case XAIE_EVENT_PORT_RUNNING_2_PL:
case XAIE_EVENT_PORT_STALLED_2_PL:
case XAIE_EVENT_PORT_IDLE_2_PL:
return 2;
case XAIE_EVENT_PORT_RUNNING_1_CORE:
case XAIE_EVENT_PORT_STALLED_1_CORE:
case XAIE_EVENT_PORT_IDLE_1_CORE:
case XAIE_EVENT_PORT_RUNNING_1_PL:
case XAIE_EVENT_PORT_STALLED_1_PL:
case XAIE_EVENT_PORT_IDLE_1_PL:
return 1;
default:
return 0;
}
}


/****************************************************************************
* Get XAie module enum at the module index
***************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ namespace xdp::aie::profile {
*/
bool isPortTlastEvent(const XAie_Events event);

uint8_t getPortNumberFromEvent(const XAie_Events event);

/**
* @brief Get XAie module enum at the module index
* @param moduleIndex module index
Expand Down

0 comments on commit ffe9e25

Please sign in to comment.