From f9bcf7b803e319c87da9c231d0282e06b3dbc1af Mon Sep 17 00:00:00 2001 From: Vinod Pangul <146476973+vipangul@users.noreply.github.com> Date: Fri, 3 Oct 2025 16:28:57 -0600 Subject: [PATCH 1/4] Initial support of absolute colum settings Signed-off-by: Vinod Pangul <146476973+vipangul@users.noreply.github.com> --- .../filetypes/aie_control_config_filetype.cpp | 24 +++++++-------- .../filetypes/aie_trace_config_filetype.cpp | 12 ++++---- .../plugin/aie_profile/edge/aie_profile.cpp | 29 ++++++++----------- .../plugin/aie_profile/ve2/aie_profile.cpp | 15 ++++++---- .../plugin/aie_status/aie_status_plugin.cpp | 13 ++------- .../plugin/aie_trace/aie_trace_plugin.cpp | 13 ++------- .../plugin/aie_trace/edge/aie_trace.cpp | 29 +++++++------------ .../plugin/aie_trace/ve2/aie_trace.cpp | 21 ++++++++------ .../profile/writer/aie_profile/aie_writer.cpp | 5 ++-- 9 files changed, 69 insertions(+), 92 deletions(-) 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 764171b83e4..799f40a2c98 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 @@ -170,6 +170,7 @@ AIEControlConfigFiletype::getPLIOs() const } std::unordered_map plios; + uint8_t colShift = getPartitionOverlayStartCols().front(); for (auto& plio_node : pliosMetadata.get()) { io_config plio; @@ -178,7 +179,7 @@ AIEControlConfigFiletype::getPLIOs() const plio.id = plio_node.second.get("id"); plio.name = plio_node.second.get("name"); plio.logicalName = plio_node.second.get("logical_name"); - plio.shimColumn = plio_node.second.get("shim_column"); + plio.shimColumn = plio_node.second.get("shim_column") + colShift; plio.streamId = plio_node.second.get("stream_id"); plio.slaveOrMaster = plio_node.second.get("slaveOrMaster"); plio.channelNum = 0; @@ -216,6 +217,7 @@ AIEControlConfigFiletype::getChildGMIOs( const std::string& childStr) const } std::unordered_map gmios; + uint8_t colShift = getPartitionOverlayStartCols().front(); for (auto& gmio_node : gmiosMetadata.get()) { io_config gmio; @@ -233,7 +235,7 @@ AIEControlConfigFiletype::getChildGMIOs( const std::string& childStr) const gmio.name = gmio_node.second.get("name"); gmio.logicalName = gmio_node.second.get("logical_name"); gmio.slaveOrMaster = slaveOrMaster; - gmio.shimColumn = gmio_node.second.get("shim_column"); + gmio.shimColumn = gmio_node.second.get("shim_column") + colShift; gmio.channelNum = (slaveOrMaster == 0) ? (channelNumber - 2) : channelNumber; gmio.streamId = gmio_node.second.get("stream_id"); gmio.burstLength = gmio_node.second.get("burst_length_in_16byte"); @@ -410,10 +412,9 @@ AIEControlConfigFiletype::getMemoryTiles(const std::string& graph_name, std::vector allTiles; std::vector memTiles; - // Always one row of interface tiles uint8_t rowOffset = 1; + uint8_t colShift = getPartitionOverlayStartCols().front(); - // Now parse all shared buffers for (auto const &shared_buffer : sharedBufferTree.get()) { auto currGraph = shared_buffer.second.get("graph"); if ((currGraph.find(graph_name) == std::string::npos) @@ -425,7 +426,7 @@ AIEControlConfigFiletype::getMemoryTiles(const std::string& graph_name, continue; tile_type tile; - tile.col = shared_buffer.second.get("column"); + tile.col = shared_buffer.second.get("column") + colShift; tile.row = shared_buffer.second.get("row") + rowOffset; // Store names of DMA channels for reporting purposes @@ -461,6 +462,7 @@ AIEControlConfigFiletype::getAIETiles(const std::string& graph_name) const std::vector tiles; auto rowOffset = getAIETileRowOffset(); + uint8_t colShift = getPartitionOverlayStartCols().front(); int startCount = 0; for (auto& graph : graphsMetadata.get()) { @@ -472,7 +474,7 @@ AIEControlConfigFiletype::getAIETiles(const std::string& graph_name) const for (auto& node : graph.second.get_child("core_columns")) { tiles.push_back(tile_type()); auto& t = tiles.at(count++); - t.col = xdp::aie::convertStringToUint8(node.second.data()); + t.col = xdp::aie::convertStringToUint8(node.second.data()) + colShift; t.active_core = true; } @@ -550,10 +552,10 @@ AIEControlConfigFiletype::getEventTiles(const std::string& graph_name, std::vector tiles; auto rowOffset = getAIETileRowOffset(); + uint8_t colShift = getPartitionOverlayStartCols().front(); int startCount = 0; for (auto& graph : graphsMetadata.get()) { - // Make sure this is requested graph // NOTE: Only top-level graphs are currently listed in metadata, // so search is reversed to support sub-graph requests // (e.g., "mygraph" is found in "mygraph.subgraph1") @@ -566,7 +568,7 @@ AIEControlConfigFiletype::getEventTiles(const std::string& graph_name, for (auto& node : graph.second.get_child(col_name)) { tiles.push_back(tile_type()); auto& t = tiles.at(count++); - t.col = xdp::aie::convertStringToUint8(node.second.data()); + t.col = xdp::aie::convertStringToUint8(node.second.data()) + colShift; if (type == module_type::core) t.active_core = true; else @@ -610,10 +612,9 @@ AIEControlConfigFiletype::getTiles(const std::string& graph_name, std::vector tiles; auto rowOffset = getAIETileRowOffset(); + uint8_t colShift = getPartitionOverlayStartCols().front(); - // Traverse all tiles in kernel map for (auto const &mapping : kernelToTileMapping.get()) { - // Make sure this tile is what we're looking for auto currGraph = mapping.second.get("graph"); if ((currGraph.find(graph_name) == std::string::npos) && (graph_name.compare("all") != 0)) @@ -626,9 +627,8 @@ AIEControlConfigFiletype::getTiles(const std::string& graph_name, continue; } - // Store this tile tile_type tile; - tile.col = mapping.second.get("column"); + tile.col = mapping.second.get("column") + colShift; tile.row = mapping.second.get("row") + rowOffset; tile.active_core = true; tile.active_memory = true; diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp index 5f67aff6ff9..887ec205e9c 100755 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp @@ -75,6 +75,7 @@ AIETraceConfigFiletype::getExternalBuffers() const } std::unordered_map gmios; + uint8_t colShift = getPartitionOverlayStartCols().front(); for (auto& buf_node : bufferMetadata.get()) { io_config gmio; @@ -82,7 +83,7 @@ AIETraceConfigFiletype::getExternalBuffers() const gmio.name = buf_node.second.get("portName"); auto direction = buf_node.second.get("direction"); gmio.slaveOrMaster = (direction == "s2mm") ? 1 : 0; - gmio.shimColumn = buf_node.second.get("shim_column"); + gmio.shimColumn = buf_node.second.get("shim_column") + colShift; gmio.channelNum = buf_node.second.get("channel_number"); gmio.streamId = buf_node.second.get("stream_id"); gmio.burstLength = 8; @@ -122,10 +123,9 @@ AIETraceConfigFiletype::getMemoryTiles(const std::string& graph_name, std::vector allTiles; std::vector memTiles; - // Always one row of interface tiles uint8_t rowOffset = 1; + uint8_t colShift = getPartitionOverlayStartCols().front(); - // Parse all shared buffers for (auto const &shared_buffer : sharedBufferTree.get()) { bool foundGraph = (graph_name.compare("all") == 0); bool foundBuffer = (buffer_name.compare("all") == 0); @@ -152,7 +152,7 @@ AIETraceConfigFiletype::getMemoryTiles(const std::string& graph_name, // Add to list if verified if (foundGraph && foundBuffer) { tile_type tile; - tile.col = shared_buffer.second.get("column"); + tile.col = shared_buffer.second.get("column") + colShift; tile.row = shared_buffer.second.get("row") + rowOffset; // Store names of DMA channels for reporting purposes @@ -204,8 +204,8 @@ AIETraceConfigFiletype::getTiles(const std::string& graph_name, std::vector tiles; auto rowOffset = getAIETileRowOffset(); + uint8_t colShift = getPartitionOverlayStartCols().front(); - // Parse all kernel mappings for (auto const &mapping : kernelToTileMapping.get()) { bool foundGraph = isAllGraph; bool foundKernel = isAllKernel; @@ -236,7 +236,7 @@ AIETraceConfigFiletype::getTiles(const std::string& graph_name, // Add to list if verified if (foundGraph && foundKernel) { tile_type tile; - tile.col = mapping.second.get("column"); + tile.col = mapping.second.get("column") + colShift; tile.row = mapping.second.get("row") + rowOffset; tile.active_core = true; tile.active_memory = true; diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp index 5d3ebcfcc55..6fd75505a9f 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp @@ -261,8 +261,6 @@ namespace xdp { auto stats = aieDevice->getRscStat(XAIEDEV_DEFAULT_GROUP_AVAIL); auto configChannel0 = metadata->getConfigChannel0(); auto configChannel1 = metadata->getConfigChannel1(); - uint8_t startColShift = metadata->getPartitionOverlayStartCols().front(); - aie::displayColShiftInfo(startColShift); for (int module = 0; module < metadata->getNumModules(); ++module) { auto configMetrics = metadata->getConfigMetricsVec(module); @@ -276,7 +274,8 @@ namespace xdp { for (auto& tileMetric : configMetrics) { auto& metricSet = tileMetric.second; auto tile = tileMetric.first; - auto col = tile.col + startColShift; + // NOTE: tile.col is now absolute (includes partition shift) + auto col = tile.col; auto row = tile.row; auto subtype = tile.subtype; auto type = aie::getModuleType(row, metadata->getAIETileRowOffset()); @@ -295,15 +294,14 @@ namespace xdp { continue; } - // Get the column relative to partition. - // For loadxclbin flow currently XRT creates partition of whole device from 0th column. - // Hence absolute and relative columns are same. - // TODO: For loadxclbin flow XRT will start creating partition of the specified columns, - // hence we should stop adding partition shift to col for passing to XAIE Apis - auto relCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) - ? col /* startColShift already added */ : tile.col; - auto loc = XAie_TileLoc(relCol, row); - auto& xaieTile = aieDevice->tile(relCol, row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto loc = XAie_TileLoc(xaieCol, row); + auto& xaieTile = aieDevice->tile(xaieCol, row); auto xaieModule = (mod == XAIE_CORE_MOD) ? xaieTile.core() : ((mod == XAIE_MEM_MOD) ? xaieTile.mem() @@ -444,7 +442,7 @@ namespace xdp { startEvent, metricSet, channel); // Store counter info in database std::string counterName = "AIE Counter " + std::to_string(counterId); - (db->getStaticInfo()).addAIECounter(deviceId, counterId, relCol, row, i, + (db->getStaticInfo()).addAIECounter(deviceId, counterId, col, row, i, phyStartEvent, phyEndEvent, resetEvent, payload, metadata->getClockFreqMhz(), metadata->getModuleName(module), counterName, (tile.stream_ids.empty() ? 0 : tile.stream_ids[0])); counterId++; @@ -518,10 +516,7 @@ namespace xdp { continue; std::vector values; - auto writerCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) - ? aie->column - : aie->column + metadata->getPartitionOverlayStartCols().front() /* need to add shift for displaying results*/ ; - values.push_back(writerCol); + values.push_back(aie->column); values.push_back(aie::getRelativeRow(aie->row, metadata->getAIETileRowOffset())); values.push_back(aie->startEvent); values.push_back(aie->endEvent); diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp index a7abb4cedb2..f4cc0eb733c 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp @@ -268,8 +268,6 @@ namespace xdp { auto hwGen = metadata->getHardwareGen(); auto configChannel0 = metadata->getConfigChannel0(); auto configChannel1 = metadata->getConfigChannel1(); - uint8_t startColShift = metadata->getPartitionOverlayStartCols().front(); - aie::displayColShiftInfo(startColShift); for (int module = 0; module < metadata->getNumModules(); ++module) { auto configMetrics = metadata->getConfigMetricsVec(module); @@ -283,7 +281,8 @@ namespace xdp { for (auto& tileMetric : configMetrics) { auto& metricSet = tileMetric.second; auto tile = tileMetric.first; - auto col = tile.col + startColShift; + // NOTE: tile.col is now absolute (includes partition shift) + auto col = tile.col; auto row = tile.row; auto subtype = tile.subtype; auto type = aie::getModuleType(row, metadata->getAIETileRowOffset()); @@ -316,8 +315,14 @@ namespace xdp { continue; } - auto loc = XAie_TileLoc(col, row); - auto& xaieTile = aieDevice->tile(col, row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (tile.col already includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto loc = XAie_TileLoc(xaieCol, row); + auto& xaieTile = aieDevice->tile(xaieCol, row); auto xaieModule = (mod == XAIE_CORE_MOD) ? xaieTile.core() : ((mod == XAIE_MEM_MOD) ? xaieTile.mem() : xaieTile.pl()); diff --git a/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp b/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp index 7b3790c8eea..22cee741b46 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp @@ -127,17 +127,8 @@ namespace xdp { mGraphCoreTilesMap[graph] = metadataReader->getTiles(graph, module_type::core, "all"); } - // NOTE: AIE Status is not released product on client. Whenever client support is needed, - // required dynamic column start shift should come from XRT and not compiler metadata - uint8_t startColShift = metadataReader->getPartitionOverlayStartCols().front(); - aie::displayColShiftInfo(startColShift); - - if (startColShift > 0) { - for(auto& [graph, tileVec] : mGraphCoreTilesMap) { - for(auto& tile : tileVec) - tile.col += startColShift; - } - } + // NOTE: Tiles from metadata are now absolute (include partition shift) + // No additional shift needed // Report tiles (debug only) if (aie::isDebugVerbosity()) { diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_plugin.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_plugin.cpp index 6a03ef11ac2..ac3787db7e4 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_plugin.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_plugin.cpp @@ -192,17 +192,8 @@ void AieTracePluginUnified::updateAIEDevice(void *handle, bool hw_context_flow) if (device != nullptr) { for (auto &gmioEntry : AIEData.metadata->get_trace_gmios()) { auto gmio = gmioEntry.second; - // Get the column shift for partition - // NOTE: If partition is not used, this value is zero. - // This is later required for GMIO trace offload. - uint8_t startColShift = AIEData.metadata->getPartitionOverlayStartCols().front(); - // Get the column relative to partition. - // For loadxclbin flow currently XRT creates partition of whole device from 0th column. - // Hence absolute and relative columns are same. - // TODO: For loadxclbin flow XRT will start creating partition of the specified columns, - // hence we should stop adding partition shift to col for passing to XAIE Apis. - uint8_t relCol = ((db->getStaticInfo()).getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) ? gmio.shimColumn + startColShift : gmio.shimColumn; - (db->getStaticInfo()).addTraceGMIO(deviceID, gmio.id, relCol, gmio.channelNum, + // NOTE: gmio.shimColumn is now absolute (includes partition shift from metadata) + (db->getStaticInfo()).addTraceGMIO(deviceID, gmio.id, gmio.shimColumn, gmio.channelNum, gmio.streamId, gmio.burstLength); } } diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp index e8ca44bfb05..11b5c795c93 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp @@ -279,11 +279,6 @@ namespace xdp { auto configChannel1 = metadata->getConfigChannel1(); int hwGen = metadata->getHardwareGen(); - // Get the column shift for partition - // NOTE: If partition is not used, this value is zero. - uint8_t startColShift = metadata->getPartitionOverlayStartCols().front(); - aie::displayColShiftInfo(startColShift); - // Zero trace event tile counts for (int m = 0; m < static_cast(module_type::num_types); ++m) { for (int n = 0; n <= NUM_TRACE_EVENTS; ++n) @@ -299,25 +294,25 @@ namespace xdp { coreTraceEndEvent = XAIE_EVENT_INSTR_EVENT_1_CORE; // Iterate over all used/specified tiles - // NOTE: rows are stored as absolute as required by resource manager + // NOTE: rows and columns are stored as absolute as required by resource manager for (auto& tileMetric : metadata->getConfigMetrics()) { auto& metricSet = tileMetric.second; auto tile = tileMetric.first; - auto col = tile.col + startColShift; + // NOTE: tile.col is now absolute (includes partition shift) + auto col = tile.col; auto row = tile.row; auto subtype = tile.subtype; auto type = aie::getModuleType(row, metadata->getRowOffset()); auto typeInt = static_cast(type); - // Get the column relative to partition. - // For loadxclbin flow currently XRT creates partition of whole device from 0th column. - // Hence absolute and relative columns are same. - // TODO: For loadxclbin flow XRT will start creating partition of the specified columns, - // hence we should stop adding partition shift to col for passing to XAIE Apis. - auto relCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) - ? col /* startColShift already added */ : tile.col; - auto& xaieTile = aieDevice->tile(relCol, row); - auto loc = XAie_TileLoc(relCol, row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (tile.col already includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto& xaieTile = aieDevice->tile(xaieCol, row); + auto loc = XAie_TileLoc(xaieCol, row); if ((type == module_type::core) && !aie::isDmaSet(metricSet)) { // If we're not looking at DMA events, then don't display the DMA @@ -330,7 +325,6 @@ namespace xdp { std::string tileName = (type == module_type::mem_tile) ? "memory" : ((type == module_type::shim) ? "interface" : "AIE"); - // Add partition shift to the column to display absolute column on the terminal. tileName.append(" tile (" + std::to_string(col) + "," + std::to_string(row) + ")"); if (aie::isInfoVerbosity()) { @@ -361,7 +355,6 @@ namespace xdp { } // AIE config object for this tile - // Add partition shift to the column to report absolute column. auto cfgTile = std::make_unique(col, row, type); cfgTile->type = type; cfgTile->trace_metric_set = metricSet; 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 79cc8ad3785..ed460399f72 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 @@ -269,11 +269,6 @@ namespace xdp { auto configChannel0 = metadata->getConfigChannel0(); auto configChannel1 = metadata->getConfigChannel1(); - // Get the column shift for partition - // NOTE: If partition is not used, this value is zero. - uint8_t startColShift = metadata->getPartitionOverlayStartCols().front(); - aie::displayColShiftInfo(startColShift); - // Zero trace event tile counts for (int m = 0; m < static_cast(module_type::num_types); ++m) { for (int n = 0; n <= NUM_TRACE_EVENTS; ++n) @@ -321,17 +316,25 @@ namespace xdp { coreTraceStartEvent = XAIE_EVENT_INSTR_EVENT_0_CORE; // Iterate over all used/specified tiles - // NOTE: rows are stored as absolute as required by resource manager + // NOTE: rows and columns are stored as absolute as required by resource manager for (auto& tileMetric : metadata->getConfigMetrics()) { auto& metricSet = tileMetric.second; auto tile = tileMetric.first; - auto col = tile.col + startColShift; + // NOTE: tile.col is now absolute (includes partition shift) + auto col = tile.col; auto row = tile.row; auto subtype = tile.subtype; auto type = aie::getModuleType(row, metadata->getRowOffset()); auto typeInt = static_cast(type); - auto& xaieTile = aieDevice->tile(col, row); - auto loc = XAie_TileLoc(col, row); + + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (tile.col already includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto& xaieTile = aieDevice->tile(xaieCol, row); + auto loc = XAie_TileLoc(xaieCol, row); if ((type == module_type::core) && !aie::isDmaSet(metricSet)) { // If we're not looking at DMA events, then don't display the DMA diff --git a/src/runtime_src/xdp/profile/writer/aie_profile/aie_writer.cpp b/src/runtime_src/xdp/profile/writer/aie_profile/aie_writer.cpp index 0f8c0f8b3f7..4c9ebb963b8 100644 --- a/src/runtime_src/xdp/profile/writer/aie_profile/aie_writer.cpp +++ b/src/runtime_src/xdp/profile/writer/aie_profile/aie_writer.cpp @@ -57,8 +57,6 @@ namespace xdp { void AIEProfilingWriter::writeMetricSettings() { - auto metadataReader = (db->getStaticInfo()).getAIEmetadataReader(mDeviceID); - uint8_t col_shift = metadataReader->getPartitionOverlayStartCols().front(); auto validConfig = (db->getStaticInfo()).getProfileConfig(mDeviceID); std::map> filteredConfig; @@ -72,7 +70,8 @@ namespace xdp { const auto& validMetrics = configMetrics[i]; for(auto &elm : validMetrics) { - metrics.push_back(std::to_string(+(elm.first.col+col_shift)) + "," + \ + // NOTE: elm.first.col is now absolute (includes partition shift) + metrics.push_back(std::to_string(+elm.first.col) + "," + \ aie::getRelativeRowStr(elm.first.row, validConfig->tileRowOffset) \ + "," + elm.second); if (i == module_type::shim && elm.second == METRIC_BYTE_COUNT) { From 475385615e491f7b02423263ddf18b15f2b872b1 Mon Sep 17 00:00:00 2001 From: Vinod Pangul <146476973+vipangul@users.noreply.github.com> Date: Fri, 3 Oct 2025 16:33:49 -0600 Subject: [PATCH 2/4] support for metadata parser v3 version Signed-off-by: Vinod Pangul <146476973+vipangul@users.noreply.github.com> --- .../static_info/filetypes/aie_control_config_filetype.cpp | 3 +++ .../static_info/filetypes/aie_trace_config_filetype.cpp | 3 +++ .../static_info/filetypes/aie_trace_config_v3_filetype.cpp | 5 +++-- .../xdp/profile/plugin/aie_status/aie_status_plugin.cpp | 5 +++-- .../xdp/profile/plugin/aie_trace/edge/aie_trace.cpp | 2 +- .../xdp/profile/plugin/aie_trace/ve2/aie_trace.cpp | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) 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 799f40a2c98..fb3823fe0b2 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 @@ -412,9 +412,11 @@ AIEControlConfigFiletype::getMemoryTiles(const std::string& graph_name, std::vector allTiles; std::vector memTiles; + // Always one row of interface tiles uint8_t rowOffset = 1; uint8_t colShift = getPartitionOverlayStartCols().front(); + // Now parse all shared buffers for (auto const &shared_buffer : sharedBufferTree.get()) { auto currGraph = shared_buffer.second.get("graph"); if ((currGraph.find(graph_name) == std::string::npos) @@ -614,6 +616,7 @@ AIEControlConfigFiletype::getTiles(const std::string& graph_name, auto rowOffset = getAIETileRowOffset(); uint8_t colShift = getPartitionOverlayStartCols().front(); + // Traverse all tiles in kernel map for (auto const &mapping : kernelToTileMapping.get()) { auto currGraph = mapping.second.get("graph"); if ((currGraph.find(graph_name) == std::string::npos) diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp index 887ec205e9c..cdcac00ebd3 100755 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_filetype.cpp @@ -123,9 +123,11 @@ AIETraceConfigFiletype::getMemoryTiles(const std::string& graph_name, std::vector allTiles; std::vector memTiles; + // Always one row of interface tiles uint8_t rowOffset = 1; uint8_t colShift = getPartitionOverlayStartCols().front(); + // Parse all shared buffers for (auto const &shared_buffer : sharedBufferTree.get()) { bool foundGraph = (graph_name.compare("all") == 0); bool foundBuffer = (buffer_name.compare("all") == 0); @@ -206,6 +208,7 @@ AIETraceConfigFiletype::getTiles(const std::string& graph_name, auto rowOffset = getAIETileRowOffset(); uint8_t colShift = getPartitionOverlayStartCols().front(); + // Parse all kernel mappings for (auto const &mapping : kernelToTileMapping.get()) { bool foundGraph = isAllGraph; bool foundKernel = isAllKernel; diff --git a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_v3_filetype.cpp b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_v3_filetype.cpp index 82db1d3e746..20fa6da194c 100644 --- a/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_v3_filetype.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/filetypes/aie_trace_config_v3_filetype.cpp @@ -116,6 +116,7 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name, std::map, tile_type> tileMap; // Use map to handle unique tiles by location auto rowOffset = getAIETileRowOffset(); + uint8_t colShift = getPartitionOverlayStartCols().front(); // Parse all kernel mappings for (auto const &mapping : kernelToTileMapping.get()) { @@ -136,7 +137,7 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name, continue; // Get core tile location - auto coreCol = mapping.second.get("column"); + auto coreCol = mapping.second.get("column") + colShift; auto coreRow = static_cast(mapping.second.get("row") + rowOffset); // Create or get existing core tile @@ -154,7 +155,7 @@ AIETraceConfigV3Filetype::getTiles(const std::string& graph_name, auto dmaChannelsTree = mapping.second.get_child_optional("dmaChannels"); if (dmaChannelsTree) { for (auto const &channel : dmaChannelsTree.get()) { - uint8_t dmaCol = xdp::aie::convertStringToUint8(channel.second.get("column")); + uint8_t dmaCol = xdp::aie::convertStringToUint8(channel.second.get("column")) + colShift; uint8_t dmaRow = static_cast(xdp::aie::convertStringToUint8(channel.second.get("row")) + rowOffset); auto dmaKey = std::make_pair(dmaCol, dmaRow); diff --git a/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp b/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp index 22cee741b46..7cedb0d2ef3 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_status/aie_status_plugin.cpp @@ -127,8 +127,9 @@ namespace xdp { mGraphCoreTilesMap[graph] = metadataReader->getTiles(graph, module_type::core, "all"); } - // NOTE: Tiles from metadata are now absolute (include partition shift) - // No additional shift needed + // NOTE: AIE Status is not released product on client. Whenever client support is needed, + // required dynamic column start shift should come from XRT and not compiler metadata + // Tiles from metadata are now absolute (no additional shift needed) // Report tiles (debug only) if (aie::isDebugVerbosity()) { diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp index 11b5c795c93..9be7a199869 100755 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/edge/aie_trace.cpp @@ -294,7 +294,7 @@ namespace xdp { coreTraceEndEvent = XAIE_EVENT_INSTR_EVENT_1_CORE; // Iterate over all used/specified tiles - // NOTE: rows and columns are stored as absolute as required by resource manager + // NOTE: rows are stored as absolute as required by resource manager for (auto& tileMetric : metadata->getConfigMetrics()) { auto& metricSet = tileMetric.second; auto tile = tileMetric.first; 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 ed460399f72..986b3474b71 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 @@ -316,7 +316,7 @@ namespace xdp { coreTraceStartEvent = XAIE_EVENT_INSTR_EVENT_0_CORE; // Iterate over all used/specified tiles - // NOTE: rows and columns are stored as absolute as required by resource manager + // NOTE: rows are stored as absolute as required by resource manager for (auto& tileMetric : metadata->getConfigMetrics()) { auto& metricSet = tileMetric.second; auto tile = tileMetric.first; From ead2e505a3d512c16d768b4fdca28215d6bbd7f2 Mon Sep 17 00:00:00 2001 From: Snigdha Gupta Date: Mon, 6 Oct 2025 17:43:28 -0600 Subject: [PATCH 3/4] Corrected column value being passed to XAIE_TileLoc function call Signed-off-by: Snigdha Gupta --- .../device/aie_trace/aie_trace_offload.cpp | 8 +++++++- .../client/aie_trace_offload_client.cpp | 9 ++++++++- .../aie_trace/ve2/aie_trace_offload_ve2.cpp | 8 +++++++- .../plugin/aie_profile/edge/aie_profile.cpp | 18 ++++++++++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_offload.cpp b/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_offload.cpp index 2ddde0964d2..8b6705a4651 100644 --- a/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_offload.cpp +++ b/src/runtime_src/xdp/profile/device/aie_trace/aie_trace_offload.cpp @@ -189,7 +189,13 @@ bool AIETraceOffload::initReadTrace() VPDatabase* db = VPDatabase::Instance(); TraceGMIO* traceGMIO = (db->getStaticInfo()).getTraceGMIO(deviceId, i); - gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(traceGMIO->shimColumn, 0); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = (db->getStaticInfo()).getAIEmetadataReader(deviceId)->getPartitionOverlayStartCols().front(); + auto col = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? traceGMIO->shimColumn : (traceGMIO->shimColumn - partitionShift); + gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(col, 0); int driverStatus = XAIE_OK; driverStatus = XAie_DmaDescInit(devInst, &(gmioDMAInsts[i].shimDmaInst), gmioDMAInsts[i].gmioTileLoc); diff --git a/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.cpp b/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.cpp index 6fcbaa6f020..8e9444705fa 100644 --- a/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.cpp +++ b/src/runtime_src/xdp/profile/device/aie_trace/client/aie_trace_offload_client.cpp @@ -121,7 +121,14 @@ namespace xdp { // Todo: get this from aie metadata XAie_LocType loc; XAie_DmaDesc DmaDesc; - loc = XAie_TileLoc(traceGMIO->shimColumn, 0); + + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = (db->getStaticInfo()).getAIEmetadataReader(deviceId)->getPartitionOverlayStartCols().front(); + auto col = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? traceGMIO->shimColumn : (traceGMIO->shimColumn - partitionShift); + loc = XAie_TileLoc(col, 0); uint8_t s2mm_ch_id = traceGMIO->channelNumber; uint16_t s2mm_bd_id = 15; /* for now use last bd */ diff --git a/src/runtime_src/xdp/profile/device/aie_trace/ve2/aie_trace_offload_ve2.cpp b/src/runtime_src/xdp/profile/device/aie_trace/ve2/aie_trace_offload_ve2.cpp index 2e7a241ba48..3be014b31bf 100644 --- a/src/runtime_src/xdp/profile/device/aie_trace/ve2/aie_trace_offload_ve2.cpp +++ b/src/runtime_src/xdp/profile/device/aie_trace/ve2/aie_trace_offload_ve2.cpp @@ -120,7 +120,13 @@ bool AIETraceOffload::initReadTrace() VPDatabase* db = VPDatabase::Instance(); TraceGMIO* traceGMIO = (db->getStaticInfo()).getTraceGMIO(deviceId, i); - gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(traceGMIO->shimColumn, 0); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = (db->getStaticInfo()).getAIEmetadataReader(deviceId)->getPartitionOverlayStartCols().front(); + auto col = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? traceGMIO->shimColumn : (traceGMIO->shimColumn - partitionShift); + gmioDMAInsts[i].gmioTileLoc = XAie_TileLoc(col, 0); int driverStatus = XAIE_OK; driverStatus = XAie_DmaDescInit(devInst, &(gmioDMAInsts[i].shimDmaInst), gmioDMAInsts[i].gmioTileLoc); diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp index 6fd75505a9f..7233408d1d8 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp @@ -516,6 +516,7 @@ namespace xdp { continue; std::vector values; + // NOTE: aie->column is now absolute (includes partition shift) values.push_back(aie->column); values.push_back(aie::getRelativeRow(aie->row, metadata->getAIETileRowOffset())); values.push_back(aie->startEvent); @@ -525,8 +526,15 @@ namespace xdp { // Read counter value from device uint32_t counterValue; if (perfCounters.empty()) { + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? aie->column : (aie->column - partitionShift); + XAie_LocType tileLocation = XAie_TileLoc(xaieCol, aie->row); + // Compiler-defined counters - XAie_LocType tileLocation = XAie_TileLoc(aie->column, aie->row); XAie_PerfCounterGet(aieDevInst, tileLocation, XAIE_CORE_MOD, aie->counterNumber, &counterValue); } else { @@ -580,7 +588,13 @@ namespace xdp { auto falModuleType = (moduleType == module_type::core) ? XAIE_CORE_MOD : ((moduleType == module_type::shim) ? XAIE_PL_MOD : XAIE_MEM_MOD); - XAie_LocType tileLocation = XAie_TileLoc(aie->column, aie->row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? aie->column : (aie->column - partitionShift); + XAie_LocType tileLocation = XAie_TileLoc(xaieCol, aie->row); XAie_ReadTimer(aieDevInst, tileLocation, falModuleType, &timerValue); } values.push_back(timerValue); From f1f297a42ad8f19f13dfd792ed899de93846436c Mon Sep 17 00:00:00 2001 From: Snigdha Gupta Date: Mon, 6 Oct 2025 18:53:16 -0600 Subject: [PATCH 4/4] Update col values for aie_profile plugin Signed-off-by: Snigdha Gupta --- .../plugin/aie_profile/client/aie_profile.cpp | 8 ++++- .../plugin/aie_profile/edge/aie_profile.cpp | 16 ++++++++-- .../aie_profile/util/aie_profile_config.cpp | 1 + .../plugin/aie_profile/ve2/aie_profile.cpp | 32 ++++++++++++++++--- 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp index 385c4ee566c..d1c70de1c0e 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp @@ -137,7 +137,13 @@ namespace xdp { continue; } - auto loc = XAie_TileLoc(col, row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto loc = XAie_TileLoc(xaieCol, row); auto startEvents = (type == module_type::core) ? coreStartEvents[metricSet] : ((type == module_type::dma) ? memoryStartEvents[metricSet] : ((type == module_type::shim) ? shimStartEvents[metricSet] diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp index 7233408d1d8..21a3142d754 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp @@ -223,7 +223,13 @@ namespace xdp { { auto col = tile.col; auto row = tile.row; - auto loc = XAie_TileLoc(col, row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto loc = XAie_TileLoc(xaieCol, row); std::string moduleName = (mod == XAIE_CORE_MOD) ? "aie" : ((mod == XAIE_MEM_MOD) ? "aie_memory" : "interface_tile"); @@ -423,7 +429,13 @@ namespace xdp { // Generate user_event_1 for byte count metric set after configuration if ((metricSet == METRIC_BYTE_COUNT) && (i == 1) && !graphItrBroadcastConfigDone) { - XAie_LocType tileloc = XAie_TileLoc(tile.col, tile.row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? tile.col : (tile.col - partitionShift); + XAie_LocType tileloc = XAie_TileLoc(xaieCol, tile.row); //Note: For BYTE_COUNT metric, user_event_1 is used twice as eventA & eventB to // to transition the FSM from Idle->State0->State1. // eventC = Port Running and eventD = stop event (counter event). 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 5a84c83588f..035796c474a 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 @@ -345,6 +345,7 @@ namespace xdp::aie::profile { return std::make_pair(0, XAIE_EVENT_USER_EVENT_0_PL); } + // !!! TODO: do we need to account for partition shift in this file? XAie_LocType destTileLocation = XAie_TileLoc(destTile.col, destTile.row); // Include all tiles between source and destination diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp index f4cc0eb733c..a6e4435afab 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp @@ -229,7 +229,13 @@ namespace xdp { { auto col = tile.col; auto row = tile.row; - auto loc = XAie_TileLoc(col, row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? col : (col - partitionShift); + auto loc = XAie_TileLoc(xaieCol, row); std::string moduleName = (mod == XAIE_CORE_MOD) ? "aie" : ((mod == XAIE_MEM_MOD) ? "aie_memory" : "interface_tile"); @@ -443,7 +449,13 @@ namespace xdp { // Generate user_event_1 for byte count metric set after configuration if ((metricSet == METRIC_BYTE_COUNT) && (i == 1) && !graphItrBroadcastConfigDone) { - XAie_LocType tileloc = XAie_TileLoc(tile.col, tile.row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? tile.col : (tile.col - partitionShift); + XAie_LocType tileloc = XAie_TileLoc(xaieCol, tile.row); //Note: For BYTE_COUNT metric, user_event_1 is used twice as eventA & eventB to // to transition the FSM from Idle->State0->State1. // eventC = Port Running and eventD = stop event (counter event). @@ -547,7 +559,13 @@ namespace xdp { uint32_t counterValue; if (perfCounters.empty()) { // Compiler-defined counters - XAie_LocType tileLocation = XAie_TileLoc(aie->column, aie->row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? tile.col : (tile.col - partitionShift); + XAie_LocType tileLocation = XAie_TileLoc(xaieCol, aie->row); XAie_PerfCounterGet(aieDevInst, tileLocation, XAIE_CORE_MOD, aie->counterNumber, &counterValue); } else { @@ -601,7 +619,13 @@ namespace xdp { auto falModuleType = (moduleType == module_type::core) ? XAIE_CORE_MOD : ((moduleType == module_type::shim) ? XAIE_PL_MOD : XAIE_MEM_MOD); - XAie_LocType tileLocation = XAie_TileLoc(aie->column, aie->row); + // Get the column for XAIE APIs + // For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata) + // For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift + auto partitionShift = metadata->getPartitionOverlayStartCols().front(); + auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE) + ? tile.col : (tile.col - partitionShift); + XAie_LocType tileLocation = XAie_TileLoc(xaieCol, aie->row); XAie_ReadTimer(aieDevInst, tileLocation, falModuleType, &timerValue); } values.push_back(timerValue);