From 758649e695a02af9db58c9a42e32c612146a3966 Mon Sep 17 00:00:00 2001 From: Vinod Pangul <146476973+vipangul@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:28:04 -0800 Subject: [PATCH] Build fix by moving functions to util Signed-off-by: Vinod Pangul <146476973+vipangul@users.noreply.github.com> --- .../aie_profile/util/aie_profile_config.cpp | 43 ----------------- .../aie_profile/util/aie_profile_config.h | 25 ---------- .../aie_profile/util/aie_profile_util.cpp | 47 +++++++++++++++++++ .../aie_profile/util/aie_profile_util.h | 27 +++++++++++ 4 files changed, 74 insertions(+), 68 deletions(-) diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.cpp index c2ffbe5d91b..2d45dc21c13 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.cpp @@ -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) diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.h b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.h index a0aee28d474..d3b3be7ed96 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.h +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.h @@ -223,32 +223,7 @@ namespace xdp::aie::profile { const XAie_Events bcEvent, XAie_Events& bcChannelEvent, std::vector>& 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) diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.cpp index b60d51495a1..a60af4f7604 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.cpp @@ -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 ***************************************************************************/ diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.h b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.h index 4c0d61a0575..f017bdea6e9 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.h +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_util.h @@ -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