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 180be36e929..00854e42f6e 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 @@ -239,8 +239,8 @@ namespace aie { auto currPort = name.substr(namePos+1); // Make sure this matches what we're looking for - if ((channelId >= 0) && (channelId != streamId)) - continue; + //if ((channelId >= 0) && (channelId != streamId)) + // continue; if ((portName.compare("all") != 0) && (portName.compare(currPort) != 0) && (portName.compare(logicalName) != 0)) @@ -253,13 +253,18 @@ namespace aie { // NOTE: input = slave (data flowing from PLIO) // output = master (data flowing to PLIO) if ((metricStr != "ports") - && ((isMaster && (metricStr.find("input") != std::string::npos)) - || (!isMaster && (metricStr.find("output") != std::string::npos)))) + && ((isMaster && (metricStr.find("input") != std::string::npos) + && (metricStr.find("mm2s") != std::string::npos)) + || (!isMaster && (metricStr.find("output") != std::string::npos) + && (metricStr.find("s2mm") != std::string::npos)))) continue; // Make sure column is within specified range (if specified) if (useColumn && !((minCol <= (uint32_t)shimCol) && ((uint32_t)shimCol <= maxCol))) continue; + if ((channelId >= 0) && (channelId != io.second.channelNum)) + continue; + tile_type tile = {0}; tile.col = shimCol; tile.row = 0; @@ -281,11 +286,11 @@ namespace aie { // Memory Tiles // ************************************************************************** - // Find all memory tiles associated with a graph and kernel - // kernel_name = all : all tiles in graph - // kernel_name = : only tiles used by that specific kernel + // Find all memory tiles associated with a graph and buffer + // buffer_name = all : all tiles in graph + // buffer_name = : only tiles used by that specific buffer std::vector getMemoryTiles(const boost::property_tree::ptree& aie_meta, const std::string& graph_name, - const std::string& kernel_name) + const std::string& buffer_name) { if (getHardwareGeneration(aie_meta) == 1) return {}; @@ -306,13 +311,10 @@ namespace aie { if ((currGraph.find(graph_name) == std::string::npos) && (graph_name.compare("all") != 0)) continue; - if (kernel_name.compare("all") != 0) { - std::vector names; - std::string functionStr = shared_buffer.second.get("function"); - boost::split(names, functionStr, boost::is_any_of(".")); - if (std::find(names.begin(), names.end(), kernel_name) == names.end()) - continue; - } + auto currBuffer = shared_buffer.second.get("bufferName"); + if ((currBuffer.find(buffer_name) == std::string::npos) + && (buffer_name.compare("all") != 0)) + continue; tile_type tile; tile.col = shared_buffer.second.get("column"); @@ -411,7 +413,7 @@ namespace aie { return tiles; } - // Find all AIE or memory tiles associated with a graph and kernel + // Find all AIE or memory tiles associated with a graph and kernel/buffer // kernel_name = all : all tiles in graph // kernel_name = : only tiles used by that specific kernel std::vector getTiles(const boost::property_tree::ptree& aie_meta, const std::string& graph_name, @@ -419,8 +421,6 @@ namespace aie { { if (type == module_type::mem_tile) return getMemoryTiles(aie_meta, graph_name, kernel_name); - if (kernel_name.compare("all") == 0) - return getAIETiles(aie_meta, graph_name); // Now search by graph-kernel pairs auto kernelToTileMapping = aie_meta.get_child_optional("aie_metadata.TileMapping.AIEKernelToTileMapping"); diff --git a/src/runtime_src/xdp/profile/database/static_info/aie_util.h b/src/runtime_src/xdp/profile/database/static_info/aie_util.h index 92171b412f8..56feb5d7cbc 100755 --- a/src/runtime_src/xdp/profile/database/static_info/aie_util.h +++ b/src/runtime_src/xdp/profile/database/static_info/aie_util.h @@ -58,7 +58,7 @@ namespace aie { std::vector getMemoryTiles(const boost::property_tree::ptree& aie_meta, const std::string& graph_name, - const std::string& kernel_name = "all"); + const std::string& buffer_name = "all"); std::vector getAIETiles(const boost::property_tree::ptree& aie_meta, const std::string& graph_name); 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 97e5db30199..99edd13daf6 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 @@ -288,8 +288,6 @@ namespace xdp { { if (type == module_type::mem_tile) return get_mem_tiles(device, graph_name, kernel_name); - if (kernel_name.compare("all") == 0) - return get_aie_tiles(device, graph_name, type); // Now search by graph-kernel pairs auto data = device->get_axlf_section(AIE_METADATA); @@ -359,13 +357,18 @@ namespace xdp { // STEP 1 : Parse per-graph or per-kernel settings - /* AIE_profile_settings config format ; Multiple values can be specified for - * a metric separated with ';' AI Engine Tiles graph_based_aie_metrics = :: - * graph_based_aie_memory_metrics = :: MEM Tiles - * graph_based_memory_tile_metrics = ::[:] + /* AIE_profile_settings config format + * Multiple values can be specified separated with ';' + * + * AI Engine Tiles + * graph_based_aie_metrics = : + * : + * graph_based_aie_memory_metrics = : + * : MEM Tiles + * + * Memory tiles (AIE2 and beyond) + * graph_based_memory_tile_metrics = : + * :[:] */ std::vector> graphMetrics(graphMetricsSettings.size()); @@ -416,16 +419,6 @@ namespace xdp { // Check if already processed or if invalid if (graphMetrics[i][0].compare("all") == 0) continue; - if (std::find(allValidGraphs.begin(), allValidGraphs.end(), graphMetrics[i][0]) == allValidGraphs.end()) { - std::stringstream msg; - msg << "Could not find graph " << graphMetrics[i][0] - << " as specified in graph_based_" << modName << "_metrics setting." - << " The following graphs are valid : " << allValidGraphs[0]; - for (size_t j = 1; j < allValidGraphs.size(); j++) - msg << ", " << allValidGraphs[j]; - xrt_core::message::send(severity_level::warning, "XRT", msg.str()); - continue; - } if ((graphMetrics[i][1].compare("all") != 0) && (std::find(allValidKernels.begin(), allValidKernels.end(), graphMetrics[i][1]) == allValidKernels.end())) { std::stringstream msg; @@ -462,25 +455,28 @@ namespace xdp { // STEP 2 : Parse per-tile settings: all, bounding box, and/or single tiles - /* AIE_profile_settings config format ; Multiple values can be specified for - * a metric separated with ';' AI Engine Tiles Single or all tiles - * tile_based_aie_metrics = - * [[{,}|all>:] - * tile_based_aie_memory_metrics = - * [[<{,}|all>:] + /* AIE_profile_settings config format + * Multiple values can be specified separated with ';' + * + * AI Engine Tiles + * Single or all tiles + * tile_based_aie_metrics = [[{,}|all> + * :] + * tile_based_aie_memory_metrics = [[<{,}|all> + * :] * Range of tiles - * tile_based_aie_metrics = - * [{}:{,}:]] - * tile_based_aie_memory_metrics = - * [{}:{,}:]] + * tile_based_aie_metrics = [{}:{,} + * :]] + * tile_based_aie_memory_metrics = [{}:{,} + * :]] * - * MEM Tiles (AIE2 and beyond) + * Memory Tiles (AIE2 and beyond) * Single or all tiles - * tile_based_memory_tile_metrics = - * [[<{,}|all>:[:]] + * tile_based_memory_tile_metrics = [[<{,}|all> + * :[:]] * Range of tiles - * tile_based_memory_tile_metrics = - * [{}:{,}:[:]]] + * tile_based_memory_tile_metrics = [{}:{,} + * :[:]]] */ std::vector> metrics(metricsSettings.size()); @@ -816,11 +812,12 @@ namespace xdp { if (metrics[i][0].compare("all") != 0) continue; - int16_t channelId = (metrics[i].size() < 3) ? -1 : static_cast(std::stoul(metrics[i][2])); + uint8_t channelId = (metrics[i].size() < 3) ? 0 : static_cast(std::stoul(metrics[i][2])); auto tiles = aie::getInterfaceTiles(aie_meta, "all", "all", metrics[i][1], channelId); - for (auto& e : tiles) { - configMetrics[moduleIdx][e] = metrics[i][1]; + for (auto& t : tiles) { + configMetrics[moduleIdx][t] = metrics[i][1]; + configChannel0[t] = channelId; } } // Pass 1 @@ -850,18 +847,17 @@ namespace xdp { continue; } - int16_t channelId = 0; + uint8_t channelId = 0; if (metrics[i].size() == 4) { try { - channelId = static_cast(std::stoul(metrics[i][3])); + channelId = static_cast(std::stoul(metrics[i][3])); } catch (std::invalid_argument const&) { - // Expected channel Id is not an integer, give warning and ignore channelId + // Expected channel Id is not an integer, give warning and ignore xrt_core::message::send(severity_level::warning, "XRT", "Channel ID specification in " "tile_based_interface_tile_metrics is " "not an integer and hence ignored."); - channelId = -1; } } @@ -870,6 +866,7 @@ namespace xdp { for (auto& t : tiles) { configMetrics[moduleIdx][t] = metrics[i][2]; + configChannel0[t] = channelId; } } // Pass 2 @@ -896,19 +893,17 @@ namespace xdp { continue; } - int16_t channelId = -1; + uint8_t channelId = 0; if (metrics[i].size() == 3) { try { - channelId = static_cast(std::stoul(metrics[i][2])); + channelId = static_cast(std::stoul(metrics[i][2])); } catch (std::invalid_argument const&) { - // Expected channel Id is not an integer, give warning and - // ignore channelId + // Expected channel Id is not an integer, give warning and ignore xrt_core::message::send(severity_level::warning, "XRT", "Channel ID specification in " "tile_based_interface_tile_metrics is not an integer " "and hence ignored."); - channelId = -1; } } @@ -917,6 +912,7 @@ namespace xdp { for (auto& t : tiles) { configMetrics[moduleIdx][t] = metrics[i][1]; + configChannel0[t] = channelId; } } } // 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 0c337249b95..b5f91d85453 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 @@ -293,12 +293,17 @@ namespace xdp { xdp::aie::tileCompare); // STEP 1 : Parse per-graph or per-kernel settings - /* AIE_trace_settings config format ; Multiple values can be specified for a metric separated with ';' + + /* AIE_trace_settings config format + * Multiple values can be specified separated with ';' + * * AI Engine Tiles - * graph_based_aie_tile_metrics = :: + * graph_based_aie_tile_metrics = : + * : + * * Memory Tiles (AIE2 and beyond) - * graph_based_memory_tile_metrics = - * ::[:][:] + * graph_based_memory_tile_metrics = : + * :[:][:] */ std::vector> graphMetrics(graphMetricsSettings.size()); @@ -349,16 +354,6 @@ namespace xdp { // Check if already processed or if invalid if (graphMetrics[i][0].compare("all") == 0) continue; - if (std::find(allValidGraphs.begin(), allValidGraphs.end(), graphMetrics[i][0]) == allValidGraphs.end()) { - std::stringstream msg; - msg << "Could not find graph " << graphMetrics[i][0] - << ", as specified in graph_based_" << tileName << "_tile_metrics setting." - << " The following graphs are valid : " << allValidGraphs[0]; - for (size_t j = 1; j < allValidGraphs.size(); j++) - msg << ", " + allValidGraphs[j]; - xrt_core::message::send(severity_level::warning, "XRT", msg.str()); - continue; - } if ((graphMetrics[i][1].compare("all") != 0) && (std::find(allValidKernels.begin(), allValidKernels.end(), graphMetrics[i][1]) == allValidKernels.end())) { std::stringstream msg; @@ -397,17 +392,19 @@ namespace xdp { /* * AI Engine Tiles * Single or all tiles - * tile_based_aie_tile_metrics = <{,}|all>: + * tile_based_aie_tile_metrics = <{,}|all> + * : * Range of tiles - * tile_based_aie_tile_metrics = {}:{,}: + * tile_based_aie_tile_metrics = {}:{,} + * : * * Memory Tiles (AIE2 and beyond) * Single or all tiles - * tile_based_memory_tile_metrics = - * <{,}|all>:[:][:] + * tile_based_memory_tile_metrics = <{,}|all> + * :[:][:] * Range of tiles - * tile_based_memory_tile_metrics = - * {}:{,}:[:][:] + * tile_based_memory_tile_metrics = {}:{,} + * :[:][:] */ std::vector> metrics(metricsSettings.size()); @@ -681,16 +678,6 @@ namespace xdp { // Check if already processed or if invalid if (graphMetrics[i][0].compare("all") == 0) continue; - if (std::find(allValidGraphs.begin(), allValidGraphs.end(), graphMetrics[i][0]) == allValidGraphs.end()) { - std::stringstream msg; - msg << "Could not find graph " << graphMetrics[i][0] - << ", as specified in graph_based_interface_tile_metrics setting." - << " The following graphs are valid : " << allValidGraphs[0]; - for (size_t j = 1; j < allValidGraphs.size(); j++) - msg << ", " + allValidGraphs[j]; - xrt_core::message::send(severity_level::warning, "XRT", msg.str()); - continue; - } if ((graphMetrics[i][1].compare("all") != 0) && (std::find(allValidPorts.begin(), allValidPorts.end(), graphMetrics[i][1]) == allValidPorts.end())) { std::stringstream msg; @@ -745,11 +732,12 @@ namespace xdp { if (metrics[i][0].compare("all") != 0) continue; - int16_t channelId = (metrics[i].size() < 3) ? -1 : static_cast(std::stoul(metrics[i][2])); + uint8_t channelId = (metrics[i].size() < 3) ? 0 : static_cast(std::stoul(metrics[i][2])); auto tiles = aie::getInterfaceTiles(aieMeta, metrics[i][0], "all", metrics[i][1], channelId); - for (auto& e : tiles) { - configMetrics[e] = metrics[i][1]; + for (auto& t : tiles) { + configMetrics[t] = metrics[i][1]; + configChannel0[t] = channelId; } } // Pass 1 @@ -779,19 +767,17 @@ namespace xdp { continue; } - int16_t channelId = 0; + uint8_t channelId = 0; if (metrics[i].size() == 4) { try { - channelId = static_cast(std::stoul(metrics[i][3])); + channelId = static_cast(std::stoul(metrics[i][3])); } catch (std::invalid_argument const&) { - // Expected channel Id is not an integer, give warning and - // ignore channelId + // Expected channel Id is not an integer, give warning and ignore xrt_core::message::send(severity_level::warning, "XRT", "Channel ID specification in " "tile_based_interface_tile_metrics is " "not an integer and hence ignored."); - channelId = -1; } } @@ -800,6 +786,7 @@ namespace xdp { for (auto& t : tiles) { configMetrics[t] = metrics[i][2]; + configChannel0[t] = channelId; } } // Pass 2 @@ -826,18 +813,17 @@ namespace xdp { continue; } - int16_t channelId = -1; + uint8_t channelId = 0; if (metrics[i].size() == 3) { try { - channelId = static_cast(std::stoul(metrics[i][2])); + channelId = static_cast(std::stoul(metrics[i][2])); } catch (std::invalid_argument const&) { - // Expected channel Id is not an integer, give warning and ignore channelId + // Expected channel Id is not an integer, give warning and ignore xrt_core::message::send(severity_level::warning, "XRT", "Channel ID specification in " "tile_based_interface_tile_metrics is not an integer " "and hence ignored."); - channelId = -1; } } @@ -846,6 +832,7 @@ namespace xdp { for (auto& t : tiles) { configMetrics[t] = metrics[i][1]; + configChannel0[t] = channelId; } } } // Pass 3