From baf88820fb3fc24dda4dc08c91ecbca2c76c7b0f Mon Sep 17 00:00:00 2001 From: Vinod Pangul <146476973+vipangul@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:51:34 -0700 Subject: [PATCH] Fix to handle input_ports_details and output_ports_details Interface tiles metric for PLIO designs (#8064) --- .../profile/database/static_info/aie_util.cpp | 3 ++- src/runtime_src/xdp/profile/device/tracedefs.h | 1 + .../plugin/aie_trace/aie_trace_metadata.cpp | 18 ++++++++++++++++++ .../plugin/aie_trace/aie_trace_metadata.h | 11 ++++++++++- .../plugin/aie_trace/aie_trace_plugin.cpp | 6 ++++++ 5 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp b/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp index 71a77eea0af..d0415a9e6c3 100755 --- a/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp +++ b/src/runtime_src/xdp/profile/database/static_info/aie_util.cpp @@ -383,7 +383,8 @@ namespace xdp::aie { for (auto& info : infoVector) { auto startCol = static_cast(info.start_col); xrt_core::message::send(severity_level::info, "XRT", - "Partition shift of " + std::to_string(startCol) + " was found."); + "Partition shift of " + std::to_string(startCol) + + " was found, number of columns: " + std::to_string(info.num_cols)); startCols.push_back(startCol); } } diff --git a/src/runtime_src/xdp/profile/device/tracedefs.h b/src/runtime_src/xdp/profile/device/tracedefs.h index 19daf3024f1..d78f4e88393 100755 --- a/src/runtime_src/xdp/profile/device/tracedefs.h +++ b/src/runtime_src/xdp/profile/device/tracedefs.h @@ -86,6 +86,7 @@ Please increase trace_buffer_size and trace_buffer_offload_interval together or #define AIE_TRACE_BUF_ALLOC_FAIL "Allocation of buffer for AIE trace failed. AIE trace will not be available." #define AIE_TS2MM_WARN_MSG_BUF_FULL "AIE Trace Buffer is full. Device trace could be incomplete." #define AIE_TS2MM_WARN_MSG_CIRC_BUF_OVERWRITE "Circular buffer overwrite was detected in device trace. AIE trace could be incomplete." +#define AIE_TRACE_TILES_UNAVAILABLE "No valid tiles found for the provided configuration and design. So, AIE event trace will not be available." #define AIE_TRACE_BUF_REUSE_WARN "AIE reuse_buffer may cause overrun. \ Recommended settings: \ 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 28e741cdc02..3e03a8cf497 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 @@ -903,6 +903,7 @@ namespace xdp { // Set default, check validity, and remove "off" tiles bool showWarning = true; + bool showWarningGMIOMetric = true; std::vector offTiles; auto defaultSet = defaultSets[module_type::shim]; auto metricVec = metricSets[module_type::shim]; @@ -917,6 +918,23 @@ namespace xdp { continue; } + // Check for PLIO tiles and it's compatible metric settings + if ((tileMetric.first.subtype == 0) && isGMIOMetric(tileMetric.second)) { + if (showWarningGMIOMetric) { + std::string msg = "Configured interface_tile metric set " + tileMetric.second + + " is only applicable for GMIO type tiles."; + xrt_core::message::send(severity_level::warning, "XRT", msg); + showWarningGMIOMetric = false; + } + + std::stringstream msg; + msg << "Configured interface_tile metric set metric set " << tileMetric.second; + msg << " skipped for tile (" << +tileMetric.first.col << ", " << +tileMetric.first.row << ")."; + xrt_core::message::send(severity_level::warning, "XRT", msg.str()); + offTiles.push_back(tileMetric.first); + continue; + } + // Ensure requested metric set is supported (if not, use default) if (std::find(metricVec.begin(), metricVec.end(), tileMetric.second) == metricVec.end()) { if (showWarning) { diff --git a/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.h b/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.h index ad4f8307ba6..ac11d2a79cc 100644 --- a/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.h +++ b/src/runtime_src/xdp/profile/plugin/aie_trace/aie_trace_metadata.h @@ -108,6 +108,11 @@ class AieTraceMetadata { hwContext = std::move(c); } + bool isGMIOMetric(const std::string& metric) const { + return gmioMetricSets.find(metric) != gmioMetricSets.end(); + } + bool configMetricsEmpty() const { return configMetrics.empty(); } + private: bool useDelay = false; bool useUserControl = false; @@ -157,11 +162,15 @@ class AieTraceMetadata { "input_ports_details", "output_ports_details", "mm2s_ports", "s2mm_ports", "mm2s_ports_stalls", "s2mm_ports_stalls", - "mms2_ports_details", "s2mm_ports_details", + "mm2s_ports_details", "s2mm_ports_details", "input_output_ports", "mm2s_s2mm_ports", "input_output_ports_stalls", "mm2s_s2mm_ports_stalls"} } }; + std::set gmioMetricSets { + "input_ports_details", "output_ports_details", + "mm2s_ports_details", "s2mm_ports_details" }; + void* handle; xrt::hw_context hwContext; }; 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 48eb95e9a77..9fa6c7bd84c 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 @@ -137,6 +137,12 @@ void AieTracePluginUnified::updateAIEDevice(void *handle) { // Metadata depends on static information from the database AIEData.metadata = std::make_shared(deviceID, handle); + if (AIEData.metadata->configMetricsEmpty()) { + AIEData.valid = false; + xrt_core::message::send(severity_level::warning, "XRT", + AIE_TRACE_TILES_UNAVAILABLE); + return; + } #ifdef XDP_CLIENT_BUILD AIEData.metadata->setHwContext(context);