Skip to content

add new function in xrt-smi to query the load on AIE array. - #9983

Open
zhangchiming wants to merge 3 commits into
Xilinx:masterfrom
zhangchiming:aie-load
Open

add new function in xrt-smi to query the load on AIE array.#9983
zhangchiming wants to merge 3 commits into
Xilinx:masterfrom
zhangchiming:aie-load

Conversation

@zhangchiming

@zhangchiming zhangchiming commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

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

Signed-off-by: Chiming <chimingz@amd.com>
@xrt-pr-bot

xrt-pr-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

⚠️ Authorization Failed

@zhangchiming is not a repository collaborator.

To proceed:

  • XRT Admins: Add the build label to authorize this PR build
  • OR Add @zhangchiming as a repository collaborator

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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++) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]

Suggested change
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]

Suggested change
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: prefer using 'override' or (rarely) 'final' instead of 'virtual' [cppcoreguidelines-explicit-virtual-functions]

Suggested change
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@zhangchiming zhangchiming reopened this Aug 18, 2026
@aktondak

Copy link
Copy Markdown
Collaborator

This should be added as part of the platform report and not a standalone report.

Signed-off-by: Chiming <chimingz@amd.com>
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants