Skip to content

Commit 34ceebc

Browse files
authored
Configure both channel IDs for aie_trace & aie_profile (#8038)
1 parent a1a7126 commit 34ceebc

File tree

3 files changed

+55
-28
lines changed

3 files changed

+55
-28
lines changed

src/runtime_src/xdp/profile/database/static_info/filetypes/aie_control_config_filetype.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,14 @@ AIEControlConfigFiletype::getInterfaceTiles(const std::string& graphName,
251251
// Make sure column is within specified range (if specified)
252252
if (useColumn && !((minCol <= shimCol) && (shimCol <= maxCol)))
253253
continue;
254-
255-
if ((channelId >= 0) && (channelId != io.second.channelNum))
254+
// Make sure channel number is same as specified (GMIO only)
255+
if ((type == 1) && (channelId >= 0) && (channelId != io.second.channelNum)) {
256+
std::stringstream msg;
257+
msg << "Specified channel ID " << +channelId << "doesn't match for interface column "
258+
<< +shimCol <<" and stream ID " << +streamId;
259+
xrt_core::message::send(severity_level::info, "XRT", msg.str());
256260
continue;
261+
}
257262

258263
tile_type tile = {0};
259264
tile.col = shimCol;

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

+24-13
Original file line numberDiff line numberDiff line change
@@ -758,23 +758,27 @@ namespace xdp {
758758
std::vector<std::vector<std::string>> metrics(metricsSettings.size());
759759

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

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

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

771773
for (auto& t : tiles) {
772774
configMetrics[moduleIdx][t] = metrics[i][1];
773-
configChannel0[t] = channelId;
775+
configChannel0[t] = channelId0;
776+
configChannel1[t] = channelId1;
774777
}
775778
} // Pass 1
776779

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

806-
uint8_t channelId = 0;
810+
uint8_t channelId0 = 0;
811+
uint8_t channelId1 = 0;
807812

808-
if (metrics[i].size() == 4) {
813+
if (metrics[i].size() >= 4) {
809814
try {
810-
channelId = aie::convertStringToUint8(metrics[i][3]);
815+
channelId0 = aie::convertStringToUint8(metrics[i][3]);
816+
channelId1 = (metrics[i].size() == 4) ? channelId0 : aie::convertStringToUint8(metrics[i][4]);
811817
}
812818
catch (std::invalid_argument const&) {
813819
// Expected channel Id is not an integer, give warning and ignore
@@ -818,15 +824,17 @@ namespace xdp {
818824
}
819825
}
820826

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

823829
for (auto& t : tiles) {
824830
configMetrics[moduleIdx][t] = metrics[i][2];
825-
configChannel0[t] = channelId;
831+
configChannel0[t] = channelId0;
832+
configChannel1[t] = channelId1;
826833
}
827834
} // Pass 2
828835

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

853-
uint8_t channelId = 0;
861+
uint8_t channelId0 = 0;
862+
uint8_t channelId1 = 0;
854863

855-
if (metrics[i].size() == 3) {
864+
if (metrics[i].size() >= 3) {
856865
try {
857-
channelId = aie::convertStringToUint8(metrics[i][2]);
866+
channelId0 = aie::convertStringToUint8(metrics[i][2]);
867+
channelId1 = (metrics[i].size() == 3) ? channelId0 : aie::convertStringToUint8(metrics[i][3]);
858868
}
859869
catch (std::invalid_argument const&) {
860870
// Expected channel Id is not an integer, give warning and ignore
@@ -865,11 +875,12 @@ namespace xdp {
865875
}
866876
}
867877

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

870880
for (auto& t : tiles) {
871881
configMetrics[moduleIdx][t] = metrics[i][1];
872-
configChannel0[t] = channelId;
882+
configChannel0[t] = channelId0;
883+
configChannel1[t] = channelId1;
873884
}
874885
}
875886
} // Pass 3

src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.cpp

+24-13
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ namespace xdp {
772772
std::vector<std::vector<std::string>> metrics(metricsSettings.size());
773773

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

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

787789
for (auto& t : tiles) {
788790
configMetrics[t] = metrics[i][1];
789-
configChannel0[t] = channelId;
791+
configChannel0[t] = channelId0;
792+
configChannel1[t] = channelId1;
790793
}
791794
} // Pass 1
792795

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

820-
uint8_t channelId = 0;
821-
if (metrics[i].size() == 4) {
824+
uint8_t channelId0 = 0;
825+
uint8_t channelId1 = 0;
826+
if (metrics[i].size() >= 4) {
822827
try {
823-
channelId = aie::convertStringToUint8(metrics[i][3]);
828+
channelId0 = aie::convertStringToUint8(metrics[i][3]);
829+
channelId1 = (metrics[i].size() == 4) ? channelId0 : aie::convertStringToUint8(metrics[i][4]);
824830
}
825831
catch (std::invalid_argument const&) {
826832
// Expected channel Id is not an integer. Give warning and ignore.
@@ -833,15 +839,17 @@ namespace xdp {
833839

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

838844
for (auto& t : tiles) {
839845
configMetrics[t] = metrics[i][2];
840-
configChannel0[t] = channelId;
846+
configChannel0[t] = channelId0;
847+
configChannel1[t] = channelId1;
841848
}
842849
} // Pass 2
843850

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

867-
uint8_t channelId = 0;
868-
if (metrics[i].size() == 3) {
875+
uint8_t channelId0 = 0;
876+
uint8_t channelId1 = 0;
877+
if (metrics[i].size() >= 3) {
869878
try {
870-
channelId = aie::convertStringToUint8(metrics[i][2]);
879+
channelId0 = aie::convertStringToUint8(metrics[i][2]);
880+
channelId1 = (metrics[i].size() == 3) ? channelId0 : aie::convertStringToUint8(metrics[i][3]);
871881
}
872882
catch (std::invalid_argument const&) {
873883
// Expected channel Id is not an integer, give warning and ignore
@@ -879,11 +889,12 @@ namespace xdp {
879889
}
880890

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

884894
for (auto& t : tiles) {
885895
configMetrics[t] = metrics[i][1];
886-
configChannel0[t] = channelId;
896+
configChannel0[t] = channelId0;
897+
configChannel1[t] = channelId1;
887898
}
888899
}
889900
} // Pass 3

0 commit comments

Comments
 (0)