Skip to content

Commit

Permalink
Configure both channel IDs for aie_trace & aie_profile (#8038)
Browse files Browse the repository at this point in the history
  • Loading branch information
vipangul authored Apr 2, 2024
1 parent a1a7126 commit 34ceebc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,14 @@ AIEControlConfigFiletype::getInterfaceTiles(const std::string& graphName,
// Make sure column is within specified range (if specified)
if (useColumn && !((minCol <= shimCol) && (shimCol <= maxCol)))
continue;

if ((channelId >= 0) && (channelId != io.second.channelNum))
// Make sure channel number is same as specified (GMIO only)
if ((type == 1) && (channelId >= 0) && (channelId != io.second.channelNum)) {
std::stringstream msg;
msg << "Specified channel ID " << +channelId << "doesn't match for interface column "
<< +shimCol <<" and stream ID " << +streamId;
xrt_core::message::send(severity_level::info, "XRT", msg.str());
continue;
}

tile_type tile = {0};
tile.col = shimCol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,23 +758,27 @@ namespace xdp {
std::vector<std::vector<std::string>> metrics(metricsSettings.size());

// Pass 1 : process only "all" metric setting
// all:<metric>[:<channel0>[:<channel1>]]
for (size_t i = 0; i < metricsSettings.size(); ++i) {
// Split done only in Pass 1
boost::split(metrics[i], metricsSettings[i], boost::is_any_of(":"));

if (metrics[i][0].compare("all") != 0)
continue;

uint8_t channelId = (metrics[i].size() < 3) ? 0 : aie::convertStringToUint8(metrics[i][2]);
auto tiles = metadataReader->getInterfaceTiles("all", "all", metrics[i][1], channelId);
uint8_t channelId0 = (metrics[i].size() < 3) ? 0 : aie::convertStringToUint8(metrics[i][2]);
uint8_t channelId1 = (metrics[i].size() < 4) ? channelId0 : aie::convertStringToUint8(metrics[i][3]);
auto tiles = metadataReader->getInterfaceTiles("all", "all", metrics[i][1], channelId0);

for (auto& t : tiles) {
configMetrics[moduleIdx][t] = metrics[i][1];
configChannel0[t] = channelId;
configChannel0[t] = channelId0;
configChannel1[t] = channelId1;
}
} // Pass 1

// Pass 2 : process only range of tiles metric setting
// <minclumn>:<maxcolumn>:<metric>[:<channel0>[:<channel1>]]
for (size_t i = 0; i < metricsSettings.size(); ++i) {
if ((metrics[i][0].compare("all") == 0) || (metrics[i].size() < 3))
continue;
Expand Down Expand Up @@ -803,11 +807,13 @@ namespace xdp {
continue;
}

uint8_t channelId = 0;
uint8_t channelId0 = 0;
uint8_t channelId1 = 0;

if (metrics[i].size() == 4) {
if (metrics[i].size() >= 4) {
try {
channelId = aie::convertStringToUint8(metrics[i][3]);
channelId0 = aie::convertStringToUint8(metrics[i][3]);
channelId1 = (metrics[i].size() == 4) ? channelId0 : aie::convertStringToUint8(metrics[i][4]);
}
catch (std::invalid_argument const&) {
// Expected channel Id is not an integer, give warning and ignore
Expand All @@ -818,15 +824,17 @@ namespace xdp {
}
}

auto tiles = metadataReader->getInterfaceTiles("all", "all", metrics[i][2], channelId, true, minCol, maxCol);
auto tiles = metadataReader->getInterfaceTiles("all", "all", metrics[i][2], channelId0, true, minCol, maxCol);

for (auto& t : tiles) {
configMetrics[moduleIdx][t] = metrics[i][2];
configChannel0[t] = channelId;
configChannel0[t] = channelId0;
configChannel1[t] = channelId1;
}
} // Pass 2

// Pass 3 : process only single tile metric setting
// <singleColumn>:<metric>[:<channel0>[:<channel1>]]
for (size_t i = 0; i < metricsSettings.size(); ++i) {
// Skip range specification, invalid format, or already processed
if ((metrics[i].size() == 4) || (metrics[i].size() < 2) || (metrics[i][0].compare("all") == 0))
Expand All @@ -850,11 +858,13 @@ namespace xdp {
continue;
}

uint8_t channelId = 0;
uint8_t channelId0 = 0;
uint8_t channelId1 = 0;

if (metrics[i].size() == 3) {
if (metrics[i].size() >= 3) {
try {
channelId = aie::convertStringToUint8(metrics[i][2]);
channelId0 = aie::convertStringToUint8(metrics[i][2]);
channelId1 = (metrics[i].size() == 3) ? channelId0 : aie::convertStringToUint8(metrics[i][3]);
}
catch (std::invalid_argument const&) {
// Expected channel Id is not an integer, give warning and ignore
Expand All @@ -865,11 +875,12 @@ namespace xdp {
}
}

auto tiles = metadataReader->getInterfaceTiles("all", "all", metrics[i][1], channelId, true, col, col);
auto tiles = metadataReader->getInterfaceTiles("all", "all", metrics[i][1], channelId0, true, col, col);

for (auto& t : tiles) {
configMetrics[moduleIdx][t] = metrics[i][1];
configChannel0[t] = channelId;
configChannel0[t] = channelId0;
configChannel1[t] = channelId1;
}
}
} // Pass 3
Expand Down
37 changes: 24 additions & 13 deletions src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ namespace xdp {
std::vector<std::vector<std::string>> metrics(metricsSettings.size());

// Pass 1 : process only "all" metric setting
// all:<metric>[:<channel0>[:<channel1>]]
for (size_t i = 0; i < metricsSettings.size(); ++i) {
// Split done only in Pass 1
boost::split(metrics[i], metricsSettings[i], boost::is_any_of(":"));
Expand All @@ -781,16 +782,19 @@ namespace xdp {
continue;

processed.insert(i);
uint8_t channelId = (metrics[i].size() < 3) ? 0 : aie::convertStringToUint8(metrics[i][2]);
auto tiles = metadataReader->getInterfaceTiles(metrics[i][0], "all", metrics[i][1], channelId);
uint8_t channelId0 = (metrics[i].size() < 3) ? 0 : aie::convertStringToUint8(metrics[i][2]);
uint8_t channelId1 = (metrics[i].size() < 4) ? channelId0 : aie::convertStringToUint8(metrics[i][3]);
auto tiles = metadataReader->getInterfaceTiles(metrics[i][0], "all", metrics[i][1], channelId0);

for (auto& t : tiles) {
configMetrics[t] = metrics[i][1];
configChannel0[t] = channelId;
configChannel0[t] = channelId0;
configChannel1[t] = channelId1;
}
} // Pass 1

// Pass 2 : process only range of tiles metric setting
// <minclumn>:<maxcolumn>:<metric>[:<channel0>[:<channel1>]]
for (size_t i = 0; i < metricsSettings.size(); ++i) {
if ((processed.find(i) != processed.end()) || (metrics[i].size() < 3))
continue;
Expand All @@ -817,10 +821,12 @@ namespace xdp {
continue;
}

uint8_t channelId = 0;
if (metrics[i].size() == 4) {
uint8_t channelId0 = 0;
uint8_t channelId1 = 0;
if (metrics[i].size() >= 4) {
try {
channelId = aie::convertStringToUint8(metrics[i][3]);
channelId0 = aie::convertStringToUint8(metrics[i][3]);
channelId1 = (metrics[i].size() == 4) ? channelId0 : aie::convertStringToUint8(metrics[i][4]);
}
catch (std::invalid_argument const&) {
// Expected channel Id is not an integer. Give warning and ignore.
Expand All @@ -833,15 +839,17 @@ namespace xdp {

processed.insert(i);
auto tiles = metadataReader->getInterfaceTiles(metrics[i][0], "all", metrics[i][2],
channelId, true, minCol, maxCol);
channelId0, true, minCol, maxCol);

for (auto& t : tiles) {
configMetrics[t] = metrics[i][2];
configChannel0[t] = channelId;
configChannel0[t] = channelId0;
configChannel1[t] = channelId1;
}
} // Pass 2

// Pass 3 : process only single tile metric setting
// <singleColumn>:<metric>[:<channel0>[:<channel1>]]
for (size_t i = 0; i < metricsSettings.size(); ++i) {
// Skip if already processed or invalid format
if ((processed.find(i) != processed.end()) || (metrics[i].size() < 2))
Expand All @@ -864,10 +872,12 @@ namespace xdp {
continue;
}

uint8_t channelId = 0;
if (metrics[i].size() == 3) {
uint8_t channelId0 = 0;
uint8_t channelId1 = 0;
if (metrics[i].size() >= 3) {
try {
channelId = aie::convertStringToUint8(metrics[i][2]);
channelId0 = aie::convertStringToUint8(metrics[i][2]);
channelId1 = (metrics[i].size() == 3) ? channelId0 : aie::convertStringToUint8(metrics[i][3]);
}
catch (std::invalid_argument const&) {
// Expected channel Id is not an integer, give warning and ignore
Expand All @@ -879,11 +889,12 @@ namespace xdp {
}

auto tiles = metadataReader->getInterfaceTiles(metrics[i][0], "all", metrics[i][1],
channelId, true, col, col);
channelId0, true, col, col);

for (auto& t : tiles) {
configMetrics[t] = metrics[i][1];
configChannel0[t] = channelId;
configChannel0[t] = channelId0;
configChannel1[t] = channelId1;
}
}
} // Pass 3
Expand Down

0 comments on commit 34ceebc

Please sign in to comment.