add new function in xrt-smi to query the load on AIE array. - #9983
add new function in xrt-smi to query the load on AIE array.#9983zhangchiming wants to merge 3 commits into
Conversation
Signed-off-by: Chiming <chimingz@amd.com>
|
@zhangchiming is not a repository collaborator. To proceed:
|
| struct result_type { | ||
| uint32_t load_percent; // 0-100, or UINT32_MAX if unavailable | ||
| uint64_t timestamp_ms; // FW uptime when second snapshot was taken | ||
| uint64_t activity_counters[8]; // raw counter values from second snapshot |
There was a problem hiding this comment.
warning: 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
uint64_t activity_counters[8]; // raw counter values from second snapshot
^| struct result_type { | ||
| uint32_t load_percent; // 0-100, or UINT32_MAX if unavailable | ||
| uint64_t timestamp_ms; // FW uptime when second snapshot was taken | ||
| uint64_t activity_counters[8]; // raw counter values from second snapshot |
There was a problem hiding this comment.
warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]
uint64_t activity_counters[8]; // raw counter values from second snapshot
^| static const key_type key = key_type::aie_load; | ||
|
|
||
| virtual std::any | ||
| get(const device*) const override = 0; |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [cppcoreguidelines-explicit-virtual-functions]
src/runtime_src/core/common/query_requests.h:4337:
- virtual std::any
+ std::any| get(const device*) const override = 0; | ||
|
|
||
| virtual std::any | ||
| get(const device*, const std::any&) const override = 0; |
There was a problem hiding this comment.
warning: 'virtual' is redundant since the function is already declared 'override' [cppcoreguidelines-explicit-virtual-functions]
src/runtime_src/core/common/query_requests.h:4340:
- virtual std::any
+ std::any| node.put("operations_per_second", data.operations_per_second); | ||
|
|
||
| boost::property_tree::ptree pt_counters; | ||
| for (size_t i = 0; i < 8; i++) { |
There was a problem hiding this comment.
warning: 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
for (size_t i = 0; i < 8; i++) {
^| void setDuration(uint32_t duration_ms) { m_duration_ms = duration_ms; } | ||
|
|
||
| public: | ||
| virtual void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; |
There was a problem hiding this comment.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]
| virtual void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | |
| void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const override; |
|
|
||
| public: | ||
| virtual void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | ||
| virtual void getPropertyTree20202(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; |
There was a problem hiding this comment.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]
| virtual void getPropertyTree20202(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | |
| void getPropertyTree20202(const xrt_core::device* dev, boost::property_tree::ptree& pt) const override; |
| virtual void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | ||
| virtual void getPropertyTree20202(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | ||
| virtual void writeReport(const xrt_core::device* dev, const boost::property_tree::ptree& pt, | ||
| const std::vector<std::string>& elementsFilter, std::ostream& output) const; |
There was a problem hiding this comment.
warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]
| const std::vector<std::string>& elementsFilter, std::ostream& output) const; | |
| void writeReport(const xrt_core::device* dev, const boost::property_tree::ptree& pt, | |
| const std::vector<std::string>& elementsFilter, std::ostream& output) const override; |
| [&](const xrt_core::device*) { | ||
| std::ostringstream console; | ||
| XBU::produce_reports(device, reportsToProcess, schema_version, schema_label, {}, console, oSchemaOutput); | ||
| XBU::produce_reports(device, reportsToProcess, schemaVersion, {}, console, oSchemaOutput); |
There was a problem hiding this comment.
warning: too few arguments to function call, expected 7, have 6 [clang-diagnostic-error]
XBU::produce_reports(device, reportsToProcess, schemaVersion, {}, console, oSchemaOutput);
^Additional context
src/runtime_src/core/tools/common/XBHelpMenus.h:40: 'produce_reports' declared here
produce_reports( const std::shared_ptr<xrt_core::device>& device,
^| *options.m_watchIntervalSec); | ||
| } else { | ||
| XBU::produce_reports(device, reportsToProcess, schema_version, schema_label, {}, std::cout, oSchemaOutput); | ||
| XBU::produce_reports(device, reportsToProcess, schemaVersion, {}, std::cout, oSchemaOutput); |
There was a problem hiding this comment.
warning: too few arguments to function call, expected 7, have 6 [clang-diagnostic-error]
XBU::produce_reports(device, reportsToProcess, schemaVersion, {}, std::cout, oSchemaOutput);
^Additional context
src/runtime_src/core/tools/common/XBHelpMenus.h:40: 'produce_reports' declared here
produce_reports( const std::shared_ptr<xrt_core::device>& device,
^Signed-off-by: Chiming <chimingz@amd.com>
|
This should be added as part of the platform report and not a standalone report. |
Signed-off-by: Chiming <chimingz@amd.com>
|
clang-tidy review says "All clean, LGTM! 👍" |
Problem solved by the commit
Adds a new aie-load report to xrt-smi so users can query AIE4 array hardware utilization (as a 0-100% load figure, analogous to Windows Task Manager CPU usage) directly from the command line:
xrt-smi examine -r aie-load [--duration ]
The load percentage value is included in the existing xrt-smi examine -r platform report
The AIE load percentage is calculated as hw activities counters delta (between two sampling point) divided by max counters increment possible (determined by number of AIE rows/colums, AIE array clocks and time between two sampling point) .
How problem was solved, alternative solutions (if any) and why they were rejected
Added query::aie_load (with a sample_duration_ms arg) to query_requests.h and a new ReportAieLoad report class that calls device_queryquery::aie_load() directly
What has been tested and how, request additional testing if necessary
Manually verified xrt-smi examine -r aie-load and xrt-smi examine -r aie-load --duration against the modified driver, Manually verified xrt-smi examine -r platform includes the new AIE Load line (text output)
Documentation impact (if any)
xrt-smi examine --help / --list-opcodes-equivalent output now includes aie-load and --duration; user-facing XRT documentation (if any lists examine report names) should be updated to include aie-load.
Documentation impact (if any)
NA