Skip to content

Commit f1f297a

Browse files
author
Snigdha Gupta
committed
Update col values for aie_profile plugin
Signed-off-by: Snigdha Gupta <snigupta@xcosnigupta50x.amd.com>
1 parent ead2e50 commit f1f297a

4 files changed

Lines changed: 50 additions & 7 deletions

File tree

src/runtime_src/xdp/profile/plugin/aie_profile/client/aie_profile.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ namespace xdp {
137137
continue;
138138
}
139139

140-
auto loc = XAie_TileLoc(col, row);
140+
// Get the column for XAIE APIs
141+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
142+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
143+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
144+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
145+
? col : (col - partitionShift);
146+
auto loc = XAie_TileLoc(xaieCol, row);
141147
auto startEvents = (type == module_type::core) ? coreStartEvents[metricSet]
142148
: ((type == module_type::dma) ? memoryStartEvents[metricSet]
143149
: ((type == module_type::shim) ? shimStartEvents[metricSet]

src/runtime_src/xdp/profile/plugin/aie_profile/edge/aie_profile.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,13 @@ namespace xdp {
223223
{
224224
auto col = tile.col;
225225
auto row = tile.row;
226-
auto loc = XAie_TileLoc(col, row);
226+
// Get the column for XAIE APIs
227+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
228+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
229+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
230+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
231+
? col : (col - partitionShift);
232+
auto loc = XAie_TileLoc(xaieCol, row);
227233
std::string moduleName = (mod == XAIE_CORE_MOD) ? "aie"
228234
: ((mod == XAIE_MEM_MOD) ? "aie_memory"
229235
: "interface_tile");
@@ -423,7 +429,13 @@ namespace xdp {
423429

424430
// Generate user_event_1 for byte count metric set after configuration
425431
if ((metricSet == METRIC_BYTE_COUNT) && (i == 1) && !graphItrBroadcastConfigDone) {
426-
XAie_LocType tileloc = XAie_TileLoc(tile.col, tile.row);
432+
// Get the column for XAIE APIs
433+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
434+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
435+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
436+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
437+
? tile.col : (tile.col - partitionShift);
438+
XAie_LocType tileloc = XAie_TileLoc(xaieCol, tile.row);
427439
//Note: For BYTE_COUNT metric, user_event_1 is used twice as eventA & eventB to
428440
// to transition the FSM from Idle->State0->State1.
429441
// eventC = Port Running and eventD = stop event (counter event).

src/runtime_src/xdp/profile/plugin/aie_profile/util/aie_profile_config.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ namespace xdp::aie::profile {
345345
return std::make_pair(0, XAIE_EVENT_USER_EVENT_0_PL);
346346
}
347347

348+
// !!! TODO: do we need to account for partition shift in this file?
348349
XAie_LocType destTileLocation = XAie_TileLoc(destTile.col, destTile.row);
349350

350351
// Include all tiles between source and destination

src/runtime_src/xdp/profile/plugin/aie_profile/ve2/aie_profile.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,13 @@ namespace xdp {
229229
{
230230
auto col = tile.col;
231231
auto row = tile.row;
232-
auto loc = XAie_TileLoc(col, row);
232+
// Get the column for XAIE APIs
233+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
234+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
235+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
236+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
237+
? col : (col - partitionShift);
238+
auto loc = XAie_TileLoc(xaieCol, row);
233239
std::string moduleName = (mod == XAIE_CORE_MOD) ? "aie"
234240
: ((mod == XAIE_MEM_MOD) ? "aie_memory"
235241
: "interface_tile");
@@ -443,7 +449,13 @@ namespace xdp {
443449

444450
// Generate user_event_1 for byte count metric set after configuration
445451
if ((metricSet == METRIC_BYTE_COUNT) && (i == 1) && !graphItrBroadcastConfigDone) {
446-
XAie_LocType tileloc = XAie_TileLoc(tile.col, tile.row);
452+
// Get the column for XAIE APIs
453+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
454+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
455+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
456+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
457+
? tile.col : (tile.col - partitionShift);
458+
XAie_LocType tileloc = XAie_TileLoc(xaieCol, tile.row);
447459
//Note: For BYTE_COUNT metric, user_event_1 is used twice as eventA & eventB to
448460
// to transition the FSM from Idle->State0->State1.
449461
// eventC = Port Running and eventD = stop event (counter event).
@@ -547,7 +559,13 @@ namespace xdp {
547559
uint32_t counterValue;
548560
if (perfCounters.empty()) {
549561
// Compiler-defined counters
550-
XAie_LocType tileLocation = XAie_TileLoc(aie->column, aie->row);
562+
// Get the column for XAIE APIs
563+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
564+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
565+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
566+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
567+
? tile.col : (tile.col - partitionShift);
568+
XAie_LocType tileLocation = XAie_TileLoc(xaieCol, aie->row);
551569
XAie_PerfCounterGet(aieDevInst, tileLocation, XAIE_CORE_MOD, aie->counterNumber, &counterValue);
552570
}
553571
else {
@@ -601,7 +619,13 @@ namespace xdp {
601619
auto falModuleType = (moduleType == module_type::core) ? XAIE_CORE_MOD
602620
: ((moduleType == module_type::shim) ? XAIE_PL_MOD
603621
: XAIE_MEM_MOD);
604-
XAie_LocType tileLocation = XAie_TileLoc(aie->column, aie->row);
622+
// Get the column for XAIE APIs
623+
// For LOAD_XCLBIN_STYLE: use absolute column (includes partition shift from metadata)
624+
// For REGISTER_XCLBIN_STYLE (hw_context): XAIE APIs expect relative columns, so subtract partition shift
625+
auto partitionShift = metadata->getPartitionOverlayStartCols().front();
626+
auto xaieCol = (db->getStaticInfo().getAppStyle() == xdp::AppStyle::LOAD_XCLBIN_STYLE)
627+
? tile.col : (tile.col - partitionShift);
628+
XAie_LocType tileLocation = XAie_TileLoc(xaieCol, aie->row);
605629
XAie_ReadTimer(aieDevInst, tileLocation, falModuleType, &timerValue);
606630
}
607631
values.push_back(timerValue);

0 commit comments

Comments
 (0)