SWDEV-384793 - Clean up API
Change-Id: I441b315d32df59a454e06d521e5ca8b2c229451a Signed-off-by: Dalibor Stanisavljevic <Dalibor.Stanisavljevic@amd.com>
Этот коммит содержится в:
коммит произвёл
Cedomir Dimic
родитель
ca7f965018
Коммит
1bc1d431d8
@@ -216,7 +216,6 @@ class AMDSMICommands():
|
||||
if args.asic:
|
||||
try:
|
||||
asic_info = amdsmi_interface.amdsmi_get_asic_info(args.gpu)
|
||||
asic_info['family'] = hex(asic_info['family'])
|
||||
asic_info['vendor_id'] = hex(asic_info['vendor_id'])
|
||||
asic_info['device_id'] = hex(asic_info['device_id'])
|
||||
asic_info['rev_id'] = hex(asic_info['rev_id'])
|
||||
@@ -255,10 +254,9 @@ class AMDSMICommands():
|
||||
try:
|
||||
vbios_info = amdsmi_interface.amdsmi_get_vbios_info(args.gpu)
|
||||
if self.logger.is_gpuvsmi_compatibility():
|
||||
vbios_info['version'] = vbios_info.pop('vbios_version_string')
|
||||
vbios_info['version'] = vbios_info.pop('version')
|
||||
vbios_info['build_date'] = vbios_info.pop('build_date')
|
||||
vbios_info['part_number'] = vbios_info.pop('part_number')
|
||||
vbios_info['vbios_version'] = vbios_info.pop('vbios_version')
|
||||
|
||||
static_dict['vbios'] = vbios_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
@@ -351,23 +349,7 @@ class AMDSMICommands():
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
if args.caps:
|
||||
try:
|
||||
caps_info = amdsmi_interface.amdsmi_get_caps_info(args.gpu)
|
||||
caps_info.pop('mm_ip_list')
|
||||
caps_info.pop('ras_supported')
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
for capability_name, capability_value in caps_info.items():
|
||||
if isinstance(capability_value, list):
|
||||
caps_info[capability_name] = f"{capability_value}"
|
||||
if isinstance(capability_value, bool):
|
||||
caps_info[capability_name] = f"{bool(capability_value)}"
|
||||
|
||||
static_dict['caps'] = caps_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['caps'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
pass
|
||||
if (self.helpers.is_linux() and self.helpers.is_baremetal()):
|
||||
if args.numa:
|
||||
try:
|
||||
@@ -1055,18 +1037,7 @@ class AMDSMICommands():
|
||||
elif not self.all_arguments:
|
||||
raise e
|
||||
if args.energy:
|
||||
try:
|
||||
energy = amdsmi_interface.amdsmi_get_power_info(args.gpu)['energy_accumulator']
|
||||
|
||||
if self.logger.is_human_readable_format():
|
||||
unit = 'J'
|
||||
energy = f"{energy} {unit}"
|
||||
|
||||
values_dict['energy'] = energy
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
values_dict['energy'] = e.get_error_info()
|
||||
if not self.all_arguments:
|
||||
raise e
|
||||
pass
|
||||
if args.mem_usage:
|
||||
memory_total = {}
|
||||
try:
|
||||
|
||||
@@ -286,7 +286,6 @@ int main() {
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_asic_info:\n");
|
||||
printf("\tMarket Name: %s\n", asic_info.market_name);
|
||||
printf("\tFamilyID: 0x%x\n", asic_info.family);
|
||||
printf("\tDeviceID: 0x%lx\n", asic_info.device_id);
|
||||
printf("\tVendorID: 0x%x\n", asic_info.vendor_id);
|
||||
printf("\tRevisionID: 0x%x\n", asic_info.rev_id);
|
||||
@@ -300,9 +299,8 @@ int main() {
|
||||
printf("\tVBios Name: %s\n", vbios_info.name);
|
||||
printf("\tBuild Date: %s\n", vbios_info.build_date);
|
||||
printf("\tPart Number: %s\n", vbios_info.part_number);
|
||||
printf("\tVBios Version: %d\n", vbios_info.vbios_version);
|
||||
printf("\tVBios Version String: %s\n\n",
|
||||
vbios_info.vbios_version_string);
|
||||
vbios_info.version);
|
||||
|
||||
// Get power measure
|
||||
amdsmi_power_info_t power_measure = {};
|
||||
@@ -313,8 +311,6 @@ int main() {
|
||||
power_measure.gfx_voltage);
|
||||
printf("\tAverage socket power: %d\n",
|
||||
power_measure.average_socket_power);
|
||||
printf("\tEnergy accumulator: %ld\n\n",
|
||||
power_measure.energy_accumulator);
|
||||
printf("\tGPU Power limit: %d\n\n", power_measure.power_limit);
|
||||
|
||||
// Get driver version
|
||||
@@ -341,7 +337,7 @@ int main() {
|
||||
printf("\tAverage GFX Activity: %d\n",
|
||||
engine_usage.gfx_activity);
|
||||
printf("\tAverage MM Activity: %d\n",
|
||||
engine_usage.mm_activity[0]);
|
||||
engine_usage.mm_activity);
|
||||
printf("\tAverage UMC Activity: %d\n\n",
|
||||
engine_usage.umc_activity);
|
||||
|
||||
@@ -364,7 +360,6 @@ int main() {
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_clock_info:\n");
|
||||
printf("\tGPU GFX Max Clock: %d\n", gfx_clk_values.max_clk);
|
||||
printf("\tGPU GFX Average Clock: %d\n", gfx_clk_values.avg_clk);
|
||||
printf("\tGPU GFX Current Clock: %d\n", gfx_clk_values.cur_clk);
|
||||
|
||||
// Get MEM clock measurements
|
||||
@@ -373,7 +368,6 @@ int main() {
|
||||
&mem_clk_values);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf("\tGPU MEM Max Clock: %d\n", mem_clk_values.max_clk);
|
||||
printf("\tGPU MEM Average Clock: %d\n", mem_clk_values.avg_clk);
|
||||
printf("\tGPU MEM Current Clock: %d\n\n", mem_clk_values.cur_clk);
|
||||
|
||||
// Get PCIe status
|
||||
@@ -524,7 +518,7 @@ int main() {
|
||||
amdsmi_proc_info_t info_list[num_process];
|
||||
amdsmi_proc_info_t process = {};
|
||||
uint64_t mem = 0, gtt_mem = 0, cpu_mem = 0, vram_mem = 0;
|
||||
uint64_t gfx = 0, comp = 0, dma = 0, enc = 0, dec = 0;
|
||||
uint64_t gfx = 0, enc = 0;
|
||||
char bdf_str[20];
|
||||
sprintf(bdf_str, "%04lx:%02x:%02x.%d", bdf.domain_number,
|
||||
bdf.bus_number, bdf.device_number, bdf.function_number);
|
||||
@@ -556,8 +550,8 @@ int main() {
|
||||
"engine usage (ns) |\n");
|
||||
printf("| | | | "
|
||||
"| | | | "
|
||||
" | gfx comp dma enc dec |\n");
|
||||
printf("+=======+==================+============+=============="
|
||||
" | gfx enc |\n");
|
||||
printf("+=======+"
|
||||
"+=============+=============+=============+============"
|
||||
"==+=========================================+\n");
|
||||
for (int it = 0; it < num; it++) {
|
||||
@@ -571,41 +565,30 @@ int main() {
|
||||
pwd = getpwuid(st.st_uid);
|
||||
if (!pwd)
|
||||
printf("| %5d | %16s | %10d | %s | %7ld KiB | %7ld KiB "
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu %lu "
|
||||
"%lu %lu |\n",
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu |\n",
|
||||
info_list[it].pid, info_list[it].name, st.st_uid,
|
||||
bdf_str, info_list[it].mem / 1024,
|
||||
info_list[it].memory_usage.gtt_mem / 1024,
|
||||
info_list[it].memory_usage.cpu_mem / 1024,
|
||||
info_list[it].memory_usage.vram_mem / 1024,
|
||||
info_list[it].engine_usage.gfx,
|
||||
info_list[it].engine_usage.compute,
|
||||
info_list[it].engine_usage.dma,
|
||||
info_list[it].engine_usage.enc,
|
||||
info_list[it].engine_usage.dec);
|
||||
info_list[it].engine_usage.enc);
|
||||
else
|
||||
printf("| %5d | %16s | %10s | %s | %7ld KiB | %7ld KiB "
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu %lu "
|
||||
"%lu %lu |\n",
|
||||
"| %7ld KiB | %7ld KiB | %lu %lu |\n",
|
||||
info_list[it].pid, info_list[it].name,
|
||||
pwd->pw_name, bdf_str, info_list[it].mem / 1024,
|
||||
info_list[it].memory_usage.gtt_mem / 1024,
|
||||
info_list[it].memory_usage.cpu_mem / 1024,
|
||||
info_list[it].memory_usage.vram_mem / 1024,
|
||||
info_list[it].engine_usage.gfx,
|
||||
info_list[it].engine_usage.compute,
|
||||
info_list[it].engine_usage.dma,
|
||||
info_list[it].engine_usage.enc,
|
||||
info_list[it].engine_usage.dec);
|
||||
info_list[it].engine_usage.enc);
|
||||
mem += info_list[it].mem / 1024;
|
||||
gtt_mem += info_list[it].memory_usage.gtt_mem / 1024;
|
||||
cpu_mem += info_list[it].memory_usage.cpu_mem / 1024;
|
||||
vram_mem += info_list[it].memory_usage.vram_mem / 1024;
|
||||
gfx = info_list[it].engine_usage.gfx;
|
||||
comp = info_list[it].engine_usage.compute;
|
||||
dma = info_list[it].engine_usage.dma;
|
||||
enc = info_list[it].engine_usage.enc;
|
||||
dec = info_list[it].engine_usage.dec;
|
||||
printf(
|
||||
"+-------+------------------+------------+-------------"
|
||||
"-+-------------+-------------+-------------+----------"
|
||||
@@ -614,8 +597,8 @@ int main() {
|
||||
printf("| TOTAL:| %s | %7ld "
|
||||
"KiB | %7ld KiB | %7ld KiB | %7ld KiB | %lu %lu "
|
||||
"%lu %lu %lu |\n",
|
||||
bdf_str, mem, gtt_mem, cpu_mem, vram_mem, gfx, comp, dma,
|
||||
enc, dec);
|
||||
bdf_str, mem, gtt_mem, cpu_mem, vram_mem, gfx,
|
||||
enc);
|
||||
printf("+=======+==================+============+=============="
|
||||
"+=============+=============+=============+============"
|
||||
"=+==========================================+\n");
|
||||
@@ -651,22 +634,6 @@ int main() {
|
||||
std::cout << "\t\tFrame buffer usage (MB): " << vram_usage.vram_used
|
||||
<< "/" << vram_usage.vram_total << "\n\n";
|
||||
|
||||
// Get Cap info
|
||||
amdsmi_gpu_caps_t caps_info = {};
|
||||
ret = amdsmi_get_caps_info(processor_handles[j], &caps_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_caps_info:\n");
|
||||
std::cout << "\t\tGFX IP Major: " << caps_info.gfx.gfxip_major
|
||||
<< "\n"
|
||||
<< "\t\tGFX IP Minor: " << caps_info.gfx.gfxip_minor
|
||||
<< "\n"
|
||||
<< "\t\tCU IP Count: " << caps_info.gfx.gfxip_cu_count
|
||||
<< "\n"
|
||||
<< "\t\tDMA IP Count: " << caps_info.dma_ip_count << "\n"
|
||||
<< "\t\tGFX IP Count: " << caps_info.gfx_ip_count << "\n"
|
||||
<< "\t\tMM IP Count: " << int(caps_info.mm.mm_ip_count)
|
||||
<< "\n\n";
|
||||
|
||||
amdsmi_power_cap_info_t cap_info = {};
|
||||
ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
@@ -131,7 +131,6 @@ int main() {
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_asic_info:\n");
|
||||
printf("\tMarket Name: %s\n", asic_info.market_name);
|
||||
printf("\tFamilyID: 0x%x\n", asic_info.family);
|
||||
printf("\tDeviceID: 0x%lx\n", asic_info.device_id);
|
||||
printf("\tVendorID: 0x%x\n", asic_info.vendor_id);
|
||||
printf("\tRevisionID: 0x%x\n", asic_info.rev_id);
|
||||
@@ -145,9 +144,8 @@ int main() {
|
||||
printf("\tVBios Name: %s\n", vbios_info.name);
|
||||
printf("\tBuild Date: %s\n", vbios_info.build_date);
|
||||
printf("\tPart Number: %s\n", vbios_info.part_number);
|
||||
printf("\tVBios Version: %d\n", vbios_info.vbios_version);
|
||||
printf("\tVBios Version String: %s\n\n",
|
||||
vbios_info.vbios_version_string);
|
||||
vbios_info.version);
|
||||
|
||||
// Get engine usage info
|
||||
amdsmi_engine_usage_t engine_usage = {};
|
||||
@@ -157,7 +155,7 @@ int main() {
|
||||
printf("\tAverage GFX Activity: %d\n",
|
||||
engine_usage.gfx_activity);
|
||||
printf("\tAverage MM Activity: %d\n",
|
||||
engine_usage.mm_activity[0]);
|
||||
engine_usage.mm_activity);
|
||||
printf("\tAverage UMC Activity: %d\n\n",
|
||||
engine_usage.umc_activity);
|
||||
|
||||
@@ -315,22 +313,6 @@ int main() {
|
||||
std::cout << "\t\tFrame buffer usage (MB): " << vram_usage.vram_used
|
||||
<< "/" << vram_usage.vram_total << "\n\n";
|
||||
|
||||
// Get Cap info
|
||||
amdsmi_gpu_caps_t caps_info = {};
|
||||
ret = amdsmi_get_caps_info(processor_handles[j], &caps_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_caps_info:\n");
|
||||
std::cout << "\t\tGFX IP Major: " << caps_info.gfx.gfxip_major
|
||||
<< "\n"
|
||||
<< "\t\tGFX IP Minor: " << caps_info.gfx.gfxip_minor
|
||||
<< "\n"
|
||||
<< "\t\tCU IP Count: " << caps_info.gfx.gfxip_cu_count
|
||||
<< "\n"
|
||||
<< "\t\tDMA IP Count: " << caps_info.dma_ip_count << "\n"
|
||||
<< "\t\tGFX IP Count: " << caps_info.gfx_ip_count << "\n"
|
||||
<< "\t\tMM IP Count: " << int(caps_info.mm.mm_ip_count)
|
||||
<< "\n\n";
|
||||
|
||||
amdsmi_power_cap_info_t cap_info = {};
|
||||
ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
|
||||
@@ -284,29 +284,6 @@ typedef struct {
|
||||
uint32_t reserved[9];
|
||||
} amdsmi_xgmi_info_t;
|
||||
|
||||
/**
|
||||
* GPU Capability info
|
||||
*/
|
||||
typedef struct {
|
||||
struct {
|
||||
uint32_t gfxip_major;
|
||||
uint32_t gfxip_minor;
|
||||
uint16_t gfxip_cu_count;
|
||||
uint32_t reserved[5];
|
||||
} gfx;
|
||||
struct {
|
||||
uint8_t mm_ip_count;
|
||||
uint8_t mm_ip_list[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint32_t reserved[5];
|
||||
} mm;
|
||||
|
||||
bool ras_supported;
|
||||
uint8_t max_vf_num;
|
||||
uint32_t gfx_ip_count;
|
||||
uint32_t dma_ip_count;
|
||||
uint32_t reserved[5];
|
||||
} amdsmi_gpu_caps_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t vram_total;
|
||||
uint32_t vram_used;
|
||||
@@ -339,10 +316,9 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
char name[AMDSMI_MAX_STRING_LENGTH];
|
||||
uint32_t vbios_version;
|
||||
char build_date[AMDSMI_MAX_DATE_LENGTH];
|
||||
char part_number[AMDSMI_MAX_STRING_LENGTH];
|
||||
char vbios_version_string[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
char version[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
uint32_t reserved[15];
|
||||
} amdsmi_vbios_info_t;
|
||||
|
||||
@@ -358,7 +334,6 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
char market_name[AMDSMI_MAX_STRING_LENGTH];
|
||||
uint32_t family; /**< Has zero value */
|
||||
uint32_t vendor_id; //< Use 32 bit to be compatible with other platform.
|
||||
uint32_t subvendor_id; //< The subsystem vendor id
|
||||
uint64_t device_id; //< The unique id of a GPU
|
||||
@@ -378,17 +353,15 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint32_t average_socket_power;
|
||||
uint64_t energy_accumulator; // v1 mod. (32->64)
|
||||
uint32_t gfx_voltage; // GFX voltage measurement in mV
|
||||
uint32_t soc_voltage; // SOC voltage measurement in mV
|
||||
uint32_t mem_voltage; // MEM voltage measurement in mV
|
||||
uint32_t power_limit; // The power limit;
|
||||
uint32_t reserved[9];
|
||||
uint32_t reserved[11];
|
||||
} amdsmi_power_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t cur_clk;
|
||||
uint32_t avg_clk;
|
||||
uint32_t min_clk;
|
||||
uint32_t max_clk;
|
||||
uint32_t reserved[4];
|
||||
@@ -397,8 +370,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint32_t gfx_activity;
|
||||
uint32_t umc_activity;
|
||||
uint32_t mm_activity[AMDSMI_MAX_MM_IP_COUNT];
|
||||
uint32_t reserved[6];
|
||||
uint32_t mm_activity;
|
||||
uint32_t reserved[13];
|
||||
} amdsmi_engine_usage_t;
|
||||
|
||||
typedef uint32_t amdsmi_process_handle;
|
||||
@@ -409,10 +382,7 @@ typedef struct {
|
||||
uint64_t mem; /** in bytes */
|
||||
struct {
|
||||
uint64_t gfx;
|
||||
uint64_t compute;
|
||||
uint64_t dma;
|
||||
uint64_t enc;
|
||||
uint64_t dec;
|
||||
} engine_usage; /** How much time the process spend using these engines in ns */
|
||||
struct {
|
||||
uint64_t gtt_mem;
|
||||
@@ -420,7 +390,7 @@ typedef struct {
|
||||
uint64_t vram_mem;
|
||||
} memory_usage; /** in bytes */
|
||||
char container_name[AMDSMI_NORMAL_STRING_LENGTH];
|
||||
uint32_t reserved[10];
|
||||
uint32_t reserved[4];
|
||||
} amdsmi_proc_info_t;
|
||||
|
||||
//! Guaranteed maximum possible number of supported frequencies
|
||||
@@ -1625,30 +1595,6 @@ amdsmi_status_t amdsmi_set_gpu_pci_bandwidth(amdsmi_processor_handle processor_
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get the average power consumption of a processor
|
||||
*
|
||||
* @details This function will write the current average power consumption
|
||||
* (in microwatts) to the uint64_t pointed to by @p power, for the given
|
||||
* processor handle @p processor_handle and a pointer to a uint64_t @p power
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
|
||||
* If a processor has more than one sensor, it could be greater than 0.
|
||||
*
|
||||
* @param[in,out] power a pointer to uint64_t to which the average power
|
||||
* consumption will be written
|
||||
* If this parameter is nullptr, this function will return
|
||||
* ::AMDSMI_STATUS_INVAL if the function is supported with the provided,
|
||||
* arguments and ::AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the
|
||||
* provided arguments.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_power_ave(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t *power);
|
||||
|
||||
/**
|
||||
* @brief Get the energy accumulator counter of the processor with provided
|
||||
* processor handle.
|
||||
@@ -3621,7 +3567,7 @@ amdsmi_get_gpu_driver_version(amdsmi_processor_handle processor_handle, int *len
|
||||
* @brief Returns the ASIC information for the device
|
||||
*
|
||||
* @details This function returns ASIC information such as the product name,
|
||||
* the family, the vendor ID, the subvendor ID, the device ID,
|
||||
* the vendor ID, the subvendor ID, the device ID,
|
||||
* the revision ID and the serial number.
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
@@ -3677,20 +3623,6 @@ amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle, uint32_t sen
|
||||
amdsmi_status_t
|
||||
amdsmi_get_xgmi_info(amdsmi_processor_handle processor_handle, amdsmi_xgmi_info_t *info);
|
||||
|
||||
/**
|
||||
* @brief Returns the device capabilities as currently configured in
|
||||
* the system
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
*
|
||||
* @param[out] info Reference to caps information structure. Must be
|
||||
* allocated by user.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_caps_info(amdsmi_processor_handle processor_handle, amdsmi_gpu_caps_t *info);
|
||||
|
||||
/** @} End asicinfo */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -295,7 +295,6 @@ Output: Dictionary with fields
|
||||
Field | Content
|
||||
---|---
|
||||
`market_name` | market name
|
||||
`family` | family
|
||||
`vendor_id` | vendor id
|
||||
`device_id` | device id
|
||||
`rev_id` | revision id
|
||||
@@ -316,7 +315,6 @@ try:
|
||||
for device in devices:
|
||||
asic_info = amdsmi_get_gpu_asic_info(device)
|
||||
print(asic_info['market_name'])
|
||||
print(hex(asic_info['family']))
|
||||
print(hex(asic_info['vendor_id']))
|
||||
print(hex(asic_info['device_id']))
|
||||
print(hex(asic_info['rev_id']))
|
||||
@@ -364,46 +362,6 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_caps_info
|
||||
Description: Returns capabilities as currently configured for the given GPU
|
||||
|
||||
Input parameters:
|
||||
* `processor_handle` device which to query
|
||||
|
||||
Output: Dictionary with fields
|
||||
|
||||
Field | Description
|
||||
---|---
|
||||
`gfx` | <table> <thead><tr><th> Subfield </th><th>Description</th></tr></thead><tbody><tr><td>`gfxip_major`</td><td> major revision of GFX IP</td></tr><tr><td>`gfxip_minor`</td><td>minor revision of GFX IP</td></tr><tr><td>`gfxip_cu_count`</td><td>number of GFX compute units</td></tr></tbody></table>
|
||||
`mm_ip_list` | List of MM engines on the device, of AmdSmiMmIp type
|
||||
`ras_supported` | `True` if ecc is supported, `False` if not
|
||||
`gfx_ip_count` | Number of GFX engines on the device
|
||||
`dma_ip_count` | Number of DMA engines on the device
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_caps_info` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
```python
|
||||
try:
|
||||
devices = amdsmi_get_processor_handles()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
caps_info = amdsmi_get_caps_info(device)
|
||||
print(caps_info['ras_supported'])
|
||||
print(caps_info['gfx']['gfxip_major'])
|
||||
print(caps_info['gfx']['gfxip_minor'])
|
||||
print(caps_info['gfx']['gfxip_cu_count'])
|
||||
print(caps_info['mm_ip_list'])
|
||||
print(caps_info['gfx_ip_count'])
|
||||
print(caps_info['dma_ip_count'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_gpu_vbios_info
|
||||
Description: Returns the static information for the VBIOS on the device.
|
||||
@@ -416,10 +374,9 @@ Output: Dictionary with fields
|
||||
Field | Description
|
||||
---|---
|
||||
`name` | vbios name
|
||||
`vbios_version` | vbios current version
|
||||
`build_date` | vbios build date
|
||||
`part_number` | vbios part number
|
||||
`vbios_version_string` | vbios version string
|
||||
`version` | vbios version string
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_vbios_info` function:
|
||||
* `AmdSmiLibraryException`
|
||||
@@ -436,10 +393,9 @@ try:
|
||||
for device in devices:
|
||||
vbios_info = amdsmi_get_gpu_vbios_info(device)
|
||||
print(vbios_info['name'])
|
||||
print(vbios_info['vbios_version'])
|
||||
print(vbios_info['build_date'])
|
||||
print(vbios_info['part_number'])
|
||||
print(vbios_info['vbios_version_string'])
|
||||
print(vbios_info['version'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
@@ -489,7 +445,7 @@ Field | Description
|
||||
---|---
|
||||
`gfx_activity`| graphics engine usage percentage (0 - 100)
|
||||
`umc_activity` | memory engine usage percentage (0 - 100)
|
||||
`mm_activity` | list of multimedia engine usages in percentage (0 - 100)
|
||||
`mm_activity` | average multimedia engine usages in percentage (0 - 100)
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_activity` function:
|
||||
* `AmdSmiLibraryException`
|
||||
@@ -523,7 +479,6 @@ Field | Description
|
||||
---|---
|
||||
`average_socket_power`| average socket power
|
||||
`gfx_voltage` | voltage gfx
|
||||
`energy_accumulator` | energy accumulator
|
||||
`power_limit` | power limit
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_power_info` function:
|
||||
@@ -542,7 +497,6 @@ try:
|
||||
power_measure = amdsmi_get_power_info(device)
|
||||
print(power_measure['average_socket_power'])
|
||||
print(power_measure['gfx_voltage'])
|
||||
print(power_measure['energy_accumulator'])
|
||||
print(power_measure['power_limit'])
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
@@ -605,7 +559,6 @@ Output: Dictionary with fields
|
||||
Field | Description
|
||||
---|---
|
||||
`cur_clk`| Current clock for given clock type
|
||||
`avg_clk` | Average clock for given clock type
|
||||
`min_clk` | Minimum clock for given clock type
|
||||
`max_clk` | Maximum clock for given clock type
|
||||
|
||||
@@ -624,7 +577,6 @@ try:
|
||||
for device in devices:
|
||||
clock_measure = amdsmi_get_clock_info(device, AmdSmiClkType.GFX)
|
||||
print(clock_measure['cur_clk'])
|
||||
print(clock_measure['avg_clk'])
|
||||
print(clock_measure['min_clk'])
|
||||
print(clock_measure['max_clk'])
|
||||
except AmdSmiException as e:
|
||||
@@ -852,7 +804,7 @@ Field | Description
|
||||
`name` | Name of process
|
||||
`pid` | Process ID
|
||||
`mem` | Process memory usage
|
||||
`engine_usage`| <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gfx`</td><td>GFX engine usage in ns</td></tr><tr><td>`compute`</td><td>Compute engine usage in ns</td></tr><tr><td>`dma`</td><td>DMA engine usage in ns </td></tr><tr><td>`enc`</td><td>Encode engine usage in ns</td></tr><tr><td>`dec`</td><td>Decode engine usage in ns</td></tr></tbody></table>
|
||||
`engine_usage`| <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gfx`</td><td>GFX engine usage in ns</td></tr><tr><td>`enc`</td><td>Encode engine usage in ns</td></tr></tbody></table>
|
||||
`memory_usage`| <table><thead><tr> <th> Subfield </th> <th> Description</th> </tr></thead><tbody><tr><td>`gtt_mem`</td><td>GTT memory usage</td></tr><tr><td>`cpu_mem`</td><td>CPU memory usage</td></tr><tr><td>`vram_mem`</td><td>VRAM memory usage</td></tr> </tbody></table>
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_gpu_process_info` function:
|
||||
@@ -1490,37 +1442,6 @@ except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
## amdsmi_get_power_ave
|
||||
|
||||
Description: Get the average power consumption of the device
|
||||
|
||||
Input parameters:
|
||||
|
||||
* `processor_handle` device which to query
|
||||
* `sensor_id` a 0-based sensor index. Normally, this will be 0.
|
||||
If a device has more than one sensor, it could be greater than 0.
|
||||
|
||||
Output: the average power consumption
|
||||
|
||||
Exceptions that can be thrown by `amdsmi_get_power_ave` function:
|
||||
* `AmdSmiLibraryException`
|
||||
* `AmdSmiRetryException`
|
||||
* `AmdSmiParameterException`
|
||||
|
||||
Example:
|
||||
```python
|
||||
try:
|
||||
devices = gpuvsmi_get_devices()
|
||||
if len(devices) == 0:
|
||||
print("No GPUs on machine")
|
||||
else:
|
||||
for device in devices:
|
||||
power = amdsmi_get_power_ave(device)
|
||||
print(power)
|
||||
except AmdSmiException as e:
|
||||
print(e)
|
||||
```
|
||||
|
||||
|
||||
## amdsmi_get_energy_count
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ from .amdsmi_interface import amdsmi_get_gpu_driver_version
|
||||
# # ASIC and Bus Static Information
|
||||
from .amdsmi_interface import amdsmi_get_gpu_asic_info
|
||||
from .amdsmi_interface import amdsmi_get_power_cap_info
|
||||
from .amdsmi_interface import amdsmi_get_caps_info
|
||||
|
||||
# # Microcode and VBIOS Information
|
||||
from .amdsmi_interface import amdsmi_get_gpu_vbios_info
|
||||
@@ -144,7 +143,6 @@ from .amdsmi_interface import amdsmi_get_gpu_pci_replay_counter
|
||||
from .amdsmi_interface import amdsmi_get_gpu_topo_numa_affinity
|
||||
|
||||
# # Power information
|
||||
from .amdsmi_interface import amdsmi_get_power_ave
|
||||
from .amdsmi_interface import amdsmi_get_energy_count
|
||||
|
||||
# # Memory information
|
||||
|
||||
@@ -597,7 +597,6 @@ def amdsmi_get_gpu_asic_info(
|
||||
|
||||
return {
|
||||
"market_name": asic_info.market_name.decode("utf-8"),
|
||||
"family": asic_info.family,
|
||||
"vendor_id": asic_info.vendor_id,
|
||||
"device_id": asic_info.device_id,
|
||||
"rev_id": asic_info.rev_id,
|
||||
@@ -626,32 +625,6 @@ def amdsmi_get_power_cap_info(
|
||||
"min_power_cap": power_info.min_power_cap,
|
||||
"max_power_cap": power_info.max_power_cap}
|
||||
|
||||
def amdsmi_get_caps_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
) -> Dict[str, Any]:
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
raise AmdSmiParameterException(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
gpu_caps = amdsmi_wrapper.amdsmi_gpu_caps_t()
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_caps_info(
|
||||
processor_handle, ctypes.byref(gpu_caps))
|
||||
)
|
||||
|
||||
return {
|
||||
"gfx": {
|
||||
"gfxip_major": gpu_caps.gfx.gfxip_major,
|
||||
"gfxip_minor": gpu_caps.gfx.gfxip_minor,
|
||||
"gfxip_cu_count": gpu_caps.gfx.gfxip_cu_count,
|
||||
},
|
||||
"mm_ip_list": list(gpu_caps.mm.mm_ip_list),
|
||||
"ras_supported": gpu_caps.ras_supported,
|
||||
"gfx_ip_count": gpu_caps.gfx_ip_count,
|
||||
"dma_ip_count": gpu_caps.dma_ip_count,
|
||||
}
|
||||
|
||||
|
||||
def amdsmi_get_gpu_vbios_info(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
@@ -669,10 +642,9 @@ def amdsmi_get_gpu_vbios_info(
|
||||
|
||||
return {
|
||||
"name": vbios_info.name.decode("utf-8"),
|
||||
"vbios_version_string": vbios_info.vbios_version_string.decode("utf-8"),
|
||||
"version": vbios_info.version.decode("utf-8"),
|
||||
"build_date": vbios_info.build_date.decode("utf-8"),
|
||||
"part_number": vbios_info.part_number.decode("utf-8"),
|
||||
"vbios_version": vbios_info.vbios_version,
|
||||
}
|
||||
|
||||
|
||||
@@ -694,7 +666,7 @@ def amdsmi_get_gpu_activity(
|
||||
return {
|
||||
"gfx_activity": engine_usage.gfx_activity,
|
||||
"umc_activity": engine_usage.umc_activity,
|
||||
"mm_activity": list(engine_usage.mm_activity),
|
||||
"mm_activity": engine_usage.mm_activity,
|
||||
}
|
||||
|
||||
|
||||
@@ -720,7 +692,6 @@ def amdsmi_get_clock_info(
|
||||
|
||||
return {
|
||||
"cur_clk": clock_measure.cur_clk,
|
||||
"avg_clk": clock_measure.avg_clk,
|
||||
"min_clk": clock_measure.min_clk,
|
||||
"max_clk": clock_measure.max_clk,
|
||||
}
|
||||
@@ -907,10 +878,7 @@ def amdsmi_get_gpu_process_info(
|
||||
"mem": info.mem,
|
||||
"engine_usage": {
|
||||
"gfx": info.engine_usage.gfx,
|
||||
"compute": info.engine_usage.compute,
|
||||
"dma": info.engine_usage.dma,
|
||||
"enc": info.engine_usage.enc,
|
||||
"dec": info.engine_usage.dec,
|
||||
"enc": info.engine_usage.enc
|
||||
},
|
||||
"memory_usage": {
|
||||
"gtt_mem": info.memory_usage.gtt_mem,
|
||||
@@ -980,7 +948,6 @@ def amdsmi_get_power_info(
|
||||
return {
|
||||
"average_socket_power": power_measure.average_socket_power,
|
||||
"gfx_voltage": power_measure.gfx_voltage,
|
||||
"energy_accumulator": power_measure.energy_accumulator,
|
||||
"power_limit" : power_measure.power_limit,
|
||||
}
|
||||
|
||||
@@ -1838,22 +1805,6 @@ def amdsmi_set_power_cap(
|
||||
)
|
||||
|
||||
|
||||
def amdsmi_get_power_ave(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_id: ctypes.c_uint32):
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
raise AmdSmiParameterException(
|
||||
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
|
||||
)
|
||||
|
||||
power = ctypes.c_uint64()
|
||||
|
||||
_check_res(
|
||||
amdsmi_wrapper.amdsmi_get_power_ave(
|
||||
processor_handle, sensor_id, ctypes.byref(power))
|
||||
)
|
||||
|
||||
return power.value
|
||||
|
||||
|
||||
def amdsmi_set_gpu_power_profile(
|
||||
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
|
||||
reserved: int,
|
||||
|
||||
@@ -498,49 +498,11 @@ struct_c__SA_amdsmi_xgmi_info_t._fields_ = [
|
||||
('xgmi_hive_id', ctypes.c_uint64),
|
||||
('xgmi_node_id', ctypes.c_uint64),
|
||||
('index', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 9),
|
||||
('number_adapters', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 8),
|
||||
]
|
||||
|
||||
amdsmi_xgmi_info_t = struct_c__SA_amdsmi_xgmi_info_t
|
||||
class struct_c__SA_amdsmi_gpu_caps_t(Structure):
|
||||
pass
|
||||
|
||||
class struct_c__SA_amdsmi_gpu_caps_t_0(Structure):
|
||||
pass
|
||||
|
||||
struct_c__SA_amdsmi_gpu_caps_t_0._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_gpu_caps_t_0._fields_ = [
|
||||
('gfxip_major', ctypes.c_uint32),
|
||||
('gfxip_minor', ctypes.c_uint32),
|
||||
('gfxip_cu_count', ctypes.c_uint16),
|
||||
('PADDING_0', ctypes.c_ubyte * 2),
|
||||
('reserved', ctypes.c_uint32 * 5),
|
||||
]
|
||||
|
||||
class struct_c__SA_amdsmi_gpu_caps_t_1(Structure):
|
||||
pass
|
||||
|
||||
struct_c__SA_amdsmi_gpu_caps_t_1._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_gpu_caps_t_1._fields_ = [
|
||||
('mm_ip_count', ctypes.c_ubyte),
|
||||
('mm_ip_list', ctypes.c_ubyte * 8),
|
||||
('PADDING_0', ctypes.c_ubyte * 3),
|
||||
('reserved', ctypes.c_uint32 * 5),
|
||||
]
|
||||
|
||||
struct_c__SA_amdsmi_gpu_caps_t._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_gpu_caps_t._fields_ = [
|
||||
('gfx', struct_c__SA_amdsmi_gpu_caps_t_0),
|
||||
('mm', struct_c__SA_amdsmi_gpu_caps_t_1),
|
||||
('ras_supported', ctypes.c_bool),
|
||||
('max_vf_num', ctypes.c_ubyte),
|
||||
('PADDING_0', ctypes.c_ubyte * 2),
|
||||
('gfx_ip_count', ctypes.c_uint32),
|
||||
('dma_ip_count', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 5),
|
||||
]
|
||||
|
||||
amdsmi_gpu_caps_t = struct_c__SA_amdsmi_gpu_caps_t
|
||||
class struct_c__SA_amdsmi_vram_info_t(Structure):
|
||||
pass
|
||||
|
||||
@@ -603,10 +565,9 @@ class struct_c__SA_amdsmi_vbios_info_t(Structure):
|
||||
struct_c__SA_amdsmi_vbios_info_t._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_vbios_info_t._fields_ = [
|
||||
('name', ctypes.c_char * 64),
|
||||
('vbios_version', ctypes.c_uint32),
|
||||
('build_date', ctypes.c_char * 32),
|
||||
('part_number', ctypes.c_char * 64),
|
||||
('vbios_version_string', ctypes.c_char * 32),
|
||||
('version', ctypes.c_char * 32),
|
||||
('reserved', ctypes.c_uint32 * 15),
|
||||
]
|
||||
|
||||
@@ -641,14 +602,12 @@ class struct_c__SA_amdsmi_asic_info_t(Structure):
|
||||
struct_c__SA_amdsmi_asic_info_t._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_asic_info_t._fields_ = [
|
||||
('market_name', ctypes.c_char * 64),
|
||||
('family', ctypes.c_uint32),
|
||||
('vendor_id', ctypes.c_uint32),
|
||||
('subvendor_id', ctypes.c_uint32),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
('device_id', ctypes.c_uint64),
|
||||
('rev_id', ctypes.c_uint32),
|
||||
('asic_serial', ctypes.c_char * 32),
|
||||
('PADDING_1', ctypes.c_ubyte * 4),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
]
|
||||
|
||||
amdsmi_asic_info_t = struct_c__SA_amdsmi_asic_info_t
|
||||
@@ -674,14 +633,11 @@ class struct_c__SA_amdsmi_power_info_t(Structure):
|
||||
struct_c__SA_amdsmi_power_info_t._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_power_info_t._fields_ = [
|
||||
('average_socket_power', ctypes.c_uint32),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
('energy_accumulator', ctypes.c_uint64),
|
||||
('gfx_voltage', ctypes.c_uint32),
|
||||
('soc_voltage', ctypes.c_uint32),
|
||||
('mem_voltage', ctypes.c_uint32),
|
||||
('power_limit', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 9),
|
||||
('PADDING_1', ctypes.c_ubyte * 4),
|
||||
('reserved', ctypes.c_uint32 * 11),
|
||||
]
|
||||
|
||||
amdsmi_power_info_t = struct_c__SA_amdsmi_power_info_t
|
||||
@@ -691,7 +647,6 @@ class struct_c__SA_amdsmi_clk_info_t(Structure):
|
||||
struct_c__SA_amdsmi_clk_info_t._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_clk_info_t._fields_ = [
|
||||
('cur_clk', ctypes.c_uint32),
|
||||
('avg_clk', ctypes.c_uint32),
|
||||
('min_clk', ctypes.c_uint32),
|
||||
('max_clk', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 4),
|
||||
@@ -705,8 +660,8 @@ struct_c__SA_amdsmi_engine_usage_t._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_engine_usage_t._fields_ = [
|
||||
('gfx_activity', ctypes.c_uint32),
|
||||
('umc_activity', ctypes.c_uint32),
|
||||
('mm_activity', ctypes.c_uint32 * 8),
|
||||
('reserved', ctypes.c_uint32 * 6),
|
||||
('mm_activity', ctypes.c_uint32),
|
||||
('reserved', ctypes.c_uint32 * 13),
|
||||
]
|
||||
|
||||
amdsmi_engine_usage_t = struct_c__SA_amdsmi_engine_usage_t
|
||||
@@ -730,10 +685,7 @@ class struct_c__SA_amdsmi_proc_info_t_0(Structure):
|
||||
struct_c__SA_amdsmi_proc_info_t_0._pack_ = 1 # source:False
|
||||
struct_c__SA_amdsmi_proc_info_t_0._fields_ = [
|
||||
('gfx', ctypes.c_uint64),
|
||||
('compute', ctypes.c_uint64),
|
||||
('dma', ctypes.c_uint64),
|
||||
('enc', ctypes.c_uint64),
|
||||
('dec', ctypes.c_uint64),
|
||||
]
|
||||
|
||||
struct_c__SA_amdsmi_proc_info_t._pack_ = 1 # source:False
|
||||
@@ -745,7 +697,7 @@ struct_c__SA_amdsmi_proc_info_t._fields_ = [
|
||||
('engine_usage', struct_c__SA_amdsmi_proc_info_t_0),
|
||||
('memory_usage', struct_c__SA_amdsmi_proc_info_t_1),
|
||||
('container_name', ctypes.c_char * 32),
|
||||
('reserved', ctypes.c_uint32 * 10),
|
||||
('reserved', ctypes.c_uint32 * 4),
|
||||
]
|
||||
|
||||
amdsmi_proc_info_t = struct_c__SA_amdsmi_proc_info_t
|
||||
@@ -1458,9 +1410,6 @@ amdsmi_get_gpu_pci_replay_counter.argtypes = [amdsmi_processor_handle, ctypes.PO
|
||||
amdsmi_set_gpu_pci_bandwidth = _libraries['libamd_smi.so'].amdsmi_set_gpu_pci_bandwidth
|
||||
amdsmi_set_gpu_pci_bandwidth.restype = amdsmi_status_t
|
||||
amdsmi_set_gpu_pci_bandwidth.argtypes = [amdsmi_processor_handle, uint64_t]
|
||||
amdsmi_get_power_ave = _libraries['libamd_smi.so'].amdsmi_get_power_ave
|
||||
amdsmi_get_power_ave.restype = amdsmi_status_t
|
||||
amdsmi_get_power_ave.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)]
|
||||
amdsmi_get_energy_count = _libraries['libamd_smi.so'].amdsmi_get_energy_count
|
||||
amdsmi_get_energy_count.restype = amdsmi_status_t
|
||||
amdsmi_get_energy_count.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_uint64)]
|
||||
@@ -1686,9 +1635,6 @@ amdsmi_get_power_cap_info.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.
|
||||
amdsmi_get_xgmi_info = _libraries['libamd_smi.so'].amdsmi_get_xgmi_info
|
||||
amdsmi_get_xgmi_info.restype = amdsmi_status_t
|
||||
amdsmi_get_xgmi_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_xgmi_info_t)]
|
||||
amdsmi_get_caps_info = _libraries['libamd_smi.so'].amdsmi_get_caps_info
|
||||
amdsmi_get_caps_info.restype = amdsmi_status_t
|
||||
amdsmi_get_caps_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_gpu_caps_t)]
|
||||
amdsmi_get_fw_info = _libraries['libamd_smi.so'].amdsmi_get_fw_info
|
||||
amdsmi_get_fw_info.restype = amdsmi_status_t
|
||||
amdsmi_get_fw_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_fw_info_t)]
|
||||
@@ -1864,11 +1810,10 @@ __all__ = \
|
||||
'amdsmi_func_id_iter_handle_t', 'amdsmi_func_id_value_t',
|
||||
'amdsmi_fw_block_t', 'amdsmi_fw_block_t__enumvalues',
|
||||
'amdsmi_fw_info_t', 'amdsmi_get_busy_percent',
|
||||
'amdsmi_get_caps_info', 'amdsmi_get_clk_freq',
|
||||
'amdsmi_get_clock_info', 'amdsmi_get_energy_count',
|
||||
'amdsmi_get_func_iter_value', 'amdsmi_get_fw_info',
|
||||
'amdsmi_get_gpu_activity', 'amdsmi_get_gpu_asic_info',
|
||||
'amdsmi_get_gpu_available_counters',
|
||||
'amdsmi_get_clk_freq', 'amdsmi_get_clock_info',
|
||||
'amdsmi_get_energy_count', 'amdsmi_get_func_iter_value',
|
||||
'amdsmi_get_fw_info', 'amdsmi_get_gpu_activity',
|
||||
'amdsmi_get_gpu_asic_info', 'amdsmi_get_gpu_available_counters',
|
||||
'amdsmi_get_gpu_bad_page_info', 'amdsmi_get_gpu_board_info',
|
||||
'amdsmi_get_gpu_compute_process_gpus',
|
||||
'amdsmi_get_gpu_compute_process_info',
|
||||
@@ -1898,16 +1843,14 @@ __all__ = \
|
||||
'amdsmi_get_gpu_vendor_name', 'amdsmi_get_gpu_volt_metric',
|
||||
'amdsmi_get_gpu_vram_usage', 'amdsmi_get_gpu_vram_vendor',
|
||||
'amdsmi_get_minmax_bandwidth', 'amdsmi_get_pcie_link_caps',
|
||||
'amdsmi_get_pcie_link_status', 'amdsmi_get_power_ave',
|
||||
'amdsmi_get_power_cap_info', 'amdsmi_get_power_info',
|
||||
'amdsmi_get_processor_handle_from_bdf',
|
||||
'amdsmi_get_pcie_link_status', 'amdsmi_get_power_cap_info',
|
||||
'amdsmi_get_power_info', 'amdsmi_get_processor_handle_from_bdf',
|
||||
'amdsmi_get_processor_handles', 'amdsmi_get_processor_type',
|
||||
'amdsmi_get_socket_handles', 'amdsmi_get_socket_info',
|
||||
'amdsmi_get_temp_metric', 'amdsmi_get_utilization_count',
|
||||
'amdsmi_get_version', 'amdsmi_get_version_str',
|
||||
'amdsmi_get_xgmi_info', 'amdsmi_gpu_block_t',
|
||||
'amdsmi_gpu_block_t__enumvalues', 'amdsmi_gpu_caps_t',
|
||||
'amdsmi_gpu_control_counter',
|
||||
'amdsmi_gpu_block_t__enumvalues', 'amdsmi_gpu_control_counter',
|
||||
'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',
|
||||
@@ -1988,9 +1931,6 @@ __all__ = \
|
||||
'struct_c__SA_amdsmi_frequency_range_t',
|
||||
'struct_c__SA_amdsmi_fw_info_t',
|
||||
'struct_c__SA_amdsmi_fw_info_t_0',
|
||||
'struct_c__SA_amdsmi_gpu_caps_t',
|
||||
'struct_c__SA_amdsmi_gpu_caps_t_0',
|
||||
'struct_c__SA_amdsmi_gpu_caps_t_1',
|
||||
'struct_c__SA_amdsmi_gpu_metrics_t',
|
||||
'struct_c__SA_amdsmi_od_vddc_point_t',
|
||||
'struct_c__SA_amdsmi_od_volt_curve_t',
|
||||
|
||||
@@ -298,7 +298,6 @@ class Formatter:
|
||||
| """ + self.style.text(" 9 Get device pci throughput. Api: amdsmi_get_gpu_pci_throughput <bdf>") + """ |
|
||||
| """ + self.style.text("10 Get device pci replay counter. Api: amdsmi_get_gpu_pci_replay_counter <bdf>") + """ |
|
||||
| """ + self.style.text("11 Get topo numa affinity. Api: amdsmi_get_gpu_topo_numa_affinity <bdf>") + """ |
|
||||
| """ + self.style.text("12 Get device power ave. Api: amdsmi_get_power_ave <bdf><sensor_id>") + """ |
|
||||
| """ + self.style.text("13 Get device energy count. Api: amdsmi_get_energy_count <bdf>") + """ |
|
||||
| """ + self.style.text("14 Get device memory total. Api: amdsmi_get_gpu_memory_total <bdf>") + """ |
|
||||
| """ + self.style.text("15 Get device memory usage. Api: amdsmi_get_gpu_memory_usage <bdf>") + """ |
|
||||
@@ -375,10 +374,6 @@ class Formatter:
|
||||
##############################################
|
||||
# SMI tool wrapper
|
||||
##############################################
|
||||
def amdsmi_tool_dev_power_ave_get(dev, dic):
|
||||
sensor_id = dic["sensor_id"]
|
||||
return smi_api.amdsmi_get_power_ave(dev, ctypes.c_uint32(sensor_id))
|
||||
|
||||
def amdsmi_tool_dev_memory_total_get(dev):
|
||||
result = {}
|
||||
for memory_type in smi_api.AmdSmiMemoryType:
|
||||
|
||||
@@ -388,96 +388,6 @@ amdsmi_status_t amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_hand
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_caps_info(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_gpu_caps_t *info) {
|
||||
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (info == nullptr) {
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
}
|
||||
|
||||
amd::smi::AMDSmiProcessor* amd_device = nullptr;
|
||||
amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance()
|
||||
.handle_to_processor(processor_handle, &amd_device);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) return ret;
|
||||
|
||||
if (amd_device->get_processor_type() != AMD_GPU) {
|
||||
return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
amd::smi::AMDSmiGPUDevice* gpu_device = nullptr;
|
||||
amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device);
|
||||
if (r != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
|
||||
unsigned uvd, vce, uvd_enc, vcn_enc;
|
||||
struct drm_amdgpu_info_hw_ip ip;
|
||||
struct drm_amdgpu_info_device device;
|
||||
unsigned count, j;
|
||||
|
||||
r = gpu_device->amdgpu_query_info(AMDGPU_INFO_DEV_INFO,
|
||||
sizeof(struct drm_amdgpu_info_device), &device);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
info->gfx.gfxip_cu_count = (uint16_t)device.cu_active_number;
|
||||
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_INFO,
|
||||
AMDGPU_HW_IP_GFX, sizeof(ip), &ip);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
info->gfx.gfxip_major = ip.hw_ip_version_major;
|
||||
info->gfx.gfxip_minor = ip.hw_ip_version_minor;
|
||||
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_COUNT,
|
||||
AMDGPU_HW_IP_GFX, sizeof(unsigned), &count);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
info->gfx_ip_count = count;
|
||||
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_COUNT,
|
||||
AMDGPU_HW_IP_DMA, sizeof(unsigned), &count);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
info->dma_ip_count = count;
|
||||
|
||||
|
||||
count = 0;
|
||||
/* Count multimedia engines */
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_COUNT,
|
||||
AMDGPU_HW_IP_UVD, sizeof(struct drm_amdgpu_info_device), &uvd);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
for (j = 0; j < uvd; j++)
|
||||
info->mm.mm_ip_list[count++] = AMDSMI_MM_UVD;
|
||||
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_COUNT,
|
||||
AMDGPU_HW_IP_UVD_ENC, sizeof(struct drm_amdgpu_info_device), &uvd_enc);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
for (j = 0; j < uvd_enc; j++)
|
||||
info->mm.mm_ip_list[count++] = AMDSMI_MM_UVD;
|
||||
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_COUNT,
|
||||
AMDGPU_HW_IP_VCE, sizeof(struct drm_amdgpu_info_device), &vce);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
for (j = 0; j < vce; j++)
|
||||
info->mm.mm_ip_list[count++] = AMDSMI_MM_VCE;
|
||||
|
||||
/* VCN is shared DEC/ENC check only ENC */
|
||||
r = gpu_device->amdgpu_query_hw_ip(AMDGPU_INFO_HW_IP_COUNT,
|
||||
AMDGPU_HW_IP_VCN_ENC, sizeof(struct drm_amdgpu_info_device),
|
||||
&vcn_enc);
|
||||
if (r != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
for (j = 0; j < vcn_enc; j++)
|
||||
info->mm.mm_ip_list[count++] = AMDSMI_MM_VCN;
|
||||
|
||||
info->mm.mm_ip_count = static_cast<uint8_t>(count);
|
||||
|
||||
info->ras_supported = false;
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_gpu_fan_rpms(amdsmi_processor_handle processor_handle,
|
||||
uint32_t sensor_ind, int64_t *speed) {
|
||||
return rsmi_wrapper(rsmi_dev_fan_rpms_get, processor_handle, sensor_ind,
|
||||
@@ -597,7 +507,6 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i
|
||||
}
|
||||
|
||||
info->device_id = dev_info.device_id;
|
||||
info->family = dev_info.family;
|
||||
info->rev_id = dev_info.pci_rev;
|
||||
info->vendor_id = gpu_device->get_vendor_id();
|
||||
}
|
||||
@@ -938,7 +847,6 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle,
|
||||
{"rsmi_dev_firmware_version_get", "amdsmi_get_fw_info"},
|
||||
{"rsmi_dev_ecc_count_get", " amdsmi_get_gpu_ecc_count"},
|
||||
{"rsmi_counter_available_counters_get", " amdsmi_get_gpu_available_counters"},
|
||||
{"rsmi_dev_power_ave_get", "amdsmi_get_power_ave"},
|
||||
{"rsmi_dev_power_cap_get", "amdsmi_get_power_cap_info"},
|
||||
{"rsmi_dev_power_cap_default_get", "amdsmi_get_power_cap_info"},
|
||||
{"rsmi_dev_power_cap_range_get", "amdsmi_get_power_cap_info"},
|
||||
@@ -1130,16 +1038,6 @@ amdsmi_status_t
|
||||
sensor_ind, cap);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_power_ave(amdsmi_processor_handle processor_handle,
|
||||
uint32_t sensor_ind, uint64_t *power) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (power == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_power_ave_get, processor_handle,
|
||||
sensor_ind, power);
|
||||
}
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_power_profile_presets(amdsmi_processor_handle processor_handle,
|
||||
uint32_t sensor_ind,
|
||||
@@ -1446,8 +1344,7 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios
|
||||
strncpy(info->name, (char *) vbios.name, AMDSMI_MAX_STRING_LENGTH);
|
||||
strncpy(info->build_date, (char *) vbios.date, AMDSMI_MAX_DATE_LENGTH);
|
||||
strncpy(info->part_number, (char *) vbios.vbios_pn, AMDSMI_MAX_STRING_LENGTH);
|
||||
strncpy(info->vbios_version_string, (char *) vbios.vbios_ver_str, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
info->vbios_version = vbios.version;
|
||||
strncpy(info->version, (char *) vbios.vbios_ver_str, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
}
|
||||
else {
|
||||
// get vbios version string from rocm_smi
|
||||
@@ -1458,7 +1355,7 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios
|
||||
|
||||
// ignore the errors so that it can populate as many fields as possible.
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
strncpy(info->vbios_version_string,
|
||||
strncpy(info->version,
|
||||
vbios_version, AMDSMI_NORMAL_STRING_LENGTH);
|
||||
}
|
||||
}
|
||||
@@ -1485,7 +1382,7 @@ amdsmi_get_gpu_activity(amdsmi_processor_handle processor_handle, amdsmi_engine_
|
||||
return status;
|
||||
}
|
||||
info->gfx_activity = metrics.average_gfx_activity;
|
||||
info->mm_activity[0] = metrics.average_mm_activity;
|
||||
info->mm_activity = metrics.average_mm_activity;
|
||||
info->umc_activity = metrics.average_umc_activity;
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
@@ -1524,19 +1421,15 @@ amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_
|
||||
|
||||
switch (clk_type) {
|
||||
case CLK_TYPE_GFX:
|
||||
info->avg_clk = metrics.average_gfxclk_frequency;
|
||||
info->cur_clk = metrics.current_gfxclk;
|
||||
break;
|
||||
case CLK_TYPE_MEM:
|
||||
info->avg_clk = metrics.average_uclk_frequency;
|
||||
info->cur_clk = metrics.current_uclk;
|
||||
break;
|
||||
case CLK_TYPE_VCLK0:
|
||||
info->avg_clk = metrics.average_vclk0_frequency;
|
||||
info->cur_clk = metrics.current_vclk0;
|
||||
break;
|
||||
case CLK_TYPE_VCLK1:
|
||||
info->avg_clk = metrics.average_vclk1_frequency;
|
||||
info->cur_clk = metrics.current_vclk1;
|
||||
break;
|
||||
default:
|
||||
@@ -1735,7 +1628,6 @@ amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_inf
|
||||
info->gfx_voltage = voltage_read;
|
||||
|
||||
info->average_socket_power = metrics.average_socket_power;
|
||||
info->energy_accumulator = metrics.energy_accumulator;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -191,20 +191,6 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
|
||||
continue;
|
||||
|
||||
info.engine_usage.gfx = engine_gfx;
|
||||
} else if (line.find("drm-engine-compute") != std::string::npos) {
|
||||
uint64_t engine_compute;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-compute: %lu", &engine_compute) != 1)
|
||||
continue;
|
||||
|
||||
info.engine_usage.compute = engine_compute;
|
||||
} else if (line.find("drm-engine-dma") != std::string::npos) {
|
||||
uint64_t engine_dma;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-dma: %lu", &engine_dma) != 1)
|
||||
continue;
|
||||
|
||||
info.engine_usage.dma = engine_dma;
|
||||
} else if (line.find("drm-engine-enc") != std::string::npos) {
|
||||
uint64_t engine_enc;
|
||||
|
||||
@@ -212,13 +198,6 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
|
||||
continue;
|
||||
|
||||
info.engine_usage.enc = engine_enc;
|
||||
} else if (line.find("drm-engine-dec") != std::string::npos) {
|
||||
uint64_t engine_dec;
|
||||
|
||||
if (sscanf(line.c_str(), "drm-engine-dec: %lu", &engine_dec) != 1)
|
||||
continue;
|
||||
|
||||
info.engine_usage.dec = engine_dec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,6 @@ void TestMutualExclusion::Run(void) {
|
||||
amdsmi_get_gpu_metrics_info
|
||||
amdsmi_get_gpu_od_volt_curve_regions
|
||||
amdsmi_dev_power_max_get
|
||||
amdsmi_get_power_ave
|
||||
amdsmi_dev_power_cap_get
|
||||
amdsmi_dev_power_cap_range_get
|
||||
amdsmi_set_power_cap
|
||||
|
||||
@@ -111,18 +111,6 @@ void TestPowerRead::Run(void) {
|
||||
std::cout << "\t**Power Cap Range: " << info.min_power_cap << " to " <<
|
||||
info.max_power_cap << " uW" << std::endl;
|
||||
}
|
||||
|
||||
err = amdsmi_get_power_ave(processor_handles_[i], 0, &val_ui64);
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Averge Power Usage: ";
|
||||
CHK_AMDSMI_PERM_ERR(err)
|
||||
if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " mW" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_power_ave(processor_handles_[i], 0, nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void TestSysInfoRead::Run(void) {
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**VBIOS Version: "
|
||||
<< info.vbios_version_string << std::endl;
|
||||
<< info.version << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user