Skip to content

Commit

Permalink
Build fix by moving functions to util
Browse files Browse the repository at this point in the history
Signed-off-by: Vinod Pangul <[email protected]>
  • Loading branch information
vipangul committed Jan 11, 2025
1 parent 6faa525 commit 758649e
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -607,52 +607,9 @@ namespace xdp::aie::profile {
bcChannelEvent = channelEvent;
}

/****************************************************************************
* Configure the individual AIE events for metric sets that use group events
***************************************************************************/
void configGroupEvents(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const XAie_ModuleType mod, const module_type type,
const std::string metricSet, const XAie_Events event,
const uint8_t channel)
{
// Set masks for group events
// NOTE: Group error enable register is blocked, so ignoring
if (event == XAIE_EVENT_GROUP_DMA_ACTIVITY_MEM)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_DMA_MASK);
else if (event == XAIE_EVENT_GROUP_LOCK_MEM)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_LOCK_MASK);
else if (event == XAIE_EVENT_GROUP_MEMORY_CONFLICT_MEM)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_CONFLICT_MASK);
else if (event == XAIE_EVENT_GROUP_CORE_PROGRAM_FLOW_CORE)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_CORE_PROGRAM_FLOW_MASK);
else if (event == XAIE_EVENT_GROUP_CORE_STALL_CORE)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_CORE_STALL_MASK);
else if (event == XAIE_EVENT_GROUP_DMA_ACTIVITY_PL) {
uint32_t bitMask = aie::isInputSet(type, metricSet)
? ((channel == 0) ? GROUP_SHIM_S2MM0_STALL_MASK : GROUP_SHIM_S2MM1_STALL_MASK)
: ((channel == 0) ? GROUP_SHIM_MM2S0_STALL_MASK : GROUP_SHIM_MM2S1_STALL_MASK);
XAie_EventGroupControl(aieDevInst, loc, mod, event, bitMask);
}
}

/****************************************************************************
* Configure the selection index to monitor channel number in memory tiles
***************************************************************************/
void configEventSelections(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const module_type type, const std::string metricSet,
const uint8_t channel)
{
if (type != module_type::mem_tile)
return;

XAie_DmaDirection dmaDir = aie::isInputSet(type, metricSet) ? DMA_S2MM : DMA_MM2S;
XAie_EventSelectDmaChannel(aieDevInst, loc, 0, dmaDir, channel);

std::stringstream msg;
msg << "Configured mem tile " << (aie::isInputSet(type,metricSet) ? "S2MM" : "MM2S")
<< "DMA for metricset " << metricSet << ", channel " << (int)channel << ".";
xrt_core::message::send(severity_level::debug, "XRT", msg.str());
}

/****************************************************************************
* Configure counters in Microblaze Debug Module (MDM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,32 +223,7 @@ namespace xdp::aie::profile {
const XAie_Events bcEvent, XAie_Events& bcChannelEvent,
std::vector<std::shared_ptr<xaiefal::XAieBroadcast>>& bcResourcesBytesTx);

/**
* @brief Configure the individual AIE events for metric sets that use group events
* @param aieDevInst AIE device instance
* @param loc Tile location
* @param mod AIE driver module type
* @param type xdp module type
* @param metricSet metric set to be configured
* @param event metric set group event
* @param channel channel to be configured
*/
void configGroupEvents(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const XAie_ModuleType mod, const module_type type,
const std::string metricSet, const XAie_Events event,
const uint8_t channel);

/**
* @brief Configure the selection index to monitor channel number in memory tiles
* @param aieDevInst AIE device instance
* @param loc Tile location
* @param type xdp module type
* @param metricSet metric set to be configured
* @param channel channel to be configured
*/
void configEventSelections(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const module_type type, const std::string metricSet,
const uint8_t channel);

/**
* @brief Configure counters in Microblaze Debug Module (MDM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,53 @@ namespace xdp::aie::profile {
return eventSets;
}

/****************************************************************************
* Configure the individual AIE events for metric sets that use group events
***************************************************************************/
void configGroupEvents(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const XAie_ModuleType mod, const module_type type,
const std::string metricSet, const XAie_Events event,
const uint8_t channel)
{
// Set masks for group events
// NOTE: Group error enable register is blocked, so ignoring
if (event == XAIE_EVENT_GROUP_DMA_ACTIVITY_MEM)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_DMA_MASK);
else if (event == XAIE_EVENT_GROUP_LOCK_MEM)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_LOCK_MASK);
else if (event == XAIE_EVENT_GROUP_MEMORY_CONFLICT_MEM)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_CONFLICT_MASK);
else if (event == XAIE_EVENT_GROUP_CORE_PROGRAM_FLOW_CORE)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_CORE_PROGRAM_FLOW_MASK);
else if (event == XAIE_EVENT_GROUP_CORE_STALL_CORE)
XAie_EventGroupControl(aieDevInst, loc, mod, event, GROUP_CORE_STALL_MASK);
else if (event == XAIE_EVENT_GROUP_DMA_ACTIVITY_PL) {
uint32_t bitMask = aie::isInputSet(type, metricSet)
? ((channel == 0) ? GROUP_SHIM_S2MM0_STALL_MASK : GROUP_SHIM_S2MM1_STALL_MASK)
: ((channel == 0) ? GROUP_SHIM_MM2S0_STALL_MASK : GROUP_SHIM_MM2S1_STALL_MASK);
XAie_EventGroupControl(aieDevInst, loc, mod, event, bitMask);
}
}

/****************************************************************************
* Configure the selection index to monitor channel number in memory tiles
***************************************************************************/
void configEventSelections(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const module_type type, const std::string metricSet,
const uint8_t channel)
{
if (type != module_type::mem_tile)
return;

XAie_DmaDirection dmaDir = aie::isInputSet(type, metricSet) ? DMA_S2MM : DMA_MM2S;
XAie_EventSelectDmaChannel(aieDevInst, loc, 0, dmaDir, channel);

std::stringstream msg;
msg << "Configured mem tile " << (aie::isInputSet(type,metricSet) ? "S2MM" : "MM2S")
<< "DMA for metricset " << metricSet << ", channel " << (int)channel << ".";
xrt_core::message::send(severity_level::debug, "XRT", msg.str());
}

/****************************************************************************
* Modify configured events based on the channel and hardware generation
***************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,33 @@ namespace xdp::aie::profile {
*/
bool isStreamSwitchPortEvent(const XAie_Events event);

/**
* @brief Configure the individual AIE events for metric sets that use group events
* @param aieDevInst AIE device instance
* @param loc Tile location
* @param mod AIE driver module type
* @param type xdp module type
* @param metricSet metric set to be configured
* @param event metric set group event
* @param channel channel to be configured
*/
void configGroupEvents(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const XAie_ModuleType mod, const module_type type,
const std::string metricSet, const XAie_Events event,
const uint8_t channel);

/**
* @brief Configure the selection index to monitor channel number in memory tiles
* @param aieDevInst AIE device instance
* @param loc Tile location
* @param type xdp module type
* @param metricSet metric set to be configured
* @param channel channel to be configured
*/
void configEventSelections(XAie_DevInst* aieDevInst, const XAie_LocType loc,
const module_type type, const std::string metricSet,
const uint8_t channel);

/**
* @brief Check if event is a port running event
* @param event Event ID to check
Expand Down

0 comments on commit 758649e

Please sign in to comment.