From cf6790bfecf124db2c10c79e78701622632cbe70 Mon Sep 17 00:00:00 2001 From: Ryan Chane Date: Tue, 29 Oct 2024 14:35:59 -0700 Subject: [PATCH 1/3] VITIS-13786 Update aie partition report Signed-off-by: Ryan Chane --- src/runtime_src/core/common/query_requests.h | 1 + src/runtime_src/core/tools/common/Table2D.cpp | 2 +- .../common/reports/ReportAiePartitions.cpp | 35 ++----------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/runtime_src/core/common/query_requests.h b/src/runtime_src/core/common/query_requests.h index fdbe1da479a..ca4363a94a3 100644 --- a/src/runtime_src/core/common/query_requests.h +++ b/src/runtime_src/core/common/query_requests.h @@ -1768,6 +1768,7 @@ struct aie_partition_info : request uint64_t start_col; uint64_t num_cols; int pid; + bool is_suspended; uint64_t instruction_mem; uint64_t command_submissions; uint64_t command_completions; diff --git a/src/runtime_src/core/tools/common/Table2D.cpp b/src/runtime_src/core/tools/common/Table2D.cpp index 4dc668be4f7..83a1c3b49f8 100644 --- a/src/runtime_src/core/tools/common/Table2D.cpp +++ b/src/runtime_src/core/tools/common/Table2D.cpp @@ -37,7 +37,7 @@ void Table2D::appendToOutput(std::string& output, const std::string& prefix, const std::string& suffix, const ColumnData& column, const std::string& data) const { // Format for table data - boost::format fmt("%s|%s%s%s%s|"); + boost::format fmt("%s%s%s%s%s"); size_t left_blanks = 0; size_t right_blanks = 0; getBlankSizes(column, data.size(), left_blanks, right_blanks); diff --git a/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp b/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp index 292e0baa77d..4aec4de85a7 100644 --- a/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp +++ b/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp @@ -33,6 +33,7 @@ populate_aie_partition(const xrt_core::device* device) boost::property_tree::ptree pt_entry; pt_entry.put("pid", entry.pid); pt_entry.put("context_id", entry.metadata.id); + pt_entry.put("status", entry.is_suspended ? "IDLE" : "ACTIVE"); pt_entry.put("instr_bo_mem", entry.instruction_mem); pt_entry.put("command_submissions", entry.command_submissions); pt_entry.put("command_completions", entry.command_completions); @@ -62,35 +63,6 @@ populate_aie_partition(const xrt_core::device* device) return pt; } -static std::string -calculate_col_utilization(const xrt_core::device* device, boost::property_tree::ptree &_pt) -{ - auto total_device_cols = xrt_core::device_query_default(device, 0); - if (total_device_cols == 0) - return "N/A"; - - boost::property_tree::ptree empty_ptree; - uint64_t total_active_cols = 0; - const boost::property_tree::ptree pt_partitions = _pt.get_child("partitions", empty_ptree); - for (auto& pt_partition : pt_partitions) { - auto& partition = pt_partition.second; - const auto num_cols = partition.get("num_cols"); - for (const auto& pt_hw_context : partition.get_child("hw_contexts", empty_ptree)) { - const auto& hw_context = pt_hw_context.second; - // We consider a context and its columns active if there are more cmd submissions than completions. - if (hw_context.get("command_submissions") > hw_context.get("command_completions")) { - total_active_cols += num_cols; - break; - } - } - } - // If this check is true, at least two contexts were active on the same column at once. - if (total_active_cols > total_device_cols) - total_active_cols = total_device_cols; - double total_col_occupancy = ((static_cast(total_active_cols) / total_device_cols) * 100); - return boost::str(boost::format("%.0f%%") % total_col_occupancy); -} - void ReportAiePartitions:: getPropertyTreeInternal(const xrt_core::device* _pDevice, @@ -109,7 +81,6 @@ getPropertyTree20202(const xrt_core::device* _pDevice, boost::property_tree::ptree pt; pt.put("description", "AIE Partition Information"); pt.add_child("partitions", populate_aie_partition(_pDevice)); - pt.put("total_col_occupancy", calculate_col_utilization(_pDevice, pt)); _pt.add_child("aie_partitions", pt); } @@ -128,8 +99,6 @@ writeReport(const xrt_core::device* /*_pDevice*/, return; } - _output << boost::str(boost::format("Total Column Occupancy: %s\n") % _pt.get("aie_partitions.total_col_occupancy")); - for (const auto& pt_partition : pt_partitions) { const auto& partition = pt_partition.second; @@ -145,6 +114,7 @@ writeReport(const xrt_core::device* /*_pDevice*/, const std::vector table_headers = { {"PID", Table2D::Justification::left}, {"Ctx ID", Table2D::Justification::left}, + {"Status", Table2D::Justification::left}, {"Instr BO", Table2D::Justification::left}, {"Sub", Table2D::Justification::left}, {"Compl", Table2D::Justification::left}, @@ -165,6 +135,7 @@ writeReport(const xrt_core::device* /*_pDevice*/, const std::vector entry_data = { hw_context.get("pid"), hw_context.get("context_id"), + hw_context.get("status"), xrt_core::utils::unit_convert(hw_context.get("instr_bo_mem")), hw_context.get("command_submissions"), hw_context.get("command_completions"), From db98799aaab4d21e228a329b2fc6a2f71796d938 Mon Sep 17 00:00:00 2001 From: Ryan Chane Date: Tue, 29 Oct 2024 15:04:32 -0700 Subject: [PATCH 2/3] Lowercase status field Signed-off-by: Ryan Chane --- .../core/tools/common/reports/ReportAiePartitions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp b/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp index 4aec4de85a7..e2b187ca031 100644 --- a/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp +++ b/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp @@ -33,7 +33,7 @@ populate_aie_partition(const xrt_core::device* device) boost::property_tree::ptree pt_entry; pt_entry.put("pid", entry.pid); pt_entry.put("context_id", entry.metadata.id); - pt_entry.put("status", entry.is_suspended ? "IDLE" : "ACTIVE"); + pt_entry.put("status", entry.is_suspended ? "Idle" : "Active"); pt_entry.put("instr_bo_mem", entry.instruction_mem); pt_entry.put("command_submissions", entry.command_submissions); pt_entry.put("command_completions", entry.command_completions); From e9a645094e1a92da60effe863a7346c8914c74db Mon Sep 17 00:00:00 2001 From: Ryan Chane Date: Tue, 29 Oct 2024 15:58:33 -0700 Subject: [PATCH 3/3] Fix table2d to have single dividers Signed-off-by: Ryan Chane --- src/runtime_src/core/tools/common/Table2D.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime_src/core/tools/common/Table2D.cpp b/src/runtime_src/core/tools/common/Table2D.cpp index 83a1c3b49f8..d7e63e66e42 100644 --- a/src/runtime_src/core/tools/common/Table2D.cpp +++ b/src/runtime_src/core/tools/common/Table2D.cpp @@ -37,7 +37,7 @@ void Table2D::appendToOutput(std::string& output, const std::string& prefix, const std::string& suffix, const ColumnData& column, const std::string& data) const { // Format for table data - boost::format fmt("%s%s%s%s%s"); + boost::format fmt("%s%s%s%s%s|"); size_t left_blanks = 0; size_t right_blanks = 0; getBlankSizes(column, data.size(), left_blanks, right_blanks); @@ -57,7 +57,9 @@ Table2D::toString(const std::string& prefix) const // The first column must align with the user desires // All other columns should only use the previous lines space suffix - const std::string column_prefix = (col == 0) ? prefix : ""; + std::string column_prefix = ""; + if (col == 0) + column_prefix = prefix + '|'; // For the first row add the headers const auto space_suffix = std::string(m_inter_entry_padding, ' ');