diff --git a/src/runtime_src/core/common/info_platform.cpp b/src/runtime_src/core/common/info_platform.cpp index 0c426249923..76541143405 100644 --- a/src/runtime_src/core/common/info_platform.cpp +++ b/src/runtime_src/core/common/info_platform.cpp @@ -9,6 +9,7 @@ #include "xrt/detail/xclbin.h" #include +#include // Too much typing using ptree_type = boost::property_tree::ptree; @@ -194,6 +195,25 @@ add_host_mem_info(const xrt_core::device* device, ptree_type& pt) pt.add("host_memory_status", get_host_mem_status(device)); } +void +add_aie_load_info(const xrt_core::device* device, ptree_type& pt) +{ + try { + const xq::aie_load::args args{}; // sample_duration_ms = 0 -> driver default + const auto data = xrt_core::device_query(device, args); + + ptree_type pt_aie_load; + if (data.load_percent == std::numeric_limits::max()) + pt_aie_load.put("load_percent", "N/A"); + else + pt_aie_load.put("load_percent", data.load_percent); + pt.put_child("aie_load", pt_aie_load); + } + catch (const xq::exception&) { + // Ignoring if not available: older driver/DLL or unsupported device + } +} + void add_status_info(const xrt_core::device* device, ptree_type& pt) { @@ -431,6 +451,7 @@ add_platform_info(const xrt_core::device* device, ptree_type& pt_platform_array) { add_electrical_info(device, pt_platform); add_thermal_info(device, pt_platform); + add_aie_load_info(device, pt_platform); break; } default: diff --git a/src/runtime_src/core/common/query_requests.h b/src/runtime_src/core/common/query_requests.h index 2f71d6e9e6e..47cb9305f5b 100644 --- a/src/runtime_src/core/common/query_requests.h +++ b/src/runtime_src/core/common/query_requests.h @@ -13,6 +13,7 @@ #include "core/include/ert.h" #include "core/include/xclerr_int.h" +#include #include #include #include @@ -350,7 +351,8 @@ enum class key_type aie_read, aie_write, - aie_coredump + aie_coredump, + aie_load }; struct pcie_vendor : request @@ -4316,6 +4318,32 @@ struct aie_coredump : request std::any get(const device*, const std::any&) const override = 0; }; + +// AIE array hardware utilization, computed from two consecutive firmware +// activity-counter snapshots separated by sample_duration_ms milliseconds. +struct aie_load : request +{ + static constexpr size_t num_activity_counters = 8; + + 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 + std::array activity_counters; // raw counter values from second snapshot + uint64_t operations_per_second; // total counter change across all activity counters per second + }; + + struct args { + uint32_t sample_duration_ms = 0; // 0 = driver default (XRT_AIE_LOAD_SAMPLE_INTERVAL_MS) + }; + + static const key_type key = key_type::aie_load; + + std::any + get(const device*) const override = 0; + + std::any + get(const device*, const std::any&) const override = 0; +}; } // query } // xrt_core diff --git a/src/runtime_src/core/common/smi/smi_ryzen.cpp b/src/runtime_src/core/common/smi/smi_ryzen.cpp index b8b61e1c3e0..1c1cf52e4e8 100644 --- a/src/runtime_src/core/common/smi/smi_ryzen.cpp +++ b/src/runtime_src/core/common/smi/smi_ryzen.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: Apache-2.0 -// Copyright (C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved. +// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. #define XRT_CORE_COMMON_SOURCE @@ -63,7 +63,7 @@ config_gen_ryzen::create_validate_subcommand() validate_suboptions.emplace("device", std::make_shared