Merge amd-dev into amd-master 20240215
Signed-off-by: Maisam Arif <maisarif@amd.com>
Change-Id: I089fcea8184d323f5e65311bb63c231cb94890e3
[ROCm/amdsmi commit: fad7339c39]
This commit is contained in:
@@ -28,7 +28,7 @@ find_program(GIT NAMES git)
|
||||
|
||||
## Setup the package version based on git tags.
|
||||
set(PKG_VERSION_GIT_TAG_PREFIX "amdsmi_pkg_ver")
|
||||
get_package_version_number("24.2.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
|
||||
get_package_version_number("24.3.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
|
||||
message("Package version: ${PKG_VERSION_STR}")
|
||||
set(${AMD_SMI_LIBS_TARGET}_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
|
||||
set(${AMD_SMI_LIBS_TARGET}_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")
|
||||
|
||||
@@ -78,7 +78,7 @@ amd-smi will report the version and current platform detected when running the c
|
||||
~$ amd-smi
|
||||
usage: amd-smi [-h] ...
|
||||
|
||||
AMD System Management Interface | Version: 24.2.0.0 | ROCm version: 6.1.0 | Platform: Linux
|
||||
AMD System Management Interface | Version: 24.3.0.0 | ROCm version: 6.1.0 | Platform: Linux
|
||||
Baremetal
|
||||
|
||||
options:
|
||||
|
||||
@@ -152,10 +152,10 @@ class AMDSMICommands():
|
||||
|
||||
# Store values based on format
|
||||
if self.logger.is_human_readable_format():
|
||||
self.logger.store_output(args.gpu, 'AMDSMI_SPACING_REMOVAL', {'bdf':bdf, 'uuid':uuid})
|
||||
self.logger.store_output(args.gpu, 'AMDSMI_SPACING_REMOVAL', {'gpu_bdf':bdf, 'gpu_uuid':uuid})
|
||||
else:
|
||||
self.logger.store_output(args.gpu, 'bdf', bdf)
|
||||
self.logger.store_output(args.gpu, 'uuid', uuid)
|
||||
self.logger.store_output(args.gpu, 'gpu_bdf', bdf)
|
||||
self.logger.store_output(args.gpu, 'gpu_uuid', uuid)
|
||||
|
||||
if multiple_devices:
|
||||
self.logger.store_multiple_device_output()
|
||||
@@ -323,16 +323,6 @@ class AMDSMICommands():
|
||||
if args.asic:
|
||||
try:
|
||||
asic_info = amdsmi_interface.amdsmi_get_gpu_asic_info(args.gpu)
|
||||
asic_info['vendor_id'] = hex(asic_info['vendor_id'])
|
||||
asic_info['vendor_name'] = asic_info['vendor_name'].replace(',', '')
|
||||
asic_info['device_id'] = hex(asic_info['device_id'])
|
||||
asic_info['rev_id'] = hex(asic_info['rev_id'])
|
||||
if asic_info['asic_serial'] != '':
|
||||
asic_info['asic_serial'] = hex(int(asic_info['asic_serial'], base=16))
|
||||
else:
|
||||
asic_info['asic_serial'] = "N/A"
|
||||
if asic_info['oam_id'] == 0xFFFF: # uint 16 max
|
||||
asic_info['oam_id'] = "N/A"
|
||||
static_dict['asic'] = asic_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['asic'] = "N/A"
|
||||
@@ -560,21 +550,32 @@ class AMDSMICommands():
|
||||
static_dict['vram'] = vram_info
|
||||
if args.cache:
|
||||
try:
|
||||
cache_info = amdsmi_interface.amdsmi_get_gpu_cache_info(args.gpu)
|
||||
logging.debug(f"cache_info dictionary = {cache_info}")
|
||||
|
||||
cach_info_list = amdsmi_interface.amdsmi_get_gpu_cache_info(args.gpu)
|
||||
logging.debug(f"cache_info dictionary = {cach_info_list}")
|
||||
if self.logger.is_human_readable_format():
|
||||
for key, cache_values in cache_info.items():
|
||||
cache_values['cache_size'] = f"{cache_values['cache_size']} KB"
|
||||
cache_info_dict_format = {}
|
||||
for cache_dict in cach_info_list:
|
||||
cache_index = "cache_" + str(cache_dict["cache"])
|
||||
cache_info_dict_format[cache_index] = cache_dict
|
||||
|
||||
# Remove cache index from new dictionary
|
||||
cache_info_dict_format[cache_index].pop("cache")
|
||||
|
||||
# Add cache_size unit
|
||||
cache_info_dict_format[cache_index]["cache_size"] = f"{cache_info_dict_format[cache_index]['cache_size']} KB"
|
||||
|
||||
# take cache_properties out of list -> display as string, removing brackets
|
||||
cache_values['cache_properties'] = ", ".join(cache_values['cache_properties'])
|
||||
logging.debug(f"After human_readable | cache_info = {cache_info}")
|
||||
cache_info_dict_format[cache_index]["cache_properties"] = ", ".join(cache_info_dict_format[cache_index]["cache_properties"])
|
||||
|
||||
cach_info_list = cache_info_dict_format
|
||||
|
||||
logging.debug(f"After human_readable | cache_info = {cach_info_list}")
|
||||
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
cache_info = "N/A"
|
||||
cach_info_list = "N/A"
|
||||
logging.debug("Failed to get cache info for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
|
||||
static_dict['cache'] = cache_info
|
||||
static_dict['cache_info'] = cach_info_list
|
||||
if 'ras' in current_platform_args:
|
||||
if args.ras:
|
||||
ras_dict = {"eeprom_version": "N/A",
|
||||
@@ -1961,7 +1962,7 @@ class AMDSMICommands():
|
||||
if (args.cpu_metrics_ver):
|
||||
static_dict["metric_version"] = {}
|
||||
try:
|
||||
version = amdsmi_interface.amdsmi_get_metrics_table_version(args.cpu)
|
||||
version = amdsmi_interface.amdsmi_get_hsmp_metrics_table_version(args.cpu)
|
||||
static_dict["metric_version"]["version"] = version
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["metric_version"]["version"] = "N/A"
|
||||
@@ -1982,7 +1983,7 @@ class AMDSMICommands():
|
||||
static_dict["metrics_table"]["cpu_model"] = "N/A"
|
||||
logging.debug("Failed to get cpu model | %s", e.get_error_info())
|
||||
try:
|
||||
metrics_table = amdsmi_interface.amdsmi_get_metrics_table(args.cpu)
|
||||
metrics_table = amdsmi_interface.amdsmi_get_hsmp_metrics_table(args.cpu)
|
||||
static_dict["metrics_table"]["response"] = metrics_table
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict["metrics_table"]["response"] = "N/A"
|
||||
|
||||
@@ -994,8 +994,8 @@ core limit value"
|
||||
|
||||
|
||||
def _add_monitor_parser(self, subparsers, func):
|
||||
if not(self.helpers.is_baremetal() and self.helpers.is_linux()):
|
||||
# This subparser is only applicable to Baremetal Linux
|
||||
if not(self.helpers.is_linux()):
|
||||
# This subparser is only applicable to Linux
|
||||
return
|
||||
|
||||
# Subparser help text
|
||||
|
||||
@@ -48,7 +48,7 @@ PROJECT_NAME = AMD SMI
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = "24.2.0.0"
|
||||
PROJECT_NUMBER = "24.3.0.0"
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
@@ -2276,7 +2276,7 @@ INCLUDE_FILE_PATTERNS =
|
||||
# recursively expanded use the := operator instead of the = operator.
|
||||
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
|
||||
|
||||
PREDEFINED =
|
||||
PREDEFINED = ENABLE_ESMI_LIB
|
||||
|
||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
|
||||
# tag can be used to specify a list of macro names that should be expanded. The
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
@@ -212,6 +213,13 @@ void getFWNameFromId(int id, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string print_unsigned_int(T value) {
|
||||
std::stringstream ss;
|
||||
ss << static_cast<uint64_t>(value | 0);
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
int main() {
|
||||
amdsmi_status_t ret;
|
||||
@@ -315,7 +323,7 @@ int main() {
|
||||
printf("\tCache Level: %d, Cache Size: %d KB, Cache type: 0x%x\n",
|
||||
cache_info.cache[i].cache_level,
|
||||
cache_info.cache[i].cache_size,
|
||||
cache_info.cache[i].properties);
|
||||
cache_info.cache[i].cache_properties);
|
||||
printf("\tMax number CU shared: %d, Number of instances: %d\n",
|
||||
cache_info.cache[i].max_num_cu_shared,
|
||||
cache_info.cache[i].num_cache_instance);
|
||||
@@ -655,6 +663,177 @@ int main() {
|
||||
<< "\n\n";
|
||||
std::cout << "\t\t Max Power Cap: " << cap_info.max_power_cap
|
||||
<< "\n\n";
|
||||
|
||||
/// Get GPU Metrics info
|
||||
std::cout << "\n\n";
|
||||
amdsmi_gpu_metrics_t gpu_metrics;
|
||||
ret = amdsmi_get_gpu_metrics_info(processor_handles[j], &gpu_metrics);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_metrics_info:\n");
|
||||
printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i,
|
||||
bdf.fields.domain_number,
|
||||
bdf.fields.bus_number,
|
||||
bdf.fields.device_number,
|
||||
bdf.fields.function_number);
|
||||
|
||||
std::cout << "\t**.common_header.format_revision : "
|
||||
<< print_unsigned_int(gpu_metrics.common_header.format_revision) << "\n";
|
||||
std::cout << "\t**.common_header.content_revision : "
|
||||
<< print_unsigned_int(gpu_metrics.common_header.content_revision) << "\n";
|
||||
std::cout << "\t**.temperature_edge : " << std::dec
|
||||
<< gpu_metrics.temperature_edge << "\n";
|
||||
std::cout << "\t**.temperature_hotspot : " << std::dec
|
||||
<< gpu_metrics.temperature_hotspot << "\n";
|
||||
std::cout << "\t**.temperature_mem : " << std::dec
|
||||
<< gpu_metrics.temperature_mem << "\n";
|
||||
std::cout << "\t**.temperature_vrgfx : " << std::dec
|
||||
<< gpu_metrics.temperature_vrgfx << "\n";
|
||||
std::cout << "\t**.temperature_vrsoc : " << std::dec
|
||||
<< gpu_metrics.temperature_vrsoc << "\n";
|
||||
std::cout << "\t**.temperature_vrmem : " << std::dec
|
||||
<< gpu_metrics.temperature_vrmem << "\n";
|
||||
std::cout << "\t**.average_gfx_activity : " << std::dec
|
||||
<< gpu_metrics.average_gfx_activity << "\n";
|
||||
std::cout << "\t**.average_umc_activity : " << std::dec
|
||||
<< gpu_metrics.average_umc_activity << "\n";
|
||||
std::cout << "\t**.average_mm_activity : " << std::dec
|
||||
<< gpu_metrics.average_mm_activity << "\n";
|
||||
std::cout << "\t**.average_socket_power : " << std::dec
|
||||
<< gpu_metrics.average_socket_power << "\n";
|
||||
std::cout << "\t**.energy_accumulator : " << std::dec
|
||||
<< gpu_metrics.energy_accumulator << "\n";
|
||||
std::cout << "\t**.system_clock_counter : " << std::dec
|
||||
<< gpu_metrics.system_clock_counter << "\n";
|
||||
std::cout << "\t**.average_gfxclk_frequency : " << std::dec
|
||||
<< gpu_metrics.average_gfxclk_frequency << "\n";
|
||||
std::cout << "\t**.average_socclk_frequency : " << std::dec
|
||||
<< gpu_metrics.average_socclk_frequency << "\n";
|
||||
std::cout << "\t**.average_uclk_frequency : " << std::dec
|
||||
<< gpu_metrics.average_uclk_frequency << "\n";
|
||||
std::cout << "\t**.average_vclk0_frequency : " << std::dec
|
||||
<< gpu_metrics.average_vclk0_frequency<< "\n";
|
||||
std::cout << "\t**.average_dclk0_frequency : " << std::dec
|
||||
<< gpu_metrics.average_dclk0_frequency << "\n";
|
||||
std::cout << "\t**.average_vclk1_frequency : " << std::dec
|
||||
<< gpu_metrics.average_vclk1_frequency << "\n";
|
||||
std::cout << "\t**.average_dclk1_frequency : " << std::dec
|
||||
<< gpu_metrics.average_dclk1_frequency << "\n";
|
||||
std::cout << "\t**.current_gfxclk : " << std::dec
|
||||
<< gpu_metrics.current_gfxclk << "\n";
|
||||
std::cout << "\t**.current_socclk : " << std::dec
|
||||
<< gpu_metrics.current_socclk << "\n";
|
||||
std::cout << "\t**.current_uclk : " << std::dec
|
||||
<< gpu_metrics.current_uclk << "\n";
|
||||
std::cout << "\t**.current_vclk0 : " << std::dec
|
||||
<< gpu_metrics.current_vclk0 << "\n";
|
||||
std::cout << "\t**.current_dclk0 : " << std::dec
|
||||
<< gpu_metrics.current_dclk0 << "\n";
|
||||
std::cout << "\t**.current_vclk1 : " << std::dec
|
||||
<< gpu_metrics.current_vclk1 << "\n";
|
||||
std::cout << "\t**.current_dclk1 : " << std::dec
|
||||
<< gpu_metrics.current_dclk1 << "\n";
|
||||
std::cout << "\t**.throttle_status : " << std::dec
|
||||
<< gpu_metrics.throttle_status << "\n";
|
||||
std::cout << "\t**.current_fan_speed : " << std::dec
|
||||
<< gpu_metrics.current_fan_speed << "\n";
|
||||
std::cout << "\t**.pcie_link_width : " << std::dec
|
||||
<< gpu_metrics.pcie_link_width << "\n";
|
||||
std::cout << "\t**.pcie_link_speed : " << std::dec
|
||||
<< gpu_metrics.pcie_link_speed << "\n";
|
||||
std::cout << "\t**.gfx_activity_acc : " << std::dec
|
||||
<< gpu_metrics.gfx_activity_acc << "\n";
|
||||
std::cout << "\t**.mem_activity_acc : " << std::dec
|
||||
<< gpu_metrics.mem_activity_acc << "\n";
|
||||
std::cout << "\t**.firmware_timestamp : " << std::dec
|
||||
<< gpu_metrics.firmware_timestamp << "\n";
|
||||
std::cout << "\t**.voltage_soc : " << std::dec
|
||||
<< gpu_metrics.voltage_soc << "\n";
|
||||
std::cout << "\t**.voltage_gfx : " << std::dec
|
||||
<< gpu_metrics.voltage_gfx << "\n";
|
||||
std::cout << "\t**.voltage_mem : " << std::dec
|
||||
<< gpu_metrics.voltage_mem << "\n";
|
||||
std::cout << "\t**.indep_throttle_status : " << std::dec
|
||||
<< gpu_metrics.indep_throttle_status << "\n";
|
||||
std::cout << "\t**.current_socket_power : " << std::dec
|
||||
<< gpu_metrics.current_socket_power << "\n";
|
||||
std::cout << "\t**.gfxclk_lock_status : " << std::dec
|
||||
<< gpu_metrics.gfxclk_lock_status << "\n";
|
||||
std::cout << "\t**.xgmi_link_width : " << std::dec
|
||||
<< gpu_metrics.xgmi_link_width << "\n";
|
||||
std::cout << "\t**.xgmi_link_speed : " << std::dec
|
||||
<< gpu_metrics.xgmi_link_speed << "\n";
|
||||
std::cout << "\t**.pcie_bandwidth_acc : " << std::dec
|
||||
<< gpu_metrics.pcie_bandwidth_acc << "\n";
|
||||
std::cout << "\t**.pcie_bandwidth_inst : " << std::dec
|
||||
<< gpu_metrics.pcie_bandwidth_inst << "\n";
|
||||
std::cout << "\t**.pcie_l0_to_recov_count_acc : " << std::dec
|
||||
<< gpu_metrics.pcie_l0_to_recov_count_acc << "\n";
|
||||
std::cout << "\t**.pcie_replay_count_acc : " << std::dec
|
||||
<< gpu_metrics.pcie_replay_count_acc << "\n";
|
||||
std::cout << "\t**.pcie_replay_rover_count_acc : " << std::dec
|
||||
<< gpu_metrics.pcie_replay_rover_count_acc << "\n";
|
||||
|
||||
std::cout << "\t**.temperature_hbm[] : " << std::dec << "\n";
|
||||
for (const auto& temp : gpu_metrics.temperature_hbm) {
|
||||
std::cout << "\t -> " << std::dec << temp << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.vcn_activity[] : " << std::dec << "\n";
|
||||
for (const auto& vcn : gpu_metrics.vcn_activity) {
|
||||
std::cout << "\t -> " << std::dec << vcn << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.xgmi_read_data_acc[] : " << std::dec << "\n";
|
||||
for (const auto& read_data : gpu_metrics.xgmi_read_data_acc) {
|
||||
std::cout << "\t -> " << std::dec << read_data << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.xgmi_write_data_acc[] : " << std::dec << "\n";
|
||||
for (const auto& write_data : gpu_metrics.xgmi_write_data_acc) {
|
||||
std::cout << "\t -> " << std::dec << write_data << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.current_gfxclks[] : " << std::dec << "\n";
|
||||
for (const auto& gfxclk : gpu_metrics.current_gfxclks) {
|
||||
std::cout << "\t -> " << std::dec << gfxclk << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.current_socclks[] : " << std::dec << "\n";
|
||||
for (const auto& socclk : gpu_metrics.current_socclks) {
|
||||
std::cout << "\t -> " << std::dec << socclk << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.current_vclk0s[] : " << std::dec << "\n";
|
||||
for (const auto& vclk : gpu_metrics.current_vclk0s) {
|
||||
std::cout << "\t -> " << std::dec << vclk << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\t**.current_dclk0s[] : " << std::dec << "\n";
|
||||
for (const auto& dclk : gpu_metrics.current_dclk0s) {
|
||||
std::cout << "\t -> " << std::dec << dclk << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t ** -> Checking metrics with constant changes ** " << "\n";
|
||||
constexpr uint16_t kMAX_ITER_TEST = 10;
|
||||
amdsmi_gpu_metrics_t gpu_metrics_check;
|
||||
for (auto idx = uint16_t(1); idx <= kMAX_ITER_TEST; ++idx) {
|
||||
amdsmi_get_gpu_metrics_info(processor_handles[j], &gpu_metrics_check);
|
||||
std::cout << "\t\t -> firmware_timestamp [" << idx << "/" << kMAX_ITER_TEST << "]: " << gpu_metrics_check.firmware_timestamp << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\n";
|
||||
for (auto idx = uint16_t(1); idx <= kMAX_ITER_TEST; ++idx) {
|
||||
amdsmi_get_gpu_metrics_info(processor_handles[j], &gpu_metrics_check);
|
||||
std::cout << "\t\t -> system_clock_counter [" << idx << "/" << kMAX_ITER_TEST << "]: " << gpu_metrics_check.system_clock_counter << "\n";
|
||||
}
|
||||
std::cout << "\n";
|
||||
|
||||
std::cout << "\n";
|
||||
std::cout << "\t ** Note: Values MAX'ed out (UINTX MAX are unsupported for the version in question) ** " << "\n";
|
||||
std::cout << "\n";
|
||||
std::cout << "+=======+==================+============+=============="
|
||||
<< "+=============+=============+=============+============+\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -287,8 +287,8 @@ int main(int argc, char **argv) {
|
||||
double fraction_uq10 = fraction_q10;
|
||||
const char* err_str1;
|
||||
|
||||
amdsmi_hsmp_metric_table_t mtbl = {};
|
||||
ret = amdsmi_get_metrics_table(plist[index], &mtbl);
|
||||
amdsmi_hsmp_metrics_table_t mtbl = {};
|
||||
ret = amdsmi_get_hsmp_metrics_table(plist[index], &mtbl);
|
||||
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) {
|
||||
cout<<"Failed to get Metrics Table for CPU["<<index<<"], Err["<<ret<<"]" << endl;
|
||||
|
||||
@@ -151,7 +151,7 @@ typedef enum {
|
||||
#define AMDSMI_LIB_VERSION_YEAR 24
|
||||
|
||||
//! Major version should be changed for every header change (adding/deleting APIs, changing names, fields of structures, etc.)
|
||||
#define AMDSMI_LIB_VERSION_MAJOR 2
|
||||
#define AMDSMI_LIB_VERSION_MAJOR 3
|
||||
|
||||
//! Minor version should be updated for each API change, but without changing headers
|
||||
#define AMDSMI_LIB_VERSION_MINOR 0
|
||||
@@ -541,19 +541,19 @@ typedef struct {
|
||||
* @brief cache properties
|
||||
*/
|
||||
typedef enum {
|
||||
CACHE_PROPERTIES_ENABLED = 0x00000001,
|
||||
CACHE_PROPERTIES_DATA_CACHE = 0x00000002,
|
||||
CACHE_PROPERTIES_INST_CACHE = 0x00000004,
|
||||
CACHE_PROPERTIES_CPU_CACHE = 0x00000008,
|
||||
CACHE_PROPERTIES_SIMD_CACHE = 0x00000010,
|
||||
AMDSMI_CACHE_PROPERTIES_ENABLED = 0x00000001,
|
||||
AMDSMI_CACHE_PROPERTIES_DATA_CACHE = 0x00000002,
|
||||
AMDSMI_CACHE_PROPERTIES_INST_CACHE = 0x00000004,
|
||||
AMDSMI_CACHE_PROPERTIES_CPU_CACHE = 0x00000008,
|
||||
AMDSMI_CACHE_PROPERTIES_SIMD_CACHE = 0x00000010,
|
||||
} amdsmi_cache_properties_type_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t num_cache_types;
|
||||
struct cache_ {
|
||||
uint32_t cache_properties; // amdsmi_cache_properties_type_t which is a bitmask
|
||||
uint32_t cache_size; /* In KB */
|
||||
uint32_t cache_level;
|
||||
uint32_t properties; // amdsmi_cache_properties_type_t which is a bitmask
|
||||
uint32_t max_num_cu_shared; /* Indicates how many Compute Units share this cache instance */
|
||||
uint32_t num_cache_instance; /* total number of instance of this cache type */
|
||||
uint32_t reserved[3];
|
||||
@@ -1527,7 +1527,7 @@ typedef struct {
|
||||
} amdsmi_dpm_level_t;
|
||||
|
||||
/**
|
||||
* @brief Metrics table (supported only with hsmp proto version 6).
|
||||
* @brief HSMP Metrics table (supported only with hsmp proto version 6).
|
||||
*/
|
||||
typedef struct __attribute__((__packed__)){
|
||||
uint32_t accumulation_counter;
|
||||
@@ -1606,7 +1606,7 @@ typedef struct __attribute__((__packed__)){
|
||||
|
||||
/* New items at the end to maintain driver compatibility */
|
||||
uint32_t gfxclk_frequency[8];
|
||||
} amdsmi_hsmp_metric_table_t;
|
||||
} amdsmi_hsmp_metrics_table_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1619,7 +1619,7 @@ typedef struct __attribute__((__packed__)){
|
||||
/**
|
||||
* @brief Initialize the AMD SMI library
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details This function initializes the library and the internal data structures,
|
||||
@@ -1642,7 +1642,7 @@ amdsmi_status_t amdsmi_init(uint64_t init_flags);
|
||||
/**
|
||||
* @brief Shutdown the AMD SMI library
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details This function shuts down the library and internal data structures and
|
||||
@@ -1663,7 +1663,7 @@ amdsmi_status_t amdsmi_shut_down(void);
|
||||
/**
|
||||
* @brief Get the list of socket handles in the system.
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details Depends on what flag is passed to ::amdsmi_init. AMDSMI_INIT_AMD_GPUS
|
||||
@@ -1726,7 +1726,7 @@ amdsmi_status_t amdsmi_get_cpusocket_handles(uint32_t *socket_count,
|
||||
/**
|
||||
* @brief Get information about the given socket
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details This function retrieves socket information. The @p socket_handle must
|
||||
@@ -1818,7 +1818,7 @@ amdsmi_status_t amdsmi_get_processor_handles_by_type(amdsmi_socket_handle socket
|
||||
/**
|
||||
* @brief Get the list of the processor handles associated to a socket.
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details This function retrieves the processor handles of a socket. The
|
||||
@@ -1886,7 +1886,7 @@ amdsmi_status_t amdsmi_get_cpucore_handles(amdsmi_cpusocket_handle socket_handle
|
||||
/**
|
||||
* @brief Get the processor type of the processor_handle
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details This function retrieves the processor type. A processor_handle must be provided
|
||||
@@ -1906,7 +1906,7 @@ amdsmi_status_t amdsmi_get_processor_type(amdsmi_processor_handle processor_hand
|
||||
/**
|
||||
* @brief Get processor handle with the matching bdf.
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
|
||||
* @platform{guest_mvf} @platform{guest_windows}
|
||||
*
|
||||
* @details Given bdf info @p bdf, this function will get
|
||||
@@ -2462,7 +2462,7 @@ amdsmi_get_gpu_bad_page_info(amdsmi_processor_handle processor_handle, uint32_t
|
||||
* @brief Returns RAS features info.
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host}
|
||||
*
|
||||
*
|
||||
* @param[in] processor_handle Device handle which to query
|
||||
*
|
||||
* @param[out] ras_feature RAS features that are currently enabled and supported on
|
||||
@@ -2635,7 +2635,7 @@ amdsmi_status_t amdsmi_get_gpu_fan_speed_max(amdsmi_processor_handle processor_h
|
||||
* specified temperature sensor on the specified device. It is not supported on
|
||||
* virtual machine guest
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host}
|
||||
* @platform{gpu_bm_linux} @platform{host}
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, a sensor type @p sensor_type, a
|
||||
* ::amdsmi_temperature_metric_t @p metric and a pointer to an int64_t @p
|
||||
@@ -2666,7 +2666,7 @@ amdsmi_status_t amdsmi_get_temp_metric(amdsmi_processor_handle processor_handle,
|
||||
/**
|
||||
* @brief Returns gpu cache info.
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host}
|
||||
* @platform{gpu_bm_linux} @platform{host}
|
||||
*
|
||||
* @param[in] processor_handle PF of a processor for which to query
|
||||
*
|
||||
@@ -2935,6 +2935,27 @@ amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle);
|
||||
amdsmi_status_t amdsmi_get_gpu_od_volt_info(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_od_volt_freq_data_t *odv);
|
||||
|
||||
/**
|
||||
* @brief Get the 'metrics_header_info' from the GPU metrics associated with the device
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{guest_1vf}
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle and a pointer to a amd_metrics_table_header_t in which
|
||||
* the 'metrics_header_info' will stored
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
*
|
||||
* @param[inout] header_value a pointer to amd_metrics_table_header_t to which the device gpu
|
||||
* metric unit will be stored
|
||||
*
|
||||
* @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call.
|
||||
* ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit
|
||||
* does not exist for the given device
|
||||
*
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_metrics_header_info(amdsmi_processor_handle processor_handle, amd_metrics_table_header_t* header_value);
|
||||
|
||||
/**
|
||||
* @brief This function retrieves the gpu metrics information. It is not supported
|
||||
* on virtual machine guest
|
||||
@@ -4375,7 +4396,7 @@ amdsmi_status_t amdsmi_get_gpu_vram_info(
|
||||
/**
|
||||
* @brief Returns the board part number and board information for the requested device
|
||||
*
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
|
||||
* @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
*
|
||||
@@ -4648,10 +4669,10 @@ amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_
|
||||
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup energyinfo Energy information (RAPL MSR) */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup energyinfo Energy information (RAPL MSR)
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the core energy for a given core.
|
||||
@@ -4681,12 +4702,12 @@ amdsmi_status_t amdsmi_get_cpu_core_energy(amdsmi_processor_handle processor_han
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_processor_handle processor_handle,
|
||||
uint64_t *penergy);
|
||||
|
||||
/** @} */
|
||||
/** @} End energyinfo */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup systemstatistics HSMP system statistics */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup systemstatistics HSMP system statistics
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get SMU Firmware Version.
|
||||
@@ -4804,12 +4825,12 @@ amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_processor_handle process
|
||||
amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *freq);
|
||||
|
||||
/** @} */
|
||||
/** @} systemstatistics */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup powercont Power Control */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup powercont Power Control
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the socket power.
|
||||
@@ -4895,12 +4916,12 @@ amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_processor_handle processo
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_processor_handle processor_handle,
|
||||
uint8_t mode);
|
||||
|
||||
/** @} */
|
||||
/** @} powercont */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup perfcont Performance (Boost limit) Control */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup perfcont Performance (Boost limit) Control
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the core boost limit.
|
||||
@@ -4958,12 +4979,12 @@ amdsmi_status_t amdsmi_set_cpu_core_boostlimit(amdsmi_processor_handle processor
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t boostlimit);
|
||||
|
||||
/** @} */
|
||||
/** @} perfcont */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup ddrquer DDR bandwidth monitor */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup ddrquer DDR bandwidth monitor
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the DDR bandwidth data.
|
||||
@@ -4978,12 +4999,12 @@ amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_processor_handle process
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
|
||||
/** @} */
|
||||
/** @} ddrquer */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup tempquer Temperature Query */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup tempquer Temperature Query
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get socket temperature.
|
||||
@@ -4999,12 +5020,12 @@ amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ptmon);
|
||||
|
||||
/** @} */
|
||||
/** @} tempquer */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup dimmstatistics Dimm statistics */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup dimmstatistics Dimm statistics
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get DIMM temperature range and refresh rate.
|
||||
@@ -5051,12 +5072,12 @@ amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_processor_handle proce
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_thermal_t *dimm_temp);
|
||||
|
||||
/** @} */
|
||||
/** @} dimmstatistics */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup xgmibwcont xGMI bandwidth control */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup xgmibwcont xGMI bandwidth control
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set xgmi width.
|
||||
@@ -5071,12 +5092,12 @@ amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_processor_handle proce
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
|
||||
/** @} */
|
||||
/** @} xgmibwcont */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup gmi3widthcont GMI3 width control */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup gmi3widthcont GMI3 width control
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Set gmi3 link width range.
|
||||
@@ -5092,12 +5113,12 @@ amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_processor_handle processor_hand
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min_link_width, uint8_t max_link_width);
|
||||
|
||||
/** @} */
|
||||
/** @} gmi3widthcont */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup pstatecnt Pstate selection */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup pstatecnt Pstate selection
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enable APB.
|
||||
@@ -5181,12 +5202,12 @@ amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_processor_handle processor_
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t max_pstate, uint8_t min_pstate);
|
||||
|
||||
/** @} */
|
||||
/** @} pstatecnt */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup bwquer Bandwidth monitor */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup bwquer Bandwidth monitor
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
@@ -5216,45 +5237,45 @@ amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_processor_handle proc
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
|
||||
/** @} */
|
||||
/** @} bwquer */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup MetQuer Metrics Table */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup MetQuer HSMP Metrics Table
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get metrics table version
|
||||
* @brief Get HSMP metrics table version
|
||||
*
|
||||
* @platform{cpu_bm}
|
||||
*
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_version input buffer to return the metrics table version.
|
||||
* @param[in,out] metrics_version input buffer to return the HSMP metrics table version.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_status_t amdsmi_get_hsmp_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *metrics_version);
|
||||
|
||||
/**
|
||||
* @brief Get metrics table
|
||||
* @brief Get HSMP metrics table
|
||||
*
|
||||
* @platform{cpu_bm}
|
||||
*
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_table input buffer to return the metrics table.
|
||||
* @param[in,out] metrics_table input buffer to return the HSMP metrics table.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_hsmp_metric_table_t *metrics_table);
|
||||
amdsmi_status_t amdsmi_get_hsmp_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_hsmp_metrics_table_t *metrics_table);
|
||||
|
||||
/** @} */
|
||||
/** @} MetQuer */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @defgroup auxiquer Auxillary functions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @{ */
|
||||
/*****************************************************************************/
|
||||
/** @defgroup auxiquer Auxillary functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get first online core on socket.
|
||||
@@ -5305,7 +5326,7 @@ amdsmi_status_t amdsmi_get_cpu_model(uint32_t *cpu_model);
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_esmi_err_msg(amdsmi_status_t status, const char **status_string);
|
||||
#endif
|
||||
/** @} */
|
||||
/** @} auxiquer */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -465,32 +465,33 @@ except AmdSmiException as e:
|
||||
|
||||
### amdsmi_get_gpu_cache_info
|
||||
|
||||
Description: Returns dictionary of cache information for the given GPU.
|
||||
Description: Returns a list of dictionaries containing cache information for the given GPU.
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `processor_handle` device which to query
|
||||
|
||||
Output: Dictionary of Dictionaries containing cache information
|
||||
Schema: { cache_index:
|
||||
{
|
||||
cache_properties:
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
cache_size: {"type" : "number"},
|
||||
cache_level: {"type" : "number"},
|
||||
max_num_cu_shared: {"type" : "number"},
|
||||
num_cache_instance: {"type" : "number"}
|
||||
}
|
||||
}
|
||||
Output: List of Dictionaries containing cache information following the schema below:
|
||||
Schema:
|
||||
|
||||
```JSON
|
||||
{
|
||||
cache: {"type" : "number"},
|
||||
cache_properties:
|
||||
{
|
||||
"type" : "array",
|
||||
"items" : {"type" : "string"}
|
||||
},
|
||||
cache_size: {"type" : "number"},
|
||||
cache_level: {"type" : "number"},
|
||||
max_num_cu_shared: {"type" : "number"},
|
||||
num_cache_instance: {"type" : "number"}
|
||||
}
|
||||
```
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`cache_index` | cache index is a string of format "cache_#" up to 10 caches will be available
|
||||
`cache` | cache index from 0-9
|
||||
`cache_properties` | list of up to 4 cache property type strings. Ex. data ("DATA_CACHE"), instruction ("INST_CACHE"), CPU ("CPU_CACHE"), or SIMD ("SIMD_CACHE").
|
||||
`cache_size` | size of cache in KB
|
||||
`cache_level` | level of cache
|
||||
@@ -5958,13 +5959,13 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_metrics_table_version
|
||||
### amdsmi_get_hsmp_metrics_table_version
|
||||
|
||||
Description: Get metrics table version.
|
||||
Description: Get HSMP metrics table version.
|
||||
|
||||
Output: amdsmi metrics table version
|
||||
Output: amdsmi HSMP metrics table version
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_metrics_table_version` function:
|
||||
Exceptions that can be thrown by `amdsmi_get_hsmp_metrics_table_version` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
@@ -5977,19 +5978,19 @@ try:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
met_ver = amdsmi_get_metrics_table_version(processor)
|
||||
met_ver = amdsmi_get_hsmp_metrics_table_version(processor)
|
||||
print(met_ver)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
### amdsmi_get_metrics_table
|
||||
### amdsmi_get_hsmp_metrics_table
|
||||
|
||||
Description: Get metrics table
|
||||
Description: Get HSMP metrics table
|
||||
|
||||
Output: metric table data
|
||||
Output: HSMP metric table data
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_metrics_table` function:
|
||||
Exceptions that can be thrown by `amdsmi_get_hsmp_metrics_table` function:
|
||||
|
||||
* `AmdSmiLibraryException`
|
||||
|
||||
@@ -6002,7 +6003,7 @@ try:
|
||||
print("No CPU sockets on machine")
|
||||
else:
|
||||
for processor in processor_handles:
|
||||
mtbl = amdsmi_get_metrics_table(processor)
|
||||
mtbl = amdsmi_get_hsmp_metrics_table(processor)
|
||||
print(mtbl['accumulation_counter'])
|
||||
print(mtbl['max_socket_temperature'])
|
||||
print(mtbl['max_vr_temperature'])
|
||||
|
||||
@@ -69,8 +69,8 @@ try:
|
||||
from .amdsmi_interface import amdsmi_set_cpu_df_pstate_range
|
||||
from .amdsmi_interface import amdsmi_get_cpu_current_io_bandwidth
|
||||
from .amdsmi_interface import amdsmi_get_cpu_current_xgmi_bw
|
||||
from .amdsmi_interface import amdsmi_get_metrics_table_version
|
||||
from .amdsmi_interface import amdsmi_get_metrics_table
|
||||
from .amdsmi_interface import amdsmi_get_hsmp_metrics_table_version
|
||||
from .amdsmi_interface import amdsmi_get_hsmp_metrics_table
|
||||
from .amdsmi_interface import amdsmi_first_online_core_on_cpu_socket
|
||||
from .amdsmi_interface import amdsmi_get_cpu_family
|
||||
from .amdsmi_interface import amdsmi_get_cpu_model
|
||||
|
||||
@@ -1349,7 +1349,7 @@ def amdsmi_get_cpu_current_xgmi_bw(
|
||||
|
||||
return f"{xgmi_bw.value} Mbps"
|
||||
|
||||
def amdsmi_get_metrics_table_version(
|
||||
def amdsmi_get_hsmp_metrics_table_version(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle
|
||||
):
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
@@ -1360,7 +1360,7 @@ def amdsmi_get_metrics_table_version(
|
||||
metric_tbl_version = ctypes.c_uint32()
|
||||
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_metrics_table_version(
|
||||
amdsmi_wrapper.amdsmi_get_hsmp_metrics_table_version(
|
||||
processor_handle, ctypes.byref(metric_tbl_version))
|
||||
)
|
||||
|
||||
@@ -1393,7 +1393,7 @@ def check_msb_64(num):
|
||||
else:
|
||||
return num
|
||||
|
||||
def amdsmi_get_metrics_table(
|
||||
def amdsmi_get_hsmp_metrics_table(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle
|
||||
):
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
@@ -1401,7 +1401,7 @@ def amdsmi_get_metrics_table(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
mtbl = amdsmi_wrapper.amdsmi_hsmp_metric_table_t()
|
||||
mtbl = amdsmi_wrapper.amdsmi_hsmp_metrics_table_t()
|
||||
|
||||
'''Encodings for the metric table defined for hsmp'''
|
||||
fraction_q10 = 1 / math.pow(2, 10)
|
||||
@@ -1409,7 +1409,7 @@ def amdsmi_get_metrics_table(
|
||||
fraction_uq16 = 1 / math.pow(2, 16)
|
||||
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_metrics_table(
|
||||
amdsmi_wrapper.amdsmi_get_hsmp_metrics_table(
|
||||
processor_handle, mtbl
|
||||
)
|
||||
)
|
||||
@@ -1562,23 +1562,50 @@ def amdsmi_get_gpu_asic_info(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
asic_info = amdsmi_wrapper.amdsmi_asic_info_t()
|
||||
asic_info_struct = amdsmi_wrapper.amdsmi_asic_info_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_asic_info(
|
||||
processor_handle, ctypes.byref(asic_info))
|
||||
processor_handle, ctypes.byref(asic_info_struct))
|
||||
)
|
||||
|
||||
return {
|
||||
"market_name": asic_info.market_name.decode("utf-8"),
|
||||
"vendor_id": asic_info.vendor_id,
|
||||
"vendor_name": asic_info.vendor_name.decode("utf-8"),
|
||||
"subvendor_id": asic_info.subvendor_id if asic_info.subvendor_id == '' else hex(asic_info.subvendor_id),
|
||||
"device_id": asic_info.device_id,
|
||||
"rev_id": asic_info.rev_id,
|
||||
"asic_serial": asic_info.asic_serial.decode("utf-8"),
|
||||
"oam_id": asic_info.oam_id
|
||||
asic_info = {
|
||||
"market_name": asic_info_struct.market_name.decode("utf-8"),
|
||||
"vendor_id": asic_info_struct.vendor_id,
|
||||
"vendor_name": asic_info_struct.vendor_name.decode("utf-8"),
|
||||
"subvendor_id": asic_info_struct.subvendor_id,
|
||||
"device_id": asic_info_struct.device_id,
|
||||
"rev_id": asic_info_struct.rev_id,
|
||||
"asic_serial": asic_info_struct.asic_serial.decode("utf-8"),
|
||||
"oam_id": asic_info_struct.oam_id
|
||||
}
|
||||
|
||||
string_values = ["market_name", "vendor_name"]
|
||||
for value in string_values:
|
||||
if not asic_info[value]:
|
||||
asic_info[value] = "N/A"
|
||||
|
||||
hex_values = ["vendor_id", "subvendor_id", "device_id", "rev_id"]
|
||||
for value in hex_values:
|
||||
if asic_info[value]:
|
||||
asic_info[value] = hex(asic_info[value])
|
||||
else:
|
||||
asic_info[value] = "N/A"
|
||||
|
||||
# Ensure hex output for asic_serial
|
||||
if asic_info["asic_serial"]:
|
||||
asic_info["asic_serial"] = str.format("0x{:016X}", int(asic_info["asic_serial"], base=16))
|
||||
else:
|
||||
asic_info["asic_serial"] = "N/A"
|
||||
|
||||
# Check for max value as a sign for not applicable
|
||||
if asic_info["oam_id"] == 0xFFFF: # uint 16 max
|
||||
asic_info["oam_id"] = "N/A"
|
||||
|
||||
# Remove commas from vendor name for clean output
|
||||
asic_info["vendor_name"] = asic_info["vendor_name"].replace(',', '')
|
||||
|
||||
return asic_info
|
||||
|
||||
|
||||
def amdsmi_get_power_cap_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
@@ -1625,51 +1652,52 @@ def amdsmi_get_gpu_vram_info(
|
||||
|
||||
def amdsmi_get_gpu_cache_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
) -> Dict[str, Dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
raise AmdSmiParameterException(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
cache_info = amdsmi_wrapper.amdsmi_gpu_cache_info_t()
|
||||
cache_info_struct = amdsmi_wrapper.amdsmi_gpu_cache_info_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_gpu_cache_info(
|
||||
processor_handle, ctypes.byref(cache_info))
|
||||
processor_handle, ctypes.byref(cache_info_struct))
|
||||
)
|
||||
|
||||
cache_info_dict = {}
|
||||
for cache_index in range(cache_info.num_cache_types):
|
||||
cache_info_list = []
|
||||
for cache_index in range(cache_info_struct.num_cache_types):
|
||||
# Put cache_properties at the start of the dictionary for readability
|
||||
cache_dict = {
|
||||
"cache_properties": [],
|
||||
"cache_size": cache_info.cache[cache_index].cache_size,
|
||||
"cache_level": cache_info.cache[cache_index].cache_level,
|
||||
"max_num_cu_shared": cache_info.cache[cache_index].max_num_cu_shared,
|
||||
"num_cache_instance": cache_info.cache[cache_index].num_cache_instance
|
||||
"cache": cache_index,
|
||||
"cache_properties": [], # This will be a list of strings
|
||||
"cache_size": cache_info_struct.cache[cache_index].cache_size,
|
||||
"cache_level": cache_info_struct.cache[cache_index].cache_level,
|
||||
"max_num_cu_shared": cache_info_struct.cache[cache_index].max_num_cu_shared,
|
||||
"num_cache_instance": cache_info_struct.cache[cache_index].num_cache_instance
|
||||
}
|
||||
|
||||
# Check against cache properties bitmask
|
||||
cache_properties = cache_info.cache[cache_index].properties
|
||||
data_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_DATA_CACHE
|
||||
inst_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_INST_CACHE
|
||||
cpu_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_CPU_CACHE
|
||||
simd_cache = cache_properties & amdsmi_wrapper.CACHE_PROPERTIES_SIMD_CACHE
|
||||
cache_properties = cache_info_struct.cache[cache_index].cache_properties
|
||||
data_cache = cache_properties & amdsmi_wrapper.AMDSMI_CACHE_PROPERTIES_DATA_CACHE
|
||||
inst_cache = cache_properties & amdsmi_wrapper.AMDSMI_CACHE_PROPERTIES_INST_CACHE
|
||||
cpu_cache = cache_properties & amdsmi_wrapper.AMDSMI_CACHE_PROPERTIES_CPU_CACHE
|
||||
simd_cache = cache_properties & amdsmi_wrapper.AMDSMI_CACHE_PROPERTIES_SIMD_CACHE
|
||||
|
||||
cache_properties_status = [data_cache, inst_cache, cpu_cache, simd_cache]
|
||||
cache_property_list = []
|
||||
for cache_property in cache_properties_status:
|
||||
if cache_property:
|
||||
property_name = amdsmi_wrapper.amdsmi_cache_properties_type_t__enumvalues[cache_property]
|
||||
property_name = property_name.replace("CACHE_PROPERTIES_", "")
|
||||
property_name = property_name.replace("AMDSMI_CACHE_PROPERTIES_", "")
|
||||
cache_property_list.append(property_name)
|
||||
|
||||
cache_dict["cache_properties"] = cache_property_list
|
||||
cache_info_dict[f"cache_{cache_index}"] = cache_dict
|
||||
cache_info_list.append(cache_dict)
|
||||
|
||||
if not cache_info_dict:
|
||||
if not cache_info_list:
|
||||
raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_NO_DATA)
|
||||
|
||||
return cache_info_dict
|
||||
return cache_info_list
|
||||
|
||||
|
||||
def amdsmi_get_gpu_vbios_info(
|
||||
|
||||
@@ -746,19 +746,6 @@ amdsmi_card_form_factor_t = ctypes.c_uint32 # enum
|
||||
class struct_amdsmi_pcie_info_t(Structure):
|
||||
pass
|
||||
|
||||
class struct_pcie_static_(Structure):
|
||||
pass
|
||||
|
||||
struct_pcie_static_._pack_ = 1 # source:False
|
||||
struct_pcie_static_._fields_ = [
|
||||
('max_pcie_lanes', ctypes.c_uint16),
|
||||
('PADDING_0', ctypes.c_ubyte * 2),
|
||||
('max_pcie_speed', ctypes.c_uint32),
|
||||
('pcie_interface_version', ctypes.c_uint32),
|
||||
('slot_type', amdsmi_card_form_factor_t),
|
||||
('reserved', ctypes.c_uint64 * 10),
|
||||
]
|
||||
|
||||
class struct_pcie_metric_(Structure):
|
||||
pass
|
||||
|
||||
@@ -777,6 +764,19 @@ struct_pcie_metric_._fields_ = [
|
||||
('reserved', ctypes.c_uint64 * 13),
|
||||
]
|
||||
|
||||
class struct_pcie_static_(Structure):
|
||||
pass
|
||||
|
||||
struct_pcie_static_._pack_ = 1 # source:False
|
||||
struct_pcie_static_._fields_ = [
|
||||
('max_pcie_lanes', ctypes.c_uint16),
|
||||
('PADDING_0', ctypes.c_ubyte * 2),
|
||||
('max_pcie_speed', ctypes.c_uint32),
|
||||
('pcie_interface_version', ctypes.c_uint32),
|
||||
('slot_type', amdsmi_card_form_factor_t),
|
||||
('reserved', ctypes.c_uint64 * 10),
|
||||
]
|
||||
|
||||
struct_amdsmi_pcie_info_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_pcie_info_t._fields_ = [
|
||||
('pcie_static', struct_pcie_static_),
|
||||
@@ -815,17 +815,17 @@ amdsmi_vbios_info_t = struct_amdsmi_vbios_info_t
|
||||
|
||||
# values for enumeration 'amdsmi_cache_properties_type_t'
|
||||
amdsmi_cache_properties_type_t__enumvalues = {
|
||||
1: 'CACHE_PROPERTIES_ENABLED',
|
||||
2: 'CACHE_PROPERTIES_DATA_CACHE',
|
||||
4: 'CACHE_PROPERTIES_INST_CACHE',
|
||||
8: 'CACHE_PROPERTIES_CPU_CACHE',
|
||||
16: 'CACHE_PROPERTIES_SIMD_CACHE',
|
||||
1: 'AMDSMI_CACHE_PROPERTIES_ENABLED',
|
||||
2: 'AMDSMI_CACHE_PROPERTIES_DATA_CACHE',
|
||||
4: 'AMDSMI_CACHE_PROPERTIES_INST_CACHE',
|
||||
8: 'AMDSMI_CACHE_PROPERTIES_CPU_CACHE',
|
||||
16: 'AMDSMI_CACHE_PROPERTIES_SIMD_CACHE',
|
||||
}
|
||||
CACHE_PROPERTIES_ENABLED = 1
|
||||
CACHE_PROPERTIES_DATA_CACHE = 2
|
||||
CACHE_PROPERTIES_INST_CACHE = 4
|
||||
CACHE_PROPERTIES_CPU_CACHE = 8
|
||||
CACHE_PROPERTIES_SIMD_CACHE = 16
|
||||
AMDSMI_CACHE_PROPERTIES_ENABLED = 1
|
||||
AMDSMI_CACHE_PROPERTIES_DATA_CACHE = 2
|
||||
AMDSMI_CACHE_PROPERTIES_INST_CACHE = 4
|
||||
AMDSMI_CACHE_PROPERTIES_CPU_CACHE = 8
|
||||
AMDSMI_CACHE_PROPERTIES_SIMD_CACHE = 16
|
||||
amdsmi_cache_properties_type_t = ctypes.c_uint32 # enum
|
||||
class struct_amdsmi_gpu_cache_info_t(Structure):
|
||||
pass
|
||||
@@ -835,9 +835,9 @@ class struct_cache_(Structure):
|
||||
|
||||
struct_cache_._pack_ = 1 # source:False
|
||||
struct_cache_._fields_ = [
|
||||
('cache_properties', ctypes.c_uint32),
|
||||
('cache_size', ctypes.c_uint32),
|
||||
('cache_level', ctypes.c_uint32),
|
||||
('properties', ctypes.c_uint32),
|
||||
('max_num_cu_shared', ctypes.c_uint32),
|
||||
('num_cache_instance', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 3),
|
||||
@@ -1780,11 +1780,11 @@ struct_amdsmi_dpm_level_t._fields_ = [
|
||||
]
|
||||
|
||||
amdsmi_dpm_level_t = struct_amdsmi_dpm_level_t
|
||||
class struct_amdsmi_hsmp_metric_table_t(Structure):
|
||||
class struct_amdsmi_hsmp_metrics_table_t(Structure):
|
||||
pass
|
||||
|
||||
struct_amdsmi_hsmp_metric_table_t._pack_ = 1 # source:True
|
||||
struct_amdsmi_hsmp_metric_table_t._fields_ = [
|
||||
struct_amdsmi_hsmp_metrics_table_t._pack_ = 1 # source:True
|
||||
struct_amdsmi_hsmp_metrics_table_t._fields_ = [
|
||||
('accumulation_counter', ctypes.c_uint32),
|
||||
('max_socket_temperature', ctypes.c_uint32),
|
||||
('max_vr_temperature', ctypes.c_uint32),
|
||||
@@ -1845,7 +1845,7 @@ struct_amdsmi_hsmp_metric_table_t._fields_ = [
|
||||
('gfxclk_frequency', ctypes.c_uint32 * 8),
|
||||
]
|
||||
|
||||
amdsmi_hsmp_metric_table_t = struct_amdsmi_hsmp_metric_table_t
|
||||
amdsmi_hsmp_metrics_table_t = struct_amdsmi_hsmp_metrics_table_t
|
||||
uint64_t = ctypes.c_uint64
|
||||
amdsmi_init = _libraries['libamd_smi.so'].amdsmi_init
|
||||
amdsmi_init.restype = amdsmi_status_t
|
||||
@@ -1993,6 +1993,9 @@ amdsmi_reset_gpu.argtypes = [amdsmi_processor_handle]
|
||||
amdsmi_get_gpu_od_volt_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_od_volt_info
|
||||
amdsmi_get_gpu_od_volt_info.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_od_volt_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_od_volt_freq_data_t)]
|
||||
amdsmi_get_gpu_metrics_header_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_header_info
|
||||
amdsmi_get_gpu_metrics_header_info.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_metrics_header_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amd_metrics_table_header_t)]
|
||||
amdsmi_get_gpu_metrics_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_metrics_info
|
||||
amdsmi_get_gpu_metrics_info.restype = amdsmi_status_t
|
||||
amdsmi_get_gpu_metrics_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_gpu_metrics_t)]
|
||||
@@ -2285,12 +2288,12 @@ amdsmi_get_cpu_current_io_bandwidth.argtypes = [amdsmi_processor_handle, amdsmi_
|
||||
amdsmi_get_cpu_current_xgmi_bw = _libraries['libamd_smi.so'].amdsmi_get_cpu_current_xgmi_bw
|
||||
amdsmi_get_cpu_current_xgmi_bw.restype = amdsmi_status_t
|
||||
amdsmi_get_cpu_current_xgmi_bw.argtypes = [amdsmi_processor_handle, amdsmi_link_id_bw_type_t, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_metrics_table_version = _libraries['libamd_smi.so'].amdsmi_get_metrics_table_version
|
||||
amdsmi_get_metrics_table_version.restype = amdsmi_status_t
|
||||
amdsmi_get_metrics_table_version.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_metrics_table = _libraries['libamd_smi.so'].amdsmi_get_metrics_table
|
||||
amdsmi_get_metrics_table.restype = amdsmi_status_t
|
||||
amdsmi_get_metrics_table.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_hsmp_metric_table_t)]
|
||||
amdsmi_get_hsmp_metrics_table_version = _libraries['libamd_smi.so'].amdsmi_get_hsmp_metrics_table_version
|
||||
amdsmi_get_hsmp_metrics_table_version.restype = amdsmi_status_t
|
||||
amdsmi_get_hsmp_metrics_table_version.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
amdsmi_get_hsmp_metrics_table = _libraries['libamd_smi.so'].amdsmi_get_hsmp_metrics_table
|
||||
amdsmi_get_hsmp_metrics_table.restype = amdsmi_status_t
|
||||
amdsmi_get_hsmp_metrics_table.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_amdsmi_hsmp_metrics_table_t)]
|
||||
amdsmi_first_online_core_on_cpu_socket = _libraries['libamd_smi.so'].amdsmi_first_online_core_on_cpu_socket
|
||||
amdsmi_first_online_core_on_cpu_socket.restype = amdsmi_status_t
|
||||
amdsmi_first_online_core_on_cpu_socket.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
|
||||
@@ -2305,6 +2308,11 @@ amdsmi_get_esmi_err_msg.restype = amdsmi_status_t
|
||||
amdsmi_get_esmi_err_msg.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))]
|
||||
__all__ = \
|
||||
['AGG_BW0', 'AMDSMI_ARG_PTR_NULL', 'AMDSMI_AVERAGE_POWER',
|
||||
'AMDSMI_CACHE_PROPERTIES_CPU_CACHE',
|
||||
'AMDSMI_CACHE_PROPERTIES_DATA_CACHE',
|
||||
'AMDSMI_CACHE_PROPERTIES_ENABLED',
|
||||
'AMDSMI_CACHE_PROPERTIES_INST_CACHE',
|
||||
'AMDSMI_CACHE_PROPERTIES_SIMD_CACHE',
|
||||
'AMDSMI_CARD_FORM_FACTOR_OAM', 'AMDSMI_CARD_FORM_FACTOR_PCIE',
|
||||
'AMDSMI_CARD_FORM_FACTOR_UNKNOWN', 'AMDSMI_CNTR_CMD_START',
|
||||
'AMDSMI_CNTR_CMD_STOP', 'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY',
|
||||
@@ -2421,29 +2429,27 @@ __all__ = \
|
||||
'AMDSMI_VRAM_VENDOR__WINBOND', 'AMDSMI_XGMI_STATUS_ERROR',
|
||||
'AMDSMI_XGMI_STATUS_MULTIPLE_ERRORS',
|
||||
'AMDSMI_XGMI_STATUS_NO_ERRORS', 'AMD_APU', 'AMD_CPU',
|
||||
'AMD_CPU_CORE', 'AMD_GPU', 'CACHE_PROPERTIES_CPU_CACHE',
|
||||
'CACHE_PROPERTIES_DATA_CACHE', 'CACHE_PROPERTIES_ENABLED',
|
||||
'CACHE_PROPERTIES_INST_CACHE', 'CACHE_PROPERTIES_SIMD_CACHE',
|
||||
'CLK_TYPE_DCEF', 'CLK_TYPE_DCLK0', 'CLK_TYPE_DCLK1',
|
||||
'CLK_TYPE_DF', 'CLK_TYPE_FIRST', 'CLK_TYPE_GFX', 'CLK_TYPE_MEM',
|
||||
'CLK_TYPE_PCIE', 'CLK_TYPE_SOC', 'CLK_TYPE_SYS', 'CLK_TYPE_VCLK0',
|
||||
'CLK_TYPE_VCLK1', 'CLK_TYPE__MAX', 'COMPUTE_PARTITION_CPX',
|
||||
'COMPUTE_PARTITION_DPX', 'COMPUTE_PARTITION_INVALID',
|
||||
'COMPUTE_PARTITION_QPX', 'COMPUTE_PARTITION_SPX',
|
||||
'COMPUTE_PARTITION_TPX', 'CONTAINER_DOCKER', 'CONTAINER_LXC',
|
||||
'FW_ID_ASD', 'FW_ID_CP_CE', 'FW_ID_CP_ME', 'FW_ID_CP_MEC1',
|
||||
'FW_ID_CP_MEC2', 'FW_ID_CP_MEC_JT1', 'FW_ID_CP_MEC_JT2',
|
||||
'FW_ID_CP_MES', 'FW_ID_CP_PFP', 'FW_ID_CP_PM4', 'FW_ID_DFC',
|
||||
'FW_ID_DMCU', 'FW_ID_DMCU_ERAM', 'FW_ID_DMCU_ISR',
|
||||
'FW_ID_DRV_CAP', 'FW_ID_FIRST', 'FW_ID_IMU_DRAM',
|
||||
'FW_ID_IMU_IRAM', 'FW_ID_ISP', 'FW_ID_MC', 'FW_ID_MES_KIQ',
|
||||
'FW_ID_MES_STACK', 'FW_ID_MES_THREAD1', 'FW_ID_MES_THREAD1_STACK',
|
||||
'FW_ID_MMSCH', 'FW_ID_PM', 'FW_ID_PPTABLE', 'FW_ID_PSP_BL',
|
||||
'FW_ID_PSP_DBG', 'FW_ID_PSP_INTF', 'FW_ID_PSP_KEYDB',
|
||||
'FW_ID_PSP_SOC', 'FW_ID_PSP_SOSDRV', 'FW_ID_PSP_SPL',
|
||||
'FW_ID_PSP_SYSDRV', 'FW_ID_PSP_TOC', 'FW_ID_REG_ACCESS_WHITELIST',
|
||||
'FW_ID_RLC', 'FW_ID_RLCV_LX7', 'FW_ID_RLC_P',
|
||||
'FW_ID_RLC_RESTORE_LIST_CNTL', 'FW_ID_RLC_RESTORE_LIST_GPM_MEM',
|
||||
'AMD_CPU_CORE', 'AMD_GPU', 'CLK_TYPE_DCEF', 'CLK_TYPE_DCLK0',
|
||||
'CLK_TYPE_DCLK1', 'CLK_TYPE_DF', 'CLK_TYPE_FIRST', 'CLK_TYPE_GFX',
|
||||
'CLK_TYPE_MEM', 'CLK_TYPE_PCIE', 'CLK_TYPE_SOC', 'CLK_TYPE_SYS',
|
||||
'CLK_TYPE_VCLK0', 'CLK_TYPE_VCLK1', 'CLK_TYPE__MAX',
|
||||
'COMPUTE_PARTITION_CPX', 'COMPUTE_PARTITION_DPX',
|
||||
'COMPUTE_PARTITION_INVALID', 'COMPUTE_PARTITION_QPX',
|
||||
'COMPUTE_PARTITION_SPX', 'COMPUTE_PARTITION_TPX',
|
||||
'CONTAINER_DOCKER', 'CONTAINER_LXC', 'FW_ID_ASD', 'FW_ID_CP_CE',
|
||||
'FW_ID_CP_ME', 'FW_ID_CP_MEC1', 'FW_ID_CP_MEC2',
|
||||
'FW_ID_CP_MEC_JT1', 'FW_ID_CP_MEC_JT2', 'FW_ID_CP_MES',
|
||||
'FW_ID_CP_PFP', 'FW_ID_CP_PM4', 'FW_ID_DFC', 'FW_ID_DMCU',
|
||||
'FW_ID_DMCU_ERAM', 'FW_ID_DMCU_ISR', 'FW_ID_DRV_CAP',
|
||||
'FW_ID_FIRST', 'FW_ID_IMU_DRAM', 'FW_ID_IMU_IRAM', 'FW_ID_ISP',
|
||||
'FW_ID_MC', 'FW_ID_MES_KIQ', 'FW_ID_MES_STACK',
|
||||
'FW_ID_MES_THREAD1', 'FW_ID_MES_THREAD1_STACK', 'FW_ID_MMSCH',
|
||||
'FW_ID_PM', 'FW_ID_PPTABLE', 'FW_ID_PSP_BL', 'FW_ID_PSP_DBG',
|
||||
'FW_ID_PSP_INTF', 'FW_ID_PSP_KEYDB', 'FW_ID_PSP_SOC',
|
||||
'FW_ID_PSP_SOSDRV', 'FW_ID_PSP_SPL', 'FW_ID_PSP_SYSDRV',
|
||||
'FW_ID_PSP_TOC', 'FW_ID_REG_ACCESS_WHITELIST', 'FW_ID_RLC',
|
||||
'FW_ID_RLCV_LX7', 'FW_ID_RLC_P', 'FW_ID_RLC_RESTORE_LIST_CNTL',
|
||||
'FW_ID_RLC_RESTORE_LIST_GPM_MEM',
|
||||
'FW_ID_RLC_RESTORE_LIST_SRM_MEM', 'FW_ID_RLC_SAVE_RESTORE_LIST',
|
||||
'FW_ID_RLC_SRLG', 'FW_ID_RLC_SRLS', 'FW_ID_RLC_V', 'FW_ID_RLX6',
|
||||
'FW_ID_RLX6_CORE1', 'FW_ID_RLX6_DRAM_BOOT',
|
||||
@@ -2527,6 +2533,7 @@ __all__ = \
|
||||
'amdsmi_get_gpu_id', 'amdsmi_get_gpu_memory_partition',
|
||||
'amdsmi_get_gpu_memory_reserved_pages',
|
||||
'amdsmi_get_gpu_memory_total', 'amdsmi_get_gpu_memory_usage',
|
||||
'amdsmi_get_gpu_metrics_header_info',
|
||||
'amdsmi_get_gpu_metrics_info',
|
||||
'amdsmi_get_gpu_od_volt_curve_regions',
|
||||
'amdsmi_get_gpu_od_volt_info', 'amdsmi_get_gpu_overdrive_level',
|
||||
@@ -2544,9 +2551,9 @@ __all__ = \
|
||||
'amdsmi_get_gpu_total_ecc_count', 'amdsmi_get_gpu_vbios_info',
|
||||
'amdsmi_get_gpu_vendor_name', 'amdsmi_get_gpu_volt_metric',
|
||||
'amdsmi_get_gpu_vram_info', 'amdsmi_get_gpu_vram_usage',
|
||||
'amdsmi_get_gpu_vram_vendor', 'amdsmi_get_lib_version',
|
||||
'amdsmi_get_link_metrics', 'amdsmi_get_metrics_table',
|
||||
'amdsmi_get_metrics_table_version',
|
||||
'amdsmi_get_gpu_vram_vendor', 'amdsmi_get_hsmp_metrics_table',
|
||||
'amdsmi_get_hsmp_metrics_table_version', 'amdsmi_get_lib_version',
|
||||
'amdsmi_get_link_metrics',
|
||||
'amdsmi_get_minmax_bandwidth_between_processors',
|
||||
'amdsmi_get_pcie_info', 'amdsmi_get_power_cap_info',
|
||||
'amdsmi_get_power_info',
|
||||
@@ -2562,7 +2569,7 @@ __all__ = \
|
||||
'amdsmi_gpu_counter_group_supported', 'amdsmi_gpu_create_counter',
|
||||
'amdsmi_gpu_destroy_counter', 'amdsmi_gpu_metrics_t',
|
||||
'amdsmi_gpu_read_counter', 'amdsmi_gpu_xgmi_error_status',
|
||||
'amdsmi_hsmp_metric_table_t', 'amdsmi_init',
|
||||
'amdsmi_hsmp_metrics_table_t', 'amdsmi_init',
|
||||
'amdsmi_init_flags_t', 'amdsmi_init_gpu_event_notification',
|
||||
'amdsmi_io_bw_encoding_t', 'amdsmi_io_link_type_t',
|
||||
'amdsmi_is_P2P_accessible',
|
||||
@@ -2623,7 +2630,7 @@ __all__ = \
|
||||
'struct_amdsmi_freq_volt_region_t', 'struct_amdsmi_frequencies_t',
|
||||
'struct_amdsmi_frequency_range_t', 'struct_amdsmi_fw_info_t',
|
||||
'struct_amdsmi_gpu_cache_info_t', 'struct_amdsmi_gpu_metrics_t',
|
||||
'struct_amdsmi_hsmp_metric_table_t',
|
||||
'struct_amdsmi_hsmp_metrics_table_t',
|
||||
'struct_amdsmi_link_id_bw_type_t', 'struct_amdsmi_link_metrics_t',
|
||||
'struct_amdsmi_name_value_t', 'struct_amdsmi_od_vddc_point_t',
|
||||
'struct_amdsmi_od_volt_curve_t',
|
||||
|
||||
@@ -2685,47 +2685,42 @@ rsmi_status_t Device::dev_read_gpu_metrics_header_data()
|
||||
|
||||
// Check if/when metrics table needs to be refreshed.
|
||||
auto now_ts = actual_timestamp_in_secs();
|
||||
if ((!m_gpu_metrics_header.m_structure_size) ||
|
||||
(!m_gpu_metrics_header.m_format_revision) ||
|
||||
(!m_gpu_metrics_header.m_content_revision)) {
|
||||
auto op_result = readDevInfo(DevInfoTypes::kDevGpuMetrics,
|
||||
sizeof(AMDGpuMetricsHeader_v1_t),
|
||||
&m_gpu_metrics_header);
|
||||
if ((status_code = ErrnoToRsmiStatus(op_result)) !=
|
||||
rsmi_status_t::RSMI_STATUS_SUCCESS) {
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(m_gpu_metrics_header)
|
||||
<< " | Cause: readDevInfo(kDevGpuMetrics)"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " Could not read Metrics Header: "
|
||||
<< print_unsigned_int(m_gpu_metrics_header.m_structure_size)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
if ((status_code = is_gpu_metrics_version_supported(m_gpu_metrics_header)) ==
|
||||
rsmi_status_t::RSMI_STATUS_NOT_SUPPORTED) {
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(m_gpu_metrics_header)
|
||||
<< " | Cause: gpu metric file version is not supported: "
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " Could not read Metrics Header: "
|
||||
<< print_unsigned_int(m_gpu_metrics_header.m_structure_size)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
|
||||
m_gpu_metrics_updated_timestamp = actual_timestamp_in_secs();
|
||||
auto op_result = readDevInfo(DevInfoTypes::kDevGpuMetrics,
|
||||
sizeof(AMDGpuMetricsHeader_v1_t),
|
||||
&m_gpu_metrics_header);
|
||||
if ((status_code = ErrnoToRsmiStatus(op_result)) !=
|
||||
rsmi_status_t::RSMI_STATUS_SUCCESS) {
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(m_gpu_metrics_header)
|
||||
<< " | Cause: readDevInfo(kDevGpuMetrics)"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " Could not read Metrics Header: "
|
||||
<< print_unsigned_int(m_gpu_metrics_header.m_structure_size)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
if ((status_code = is_gpu_metrics_version_supported(m_gpu_metrics_header)) ==
|
||||
rsmi_status_t::RSMI_STATUS_NOT_SUPPORTED) {
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(m_gpu_metrics_header)
|
||||
<< " | Cause: gpu metric file version is not supported: "
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " Could not read Metrics Header: "
|
||||
<< print_unsigned_int(m_gpu_metrics_header.m_structure_size)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
m_gpu_metrics_updated_timestamp = actual_timestamp_in_secs();
|
||||
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
@@ -2847,23 +2842,21 @@ rsmi_status_t Device::setup_gpu_metrics_reading()
|
||||
}
|
||||
|
||||
//
|
||||
// if/in case setup_gpu_metrics_reading() was called already use the same pointer
|
||||
m_gpu_metrics_ptr.reset();
|
||||
m_gpu_metrics_ptr = amdgpu_metrics_factory(gpu_metrics_flag_version);
|
||||
if (!m_gpu_metrics_ptr) {
|
||||
m_gpu_metrics_ptr = amdgpu_metrics_factory(gpu_metrics_flag_version);
|
||||
if (!m_gpu_metrics_ptr) {
|
||||
status_code = rsmi_status_t::RSMI_STATUS_UNEXPECTED_DATA;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(dev_get_metrics_header())
|
||||
<< " | Cause: amdgpu_metrics_factory() couldn't get a valid metric object"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
status_code = rsmi_status_t::RSMI_STATUS_UNEXPECTED_DATA;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(dev_get_metrics_header())
|
||||
<< " | Cause: amdgpu_metrics_factory() couldn't get a valid metric object"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2943,23 +2936,21 @@ rsmi_status_t Device::dev_log_gpu_metrics(std::ostringstream& outstream_metrics)
|
||||
// meaning, we didn't run any queries, and just want to
|
||||
// print all the gpu metrics content, we need to setup
|
||||
// the environment first.
|
||||
if (!m_gpu_metrics_ptr) {
|
||||
status_code = setup_gpu_metrics_reading();
|
||||
if ((status_code != rsmi_status_t::RSMI_STATUS_SUCCESS) || (!m_gpu_metrics_ptr)) {
|
||||
// At this point we should have a valid gpu_metrics pointer.
|
||||
status_code = rsmi_status_t::RSMI_STATUS_UNEXPECTED_DATA;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(dev_get_metrics_header())
|
||||
<< " | Cause: Couldn't get a valid metric object"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
status_code = setup_gpu_metrics_reading();
|
||||
if ((status_code != rsmi_status_t::RSMI_STATUS_SUCCESS) || (!m_gpu_metrics_ptr)) {
|
||||
// At this point we should have a valid gpu_metrics pointer.
|
||||
status_code = rsmi_status_t::RSMI_STATUS_UNEXPECTED_DATA;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(dev_get_metrics_header())
|
||||
<< " | Cause: Couldn't get a valid metric object"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
|
||||
// Header info
|
||||
@@ -3105,22 +3096,20 @@ rsmi_status_t Device::run_internal_gpu_metrics_query(AMDGpuMetricsUnitType_t met
|
||||
ostrstream << __PRETTY_FUNCTION__ << " | ======= start =======";
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
if (!m_gpu_metrics_ptr) {
|
||||
status_code = setup_gpu_metrics_reading();
|
||||
if ((status_code != rsmi_status_t::RSMI_STATUS_SUCCESS) || (!m_gpu_metrics_ptr)) {
|
||||
status_code = rsmi_status_t::RSMI_STATUS_UNEXPECTED_DATA;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(dev_get_metrics_header())
|
||||
<< " | Cause: Couldn't get a valid metric object"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
status_code = setup_gpu_metrics_reading();
|
||||
if ((status_code != rsmi_status_t::RSMI_STATUS_SUCCESS) || (!m_gpu_metrics_ptr)) {
|
||||
status_code = rsmi_status_t::RSMI_STATUS_UNEXPECTED_DATA;
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << index()
|
||||
<< " | Metric Version: " << stringfy_metrics_header(dev_get_metrics_header())
|
||||
<< " | Cause: Couldn't get a valid metric object"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(status_code)
|
||||
<< " |";
|
||||
LOG_ERROR(ostrstream);
|
||||
return status_code;
|
||||
}
|
||||
|
||||
// Lookup the dynamic table
|
||||
|
||||
@@ -445,20 +445,21 @@ amdsmi_status_t amdsmi_get_gpu_cache_info(
|
||||
|
||||
info->num_cache_types = rsmi_info.num_cache_types;
|
||||
for (unsigned int i =0; i < rsmi_info.num_cache_types; i++) {
|
||||
// convert from sysfs type to CRAT type(HSA Cache Affinity type)
|
||||
info->cache[i].cache_properties = 0;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_DATA)
|
||||
info->cache[i].cache_properties |= AMDSMI_CACHE_PROPERTIES_DATA_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_INSTRUCTION)
|
||||
info->cache[i].cache_properties |= AMDSMI_CACHE_PROPERTIES_INST_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_CPU)
|
||||
info->cache[i].cache_properties |= AMDSMI_CACHE_PROPERTIES_CPU_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_HSACU)
|
||||
info->cache[i].cache_properties |= AMDSMI_CACHE_PROPERTIES_SIMD_CACHE;
|
||||
|
||||
info->cache[i].cache_size = rsmi_info.cache[i].cache_size_kb;
|
||||
info->cache[i].cache_level = rsmi_info.cache[i].cache_level;
|
||||
info->cache[i].max_num_cu_shared = rsmi_info.cache[i].max_num_cu_shared;
|
||||
info->cache[i].num_cache_instance = rsmi_info.cache[i].num_cache_instance;
|
||||
// convert from sysfs type to CRAT type(HSA Cache Affinity type)
|
||||
info->cache[i].properties = 0;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_DATA)
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_DATA_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_INSTRUCTION)
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_INST_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_CPU)
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_CPU_CACHE;
|
||||
if (rsmi_info.cache[i].flags & HSA_CACHE_TYPE_HSACU)
|
||||
info->cache[i].properties |= CACHE_PROPERTIES_SIMD_CACHE;
|
||||
}
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
@@ -1108,6 +1109,17 @@ amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_han
|
||||
reinterpret_cast<rsmi_ras_err_state_t*>(state));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_metrics_header_info(amdsmi_processor_handle processor_handle,
|
||||
amd_metrics_table_header_t *header_value)
|
||||
{
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
return rsmi_wrapper(rsmi_dev_metrics_header_info_get, processor_handle,
|
||||
reinterpret_cast<metrics_table_header_t*>(header_value));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_gpu_metrics_info(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
amdsmi_gpu_metrics_t *pgpu_metrics) {
|
||||
@@ -3004,7 +3016,7 @@ amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_processor_handle processor
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_status_t amdsmi_get_hsmp_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *metrics_version)
|
||||
{
|
||||
amdsmi_status_t status;
|
||||
@@ -3024,8 +3036,8 @@ amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle process
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_hsmp_metric_table_t *metrics_table)
|
||||
amdsmi_status_t amdsmi_get_hsmp_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_hsmp_metrics_table_t *metrics_table)
|
||||
{
|
||||
amdsmi_status_t status;
|
||||
struct hsmp_metric_table metrics_tbl;
|
||||
@@ -3036,7 +3048,7 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handl
|
||||
if (processor_handle == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
if(sizeof(amdsmi_hsmp_metric_table_t) != sizeof(struct hsmp_metric_table))
|
||||
if(sizeof(amdsmi_hsmp_metrics_table_t) != sizeof(struct hsmp_metric_table))
|
||||
return AMDSMI_STATUS_UNEXPECTED_SIZE;
|
||||
|
||||
amdsmi_status_t r = amdsmi_get_processor_info(processor_handle, SIZE, proc_id);
|
||||
@@ -3049,7 +3061,7 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handl
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return amdsmi_errno_to_esmi_status(status);
|
||||
|
||||
std::memcpy(metrics_table, &metrics_tbl, sizeof(amdsmi_hsmp_metric_table_t));
|
||||
std::memcpy(metrics_table, &metrics_tbl, sizeof(amdsmi_hsmp_metrics_table_t));
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -349,6 +349,23 @@ void TestGpuMetricsRead::Run(void) {
|
||||
<< static_cast<uint32_t>(smu.pcie_nak_rcvd_count_acc) << "\n";
|
||||
std::cout << "pcie_replay_rover_count_acc= " << std::dec
|
||||
<< static_cast<uint64_t>(smu.pcie_replay_rover_count_acc) << "\n";
|
||||
|
||||
// Check for constant changes/refresh metrics
|
||||
std::cout << "\n";
|
||||
std::cout << "\t ** -> Checking metrics with constant changes ** " << "\n";
|
||||
constexpr uint16_t kMAX_ITER_TEST = 10;
|
||||
amdsmi_gpu_metrics_t gpu_metrics_check;
|
||||
for (auto idx = uint16_t(1); idx <= kMAX_ITER_TEST; ++idx) {
|
||||
amdsmi_get_gpu_metrics_info(processor_handles_[i], &gpu_metrics_check);
|
||||
std::cout << "\t\t -> firmware_timestamp [" << idx << "/" << kMAX_ITER_TEST << "]: " << gpu_metrics_check.firmware_timestamp << "\n";
|
||||
}
|
||||
|
||||
std::cout << "\n";
|
||||
for (auto idx = uint16_t(1); idx <= kMAX_ITER_TEST; ++idx) {
|
||||
amdsmi_get_gpu_metrics_info(processor_handles_[i], &gpu_metrics_check);
|
||||
std::cout << "\t\t -> system_clock_counter [" << idx << "/" << kMAX_ITER_TEST << "]: " << gpu_metrics_check.system_clock_counter << "\n";
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user