diff --git a/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp b/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp index 89cd88cc76..292e0baa77 100644 --- a/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp +++ b/src/runtime_src/core/tools/common/reports/ReportAiePartitions.cpp @@ -87,8 +87,8 @@ calculate_col_utilization(const xrt_core::device* device, boost::property_tree:: // 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_utilization = ((static_cast(total_active_cols) / total_device_cols) * 100); - return boost::str(boost::format("%.0f%%") % total_col_utilization); + double total_col_occupancy = ((static_cast(total_active_cols) / total_device_cols) * 100); + return boost::str(boost::format("%.0f%%") % total_col_occupancy); } void @@ -109,7 +109,7 @@ 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_utilization", calculate_col_utilization(_pDevice, pt)); + pt.put("total_col_occupancy", calculate_col_utilization(_pDevice, pt)); _pt.add_child("aie_partitions", pt); } @@ -128,7 +128,7 @@ writeReport(const xrt_core::device* /*_pDevice*/, return; } - _output << boost::str(boost::format("Total Column Utilization: %s\n") % _pt.get("aie_partitions.total_col_utilization")); + _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; diff --git a/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp b/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp index be49b35f75..9be351cf88 100644 --- a/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp +++ b/src/runtime_src/core/tools/common/tests/TestAIEReconfigOverhead.cpp @@ -38,8 +38,6 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -67,8 +65,6 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBUtilities::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -90,8 +86,6 @@ TestAIEReconfigOverhead::run(std::shared_ptr dev) if (!std::filesystem::exists(dpu_instr)) return ptree; - logger(ptree, "DPU-Sequence", dpu_instr); - size_t instr_size = 0; try { instr_size = XBValidateUtils::get_instr_size(dpu_instr); diff --git a/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp b/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp index dfcb82d61b..6fb098e395 100644 --- a/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp +++ b/src/runtime_src/core/tools/common/tests/TestCmdChainLatency.cpp @@ -36,8 +36,6 @@ TestCmdChainLatency::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -65,8 +63,6 @@ TestCmdChainLatency::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); diff --git a/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp b/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp index 552e48eaee..b32c2e779a 100644 --- a/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp +++ b/src/runtime_src/core/tools/common/tests/TestCmdChainThroughput.cpp @@ -36,8 +36,6 @@ TestCmdChainThroughput::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -65,8 +63,6 @@ TestCmdChainThroughput::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); diff --git a/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp b/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp index cb5eca0d4f..f6f6b345dc 100644 --- a/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp +++ b/src/runtime_src/core/tools/common/tests/TestDF_bandwidth.cpp @@ -42,8 +42,6 @@ TestDF_bandwidth::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -71,8 +69,6 @@ TestDF_bandwidth::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -94,8 +90,6 @@ TestDF_bandwidth::run(std::shared_ptr dev) if (!std::filesystem::exists(dpu_instr)) return ptree; - logger(ptree, "DPU-Sequence", dpu_instr); - size_t instr_size = 0; try { instr_size = XBValidateUtils::get_instr_size(dpu_instr); diff --git a/src/runtime_src/core/tools/common/tests/TestGemm.cpp b/src/runtime_src/core/tools/common/tests/TestGemm.cpp index 3557c044b1..87e4431ed4 100644 --- a/src/runtime_src/core/tools/common/tests/TestGemm.cpp +++ b/src/runtime_src/core/tools/common/tests/TestGemm.cpp @@ -45,8 +45,6 @@ TestGemm::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -74,7 +72,6 @@ TestGemm::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -97,9 +94,6 @@ TestGemm::run(std::shared_ptr dev) if (!std::filesystem::exists(dpu_instr)) return ptree; - if(XBU::getVerbose()) - logger(ptree, "DPU-Sequence", dpu_instr); - size_t instr_size = 0; try { instr_size = XBValidateUtils::get_instr_size(dpu_instr); diff --git a/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp b/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp index 6a215ce100..ada21fa5c2 100644 --- a/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp +++ b/src/runtime_src/core/tools/common/tests/TestNPULatency.cpp @@ -36,8 +36,6 @@ TestNPULatency::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -65,8 +63,6 @@ TestNPULatency::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -80,7 +76,7 @@ TestNPULatency::run(std::shared_ptr dev) catch (const std::exception& ) { logger (ptree, "Error", "Not enough columns available. Please make sure no other workload is running on the device."); - ptree.put("status", test_token_failed);ptree.put("status", test_token_failed); + ptree.put("status", test_token_failed); return ptree; } xrt::xclbin::ip cu; diff --git a/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp b/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp index 48dcd15625..b1da8c6740 100644 --- a/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp +++ b/src/runtime_src/core/tools/common/tests/TestNPUThroughput.cpp @@ -36,8 +36,6 @@ TestNPUThroughput::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -65,8 +63,6 @@ TestNPUThroughput::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); diff --git a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp index 534ab9d728..5351b0c968 100644 --- a/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp +++ b/src/runtime_src/core/tools/common/tests/TestSpatialSharingOvd.cpp @@ -36,9 +36,6 @@ boost::property_tree::ptree TestSpatialSharingOvd::run(std::shared_ptr threads; std::vector testcases; diff --git a/src/runtime_src/core/tools/common/tests/TestTCTAllColumn.cpp b/src/runtime_src/core/tools/common/tests/TestTCTAllColumn.cpp index 23a4b98f79..b98379fc34 100644 --- a/src/runtime_src/core/tools/common/tests/TestTCTAllColumn.cpp +++ b/src/runtime_src/core/tools/common/tests/TestTCTAllColumn.cpp @@ -38,7 +38,6 @@ TestTCTAllColumn::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); xrt::xclbin xclbin; try { @@ -67,8 +66,6 @@ TestTCTAllColumn::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -91,8 +88,6 @@ TestTCTAllColumn::run(std::shared_ptr dev) if (!std::filesystem::exists(dpu_instr)) return ptree; - logger(ptree, "DPU-Sequence", dpu_instr); - size_t instr_size = 0; try { instr_size = XBValidateUtils::get_instr_size(dpu_instr); diff --git a/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp b/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp index a96ee37d00..b7046b5221 100644 --- a/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp +++ b/src/runtime_src/core/tools/common/tests/TestTCTOneColumn.cpp @@ -38,8 +38,6 @@ TestTCTOneColumn::run(std::shared_ptr dev) return ptree; } - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try { xclbin = xrt::xclbin(xclbin_path); @@ -67,8 +65,6 @@ TestTCTOneColumn::run(std::shared_ptr dev) return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -90,8 +86,6 @@ TestTCTOneColumn::run(std::shared_ptr dev) if (!std::filesystem::exists(dpu_instr)) return ptree; - logger(ptree, "DPU-Sequence", dpu_instr); - size_t instr_size = 0; try { instr_size = XBValidateUtils::get_instr_size(dpu_instr); diff --git a/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp index 2baf8741c0..2359856a13 100644 --- a/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp +++ b/src/runtime_src/core/tools/common/tests/TestTemporalSharingOvd.cpp @@ -28,8 +28,6 @@ TestTemporalSharingOvd::run(std::shared_ptr dev) { if (!std::filesystem::exists(xclbin_path)) return ptree; - logger(ptree, "Xclbin", xclbin_path); - xrt::xclbin xclbin; try{ xclbin = xrt::xclbin(xclbin_path); @@ -55,8 +53,6 @@ TestTemporalSharingOvd::run(std::shared_ptr dev) { return ptree; } auto kernelName = xkernel.get_name(); - if(XBU::getVerbose()) - logger(ptree, "Details", boost::str(boost::format("Kernel name is '%s'") % kernelName)); auto working_dev = xrt::device(dev); working_dev.register_xclbin(xclbin); @@ -66,8 +62,6 @@ TestTemporalSharingOvd::run(std::shared_ptr dev) { if (!std::filesystem::exists(dpu_instr)) return ptree; - logger(ptree, "DPU-Sequence", dpu_instr); - // Run 1 std::vector threads; std::vector testcases; diff --git a/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp b/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp index 6e60f5275b..a0b8ee2f3e 100644 --- a/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp +++ b/src/runtime_src/core/tools/xbutil2/OO_Reports.cpp @@ -14,23 +14,59 @@ // 3rd Party Library - Include Files #include #include +#include namespace po = boost::program_options; using bpt = boost::property_tree::ptree; namespace { + static void -print_preemption_telemetry(const xrt_core::device* device) +print_clock_info(const xrt_core::device* device, bool is_json) { - boost::property_tree::ptree empty_ptree; + bpt empty_tree; std::stringstream ss; - boost::property_tree::ptree telemetry_pt = xrt_core::telemetry::preemption_telemetry_info(device).get_child("telemetry", empty_ptree); + auto clocks = xrt_core::platform::get_clock_info(device); + const bpt& pt_clock_array = clocks.get_child("clocks", empty_tree); + ss << "Clocks\n"; + if (pt_clock_array.empty()) { + ss << " No clock information available\n\n"; + std::cout << ss.str(); + return; + } + + // if json format is requested, print it to console and exit + if(is_json) { + boost::property_tree::write_json(std::cout, clocks, true); + return; + } + + for (const auto& kc : pt_clock_array) { + const bpt& pt_clock = kc.second; + ss << boost::format(" %-23s: %3s MHz\n") % pt_clock.get("id") % pt_clock.get("freq_mhz"); + } + std::cout << ss.str(); +} + +static void +print_preemption_telemetry(const xrt_core::device* device, bool is_json) +{ + bpt empty_ptree; + std::stringstream ss; + bpt telemetry_pt = xrt_core::telemetry::preemption_telemetry_info(device); + bpt telemetry_array = telemetry_pt.get_child("telemetry", empty_ptree); ss << "Premption Telemetry Data\n"; - if (telemetry_pt.empty()) { + if (telemetry_array.empty()) { ss << " No hardware contexts running on device\n\n"; std::cout << ss.str(); return; } + // if json format is requested, print it to console and exit + if(is_json) { + boost::property_tree::write_json(std::cout, telemetry_pt, true); + return; + } + std::vector preempt_headers = { {"User Task", Table2D::Justification::left}, {"Ctx ID", Table2D::Justification::left}, @@ -41,7 +77,7 @@ print_preemption_telemetry(const xrt_core::device* device) }; Table2D preemption_table(preempt_headers); - for (const auto& [name, user_task] : telemetry_pt) { + for (const auto& [name, user_task] : telemetry_array) { const std::vector rtos_data = { user_task.get("user_task"), user_task.get("slot_index"), @@ -58,7 +94,7 @@ print_preemption_telemetry(const xrt_core::device* device) std::cout << ss.str(); } -} //end namespace; +} //end namespace // ----- C L A S S M E T H O D S ------------------------------------------- @@ -67,10 +103,12 @@ OO_Reports::OO_Reports( const std::string &_longName, bool _isHidden ) , m_device("") , m_action("") , m_help(false) + , m_json(false) { m_optionsDescription.add_options() ("device,d", boost::program_options::value(&m_device), "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest") ("help", boost::program_options::bool_switch(&m_help), "Help to use this sub-command") + ("json", boost::program_options::bool_switch(&m_json), "Output the report in json format to the console") ; m_optionsHidden.add_options() @@ -122,21 +160,10 @@ OO_Reports::execute(const SubCmdOptions& _options) const try { if (boost::iequals(m_action, "clocks")) { - bpt empty_tree; - auto clocks = xrt_core::platform::get_clock_info(device.get()); - const bpt& pt_clock_array = clocks.get_child("clocks", empty_tree); - if(pt_clock_array.empty()) - return; - - std::cout << std::endl << "Clocks" << std::endl; - for (const auto& kc : pt_clock_array) { - const bpt& pt_clock = kc.second; - std::string clock_name_type = pt_clock.get("id"); - std::cout << boost::format(" %-23s: %3s MHz\n") % clock_name_type % pt_clock.get("freq_mhz"); - } + print_clock_info(device.get(), m_json); } else if (boost::iequals(m_action, "preemption")) { - print_preemption_telemetry(device.get()); + print_preemption_telemetry(device.get(), m_json); } else { throw xrt_core::error(boost::str(boost::format("Invalid report value: '%s'\n") % m_action)); diff --git a/src/runtime_src/core/tools/xbutil2/OO_Reports.h b/src/runtime_src/core/tools/xbutil2/OO_Reports.h index b2a02294a7..f757f9d234 100644 --- a/src/runtime_src/core/tools/xbutil2/OO_Reports.h +++ b/src/runtime_src/core/tools/xbutil2/OO_Reports.h @@ -17,6 +17,7 @@ class OO_Reports : public OptionOptions { std::string m_device; std::string m_action; bool m_help; + bool m_json; }; #endif diff --git a/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp b/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp index afc350ffdc..e35dbf46b9 100644 --- a/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp +++ b/src/runtime_src/core/tools/xbutil2/SubCmdValidate.cpp @@ -315,9 +315,6 @@ run_test_suite_device( const std::shared_ptr& device, int test_idx = 0; - if (testObjectsToRun.size() == 1) - XBU::setVerbose(true);// setting verbose true for single_case. - for (std::shared_ptr testPtr : testObjectsToRun) { auto bdf = xrt_core::device_query(device);