Skip to content

Commit

Permalink
cover all stream switch port events (#8118)
Browse files Browse the repository at this point in the history
Signed-off-by: Vinod Pangul <[email protected]>
  • Loading branch information
vipangul authored Apr 30, 2024
1 parent 8a52779 commit 899b001
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 27 deletions.
66 changes: 51 additions & 15 deletions src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,24 +135,57 @@ namespace xdp {
}
}

bool AieProfile_EdgeImpl::isPortTlastEvent(const XAie_Events event)
{
switch (event) {
case XAIE_EVENT_PORT_TLAST_0_PL:
case XAIE_EVENT_PORT_TLAST_1_PL:
case XAIE_EVENT_PORT_TLAST_0_MEM_TILE:
return true;
default:
return false;
}
}

uint8_t AieProfile_EdgeImpl::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_TLAST_1_PL:
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;
Expand Down Expand Up @@ -266,10 +299,13 @@ namespace xdp {
XAie_Events ssEvent;
if (aie::profile::isPortRunningEvent(startEvent))
switchPortRsc->getSSRunningEvent(ssEvent);
else if (isPortTlastEvent(startEvent))
else if (aie::profile::isPortTlastEvent(startEvent))
switchPortRsc->getSSTlastEvent(ssEvent);
else
else if (aie::profile::isPortStalledEvent(startEvent))
switchPortRsc->getSSStalledEvent(ssEvent);
else
switchPortRsc->getSSIdleEvent(ssEvent);

startEvents.at(i) = ssEvent;
endEvents.at(i) = ssEvent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace xdp {
bool checkAieDevice(const uint64_t deviceId, void* handle);

bool setMetricsSettings(const uint64_t deviceId, void* handle);
bool isPortTlastEvent(const XAie_Events event);
uint8_t getPortNumberFromEvent(const XAie_Events event);
void printTileModStats(xaiefal::XAieDev* aieDevice,
const tile_type& tile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ namespace xdp::aie::profile {
***************************************************************************/
bool isStreamSwitchPortEvent(const XAie_Events event)
{
return (std::find(sSEventList.begin(), sSEventList.end(), event) != sSEventList.end());
if (isPortRunningEvent(event) || isPortStalledEvent(event) ||
isPortIdleEvent(event) || isPortTlastEvent(event))
return true;

return false;
}

/****************************************************************************
Expand All @@ -279,6 +283,74 @@ namespace xdp::aie::profile {
return (runningEvents.find(event) != runningEvents.end());
}

/****************************************************************************
* Check if port stalled event
***************************************************************************/
bool isPortStalledEvent(const XAie_Events event)
{
std::set<XAie_Events> stalledEvents = {
XAIE_EVENT_PORT_STALLED_0_CORE, XAIE_EVENT_PORT_STALLED_1_CORE,
XAIE_EVENT_PORT_STALLED_2_CORE, XAIE_EVENT_PORT_STALLED_3_CORE,
XAIE_EVENT_PORT_STALLED_4_CORE, XAIE_EVENT_PORT_STALLED_5_CORE,
XAIE_EVENT_PORT_STALLED_6_CORE, XAIE_EVENT_PORT_STALLED_7_CORE,
XAIE_EVENT_PORT_STALLED_0_PL, XAIE_EVENT_PORT_STALLED_1_PL,
XAIE_EVENT_PORT_STALLED_2_PL, XAIE_EVENT_PORT_STALLED_3_PL,
XAIE_EVENT_PORT_STALLED_4_PL, XAIE_EVENT_PORT_STALLED_5_PL,
XAIE_EVENT_PORT_STALLED_6_PL, XAIE_EVENT_PORT_STALLED_7_PL,
XAIE_EVENT_PORT_STALLED_0_MEM_TILE, XAIE_EVENT_PORT_STALLED_1_MEM_TILE,
XAIE_EVENT_PORT_STALLED_2_MEM_TILE, XAIE_EVENT_PORT_STALLED_3_MEM_TILE,
XAIE_EVENT_PORT_STALLED_4_MEM_TILE, XAIE_EVENT_PORT_STALLED_5_MEM_TILE,
XAIE_EVENT_PORT_STALLED_6_MEM_TILE, XAIE_EVENT_PORT_STALLED_7_MEM_TILE
};

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

/****************************************************************************
* Check if port idle event
***************************************************************************/
bool isPortIdleEvent(const XAie_Events event)
{
std::set<XAie_Events> idleEvents = {
XAIE_EVENT_PORT_IDLE_0_CORE, XAIE_EVENT_PORT_IDLE_1_CORE,
XAIE_EVENT_PORT_IDLE_2_CORE, XAIE_EVENT_PORT_IDLE_3_CORE,
XAIE_EVENT_PORT_IDLE_4_CORE, XAIE_EVENT_PORT_IDLE_5_CORE,
XAIE_EVENT_PORT_IDLE_6_CORE, XAIE_EVENT_PORT_IDLE_7_CORE,
XAIE_EVENT_PORT_IDLE_0_PL, XAIE_EVENT_PORT_IDLE_1_PL,
XAIE_EVENT_PORT_IDLE_2_PL, XAIE_EVENT_PORT_IDLE_3_PL,
XAIE_EVENT_PORT_IDLE_4_PL, XAIE_EVENT_PORT_IDLE_5_PL,
XAIE_EVENT_PORT_IDLE_6_PL, XAIE_EVENT_PORT_IDLE_7_PL,
XAIE_EVENT_PORT_IDLE_0_MEM_TILE, XAIE_EVENT_PORT_IDLE_1_MEM_TILE,
XAIE_EVENT_PORT_IDLE_2_MEM_TILE, XAIE_EVENT_PORT_IDLE_3_MEM_TILE,
XAIE_EVENT_PORT_IDLE_4_MEM_TILE, XAIE_EVENT_PORT_IDLE_5_MEM_TILE,
XAIE_EVENT_PORT_IDLE_6_MEM_TILE, XAIE_EVENT_PORT_IDLE_7_MEM_TILE
};

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

/****************************************************************************
* Check if port Tlast event
***************************************************************************/
bool isPortTlastEvent(const XAie_Events event)
{
std::set<XAie_Events> tlastEvents = {
XAIE_EVENT_PORT_TLAST_0_CORE, XAIE_EVENT_PORT_TLAST_1_CORE,
XAIE_EVENT_PORT_TLAST_2_CORE, XAIE_EVENT_PORT_TLAST_3_CORE,
XAIE_EVENT_PORT_TLAST_4_CORE, XAIE_EVENT_PORT_TLAST_5_CORE,
XAIE_EVENT_PORT_TLAST_6_CORE, XAIE_EVENT_PORT_TLAST_7_CORE,
XAIE_EVENT_PORT_TLAST_0_PL, XAIE_EVENT_PORT_TLAST_1_PL,
XAIE_EVENT_PORT_TLAST_2_PL, XAIE_EVENT_PORT_TLAST_3_PL,
XAIE_EVENT_PORT_TLAST_4_PL, XAIE_EVENT_PORT_TLAST_5_PL,
XAIE_EVENT_PORT_TLAST_6_PL, XAIE_EVENT_PORT_TLAST_7_PL,
XAIE_EVENT_PORT_TLAST_0_MEM_TILE, XAIE_EVENT_PORT_TLAST_1_MEM_TILE,
XAIE_EVENT_PORT_TLAST_2_MEM_TILE, XAIE_EVENT_PORT_TLAST_3_MEM_TILE,
XAIE_EVENT_PORT_TLAST_4_MEM_TILE, XAIE_EVENT_PORT_TLAST_5_MEM_TILE,
XAIE_EVENT_PORT_TLAST_6_MEM_TILE, XAIE_EVENT_PORT_TLAST_7_MEM_TILE
};

return (tlastEvents.find(event) != tlastEvents.end());
}
/****************************************************************************
* Get XAie module enum at the module index
***************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ extern "C" {

namespace xdp::aie::profile {

const std::vector<XAie_Events> sSEventList = {
XAIE_EVENT_PORT_RUNNING_0_CORE,
XAIE_EVENT_PORT_STALLED_0_CORE,
XAIE_EVENT_PORT_RUNNING_0_PL,
XAIE_EVENT_PORT_RUNNING_0_MEM_TILE,
XAIE_EVENT_PORT_STALLED_0_MEM_TILE,
XAIE_EVENT_PORT_TLAST_0_MEM_TILE
};

const std::map<xdp::module_type, uint16_t> counterBases = {
{module_type::core, static_cast<uint16_t>(0)},
{module_type::dma, BASE_MEMORY_COUNTER},
Expand Down Expand Up @@ -100,6 +91,26 @@ namespace xdp::aie::profile {
*/
bool isPortRunningEvent(const XAie_Events event);

/**
* @brief Check if event is a port stalled event
* @param event Event ID to check
* @return True if given event is a port stalled event
*/
bool isPortStalledEvent(const XAie_Events event);

/**
* @brief Check if event is a port idle event
* @param event Event ID to check
* @return True if given event is a port idle event
*/
bool isPortIdleEvent(const XAie_Events event);

/**
* @brief Check if event is a port tlast event
* @param event Event ID to check
* @return True if given event is a port tlast event
*/
bool isPortTlastEvent(const XAie_Events event);

/**
* @brief Get XAie module enum at the module index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ namespace xdp {
std::stringstream msg;
msg << "Configured interface_tile metric set metric set " << tileMetric.second;
msg << " skipped for tile (" << +tileMetric.first.col << ", " << +tileMetric.first.row << ").";
xrt_core::message::send(severity_level::warning, "XRT", msg.str());
xrt_core::message::send(severity_level::debug, "XRT", msg.str());
offTiles.push_back(tileMetric.first);
continue;
}
Expand Down
28 changes: 28 additions & 0 deletions src/runtime_src/xdp/profile/plugin/aie_trace/client/aie_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,34 @@ namespace xdp {
uint8_t AieTrace_WinImpl::getPortNumberFromEvent(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:
Expand Down

0 comments on commit 899b001

Please sign in to comment.