From 34ceebc40b326aae408f8dc523c785db796e0483 Mon Sep 17 00:00:00 2001 From: Vinod Pangul <146476973+vipangul@users.noreply.github.com> Date: Tue, 2 Apr 2024 14:06:07 -0700 Subject: [PATCH] Configure both channel IDs for aie_trace & aie_profile (#8038) --- .../filetypes/aie_control_config_filetype.cpp | 9 ++++- .../aie_profile/aie_profile_metadata.cpp | 37 ++++++++++++------- .../plugin/aie_trace/aie_trace_metadata.cpp | 37 ++++++++++++------- 3 files changed, 55 insertions(+), 28 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 3331a759e9a..940373469ee 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 @@ -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; diff --git a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp index 09d4d560232..38a884fc6a6 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_profile/aie_profile_metadata.cpp @@ -758,6 +758,7 @@ namespace xdp { std::vector> metrics(metricsSettings.size()); // Pass 1 : process only "all" metric setting + // all:[:[:]] 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(":")); @@ -765,16 +766,19 @@ namespace xdp { 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 + // ::[:[:]] for (size_t i = 0; i < metricsSettings.size(); ++i) { if ((metrics[i][0].compare("all") == 0) || (metrics[i].size() < 3)) continue; @@ -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 @@ -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 + // :[:[:]] 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)) @@ -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 @@ -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 diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.cpp b/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.cpp index 12eefc77649..28e741cdc02 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.cpp +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.cpp @@ -772,6 +772,7 @@ namespace xdp { std::vector> metrics(metricsSettings.size()); // Pass 1 : process only "all" metric setting + // all:[:[:]] 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(":")); @@ -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 + // ::[:[:]] for (size_t i = 0; i < metricsSettings.size(); ++i) { if ((processed.find(i) != processed.end()) || (metrics[i].size() < 3)) continue; @@ -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. @@ -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 + // :[:[:]] 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)) @@ -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 @@ -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