diff --git a/src/runtime_src/xdp/profile/database/static_info/aie_constructs.h b/src/runtime_src/xdp/profile/database/static_info/aie_constructs.h index 941d0349e80..9228d32e8a9 100644 --- a/src/runtime_src/xdp/profile/database/static_info/aie_constructs.h +++ b/src/runtime_src/xdp/profile/database/static_info/aie_constructs.h @@ -31,6 +31,7 @@ namespace xdp::aie { bool broadcast_enable_core; bool graph_iterator_event; std::string event_trace; + bool enable_multi_layer; }; struct driver_config diff --git a/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp b/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp index 2cc0808b13a..d397d2a754a 100755 --- a/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp @@ -409,6 +409,28 @@ namespace xdp::aie { try { xrt::hw_context context = xrt_core::hw_context_int::create_hw_context_from_implementation(hwCtxImpl); auto device = xrt_core::hw_context_int::get_core_device(context); + + auto info = xrt_core::device_query_default(device.get(), {}); + for(const auto& e : info) { + boost::property_tree::ptree pt; + pt.put("start_col", e.start_col); + pt.put("num_cols", e.num_cols); + infoPt.push_back(std::make_pair("", pt)); + } + } + catch(...) { + xrt_core::message::send(severity_level::info, "XRT", "Could not retrieve AIE Partition Info."); + return infoPt; + } + return infoPt; + } + + boost::property_tree::ptree + getAIEPartitionInfo(void* handle) + { + boost::property_tree::ptree infoPt; + try { + auto device = xrt_core::get_userpf_device(handle); auto info = xrt_core::device_query_default(device.get(), {}); for(const auto& e : info) { diff --git a/src/runtime_src/xdp/profile/database/static_info/aie_util.h b/src/runtime_src/xdp/profile/database/static_info/aie_util.h index cbf7416a25c..0056a646ed6 100755 --- a/src/runtime_src/xdp/profile/database/static_info/aie_util.h +++ b/src/runtime_src/xdp/profile/database/static_info/aie_util.h @@ -111,6 +111,10 @@ namespace xdp::aie { boost::property_tree::ptree getAIEPartitionInfoClient(void* hwCtxImpl); + XDP_CORE_EXPORT + boost::property_tree::ptree + getAIEPartitionInfo(void* handle); + XDP_CORE_EXPORT void displayColShiftInfo(uint8_t colShift); diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp index 2cde02b0a10..52b5b5513d1 100644 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp @@ -66,6 +66,8 @@ AIEControlConfigFiletype::getAIECompilerOptions() const aie_meta.get("aie_metadata.aiecompiler_options.graph_iterator_event", false); aiecompiler_options.event_trace = aie_meta.get("aie_metadata.aiecompiler_options.event_trace", "runtime"); + aiecompiler_options.enable_multi_layer = + aie_meta.get("aie_metadata.aiecompiler_options.enable_multi_layer", false); return aiecompiler_options; } diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/CMakeLists.txt b/src/runtime_src/xdp/profile/plugin/aie_trace/CMakeLists.txt index af0f9c5aeed..6b44b250c1d 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/CMakeLists.txt +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/CMakeLists.txt @@ -42,6 +42,7 @@ file(GLOB AIE_TRACE_UTIL_FILES "${PROFILE_DIR}/plugin/aie_trace/util/*.cpp" ) + file(GLOB AIE_DRIVER_COMMON_UTIL_FILES "${PROFILE_DIR}/device/common/*.h" "${PROFILE_DIR}/device/common/*.cpp" diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.cpp index 2ebe4f74f2d..21f969b1686 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.cpp @@ -462,4 +462,86 @@ namespace xdp::aie::trace { return true; } + /**************************************************************************** + * Reset timer for the specified tile range + ***************************************************************************/ + void timerSyncronization(XAie_DevInst* aieDevInst, xaiefal::XAieDev* aieDevice, std::shared_ptr metadata, uint8_t startCol, uint8_t numCols) + { + std::shared_ptr traceStartBroadcastCh1 = nullptr, traceStartBroadcastCh2 = nullptr; + std::vector vL; + traceStartBroadcastCh1 = aieDevice->broadcast(vL, XAIE_PL_MOD, XAIE_CORE_MOD); + traceStartBroadcastCh1->reserve(); + traceStartBroadcastCh2 = aieDevice->broadcast(vL, XAIE_PL_MOD, XAIE_CORE_MOD); + traceStartBroadcastCh2->reserve(); + + uint8_t broadcastId1 = traceStartBroadcastCh1->getBc(); + uint8_t broadcastId2 = traceStartBroadcastCh2->getBc(); + + //build broadcast network + aie::trace::build2ChannelBroadcastNetwork(aieDevInst, metadata, broadcastId1, broadcastId2, XAIE_EVENT_USER_EVENT_0_PL, startCol, numCols); + + //set timer control register + for (auto& tileMetric : metadata->getConfigMetrics()) { + auto tile = tileMetric.first; + auto col = tile.col + startCol; + auto row = tile.row; + auto type = aie::getModuleType(row, metadata->getRowOffset()); + auto loc = XAie_TileLoc(col, row); + + if(type == module_type::shim) { + XAie_Events resetEvent = (XAie_Events)(XAIE_EVENT_BROADCAST_A_0_PL + broadcastId2); + if(col == startCol) + { + resetEvent = XAIE_EVENT_USER_EVENT_0_PL; + } + + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_PL_MOD, resetEvent, XAIE_RESETDISABLE); + } + else if(type == module_type::mem_tile) { + XAie_Events resetEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_0_MEM_TILE + broadcastId1); + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_MEM_MOD, resetEvent, XAIE_RESETDISABLE); + } + else { + XAie_Events resetEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_0_CORE + broadcastId1); + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_CORE_MOD, resetEvent, XAIE_RESETDISABLE); + resetEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_0_MEM + broadcastId1); + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_MEM_MOD, resetEvent, XAIE_RESETDISABLE); + } + } + + //Generate the event to trigger broadcast network to reset timer + XAie_EventGenerate(aieDevInst, XAie_TileLoc(startCol, 0), XAIE_PL_MOD, XAIE_EVENT_USER_EVENT_0_PL); + + //reset timer control register so that timer are not reset after this point + for (auto& tileMetric : metadata->getConfigMetrics()) { + auto tile = tileMetric.first; + auto col = tile.col + startCol; + auto row = tile.row; + auto type = aie::getModuleType(row, metadata->getRowOffset()); + auto loc = XAie_TileLoc(col, row); + + if(type == module_type::shim) { + XAie_Events resetEvent = XAIE_EVENT_NONE_PL ; + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_PL_MOD, resetEvent, XAIE_RESETDISABLE); + } + else if(type == module_type::mem_tile) { + XAie_Events resetEvent = XAIE_EVENT_NONE_MEM_TILE; + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_MEM_MOD, resetEvent, XAIE_RESETDISABLE); + } + else { + XAie_Events resetEvent = XAIE_EVENT_NONE_CORE; + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_CORE_MOD, resetEvent, XAIE_RESETDISABLE); + resetEvent = XAIE_EVENT_NONE_MEM; + XAie_SetTimerResetEvent(aieDevInst, loc, XAIE_MEM_MOD, resetEvent, XAIE_RESETDISABLE); + } + } + + //reset broadcast network + reset2ChannelBroadcastNetwork(aieDevInst, metadata, broadcastId1, broadcastId2, startCol, numCols); + + //release the channels used for timer sync + traceStartBroadcastCh1->release(); + traceStartBroadcastCh2->release(); + } + } // namespace xdp diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.h b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.h index 773845637ea..3df6472d4e5 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.h +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_config.h @@ -20,6 +20,7 @@ #include #include "xaiefal/xaiefal.hpp" #include "xdp/profile/database/static_info/aie_constructs.h" +#include "xdp/profile/plugin/aie_trace/aie_trace_metadata.h" namespace xdp::aie::trace { /** @@ -119,6 +120,18 @@ namespace xdp::aie::trace { */ bool configStartIteration(xaiefal::XAieMod& core, uint32_t iteration, XAie_Events& startEvent); + + /** + * @brief Reset timers for specified tile range + * @param aieDevInst AIE device Instance + * @param aieDevice AIE device + * @param metadata Trace Metadata + * @param startCol Start column of the partition + * @param numCols Num of columns in the partition + */ + void timerSyncronization(XAie_DevInst* aieDevInst, xaiefal::XAieDev* aieDevice, + std::shared_ptr metadata, uint8_t startCol, + uint8_t numCols); } // namespace xdp::aie::trace #endif diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.cpp index 6c6c994ad61..07e2828e1a0 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.cpp @@ -632,4 +632,107 @@ namespace xdp::aie::trace { XAIE_EVENT_DMA_S2MM_0_MEMORY_BACKPRESSURE_PL, XAIE_EVENT_DMA_S2MM_1_MEMORY_BACKPRESSURE_PL); } } + + /**************************************************************************** + * Set up broadcast network + ***************************************************************************/ + void build2ChannelBroadcastNetwork(XAie_DevInst* aieDevInst, std::shared_ptr metadata, uint8_t broadcastId1, uint8_t broadcastId2, XAie_Events event, uint8_t startCol, uint8_t numCols) + { + std::vector maxRowAtCol(startCol + numCols, 0); + for (auto& tileMetric : metadata->getConfigMetrics()) { + auto tile = tileMetric.first; + auto col = tile.col; + auto row = tile.row; + maxRowAtCol[startCol + col] = std::max(maxRowAtCol[col], (uint8_t)row); + } + + XAie_Events bcastEvent2_PL = (XAie_Events) (XAIE_EVENT_BROADCAST_A_0_PL + broadcastId2); + XAie_EventBroadcast(aieDevInst, XAie_TileLoc(startCol, 0), XAIE_PL_MOD, broadcastId2, event); + + for(uint8_t col = startCol; col < startCol + numCols; col++) { + for(uint8_t row = 0; row <= maxRowAtCol[col]; row++) { + module_type tileType = aie::getModuleType(row, metadata->getRowOffset()); + auto loc = XAie_TileLoc(col, row); + + if(tileType == module_type::shim) { + // first channel is only used to send north + if(col == startCol) { + XAie_EventBroadcast(aieDevInst, loc, XAIE_PL_MOD, broadcastId1, event); + } + else { + XAie_EventBroadcast(aieDevInst, loc, XAIE_PL_MOD, broadcastId1, bcastEvent2_PL); + } + if(maxRowAtCol[col] != row) { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_EAST); + } + else { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_EAST | XAIE_EVENT_BROADCAST_NORTH); + } + + // second channel is only used to send east + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_A, broadcastId2, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_NORTH); + + if(col != startCol + numCols - 1) { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_B, broadcastId2, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_NORTH); + } + else { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_B, broadcastId2, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_NORTH | XAIE_EVENT_BROADCAST_EAST); + } + } + else if(tileType == module_type::mem_tile) { + if(maxRowAtCol[col] != row) { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_EAST); + } + else { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_EAST | XAIE_EVENT_BROADCAST_NORTH); + } + } + else { //core tile + if(maxRowAtCol[col] != row) { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_CORE_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST); + } + else { + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_CORE_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_NORTH); + } + XAie_EventBroadcastBlockDir(aieDevInst, loc, XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_SOUTH | XAIE_EVENT_BROADCAST_WEST | XAIE_EVENT_BROADCAST_EAST | XAIE_EVENT_BROADCAST_NORTH); + } + } + } + } + + /**************************************************************************** + * Reset broadcast network + ***************************************************************************/ + void reset2ChannelBroadcastNetwork(XAie_DevInst* aieDevInst, std::shared_ptr metadata, uint8_t broadcastId1, uint8_t broadcastId2, uint8_t startCol, uint8_t numCols) { + std::vector maxRowAtCol(startCol + numCols, 0); + for (auto& tileMetric : metadata->getConfigMetrics()) { + auto tile = tileMetric.first; + auto col = tile.col; + auto row = tile.row; + maxRowAtCol[startCol + col] = std::max(maxRowAtCol[col], (uint8_t)row); + } + + XAie_EventBroadcastReset(aieDevInst, XAie_TileLoc(startCol, 0), XAIE_PL_MOD, broadcastId2); + + for(uint8_t col = startCol; col < startCol + numCols; col++) { + for(uint8_t row = 0; row <= maxRowAtCol[col]; row++) { + module_type tileType = aie::getModuleType(row, metadata->getRowOffset()); + auto loc = XAie_TileLoc(col, row); + + if(tileType == module_type::shim) { + XAie_EventBroadcastReset(aieDevInst, loc, XAIE_PL_MOD, broadcastId1); + XAie_EventBroadcastUnblockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_ALL); + XAie_EventBroadcastUnblockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_A, broadcastId2, XAIE_EVENT_BROADCAST_ALL); + XAie_EventBroadcastUnblockDir(aieDevInst, loc, XAIE_PL_MOD, XAIE_EVENT_SWITCH_B, broadcastId2, XAIE_EVENT_BROADCAST_ALL); + } + else if(tileType == module_type::mem_tile) { + XAie_EventBroadcastUnblockDir(aieDevInst, loc, XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_ALL); + } + else { //core tile + XAie_EventBroadcastUnblockDir(aieDevInst, loc, XAIE_CORE_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_ALL); + XAie_EventBroadcastUnblockDir(aieDevInst, loc, XAIE_MEM_MOD, XAIE_EVENT_SWITCH_A, broadcastId1, XAIE_EVENT_BROADCAST_ALL); + } + } + } + } } // namespace xdp::aie diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.h b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.h index ae456fbfcd7..80fdcc06c6b 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.h +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/util/aie_trace_util.h @@ -20,6 +20,7 @@ #include #include "xaiefal/xaiefal.hpp" #include "xdp/profile/database/static_info/aie_constructs.h" +#include "xdp/profile/plugin/aie_trace/aie_trace_metadata.h" namespace xdp::aie::trace { /** @@ -178,6 +179,28 @@ namespace xdp::aie::trace { void modifyEvents(module_type type, io_type subtype, const std::string metricSet, uint8_t channel, std::vector& events); + /** + * @brief Build 2-channel broadcast network for specified tile range + * @param aieDevInst AIE device + * @param metadata Trace Metadata + * @param broadcastId1 Broadcast channel 1 + * @param broadcastId2 Broadcast channel 2 + * @param event Event to trigger broadcast network + * @param startCol Start column of the partition + * @param numCols Num of columns in the partition + */ + void build2ChannelBroadcastNetwork(XAie_DevInst* aieDevInst, std::shared_ptr metadata, uint8_t broadcastId1, uint8_t broadcastId2, XAie_Events event, uint8_t startCol, uint8_t numCols); + + /** + * @brief Reset 2-channel broadcast network for specified tile range + * @param aieDevInst AIE device + * @param metadata Trace Metadata + * @param broadcastId1 Broadcast channel 1 + * @param broadcastId2 Broadcast channel 2 + * @param startCol Start column of the partition + * @param numCols Num of columns in the partition + */ + void reset2ChannelBroadcastNetwork(XAie_DevInst* aieDevInst, std::shared_ptr metadata, uint8_t broadcastId1, uint8_t broadcastId2, uint8_t startCol, uint8_t numCols); } // namespace xdp::aie::trace #endif diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/ve2/aie_trace.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/ve2/aie_trace.cpp index f4a9972993f..7bbe7f95b42 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/ve2/aie_trace.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/ve2/aie_trace.cpp @@ -291,6 +291,16 @@ namespace xdp { return false; } + // Get partition columns + boost::property_tree::ptree aiePartitionPt = xdp::aie::getAIEPartitionInfo(handle); + // Currently, assuming only one Hw Context is alive at a time + uint8_t startCol = static_cast(aiePartitionPt.front().second.get("start_col")); + uint8_t numCols = static_cast(aiePartitionPt.front().second.get("num_cols")); + + //TODO: Remove below 2 lines once aie_partition_info from XRT returns correct values + const char* envNumCols = std::getenv("NUM_COLS"); + numCols = envNumCols ? static_cast(std::stoi(envNumCols)) : 4 ; + // Get channel configurations (memory and interface tiles) auto configChannel0 = metadata->getConfigChannel0(); auto configChannel1 = metadata->getConfigChannel1(); @@ -306,6 +316,35 @@ namespace xdp { mNumTileTraceEvents[m][n] = 0; } + auto metadataReader = (VPDatabase::Instance()->getStaticInfo()).getAIEmetadataReader(); + if (!metadataReader) { + if (aie::isDebugVerbosity()) { + std::stringstream msg; + msg << "AIE metadata reader is null"; + xrt_core::message::send(severity_level::debug, "XRT", msg.str()); + } + } + + auto compilerOptions = metadataReader->getAIECompilerOptions(); + std::shared_ptr traceStartBroadcastCh1 = nullptr, traceStartBroadcastCh2 = nullptr; + if(compilerOptions.enable_multi_layer) { + + aie::trace::timerSyncronization(aieDevInst,aieDevice, metadata, startCol, numCols); + if(xrt_core::config::get_aie_trace_settings_trace_start_broadcast()) + { + std::vector vL; + traceStartBroadcastCh1 = aieDevice->broadcast(vL, XAIE_PL_MOD, XAIE_CORE_MOD); + traceStartBroadcastCh1->reserve(); + traceStartBroadcastCh2 = aieDevice->broadcast(vL, XAIE_PL_MOD, XAIE_CORE_MOD); + traceStartBroadcastCh2->reserve(); + aie::trace::build2ChannelBroadcastNetwork(aieDevInst, metadata, traceStartBroadcastCh1->getBc(), traceStartBroadcastCh2->getBc(), XAIE_EVENT_USER_EVENT_0_PL, startCol, numCols); + + coreTraceStartEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_0_CORE + traceStartBroadcastCh1->getBc()); + memoryTileTraceStartEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_0_MEM_TILE + traceStartBroadcastCh1->getBc()); + interfaceTileTraceStartEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_A_0_PL + traceStartBroadcastCh2->getBc()); + } + } + // Using user event for trace end to enable flushing // NOTE: Flush trace module always at the end because for some applications // core might be running infinitely. @@ -661,6 +700,11 @@ namespace xdp { traceEndEvent = comboEvents.at(1); } + if(compilerOptions.enable_multi_layer && type == module_type::core && xrt_core::config::get_aie_trace_settings_trace_start_broadcast()) + { + traceStartEvent = (XAie_Events) (XAIE_EVENT_BROADCAST_0_MEM + traceStartBroadcastCh1->getBc()); + } + // Configure event ports on stream switch // NOTE: These are events from the core module stream switch // outputted on the memory module trace stream. @@ -822,8 +866,17 @@ namespace xdp { } auto shimTrace = shim.traceControl(); - if (shimTrace->setCntrEvent(interfaceTileTraceStartEvent, interfaceTileTraceEndEvent) != XAIE_OK) - break; + + if(col == startCol && compilerOptions.enable_multi_layer && xrt_core::config::get_aie_trace_settings_trace_start_broadcast()) + { + if (shimTrace->setCntrEvent(XAIE_EVENT_USER_EVENT_0_PL, interfaceTileTraceEndEvent) != XAIE_OK) + break; + } + else + { + if (shimTrace->setCntrEvent(interfaceTileTraceStartEvent, interfaceTileTraceEndEvent) != XAIE_OK) + break; + } auto ret = shimTrace->reserve(); if (ret != XAIE_OK) {