diff --git a/projects/amdsmi/CMakeLists.txt b/projects/amdsmi/CMakeLists.txt index 552b68741a..3702f31253 100755 --- a/projects/amdsmi/CMakeLists.txt +++ b/projects/amdsmi/CMakeLists.txt @@ -208,9 +208,10 @@ set(CPACK_DEBIAN_ASAN_PACKAGE_RECOMMENDS "sudo, libdrm-dev") set(CPACK_DEBIAN_DEV_PACKAGE_RECOMMENDS "sudo, libdrm-dev") set(CPACK_DEBIAN_ASAN_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}-asan") set(CPACK_DEBIAN_DEV_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3") -set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS "python3") -set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "python3") +#Python 3.7.9 is the first stable build post the python bugfix window +set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3 (>= 3.7.9), python3-clang, python3-yaml") +set(CPACK_DEBIAN_ASAN_PACKAGE_DEPENDS "python3 (>= 3.7.9), python3-clang, python3-yaml") +set(CPACK_DEBIAN_DEV_PACKAGE_DEPENDS "python3 (>= 3.7.9), python3-clang, python3-yaml") ## Process the Debian install/remove scripts to update the CPACK variables configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY) @@ -227,11 +228,12 @@ endif() set(CPACK_RPM_PACKAGE_PROVIDES "amd-smi") set(CPACK_RPM_DEV_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}") set(CPACK_RPM_ASAN_PACKAGE_PROVIDES "${AMD_SMI_PACKAGE}-asan") -set(CPACK_RPM_PACKAGE_REQUIRES "python3") +#Python 3.7.9 is the first stable build post the python bugfix window +set(CPACK_RPM_PACKAGE_REQUIRES "python38, python3-clang, python3-pyyaml") # don't terminate if bytecompile of python files fails set(CPACK_RPM_SPEC_MORE_DEFINE "%define _python_bytecompile_errors_terminate_build 0") -set(CPACK_RPM_DEV_PACKAGE_REQUIRES "python3") -set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "python3") +set(CPACK_RPM_DEV_PACKAGE_REQUIRES "python38, python3-clang, python3-pyyaml") +set(CPACK_RPM_ASAN_PACKAGE_REQUIRES "python38, python3-clang, python3-pyyaml") # Add rocm-core dependency if -DROCM_DEP_ROCMCORE=ON is passed if(ROCM_DEP_ROCMCORE) @@ -243,7 +245,6 @@ if(ROCM_DEP_ROCMCORE) string(APPEND CPACK_RPM_PACKAGE_REQUIRES ", rocm-core") endif() - ## Enable Component Mode and set component specific flags set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_DEBIAN_DEV_PACKAGE_NAME "${AMD_SMI_PACKAGE}") diff --git a/projects/amdsmi/README.md b/projects/amdsmi/README.md index ac7ec316c3..a017f40f30 100755 --- a/projects/amdsmi/README.md +++ b/projects/amdsmi/README.md @@ -76,7 +76,7 @@ Many of the functions in the library take a "socket handle" or "device handle". GPU device and CPU device on the same socket. Moreover, for MI200, it may have multiple GCDs. To discover the sockets in the system, `amdsmi_get_socket_handles()` is called to get list of sockets -handles, which in turn can be used to query the devices in that socket using `amdsmi_get_device_handles()`. The device handler is used to distinguish the detected devices from one another. It is important to note that a device may end up with a different device handles after restart application, so a device handle should not be relied upon to be constant over process. +handles, which in turn can be used to query the devices in that socket using `amdsmi_get_processor_handles()`. The device handler is used to distinguish the detected devices from one another. It is important to note that a device may end up with a different device handles after restart application, so a device handle should not be relied upon to be constant over process. ## Hello AMD SMI @@ -116,34 +116,34 @@ int main() { // Get the device count for the socket. uint32_t device_count = 0; - ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr); + ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr); // Allocate the memory for the device handlers on the socket - std::vector device_handles(device_count); + std::vector processor_handles(device_count); // Get all devices of the socket - ret = amdsmi_get_device_handles(sockets[i], - &device_count, &device_handles[0]); + ret = amdsmi_get_processor_handles(sockets[i], + &device_count, &processor_handles[0]); // For each device of the socket, get name and temperature. for (uint32_t j=0; j < device_count; j++) { // Get device type. Since the amdsmi is initialized with - // AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU. - device_type_t device_type; - ret = amdsmi_get_device_type(device_handles[j], &device_type); - if (device_type != AMD_GPU) { + // AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU. + processor_type_t processor_type; + ret = amdsmi_get_processor_type(processor_handles[j], &processor_type); + if (processor_type != AMD_GPU) { std::cout << "Expect AMD_GPU device type!\n"; return 1; } // Get device name amdsmi_board_info_t board_info; - ret = amdsmi_get_board_info(device_handles[j], &board_info); + ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info); std::cout << "\tdevice " << j <<"\n\t\tName:" << board_info.product_name << std::endl; // Get temperature int64_t val_i64 = 0; - ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE, + ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &val_i64); std::cout << "\t\tTemperature: " << val_i64 << "C" << std::endl; } @@ -157,7 +157,32 @@ int main() { } ``` -# Python wrapper +# Insall Python Library and CLI Tool + +## Requirements + +- python 3.7+ 64-bit +- driver must be loaded for amdsmi_init() to pass + +## Installation + +- Install amdgpu driver +- Install amd-smi-lib package through package manager +- cd /opt//share/amd_smi +- pip install . + +or + +- pip3 install . +- /opt//bin/amd-smi --help + +Add /opt//bin to your shell's path to call amd-smi from the cmdline + +## Documentation + +Documentation for AMDSMI-CLI is available post install in /opt//libexec/amdsmi_cli/README.md + +## Rebuilding Python wrapper The python wrapper (binding) is an auto-generated file `py-interface/amdsmi_wrapper.py` Wrapper should be re-generated on each C++ API change, by doing: @@ -173,7 +198,7 @@ Note: To be able to re-generate python wrapper you need several tools installed Note: python_wrapper is NOT automatically re-generated. You must run `cmake` with `-DBUILD_WRAPPER=on` argument. -## DISCLAIMER +# DISCLAIMER The information contained herein is for informational purposes only, and is subject to change without notice. In addition, any stated support is planned and is also subject to change. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. diff --git a/projects/amdsmi/amdsmi_cli/README.md b/projects/amdsmi/amdsmi_cli/README.md index 7fe72510d3..bcaa1d9659 100644 --- a/projects/amdsmi/amdsmi_cli/README.md +++ b/projects/amdsmi/amdsmi_cli/README.md @@ -1,4 +1,5 @@ # AMD System Management Interface + This tool acts as a command line interface for manipulating and monitoring the amdgpu kernel, and is intended to replace and deprecate the existing rocm_smi CLI tool & gpuv-smi tool. @@ -6,27 +7,47 @@ It uses Ctypes to call the amd_smi_lib API. Recommended: At least one AMD GPU with AMD driver installed ## Requirements -* python 3.7+ 64-bit -* driver must be loaded for amdsmi_init() to pass + +- python 3.7+ 64-bit +- driver must be loaded for amdsmi_init() to pass ## Installation + - Install amdgpu driver -- Through package manager install amd-smi-lib +- Install amd-smi-lib package through package manager - cd /opt//share/amd_smi - pip install . -- /opt//bin/amd-smi + +or + +- pip3 install . +- /opt//bin/amd-smi --help + +### RHEL 8 + +The default python version in RHEL 8 is python 3.6.8 + +To install the python library you need to upgrade to python 3.7+ + +The package's dependency manager will attempt to install python 3.8+ + +Verify that your pip version is 3.7+ and if not you can use pip3.8 instead ### Example of Ubuntu 22.04 post amdgpu driver install + ``` shell apt install amd-smi-lib cd /opt/rocm/share/amd_smi pip install . /opt/rocm/bin/amd-smi ``` -Add /opt/rocm/bin to your local path to access amd-smi via the cmdline + +Add /opt/rocm/bin to your shell's path to access amd-smi via the cmdline ## Usage + amd-smi will report the version and current platform detected when running the command without arguments: + ``` bash amd-smi usage: amd-smi [-h] ... @@ -51,12 +72,15 @@ AMD-SMI Commands: set Set options for devices. reset Reset options for devices. ``` + More detailed verison information can be give when running `amd-smi version` Each command will have detailed information via `amd-smi [command] --help` ## Commands + For convenience, here is the help output for each command + ``` bash amd-smi discovery --help usage: amd-smi discovery [-h] [--json | --csv] [--file FILE] @@ -330,4 +354,3 @@ The information contained herein is for informational purposes only, and is subj AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. Copyright (c) 2014-2023 Advanced Micro Devices, Inc. All rights reserved. - diff --git a/projects/amdsmi/amdsmi_cli/Release Notes.md b/projects/amdsmi/amdsmi_cli/Release Notes.md new file mode 100644 index 0000000000..8f4ff9ceb9 --- /dev/null +++ b/projects/amdsmi/amdsmi_cli/Release Notes.md @@ -0,0 +1,33 @@ +# Release Notes + +## Documentation + +Documentation for AMDSMI-CLI is available post install in /opt//libexec/amdsmi_cli/README.md + +## AMDSMI-CLI 0.0.4 + +### Added + +- AMDSMI-CLI tool enabled for Linux Baremetal & Guest +- Added CSV & Watch modifier +- Added topology subcommand + +### Known Issues + +- not all ecc fields are currently supported +- RHEL 8 has extra install steps + +## AMDSMI-CLI 0.0.2 + +### Added + +- AMDSMI-CLI tool enabled for Linux Baremetal & Guest + +### Known Issues + +- ecc & ras subcommands will report N/A even if RAS is enabled +- process vram_mem's unit is listed as percentage vs bytes +- csv modifier does not work +- topology information is not yet enabled +- watch modifier not fully enabled +- limited guest support \ No newline at end of file diff --git a/projects/amdsmi/amdsmi_cli/_version.py b/projects/amdsmi/amdsmi_cli/_version.py index 81f0fdeccf..3dc1f76bc6 100644 --- a/projects/amdsmi/amdsmi_cli/_version.py +++ b/projects/amdsmi/amdsmi_cli/_version.py @@ -1 +1 @@ -__version__ = "0.0.4" +__version__ = "0.1.0" diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_cli.py b/projects/amdsmi/amdsmi_cli/amdsmi_cli.py index 2381c88669..23564faa55 100755 --- a/projects/amdsmi/amdsmi_cli/amdsmi_cli.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_cli.py @@ -28,6 +28,7 @@ from amdsmi_parser import AMDSMIParser from amdsmi_logger import AMDSMILogger import amdsmi_cli_exceptions from amdsmi import amdsmi_interface +from amdsmi import amdsmi_exception def _print_error(e, destination): @@ -85,6 +86,6 @@ if __name__ == "__main__": args.func(args) except amdsmi_cli_exceptions.AmdSmiException as e: _print_error(str(e), amd_smi_commands.logger.destination) - except amdsmi_interface.AmdSmiLibraryException as e: + except amdsmi_exception.AmdSmiLibraryException as e: exc = amdsmi_cli_exceptions.AmdSmiAMDSMIErrorException(amd_smi_commands.logger.format, e.get_error_code()) _print_error(str(exc), amd_smi_commands.logger.destination) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index bfc3ca80a6..4aacf829eb 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -44,7 +44,7 @@ class AMDSMICommands(): format=format, destination=destination) try: - self.device_handles = amdsmi_interface.amdsmi_get_device_handles() + self.device_handles = amdsmi_interface.amdsmi_get_processor_handles() except amdsmi_exception.AmdSmiLibraryException as e: raise e self.stop = '' @@ -117,12 +117,12 @@ class AMDSMICommands(): args.gpu = device_handle try: - bdf = amdsmi_interface.amdsmi_get_device_bdf(args.gpu) + bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: bdf = e.get_error_info() try: - uuid = amdsmi_interface.amdsmi_get_device_uuid(args.gpu) + uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: uuid = e.get_error_info() @@ -185,7 +185,7 @@ class AMDSMICommands(): args.caps = caps if numa: args.numa = numa - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if ras: args.ras = ras if limit: @@ -204,10 +204,10 @@ class AMDSMICommands(): args.gpu = device_handle # If all arguments are False, it means that no argument was passed and the entire static should be printed - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if not any([args.asic, args.bus, args.vbios, args.limit, args.driver, args.caps, args.ras, args.board]): args.asic = args.bus = args.vbios = args.limit = args.driver = args.caps = args.ras = args.board = args.numa = self.all_arguments = True - if (self.helpers.is_linux() and self.helpers.is_virtual_os()): + if self.helpers.is_linux() and self.helpers.is_virtual_os(): if not any([args.asic, args.bus, args.vbios, args.driver, args.caps]): args.asic = args.bus = args.vbios = args.driver = args.caps = self.all_arguments = True @@ -215,8 +215,7 @@ 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 = amdsmi_interface.amdsmi_get_gpu_asic_info(args.gpu) 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']) @@ -243,7 +242,7 @@ class AMDSMICommands(): raise e try: - bus_output_info['bdf'] = amdsmi_interface.amdsmi_get_device_bdf(args.gpu) + bus_output_info['bdf'] = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: bus_output_info['bdf'] = e.get_error_info() if not self.all_arguments: @@ -253,28 +252,26 @@ class AMDSMICommands(): static_dict['bus'] = bus_output_info if args.vbios: try: - vbios_info = amdsmi_interface.amdsmi_get_vbios_info(args.gpu) + vbios_info = amdsmi_interface.amdsmi_get_gpu_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: static_dict['vbios'] = e.get_error_info() if not self.all_arguments: raise e - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if args.board: try: - board_info = amdsmi_interface.amdsmi_get_board_info(args.gpu) + board_info = amdsmi_interface.amdsmi_get_gpu_board_info(args.gpu) board_info['serial_number'] = hex(board_info['serial_number']) + board_info['model_number'] = board_info['model_number'].strip() board_info['product_serial'] = '0x' + board_info['product_serial'] - - if self.logger.is_gpuvsmi_compatibility(): - board_info['product_number'] = board_info.pop('product_serial') - board_info['product_name'] = board_info.pop('product_name') + board_info['product_name'] = board_info['product_name'].strip() + board_info['manufacturer_name'] = board_info['manufacturer_name'].strip() static_dict['board'] = board_info except amdsmi_exception.AmdSmiLibraryException as e: @@ -283,14 +280,14 @@ class AMDSMICommands(): raise e if args.limit: try: - power_limit = amdsmi_interface.amdsmi_get_power_measure(args.gpu)['power_limit'] + power_limit = amdsmi_interface.amdsmi_get_power_info(args.gpu)['power_limit'] except amdsmi_exception.AmdSmiLibraryException as e: power_limit = e.get_error_info() if not self.all_arguments: raise e try: - temp_edge_limit = amdsmi_interface.amdsmi_dev_get_temp_metric(args.gpu, + temp_edge_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu, amdsmi_interface.AmdSmiTemperatureType.EDGE, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL) except amdsmi_exception.AmdSmiLibraryException as e: temp_edge_limit = e.get_error_info() @@ -298,7 +295,7 @@ class AMDSMICommands(): raise e try: - temp_junction_limit = amdsmi_interface.amdsmi_dev_get_temp_metric(args.gpu, + temp_junction_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu, amdsmi_interface.AmdSmiTemperatureType.JUNCTION, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL) except amdsmi_exception.AmdSmiLibraryException as e: temp_junction_limit = e.get_error_info() @@ -306,7 +303,7 @@ class AMDSMICommands(): raise e try: - temp_vram_limit = amdsmi_interface.amdsmi_dev_get_temp_metric(args.gpu, + temp_vram_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu, amdsmi_interface.AmdSmiTemperatureType.VRAM, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL) except amdsmi_exception.AmdSmiLibraryException as e: temp_junction_limit = e.get_error_info() @@ -332,46 +329,26 @@ class AMDSMICommands(): if args.driver: try: driver_info = {} - driver_info['driver_version'] = amdsmi_interface.amdsmi_get_driver_version(args.gpu) + driver_info['driver_version'] = amdsmi_interface.amdsmi_get_gpu_driver_version(args.gpu) static_dict['driver'] = driver_info except amdsmi_exception.AmdSmiLibraryException as e: static_dict['driver'] = e.get_error_info() if not self.all_arguments: raise e - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if args.ras: try: - if self.helpers.has_ras_support(args.gpu): - static_dict['ras'] = amdsmi_interface.amdsmi_get_ras_block_features_enabled(args.gpu) - else: - static_dict['ras'] = 'N/A' - + static_dict['ras'] = amdsmi_interface.amdsmi_get_gpu_ras_block_features_enabled(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: - static_dict['ras'] = e.get_error_info() + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED: + static_dict['ras'] = 'N/A' + else: + static_dict['ras'] = e.get_error_info() if not self.all_arguments: raise e if args.caps: - try: - caps_info = amdsmi_interface.amdsmi_get_caps_info(args.gpu) - - 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)}" - - if self.logger.is_csv_format() and self.logger.is_gpuvsmi_compatibility(): - if 'mm_ip_list' in caps_info: - if caps_info['mm_ip_list']: # Don't index if it's not populated - caps_info['mm_ip_list'] = caps_info['mm_ip_list'][0] - - 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: @@ -382,7 +359,7 @@ class AMDSMICommands(): raise e try: - numa_affinity = amdsmi_interface.amdsmi_topo_get_numa_affinity(args.gpu) + numa_affinity = amdsmi_interface.amdsmi_get_gpu_topo_numa_affinity(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: numa_affinity = e.get_error_info() if not self.all_arguments: @@ -395,19 +372,19 @@ class AMDSMICommands(): # Convert and store output by pid for csv format if self.logger.is_csv_format(): # expand if ras blocks are populated - if (self.helpers.is_linux() and self.helpers.is_baremetal() and args.ras): + if self.helpers.is_linux() and self.helpers.is_baremetal() and args.ras: if isinstance(static_dict['ras'], list): ras_dicts = static_dict.pop('ras') multiple_devices_csv_override = True for ras_dict in ras_dicts: for key, value in ras_dict.items(): self.logger.store_output(args.gpu, key, value) - self.logger.store_output(args.gpu, 'values', static_dict) + self.logger.store_output(args.gpu, 'values', static_dict) self.logger.store_multiple_device_output() else: # Store values if ras has an error self.logger.store_output(args.gpu, 'values', static_dict) - if (self.helpers.is_linux() and self.helpers.is_virtual_os()): + if self.helpers.is_linux() and self.helpers.is_virtual_os(): self.logger.store_output(args.gpu, 'values', static_dict) else: self.logger.store_output(args.gpu, 'values', static_dict) @@ -551,7 +528,7 @@ class AMDSMICommands(): bad_page_err_output = '' try: - bad_page_info = amdsmi_interface.amdsmi_get_bad_page_info(args.gpu) + bad_page_info = amdsmi_interface.amdsmi_get_gpu_bad_page_info(args.gpu) bad_page_error = False except amdsmi_exception.AmdSmiLibraryException as e: bad_page_info = "" @@ -631,8 +608,8 @@ class AMDSMICommands(): def metric(self, args, multiple_devices=False, watching_output=False, gpu=None, usage=None, watch=None, watch_time=None, iterations=None, fb_usage=None, power=None, - clock=None, temperature=None, ecc=None, pcie=None, voltage=None, fan=None, - voltage_curve=None, overdrive=None, mem_overdrive=None, perf_level=None, + clock=None, temperature=None, ecc=None, ecc_block=None, pcie=None, voltage=None, + fan=None, voltage_curve=None, overdrive=None, mem_overdrive=None, perf_level=None, replay_count=None, xgmi_err=None, energy=None, mem_usage=None): """Get Metric information for target gpu @@ -650,6 +627,7 @@ class AMDSMICommands(): clock (bool, optional): Value override for args.clock. Defaults to None. temperature (bool, optional): Value override for args.temperature. Defaults to None. ecc (bool, optional): Value override for args.ecc. Defaults to None. + ecc_block (bool, optional): Value override for args.ecc. Defaults to None. pcie (bool, optional): Value override for args.pcie. Defaults to None. voltage (bool, optional): Value override for args.voltage. Defaults to None. fan (bool, optional): Value override for args.fan. Defaults to None. @@ -684,7 +662,7 @@ class AMDSMICommands(): if mem_usage: args.mem_usage = mem_usage - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if usage: args.usage = usage if power: @@ -695,6 +673,8 @@ class AMDSMICommands(): args.temperature = temperature if ecc: args.ecc = ecc + if ecc_block: + args.ecc_block = ecc_block if pcie: args.pcie = pcie if voltage: @@ -755,21 +735,21 @@ class AMDSMICommands(): raise IndexError("args.gpu should not be an empty list") # Check if any of the options have been set, if not then set them all to true - if (self.helpers.is_linux() and self.helpers.is_virtual_os()): + if self.helpers.is_linux() and self.helpers.is_virtual_os(): if not any([args.fb_usage, args.replay_count, args.mem_usage]): args.fb_usage = args.replay_count = args.mem_usage = self.all_arguments = True - if (self.helpers.is_linux() and self.helpers.is_baremetal()): - if not any([args.usage, args.fb_usage, args.power, args.clock, args.temperature, args.ecc, args.pcie, args.voltage, args.fan, + if self.helpers.is_linux() and self.helpers.is_baremetal(): + if not any([args.usage, args.fb_usage, args.power, args.clock, args.temperature, args.ecc, args.ecc_block, args.pcie, args.voltage, args.fan, args.voltage_curve, args.overdrive, args.mem_overdrive, args.perf_level, args.replay_count, args.xgmi_err, args.energy, args.mem_usage]): - args.usage = args.fb_usage = args.power = args.clock = args.temperature = args.ecc = args.pcie = args.voltage = args.fan = \ + args.usage = args.fb_usage = args.power = args.clock = args.temperature = args.ecc = args.ecc_block = args.pcie = args.voltage = args.fan = \ args.voltage_curve = args.overdrive = args.mem_overdrive = args.perf_level = \ args.replay_count = args.xgmi_err = args.energy = args.mem_usage = self.all_arguments = True # Add timestamp and store values for specified arguments values_dict = {} - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if args.usage: try: engine_usage = amdsmi_interface.amdsmi_get_gpu_activity(args.gpu) @@ -791,7 +771,7 @@ class AMDSMICommands(): raise e if args.fb_usage: try: - vram_usage = amdsmi_interface.amdsmi_get_vram_usage(args.gpu) + vram_usage = amdsmi_interface.amdsmi_get_gpu_vram_usage(args.gpu) if self.logger.is_gpuvsmi_compatibility(): vram_usage['fb_total'] = vram_usage.pop('vram_total') @@ -808,39 +788,39 @@ class AMDSMICommands(): if not self.all_arguments: raise e - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if args.power: power_dict = {} try: - power_measure = amdsmi_interface.amdsmi_get_power_measure(args.gpu) + power_measure = amdsmi_interface.amdsmi_get_power_info(args.gpu) power_dict = {'average_socket_power': power_measure['average_socket_power'], - 'voltage_gfx': power_measure['voltage_gfx'], - 'voltage_soc': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info, - 'voltage_mem': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info} + 'gfx_voltage': power_measure['gfx_voltage'], + 'soc_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info, + 'mem_voltage': amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info} if self.logger.is_human_readable_format(): power_dict['average_socket_power'] = f"{power_dict['average_socket_power']} W" - power_dict['voltage_gfx'] = f"{power_dict['voltage_gfx']} mV" - power_dict['voltage_soc'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info - power_dict['voltage_mem'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info + power_dict['gfx_voltage'] = f"{power_dict['gfx_voltage']} mV" + power_dict['soc_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info + power_dict['mem_voltage'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info except amdsmi_exception.AmdSmiLibraryException as e: power_dict = {'average_socket_power': e.get_error_info(), - 'voltage_gfx': e.get_error_info(), - 'voltage_soc': e.get_error_info(), - 'voltage_mem': e.get_error_info()} + 'gfx_voltage': e.get_error_info(), + 'soc_voltage': e.get_error_info(), + 'mem_voltage': e.get_error_info()} if not self.all_arguments: raise e if self.logger.is_gpuvsmi_compatibility(): power_dict['current_power'] = power_dict.pop('average_socket_power') - power_dict['current_voltage'] = power_dict.pop('voltage_gfx') - power_dict['current_voltage_soc'] = power_dict.pop('voltage_soc') - power_dict['current_voltage_mem'] = power_dict.pop('voltage_mem') + power_dict['current_voltage'] = power_dict.pop('gfx_voltage') + power_dict['current_soc_voltage'] = power_dict.pop('soc_voltage') + power_dict['current_mem_voltage'] = power_dict.pop('mem_voltage') try: - power_dict['current_fan_rpm'] = amdsmi_interface.amdsmi_dev_get_fan_rpms(args.gpu, 0) + power_dict['current_fan_rpm'] = amdsmi_interface.amdsmi_get_gpu_fan_rpms(args.gpu, 0) if self.logger.is_human_readable_format(): power_dict['current_fan_rpm'] = f"{power_dict['current_fan_rpm']} RPM" except amdsmi_exception.AmdSmiLibraryException as e: @@ -851,8 +831,8 @@ class AMDSMICommands(): values_dict['power'] = power_dict if args.clock: try: - clock_gfx = amdsmi_interface.amdsmi_get_clock_measure(args.gpu, amdsmi_interface.AmdSmiClkType.GFX) - clock_mem = amdsmi_interface.amdsmi_get_clock_measure(args.gpu, amdsmi_interface.AmdSmiClkType.MEM) + clock_gfx = amdsmi_interface.amdsmi_get_clock_info(args.gpu, amdsmi_interface.AmdSmiClkType.GFX) + clock_mem = amdsmi_interface.amdsmi_get_clock_info(args.gpu, amdsmi_interface.AmdSmiClkType.MEM) clocks = {'gfx': clock_gfx, 'mem': clock_mem} @@ -870,11 +850,11 @@ class AMDSMICommands(): raise e if args.temperature: try: - temperature_edge_current = amdsmi_interface.amdsmi_dev_get_temp_metric( + temperature_edge_current = amdsmi_interface.amdsmi_get_temp_metric( args.gpu, amdsmi_interface.AmdSmiTemperatureType.EDGE, amdsmi_interface.AmdSmiTemperatureMetric.CURRENT) - temperature_junction_current = amdsmi_interface.amdsmi_dev_get_temp_metric( + temperature_junction_current = amdsmi_interface.amdsmi_get_temp_metric( args.gpu, amdsmi_interface.AmdSmiTemperatureType.JUNCTION, amdsmi_interface.AmdSmiTemperatureMetric.CURRENT) - temperature_vram_current = amdsmi_interface.amdsmi_dev_get_temp_metric( + temperature_vram_current = amdsmi_interface.amdsmi_get_temp_metric( args.gpu, amdsmi_interface.AmdSmiTemperatureType.VRAM, amdsmi_interface.AmdSmiTemperatureMetric.CURRENT) temperatures = {'edge': temperature_edge_current, @@ -899,23 +879,44 @@ class AMDSMICommands(): if not self.all_arguments: raise e if args.ecc: + ecc_count = {} + try: + ecc_count = amdsmi_interface.amdsmi_get_gpu_ecc_error_count(args.gpu) + ecc_count['correctable'] = ecc_count.pop('correctable_count') + ecc_count['uncorrectable'] = ecc_count.pop('uncorrectable_count') + + values_dict['ecc'] = ecc_count + except amdsmi_exception.AmdSmiLibraryException as e: + if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED: + ecc_count['correctable'] = 'N/A' + ecc_count['uncorrectable'] = 'N/A' + values_dict['ecc'] = ecc_count + else: + values_dict['ecc'] = e.get_error_info() + if not self.all_arguments: + raise e + + if args.ecc_block: ecc_dict = {} try: - if self.helpers.has_ras_support(args.gpu): - ras_states = amdsmi_interface.amdsmi_get_ras_block_features_enabled(args.gpu) - for state in ras_states: - if state['status'] == amdsmi_interface.AmdSmiRasErrState.ENABLED: - gpu_block = amdsmi_interface.AmdSmiGpuBlock[state['block']] - ecc_count = amdsmi_interface.amdsmi_dev_get_ecc_count(args.gpu, gpu_block) + ras_states = amdsmi_interface.amdsmi_get_ras_block_features_enabled(args.gpu) + for state in ras_states: + if state['status'] == amdsmi_interface.AmdSmiRasErrState.ENABLED.name: + gpu_block = amdsmi_interface.AmdSmiGpuBlock[state['block']] + try: + ecc_count = amdsmi_interface.amdsmi_get_gpu_ecc_count(args.gpu, gpu_block) ecc_dict[state['block']] = {'correctable' : ecc_count['correctable_count'], - 'uncorrectable': ecc_count['uncorrectable_count']} - if not ecc_dict: - ecc_dict['correctable'] = 'N/A' - ecc_dict['uncorrectable'] = 'N/A' + 'uncorrectable': ecc_count['uncorrectable_count']} + except amdsmi_exception.AmdSmiLibraryException as e: + ecc_count = e.get_error_info() + if self.logger.is_gpuvsmi_compatibility(): + ecc_count = "N/A" - values_dict['ecc'] = ecc_dict + ecc_dict[state['block']] = {'correctable' : ecc_count, + 'uncorrectable': ecc_count} + values_dict['ecc_block'] = ecc_dict except amdsmi_exception.AmdSmiLibraryException as e: - values_dict['ecc'] = e.get_error_info() + values_dict['ecc_block'] = e.get_error_info() if not self.all_arguments: raise e @@ -936,7 +937,7 @@ class AMDSMICommands(): if args.voltage: try: - volt_metric = amdsmi_interface.amdsmi_dev_get_volt_metric( + volt_metric = amdsmi_interface.amdsmi_get_gpu_volt_metric( args.gpu, amdsmi_interface.AmdSmiVoltageType.VDDGFX, amdsmi_interface.AmdSmiVoltageMetric.CURRENT) if self.logger.is_human_readable_format(): @@ -950,14 +951,14 @@ class AMDSMICommands(): raise e if args.fan: try: - fan_speed = amdsmi_interface.amdsmi_dev_get_fan_speed(args.gpu, 0) + fan_speed = amdsmi_interface.amdsmi_get_gpu_fan_speed(args.gpu, 0) fan_speed_error = False except amdsmi_exception.AmdSmiLibraryException as e: fan_speed = e.get_error_info() fan_speed_error = True try: - fan_max = amdsmi_interface.amdsmi_dev_get_fan_speed_max(args.gpu, 0) + fan_max = amdsmi_interface.amdsmi_get_gpu_fan_speed_max(args.gpu, 0) if not fan_speed_error and fan_max > 0: fan_percent = round((float(fan_speed) / float(fan_max)) * 100, 2) if self.logger.is_human_readable_format(): @@ -970,7 +971,7 @@ class AMDSMICommands(): fan_percent = 'Unable to detect fan speed' try: - fan_rpm = amdsmi_interface.amdsmi_dev_get_fan_rpms(args.gpu, 0) + fan_rpm = amdsmi_interface.amdsmi_get_gpu_fan_rpms(args.gpu, 0) except amdsmi_exception.AmdSmiLibraryException as e: fan_rpm = e.get_error_info() @@ -980,7 +981,7 @@ class AMDSMICommands(): 'usage' : fan_percent} if args.voltage_curve: try: - od_volt = amdsmi_interface.amdsmi_dev_get_od_volt_info(args.gpu) + od_volt = amdsmi_interface.amdsmi_get_gpu_od_volt_info(args.gpu) voltage_point_dict = {} @@ -991,7 +992,7 @@ class AMDSMICommands(): else: frequency = 0 voltage = 0 - voltage_point_dict[f'voltage_point_{point}'] = f"{frequency}Mhz {voltage}mV" + voltage_point_dict[f'voltage_point_{point}'] = f"{frequency} Mhz {voltage} mV" values_dict['voltage_curve'] = voltage_point_dict except amdsmi_exception.AmdSmiLibraryException as e: @@ -1000,7 +1001,7 @@ class AMDSMICommands(): raise e if args.overdrive: try: - overdrive_level = amdsmi_interface.amdsmi_dev_get_overdrive_level(args.gpu) + overdrive_level = amdsmi_interface.amdsmi_get_gpu_overdrive_level(args.gpu) if self.logger.is_human_readable_format(): unit = '%' @@ -1015,7 +1016,7 @@ class AMDSMICommands(): values_dict['mem_overdrive'] = amdsmi_exception.AmdSmiLibraryException(amdsmi_exception.AmdSmiRetCode.NOT_IMPLEMENTED).err_info if args.perf_level: try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) values_dict['perf_level'] = perf_level except amdsmi_exception.AmdSmiLibraryException as e: values_dict['perf_level'] = e.get_error_info() @@ -1023,40 +1024,29 @@ class AMDSMICommands(): raise e if args.replay_count: try: - pci_replay_counter = amdsmi_interface.amdsmi_dev_get_pci_replay_counter(args.gpu) + pci_replay_counter = amdsmi_interface.amdsmi_get_gpu_pci_replay_counter(args.gpu) values_dict['replay_count'] = pci_replay_counter except amdsmi_exception.AmdSmiLibraryException as e: values_dict['replay_count'] = e.get_error_info() if not self.all_arguments: raise e - if (self.helpers.is_linux() and self.helpers.is_baremetal()): + if self.helpers.is_linux() and self.helpers.is_baremetal(): if args.xgmi_err: try: - values_dict['xgmi_err'] = amdsmi_interface.amdsmi_dev_xgmi_error_status(args.gpu) + values_dict['xgmi_err'] = amdsmi_interface.amdsmi_gpu_xgmi_error_status(args.gpu) except amdsmi_interface.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NOT_SUPPORTED: values_dict['xgmi_err'] = 'N/A' elif not self.all_arguments: raise e if args.energy: - try: - energy = amdsmi_interface.amdsmi_get_power_measure(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: - memory_total_vram = amdsmi_interface.amdsmi_dev_get_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM) - memory_total_vis_vram = amdsmi_interface.amdsmi_dev_get_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM) - memory_total_gtt = amdsmi_interface.amdsmi_dev_get_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT) + memory_total_vram = amdsmi_interface.amdsmi_get_gpu_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM) + memory_total_vis_vram = amdsmi_interface.amdsmi_get_gpu_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM) + memory_total_gtt = amdsmi_interface.amdsmi_get_gpu_memory_total(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT) # Convert mem_usage to megabytes memory_total['vram'] = memory_total_vram // (1024*1024) @@ -1078,9 +1068,9 @@ class AMDSMICommands(): raise e try: - total_used_vram = amdsmi_interface.amdsmi_dev_get_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM) - total_used_vis_vram = amdsmi_interface.amdsmi_dev_get_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM) - total_used_gtt = amdsmi_interface.amdsmi_dev_get_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT) + total_used_vram = amdsmi_interface.amdsmi_get_gpu_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VRAM) + total_used_vis_vram = amdsmi_interface.amdsmi_get_gpu_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.VIS_VRAM) + total_used_gtt = amdsmi_interface.amdsmi_get_gpu_memory_usage(args.gpu, amdsmi_interface.AmdSmiMemoryType.GTT) # Convert mem_usage to megabytes memory_total['used_vram'] = total_used_vram // (1024*1024) @@ -1200,14 +1190,14 @@ class AMDSMICommands(): # Populate initial processes try: - process_list = amdsmi_interface.amdsmi_get_process_list(args.gpu) + process_list = amdsmi_interface.amdsmi_get_gpu_process_list(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: raise e filtered_process_values = [] for process_handle in process_list: try: - process_info = amdsmi_interface.amdsmi_get_process_info(args.gpu, process_handle) + process_info = amdsmi_interface.amdsmi_get_gpu_process_info(args.gpu, process_handle) except amdsmi_exception.AmdSmiLibraryException as e: process_info = e.get_error_info() filtered_process_values.append({'process_info': process_info}) @@ -1216,24 +1206,15 @@ class AMDSMICommands(): process_info['mem_usage'] = process_info.pop('mem') process_info['usage'] = process_info.pop('engine_usage') - # Convert mem_usage to megabytes - - mem_usage_mb = (process_info['mem_usage']//1024) // 1024 - if mem_usage_mb < 0: - process_info['mem_usage'] = process_info['mem_usage']//1024 - mem_usage_unit = 'B' - else: - process_info['mem_usage'] = mem_usage_mb - if self.logger.is_human_readable_format(): - mem_usage_unit = 'MB' - engine_usage_unit = '%' - process_info['mem_usage'] = f"{process_info['mem_usage']} {mem_usage_unit}" + process_info['mem_usage'] = self.helpers.convert_bytes_to_readable(process_info['mem_usage']) + engine_usage_unit = "ns" for usage_metric in process_info['usage']: process_info['usage'][usage_metric] = f"{process_info['usage'][usage_metric]} {engine_usage_unit}" + for usage_metric in process_info['memory_usage']: - process_info['memory_usage'][usage_metric] = f"{process_info['memory_usage'][usage_metric]} {engine_usage_unit}" + process_info['memory_usage'][usage_metric] = self.helpers.convert_bytes_to_readable(process_info['memory_usage'][usage_metric]) filtered_process_values.append({'process_info': process_info}) @@ -1576,7 +1557,7 @@ class AMDSMICommands(): # Build GPU string for errors try: - gpu_bdf = amdsmi_interface.amdsmi_get_device_bdf(args.gpu) + gpu_bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(args.gpu) except amdsmi_exception.AmdSmiLibraryException: gpu_bdf = f'BDF Unavailable for {args.gpu}' try: @@ -1591,7 +1572,7 @@ class AMDSMICommands(): # Check if the performance level is manual, if not then set it to manual try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1599,7 +1580,7 @@ class AMDSMICommands(): if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1607,14 +1588,14 @@ class AMDSMICommands(): if clock_type != amdsmi_interface.AmdSmiClkType.PCIE: try: - amdsmi_interface.amdsmi_dev_set_clk_freq(args.gpu, clock_type, freq_bitmask) + amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the {clock_type} clock frequency on {gpu_string}") from e else: try: - amdsmi_interface.amdsmi_dev_set_pci_bandwidth(args.gpu, freq_bitmask) + amdsmi_interface.amdsmi_set_gpu_pci_bandwidth(args.gpu, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1626,7 +1607,7 @@ class AMDSMICommands(): clock_type = amdsmi_interface.AmdSmiClkType.SYS # Check if the performance level is manual, if not then set it to manual try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1634,14 +1615,14 @@ class AMDSMICommands(): if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: - amdsmi_interface.amdsmi_dev_set_clk_freq(args.gpu, clock_type, freq_bitmask) + amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1653,7 +1634,7 @@ class AMDSMICommands(): clock_type = amdsmi_interface.AmdSmiClkType.MEM # Check if the performance level is manual, if not then set it to manual try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1661,14 +1642,14 @@ class AMDSMICommands(): if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: - amdsmi_interface.amdsmi_dev_set_clk_freq(args.gpu, clock_type, freq_bitmask) + amdsmi_interface.amdsmi_set_clk_freq(args.gpu, clock_type, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1680,7 +1661,7 @@ class AMDSMICommands(): clock_type = amdsmi_interface.AmdSmiClkType.PCIE # Check if the performance level is manual, if not then set it to manual try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1688,13 +1669,13 @@ class AMDSMICommands(): if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: - amdsmi_interface.amdsmi_dev_set_pci_bandwidth(args.gpu, freq_bitmask) + amdsmi_interface.amdsmi_set_gpu_pci_bandwidth(args.gpu, freq_bitmask) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1707,7 +1688,7 @@ class AMDSMICommands(): level = amdsmi_interface.AmdSmiFreqInd(level) clock_type = amdsmi_interface.AmdSmiClkType.SYS try: - amdsmi_interface.amdsmi_dev_set_od_clk_info(args.gpu, level, value, clock_type) + amdsmi_interface.amdsmi_set_gpu_od_clk_info(args.gpu, level, value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1719,7 +1700,7 @@ class AMDSMICommands(): level = amdsmi_interface.AmdSmiFreqInd(level) clock_type = amdsmi_interface.AmdSmiClkType.MEM try: - amdsmi_interface.amdsmi_dev_set_od_clk_info(args.gpu, level, value, clock_type) + amdsmi_interface.amdsmi_set_gpu_od_clk_info(args.gpu, level, value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1729,7 +1710,7 @@ class AMDSMICommands(): if isinstance(args.vc, int): point, clk, volt = args.vc try: - amdsmi_interface.amdsmi_dev_set_od_volt_info(args.gpu, point, clk, volt) + amdsmi_interface.amdsmi_set_gpu_od_volt_info(args.gpu, point, clk, volt) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1740,7 +1721,7 @@ class AMDSMICommands(): min_value, max_value = args.srange clock_type = amdsmi_interface.AmdSmiClkType.SYS try: - amdsmi_interface.amdsmi_dev_set_clk_range(args.gpu, min_value, max_value, clock_type) + amdsmi_interface.amdsmi_set_gpu_clk_range(args.gpu, min_value, max_value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1751,7 +1732,7 @@ class AMDSMICommands(): min_value, max_value = args.srange clock_type = amdsmi_interface.AmdSmiClkType.MEM try: - amdsmi_interface.amdsmi_dev_set_clk_range(args.gpu, min_value, max_value, clock_type) + amdsmi_interface.amdsmi_set_gpu_clk_range(args.gpu, min_value, max_value, clock_type) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1760,7 +1741,7 @@ class AMDSMICommands(): self.logger.store_output(args.gpu, 'mrange', f"Successfully set {clock_type} from {min_value}(MHz) to {max_value}(MHz)") if isinstance(args.fan, int): try: - amdsmi_interface.amdsmi_dev_set_fan_speed(args.gpu, 0, args.fan) + amdsmi_interface.amdsmi_set_gpu_fan_speed(args.gpu, 0, args.fan) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1770,7 +1751,7 @@ class AMDSMICommands(): if args.perflevel: perf_level = amdsmi_interface.AmdSmiDevPerfLevel[args.perflevel] try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, perf_level) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, perf_level) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1780,7 +1761,7 @@ class AMDSMICommands(): if isinstance(args.overdrive, int): # Check if the performance level is manual, if not then set it to manual try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1788,14 +1769,14 @@ class AMDSMICommands(): if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e raise ValueError(f"Unable to set the performance level of {gpu_string} to manual") from e try: - amdsmi_interface.amdsmi_dev_set_overdrive_level_v1(args.gpu, args.overdrive) + amdsmi_interface.amdsmi_set_gpu_overdrive_level_v1(args.gpu, args.overdrive) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1805,7 +1786,7 @@ class AMDSMICommands(): if isinstance(args.memoverdrive, int): # Check if the performance level is manual, if not then set it to manual try: - perf_level = amdsmi_interface.amdsmi_dev_get_perf_level(args.gpu) + perf_level = amdsmi_interface.amdsmi_get_gpu_perf_level(args.gpu) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1813,7 +1794,7 @@ class AMDSMICommands(): if 'manual' in perf_level.lower(): try: - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, amdsmi_interface.AmdSmiDevPerfLevel.MANUAL) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1843,7 +1824,7 @@ class AMDSMICommands(): raise ValueError(f"Requested power cap: {overdrive_power_cap} is the same as the current power cap: {power_caps['power_cap']}") try: - amdsmi_interface.amdsmi_dev_set_power_cap(args.gpu, 0, overdrive_power_cap) + amdsmi_interface.amdsmi_set_power_cap(args.gpu, 0, overdrive_power_cap) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1864,7 +1845,7 @@ class AMDSMICommands(): self.logger.store_output(args.gpu, 'profile', "Not Yet Implemented") if isinstance(args.perfdeterminism, int): try: - amdsmi_interface.amdsmi_set_perf_determinism_mode(args.gpu, args.perfdeterminism) + amdsmi_interface.amdsmi_set_gpu_perf_determinism_mode(args.gpu, args.perfdeterminism) except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: raise PermissionError('Command requires elevation') from e @@ -1935,7 +1916,7 @@ class AMDSMICommands(): if args.gpureset: if self.helpers.is_amd_device(args.gpu): try: - amdsmi_interface.amdsmi_dev_reset_gpu(args.gpu) + amdsmi_interface.amdsmi_reset_gpu(args.gpu) result = 'Successfully reset GPU' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -1950,7 +1931,7 @@ class AMDSMICommands(): 'clocks' : '', 'performance': ''} try: - amdsmi_interface.amdsmi_dev_set_overdrive_level_v1(args.gpu, 0) + amdsmi_interface.amdsmi_set_gpu_overdrive_level_v1(args.gpu, 0) reset_clocks_results['overdrive'] = 'Overdrive set to 0' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -1959,7 +1940,7 @@ class AMDSMICommands(): try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) reset_clocks_results['clocks'] = 'Successfully reset clocks' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -1968,7 +1949,7 @@ class AMDSMICommands(): try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) reset_clocks_results['performance'] = 'Performance level reset to auto' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -1978,7 +1959,7 @@ class AMDSMICommands(): self.logger.store_output(args.gpu, 'reset_clocks', reset_clocks_results) if args.fans: try: - amdsmi_interface.amdsmi_dev_reset_fan(args.gpu, 0) + amdsmi_interface.amdsmi_reset_gpu_fan(args.gpu, 0) result = 'Successfully reset fan speed to driver control' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -1991,7 +1972,7 @@ class AMDSMICommands(): 'performance_level': ''} try: power_profile_mask = amdsmi_interface.AmdSmiPowerProfilePresetMasks.BOOTUP_DEFAULT - amdsmi_interface.amdsmi_dev_set_power_profile(args.gpu, 0, power_profile_mask) + amdsmi_interface.amdsmi_set_gpu_power_profile(args.gpu, 0, power_profile_mask) reset_profile_results['power_profile'] = 'Successfully reset Power Profile' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -2000,7 +1981,7 @@ class AMDSMICommands(): try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) reset_profile_results['performance_level'] = 'Successfully reset Performance Level' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -2010,7 +1991,7 @@ class AMDSMICommands(): self.logger.store_output(args.gpu, 'reset_profile', reset_profile_results) if args.xgmierr: try: - amdsmi_interface.amdsmi_dev_reset_xgmi_error(args.gpu) + amdsmi_interface.amdsmi_reset_gpu_xgmi_error(args.gpu) result = 'Successfully reset XGMI Error count' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: @@ -2020,7 +2001,7 @@ class AMDSMICommands(): if args.perfdeterminism: try: level_auto = amdsmi_interface.AmdSmiDevPerfLevel.AUTO - amdsmi_interface.amdsmi_dev_set_perf_level_v1(args.gpu, level_auto) + amdsmi_interface.amdsmi_set_gpu_perf_level_v1(args.gpu, level_auto) result = 'Successfully disabled performance determinism' except amdsmi_exception.AmdSmiLibraryException as e: if e.get_error_code() == amdsmi_exception.AmdSmiRetCode.ERR_NO_PERM: diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py index e9cebac434..3bb0f1cce2 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_helpers.py @@ -61,6 +61,7 @@ class AMDSMIHelpers(): else: self._is_virtual_os = True + def os_info(self, string_format=True): """Return operating_system and type information ex. (Linux, Baremetal) params: @@ -141,11 +142,11 @@ class AMDSMIHelpers(): gpu_choices = {} gpu_choices_str = "" - # amdsmi_get_device_handles returns the device_handles storted by gpu_id - device_handles = amdsmi_interface.amdsmi_get_device_handles() + # amdsmi_get_processor_handles returns the device_handles storted for gpu_id + device_handles = amdsmi_interface.amdsmi_get_processor_handles() for gpu_id, device_handle in enumerate(device_handles): - bdf = amdsmi_interface.amdsmi_get_device_bdf(device_handle) - uuid = amdsmi_interface.amdsmi_get_device_uuid(device_handle) + bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(device_handle) + uuid = amdsmi_interface.amdsmi_get_gpu_device_uuid(device_handle) gpu_choices[str(gpu_id)] = { "BDF": bdf, "UUID": uuid, @@ -285,9 +286,9 @@ class AMDSMIHelpers(): def get_gpu_id_from_device_handle(self, input_device_handle): """Get the gpu index from the device_handle. - amdsmi_get_device_handles() returns the list of device_handles in order of gpu_index + amdsmi_get_processor_handles() returns the list of device_handles in order of gpu_index """ - device_handles = amdsmi_interface.amdsmi_get_device_handles() + device_handles = amdsmi_interface.amdsmi_get_processor_handles() for gpu_index, device_handle in enumerate(device_handles): if input_device_handle.value == device_handle.value: return gpu_index @@ -301,10 +302,10 @@ class AMDSMIHelpers(): list[BDF]: List of GPU BDFs """ gpu_bdfs = [] - device_handles = amdsmi_interface.amdsmi_get_device_handles() + device_handles = amdsmi_interface.amdsmi_get_processor_handles() for device_handle in device_handles: - bdf = amdsmi_interface.amdsmi_get_device_bdf(device_handle) + bdf = amdsmi_interface.amdsmi_get_gpu_device_bdf(device_handle) gpu_bdfs.append(bdf) return gpu_bdfs @@ -316,7 +317,7 @@ class AMDSMIHelpers(): param device: DRM device identifier """ # Get card vendor id - asic_info = amdsmi_interface.amdsmi_get_asic_info(device_handle) + asic_info = amdsmi_interface.amdsmi_get_gpu_asic_info(device_handle) return asic_info['vendor_id'] == AMD_VENDOR_ID @@ -396,3 +397,11 @@ class AMDSMIHelpers(): return False except amdsmi_exception.AmdSmiLibraryException: return False + + + def convert_bytes_to_readable(self, bytes_input): + for unit in ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB"]: + if abs(bytes_input) < 1024: + return f"{bytes_input:3.1f} {unit}" + bytes_input /= 1024 + return f"{bytes_input:.1f} YB" diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_init.py b/projects/amdsmi/amdsmi_cli/amdsmi_init.py index 602b366ee4..cb0656252e 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_init.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_init.py @@ -29,7 +29,8 @@ import sys from pathlib import Path -sys.path.append(f'{Path(__file__).resolve().parent}/../../share/amd_smi') +sys.path.append(f"{Path(__file__).resolve().parent}/../../share/amd_smi") +sys.path.append("/opt/rocm/share/amd_smi") from amdsmi import amdsmi_interface from amdsmi import amdsmi_exception diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_logger.py b/projects/amdsmi/amdsmi_cli/amdsmi_logger.py index e8e2e7fd8c..100747bb91 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_logger.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_logger.py @@ -48,6 +48,7 @@ class AMDSMILogger(): csv = 'csv' human_readable = 'human_readable' + class LoggerCompatibility(Enum): """Enum for logger compatibility""" amdsmi = 'amdsmi' @@ -55,6 +56,17 @@ class AMDSMILogger(): gpuvsmi = 'gpuvsmi' + class CsvStdoutBuilder(object): + def __init__(self): + self.csv_string = [] + + def write(self, row): + self.csv_string.append(row) + + def __str__(self): + return ''.join(self.csv_string) + + def is_json_format(self): return self.format == self.LoggerFormat.json.value @@ -79,17 +91,6 @@ class AMDSMILogger(): return self.compatibility == self.LoggerCompatibility.gpuvsmi.value - class CsvStdoutBuilder(object): - def __init__(self): - self.csv_string = [] - - def write(self, row): - self.csv_string.append(row) - - def __str__(self): - return ''.join(self.csv_string) - - def _capitalize_keys(self, input_dict): output_dict = {} for key in input_dict.keys(): @@ -239,7 +240,6 @@ class AMDSMILogger(): else: self.output[argument] = data elif self.is_csv_format(): - # New way is in gpuvsmi func self.output['gpu'] = int(gpu_id) if argument == 'values' or isinstance(data, dict): @@ -416,6 +416,7 @@ class AMDSMILogger(): human_readable_output = '' for output in self.multiple_device_output: human_readable_output += self._convert_json_to_human_readable(output) + human_readable_output += '\n' else: human_readable_output = self._convert_json_to_human_readable(self.output) @@ -432,7 +433,7 @@ class AMDSMILogger(): human_readable_output = '' for output in self.watch_output: human_readable_output += self._convert_json_to_human_readable(output) - output_file.write(human_readable_output) + output_file.write(human_readable_output + '\n') else: with self.destination.open('a') as output_file: - output_file.write(human_readable_output) + output_file.write(human_readable_output + '\n') diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_parser.py b/projects/amdsmi/amdsmi_cli/amdsmi_parser.py index acc930dd5d..4c52a0e5d6 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_parser.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_parser.py @@ -415,6 +415,7 @@ class AMDSMIParser(argparse.ArgumentParser): clock_help = "Average, max, and current clock frequencies" temperature_help = "Current temperatures" ecc_help = "Number of ECC errors" + ecc_block_help = "Number of ECC errors per block" pcie_help = "Current PCIe speed and width" voltage_help = "Current GPU voltages" @@ -459,6 +460,8 @@ class AMDSMIParser(argparse.ArgumentParser): metric_parser.add_argument('-c', '--clock', action='store_true', required=False, help=clock_help) metric_parser.add_argument('-t', '--temperature', action='store_true', required=False, help=temperature_help) metric_parser.add_argument('-e', '--ecc', action='store_true', required=False, help=ecc_help) + metric_parser.add_argument('-k', '--ecc-block', action='store_true', required=False, help=ecc_block_help) + metric_parser.add_argument('-P', '--pcie', action='store_true', required=False, help=pcie_help) metric_parser.add_argument('-V', '--voltage', action='store_true', required=False, help=voltage_help) metric_parser.add_argument('-u', '--usage', action='store_true', required=False, help=usage_help) diff --git a/projects/amdsmi/example/amd_smi_drm_example.cc b/projects/amdsmi/example/amd_smi_drm_example.cc index d878b6e4b6..f67895cc7d 100644 --- a/projects/amdsmi/example/amd_smi_drm_example.cc +++ b/projects/amdsmi/example/amd_smi_drm_example.cc @@ -244,49 +244,48 @@ int main() { // Get the device count available for the socket. uint32_t device_count = 0; - ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr); + ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr); CHK_AMDSMI_RET(ret) // Allocate the memory for the device handlers on the socket - std::vector device_handles(device_count); + std::vector processor_handles(device_count); // Get all devices of the socket - ret = amdsmi_get_device_handles(sockets[i], - &device_count, &device_handles[0]); + ret = amdsmi_get_processor_handles(sockets[i], + &device_count, &processor_handles[0]); CHK_AMDSMI_RET(ret) // For each device of the socket, get name and temperature. for (uint32_t j = 0; j < device_count; j++) { // Get device type. Since the amdsmi is initialized with - // AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU. - device_type_t device_type = {}; - ret = amdsmi_get_device_type(device_handles[j], &device_type); + // AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU. + processor_type_t processor_type = {}; + ret = amdsmi_get_processor_type(processor_handles[j], &processor_type); CHK_AMDSMI_RET(ret) - if (device_type != AMD_GPU) { + if (processor_type != AMD_GPU) { std::cout << "Expect AMD_GPU device type!\n"; return AMDSMI_STATUS_NOT_SUPPORTED; } // Get BDF info amdsmi_bdf_t bdf = {}; - ret = amdsmi_get_device_bdf(device_handles[j], &bdf); + ret = amdsmi_get_gpu_device_bdf(processor_handles[j], &bdf); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_device_bdf:\n"); + printf(" Output of amdsmi_get_gpu_device_bdf:\n"); printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i, bdf.domain_number, bdf.bus_number, bdf.device_number, bdf.function_number); // Get handle from BDF - amdsmi_device_handle dev_handle; - ret = amdsmi_get_device_handle_from_bdf(bdf, &dev_handle); + amdsmi_processor_handle dev_handle; + ret = amdsmi_get_processor_handle_from_bdf(bdf, &dev_handle); CHK_AMDSMI_RET(ret) // Get ASIC info amdsmi_asic_info_t asic_info = {}; - ret = amdsmi_get_asic_info(device_handles[j], &asic_info); + ret = amdsmi_get_gpu_asic_info(processor_handles[j], &asic_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_asic_info:\n"); + 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); @@ -294,61 +293,58 @@ int main() { // Get VBIOS info amdsmi_vbios_info_t vbios_info = {}; - ret = amdsmi_get_vbios_info(device_handles[j], &vbios_info); + ret = amdsmi_get_gpu_vbios_info(processor_handles[j], &vbios_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_vbios_info:\n"); + printf(" Output of amdsmi_get_gpu_vbios_info:\n"); 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_measure_t power_measure = {}; - ret = amdsmi_get_power_measure(device_handles[j], &power_measure); + amdsmi_power_info_t power_measure = {}; + ret = amdsmi_get_power_info(processor_handles[j], &power_measure); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_power_measure:\n"); + printf(" Output of amdsmi_get_power_info:\n"); printf("\tCurrent GFX Voltage: %d\n", - power_measure.voltage_gfx); + 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 char version[AMDSMI_MAX_DRIVER_VERSION_LENGTH]; int version_length = AMDSMI_MAX_DRIVER_VERSION_LENGTH; - ret = amdsmi_get_driver_version(device_handles[j], &version_length, version); + ret = amdsmi_get_gpu_driver_version(processor_handles[j], &version_length, version); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_driver_version:\n"); + printf(" Output of amdsmi_get_gpu_driver_version:\n"); printf("\tDriver version: %s\n\n", version); // Get device uuid unsigned int uuid_length = AMDSMI_GPU_UUID_SIZE; char uuid[AMDSMI_GPU_UUID_SIZE]; - ret = amdsmi_get_device_uuid(device_handles[j], &uuid_length, uuid); + ret = amdsmi_get_gpu_device_uuid(processor_handles[j], &uuid_length, uuid); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_device_uuid:\n"); + printf(" Output of amdsmi_get_gpu_device_uuid:\n"); printf("\tDevice uuid: %s\n\n", uuid); // Get engine usage info amdsmi_engine_usage_t engine_usage = {}; - ret = amdsmi_get_gpu_activity(device_handles[j], &engine_usage); + ret = amdsmi_get_gpu_activity(processor_handles[j], &engine_usage); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_gpu_activity:\n"); 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); // Get firmware info amdsmi_fw_info_t fw_information = {}; char ucode_name[AMDSMI_MAX_STRING_LENGTH]; - ret = amdsmi_get_fw_info(device_handles[j], &fw_information); + ret = amdsmi_get_fw_info(processor_handles[j], &fw_information); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_fw_info:\n"); printf("Number of Microcodes: %d\n", fw_information.num_fw_info); @@ -358,27 +354,25 @@ int main() { } // Get GFX clock measurements - amdsmi_clk_measure_t gfx_clk_values = {}; - ret = amdsmi_get_clock_measure(device_handles[j], CLK_TYPE_GFX, + amdsmi_clk_info_t gfx_clk_values = {}; + ret = amdsmi_get_clock_info(processor_handles[j], CLK_TYPE_GFX, &gfx_clk_values); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_clock_measure:\n"); + 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 - amdsmi_clk_measure_t mem_clk_values = {}; - ret = amdsmi_get_clock_measure(device_handles[j], CLK_TYPE_MEM, + amdsmi_clk_info_t mem_clk_values = {}; + ret = amdsmi_get_clock_info(processor_handles[j], CLK_TYPE_MEM, &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 amdsmi_pcie_info_t pcie_info = {}; - ret = amdsmi_get_pcie_link_status(device_handles[j], &pcie_info); + ret = amdsmi_get_pcie_link_status(processor_handles[j], &pcie_info); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_pcie_link_status:\n"); printf("\tPCIe lanes: %d\n", pcie_info.pcie_lanes); @@ -386,7 +380,7 @@ int main() { // Get PCIe caps amdsmi_pcie_info_t pcie_caps_info = {}; - ret = amdsmi_get_pcie_link_caps(device_handles[j], &pcie_caps_info); + ret = amdsmi_get_pcie_link_caps(processor_handles[j], &pcie_caps_info); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_pcie_link_caps:\n"); printf("\tPCIe max lanes: %d\n", pcie_caps_info.pcie_lanes); @@ -394,16 +388,16 @@ int main() { // Get VRAM temperature limit int64_t temperature = 0; - ret = amdsmi_dev_get_temp_metric( - device_handles[j], TEMPERATURE_TYPE_VRAM, + ret = amdsmi_get_temp_metric( + processor_handles[j], TEMPERATURE_TYPE_VRAM, AMDSMI_TEMP_CRITICAL, &temperature); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_dev_get_temp_metric:\n"); + printf(" Output of amdsmi_get_temp_metric:\n"); printf("\tGPU VRAM temp limit: %ld\n", temperature); // Get GFX temperature limit - ret = amdsmi_dev_get_temp_metric( - device_handles[j], TEMPERATURE_TYPE_EDGE, + ret = amdsmi_get_temp_metric( + processor_handles[j], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CRITICAL, &temperature); CHK_AMDSMI_RET(ret) printf("\tGPU GFX temp limit: %ld\n\n", temperature); @@ -416,13 +410,13 @@ int main() { TEMPERATURE_TYPE_EDGE, TEMPERATURE_TYPE_JUNCTION, TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX}; for (const auto &temp_type : temp_types) { - ret = amdsmi_dev_get_temp_metric( - device_handles[j], temp_type, + ret = amdsmi_get_temp_metric( + processor_handles[j], temp_type, AMDSMI_TEMP_CURRENT, &temp_measurements[(int)(temp_type)]); CHK_AMDSMI_RET(ret) } - printf(" Output of amdsmi_dev_get_temp_metric:\n"); + printf(" Output of amdsmi_get_temp_metric:\n"); printf("\tGPU Edge temp measurement: %ld\n", temp_measurements[TEMPERATURE_TYPE_EDGE]); printf("\tGPU Junction temp measurement: %ld\n", @@ -442,11 +436,11 @@ int main() { "ENABLED"}; amdsmi_ras_err_state_t state = {}; int index = 0; - printf(" Output of amdsmi_get_ras_block_features_enabled:\n"); + printf(" Output of amdsmi_get_gpu_ras_block_features_enabled:\n"); for (auto block = AMDSMI_GPU_BLOCK_FIRST; block <= AMDSMI_GPU_BLOCK_LAST; block = (amdsmi_gpu_block_t)(block * 2)) { - ret = amdsmi_get_ras_block_features_enabled(device_handles[j], block, + ret = amdsmi_get_gpu_ras_block_features_enabled(processor_handles[j], block, &state); CHK_AMDSMI_RET(ret) printf("\tBlock: %s\n", block_names[index]); @@ -459,15 +453,15 @@ int main() { char bad_page_status_names[3][15] = {"RESERVED", "PENDING", "UNRESERVABLE"}; uint32_t num_pages = 0; - ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages, + ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages, nullptr); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_bad_page_info:\n"); + printf(" Output of amdsmi_get_gpu_bad_page_info:\n"); if (!num_pages) { printf("\tNo bad pages found.\n"); } else { std::vector bad_page_info(num_pages); - ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages, + ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages, bad_page_info.data()); CHK_AMDSMI_RET(ret) for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) { @@ -484,9 +478,9 @@ int main() { // Get ECC error counts amdsmi_error_count_t err_cnt_info = {}; - ret = amdsmi_get_ecc_error_count(device_handles[j], &err_cnt_info); + ret = amdsmi_get_gpu_ecc_error_count(processor_handles[j], &err_cnt_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_ecc_error_count:\n"); + printf(" Output of amdsmi_get_gpu_ecc_error_count:\n"); printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count); printf("\tUncorrectable errors: %lu\n\n", err_cnt_info.uncorrectable_count); @@ -500,10 +494,10 @@ int main() { // Get frequency ranges amdsmi_frequency_range_t freq_ranges = {}; - ret = amdsmi_get_target_frequency_range( - device_handles[j], CLK_TYPE_GFX, &freq_ranges); + ret = amdsmi_get_gpu_target_frequency_range( + processor_handles[j], CLK_TYPE_GFX, &freq_ranges); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_target_frequency_range:\n"); + printf(" Output of amdsmi_get_gpu_target_frequency_range:\n"); printf("\tSupported min freq: %lu\n", freq_ranges.supported_freq_range.lower_bound); printf("\tSupported max freq: %lu\n", @@ -514,7 +508,7 @@ int main() { freq_ranges.current_freq_range.upper_bound); uint32_t num_process = 0; - ret = amdsmi_get_process_list(device_handles[j], nullptr, + ret = amdsmi_get_gpu_process_list(processor_handles[j], nullptr, &num_process); CHK_AMDSMI_RET(ret) if (!num_process) { @@ -524,22 +518,22 @@ 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); int num = 0; - ret = amdsmi_get_process_list(device_handles[j], process_list, + ret = amdsmi_get_gpu_process_list(processor_handles[j], process_list, &num_process); CHK_AMDSMI_RET(ret) for (uint32_t it = 0; it < num_process; it += 1) { if (getpid() == process_list[it]) { continue; } - ret = amdsmi_get_process_info(device_handles[j], + ret = amdsmi_get_gpu_process_info(processor_handles[j], process_list[it], &process); if (ret != AMDSMI_STATUS_SUCCESS) { - printf("amdsmi_get_process_info() failed for " + printf("amdsmi_get_gpu_process_info() failed for " "process_list[%d], returned %d\n", it, ret); continue; @@ -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"); @@ -623,9 +606,9 @@ int main() { // Get device name amdsmi_board_info_t board_info = {}; - ret = amdsmi_get_board_info(device_handles[j], &board_info); + ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_board_info:\n"); + printf(" Output of amdsmi_get_gpu_board_info:\n"); std::cout << "\tdevice [" << j << "]\n\t\tProduct name: " << board_info.product_name << "\n" @@ -636,39 +619,23 @@ int main() { // Get temperature int64_t val_i64 = 0; - ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE, + ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &val_i64); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_dev_get_temp_metric:\n"); + printf(" Output of amdsmi_get_temp_metric:\n"); std::cout << "\t\tTemperature: " << val_i64 << "C" << "\n\n"; // Get frame buffer amdsmi_vram_info_t vram_usage = {}; - ret = amdsmi_get_vram_usage(device_handles[j], &vram_usage); + ret = amdsmi_get_gpu_vram_usage(processor_handles[j], &vram_usage); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_vram_usage:\n"); + printf(" Output of amdsmi_get_gpu_vram_usage:\n"); 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(device_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(device_handles[j], 0, &cap_info); + ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_power_cap_info:\n"); std::cout << "\t\t Power Cap: " << cap_info.power_cap diff --git a/projects/amdsmi/example/amd_smi_nodrm_example.cc b/projects/amdsmi/example/amd_smi_nodrm_example.cc index 43c01594ff..7222bdf339 100644 --- a/projects/amdsmi/example/amd_smi_nodrm_example.cc +++ b/projects/amdsmi/example/amd_smi_nodrm_example.cc @@ -96,42 +96,41 @@ int main() { // Get the device count available for the socket. uint32_t device_count = 0; - ret = amdsmi_get_device_handles(sockets[i], &device_count, nullptr); + ret = amdsmi_get_processor_handles(sockets[i], &device_count, nullptr); CHK_AMDSMI_RET(ret) // Allocate the memory for the device handlers on the socket - std::vector device_handles(device_count); + std::vector processor_handles(device_count); // Get all devices of the socket - ret = amdsmi_get_device_handles(sockets[i], - &device_count, &device_handles[0]); + ret = amdsmi_get_processor_handles(sockets[i], + &device_count, &processor_handles[0]); CHK_AMDSMI_RET(ret) // For each device of the socket, get name and temperature. for (uint32_t j = 0; j < device_count; j++) { // Get device type. Since the amdsmi is initialized with - // AMD_SMI_INIT_AMD_GPUS, the device_type must be AMD_GPU. - device_type_t device_type = {}; - ret = amdsmi_get_device_type(device_handles[j], &device_type); + // AMD_SMI_INIT_AMD_GPUS, the processor_type must be AMD_GPU. + processor_type_t processor_type = {}; + ret = amdsmi_get_processor_type(processor_handles[j], &processor_type); CHK_AMDSMI_RET(ret) - if (device_type != AMD_GPU) { + if (processor_type != AMD_GPU) { std::cout << "Expect AMD_GPU device type!\n"; return AMDSMI_STATUS_NOT_SUPPORTED; } amdsmi_bdf_t bdf = {}; - ret = amdsmi_get_device_bdf(device_handles[j], &bdf); + ret = amdsmi_get_gpu_device_bdf(processor_handles[j], &bdf); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_device_bdf:\n"); + printf(" Output of amdsmi_get_gpu_device_bdf:\n"); printf("\tDevice[%d] BDF %04lx:%02x:%02x.%d\n\n", i, bdf.domain_number, bdf.bus_number, bdf.device_number, bdf.function_number); amdsmi_asic_info_t asic_info = {}; - ret = amdsmi_get_asic_info(device_handles[j], &asic_info); + ret = amdsmi_get_gpu_asic_info(processor_handles[j], &asic_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_asic_info:\n"); + 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); @@ -139,31 +138,30 @@ int main() { // Get VBIOS info amdsmi_vbios_info_t vbios_info = {}; - ret = amdsmi_get_vbios_info(device_handles[j], &vbios_info); + ret = amdsmi_get_gpu_vbios_info(processor_handles[j], &vbios_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_vbios_info:\n"); + printf(" Output of amdsmi_get_gpu_vbios_info:\n"); 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 = {}; - ret = amdsmi_get_gpu_activity(device_handles[j], &engine_usage); + ret = amdsmi_get_gpu_activity(processor_handles[j], &engine_usage); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_gpu_activity:\n"); 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); // Get firmware info amdsmi_fw_info_t fw_information = {}; - ret = amdsmi_get_fw_info(device_handles[j], &fw_information); + ret = amdsmi_get_fw_info(processor_handles[j], &fw_information); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_fw_info:\n"); printf("\tFirmware version: %d\n", fw_information.num_fw_info); @@ -226,13 +224,13 @@ int main() { TEMPERATURE_TYPE_EDGE, TEMPERATURE_TYPE_JUNCTION, TEMPERATURE_TYPE_VRAM, TEMPERATURE_TYPE_PLX}; for (const auto &temp_type : temp_types) { - ret = amdsmi_dev_get_temp_metric( - device_handles[j], temp_type, + ret = amdsmi_get_temp_metric( + processor_handles[j], temp_type, AMDSMI_TEMP_CURRENT, &temp_measurements[(int)(temp_type)]); CHK_AMDSMI_RET(ret) } - printf(" Output of amdsmi_dev_get_temp_metric:\n"); + printf(" Output of amdsmi_get_temp_metric:\n"); printf("\tGPU Edge temp measurement: %ld\n", temp_measurements[TEMPERATURE_TYPE_EDGE]); printf("\tGPU Junction temp measurement: %ld\n", @@ -246,15 +244,15 @@ int main() { char bad_page_status_names[3][15] = {"RESERVED", "PENDING", "UNRESERVABLE"}; uint32_t num_pages = 0; - ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages, + ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages, nullptr); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_bad_page_info:\n"); + printf(" Output of amdsmi_get_gpu_bad_page_info:\n"); if (!num_pages) { printf("\tNo bad pages found.\n"); } else { std::vector bad_page_info(num_pages); - ret = amdsmi_get_bad_page_info(device_handles[j], &num_pages, + ret = amdsmi_get_gpu_bad_page_info(processor_handles[j], &num_pages, bad_page_info.data()); CHK_AMDSMI_RET(ret) for (uint32_t page_it = 0; page_it < num_pages; page_it += 1) { @@ -271,9 +269,9 @@ int main() { // Get ECC error counts amdsmi_error_count_t err_cnt_info = {}; - ret = amdsmi_get_ecc_error_count(device_handles[j], &err_cnt_info); + ret = amdsmi_get_gpu_ecc_error_count(processor_handles[j], &err_cnt_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_ecc_error_count:\n"); + printf(" Output of amdsmi_get_gpu_ecc_error_count:\n"); printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count); printf("\tUncorrectable errors: %lu\n\n", err_cnt_info.uncorrectable_count); @@ -287,9 +285,9 @@ int main() { // Get device name amdsmi_board_info_t board_info = {}; - ret = amdsmi_get_board_info(device_handles[j], &board_info); + ret = amdsmi_get_gpu_board_info(processor_handles[j], &board_info); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_board_info:\n"); + printf(" Output of amdsmi_get_gpu_board_info:\n"); std::cout << "\tdevice [" << j << "]\n\t\tProduct name: " << board_info.product_name << "\n" @@ -300,39 +298,23 @@ int main() { // Get temperature int64_t val_i64 = 0; - ret = amdsmi_dev_get_temp_metric(device_handles[j], TEMPERATURE_TYPE_EDGE, + ret = amdsmi_get_temp_metric(processor_handles[j], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &val_i64); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_dev_get_temp_metric:\n"); + printf(" Output of amdsmi_get_temp_metric:\n"); std::cout << "\t\tTemperature: " << val_i64 << "C" << "\n\n"; // Get frame buffer amdsmi_vram_info_t vram_usage = {}; - ret = amdsmi_get_vram_usage(device_handles[j], &vram_usage); + ret = amdsmi_get_gpu_vram_usage(processor_handles[j], &vram_usage); CHK_AMDSMI_RET(ret) - printf(" Output of amdsmi_get_vram_usage:\n"); + printf(" Output of amdsmi_get_gpu_vram_usage:\n"); 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(device_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(device_handles[j], 0, &cap_info); + ret = amdsmi_get_power_cap_info(processor_handles[j], 0, &cap_info); CHK_AMDSMI_RET(ret) printf(" Output of amdsmi_get_power_cap_info:\n"); std::cout << "\t\t Power Cap: " << cap_info.power_cap / 1000000 diff --git a/projects/amdsmi/include/amd_smi/amdsmi.h b/projects/amdsmi/include/amd_smi/amdsmi.h index ed8716935f..7618ab6477 100644 --- a/projects/amdsmi/include/amd_smi/amdsmi.h +++ b/projects/amdsmi/include/amd_smi/amdsmi.h @@ -120,7 +120,7 @@ typedef enum { } amdsmi_container_types_t; //! opaque handler point to underlying implementation -typedef void *amdsmi_device_handle; +typedef void *amdsmi_processor_handle; typedef void *amdsmi_socket_handle; /** @@ -132,7 +132,7 @@ typedef enum { AMD_CPU, NON_AMD_GPU, NON_AMD_CPU -} device_type_t; +} processor_type_t; /** * @brief Error codes returned by amdsmi functions @@ -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,27 +353,25 @@ typedef struct { typedef struct { uint32_t average_socket_power; - uint64_t energy_accumulator; // v1 mod. (32->64) - uint32_t voltage_gfx; // GFX voltage measurement in mV - uint32_t voltage_soc; // SOC voltage measurement in mV - uint32_t voltage_mem; // MEM voltage measurement in mV + 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]; -} amdsmi_power_measure_t; + 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]; -} amdsmi_clk_measure_t; +} amdsmi_clk_info_t; 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 @@ -609,7 +579,7 @@ typedef enum { * Event notification data returned from event notification API */ typedef struct { - amdsmi_device_handle device_handle; //!< Handler of device that corresponds to the event + amdsmi_processor_handle processor_handle; //!< Handler of device that corresponds to the event amdsmi_evt_notification_type_t event; //!< Event type char message[MAX_EVENT_NOTIFICATION_MSG_SIZE]; //!< Event message } amdsmi_evt_notification_data_t; @@ -693,7 +663,7 @@ typedef enum { /** * @brief Pre-set Profile Selections. These bitmasks can be AND'd with the * ::amdsmi_power_profile_status_t.available_profiles returned from - * :: amdsmi_dev_get_power_profile_presets to determine which power profiles + * :: amdsmi_get_gpu_power_profile_presets to determine which power profiles * are supported by the system. */ typedef enum { @@ -1141,7 +1111,7 @@ typedef union { * @details This function initializes the library and the internal data structures, * including those corresponding to sources of information that SMI provides. * - * The @p init_flags decides which type of device + * The @p init_flags decides which type of processor * can be discovered by ::amdsmi_get_socket_handles(). AMDSMI_INIT_AMD_GPUS returns * sockets with AMD GPUS, and AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS returns * sockets with either AMD GPUS or CPUS. @@ -1179,8 +1149,8 @@ amdsmi_status_t amdsmi_shut_down(void); * @details Depends on what flag is passed to ::amdsmi_init. AMDSMI_INIT_AMD_GPUS * returns sockets with AMD GPUS, and AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS returns * sockets with either AMD GPUS or CPUS. - * The socket handles can be used to query the device handles in that socket, which - * will be used in other APIs to get device detail information or telemtries. + * The socket handles can be used to query the processor handles in that socket, which + * will be used in other APIs to get processor detail information or telemtries. * * @param[in,out] socket_count As input, the value passed * through this parameter is the number of ::amdsmi_socket_handle that @@ -1221,70 +1191,70 @@ amdsmi_status_t amdsmi_get_socket_info( char *name, size_t len); /** - * @brief Get the list of the device handles associated to a socket. + * @brief Get the list of the processor handles associated to a socket. * - * @details This function retrieves the device handles of a socket. The - * @p socket_handle must be provided for the device. A socket may have mulitple different - * type devices: An APU on a socket have both CPUs and GPUs. + * @details This function retrieves the processor handles of a socket. The + * @p socket_handle must be provided for the processor. A socket may have mulitple different + * type processors: An APU on a socket have both CPUs and GPUs. * Currently, only AMD GPUs are supported. * - * The number of device count is returned through @p device_count - * if @p device_handles is NULL. Then the number of @p device_count can be pass - * as input to retrieval all devices on the socket to @p device_handles. + * The number of processor count is returned through @p processor_count + * if @p processor_handles is NULL. Then the number of @p processor_count can be pass + * as input to retrieval all processors on the socket to @p processor_handles. * * @param[in] socket_handle The socket to query * - * @param[in,out] device_count As input, the value passed - * through this parameter is the number of ::amdsmi_device_handle's that - * may be safely written to the memory pointed to by @p device_handles. This is the - * limit on how many device handles will be written to @p device_handles. On return, @p - * device_count will contain the number of device handles written to @p device_handles, - * or the number of device handles that could have been written if enough memory had been + * @param[in,out] processor_count As input, the value passed + * through this parameter is the number of ::amdsmi_processor_handle's that + * may be safely written to the memory pointed to by @p processor_handles. This is the + * limit on how many processor handles will be written to @p processor_handles. On return, @p + * processor_count will contain the number of processor handles written to @p processor_handles, + * or the number of processor handles that could have been written if enough memory had been * provided. - * If @p device_handles is NULL, as output, @p device_count will contain - * how many devices are available to read for the socket. + * If @p processor_handles is NULL, as output, @p processor_count will contain + * how many processors are available to read for the socket. * - * @param[in,out] device_handles A pointer to a block of memory to which the - * ::amdsmi_device_handle values will be written. This value may be NULL. - * In this case, this function can be used to query how many devices are + * @param[in,out] processor_handles A pointer to a block of memory to which the + * ::amdsmi_processor_handle values will be written. This value may be NULL. + * In this case, this function can be used to query how many processors are * available to read. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_get_device_handles(amdsmi_socket_handle socket_handle, - uint32_t *device_count, - amdsmi_device_handle* device_handles); +amdsmi_status_t amdsmi_get_processor_handles(amdsmi_socket_handle socket_handle, + uint32_t *processor_count, + amdsmi_processor_handle* processor_handles); /** - * @brief Get the device type of the device_handle + * @brief Get the processor type of the processor_handle * - * @details This function retrieves the device type. A device_handle must be provided - * for that device. + * @details This function retrieves the processor type. A processor_handle must be provided + * for that processor. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * - * @param[out] device_type a pointer to device_type_t to which the device type + * @param[out] processor_type a pointer to processor_type_t to which the processor type * will be written. If this parameter is nullptr, this function will return * ::AMDSMI_STATUS_INVAL. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_get_device_type(amdsmi_device_handle device_handle, - device_type_t* device_type); +amdsmi_status_t amdsmi_get_processor_type(amdsmi_processor_handle processor_handle, + processor_type_t* processor_type); /** - * @brief Get device handle with the matching bdf. + * @brief Get processor handle with the matching bdf. * * @details Given bdf info @p bdf, this function will get - * the device handle with the matching bdf. + * the processor handle with the matching bdf. * - * @param[in] bdf The bdf to match with corresponding device handle. + * @param[in] bdf The bdf to match with corresponding processor handle. * - * @param[out] device_handle device handle with the matching bdf. + * @param[out] processor_handle processor handle with the matching bdf. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_get_device_handle_from_bdf(amdsmi_bdf_t bdf, amdsmi_device_handle* device_handle); +amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf, amdsmi_processor_handle* processor_handle); /** @} End DiscQueries */ @@ -1298,15 +1268,15 @@ amdsmi_status_t amdsmi_get_device_handle_from_bdf(amdsmi_bdf_t bdf, amdsmi_devic * @brief Get the device id associated with the device with provided device * handler. * - * @details Given a device handle @p device_handle and a pointer to a uint32_t @p id, + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p id, * this function will write the device id value to the uint64_t pointed to by * @p id. This ID is an identification of the type of device, so calling this * function for different devices will give the same value if they are kind * of device. Consequently, this function should not be used to distinguish - * one device from another. amdsmi_dev_get_pci_id() should be used to get a + * one device from another. amdsmi_get_gpu_pci_id() should be used to get a * unique identifier. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] id a pointer to uint64_t to which the device id will be * written @@ -1317,12 +1287,12 @@ amdsmi_status_t amdsmi_get_device_handle_from_bdf(amdsmi_bdf_t bdf, amdsmi_devic * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_id(amdsmi_device_handle device_handle, uint16_t *id); +amdsmi_status_t amdsmi_get_gpu_id(amdsmi_processor_handle processor_handle, uint16_t *id); /** * @brief Get the name string for a give vendor ID * - * @details Given a device handle @p device_handle, a pointer to a caller provided + * @details Given a processor handle @p processor_handle, a pointer to a caller provided * char buffer @p name, and a length of this buffer @p len, this function will * write the name of the vendor (up to @p len characters) buffer @p name. The * @p id may be a device vendor or subsystem vendor ID. @@ -1333,7 +1303,7 @@ amdsmi_status_t amdsmi_dev_get_id(amdsmi_device_handle device_handle, uint16_t * * as a string. Updating the system name files can be accompplished with * "sudo update-pciids". * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] name a pointer to a caller provided char buffer to which the * name will be written @@ -1350,23 +1320,23 @@ amdsmi_status_t amdsmi_dev_get_id(amdsmi_device_handle device_handle, uint16_t * * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_vendor_name(amdsmi_device_handle device_handle, char *name, +amdsmi_status_t amdsmi_get_gpu_vendor_name(amdsmi_processor_handle processor_handle, char *name, size_t len); /** * @brief Get the vram vendor string of a device. * - * @details This function retrieves the vram vendor name given a device handle - * @p device_handle, a pointer to a caller provided + * @details This function retrieves the vram vendor name given a processor handle + * @p processor_handle, a pointer to a caller provided * char buffer @p brand, and a length of this buffer @p len, this function * will write the vram vendor of the device (up to @p len characters) to the * buffer @p brand. * * If the vram vendor for the device is not found as one of the values - * contained within amdsmi_dev_get_vram_vendor, then this function will return + * contained within amdsmi_get_gpu_vram_vendor, then this function will return * the string 'unknown' instead of the vram vendor. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] brand a pointer to a caller provided char buffer to which the * vram vendor will be written @@ -1375,18 +1345,18 @@ amdsmi_status_t amdsmi_dev_get_vendor_name(amdsmi_device_handle device_handle, c * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_vram_vendor(amdsmi_device_handle device_handle, char *brand, +amdsmi_status_t amdsmi_get_gpu_vram_vendor(amdsmi_processor_handle processor_handle, char *brand, uint32_t len); /** * @brief Get the subsystem device id associated with the device with - * provided device handle. + * provided processor handle. * - * @details Given a device handle @p device_handle and a pointer to a uint32_t @p id, + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p id, * this function will write the subsystem device id value to the uint64_t * pointed to by @p id. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] id a pointer to uint64_t to which the subsystem device id * will be written @@ -1397,12 +1367,12 @@ amdsmi_status_t amdsmi_dev_get_vram_vendor(amdsmi_device_handle device_handle, c * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_subsystem_id(amdsmi_device_handle device_handle, uint16_t *id); +amdsmi_status_t amdsmi_get_gpu_subsystem_id(amdsmi_processor_handle processor_handle, uint16_t *id); /** * @brief Get the name string for the device subsytem * - * @details Given a device handle @p device_handle, a pointer to a caller provided + * @details Given a processor handle @p processor_handle, a pointer to a caller provided * char buffer @p name, and a length of this buffer @p len, this function * will write the name of the device subsystem (up to @p len characters) * to the buffer @p name. @@ -1413,7 +1383,7 @@ amdsmi_status_t amdsmi_dev_get_subsystem_id(amdsmi_device_handle device_handle, * ID as a string. Updating the system name files can be accompplished with * "sudo update-pciids". * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] name a pointer to a caller provided char buffer to which the * name will be written @@ -1431,15 +1401,15 @@ amdsmi_status_t amdsmi_dev_get_subsystem_id(amdsmi_device_handle device_handle, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_subsystem_name(amdsmi_device_handle device_handle, char *name, size_t len); +amdsmi_get_gpu_subsystem_name(amdsmi_processor_handle processor_handle, char *name, size_t len); /** * @brief Get the drm minor number associated with this device * - * @details Given a device handle @p device_handle, find its render device file + * @details Given a processor handle @p processor_handle, find its render device file * /dev/dri/renderDN where N corresponds to its minor number. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] minor a pointer to a uint32_t into which minor number will * be copied @@ -1447,7 +1417,7 @@ amdsmi_dev_get_subsystem_name(amdsmi_device_handle device_handle, char *name, si * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_drm_render_minor(amdsmi_device_handle device_handle, uint32_t *minor); +amdsmi_get_gpu_drm_render_minor(amdsmi_processor_handle processor_handle, uint32_t *minor); /** @} End IDQuer */ @@ -1460,12 +1430,12 @@ amdsmi_dev_get_drm_render_minor(amdsmi_device_handle device_handle, uint32_t *mi /** * @brief Get the list of possible PCIe bandwidths that are available. * - * @details Given a device handle @p device_handle and a pointer to a to an + * @details Given a processor handle @p processor_handle and a pointer to a to an * ::amdsmi_pcie_bandwidth_t structure @p bandwidth, this function will fill in * @p bandwidth with the possible T/s values and associated number of lanes, * and indication of the current selection. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] bandwidth a pointer to a caller provided * ::amdsmi_pcie_bandwidth_t structure to which the frequency information will be @@ -1474,14 +1444,14 @@ amdsmi_dev_get_drm_render_minor(amdsmi_device_handle device_handle, uint32_t *mi * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_pci_bandwidth(amdsmi_device_handle device_handle, amdsmi_pcie_bandwidth_t *bandwidth); +amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, amdsmi_pcie_bandwidth_t *bandwidth); /** * @brief Get the unique PCI device identifier associated for a device * - * @details Give a device handle @p device_handle and a pointer to a uint64_t @p + * @details Give a processor handle @p processor_handle and a pointer to a uint64_t @p * bdfid, this function will write the Bus/Device/Function PCI identifier - * (BDFID) associated with device @p device_handle to the value pointed to by + * (BDFID) associated with device @p processor_handle to the value pointed to by * @p bdfid. * * The format of @p bdfid will be as follows: @@ -1497,7 +1467,7 @@ amdsmi_dev_get_pci_bandwidth(amdsmi_device_handle device_handle, amdsmi_pcie_ban * | Device | [ 7: 3] | * | Function | [ 2: 0] | * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] bdfid a pointer to uint64_t to which the device bdfid value * will be written @@ -1508,17 +1478,17 @@ amdsmi_dev_get_pci_bandwidth(amdsmi_device_handle device_handle, amdsmi_pcie_ban * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_pci_id(amdsmi_device_handle device_handle, uint64_t *bdfid); +amdsmi_status_t amdsmi_get_gpu_pci_id(amdsmi_processor_handle processor_handle, uint64_t *bdfid); /** * @brief Get the NUMA node associated with a device * - * @details Given a device handle @p device_handle and a pointer to a uint32_t @p + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p * numa_node, this function will retrieve the NUMA node value associated - * with device @p device_handle and store the value at location pointed to by + * with device @p processor_handle and store the value at location pointed to by * @p numa_node. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] numa_node pointer to location where NUMA node value will * be written. @@ -1529,18 +1499,18 @@ amdsmi_status_t amdsmi_dev_get_pci_id(amdsmi_device_handle device_handle, uint64 * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_topo_get_numa_affinity(amdsmi_device_handle device_handle, uint32_t *numa_node); +amdsmi_status_t amdsmi_get_gpu_topo_numa_affinity(amdsmi_processor_handle processor_handle, uint32_t *numa_node); /** * @brief Get PCIe traffic information * - * @details Give a device handle @p device_handle and pointers to a uint64_t's, @p + * @details Give a processor handle @p processor_handle and pointers to a uint64_t's, @p * sent, @p received and @p max_pkt_sz, this function will write the number * of bytes sent and received in 1 second to @p sent and @p received, * respectively. The maximum possible packet size will be written to * @p max_pkt_sz. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] sent a pointer to uint64_t to which the number of bytes sent * will be written in 1 second. If pointer is NULL, it will be ignored. @@ -1553,18 +1523,18 @@ amdsmi_status_t amdsmi_topo_get_numa_affinity(amdsmi_device_handle device_handle * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_pci_throughput(amdsmi_device_handle device_handle, uint64_t *sent, +amdsmi_status_t amdsmi_get_gpu_pci_throughput(amdsmi_processor_handle processor_handle, uint64_t *sent, uint64_t *received, uint64_t *max_pkt_sz); /** * @brief Get PCIe replay counter * - * @details Given a device handle @p device_handle and a pointer to a uint64_t @p + * @details Given a processor handle @p processor_handle and a pointer to a uint64_t @p * counter, this function will write the sum of the number of NAK's received * by the GPU and the NAK's generated by the GPU to memory pointed to by @p * counter. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] counter a pointer to uint64_t to which the sum of the NAK's * received and generated by the GPU is written @@ -1575,7 +1545,7 @@ amdsmi_status_t amdsmi_dev_get_pci_throughput(amdsmi_device_handle device_handle * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_pci_replay_counter(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_pci_replay_counter(amdsmi_processor_handle processor_handle, uint64_t *counter); /** @} End PCIeQuer */ @@ -1589,10 +1559,10 @@ amdsmi_status_t amdsmi_dev_get_pci_replay_counter(amdsmi_device_handle device_h /** * @brief Control the set of allowed PCIe bandwidths that can be used. * - * @details Given a device handle @p device_handle and a 64 bit bitmask @p bw_bitmask, + * @details Given a processor handle @p processor_handle and a 64 bit bitmask @p bw_bitmask, * this function will limit the set of allowable bandwidths. If a bit in @p * bw_bitmask has a value of 1, then the frequency (as ordered in an - * ::amdsmi_frequencies_t returned by :: amdsmi_dev_get_gpu_clk_freq()) corresponding + * ::amdsmi_frequencies_t returned by :: amdsmi_get_clk_freq()) corresponding * to that bit index will be allowed. * * This function will change the performance level to @@ -1606,7 +1576,7 @@ amdsmi_status_t amdsmi_dev_get_pci_replay_counter(amdsmi_device_handle device_h * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] bw_bitmask A bitmask indicating the indices of the * bandwidths that are to be enabled (1) and disabled (0). Only the lowest @@ -1615,7 +1585,7 @@ amdsmi_status_t amdsmi_dev_get_pci_replay_counter(amdsmi_device_handle device_h * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_pci_bandwidth(amdsmi_device_handle device_handle, uint64_t bw_bitmask); +amdsmi_status_t amdsmi_set_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, uint64_t bw_bitmask); /** @} End PCIeCont */ @@ -1626,41 +1596,17 @@ amdsmi_status_t amdsmi_dev_set_pci_bandwidth(amdsmi_device_handle device_handle */ /** - * @brief Get the average power consumption of a device + * @brief Get the energy accumulator counter of the processor with provided + * processor handle. * - * @details This function will write the current average power consumption - * (in microwatts) to the uint64_t pointed to by @p power, for the given - * device handle @p device_handle and a pointer to a uint64_t @p power - * - * @param[in] device_handle a device handle - * - * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. - * If a device 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_dev_get_power_ave(amdsmi_device_handle device_handle, uint32_t sensor_ind, uint64_t *power); - -/** - * @brief Get the energy accumulator counter of the device with provided - * device handle. - * - * @details Given a device handle @p device_handle, a pointer to a uint64_t + * @details Given a processor handle @p processor_handle, a pointer to a uint64_t * @p power, and a pointer to a uint64_t @p timestamp, this function will write * amount of energy consumed to the uint64_t pointed to by @p power, * and the timestamp to the uint64_t pointed to by @p timestamp. - * The amdsmi_dev_get_power_ave() is an average of a short time. This function + * The amdsmi_get_power_ave() is an average of a short time. This function * accumulates all energy consumed. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * @param[in,out] counter_resolution resolution of the counter @p power in * micro Joules * @@ -1677,7 +1623,7 @@ amdsmi_dev_get_power_ave(amdsmi_device_handle device_handle, uint32_t sensor_ind * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_energy_count(amdsmi_device_handle device_handle, uint64_t *power, +amdsmi_get_energy_count(amdsmi_processor_handle processor_handle, uint64_t *power, float *counter_resolution, uint64_t *timestamp); /** @} End PowerQuer */ @@ -1694,10 +1640,10 @@ amdsmi_dev_get_energy_count(amdsmi_device_handle device_handle, uint64_t *power, * @p cap must be between the minimum and maximum power cap values set by the * system, which can be obtained from ::amdsmi_dev_power_cap_range_get. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. - * If a device has more than one sensor, it could be greater than 0. + * If a processor has more than one sensor, it could be greater than 0. * * @param[in] cap a uint64_t that indicates the desired power cap, in * microwatts @@ -1705,17 +1651,17 @@ amdsmi_dev_get_energy_count(amdsmi_device_handle device_handle, uint64_t *power, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_dev_set_power_cap(amdsmi_device_handle device_handle, uint32_t sensor_ind, uint64_t cap); + amdsmi_set_power_cap(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t cap); /** * @brief Set the power performance profile * * @details This function will attempt to set the current profile to the provided - * profile, given a device handle @p device_handle and a @p profile. The provided + * profile, given a processor handle @p processor_handle and a @p profile. The provided * profile must be one of the currently supported profiles, as indicated by a - * call to :: amdsmi_dev_get_power_profile_presets() + * call to :: amdsmi_get_gpu_power_profile_presets() * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] reserved Not currently used. Set to 0. * @@ -1725,7 +1671,7 @@ amdsmi_status_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_dev_set_power_profile(amdsmi_device_handle device_handle, uint32_t reserved, + amdsmi_set_gpu_power_profile(amdsmi_processor_handle processor_handle, uint32_t reserved, amdsmi_power_profile_preset_masks_t profile); /** @} End PowerCont*/ @@ -1739,11 +1685,11 @@ amdsmi_status_t /** * @brief Get the total amount of memory that exists * - * @details Given a device handle @p device_handle, a type of memory @p mem_type, and + * @details Given a processor handle @p processor_handle, a type of memory @p mem_type, and * a pointer to a uint64_t @p total, this function will write the total amount * of @p mem_type memory that exists to the location pointed to by @p total. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] mem_type The type of memory for which the total amount will be * found @@ -1758,7 +1704,7 @@ amdsmi_status_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_memory_total(amdsmi_device_handle device_handle, amdsmi_memory_type_t mem_type, +amdsmi_get_gpu_memory_total(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, uint64_t *total); /** @@ -1767,7 +1713,7 @@ amdsmi_dev_get_memory_total(amdsmi_device_handle device_handle, amdsmi_memory_ty * @details This function will write the amount of @p mem_type memory that * that is currently being used to the location pointed to by @p used. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] mem_type The type of memory for which the amount being used will * be found @@ -1782,17 +1728,17 @@ amdsmi_dev_get_memory_total(amdsmi_device_handle device_handle, amdsmi_memory_ty * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_memory_usage(amdsmi_device_handle device_handle, amdsmi_memory_type_t mem_type, +amdsmi_get_gpu_memory_usage(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, uint64_t *used); /** * @brief The first call to this API returns the number of bad pages which * should be used to allocate the buffer that should contain the bad page * records. - * @details This call will query the device @p device_handle for the + * @details This call will query the device @p processor_handle for the * number of bad pages (written to @p num_pages address). The results are * written to address held by the @p info pointer. - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * @param[out] num_pages Number of bad page records. * @param[out] info The results will be written to the * amdsmi_retired_page_record_t pointer. @@ -1800,16 +1746,16 @@ amdsmi_dev_get_memory_usage(amdsmi_device_handle device_handle, amdsmi_memory_ty * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_bad_page_info(amdsmi_device_handle device_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *info); +amdsmi_get_gpu_bad_page_info(amdsmi_processor_handle processor_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *info); /** * @brief Returns if RAS features are enabled or disabled for given block * - * @details Given a device handle @p device_handle, this function queries the + * @details Given a processor handle @p processor_handle, this function queries the * state of RAS features for a specific block @p block. Result will be written * to address held by pointer @p state. * - * @param[in] device_handle Device handle which to query + * @param[in] processor_handle Device handle which to query * * @param[in] block Block which to query * @@ -1823,17 +1769,17 @@ amdsmi_get_bad_page_info(amdsmi_device_handle device_handle, uint32_t *num_pages * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_ras_block_features_enabled(amdsmi_device_handle device_handle, amdsmi_gpu_block_t block, +amdsmi_get_gpu_ras_block_features_enabled(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_ras_err_state_t *state); /** * @brief Get percentage of time any device memory is being used * - * @details Given a device handle @p device_handle, this function returns the + * @details Given a processor handle @p processor_handle, this function returns the * percentage of time that any device memory is being used for the specified * device. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] busy_percent a pointer to the uint32_t to which the busy * percent will be written @@ -1845,18 +1791,18 @@ amdsmi_get_ras_block_features_enabled(amdsmi_device_handle device_handle, amdsmi * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_memory_busy_percent(amdsmi_device_handle device_handle, uint32_t *busy_percent); +amdsmi_get_gpu_memory_busy_percent(amdsmi_processor_handle processor_handle, uint32_t *busy_percent); /** * @brief Get information about reserved ("retired") memory pages * - * @details Given a device handle @p device_handle, this function returns retired page - * information @p records corresponding to the device with the provided device - * handle @p device_handle. The number of retired page records is returned through @p + * @details Given a processor handle @p processor_handle, this function returns retired page + * information @p records corresponding to the device with the provided processor + * handle @p processor_handle. The number of retired page records is returned through @p * num_pages. @p records may be NULL on input. In this case, the number of * records available for retrieval will be returned through @p num_pages. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] num_pages a pointer to a uint32. As input, the value passed * through this parameter is the number of ::amdsmi_retired_page_record_t's that @@ -1878,7 +1824,7 @@ amdsmi_dev_get_memory_busy_percent(amdsmi_device_handle device_handle, uint32_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_memory_reserved_pages(amdsmi_device_handle device_handle, uint32_t *num_pages, +amdsmi_get_gpu_memory_reserved_pages(amdsmi_processor_handle processor_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *records); /** @} End MemQuer */ @@ -1890,14 +1836,14 @@ amdsmi_dev_get_memory_reserved_pages(amdsmi_device_handle device_handle, uint32_ */ /** - * @brief Get the fan speed in RPMs of the device with the specified device + * @brief Get the fan speed in RPMs of the device with the specified processor * handle and 0-based sensor index. * - * @details Given a device handle @p device_handle and a pointer to a uint32_t + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t * @p speed, this function will write the current fan speed in RPMs to the * uint32_t pointed to by @p speed * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. @@ -1911,19 +1857,19 @@ amdsmi_dev_get_memory_reserved_pages(amdsmi_device_handle device_handle, uint32_ * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_fan_rpms(amdsmi_device_handle device_handle, uint32_t sensor_ind, +amdsmi_status_t amdsmi_get_gpu_fan_rpms(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, int64_t *speed); /** * @brief Get the fan speed for the specified device as a value relative to * ::AMDSMI_MAX_FAN_SPEED * - * @details Given a device handle @p device_handle and a pointer to a uint32_t + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t * @p speed, this function will write the current fan speed (a value * between 0 and the maximum fan speed, ::AMDSMI_MAX_FAN_SPEED) to the uint32_t * pointed to by @p speed * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. @@ -1937,17 +1883,17 @@ amdsmi_status_t amdsmi_dev_get_fan_rpms(amdsmi_device_handle device_handle, uint * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_fan_speed(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_fan_speed(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, int64_t *speed); /** - * @brief Get the max. fan speed of the device with provided device handle. + * @brief Get the max. fan speed of the device with provided processor handle. * - * @details Given a device handle @p device_handle and a pointer to a uint32_t + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t * @p max_speed, this function will write the maximum fan speed possible to * the uint32_t pointed to by @p max_speed * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. @@ -1961,19 +1907,19 @@ amdsmi_status_t amdsmi_dev_get_fan_speed(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_fan_speed_max(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_fan_speed_max(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t *max_speed); /** * @brief Get the temperature metric value for the specified metric, from the * specified temperature sensor on the specified device. * - * @details Given a device handle @p device_handle, a sensor type @p sensor_type, a + * @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 * temperature, this function will write the value of the metric indicated by * @p metric and @p sensor_type to the memory location @p temperature. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_type part of device from which temperature should be * obtained. This should come from the enum ::amdsmi_temperature_type_t @@ -1990,7 +1936,7 @@ amdsmi_status_t amdsmi_dev_get_fan_speed_max(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_temp_metric(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_temp_metric(amdsmi_processor_handle processor_handle, amdsmi_temperature_type_t sensor_type, amdsmi_temperature_metric_t metric, int64_t *temperature); @@ -1998,12 +1944,12 @@ amdsmi_status_t amdsmi_dev_get_temp_metric(amdsmi_device_handle device_handle, * @brief Get the voltage metric value for the specified metric, from the * specified voltage sensor on the specified device. * - * @details Given a device handle @p device_handle, a sensor type @p sensor_type, a + * @details Given a processor handle @p processor_handle, a sensor type @p sensor_type, a * ::amdsmi_voltage_metric_t @p metric and a pointer to an int64_t @p * voltage, this function will write the value of the metric indicated by * @p metric and @p sensor_type to the memory location @p voltage. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_type part of device from which voltage should be * obtained. This should come from the enum ::amdsmi_voltage_type_t @@ -2020,7 +1966,7 @@ amdsmi_status_t amdsmi_dev_get_temp_metric(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_volt_metric(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_volt_metric(amdsmi_processor_handle processor_handle, amdsmi_voltage_type_t sensor_type, amdsmi_voltage_metric_t metric, int64_t *voltage); @@ -2037,27 +1983,27 @@ amdsmi_status_t amdsmi_dev_get_volt_metric(amdsmi_device_handle device_handle, * * @details This function returns control of the fan to the system * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_reset_fan(amdsmi_device_handle device_handle, uint32_t sensor_ind); +amdsmi_status_t amdsmi_reset_gpu_fan(amdsmi_processor_handle processor_handle, uint32_t sensor_ind); /** * @brief Set the fan speed for the specified device with the provided speed, * in RPMs. * - * @details Given a device handle @p device_handle and a integer value indicating + * @details Given a processor handle @p processor_handle and a integer value indicating * speed @p speed, this function will attempt to set the fan speed to @p speed. * An error will be returned if the specified speed is outside the allowable * range for the device. The maximum value is 255 and the minimum is 0. * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. @@ -2066,7 +2012,7 @@ amdsmi_status_t amdsmi_dev_reset_fan(amdsmi_device_handle device_handle, uint32_ * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_fan_speed(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_fan_speed(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t speed); /** @} End PhysCont */ @@ -2081,12 +2027,12 @@ amdsmi_status_t amdsmi_dev_set_fan_speed(amdsmi_device_handle device_handle, /** * @brief Get percentage of time device is busy doing any processing * - * @details Given a device handle @p device_handle, this function returns the + * @details Given a processor handle @p processor_handle, this function returns the * percentage of time that the specified device is busy. The device is * considered busy if any one or more of its sub-blocks are working, and idle * if none of the sub-blocks are working. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] busy_percent a pointer to the uint32_t to which the busy * percent will be written @@ -2098,19 +2044,19 @@ amdsmi_status_t amdsmi_dev_set_fan_speed(amdsmi_device_handle device_handle, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_get_busy_percent(amdsmi_device_handle device_handle, uint32_t *busy_percent); +amdsmi_get_busy_percent(amdsmi_processor_handle processor_handle, uint32_t *busy_percent); /** * @brief Get coarse grain utilization counter of the specified device * - * @details Given a device handle @p device_handle, the array of the utilization counters, + * @details Given a processor handle @p processor_handle, the array of the utilization counters, * the size of the array, this function returns the coarse grain utilization counters * and timestamp. * The counter is the accumulated percentages. Every milliseconds the firmware calculates * % busy count and then accumulates that value in the counter. This provides minimally * invasive coarse grain GPU usage information. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] utilization_counters Multiple utilization counters can be retreived with a single * call. The caller must allocate enough space to the utilization_counters array. The caller also @@ -2125,47 +2071,47 @@ amdsmi_dev_get_busy_percent(amdsmi_device_handle device_handle, uint32_t *busy_p * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_utilization_count(amdsmi_device_handle device_handle, +amdsmi_get_utilization_count(amdsmi_processor_handle processor_handle, amdsmi_utilization_counter_t utilization_counters[], uint32_t count, uint64_t *timestamp); /** - * @brief Get current PCIE info of the device with provided device handle. + * @brief Get current PCIE info of the device with provided processor handle. * - * @details Given a device handle @p device_handle, this function returns PCIE info of the + * @details Given a processor handle @p processor_handle, this function returns PCIE info of the * given device. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[out] info amdsmi_pcie_info_t struct which will hold all the extracted PCIE info data. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_get_pcie_link_status(amdsmi_device_handle device_handle, amdsmi_pcie_info_t *info); +amdsmi_status_t amdsmi_get_pcie_link_status(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info); /** - * @brief Get max PCIe capabilities of the device with provided device handle. + * @brief Get max PCIe capabilities of the device with provided processor handle. * - * @details Given a device handle @p device_handle, this function returns PCIe caps info of the + * @details Given a processor handle @p processor_handle, this function returns PCIe caps info of the * given device. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[out] info amdsmi_pcie_info_t struct which will hold all the extracted PCIe caps data. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_device_handle device_handle, amdsmi_pcie_info_t *info); +amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info); /** * @brief Get the performance level of the device * * @details This function will write the ::amdsmi_dev_perf_level_t to the uint32_t - * pointed to by @p perf, for a given device handle @p device_handle and a pointer + * pointed to by @p perf, for a given processor handle @p processor_handle and a pointer * to a uint32_t @p perf. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] perf a pointer to ::amdsmi_dev_perf_level_t to which the * performance level will be written @@ -2176,13 +2122,13 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_device_handle device_handle, am * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_perf_level(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t *perf); /** - * @brief Enter performance determinism mode with provided device handle. + * @brief Enter performance determinism mode with provided processor handle. * - * @details Given a device handle @p device_handle and @p clkvalue this function + * @details Given a processor handle @p processor_handle and @p clkvalue this function * will enable performance determinism mode, which enforces a GFXCLK frequency * SoftMax limit per GPU set by the user. This prevents the GFXCLK PLL from * stretching when running the same workload on different GPUS, making @@ -2190,24 +2136,24 @@ amdsmi_status_t amdsmi_dev_get_perf_level(amdsmi_device_handle device_handle, * level ::amdsmi_dev_perf_level_t of the device being * ::AMDSMI_DEV_PERF_LEVEL_DETERMINISM. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] clkvalue Softmax value for GFXCLK in MHz. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_set_perf_determinism_mode(amdsmi_device_handle device_handle, uint64_t clkvalue); +amdsmi_set_gpu_perf_determinism_mode(amdsmi_processor_handle processor_handle, uint64_t clkvalue); /** * @brief Get the overdrive percent associated with the device with provided - * device handle. + * processor handle. * - * @details Given a device handle @p device_handle and a pointer to a uint32_t @p od, + * @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p od, * this function will write the overdrive percentage to the uint32_t pointed * to by @p od * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] od a pointer to uint32_t to which the overdrive percentage * will be written @@ -2219,18 +2165,18 @@ amdsmi_set_perf_determinism_mode(amdsmi_device_handle device_handle, uint64_t cl * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_overdrive_level(amdsmi_device_handle device_handle, uint32_t *od); +amdsmi_status_t amdsmi_get_gpu_overdrive_level(amdsmi_processor_handle processor_handle, uint32_t *od); /** * @brief Get the list of possible system clock speeds of device for a * specified clock type. * - * @details Given a device handle @p device_handle, a clock type @p clk_type, and a + * @details Given a processor handle @p processor_handle, a clock type @p clk_type, and a * pointer to a to an ::amdsmi_frequencies_t structure @p f, this function will * fill in @p f with the possible clock speeds, and indication of the current * clock speed selection. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] clk_type the type of clock for which the frequency is desired * @@ -2240,28 +2186,28 @@ amdsmi_status_t amdsmi_dev_get_overdrive_level(amdsmi_device_handle device_handl * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_gpu_clk_freq(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f); /** - * @brief Reset the gpu associated with the device with provided device handle + * @brief Reset the gpu associated with the device with provided processor handle * - * @details Given a device handle @p device_handle, this function will reset the GPU + * @details Given a processor handle @p processor_handle, this function will reset the GPU * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_reset_gpu(amdsmi_device_handle device_handle); +amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle); /** * @brief This function retrieves the voltage/frequency curve information * - * @details Given a device handle @p device_handle and a pointer to a + * @details Given a processor handle @p processor_handle and a pointer to a * ::amdsmi_od_volt_freq_data_t structure @p odv, this function will populate @p * odv. See ::amdsmi_od_volt_freq_data_t for more details. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] odv a pointer to an ::amdsmi_od_volt_freq_data_t structure * If this parameter is nullptr, this function will return @@ -2271,17 +2217,17 @@ amdsmi_status_t amdsmi_dev_reset_gpu(amdsmi_device_handle device_handle); * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_od_volt_info(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_od_volt_info(amdsmi_processor_handle processor_handle, amdsmi_od_volt_freq_data_t *odv); /** * @brief This function retrieves the gpu metrics information * - * @details Given a device handle @p device_handle and a pointer to a + * @details Given a processor handle @p processor_handle and a pointer to a * ::amdsmi_gpu_metrics_t structure @p pgpu_metrics, this function will populate * @p pgpu_metrics. See ::amdsmi_gpu_metrics_t for more details. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] pgpu_metrics a pointer to an ::amdsmi_gpu_metrics_t structure * If this parameter is nullptr, this function will return @@ -2291,17 +2237,17 @@ amdsmi_status_t amdsmi_dev_get_od_volt_info(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_gpu_metrics_info(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_metrics_info(amdsmi_processor_handle processor_handle, amdsmi_gpu_metrics_t *pgpu_metrics); /** * @brief This function sets the clock range information * - * @details Given a device handle @p device_handle, a minimum clock value @p minclkvalue, + * @details Given a processor handle @p processor_handle, a minimum clock value @p minclkvalue, * a maximum clock value @p maxclkvalue and a clock type @p clkType this function * will set the sclk|mclk range * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] minclkvalue value to apply to the clock range. Frequency values * are in MHz. @@ -2313,18 +2259,18 @@ amdsmi_status_t amdsmi_dev_get_gpu_metrics_info(amdsmi_device_handle device_han * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_clk_range(amdsmi_device_handle device_handle, uint64_t minclkvalue, +amdsmi_status_t amdsmi_set_gpu_clk_range(amdsmi_processor_handle processor_handle, uint64_t minclkvalue, uint64_t maxclkvalue, amdsmi_clk_type_t clkType); /** * @brief This function sets the clock frequency information * - * @details Given a device handle @p device_handle, a frequency level @p level, + * @details Given a processor handle @p processor_handle, a frequency level @p level, * a clock value @p clkvalue and a clock type @p clkType this function * will set the sclk|mclk range * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] level AMDSMI_FREQ_IND_MIN|AMDSMI_FREQ_IND_MAX to set the * minimum (0) or maximum (1) speed. @@ -2336,17 +2282,17 @@ amdsmi_status_t amdsmi_dev_set_clk_range(amdsmi_device_handle device_handle, uin * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_od_clk_info(amdsmi_device_handle device_handle, amdsmi_freq_ind_t level, +amdsmi_status_t amdsmi_set_gpu_od_clk_info(amdsmi_processor_handle processor_handle, amdsmi_freq_ind_t level, uint64_t clkvalue, amdsmi_clk_type_t clkType); /** * @brief This function sets 1 of the 3 voltage curve points. * - * @details Given a device handle @p device_handle, a voltage point @p vpoint + * @details Given a processor handle @p processor_handle, a voltage point @p vpoint * and a voltage value @p voltvalue this function will set voltage curve point * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] vpoint voltage point [0|1|2] on the voltage curve * @@ -2358,14 +2304,14 @@ amdsmi_status_t amdsmi_dev_set_od_clk_info(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_od_volt_info(amdsmi_device_handle device_handle, uint32_t vpoint, +amdsmi_status_t amdsmi_set_gpu_od_volt_info(amdsmi_processor_handle processor_handle, uint32_t vpoint, uint64_t clkvalue, uint64_t voltvalue); /** * @brief This function will retrieve the current valid regions in the * frequency/voltage space. * - * @details Given a device handle @p device_handle, a pointer to an unsigned integer + * @details Given a processor handle @p processor_handle, a pointer to an unsigned integer * @p num_regions and a buffer of ::amdsmi_freq_volt_region_t structures, @p * buffer, this function will populate @p buffer with the current * frequency-volt space regions. The caller should assign @p buffer to memory @@ -2374,9 +2320,9 @@ amdsmi_status_t amdsmi_dev_set_od_volt_info(amdsmi_device_handle device_handle, * be written to @p buffer in @p num_regions. * * The number of regions to expect this function provide (@p num_regions) can - * be obtained by calling :: amdsmi_dev_get_od_volt_info(). + * be obtained by calling :: amdsmi_get_gpu_od_volt_info(). * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] num_regions As input, this is the number of * ::amdsmi_freq_volt_region_t structures that can be written to @p buffer. As @@ -2396,14 +2342,14 @@ amdsmi_status_t amdsmi_dev_set_od_volt_info(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_od_volt_curve_regions(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_od_volt_curve_regions(amdsmi_processor_handle processor_handle, uint32_t *num_regions, amdsmi_freq_volt_region_t *buffer); /** * @brief Get the list of available preset power profiles and an indication of * which profile is currently active. * - * @details Given a device handle @p device_handle and a pointer to a + * @details Given a processor handle @p processor_handle and a pointer to a * ::amdsmi_power_profile_status_t @p status, this function will set the bits of * the ::amdsmi_power_profile_status_t.available_profiles bit field of @p status to * 1 if the profile corresponding to the respective @@ -2416,7 +2362,7 @@ amdsmi_status_t amdsmi_dev_get_od_volt_curve_regions(amdsmi_device_handle devic * ::amdsmi_power_profile_status_t.current will be set to the * ::amdsmi_power_profile_preset_masks_t of the profile that is currently active. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. @@ -2431,7 +2377,7 @@ amdsmi_status_t amdsmi_dev_get_od_volt_curve_regions(amdsmi_device_handle devic * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_dev_get_power_profile_presets(amdsmi_device_handle device_handle, uint32_t sensor_ind, + amdsmi_get_gpu_power_profile_presets(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_profile_status_t *status); /** @} End PerfQuer */ @@ -2445,54 +2391,54 @@ amdsmi_status_t /** * @brief Set the PowerPlay performance level associated with the device with - * provided device handle with the provided value. + * provided processor handle with the provided value. * - * @deprecated :: amdsmi_dev_set_perf_level_v1() is preferred, with an + * @deprecated :: amdsmi_set_gpu_perf_level_v1() is preferred, with an * interface that more closely matches the rest of the amd_smi API. * - * @details Given a device handle @p device_handle and an ::amdsmi_dev_perf_level_t @p + * @details Given a processor handle @p processor_handle and an ::amdsmi_dev_perf_level_t @p * perf_level, this function will set the PowerPlay performance level for the * device to the value @p perf_lvl. * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] perf_lvl the value to which the performance level should be set * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_dev_set_perf_level(amdsmi_device_handle device_handle, amdsmi_dev_perf_level_t perf_lvl); + amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t perf_lvl); /** * @brief Set the PowerPlay performance level associated with the device with - * provided device handle with the provided value. + * provided processor handle with the provided value. * - * @details Given a device handle @p device_handle and an ::amdsmi_dev_perf_level_t @p + * @details Given a processor handle @p processor_handle and an ::amdsmi_dev_perf_level_t @p * perf_level, this function will set the PowerPlay performance level for the * device to the value @p perf_lvl. * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] perf_lvl the value to which the performance level should be set * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_dev_set_perf_level_v1(amdsmi_device_handle device_handle, amdsmi_dev_perf_level_t perf_lvl); + amdsmi_set_gpu_perf_level_v1(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t perf_lvl); /** * @brief Set the overdrive percent associated with the device with provided - * device handle with the provided value. See details for WARNING. + * processor handle with the provided value. See details for WARNING. * - * @deprecated This function is deprecated. :: amdsmi_dev_set_overdrive_level_v1 + * @deprecated This function is deprecated. :: amdsmi_set_gpu_overdrive_level_v1 * has the same functionaltiy, with an interface that more closely * matches the rest of the amd_smi API. * - * @details Given a device handle @p device_handle and an overdrive level @p od, + * @details Given a processor handle @p processor_handle and an overdrive level @p od, * this function will set the overdrive level for the device to the value * @p od. The overdrive level is an integer value between 0 and 20, inclusive, * which represents the overdrive percentage; e.g., a value of 5 specifies @@ -2517,19 +2463,19 @@ amdsmi_status_t * WARRANTY AND MAY NOT BE COVERED BY YOUR BOARD OR SYSTEM MANUFACTURER'S * WARRANTY. Please use this utility with caution. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] od the value to which the overdrive level should be set * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_overdrive_level(amdsmi_device_handle device_handle, uint32_t od); +amdsmi_status_t amdsmi_set_gpu_overdrive_level(amdsmi_processor_handle processor_handle, uint32_t od); /** * @brief Set the overdrive percent associated with the device with provided - * device handle with the provided value. See details for WARNING. + * processor handle with the provided value. See details for WARNING. * - * @details Given a device handle @p device_handle and an overdrive level @p od, + * @details Given a processor handle @p processor_handle and an overdrive level @p od, * this function will set the overdrive level for the device to the value * @p od. The overdrive level is an integer value between 0 and 20, inclusive, * which represents the overdrive percentage; e.g., a value of 5 specifies @@ -2556,23 +2502,23 @@ amdsmi_status_t amdsmi_dev_set_overdrive_level(amdsmi_device_handle device_hand * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] od the value to which the overdrive level should be set * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_overdrive_level_v1(amdsmi_device_handle device_handle, uint32_t od); +amdsmi_status_t amdsmi_set_gpu_overdrive_level_v1(amdsmi_processor_handle processor_handle, uint32_t od); /** * @brief Control the set of allowed frequencies that can be used for the * specified clock. * - * @details Given a device handle @p device_handle, a clock type @p clk_type, and a + * @details Given a processor handle @p processor_handle, a clock type @p clk_type, and a * 64 bit bitmask @p freq_bitmask, this function will limit the set of * allowable frequencies. If a bit in @p freq_bitmask has a value of 1, then * the frequency (as ordered in an ::amdsmi_frequencies_t returned by - * amdsmi_dev_get_gpu_clk_freq()) corresponding to that bit index will be + * amdsmi_get_clk_freq()) corresponding to that bit index will be * allowed. * * This function will change the performance level to @@ -2585,7 +2531,7 @@ amdsmi_status_t amdsmi_dev_set_overdrive_level_v1(amdsmi_device_handle device_h * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] clk_type the type of clock for which the set of frequencies * will be modified @@ -2596,7 +2542,7 @@ amdsmi_status_t amdsmi_dev_set_overdrive_level_v1(amdsmi_device_handle device_h * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_set_clk_freq(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, uint64_t freq_bitmask); /** @} End PerfCont */ @@ -2661,12 +2607,12 @@ amdsmi_get_version_str(amdsmi_sw_component_t component, char *ver_str, /** * @brief Retrieve the error counts for a GPU block * - * @details Given a device handle @p device_handle, an ::amdsmi_gpu_block_t @p block and a + * @details Given a processor handle @p processor_handle, an ::amdsmi_gpu_block_t @p block and a * pointer to an ::amdsmi_error_count_t @p ec, this function will write the error * count values for the GPU block indicated by @p block to memory pointed to by * @p ec. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] block The block for which error counts should be retrieved * @@ -2679,13 +2625,13 @@ amdsmi_get_version_str(amdsmi_sw_component_t component, char *ver_str, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_ecc_count(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_error_count_t *ec); /** * @brief Retrieve the enabled ECC bit-mask * - * @details Given a device handle @p device_handle, and a pointer to a uint64_t @p + * @details Given a processor handle @p processor_handle, and a pointer to a uint64_t @p * enabled_mask, this function will write bits to memory pointed to by * @p enabled_blocks. Upon a successful call, @p enabled_blocks can then be * AND'd with elements of the ::amdsmi_gpu_block_t ennumeration to determine if @@ -2695,7 +2641,7 @@ amdsmi_status_t amdsmi_dev_get_ecc_count(amdsmi_device_handle device_handle, * but there may not be kernel support for reading error counters for that * block. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] enabled_blocks A pointer to a uint64_t to which the enabled * blocks bits will be written. @@ -2706,18 +2652,18 @@ amdsmi_status_t amdsmi_dev_get_ecc_count(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_ecc_enabled(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_ecc_enabled(amdsmi_processor_handle processor_handle, uint64_t *enabled_blocks); /** * @brief Retrieve the ECC status for a GPU block * - * @details Given a device handle @p device_handle, an ::amdsmi_gpu_block_t @p block and + * @details Given a processor handle @p processor_handle, an ::amdsmi_gpu_block_t @p block and * a pointer to an ::amdsmi_ras_err_state_t @p state, this function will write * the current state for the GPU block indicated by @p block to memory pointed * to by @p state. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] block The block for which error counts should be retrieved * @@ -2730,7 +2676,7 @@ amdsmi_status_t amdsmi_dev_get_ecc_enabled(amdsmi_device_handle device_handle, * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_ecc_status(amdsmi_device_handle device_handle, amdsmi_gpu_block_t block, +amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_ras_err_state_t *state); /** @@ -2765,28 +2711,28 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * The types of events available and the ability to count those * events are dependent on which device is being targeted and if counters are * still available for that device, respectively. - * ::amdsmi_dev_counter_group_supported() can be used to see which event types + * ::amdsmi_gpu_counter_group_supported() can be used to see which event types * (::amdsmi_event_group_t) are supported for a given device. Assuming a device * supports a given event type, we can then check to see if there are counters * available to count a specific event with - * :: amdsmi_counter_get_available_counters(). Counters may be occupied by other + * :: amdsmi_get_gpu_available_counters(). Counters may be occupied by other * perf based programs. * * Once it is determined that events are supported and counters are available, * an event counter can be created/destroyed and controlled. * - * ::amdsmi_dev_create_counter() allocates internal data structures that will be + * ::amdsmi_gpu_create_counter() allocates internal data structures that will be * used to used to control the event counter, and return a handle to this data * structure. * * Once an event counter handle is obtained, the event counter can be - * controlled (i.e., started, stopped,...) with ::amdsmi_control_counter() by + * controlled (i.e., started, stopped,...) with ::amdsmi_gpu_control_counter() by * passing ::amdsmi_counter_command_t commands. ::AMDSMI_CNTR_CMD_START starts an * event counter and ::AMDSMI_CNTR_CMD_STOP stops a counter. - * ::amdsmi_read_counter() reads an event counter. + * ::amdsmi_gpu_read_counter() reads an event counter. * * Once the counter is no longer needed, the resources it uses should be freed - * by calling ::amdsmi_dev_destroy_counter(). + * by calling ::amdsmi_gpu_destroy_counter(). * * * Important Notes about Counter Values @@ -2794,12 +2740,12 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * - A running "absolute" counter is kept internally. For the discussion that * follows, we will call the internal counter value at time @a t @a * valt - * - Issuing ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_read_counter(), causes + * - Issuing ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_gpu_read_counter(), causes * AMDSMI (in kernel) to internally record the current absolute counter value - * - ::amdsmi_read_counter() returns the number of events that have occurred + * - ::amdsmi_gpu_read_counter() returns the number of events that have occurred * since the previously recorded value (ie, a relative value, * @a valt - valt-1) from the issuing of - * ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_read_counter() + * ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_gpu_read_counter() * * Example of event counting sequence: * @@ -2811,12 +2757,12 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * amdsmi_counter_value_t value; * * // Determine if AMDSMI_EVNT_GRP_XGMI is supported for device dv_ind - * ret = amdsmi_dev_counter_group_supported(dv_ind, AMDSMI_EVNT_GRP_XGMI); + * ret = amdsmi_gpu_counter_group_supported(dv_ind, AMDSMI_EVNT_GRP_XGMI); * * // See if there are counters available for device dv_ind for event * // AMDSMI_EVNT_GRP_XGMI * - * ret = amdsmi_counter_get_available_counters(dv_ind, + * ret = amdsmi_get_gpu_available_counters(dv_ind, * AMDSMI_EVNT_GRP_XGMI, &counters_available); * * // Assuming AMDSMI_EVNT_GRP_XGMI is supported and there is at least 1 @@ -2825,30 +2771,30 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * // AMDSMI_EVNT_XGMI_0_BEATS_TX) and get the handle * // (amdsmi_event_handle_t). * - * ret = amdsmi_dev_create_counter(dv_ind, AMDSMI_EVNT_XGMI_0_BEATS_TX, + * ret = amdsmi_gpu_create_counter(dv_ind, AMDSMI_EVNT_XGMI_0_BEATS_TX, * &evnt_handle); * * // A program that generates the events of interest can be started * // immediately before or after starting the counters. * // Start counting: - * ret = amdsmi_control_counter(evnt_handle, AMDSMI_CNTR_CMD_START, NULL); + * ret = amdsmi_gpu_control_counter(evnt_handle, AMDSMI_CNTR_CMD_START, NULL); * * // Wait... * * // Get the number of events since AMDSMI_CNTR_CMD_START was issued: - * ret = amdsmi_read_counter(amdsmi_event_handle_t evt_handle, &value) + * ret = amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, &value) * * // Wait... * - * // Get the number of events since amdsmi_read_counter() was last called: - * ret = amdsmi_read_counter(amdsmi_event_handle_t evt_handle, &value) + * // Get the number of events since amdsmi_gpu_read_counter() was last called: + * ret = amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, &value) * * // Stop counting. - * ret = amdsmi_control_counter(evnt_handle, AMDSMI_CNTR_CMD_STOP, NULL); + * ret = amdsmi_gpu_control_counter(evnt_handle, AMDSMI_CNTR_CMD_STOP, NULL); * * // Release all resources (e.g., counter and memory resources) associated * with evnt_handle. - * ret = amdsmi_dev_destroy_counter(evnt_handle); + * ret = amdsmi_gpu_destroy_counter(evnt_handle); * @endcode * @{ */ @@ -2856,11 +2802,11 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); /** * @brief Tell if an event group is supported by a given device * - * @details Given a device handle @p device_handle and an event group specifier @p + * @details Given a processor handle @p processor_handle and an event group specifier @p * group, tell if @p group type events are supported by the device associated - * with @p device_handle + * with @p processor_handle * - * @param[in] device_handle device handle of device being queried + * @param[in] processor_handle processor handle of device being queried * * @param[in] group ::amdsmi_event_group_t identifier of group for which support * is being queried @@ -2868,20 +2814,20 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_counter_group_supported(amdsmi_device_handle device_handle, amdsmi_event_group_t group); +amdsmi_gpu_counter_group_supported(amdsmi_processor_handle processor_handle, amdsmi_event_group_t group); /** * @brief Create a performance counter object * * @details Create a performance counter object of type @p type for the device - * with a device handle of @p device_handle, and write a handle to the object to the + * with a processor handle of @p processor_handle, and write a handle to the object to the * memory location pointed to by @p evnt_handle. @p evnt_handle can be used * with other performance event operations. The handle should be deallocated - * with ::amdsmi_dev_destroy_counter() when no longer needed. + * with ::amdsmi_gpu_destroy_counter() when no longer needed. * * @note This function requires root access * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] type the ::amdsmi_event_type_t of performance event to create * @@ -2895,7 +2841,7 @@ amdsmi_dev_counter_group_supported(amdsmi_device_handle device_handle, amdsmi_ev * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_create_counter(amdsmi_device_handle device_handle, amdsmi_event_type_t type, +amdsmi_gpu_create_counter(amdsmi_processor_handle processor_handle, amdsmi_event_type_t type, amdsmi_event_handle_t *evnt_handle); /** @@ -2911,7 +2857,7 @@ amdsmi_dev_create_counter(amdsmi_device_handle device_handle, amdsmi_event_type_ * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_destroy_counter(amdsmi_event_handle_t evnt_handle); +amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle); /** * @brief Issue performance counter control commands @@ -2930,7 +2876,7 @@ amdsmi_dev_destroy_counter(amdsmi_event_handle_t evnt_handle); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_control_counter(amdsmi_event_handle_t evt_handle, +amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_command_t cmd, void *cmd_args); /** @@ -2950,18 +2896,18 @@ amdsmi_control_counter(amdsmi_event_handle_t evt_handle, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_read_counter(amdsmi_event_handle_t evt_handle, +amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_value_t *value); /** * @brief Get the number of currently available counters * - * @details Given a device handle @p device_handle, a performance event group @p grp, + * @details Given a processor handle @p processor_handle, a performance event group @p grp, * and a pointer to a uint32_t @p available, this function will write the * number of @p grp type counters that are available on the device with handle - * @p device_handle to the memory that @p available points to. + * @p processor_handle to the memory that @p available points to. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in] grp an event device group * @@ -2971,7 +2917,7 @@ amdsmi_read_counter(amdsmi_event_handle_t evt_handle, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_counter_get_available_counters(amdsmi_device_handle device_handle, + amdsmi_get_gpu_available_counters(amdsmi_processor_handle processor_handle, amdsmi_event_group_t grp, uint32_t *available); /** @} End PerfCntr */ @@ -3011,7 +2957,7 @@ amdsmi_status_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items); +amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items); /** * @brief Get process information about a specific process @@ -3030,20 +2976,20 @@ amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_item * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t *proc); +amdsmi_get_gpu_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t *proc); /** * @brief Get the device indices currently being used by a process * * @details Given a process id @p pid, a non-NULL pointer to an array of - * uint32_t's @p device_handleices of length *@p num_devices, this function will + * uint32_t's @p processor_handleices of length *@p num_devices, this function will * write up to @p num_devices device indices to the memory pointed to by - * @p device_handleices. If @p device_handleices is not NULL, @p num_devices will be + * @p processor_handleices. If @p processor_handleices is not NULL, @p num_devices will be * updated with the number of gpu's currently being used by process @p pid. - * If @p device_handleices is NULL, @p device_handleices will be updated with the number of + * If @p processor_handleices is NULL, @p processor_handleices will be updated with the number of * gpus currently being used by @p pid. Calling this function with @p * dv_indices being NULL is a way to determine how much memory is required - * for when @p device_handleices is not NULL. + * for when @p processor_handleices is not NULL. * * @param[in] pid The process id of the process for which the number of gpus * currently being used is requested @@ -3055,14 +3001,14 @@ amdsmi_get_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t *proc * * @param[in,out] num_devices A pointer to a uint32_t, which on input, should * contain the amount of memory in uint32_t's which have been provided by the - * @p device_handleices argument. On output, if @p device_handleices is non-NULL, this will - * be updated with the number uint32_t's actually written. If @p device_handleices is + * @p processor_handleices argument. On output, if @p processor_handleices is non-NULL, this will + * be updated with the number uint32_t's actually written. If @p processor_handleices is * NULL, this argument will be updated with the number devices being used. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, +amdsmi_get_gpu_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, uint32_t *num_devices); /** @} End SysInfo */ @@ -3076,12 +3022,12 @@ amdsmi_get_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, /** * @brief Retrieve the XGMI error status for a device * - * @details Given a device handle @p device_handle, and a pointer to an + * @details Given a processor handle @p processor_handle, and a pointer to an * ::amdsmi_xgmi_status_t @p status, this function will write the current XGMI - * error state ::amdsmi_xgmi_status_t for the device @p device_handle to the memory + * error state ::amdsmi_xgmi_status_t for the device @p processor_handle to the memory * pointed to by @p status. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] status A pointer to an ::amdsmi_xgmi_status_t to which the * XGMI error state should be written @@ -3093,21 +3039,21 @@ amdsmi_get_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_xgmi_error_status(amdsmi_device_handle device_handle, amdsmi_xgmi_status_t *status); +amdsmi_gpu_xgmi_error_status(amdsmi_processor_handle processor_handle, amdsmi_xgmi_status_t *status); /** * @brief Reset the XGMI error status for a device * - * @details Given a device handle @p device_handle, this function will reset the - * current XGMI error state ::amdsmi_xgmi_status_t for the device @p device_handle to + * @details Given a processor handle @p processor_handle, this function will reset the + * current XGMI error state ::amdsmi_xgmi_status_t for the device @p processor_handle to * amdsmi_xgmi_status_t::AMDSMI_XGMI_STATUS_NO_ERRORS * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_reset_xgmi_error(amdsmi_device_handle device_handle); +amdsmi_reset_gpu_xgmi_error(amdsmi_processor_handle processor_handle); /** @} End SysInfo */ @@ -3120,12 +3066,12 @@ amdsmi_dev_reset_xgmi_error(amdsmi_device_handle device_handle); /** * @brief Retrieve the NUMA CPU node number for a device * - * @details Given a device handle @p device_handle, and a pointer to an + * @details Given a processor handle @p processor_handle, and a pointer to an * uint32_t @p numa_node, this function will write the - * node number of NUMA CPU for the device @p device_handle to the memory + * node number of NUMA CPU for the device @p processor_handle to the memory * pointed to by @p numa_node. * - * @param[in] device_handle a device handle + * @param[in] processor_handle a processor handle * * @param[in,out] numa_node A pointer to an uint32_t to which the * numa node number should be written. @@ -3133,20 +3079,20 @@ amdsmi_dev_reset_xgmi_error(amdsmi_device_handle device_handle); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_topo_get_numa_node_number(amdsmi_device_handle device_handle, uint32_t *numa_node); +amdsmi_topo_get_numa_node_number(amdsmi_processor_handle processor_handle, uint32_t *numa_node); /** * @brief Retrieve the weight for a connection between 2 GPUs * - * @details Given a source device handle @p device_handle_src and - * a destination device handle @p device_handle_dst, and a pointer to an + * @details Given a source processor handle @p processor_handle_src and + * a destination processor handle @p processor_handle_dst, and a pointer to an * uint64_t @p weight, this function will write the - * weight for the connection between the device @p device_handle_src - * and @p device_handle_dst to the memory pointed to by @p weight. + * weight for the connection between the device @p processor_handle_src + * and @p processor_handle_dst to the memory pointed to by @p weight. * - * @param[in] device_handle_src the source device handle + * @param[in] processor_handle_src the source processor handle * - * @param[in] device_handle_dst the destination device handle + * @param[in] processor_handle_dst the destination processor handle * * @param[in,out] weight A pointer to an uint64_t to which the * weight for the connection should be written. @@ -3154,21 +3100,21 @@ amdsmi_topo_get_numa_node_number(amdsmi_device_handle device_handle, uint32_t *n * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_topo_get_link_weight(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst, +amdsmi_topo_get_link_weight(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, uint64_t *weight); /** * @brief Retreive minimal and maximal io link bandwidth between 2 GPUs * - * @details Given a source device handle @p device_handle_src and - * a destination device handle @p device_handle_dst, pointer to an + * @details Given a source processor handle @p processor_handle_src and + * a destination processor handle @p processor_handle_dst, pointer to an * uint64_t @p min_bandwidth, and a pointer to uint64_t @p max_bandiwidth, * this function will write theoretical minimal and maximal bandwidth limits. * API works if src and dst are connected via xgmi and have 1 hop distance. * - * @param[in] device_handle_src the source device handle + * @param[in] processor_handle_src the source processor handle * - * @param[in] device_handle_dst the destination device handle + * @param[in] processor_handle_dst the destination processor handle * * @param[in,out] min_bandwidth A pointer to an uint64_t to which the * minimal bandwidth for the connection should be written. @@ -3179,22 +3125,22 @@ amdsmi_topo_get_link_weight(amdsmi_device_handle device_handle_src, amdsmi_devic * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_get_minmax_bandwidth(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst, + amdsmi_get_minmax_bandwidth(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, uint64_t *min_bandwidth, uint64_t *max_bandwidth); /** * @brief Retrieve the hops and the connection type between 2 GPUs * - * @details Given a source device handle @p device_handle_src and - * a destination device handle @p device_handle_dst, and a pointer to an + * @details Given a source processor handle @p processor_handle_src and + * a destination processor handle @p processor_handle_dst, and a pointer to an * uint64_t @p hops and a pointer to an AMDSMI_IO_LINK_TYPE @p type, * this function will write the number of hops and the connection type - * between the device @p device_handle_src and @p device_handle_dst to the memory + * between the device @p processor_handle_src and @p processor_handle_dst to the memory * pointed to by @p hops and @p type. * - * @param[in] device_handle_src the source device handle + * @param[in] processor_handle_src the source processor handle * - * @param[in] device_handle_dst the destination device handle + * @param[in] processor_handle_dst the destination processor handle * * @param[in,out] hops A pointer to an uint64_t to which the * hops for the connection should be written. @@ -3205,22 +3151,22 @@ amdsmi_status_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src, - amdsmi_device_handle device_handle_dst, +amdsmi_topo_get_link_type(amdsmi_processor_handle processor_handle_src, + amdsmi_processor_handle processor_handle_dst, uint64_t *hops, AMDSMI_IO_LINK_TYPE *type); /** * @brief Return P2P availability status between 2 GPUs * - * @details Given a source device handle @p device_handle_src and - * a destination device handle @p device_handle_dst, and a pointer to a + * @details Given a source processor handle @p processor_handle_src and + * a destination processor handle @p processor_handle_dst, and a pointer to a * bool @p accessible, this function will write the P2P connection status - * between the device @p device_handle_src and @p device_handle_dst to the memory + * between the device @p processor_handle_src and @p processor_handle_dst to the memory * pointed to by @p accessible. * - * @param[in] device_handle_src the source device handle + * @param[in] processor_handle_src the source processor handle * - * @param[in] device_handle_dst the destination device handle + * @param[in] processor_handle_dst the destination processor handle * * @param[in,out] accessible A pointer to a bool to which the status for * the P2P connection availablity should be written. @@ -3228,7 +3174,7 @@ amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst, +amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, bool *accessible); /** @} End HWTopo */ @@ -3244,14 +3190,14 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * * Some functions have several variations ("variants") where some variants are * supported and others are not. For example, on a given device, - * :: amdsmi_dev_get_temp_metric may support some types of temperature metrics + * :: amdsmi_get_temp_metric may support some types of temperature metrics * (e.g., ::AMDSMI_TEMP_CRITICAL_HYST), but not others * (e.g., ::AMDSMI_TEMP_EMERGENCY). * * In addition to a top level of variant support for a function, a function * may have varying support for monitors/sensors. These are considered * "sub-variants" in functions described in this section. Continuing the - * :: amdsmi_dev_get_temp_metric example, if variant + * :: amdsmi_get_temp_metric example, if variant * ::AMDSMI_TEMP_CRITICAL_HYST is supported, perhaps * only the sub-variant sensors ::AMDSMI_TEMP_TYPE_EDGE * and ::AMDSMI_TEMP_TYPE_EDGE are supported, but not @@ -3277,19 +3223,19 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * amdsmi_func_id_iter_handle_t iter_handle, var_iter, sub_var_iter; * amdsmi_func_id_value_t value; * amdsmi_status_t err; - * amdsmi_device_handle device; + * amdsmi_processor_handle device; * - * // Get the device handle via amdsmi_get_device_handles() + * // Get the processor handle via amdsmi_get_processor_handles() * // ... ... * * std::cout << "Supported AMDSMI Functions:" << std::endl; * - * err = amdsmi_dev_open_supported_func_iterator(device, &iter_handle); + * err = amdsmi_open_supported_func_iterator(device, &iter_handle); * * while (1) { * err = amdsmi_get_func_iter_value(iter_handle, &value); * std::cout << "Function Name: " << value.name << std::endl; * - * err = amdsmi_dev_open_supported_variant_iterator(iter_handle, &var_iter); + * err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter); * if (err != AMDSMI_STATUS_NO_DATA) { * std::cout << "\tVariants/Monitors: "; * while (1) { @@ -3302,7 +3248,7 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * std::cout << " ("; * * err = - * amdsmi_dev_open_supported_variant_iterator(var_iter, &sub_var_iter); + * amdsmi_open_supported_variant_iterator(var_iter, &sub_var_iter); * if (err != AMDSMI_STATUS_NO_DATA) { * * while (1) { @@ -3315,7 +3261,7 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * break; * } * } - * err = amdsmi_dev_close_supported_func_iterator(&sub_var_iter); + * err = amdsmi_close_supported_func_iterator(&sub_var_iter); * } * * std::cout << "), "; @@ -3328,7 +3274,7 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * } * std::cout << std::endl; * - * err = amdsmi_dev_close_supported_func_iterator(&var_iter); + * err = amdsmi_close_supported_func_iterator(&var_iter); * } * * err = amdsmi_next_func_iter(iter_handle); @@ -3337,7 +3283,7 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * break; * } * } - * err = amdsmi_dev_close_supported_func_iterator(&iter_handle); + * err = amdsmi_close_supported_func_iterator(&iter_handle); * } * @endcode * @@ -3347,17 +3293,17 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h /** * @brief Get a function name iterator of supported AMDSMI functions for a device * - * @details Given a device handle @p device_handle, this function will write a function + * @details Given a processor handle @p processor_handle, this function will write a function * iterator handle to the caller-provided memory pointed to by @p handle. This * handle can be used to iterate through all the supported functions. * - * Note that although this function takes in @p device_handle as an argument, - * ::amdsmi_dev_open_supported_func_iterator itself will not be among the + * Note that although this function takes in @p processor_handle as an argument, + * ::amdsmi_open_supported_func_iterator itself will not be among the * functions listed as supported. This is because - * ::amdsmi_dev_open_supported_func_iterator does not depend on hardware or + * ::amdsmi_open_supported_func_iterator does not depend on hardware or * driver support and should always be supported. * - * @param[in] device_handle a device handle of device for which support information is + * @param[in] processor_handle a processor handle of device for which support information is * requested * * @param[in,out] handle A pointer to caller-provided memory to which the @@ -3366,7 +3312,7 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, amdsmi_device_h * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_open_supported_func_iterator(amdsmi_device_handle device_handle, +amdsmi_open_supported_func_iterator(amdsmi_processor_handle processor_handle, amdsmi_func_id_iter_handle_t *handle); /** @@ -3376,13 +3322,13 @@ amdsmi_dev_open_supported_func_iterator(amdsmi_device_handle device_handle, * write a function iterator handle to the caller-provided memory pointed to * by @p var_iter. This handle can be used to iterate through all the supported * variants of the provided handle. @p obj_h may be a handle to a function - * object, as provided by a call to ::amdsmi_dev_open_supported_func_iterator, or + * object, as provided by a call to ::amdsmi_open_supported_func_iterator, or * it may be a variant itself (from a call to - * ::amdsmi_dev_open_supported_variant_iterator), it which case @p var_iter will + * ::amdsmi_open_supported_variant_iterator), it which case @p var_iter will * be an iterator of the sub-variants of @p obj_h (e.g., monitors). * * This call allocates a small amount of memory to @p var_iter. To free this memory - * ::amdsmi_dev_close_supported_func_iterator should be called on the returned + * ::amdsmi_close_supported_func_iterator should be called on the returned * iterator handle @p var_iter when it is no longer needed. * * @param[in] obj_h an iterator handle for which the variants are being requested @@ -3393,7 +3339,7 @@ amdsmi_dev_open_supported_func_iterator(amdsmi_device_handle device_handle, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_open_supported_variant_iterator(amdsmi_func_id_iter_handle_t obj_h, +amdsmi_open_supported_variant_iterator(amdsmi_func_id_iter_handle_t obj_h, amdsmi_func_id_iter_handle_t *var_iter); /** @@ -3425,7 +3371,7 @@ amdsmi_next_func_iter(amdsmi_func_id_iter_handle_t handle); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_close_supported_func_iterator(amdsmi_func_id_iter_handle_t *handle); +amdsmi_close_supported_func_iterator(amdsmi_func_id_iter_handle_t *handle); /** * @brief Get the value associated with a function/variant iterator @@ -3461,27 +3407,27 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle, * @brief Prepare to collect event notifications for a GPU * * @details This function prepares to collect events for the GPU with device - * ID @p device_handle, by initializing any required system parameters. This call - * may open files which will remain open until ::amdsmi_stop_event_notification() + * ID @p processor_handle, by initializing any required system parameters. This call + * may open files which will remain open until ::amdsmi_stop_gpu_event_notification() * is called. * - * @param device_handle a device handle corresponding to the device on which to + * @param processor_handle a processor handle corresponding to the device on which to * listen for events * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_init_event_notification(amdsmi_device_handle device_handle); +amdsmi_init_gpu_event_notification(amdsmi_processor_handle processor_handle); /** * @brief Specify which events to collect for a device * - * @details Given a device handle @p device_handle and a @p mask consisting of + * @details Given a processor handle @p processor_handle and a @p mask consisting of * elements of ::amdsmi_evt_notification_type_t OR'd together, this function * will listen for the events specified in @p mask on the device - * corresponding to @p device_handle. + * corresponding to @p processor_handle. * - * @param device_handle a device handle corresponding to the device on which to + * @param processor_handle a processor handle corresponding to the device on which to * listen for events * * @param mask Bitmask generated by OR'ing 1 or more elements of @@ -3494,13 +3440,13 @@ amdsmi_init_event_notification(amdsmi_device_handle device_handle); * AMDSMI_EVT_NOTIF_THERMAL_THROTTLE event (which has a value of 2). * * @note ::AMDSMI_STATUS_INIT_ERROR is returned if - * ::amdsmi_init_event_notification() has not been called before a call to this + * ::amdsmi_init_gpu_event_notification() has not been called before a call to this * function * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_set_event_notification_mask(amdsmi_device_handle device_handle, uint64_t mask); + amdsmi_set_gpu_event_notification_mask(amdsmi_processor_handle processor_handle, uint64_t mask); /** * @brief Collect event notifications, waiting a specified amount of time @@ -3516,10 +3462,10 @@ amdsmi_status_t * to the buffer then poll for new events if there is still caller-provided * buffer available to write any new events that would be found. * - * This function requires prior calls to ::amdsmi_init_event_notification() and - * :: amdsmi_set_event_notification_mask(). This function polls for the + * This function requires prior calls to ::amdsmi_init_gpu_event_notification() and + * :: amdsmi_set_gpu_event_notification_mask(). This function polls for the * occurrance of the events on the respective devices that were previously - * specified by :: amdsmi_set_event_notification_mask(). + * specified by :: amdsmi_set_gpu_event_notification_mask(). * * @param[in] timeout_ms number of milliseconds to wait for an event * to occur @@ -3538,7 +3484,7 @@ amdsmi_status_t * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t - amdsmi_get_event_notification(int timeout_ms, + amdsmi_get_gpu_event_notification(int timeout_ms, uint32_t *num_elem, amdsmi_evt_notification_data_t *data); /** @@ -3546,35 +3492,35 @@ amdsmi_status_t * notification for a GPU * * @details Any resources used by event notification for the GPU with - * device handle @p device_handle will be free with this + * processor handle @p processor_handle will be free with this * function. This includes freeing any memory and closing file handles. This - * should be called for every call to ::amdsmi_init_event_notification() + * should be called for every call to ::amdsmi_init_gpu_event_notification() * - * @param[in] device_handle The device handle of the GPU for which event + * @param[in] processor_handle The processor handle of the GPU for which event * notification resources will be free * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_stop_event_notification(amdsmi_device_handle device_handle); +amdsmi_status_t amdsmi_stop_gpu_event_notification(amdsmi_processor_handle processor_handle); /** @} End EvntNotif */ /** * @brief Returns BDF of the given device * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] bdf Reference to BDF. Must be allocated by user. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_device_bdf(amdsmi_device_handle device_handle, amdsmi_bdf_t *bdf); +amdsmi_get_gpu_device_bdf(amdsmi_processor_handle processor_handle, amdsmi_bdf_t *bdf); /** * @brief Returns the UUID of the device * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[in,out] uuid_length Length of the uuid string. As input, must be * equal or greater than SMI_GPU_UUID_SIZE and be allocated by @@ -3586,7 +3532,7 @@ amdsmi_get_device_bdf(amdsmi_device_handle device_handle, amdsmi_bdf_t *bdf); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_length, char *uuid); +amdsmi_get_gpu_device_uuid(amdsmi_processor_handle processor_handle, unsigned int *uuid_length, char *uuid); /*****************************************************************************/ /** @defgroup swversion SW Version Information @@ -3596,7 +3542,7 @@ amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_le /** * @brief Returns the driver version information * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[in,out] length As input parameter length of the user allocated * string buffer. As output parameter length of the returned @@ -3608,7 +3554,7 @@ amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_le * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_driver_version(amdsmi_device_handle device_handle, int *length, char *version); +amdsmi_get_gpu_driver_version(amdsmi_processor_handle processor_handle, int *length, char *version); /** @} End swversion */ @@ -3621,10 +3567,10 @@ amdsmi_get_driver_version(amdsmi_device_handle device_handle, int *length, char * @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] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to static asic information structure. * Must be allocated by user. @@ -3632,12 +3578,12 @@ amdsmi_get_driver_version(amdsmi_device_handle device_handle, int *length, char * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *info); +amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_info_t *info); /** * @brief Returns the board part number and board information for the requested device * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to board info structure. * Must be allocated by user. @@ -3645,13 +3591,13 @@ amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *inf * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_board_info(amdsmi_device_handle device_handle, amdsmi_board_info_t *info); +amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_handle, amdsmi_board_info_t *info); /** * @brief Returns the power caps as currently configured in the * system. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * @param[in] sensor_ind A 0-based sensor index. Normally, this will be 0. * If a device has more than one sensor, it could be greater than 0. * @param[out] info Reference to power caps information structure. Must be @@ -3660,13 +3606,13 @@ amdsmi_get_board_info(amdsmi_device_handle device_handle, amdsmi_board_info_t *i * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_power_cap_info(amdsmi_device_handle device_handle, uint32_t sensor_ind, +amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_cap_info_t *info); /** * @brief Returns XGMI information for the GPU. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to xgmi information structure. Must be * allocated by user. @@ -3675,21 +3621,7 @@ amdsmi_get_power_cap_info(amdsmi_device_handle device_handle, uint32_t sensor_in * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_xgmi_info(amdsmi_device_handle device_handle, amdsmi_xgmi_info_t *info); - -/** - * @brief Returns the device capabilities as currently configured in - * the system - * - * @param[in] device_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_device_handle device_handle, amdsmi_gpu_caps_t *info); +amdsmi_get_xgmi_info(amdsmi_processor_handle processor_handle, amdsmi_xgmi_info_t *info); /** @} End asicinfo */ @@ -3701,19 +3633,19 @@ amdsmi_get_caps_info(amdsmi_device_handle device_handle, amdsmi_gpu_caps_t *info /** * @brief Returns the firmware versions running on the device. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to the fw info. Must be allocated by user. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_fw_info(amdsmi_device_handle device_handle, amdsmi_fw_info_t *info); +amdsmi_get_fw_info(amdsmi_processor_handle processor_handle, amdsmi_fw_info_t *info); /** * @brief Returns the static information for the vBIOS on the device. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to static vBIOS information. * Must be allocated by user. @@ -3721,7 +3653,7 @@ amdsmi_get_fw_info(amdsmi_device_handle device_handle, amdsmi_fw_info_t *info); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_vbios_info(amdsmi_device_handle device_handle, amdsmi_vbios_info_t *info); +amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios_info_t *info); /** @} End fwinfo */ @@ -3734,34 +3666,34 @@ amdsmi_get_vbios_info(amdsmi_device_handle device_handle, amdsmi_vbios_info_t *i * @brief Returns the current usage of the GPU engines (GFX, MM and MEM). * Each usage is reported as a percentage from 0-100%. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to the gpu engine usage structure. Must be allocated by user. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_gpu_activity(amdsmi_device_handle device_handle, amdsmi_engine_usage_t *info); +amdsmi_get_gpu_activity(amdsmi_processor_handle processor_handle, amdsmi_engine_usage_t *info); /** * @brief Returns the current power and voltage of the GPU. * The voltage is in units of mV and the power in units of W. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] info Reference to the gpu power structure. Must be allocated by user. * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_power_measure(amdsmi_device_handle device_handle, amdsmi_power_measure_t *info); +amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_info_t *info); /** * @brief Returns the measurements of the clocks in the GPU * for the GFX and multimedia engines and Memory. This call * reports the averages over 1s in MHz. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[in] clk_type Enum representing the clock type to query. * @@ -3771,13 +3703,13 @@ amdsmi_get_power_measure(amdsmi_device_handle device_handle, amdsmi_power_measur * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_clock_measure(amdsmi_device_handle device_handle, amdsmi_clk_type_t clk_type, amdsmi_clk_measure_t *info); +amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_clk_info_t *info); /** * @brief Returns the VRAM usage (both total and used memory) * in MegaBytes. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * * @param[out] info Reference to vram information. @@ -3786,7 +3718,7 @@ amdsmi_get_clock_measure(amdsmi_device_handle device_handle, amdsmi_clk_type_t c * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_vram_usage(amdsmi_device_handle device_handle, amdsmi_vram_info_t *info); +amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_handle, amdsmi_vram_info_t *info); /** @} End gpumon */ @@ -3799,7 +3731,7 @@ amdsmi_get_vram_usage(amdsmi_device_handle device_handle, amdsmi_vram_info_t *in * @brief Returns current and supported frequency range * for the specified clock type. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[in] clk_type Clock type for which to get current and supported * frequency range. @@ -3810,7 +3742,7 @@ amdsmi_get_vram_usage(amdsmi_device_handle device_handle, amdsmi_vram_info_t *in * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_target_frequency_range(amdsmi_device_handle device_handle, amdsmi_clk_type_t clk_type, amdsmi_frequency_range_t *range); +amdsmi_get_gpu_target_frequency_range(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_frequency_range_t *range); /** @} End powermon */ @@ -3827,7 +3759,7 @@ amdsmi_get_target_frequency_range(amdsmi_device_handle device_handle, amdsmi_clk * sets max_processes to 0, the total number of processes will be * returned. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] list Reference to a user-provided buffer where the process * list will be returned. This buffer must contain at least @@ -3841,13 +3773,13 @@ amdsmi_get_target_frequency_range(amdsmi_device_handle device_handle, amdsmi_clk * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_process_list(amdsmi_device_handle device_handle, amdsmi_process_handle *list, uint32_t *max_processes); +amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, amdsmi_process_handle *list, uint32_t *max_processes); /** * @brief Returns the process information of a given process. * Engine usage show how much time the process spend using these engines in ns. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[in] process Handle of process to query. * @@ -3857,7 +3789,7 @@ amdsmi_get_process_list(amdsmi_device_handle device_handle, amdsmi_process_handl * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_process_info(amdsmi_device_handle device_handle, amdsmi_process_handle process, amdsmi_proc_info_t *info); +amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_process_handle process, amdsmi_proc_info_t *info); /** @} End processinfo */ @@ -3870,7 +3802,7 @@ amdsmi_get_process_info(amdsmi_device_handle device_handle, amdsmi_process_handl * @brief Returns the number of ECC errors (correctable and * uncorrectable) in the given GPU. * - * @param[in] device_handle Device which to query + * @param[in] processor_handle Device which to query * * @param[out] ec Reference to ecc error count structure. * Must be allocated by user. @@ -3878,7 +3810,7 @@ amdsmi_get_process_info(amdsmi_device_handle device_handle, amdsmi_process_handl * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_get_ecc_error_count(amdsmi_device_handle device_handle, amdsmi_error_count_t *ec); +amdsmi_get_gpu_ecc_error_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec); /** @} End eccinfo */ diff --git a/projects/amdsmi/include/amd_smi/impl/amd_smi_gpu_device.h b/projects/amdsmi/include/amd_smi/impl/amd_smi_gpu_device.h index 9e17b05ca3..002e177146 100644 --- a/projects/amdsmi/include/amd_smi/impl/amd_smi_gpu_device.h +++ b/projects/amdsmi/include/amd_smi/impl/amd_smi_gpu_device.h @@ -45,20 +45,20 @@ #define AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_ #include "amd_smi/amdsmi.h" -#include "amd_smi/impl/amd_smi_device.h" +#include "amd_smi/impl/amd_smi_processor.h" #include "amd_smi/impl/amd_smi_drm.h" #include "shared_mutex.h" // NOLINT namespace amd { namespace smi { -class AMDSmiGPUDevice: public AMDSmiDevice { +class AMDSmiGPUDevice: public AMDSmiProcessor { public: AMDSmiGPUDevice(uint32_t gpu_id, uint32_t fd, std::string path, amdsmi_bdf_t bdf, AMDSmiDrm& drm): - AMDSmiDevice(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {} + AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), fd_(fd), path_(path), bdf_(bdf), drm_(drm) {} AMDSmiGPUDevice(uint32_t gpu_id, AMDSmiDrm& drm): - AMDSmiDevice(AMD_GPU), gpu_id_(gpu_id), drm_(drm) { + AMDSmiProcessor(AMD_GPU), gpu_id_(gpu_id), drm_(drm) { if (check_if_drm_is_supported()) this->get_drm_data(); } ~AMDSmiGPUDevice() { diff --git a/projects/amdsmi/include/amd_smi/impl/amd_smi_device.h b/projects/amdsmi/include/amd_smi/impl/amd_smi_processor.h similarity index 84% rename from projects/amdsmi/include/amd_smi/impl/amd_smi_device.h rename to projects/amdsmi/include/amd_smi/impl/amd_smi_processor.h index 86a7623d2d..3db7b0f53c 100644 --- a/projects/amdsmi/include/amd_smi/impl/amd_smi_device.h +++ b/projects/amdsmi/include/amd_smi/impl/amd_smi_processor.h @@ -41,25 +41,25 @@ * */ -#ifndef AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_ -#define AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_ +#ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_ +#define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_ #include "amd_smi/amdsmi.h" namespace amd { namespace smi { -class AMDSmiDevice { +class AMDSmiProcessor { public: - explicit AMDSmiDevice(device_type_t device) : device_type_(device) {} - virtual ~AMDSmiDevice() {} - device_type_t get_device_type() const { return device_type_;} + explicit AMDSmiProcessor(processor_type_t processor) : processor_type_(processor) {} + virtual ~AMDSmiProcessor() {} + processor_type_t get_processor_type() const { return processor_type_;} private: - device_type_t device_type_; + processor_type_t processor_type_; }; } // namespace smi } // namespace amd -#endif // AMD_SMI_INCLUDE_AMD_SMI_DEVICE_H_ +#endif // AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_ diff --git a/projects/amdsmi/include/amd_smi/impl/amd_smi_socket.h b/projects/amdsmi/include/amd_smi/impl/amd_smi_socket.h index 5f114bdc4b..93c5bd38d1 100644 --- a/projects/amdsmi/include/amd_smi/impl/amd_smi_socket.h +++ b/projects/amdsmi/include/amd_smi/impl/amd_smi_socket.h @@ -48,7 +48,7 @@ #include #include #include "amd_smi/amdsmi.h" -#include "amd_smi/impl/amd_smi_device.h" +#include "amd_smi/impl/amd_smi_processor.h" namespace amd { namespace smi { @@ -58,12 +58,12 @@ class AMDSmiSocket { explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {} ~AMDSmiSocket(); const std::string& get_socket_id() const { return socket_identifier_;} - void add_device(AMDSmiDevice* device) { devices_.push_back(device); } - std::vector& get_devices() { return devices_;} - amdsmi_status_t get_device_count(uint32_t* device_count) const; + void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); } + std::vector& get_processors() { return processors_;} + amdsmi_status_t get_processor_count(uint32_t* processor_count) const; private: std::string socket_identifier_; - std::vector devices_; + std::vector processors_; }; } // namespace smi diff --git a/projects/amdsmi/include/amd_smi/impl/amd_smi_system.h b/projects/amdsmi/include/amd_smi/impl/amd_smi_system.h index c83a86eb3c..531a7b9499 100644 --- a/projects/amdsmi/include/amd_smi/impl/amd_smi_system.h +++ b/projects/amdsmi/include/amd_smi/impl/amd_smi_system.h @@ -48,7 +48,7 @@ #include #include "amd_smi/amdsmi.h" #include "amd_smi/impl/amd_smi_socket.h" -#include "amd_smi/impl/amd_smi_device.h" +#include "amd_smi/impl/amd_smi_processor.h" #include "amd_smi/impl/amd_smi_drm.h" namespace amd { @@ -69,11 +69,11 @@ class AMDSmiSystem { amdsmi_status_t handle_to_socket(amdsmi_socket_handle socket_handle, AMDSmiSocket** socket); - amdsmi_status_t handle_to_device(amdsmi_device_handle device_handle, - AMDSmiDevice** device); + amdsmi_status_t handle_to_processor(amdsmi_processor_handle processor_handle, + AMDSmiProcessor** device); amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index, - amdsmi_device_handle* device_handle); + amdsmi_processor_handle* processor_handle); private: AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {} @@ -82,7 +82,7 @@ class AMDSmiSystem { uint64_t init_flag_; AMDSmiDrm drm_; std::vector sockets_; - std::set devices_; // Track valid devices + std::set processors_; // Track valid processors }; diff --git a/projects/amdsmi/py-interface/README.md b/projects/amdsmi/py-interface/README.md index 5b20b46eff..99ed3ac6ea 100644 --- a/projects/amdsmi/py-interface/README.md +++ b/projects/amdsmi/py-interface/README.md @@ -47,7 +47,7 @@ in amdsmi-lib and `err_info` is a string that explains the error that occurred. Example: ```python try: - num_of_GPUs = len(amdsmi_get_device_handles()) + num_of_GPUs = len(amdsmi_get_processor_handles()) if num_of_GPUs == 0: print("No GPUs on machine") except AmdSmiException as e: @@ -102,45 +102,45 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_device_type +## amdsmi_get_processor_type Description: Checks the type of device with provided handle. -Input parameters: device handle as an instance of `amdsmi_device_handle` +Input parameters: device handle as an instance of `amdsmi_processor_handle` Output: Integer, type of gpu -Exceptions that can be thrown by `amdsmi_get_device_type` function: +Exceptions that can be thrown by `amdsmi_get_processor_type` function: * `AmdSmiLibraryException` Example: ```python try: - type_of_GPU = amdsmi_get_device_type(device_handle) + type_of_GPU = amdsmi_get_processor_type(processor_handle) if type_of_GPU == 1: print("This is an AMD GPU") except AmdSmiException as e: print(e) ``` -## amdsmi_get_device_handles +## amdsmi_get_processor_handles Description: Returns list of GPU device handle objects on current machine Input parameters: `None` Output: List of GPU device handle objects -Exceptions that can be thrown by `amdsmi_get_device_handles` function: +Exceptions that can be thrown by `amdsmi_get_processor_handles` function: * `AmdSmiLibraryException` Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - print(amdsmi_get_device_uuid(device)) + print(amdsmi_get_gpu_device_uuid(device)) except AmdSmiException as e: print(e) ``` @@ -191,7 +191,7 @@ except AmdSmiException as e: ``` -## amdsmi_get_device_handle_from_bdf +## amdsmi_get_processor_handle_from_bdf Description: Returns device handle from the given BDF Input parameters: bdf string in form of either `::.` or `:.` in hexcode format. @@ -203,24 +203,24 @@ Where: Output: device handle object -Exceptions that can be thrown by `amdsmi_get_device_handle_from_bdf` function: +Exceptions that can be thrown by `amdsmi_get_processor_handle_from_bdf` function: * `AmdSmiLibraryException` * `AmdSmiBdfFormatException` Example: ```python try: - device = amdsmi_get_device_handle_from_bdf("0000:23:00.0") - print(amdsmi_get_device_uuid(device)) + device = amdsmi_get_processor_handle_from_bdf("0000:23:00.0") + print(amdsmi_get_gpu_device_uuid(device)) except AmdSmiException as e: print(e) ``` -## amdsmi_get_device_bdf +## amdsmi_get_gpu_device_bdf Description: Returns BDF of the given device Input parameters: -* `device_handle` dev for which to query +* `processor_handle` dev for which to query Output: BDF string in form of `::.` in hexcode format. Where: @@ -229,79 +229,78 @@ Where: * `` is 2 hex digits long from 00-1F interval * `` is 1 hex digit long from 0-7 interval -Exceptions that can be thrown by `amdsmi_get_device_bdf` function: +Exceptions that can be thrown by `amdsmi_get_gpu_device_bdf` function: * `AmdSmiParameterException` * `AmdSmiLibraryException` Example: ```python try: - device = amdsmi_get_device_handles()[0] - print("Device's bdf:", amdsmi_get_device_bdf(device)) + device = amdsmi_get_processor_handles()[0] + print("Device's bdf:", amdsmi_get_gpu_device_bdf(device)) except AmdSmiException as e: print(e) ``` -## amdsmi_get_device_uuid +## amdsmi_get_gpu_device_uuid Description: Returns the UUID of the device Input parameters: -* `device_handle` dev for which to query +* `processor_handle` dev for which to query Output: UUID string unique to the device -Exceptions that can be thrown by `amdsmi_get_device_uuid` function: +Exceptions that can be thrown by `amdsmi_get_gpu_device_uuid` function: * `AmdSmiParameterException` * `AmdSmiLibraryException` Example: ```python try: - device = amdsmi_get_device_handles()[0] - print("Device UUID: ", amdsmi_get_device_uuid(device)) + device = amdsmi_get_processor_handles()[0] + print("Device UUID: ", amdsmi_get_gpu_device_uuid(device)) except AmdSmiException as e: print(e) ``` -## amdsmi_get_driver_version +## amdsmi_get_gpu_driver_version Description: Returns the version string of the driver Input parameters: -* `device_handle` dev for which to query +* `processor_handle` dev for which to query Output: Driver version string that is handling the device -Exceptions that can be thrown by `amdsmi_get_driver_version` function: +Exceptions that can be thrown by `amdsmi_get_gpu_driver_version` function: * `AmdSmiParameterException` * `AmdSmiLibraryException` Example: ```python try: - device = amdsmi_get_device_handles()[0] - print("Driver version: ", amdsmi_get_driver_version(device)) + device = amdsmi_get_processor_handles()[0] + print("Driver version: ", amdsmi_get_gpu_driver_version(device)) except AmdSmiException as e: print(e) ``` -## amdsmi_get_asic_info +## amdsmi_get_gpu_asic_info Description: Returns asic information for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields Field | Content ---|--- `market_name` | market name -`family` | family `vendor_id` | vendor id `device_id` | device id `rev_id` | revision id `asic_serial` | asic serial -Exceptions that can be thrown by `amdsmi_get_asic_info` function: +Exceptions that can be thrown by `amdsmi_get_gpu_asic_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -309,14 +308,13 @@ Exceptions that can be thrown by `amdsmi_get_asic_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - asic_info = amdsmi_get_asic_info(device) + 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'])) @@ -329,7 +327,7 @@ Description: Returns dictionary of power capabilities as currently configured on the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -349,7 +347,7 @@ Exceptions that can be thrown by `amdsmi_get_power_cap_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -364,64 +362,23 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_caps_info -Description: Returns capabilities as currently configured for the given GPU -Input parameters: -* `device_handle` device which to query - -Output: Dictionary with fields - -Field | Description ----|--- - `gfx` |
Subfield Description
`gfxip_major` major revision of GFX IP
`gfxip_minor`minor revision of GFX IP
`gfxip_cu_count`number of GFX compute units
- `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_device_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_vbios_info +## amdsmi_get_gpu_vbios_info Description: Returns the static information for the VBIOS on the device. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query 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_vbios_info` function: +Exceptions that can be thrown by `amdsmi_get_gpu_vbios_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -429,17 +386,16 @@ Exceptions that can be thrown by `amdsmi_get_vbios_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - vbios_info = amdsmi_get_vbios_info(device) + 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) ``` @@ -448,7 +404,7 @@ except AmdSmiException as e: Description: Returns GPU firmware related information. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -464,7 +420,7 @@ Exceptions that can be thrown by `amdsmi_get_fw_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -481,7 +437,7 @@ except AmdSmiException as e: Description: Returns the engine usage for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -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` @@ -499,7 +455,7 @@ Exceptions that can be thrown by `amdsmi_get_gpu_activity` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -511,22 +467,21 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_get_power_measure +## amdsmi_get_power_info Description: Returns the current power and voltage for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields Field | Description ---|--- `average_socket_power`| average socket power -`voltage_gfx` | voltage gfx -`energy_accumulator` | energy accumulator +`gfx_voltage` | voltage gfx `power_limit` | power limit -Exceptions that can be thrown by `amdsmi_get_power_measure` function: +Exceptions that can be thrown by `amdsmi_get_power_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -534,24 +489,23 @@ Exceptions that can be thrown by `amdsmi_get_power_measure` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - power_measure = amdsmi_get_power_measure(device) + power_measure = amdsmi_get_power_info(device) print(power_measure['average_socket_power']) - print(power_measure['voltage_gfx']) - print(power_measure['energy_accumulator']) + print(power_measure['gfx_voltage']) print(power_measure['power_limit']) except AmdSmiException as e: print(e) ``` -## amdsmi_get_vram_usage +## amdsmi_get_gpu_vram_usage Description: Returns total VRAM and VRAM in use Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -560,7 +514,7 @@ Field | Description `vram_total` | VRAM total `vram_used`| VRAM currently in use -Exceptions that can be thrown by `amdsmi_get_vram_usage` function: +Exceptions that can be thrown by `amdsmi_get_gpu_vram_usage` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -568,22 +522,22 @@ Exceptions that can be thrown by `amdsmi_get_vram_usage` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - vram_usage = amdsmi_get_vram_usage(device) + vram_usage = amdsmi_get_gpu_vram_usage(device) print(vram_usage['vram_used']) print(vram_usage['vram_total']) except AmdSmiException as e: print(e) ``` -## amdsmi_get_clock_measure +## amdsmi_get_clock_info Description: Returns the clock measure for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `clock_type` one of `AmdSmiClkType` enum values: Field | Description @@ -605,11 +559,10 @@ 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 -Exceptions that can be thrown by `amdsmi_get_clock_measure` function: +Exceptions that can be thrown by `amdsmi_get_clock_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -617,14 +570,13 @@ Exceptions that can be thrown by `amdsmi_get_clock_measure` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - clock_measure = amdsmi_get_clock_measure(device, AmdSmiClkType.GFX) + 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: @@ -636,7 +588,7 @@ Description: Returns the pcie link status for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -653,7 +605,7 @@ Exceptions that can be thrown by `amdsmi_get_pcie_link_status` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -669,7 +621,7 @@ except AmdSmiException as e: Description: Returns the max pcie link capabilities for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -686,7 +638,7 @@ Exceptions that can be thrown by `amdsmi_get_pcie_link_caps` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -698,11 +650,11 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_bad_page_info +## amdsmi_get_gpu_bad_page_info Description: Returns bad page info for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: List consisting of dictionaries with fields for each bad page found @@ -713,7 +665,7 @@ Field | Description `page_size` | Size of bad page `status` | Status of bad page -Exceptions that can be thrown by `amdsmi_get_bad_page_info` function: +Exceptions that can be thrown by `amdsmi_get_gpu_bad_page_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -721,12 +673,12 @@ Exceptions that can be thrown by `amdsmi_get_bad_page_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - bad_page_info = amdsmi_get_bad_page_info(device) + bad_page_info = amdsmi_get_gpu_bad_page_info(device) if not len(bad_page_info): print("No bad pages found") continue @@ -739,14 +691,14 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_target_frequency_range +## amdsmi_get_gpu_target_frequency_range Description: Returns the supported frequency target range for the given GPU `Note: Not Supported` Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `clock_type` one of `AmdSmiClkType` enum values: Field | Description @@ -772,7 +724,7 @@ Field | Description `current_upper_bound` | Maximal value of target current frequency in MHz `current_lower_bound` | Minimal value of target current frequency in MHz -Exceptions that can be thrown by `amdsmi_get_target_frequency_range` function: +Exceptions that can be thrown by `amdsmi_get_gpu_target_frequency_range` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -780,27 +732,27 @@ Exceptions that can be thrown by `amdsmi_get_target_frequency_range` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: print("=============== GFX DOMAIN ================") - freq_range = amdsmi_get_target_frequency_range(device, + freq_range = amdsmi_get_gpu_target_frequency_range(device, AmdSmiClkType.GFX) print(freq_range['supported_upper_bound']) print(freq_range['supported_lower_bound']) print(freq_range['current_upper_bound']) print(freq_range['current_lower_bound']) print("=============== MEM DOMAIN ================") - freq_range = amdsmi_get_target_frequency_range(device, + freq_range = amdsmi_get_gpu_target_frequency_range(device, AmdSmiClkType.MEM) print(freq_range['supported_upper_bound']) print(freq_range['supported_lower_bound']) print(freq_range['current_upper_bound']) print(freq_range['current_lower_bound']) print("=============== VCLK0 DOMAIN ================") - freq_range = amdsmi_get_target_frequency_range(device, + freq_range = amdsmi_get_gpu_target_frequency_range(device, AmdSmiClkType.VCLK0) print(freq_range['supported_upper_bound']) print(freq_range['supported_lower_bound']) @@ -810,16 +762,16 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_process_list +## amdsmi_get_gpu_process_list Description: Returns the list of processes for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: List of process handles found -Exceptions that can be thrown by `amdsmi_get_process_list` function: +Exceptions that can be thrown by `amdsmi_get_gpu_process_list` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -827,22 +779,22 @@ Exceptions that can be thrown by `amdsmi_get_process_list` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - processes = amdsmi_get_process_list(device) + processes = amdsmi_get_gpu_process_list(device) print(processes) except AmdSmiException as e: print(e) ``` -## amdsmi_get_process_info +## amdsmi_get_gpu_process_info Description: Returns the info for the given process Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `process_handle` process which to query Output: Dictionary with fields @@ -852,10 +804,10 @@ Field | Description `name` | Name of process `pid` | Process ID `mem` | Process memory usage -`engine_usage`|
Subfield Description
`gfx`GFX engine usage in ns
`compute`Compute engine usage in ns
`dma`DMA engine usage in ns
`enc`Encode engine usage in ns
`dec`Decode engine usage in ns
+`engine_usage`|
Subfield Description
`gfx`GFX engine usage in ns
`enc`Encode engine usage in ns
`memory_usage`|
Subfield Description
`gtt_mem`GTT memory usage
`cpu_mem`CPU memory usage
`vram_mem`VRAM memory usage
-Exceptions that can be thrown by `amdsmi_get_process_info` function: +Exceptions that can be thrown by `amdsmi_get_gpu_process_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -863,24 +815,24 @@ Exceptions that can be thrown by `amdsmi_get_process_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - processes = amdsmi_get_process_list(device) + processes = amdsmi_get_gpu_process_list(device) for process in processes: - print(amdsmi_get_process_info(device, process)) + print(amdsmi_get_gpu_process_info(device, process)) except AmdSmiException as e: print(e) ``` -## amdsmi_get_ecc_error_count +## amdsmi_get_gpu_ecc_error_count Description: Returns the ECC error count for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -889,7 +841,7 @@ Field | Description `correctable_count`| Correctable ECC error count `uncorrectable_count`| Uncorrectable ECC error count -Exceptions that can be thrown by `amdsmi_get_ecc_error_count` function: +Exceptions that can be thrown by `amdsmi_get_gpu_ecc_error_count` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -897,24 +849,24 @@ Exceptions that can be thrown by `amdsmi_get_ecc_error_count` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - ecc_error_count = amdsmi_get_ecc_error_count(device) + ecc_error_count = amdsmi_get_gpu_ecc_error_count(device) print(ecc_error_count["correctable_count"]) print(ecc_error_count["uncorrectable_count"]) except AmdSmiException as e: print(e) ``` -## amdsmi_get_board_info +## amdsmi_get_gpu_board_info Description: Returns board info for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields correctable and uncorrectable @@ -924,7 +876,7 @@ Field | Description `product_serial` | Product serial `product_name` | Product name -Exceptions that can be thrown by `amdsmi_get_board_info` function: +Exceptions that can be thrown by `amdsmi_get_gpu_board_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -932,8 +884,8 @@ Exceptions that can be thrown by `amdsmi_get_board_info` function: Example: ```python try: - device = amdsmi_get_device_handle_from_bdf("0000:23.00.0") - board_info = amdsmi_get_board_info(device) + device = amdsmi_get_processor_handle_from_bdf("0000:23.00.0") + board_info = amdsmi_get_gpu_board_info(device) print(board_info["serial_number"]) print(board_info["product_serial"]) print(board_info["product_name"]) @@ -941,12 +893,12 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_ras_block_features_enabled +## amdsmi_get_gpu_ras_block_features_enabled Description: Returns status of each RAS block for the given GPU Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: List containing dictionaries with fields for each RAS block @@ -955,7 +907,7 @@ Field | Description `block` | RAS block `status` | RAS block status -Exceptions that can be thrown by `amdsmi_get_ras_block_features_enabled` function: +Exceptions that can be thrown by `amdsmi_get_gpu_ras_block_features_enabled` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -963,12 +915,12 @@ Exceptions that can be thrown by `amdsmi_get_ras_block_features_enabled` functio Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - ras_block_features = amdsmi_get_ras_block_features_enabled(device) + ras_block_features = amdsmi_get_gpu_ras_block_features_enabled(device) print(ras_block_features) except AmdSmiException as e: print(e) @@ -986,7 +938,7 @@ Description: Allocates a new event reader notifier to monitor different types of Input parameters: -* `device_handle` device handle corresponding to the device on which to listen for events +* `processor_handle` device handle corresponding to the device on which to listen for events * `event_types` list of event types from AmdSmiEvtNotificationType enum. Specifying which events to collect for the given device. Event Type | Description @@ -1015,7 +967,7 @@ Input parameters: `None` Example with manual cleanup of AmdSmiEventReader: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -1030,7 +982,7 @@ finally: Example with automatic cleanup using `with` statement: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -1041,16 +993,16 @@ except AmdSmiException as e: ``` -## amdsmi_dev_open_supported_func_iterator +## amdsmi_open_supported_func_iterator Description: Get a function name iterator of supported AMDSMI functions for a device Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Handle for a function iterator -Exceptions that can be thrown by `amdsmi_dev_open_supported_func_iterator` function: +Exceptions that can be thrown by `amdsmi_open_supported_func_iterator` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1058,19 +1010,19 @@ Exceptions that can be thrown by `amdsmi_dev_open_supported_func_iterator` funct Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - obj_handle = amdsmi_dev_open_supported_func_iterator(device) + obj_handle = amdsmi_open_supported_func_iterator(device) print(obj_handle) - amdsmi_dev_close_supported_func_iterator(obj_handle) + amdsmi_close_supported_func_iterator(obj_handle) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_open_supported_variant_iterator +## amdsmi_open_supported_variant_iterator Description: Get a variant iterator for a given handle Input parameters: @@ -1079,7 +1031,7 @@ Input parameters: Output: Variant iterator handle -Exceptions that can be thrown by `amdsmi_dev_open_supported_variant_iterator` function: +Exceptions that can be thrown by `amdsmi_open_supported_variant_iterator` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1087,16 +1039,16 @@ Exceptions that can be thrown by `amdsmi_dev_open_supported_variant_iterator` fu Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - obj_handle = amdsmi_dev_open_supported_func_iterator(device) - var_iter = amdsmi_dev_open_supported_variant_iterator(obj_handle) + obj_handle = amdsmi_open_supported_func_iterator(device) + var_iter = amdsmi_open_supported_variant_iterator(obj_handle) print(var_iter) - amdsmi_dev_close_supported_func_iterator(obj_handle) - amdsmi_dev_close_supported_func_iterator(var_iter) + amdsmi_close_supported_func_iterator(obj_handle) + amdsmi_close_supported_func_iterator(var_iter) except AmdSmiException as e: print(e) ``` @@ -1118,21 +1070,21 @@ Exceptions that can be thrown by `amdsmi_next_func_iter` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - obj_handle = amdsmi_dev_open_supported_func_iterator(device) + obj_handle = amdsmi_open_supported_func_iterator(device) print(obj_handle) obj_handle = amdsmi_next_func_iter(obj_handle) print(obj_handle) - amdsmi_dev_close_supported_func_iterator(obj_handle) + amdsmi_close_supported_func_iterator(obj_handle) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_close_supported_func_iterator +## amdsmi_close_supported_func_iterator Description: Close a variant iterator handle Input parameters: @@ -1141,7 +1093,7 @@ Input parameters: Output: None -Exceptions that can be thrown by `amdsmi_dev_close_supported_func_iterator` function: +Exceptions that can be thrown by `amdsmi_close_supported_func_iterator` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1149,13 +1101,13 @@ Exceptions that can be thrown by `amdsmi_dev_close_supported_func_iterator` func Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - obj_handle = amdsmi_dev_open_supported_func_iterator(device) - amdsmi_dev_close_supported_func_iterator(obj_handle) + obj_handle = amdsmi_open_supported_func_iterator(device) + amdsmi_close_supported_func_iterator(obj_handle) except AmdSmiException as e: print(e) ``` @@ -1183,30 +1135,30 @@ Exceptions that can be thrown by `amdsmi_get_func_iter_value` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - obj_handle = amdsmi_dev_open_supported_func_iterator(device) + obj_handle = amdsmi_open_supported_func_iterator(device) value = amdsmi_get_func_iter_value(obj_handle) print(value) - amdsmi_dev_close_supported_func_iterator(obj_handle) + amdsmi_close_supported_func_iterator(obj_handle) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_pci_bandwidth +## amdsmi_set_gpu_pci_bandwidth Description: Control the set of allowed PCIe bandwidths that can be used Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `bw_bitmask` A bitmask indicating the indices of the bandwidths that are to be enabled (1) and disabled (0) Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_pci_bandwidth` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_pci_bandwidth` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1214,27 +1166,27 @@ Exceptions that can be thrown by ` amdsmi_dev_set_pci_bandwidth` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_pci_bandwidth(device, 0) + amdsmi_set_gpu_pci_bandwidth(device, 0) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_power_cap +## amdsmi_set_power_cap Description: Set the power cap value Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_ind` a 0-based sensor index. Normally, this will be 0. If a device has more than one sensor, it could be greater than 0 * `cap` int that indicates the desired power cap, in microwatts Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_power_cap` function: +Exceptions that can be thrown by ` amdsmi_set_power_cap` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1242,28 +1194,28 @@ Exceptions that can be thrown by ` amdsmi_dev_set_power_cap` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: power_cap = 250 * 1000000 - amdsmi_dev_set_power_cap(device, 0, power_cap) + amdsmi_set_power_cap(device, 0, power_cap) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_power_profile +## amdsmi_set_gpu_power_profile Description: Set the power profile Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `reserved` Not currently used, set to 0 * `profile` a amdsmi_power_profile_preset_masks_t that hold the mask of the desired new power profile Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_power_profile` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_power_profile` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1271,30 +1223,30 @@ Exceptions that can be thrown by ` amdsmi_dev_set_power_profile` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: profile = ... - amdsmi_dev_set_power_profile(device, 0, profile) + amdsmi_set_gpu_power_profile(device, 0, profile) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_clk_range +## amdsmi_set_gpu_clk_range Description: This function sets the clock range information Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `min_clk_value` minimum clock value for desired clock range * `max_clk_value` maximum clock value for desired clock range * `clk_type`AMDSMI_CLK_TYPE_SYS | AMDSMI_CLK_TYPE_MEM range type Output: None -Exceptions that can be thrown by `amdsmi_dev_set_clk_range` function: +Exceptions that can be thrown by `amdsmi_set_gpu_clk_range` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1302,23 +1254,23 @@ Exceptions that can be thrown by `amdsmi_dev_set_clk_range` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_clk_range(device, 0, 1000, AmdSmiClkType.AMDSMI_CLK_TYPE_SYS) + amdsmi_set_gpu_clk_range(device, 0, 1000, AmdSmiClkType.AMDSMI_CLK_TYPE_SYS) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_pci_id +## amdsmi_get_gpu_pci_id Description: Get the unique PCI device identifier associated for a device Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: device bdf The format of bdfid will be as follows: @@ -1335,7 +1287,7 @@ BDFID = ((DOMAIN & 0xffffffff) << 32) | ((BUS & 0xff) << 8) | | Function | [ 2: 0] | -Exceptions that can be thrown by `amdsmi_dev_get_pci_id` function: +Exceptions that can be thrown by `amdsmi_get_gpu_pci_id` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1348,19 +1300,19 @@ try: print("No GPUs on machine") else: for device in devices: - bdfid = amdsmi_dev_get_pci_id(device) + bdfid = amdsmi_get_gpu_pci_id(device) print(bdfid) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_pci_bandwidth +## amdsmi_get_gpu_pci_bandwidth Description: Get the list of possible PCIe bandwidths that are available. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with the possible T/s values and associated number of lanes @@ -1378,7 +1330,7 @@ Field | Content `current` | current `frequency` | list of frequency -Exceptions that can be thrown by `amdsmi_dev_get_pci_bandwidth` function: +Exceptions that can be thrown by `amdsmi_get_gpu_pci_bandwidth` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1391,18 +1343,18 @@ try: print("No GPUs on machine") else: for device in devices: - bandwidth = amdsmi_dev_get_pci_bandwidth(device) + bandwidth = amdsmi_get_gpu_pci_bandwidth(device) print(bandwidth) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_pci_throughput +## amdsmi_get_gpu_pci_throughput Description: Get PCIe traffic information Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with the fields @@ -1412,7 +1364,7 @@ Field | Content `received` | the number of bytes received `max_pkt_sz` | maximum packet size -Exceptions that can be thrown by `amdsmi_dev_get_pci_throughput` function: +Exceptions that can be thrown by `amdsmi_get_gpu_pci_throughput` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1425,24 +1377,24 @@ try: print("No GPUs on machine") else: for device in devices: - pci = amdsmi_dev_get_pci_throughput(device) + pci = amdsmi_get_gpu_pci_throughput(device) print(pci) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_pci_replay_counter +## amdsmi_get_gpu_pci_replay_counter Description: Get PCIe replay counter Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: counter value The sum of the NAK's received and generated by the GPU -Exceptions that can be thrown by ` amdsmi_dev_get_pci_replay_counter` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_pci_replay_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1455,23 +1407,23 @@ try: print("No GPUs on machine") else: for device in devices: - counter = amdsmi_dev_get_pci_replay_counter(device) + counter = amdsmi_get_gpu_pci_replay_counter(device) print(counter) except AmdSmiException as e: print(e) ``` -## amdsmi_topo_get_numa_affinity +## amdsmi_get_gpu_topo_numa_affinity Description: Get the NUMA node associated with a device Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: NUMA node value -Exceptions that can be thrown by `amdsmi_topo_get_numa_affinity` function: +Exceptions that can be thrown by `amdsmi_get_gpu_topo_numa_affinity` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1484,51 +1436,20 @@ try: print("No GPUs on machine") else: for device in devices: - numa_node = amdsmi_topo_get_numa_affinity(device) + numa_node = amdsmi_get_gpu_topo_numa_affinity(device) print(numa_node) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_power_ave -Description: Get the average power consumption of the device - -Input parameters: - -* `device_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_dev_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_dev_get_power_ave(device) - print(power) -except AmdSmiException as e: - print(e) -``` - - -## amdsmi_dev_get_energy_count +## amdsmi_get_energy_count Description: Get the energy accumulator counter of the device. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: Dictionary with fields @@ -1538,7 +1459,7 @@ Field | Content `counter_resolution` | counter resolution `timestamp` | timestamp -Exceptions that can be thrown by `amdsmi_dev_get_energy_count` function: +Exceptions that can be thrown by `amdsmi_get_energy_count` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1551,25 +1472,25 @@ try: print("No GPUs on machine") else: for device in devices: - power = amdsmi_dev_get_energy_count(device) + power = amdsmi_get_energy_count(device) print(power) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_memory_total +## amdsmi_get_gpu_memory_total Description: Get the total amount of memory that exists Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `mem_type` enum AmdSmiMemoryType Output: total amount of memory -Exceptions that can be thrown by `amdsmi_dev_get_memory_total` function: +Exceptions that can be thrown by `amdsmi_get_gpu_memory_total` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1582,7 +1503,7 @@ try: print("No GPUs on machine") else: for device in devices: - memory = amdsmi_dev_get_memory_total(device) + memory = amdsmi_get_gpu_memory_total(device) print(memory) except AmdSmiException as e: print(e) @@ -1591,11 +1512,11 @@ except AmdSmiException as e: -## amdsmi_dev_set_od_clk_info +## amdsmi_set_gpu_od_clk_info Description: This function sets the clock frequency information Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `level` AMDSMI_FREQ_IND_MIN|AMDSMI_FREQ_IND_MAX to set the minimum (0) or maximum (1) speed * `clk_value` value to apply to the clock range @@ -1603,7 +1524,7 @@ or maximum (1) speed Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_od_clk_info` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_od_clk_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1611,12 +1532,12 @@ Exceptions that can be thrown by ` amdsmi_dev_set_od_clk_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_od_clk_info( + amdsmi_set_gpu_od_clk_info( device, AmdSmiFreqInd.AMDSMI_FREQ_IND_MAX, 1000, @@ -1627,18 +1548,18 @@ except AmdSmiException as e: ``` -## amdsmi_dev_get_memory_usage +## amdsmi_get_gpu_memory_usage Description: Get the current memory usage Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `mem_type` enum AmdSmiMemoryType Output: the amount of memory currently being used -Exceptions that can be thrown by `amdsmi_dev_get_memory_usage` function: +Exceptions that can be thrown by `amdsmi_get_gpu_memory_usage` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1651,25 +1572,25 @@ try: print("No GPUs on machine") else: for device in devices: - memory = amdsmi_dev_get_memory_usage(device) + memory = amdsmi_get_gpu_memory_usage(device) print(memory) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_od_volt_info +## amdsmi_set_gpu_od_volt_info Description: This function sets 1 of the 3 voltage curve points Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `vpoint` voltage point [0|1|2] on the voltage curve * `clk_value` clock value component of voltage curve point * `volt_value` voltage value component of voltage curve point Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_od_volt_info` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_od_volt_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1677,28 +1598,28 @@ Exceptions that can be thrown by ` amdsmi_dev_set_od_volt_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_od_volt_info(device, 1, 1000, 980) + amdsmi_set_gpu_od_volt_info(device, 1, 1000, 980) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_memory_busy_percent +## amdsmi_get_gpu_memory_busy_percent Description: Get percentage of time any device memory is being used Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: percentage of time that any device memory is being used for the specified device. -Exceptions that can be thrown by `amdsmi_dev_get_memory_busy_percent` function: +Exceptions that can be thrown by `amdsmi_get_gpu_memory_busy_percent` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1711,7 +1632,7 @@ try: print("No GPUs on machine") else: for device in devices: - busy_percent = amdsmi_dev_get_memory_busy_percent(device) + busy_percent = amdsmi_get_gpu_memory_busy_percent(device) print(busy_percent) except AmdSmiException as e: print(e) @@ -1719,17 +1640,17 @@ except AmdSmiException as e: -## amdsmi_dev_set_perf_level_v1 +## amdsmi_set_gpu_perf_level_v1 Description: Set the PowerPlay performance level associated with the device with provided device handle with the provided value Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `perf_lvl` the value to which the performance level should be set Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_perf_level_v1` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_perf_level_v1` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1737,27 +1658,27 @@ Exceptions that can be thrown by ` amdsmi_dev_set_perf_level_v1` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_perf_level_v1(device, AmdSmiDevPerfLevel.AMDSMI_DEV_PERF_LEVEL_HIGH) + amdsmi_set_gpu_perf_level_v1(device, AmdSmiDevPerfLevel.AMDSMI_DEV_PERF_LEVEL_HIGH) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_fan_rpms +## amdsmi_get_gpu_fan_rpms Description: Get the fan speed in RPMs of the device with the specified device handle and 0-based sensor index. Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` 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: Fan speed in rpms as integer -Exceptions that can be thrown by `amdsmi_dev_get_fan_rpms` function: +Exceptions that can be thrown by `amdsmi_get_gpu_fan_rpms` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1765,28 +1686,28 @@ Exceptions that can be thrown by `amdsmi_dev_get_fan_rpms` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - fan_rpm = amdsmi_dev_get_fan_rpms(device, 0) + fan_rpm = amdsmi_get_gpu_fan_rpms(device, 0) print(fan_rpm) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_fan_speed +## amdsmi_get_gpu_fan_speed Description: Get the fan speed for the specified device as a value relative to AMDSMI_MAX_FAN_SPEED Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` 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: Fan speed in relative to MAX -Exceptions that can be thrown by `amdsmi_dev_get_fan_speed` function: +Exceptions that can be thrown by `amdsmi_get_gpu_fan_speed` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1794,27 +1715,27 @@ Exceptions that can be thrown by `amdsmi_dev_get_fan_speed` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - fan_speed = amdsmi_dev_get_fan_speed(device, 0) + fan_speed = amdsmi_get_gpu_fan_speed(device, 0) print(fan_speed) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_fan_speed_max +## amdsmi_get_gpu_fan_speed_max Description: Get the max fan speed of the device with provided device handle Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` 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: Max fan speed as integer -Exceptions that can be thrown by `amdsmi_dev_get_fan_speed_max` function: +Exceptions that can be thrown by `amdsmi_get_gpu_fan_speed_max` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1822,28 +1743,28 @@ Exceptions that can be thrown by `amdsmi_dev_get_fan_speed_max` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - max_fan_speed = amdsmi_dev_get_fan_speed_max(device, 0) + max_fan_speed = amdsmi_get_gpu_fan_speed_max(device, 0) print(max_fan_speed) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_temp_metric +## amdsmi_get_temp_metric Description: Get the temperature metric value for the specified metric, from the specified temperature sensor on the specified device Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_type` part of device from which temperature should be obtained * `metric` enum indicated which temperature value should be retrieved Output: Temperature as integer in millidegrees Celcius -Exceptions that can be thrown by ` amdsmi_dev_get_temp_metric` function: +Exceptions that can be thrown by ` amdsmi_get_temp_metric` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1851,29 +1772,29 @@ Exceptions that can be thrown by ` amdsmi_dev_get_temp_metric` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - temp_metric = amdsmi_dev_get_temp_metric(device, AmdSmiTemperatureType.EDGE, + temp_metric = amdsmi_get_temp_metric(device, AmdSmiTemperatureType.EDGE, AmdSmiTemperatureMetric.CURRENT) print(temp_metric) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_volt_metric +## amdsmi_get_gpu_volt_metric Description: Get the voltage metric value for the specified metric, from the specified voltage sensor on the specified device Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_type` part of device from which voltage should be obtained * `metric` enum indicated which voltage value should be retrieved Output: Voltage as integer in millivolts -Exceptions that can be thrown by ` amdsmi_dev_get_volt_metric` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_volt_metric` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1881,26 +1802,26 @@ Exceptions that can be thrown by ` amdsmi_dev_get_volt_metric` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - voltage = amdsmi_dev_get_volt_metric(device, AmdSmiVoltageType.VDDGFX, + voltage = amdsmi_get_gpu_volt_metric(device, AmdSmiVoltageType.VDDGFX, AmdSmiVoltageMetric.AVERAGE) print(voltage) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_busy_percent +## amdsmi_get_busy_percent Description: Get percentage of time device is busy doing any processing Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: How busy the device is (as percentage of time) -Exceptions that can be thrown by `amdsmi_dev_get_busy_percent` function: +Exceptions that can be thrown by `amdsmi_get_busy_percent` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1908,12 +1829,12 @@ Exceptions that can be thrown by `amdsmi_dev_get_busy_percent` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - busy = amdsmi_dev_get_busy_percent(dev) + busy = amdsmi_get_busy_percent(dev) print(busy) except AmdSmiException as e: print(e) @@ -1922,7 +1843,7 @@ except AmdSmiException as e: Description: Get coarse grain utilization counter of the specified device Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `counter_types` variable number of counter types desired Output: List containing dictionaries with fields @@ -1940,7 +1861,7 @@ Exceptions that can be thrown by `amdsmi_get_utilization_count` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -1959,15 +1880,15 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_perf_level +## amdsmi_get_gpu_perf_level Description: Get the performance level of the device with provided device handle Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: Performance level as enum value of dev_perf_level_t -Exceptions that can be thrown by `amdsmi_dev_get_perf_level` function: +Exceptions that can be thrown by `amdsmi_get_gpu_perf_level` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -1975,26 +1896,26 @@ Exceptions that can be thrown by `amdsmi_dev_get_perf_level` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - perf_level = amdsmi_dev_get_perf_level(dev) + perf_level = amdsmi_get_gpu_perf_level(dev) print(perf_level) except AmdSmiException as e: print(e) ``` -## amdsmi_set_perf_determinism_mode +## amdsmi_set_gpu_perf_determinism_mode Description: Enter performance determinism mode with provided device handle Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `clkvalue` softmax value for GFXCLK in MHz Output: None -Exceptions that can be thrown by `amdsmi_set_perf_determinism_mode` function: +Exceptions that can be thrown by `amdsmi_set_gpu_perf_determinism_mode` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2002,25 +1923,25 @@ Exceptions that can be thrown by `amdsmi_set_perf_determinism_mode` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_set_perf_determinism_mode(device, 1333) + amdsmi_set_gpu_perf_determinism_mode(device, 1333) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_overdrive_level +## amdsmi_get_gpu_overdrive_level Description: Get the overdrive percent associated with the device with provided device handle Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: Overdrive percentage as integer -Exceptions that can be thrown by `amdsmi_dev_get_overdrive_level` function: +Exceptions that can be thrown by `amdsmi_get_gpu_overdrive_level` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2028,22 +1949,22 @@ Exceptions that can be thrown by `amdsmi_dev_get_overdrive_level` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - od_level = amdsmi_dev_get_overdrive_level(dev) + od_level = amdsmi_get_gpu_overdrive_level(dev) print(od_level) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_gpu_clk_freq +## amdsmi_get_clk_freq Description: Get the list of possible system clock speeds of device for a specified clock type Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `clk_type` the type of clock for which the frequency is desired Output: Dictionary with fields @@ -2054,7 +1975,7 @@ Field | Description `current`| The current frequency index `frequency`| List of frequencies, only the first num_supported frequencies are valid -Exceptions that can be thrown by ` amdsmi_dev_get_gpu_clk_freq` function: +Exceptions that can be thrown by ` amdsmi_get_clk_freq` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2062,20 +1983,20 @@ Exceptions that can be thrown by ` amdsmi_dev_get_gpu_clk_freq` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_get_gpu_clk_freq(device, AmdSmiClkType.SYS) + amdsmi_get_clk_freq(device, AmdSmiClkType.SYS) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_od_volt_info +## amdsmi_get_gpu_od_volt_info Description: This function retrieves the voltage/frequency curve information Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: Dictionary with fields @@ -2089,7 +2010,7 @@ Field | Description `num_regions`| The current frequency index -Exceptions that can be thrown by ` amdsmi_dev_get_od_volt_info` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_od_volt_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2097,20 +2018,20 @@ Exceptions that can be thrown by ` amdsmi_dev_get_od_volt_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_get_od_volt_info(dev) + amdsmi_get_gpu_od_volt_info(dev) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_gpu_metrics_info +## amdsmi_get_gpu_metrics_info Description: This function retrieves the gpu metrics information Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: Dictionary with fields @@ -2151,7 +2072,7 @@ Field | Description `mem_actvity_acc` | mem activity acc `temperature_hbm` | hbm temperature -Exceptions that can be thrown by ` amdsmi_dev_get_gpu_metrics_info` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_metrics_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2159,21 +2080,21 @@ Exceptions that can be thrown by ` amdsmi_dev_get_gpu_metrics_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_get_gpu_metrics_info(dev) + amdsmi_get_gpu_metrics_info(dev) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_od_volt_curve_regions +## amdsmi_get_gpu_od_volt_curve_regions Description: This function will retrieve the current valid regions in the frequency/voltage space Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `num_regions` number of freq volt regions Output: List containing a dictionary with fields for each freq volt region @@ -2183,7 +2104,7 @@ Field | Description `freq_range` |
Subfield Description
`lower_bound`lower bound freq range
`upper_bound`upper bound freq range
`volt_range` |
Subfield Description
`lower_bound`lower bound volt range
`upper_bound`upper bound volt range
-Exceptions that can be thrown by ` amdsmi_dev_get_od_volt_curve_regions` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_od_volt_curve_regions` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2191,21 +2112,21 @@ Exceptions that can be thrown by ` amdsmi_dev_get_od_volt_curve_regions` functio Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_get_od_volt_curve_regions(device, 3) + amdsmi_get_gpu_od_volt_curve_regions(device, 3) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_power_profile_presets +## amdsmi_get_gpu_power_profile_presets Description: Get the list of available preset power profiles and an indication of which profile is currently active Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` number of freq volt regions Output: Dictionary with fields @@ -2216,7 +2137,7 @@ Field | Description `current`| Which power profile is currently active `num_profiles`| How many power profiles are available -Exceptions that can be thrown by ` amdsmi_dev_get_power_profile_presets` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_power_profile_presets` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2224,27 +2145,27 @@ Exceptions that can be thrown by ` amdsmi_dev_get_power_profile_presets` functio Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_get_power_profile_presets(device, 0) + amdsmi_get_gpu_power_profile_presets(device, 0) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_counter_group_supported +## amdsmi_gpu_counter_group_supported Description: Tell if an event group is supported by a given device Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `event_group` event group being checked for support Output: None -Exceptions that can be thrown by `amdsmi_dev_counter_group_supported` function: +Exceptions that can be thrown by `amdsmi_gpu_counter_group_supported` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2252,27 +2173,27 @@ Exceptions that can be thrown by `amdsmi_dev_counter_group_supported` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_counter_group_supported(device, AmdSmiEventGroup.XGMI) + amdsmi_gpu_counter_group_supported(device, AmdSmiEventGroup.XGMI) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_create_counter +## amdsmi_gpu_create_counter Description: Creates a performance counter object Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query * `event_type` event group being checked for support Output: An event handle of the newly created performance counter object -Exceptions that can be thrown by `amdsmi_dev_create_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_create_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2280,16 +2201,16 @@ Exceptions that can be thrown by `amdsmi_dev_create_counter` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - event_handle = amdsmi_dev_create_counter(device, AmdSmiEventGroup.XGMI) + event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventGroup.XGMI) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_destroy_counter +## amdsmi_gpu_destroy_counter Description: Destroys a performance counter object Input parameters: @@ -2298,7 +2219,7 @@ Input parameters: Output: None -Exceptions that can be thrown by `amdsmi_dev_destroy_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_destroy_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2306,17 +2227,17 @@ Exceptions that can be thrown by `amdsmi_dev_destroy_counter` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - event_handle = amdsmi_dev_create_counter(device, AmdSmiEventGroup.XGMI) - amdsmi_dev_destroy_counter(event_handle) + event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventGroup.XGMI) + amdsmi_gpu_destroy_counter(event_handle) except AmdSmiException as e: print(e) ``` -## amdsmi_control_counter +## amdsmi_gpu_control_counter Description: Issue performance counter control commands Input parameters: @@ -2326,7 +2247,7 @@ Input parameters: Output: None -Exceptions that can be thrown by `amdsmi_control_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_control_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2334,17 +2255,17 @@ Exceptions that can be thrown by `amdsmi_control_counter` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - event_handle = amdsmi_dev_create_counter(device, AmdSmiEventType.XGMI_1_REQUEST_TX) - amdsmi_control_counter(event_handle, AmdSmiCounterCommand.CMD_START) + event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventType.XGMI_1_REQUEST_TX) + amdsmi_gpu_control_counter(event_handle, AmdSmiCounterCommand.CMD_START) except AmdSmiException as e: print(e) ``` -## amdsmi_read_counter +## amdsmi_gpu_read_counter Description: Read the current value of a performance counter Input parameters: @@ -2359,7 +2280,7 @@ Field | Description `time_enabled`| Time that the counter was enabled in nanoseconds `time_running`| Time that the counter was running in nanoseconds -Exceptions that can be thrown by `amdsmi_read_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_read_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2367,27 +2288,27 @@ Exceptions that can be thrown by `amdsmi_read_counter` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - event_handle = amdsmi_dev_create_counter(device, AmdSmiEventType.XGMI_1_REQUEST_TX) - amdsmi_read_counter(event_handle) + event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventType.XGMI_1_REQUEST_TX) + amdsmi_gpu_read_counter(event_handle) except AmdSmiException as e: print(e) ``` -## amdsmi_counter_get_available_counters +## amdsmi_get_gpu_available_counters Description: Get the number of currently available counters Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `event_group` event group being checked as AmdSmiEventGroup Output: Number of available counters for the given device of the inputted event group -Exceptions that can be thrown by ` amdsmi_counter_get_available_counters` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_available_counters` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2395,26 +2316,26 @@ Exceptions that can be thrown by ` amdsmi_counter_get_available_counters` functi Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - available_counters = amdsmi_counter_get_available_counters(device, AmdSmiEventGroup.XGMI) + available_counters = amdsmi_get_gpu_available_counters(device, AmdSmiEventGroup.XGMI) print(available_counters) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_perf_level +## amdsmi_set_gpu_perf_level Description: Set a desired performance level for given device Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `perf_level` performance level being set as AmdSmiDevPerfLevel Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_perf_level` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_perf_level` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2422,21 +2343,21 @@ Exceptions that can be thrown by ` amdsmi_dev_set_perf_level` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_perf_level(device, AmdSmiDevPerfLevel.STABLE_PEAK) + amdsmi_set_gpu_perf_level(device, AmdSmiDevPerfLevel.STABLE_PEAK) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_power_profile_presets +## amdsmi_get_gpu_power_profile_presets Description: Get the list of available preset power profiles and an indication of which profile is currently active. Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` sensor index as integer Output: Dictionary with fields @@ -2447,7 +2368,7 @@ Field | Description `current`| Which power profile is currently active `num_profiles`| How many power profiles are available -Exceptions that can be thrown by ` amdsmi_dev_get_power_profile_presets` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_power_profile_presets` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2455,25 +2376,25 @@ Exceptions that can be thrown by ` amdsmi_dev_get_power_profile_presets` functio Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - status = amdsmi_dev_get_power_profile_presets(device, 0) + status = amdsmi_get_gpu_power_profile_presets(device, 0) print(status) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_reset_gpu +## amdsmi_reset_gpu Description: Reset the gpu associated with the device with provided device handle Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: None -Exceptions that can be thrown by `amdsmi_dev_reset_gpu` function: +Exceptions that can be thrown by `amdsmi_reset_gpu` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2481,27 +2402,27 @@ Exceptions that can be thrown by `amdsmi_dev_reset_gpu` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_reset_gpu(device) + amdsmi_reset_gpu(device) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_fan_speed +## amdsmi_set_gpu_fan_speed Description: Set the fan speed for the specified device with the provided speed, in RPMs Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` sensor index as integer * `fan_speed` the speed to which the function will attempt to set the fan Output: None -Exceptions that can be thrown by `amdsmi_dev_set_fan_speed` function: +Exceptions that can be thrown by `amdsmi_set_gpu_fan_speed` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2509,25 +2430,25 @@ Exceptions that can be thrown by `amdsmi_dev_set_fan_speed` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_fan_speed(device, 0, 1333) + amdsmi_set_gpu_fan_speed(device, 0, 1333) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_reset_fan +## amdsmi_reset_gpu_fan Description: Reset the fan to automatic driver control Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `sensor_idx` sensor index as integer Output: None -Exceptions that can be thrown by `amdsmi_dev_reset_fan` function: +Exceptions that can be thrown by `amdsmi_reset_gpu_fan` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2535,21 +2456,21 @@ Exceptions that can be thrown by `amdsmi_dev_reset_fan` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_reset_fan(device, 0) + amdsmi_reset_gpu_fan(device, 0) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_clk_freq +## amdsmi_set_clk_freq Description: Control the set of allowed frequencies that can be used for the specified clock Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `clk_type` the type of clock for which the set of frequencies will be modified as AmdSmiClkType * `freq_bitmask` bitmask indicating the indices of the frequencies that are to @@ -2558,7 +2479,7 @@ bits of this mask are relevant. Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_clk_freq` function: +Exceptions that can be thrown by ` amdsmi_set_clk_freq` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2566,27 +2487,27 @@ Exceptions that can be thrown by ` amdsmi_dev_set_clk_freq` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: freq_bitmask = 0 - amdsmi_dev_set_clk_freq(device, AmdSmiClkType.GFX, freq_bitmask) + amdsmi_set_clk_freq(device, AmdSmiClkType.GFX, freq_bitmask) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_overdrive_level_v1 +## amdsmi_set_gpu_overdrive_level_v1 Description: Set the overdrive percent associated with the device with provided device handle with the provided value Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `overdrive_value` value to which the overdrive level should be set Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_overdrive_level_v1` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_overdrive_level_v1` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2594,26 +2515,26 @@ Exceptions that can be thrown by ` amdsmi_dev_set_overdrive_level_v1` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_overdrive_level_v1(device, 0) + amdsmi_set_gpu_overdrive_level_v1(device, 0) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_set_overdrive_level +## amdsmi_set_gpu_overdrive_level Description: **deprecated** Set the overdrive percent associated with the device with provided device handle with the provided value Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `overdrive_value` value to which the overdrive level should be set Output: None -Exceptions that can be thrown by ` amdsmi_dev_set_overdrive_level` function: +Exceptions that can be thrown by ` amdsmi_set_gpu_overdrive_level` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2621,21 +2542,21 @@ Exceptions that can be thrown by ` amdsmi_dev_set_overdrive_level` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_set_overdrive_level(device, 0) + amdsmi_set_gpu_overdrive_level(device, 0) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_ecc_count +## amdsmi_get_gpu_ecc_count Description: Retrieve the error counts for a GPU block Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `block` The block for which error counts should be retrieved Output: Dict containing information about error counts @@ -2645,7 +2566,7 @@ Field | Description `correctable_count`| Count of correctable errors `uncorrectable_count`| Count of uncorrectable errors -Exceptions that can be thrown by ` amdsmi_dev_get_ecc_count` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_ecc_count` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2653,26 +2574,26 @@ Exceptions that can be thrown by ` amdsmi_dev_get_ecc_count` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - ecc_count = amdsmi_dev_get_ecc_count(device, AmdSmiGpuBlock.UMC) + ecc_count = amdsmi_get_gpu_ecc_count(device, AmdSmiGpuBlock.UMC) print(ecc_count) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_ecc_enabled +## amdsmi_get_gpu_ecc_enabled Description: Retrieve the enabled ECC bit-mask Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: Enabled ECC bit-mask -Exceptions that can be thrown by ` amdsmi_dev_get_ecc_enabled` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_ecc_enabled` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2680,27 +2601,27 @@ Exceptions that can be thrown by ` amdsmi_dev_get_ecc_enabled` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - enabled = amdsmi_dev_get_ecc_enabled(device) + enabled = amdsmi_get_gpu_ecc_enabled(device) print(enabled) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_ecc_status +## amdsmi_get_gpu_ecc_status Description: Retrieve the ECC status for a GPU block Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device * `block` The block for which ECC status should be retrieved Output: ECC status for a requested GPU block -Exceptions that can be thrown by ` amdsmi_dev_get_ecc_status` function: +Exceptions that can be thrown by ` amdsmi_get_gpu_ecc_status` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2708,12 +2629,12 @@ Exceptions that can be thrown by ` amdsmi_dev_get_ecc_status` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - status = amdsmi_dev_get_ecc_status(device, AmdSmiGpuBlock.UMC) + status = amdsmi_get_gpu_ecc_status(device, AmdSmiGpuBlock.UMC) print(status) except AmdSmiException as e: print(e) @@ -2739,7 +2660,7 @@ except AmdSmiException as e: print(e) ``` -## amdsmi_get_compute_process_info +## amdsmi_get_gpu_compute_process_info Description: Get process information about processes currently using GPU Input parameters: None @@ -2754,21 +2675,21 @@ Field | Description `sdma_usage` | SDMA usage in microseconds `cu_occupancy` | Compute Unit usage in percents -Exceptions that can be thrown by `amdsmi_get_compute_process_info` function: +Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_info` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` Example: ```python try: - procs = amdsmi_get_compute_process_info() + procs = amdsmi_get_gpu_compute_process_info() for proc in procs: print(proc) except AmdSmiException as e: print(e) ``` -## amdsmi_get_compute_process_info_by_pid +## amdsmi_get_gpu_compute_process_info_by_pid Description: Get process information about processes currently using GPU Input parameters: @@ -2784,7 +2705,7 @@ Field | Description `sdma_usage` | SDMA usage in microseconds `cu_occupancy` | Compute Unit usage in percents -Exceptions that can be thrown by `amdsmi_get_compute_process_info_by_pid` function: +Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_info_by_pid` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2793,13 +2714,13 @@ Example: ```python try: pid = 0 # << valid pid here - proc = amdsmi_get_compute_process_info_by_pid(pid) + proc = amdsmi_get_gpu_compute_process_info_by_pid(pid) print(proc) except AmdSmiException as e: print(e) ``` -## amdsmi_get_compute_process_gpus +## amdsmi_get_gpu_compute_process_gpus Description: Get the device indices currently being used by a process Input parameters: @@ -2807,7 +2728,7 @@ Input parameters: Output: List of indices of devices currently being used by the process -Exceptions that can be thrown by `amdsmi_get_compute_process_gpus` function: +Exceptions that can be thrown by `amdsmi_get_gpu_compute_process_gpus` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2816,21 +2737,21 @@ Example: ```python try: pid = 0 # << valid pid here - indices = amdsmi_get_compute_process_gpus(pid) + indices = amdsmi_get_gpu_compute_process_gpus(pid) print(indices) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_xgmi_error_status +## amdsmi_gpu_xgmi_error_status Description: Retrieve the XGMI error status for a device Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: XGMI error status for a requested device -Exceptions that can be thrown by `amdsmi_dev_xgmi_error_status` function: +Exceptions that can be thrown by `amdsmi_gpu_xgmi_error_status` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2838,26 +2759,26 @@ Exceptions that can be thrown by `amdsmi_dev_xgmi_error_status` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - status = amdsmi_dev_xgmi_error_status(device) + status = amdsmi_gpu_xgmi_error_status(device) print(status) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_reset_xgmi_error +## amdsmi_reset_gpu_xgmi_error Description: Reset the XGMI error status for a device Input parameters: -* `device_handle` handle for the given device +* `processor_handle` handle for the given device Output: None -Exceptions that can be thrown by `amdsmi_dev_reset_xgmi_error` function: +Exceptions that can be thrown by `amdsmi_reset_gpu_xgmi_error` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2865,25 +2786,25 @@ Exceptions that can be thrown by `amdsmi_dev_reset_xgmi_error` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_reset_xgmi_error(device) + amdsmi_reset_gpu_xgmi_error(device) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_vendor_name +## amdsmi_get_gpu_vendor_name Description: Returns the device vendor name Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: device vendor name -Exceptions that can be thrown by `amdsmi_dev_get_vendor_name` function: +Exceptions that can be thrown by `amdsmi_get_gpu_vendor_name` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2891,27 +2812,27 @@ Exceptions that can be thrown by `amdsmi_dev_get_vendor_name` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - vendor_name = amdsmi_dev_get_vendor_name(device) + vendor_name = amdsmi_get_gpu_vendor_name(device) print(vendor_name) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_id +## amdsmi_get_gpu_id Description: Get the device id associated with the device with provided device handler Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: device id -Exceptions that can be thrown by `amdsmi_dev_get_id` function: +Exceptions that can be thrown by `amdsmi_get_gpu_id` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2919,27 +2840,27 @@ Exceptions that can be thrown by `amdsmi_dev_get_id` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - dev_id = amdsmi_dev_get_id(device) + dev_id = amdsmi_get_gpu_id(device) print(dev_id) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_vram_vendor +## amdsmi_get_gpu_vram_vendor Description: Get the vram vendor string of a gpu device. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: vram vendor -Exceptions that can be thrown by `amdsmi_dev_get_vram_vendor` function: +Exceptions that can be thrown by `amdsmi_get_gpu_vram_vendor` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2947,27 +2868,27 @@ Exceptions that can be thrown by `amdsmi_dev_get_vram_vendor` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - vram_vendor = amdsmi_dev_get_vram_vendor(device) + vram_vendor = amdsmi_get_gpu_vram_vendor(device) print(vram_vendor) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_drm_render_minor +## amdsmi_get_gpu_drm_render_minor Description: Get the drm minor number associated with this device. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: drm minor number -Exceptions that can be thrown by `amdsmi_dev_get_drm_render_minor` function: +Exceptions that can be thrown by `amdsmi_get_gpu_drm_render_minor` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2975,27 +2896,27 @@ Exceptions that can be thrown by `amdsmi_dev_get_drm_render_minor` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - render_minor = amdsmi_dev_get_drm_render_minor(device) + render_minor = amdsmi_get_gpu_drm_render_minor(device) print(render_minor) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_subsystem_id +## amdsmi_get_gpu_subsystem_id Description: Get the subsystem device id associated with the device with provided device handle. Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: subsystem device id -Exceptions that can be thrown by `amdsmi_dev_get_subsystem_id` function: +Exceptions that can be thrown by `amdsmi_get_gpu_subsystem_id` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -3003,28 +2924,28 @@ Exceptions that can be thrown by `amdsmi_dev_get_subsystem_id` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - id = amdsmi_dev_get_subsystem_id(device) + id = amdsmi_get_gpu_subsystem_id(device) print(id) except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_subsystem_name +## amdsmi_get_gpu_subsystem_name Description: Get the name string for the device subsytem Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: device subsytem -Exceptions that can be thrown by `amdsmi_dev_get_subsystem_name` function: +Exceptions that can be thrown by `amdsmi_get_gpu_subsystem_name` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -3032,12 +2953,12 @@ Exceptions that can be thrown by `amdsmi_dev_get_subsystem_name` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: for device in devices: - subsystem_nam = amdsmi_dev_get_subsystem_name(device) + subsystem_nam = amdsmi_get_gpu_subsystem_name(device) print(subsystem_nam) except AmdSmiException as e: print(e) @@ -3057,7 +2978,7 @@ Exceptions that can be thrown by `amdsmi_get_version` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -3086,7 +3007,7 @@ Exceptions that can be thrown by `amdsmi_get_version_str` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -3103,7 +3024,7 @@ Description: Retrieve the NUMA CPU node number for a device Input parameters: -* `device_handle` device which to query +* `processor_handle` device which to query Output: node number of NUMA CPU for the device @@ -3115,7 +3036,7 @@ Exceptions that can be thrown by `amdsmi_topo_get_numa_node_number` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: @@ -3131,8 +3052,8 @@ Description: Retrieve the weight for a connection between 2 GPUs. Input parameters: -* `device_handle_src` the source device handle -* `device_handle_dest` the destination device handle +* `processor_handle_src` the source device handle +* `processor_handle_dest` the destination device handle Output: the weight for a connection between 2 GPUs @@ -3144,13 +3065,13 @@ Exceptions that can be thrown by `amdsmi_topo_get_link_weight` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: - device_handle_src = devices[0] - device_handle_dest = devices[1] - weight = amdsmi_topo_get_link_weight(device_handle_src, device_handle_dest) + processor_handle_src = devices[0] + processor_handle_dest = devices[1] + weight = amdsmi_topo_get_link_weight(processor_handle_src, processor_handle_dest) print(weight) except AmdSmiException as e: print(e) @@ -3162,8 +3083,8 @@ Description: Retreive minimal and maximal io link bandwidth between 2 GPUs. Input parameters: -* `device_handle_src` the source device handle -* `device_handle_dest` the destination device handle +* `processor_handle_src` the source device handle +* `processor_handle_dest` the destination device handle Output: Dictionary with fields: @@ -3180,13 +3101,13 @@ Exceptions that can be thrown by ` amdsmi_get_minmax_bandwidth` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: - device_handle_src = devices[0] - device_handle_dest = devices[1] - bandwith = amdsmi_get_minmax_bandwidth(device_handle_src, device_handle_dest) + processor_handle_src = devices[0] + processor_handle_dest = devices[1] + bandwith = amdsmi_get_minmax_bandwidth(processor_handle_src, processor_handle_dest) print(bandwith['min_bandwidth']) print(bandwith['max_bandwidth']) except AmdSmiException as e: @@ -3199,8 +3120,8 @@ Description: Retrieve the hops and the connection type between 2 GPUs Input parameters: -* `device_handle_src` the source device handle -* `device_handle_dest` the destination device handle +* `processor_handle_src` the source device handle +* `processor_handle_dest` the destination device handle Output: Dictionary with fields: @@ -3217,13 +3138,13 @@ Exceptions that can be thrown by `amdsmi_topo_get_link_type` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: - device_handle_src = devices[0] - device_handle_dest = devices[1] - link_type = amdsmi_topo_get_link_type(device_handle_src, device_handle_dest) + processor_handle_src = devices[0] + processor_handle_dest = devices[1] + link_type = amdsmi_topo_get_link_type(processor_handle_src, processor_handle_dest) print(link_type['hops']) print(link_type['type']) except AmdSmiException as e: @@ -3236,8 +3157,8 @@ Description: Return P2P availability status between 2 GPUs Input parameters: -* `device_handle_src` the source device handle -* `device_handle_dest` the destination device handle +* `processor_handle_src` the source device handle +* `processor_handle_dest` the destination device handle Output: P2P availability status between 2 GPUs @@ -3249,13 +3170,13 @@ Exceptions that can be thrown by `amdsmi_is_P2P_accessible` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: - device_handle_src = devices[0] - device_handle_dest = devices[1] - accessible = amdsmi_is_P2P_accessible(device_handle_src, device_handle_dest) + processor_handle_src = devices[0] + processor_handle_dest = devices[1] + accessible = amdsmi_is_P2P_accessible(processor_handle_src, processor_handle_dest) print(accessible) except AmdSmiException as e: print(e) @@ -3267,7 +3188,7 @@ Description: Returns XGMI information for the GPU. Input parameters: -* `device_handle` device handle +* `processor_handle` device handle Output: Dictionary with fields: @@ -3287,7 +3208,7 @@ Exceptions that can be thrown by `amdsmi_get_xgmi_info` function: Example: ```python try: - devices = amdsmi_get_device_handles() + devices = amdsmi_get_processor_handles() if len(devices) == 0: print("No GPUs on machine") else: diff --git a/projects/amdsmi/py-interface/__init__.py b/projects/amdsmi/py-interface/__init__.py index d95f571307..ef7732c84e 100644 --- a/projects/amdsmi/py-interface/__init__.py +++ b/projects/amdsmi/py-interface/__init__.py @@ -24,145 +24,143 @@ from .amdsmi_interface import amdsmi_init from .amdsmi_interface import amdsmi_shut_down # Device Descovery -from .amdsmi_interface import amdsmi_get_device_type -from .amdsmi_interface import amdsmi_get_device_handles +from .amdsmi_interface import amdsmi_get_processor_type +from .amdsmi_interface import amdsmi_get_processor_handles from .amdsmi_interface import amdsmi_get_socket_handles from .amdsmi_interface import amdsmi_get_socket_info -from .amdsmi_interface import amdsmi_get_device_bdf -from .amdsmi_interface import amdsmi_get_device_uuid -from .amdsmi_interface import amdsmi_get_device_handle_from_bdf +from .amdsmi_interface import amdsmi_get_gpu_device_bdf +from .amdsmi_interface import amdsmi_get_gpu_device_uuid +from .amdsmi_interface import amdsmi_get_processor_handle_from_bdf # # SW Version Information -from .amdsmi_interface import amdsmi_get_driver_version +from .amdsmi_interface import amdsmi_get_gpu_driver_version # # ASIC and Bus Static Information -from .amdsmi_interface import amdsmi_get_asic_info +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_vbios_info +from .amdsmi_interface import amdsmi_get_gpu_vbios_info from .amdsmi_interface import amdsmi_get_fw_info # # GPU Monitoring from .amdsmi_interface import amdsmi_get_gpu_activity -from .amdsmi_interface import amdsmi_get_vram_usage -from .amdsmi_interface import amdsmi_get_power_measure -from .amdsmi_interface import amdsmi_get_clock_measure +from .amdsmi_interface import amdsmi_get_gpu_vram_usage +from .amdsmi_interface import amdsmi_get_power_info +from .amdsmi_interface import amdsmi_get_clock_info from .amdsmi_interface import amdsmi_get_pcie_link_status from .amdsmi_interface import amdsmi_get_pcie_link_caps -from .amdsmi_interface import amdsmi_get_bad_page_info +from .amdsmi_interface import amdsmi_get_gpu_bad_page_info # # Power Management -from .amdsmi_interface import amdsmi_get_target_frequency_range +from .amdsmi_interface import amdsmi_get_gpu_target_frequency_range # # Process Information -from .amdsmi_interface import amdsmi_get_process_list -from .amdsmi_interface import amdsmi_get_process_info +from .amdsmi_interface import amdsmi_get_gpu_process_list +from .amdsmi_interface import amdsmi_get_gpu_process_info # # ECC Error Information -from .amdsmi_interface import amdsmi_get_ecc_error_count +from .amdsmi_interface import amdsmi_get_gpu_ecc_error_count # # Board Information -from .amdsmi_interface import amdsmi_get_board_info +from .amdsmi_interface import amdsmi_get_gpu_board_info # # Ras Information -from .amdsmi_interface import amdsmi_get_ras_block_features_enabled +from .amdsmi_interface import amdsmi_get_gpu_ras_block_features_enabled # # Supported Function Checks -from .amdsmi_interface import amdsmi_dev_open_supported_func_iterator -from .amdsmi_interface import amdsmi_dev_open_supported_variant_iterator -from .amdsmi_interface import amdsmi_dev_close_supported_func_iterator +from .amdsmi_interface import amdsmi_open_supported_func_iterator +from .amdsmi_interface import amdsmi_open_supported_variant_iterator +from .amdsmi_interface import amdsmi_close_supported_func_iterator from .amdsmi_interface import amdsmi_next_func_iter from .amdsmi_interface import amdsmi_get_func_iter_value # # Unsupported Functions In Virtual Environment -from .amdsmi_interface import amdsmi_dev_set_pci_bandwidth -from .amdsmi_interface import amdsmi_dev_set_power_cap -from .amdsmi_interface import amdsmi_dev_set_power_profile -from .amdsmi_interface import amdsmi_dev_set_clk_range -from .amdsmi_interface import amdsmi_dev_set_od_clk_info -from .amdsmi_interface import amdsmi_dev_set_od_volt_info -from .amdsmi_interface import amdsmi_dev_set_perf_level_v1 -from .amdsmi_interface import amdsmi_dev_set_perf_level -from .amdsmi_interface import amdsmi_dev_get_power_profile_presets -from .amdsmi_interface import amdsmi_dev_reset_gpu -from .amdsmi_interface import amdsmi_set_perf_determinism_mode -from .amdsmi_interface import amdsmi_dev_set_fan_speed -from .amdsmi_interface import amdsmi_dev_reset_fan -from .amdsmi_interface import amdsmi_dev_set_clk_freq -from .amdsmi_interface import amdsmi_dev_set_overdrive_level_v1 -from .amdsmi_interface import amdsmi_dev_set_overdrive_level +from .amdsmi_interface import amdsmi_set_gpu_pci_bandwidth +from .amdsmi_interface import amdsmi_set_power_cap +from .amdsmi_interface import amdsmi_set_gpu_power_profile +from .amdsmi_interface import amdsmi_set_gpu_clk_range +from .amdsmi_interface import amdsmi_set_gpu_od_clk_info +from .amdsmi_interface import amdsmi_set_gpu_od_volt_info +from .amdsmi_interface import amdsmi_set_gpu_perf_level_v1 +from .amdsmi_interface import amdsmi_set_gpu_perf_level +from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets +from .amdsmi_interface import amdsmi_reset_gpu +from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode +from .amdsmi_interface import amdsmi_set_gpu_fan_speed +from .amdsmi_interface import amdsmi_reset_gpu_fan +from .amdsmi_interface import amdsmi_set_clk_freq +from .amdsmi_interface import amdsmi_set_gpu_overdrive_level_v1 +from .amdsmi_interface import amdsmi_set_gpu_overdrive_level # # Physical State Queries -from .amdsmi_interface import amdsmi_dev_get_fan_rpms -from .amdsmi_interface import amdsmi_dev_get_fan_speed -from .amdsmi_interface import amdsmi_dev_get_fan_speed_max -from .amdsmi_interface import amdsmi_dev_get_temp_metric -from .amdsmi_interface import amdsmi_dev_get_volt_metric +from .amdsmi_interface import amdsmi_get_gpu_fan_rpms +from .amdsmi_interface import amdsmi_get_gpu_fan_speed +from .amdsmi_interface import amdsmi_get_gpu_fan_speed_max +from .amdsmi_interface import amdsmi_get_temp_metric +from .amdsmi_interface import amdsmi_get_gpu_volt_metric # # Clock, Power and Performance Query -from .amdsmi_interface import amdsmi_dev_get_busy_percent +from .amdsmi_interface import amdsmi_get_busy_percent from .amdsmi_interface import amdsmi_get_utilization_count -from .amdsmi_interface import amdsmi_dev_get_perf_level -from .amdsmi_interface import amdsmi_set_perf_determinism_mode -from .amdsmi_interface import amdsmi_dev_get_overdrive_level -from .amdsmi_interface import amdsmi_dev_get_gpu_clk_freq -from .amdsmi_interface import amdsmi_dev_get_od_volt_info -from .amdsmi_interface import amdsmi_dev_get_gpu_metrics_info -from .amdsmi_interface import amdsmi_dev_get_od_volt_curve_regions -from .amdsmi_interface import amdsmi_dev_get_power_profile_presets +from .amdsmi_interface import amdsmi_get_gpu_perf_level +from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode +from .amdsmi_interface import amdsmi_get_gpu_overdrive_level +from .amdsmi_interface import amdsmi_get_clk_freq +from .amdsmi_interface import amdsmi_get_gpu_od_volt_info +from .amdsmi_interface import amdsmi_get_gpu_metrics_info +from .amdsmi_interface import amdsmi_get_gpu_od_volt_curve_regions +from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets # # Performance Counters -from .amdsmi_interface import amdsmi_dev_counter_group_supported -from .amdsmi_interface import amdsmi_dev_create_counter -from .amdsmi_interface import amdsmi_dev_destroy_counter -from .amdsmi_interface import amdsmi_control_counter -from .amdsmi_interface import amdsmi_read_counter -from .amdsmi_interface import amdsmi_counter_get_available_counters +from .amdsmi_interface import amdsmi_gpu_counter_group_supported +from .amdsmi_interface import amdsmi_gpu_create_counter +from .amdsmi_interface import amdsmi_gpu_destroy_counter +from .amdsmi_interface import amdsmi_gpu_control_counter +from .amdsmi_interface import amdsmi_gpu_read_counter +from .amdsmi_interface import amdsmi_get_gpu_available_counters # # Error Query -from .amdsmi_interface import amdsmi_dev_get_ecc_count -from .amdsmi_interface import amdsmi_dev_get_ecc_enabled -from .amdsmi_interface import amdsmi_dev_get_ecc_status +from .amdsmi_interface import amdsmi_get_gpu_ecc_count +from .amdsmi_interface import amdsmi_get_gpu_ecc_enabled +from .amdsmi_interface import amdsmi_get_gpu_ecc_status from .amdsmi_interface import amdsmi_status_string # # System Information Query -from .amdsmi_interface import amdsmi_get_compute_process_info -from .amdsmi_interface import amdsmi_get_compute_process_info_by_pid -from .amdsmi_interface import amdsmi_get_compute_process_gpus -from .amdsmi_interface import amdsmi_dev_xgmi_error_status -from .amdsmi_interface import amdsmi_dev_reset_xgmi_error +from .amdsmi_interface import amdsmi_get_gpu_compute_process_info +from .amdsmi_interface import amdsmi_get_gpu_compute_process_info_by_pid +from .amdsmi_interface import amdsmi_get_gpu_compute_process_gpus +from .amdsmi_interface import amdsmi_gpu_xgmi_error_status +from .amdsmi_interface import amdsmi_reset_gpu_xgmi_error # # PCIE information -from .amdsmi_interface import amdsmi_dev_get_pci_id -from .amdsmi_interface import amdsmi_dev_get_pci_bandwidth -from .amdsmi_interface import amdsmi_dev_get_pci_throughput -from .amdsmi_interface import amdsmi_dev_get_pci_replay_counter -from .amdsmi_interface import amdsmi_topo_get_numa_affinity +from .amdsmi_interface import amdsmi_get_gpu_pci_id +from .amdsmi_interface import amdsmi_get_gpu_pci_bandwidth +from .amdsmi_interface import amdsmi_get_gpu_pci_throughput +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_dev_get_power_ave -from .amdsmi_interface import amdsmi_dev_get_energy_count +from .amdsmi_interface import amdsmi_get_energy_count # # Memory information -from .amdsmi_interface import amdsmi_dev_get_memory_total -from .amdsmi_interface import amdsmi_dev_get_memory_usage -from .amdsmi_interface import amdsmi_dev_get_memory_busy_percent -from .amdsmi_interface import amdsmi_dev_get_memory_reserved_pages +from .amdsmi_interface import amdsmi_get_gpu_memory_total +from .amdsmi_interface import amdsmi_get_gpu_memory_usage +from .amdsmi_interface import amdsmi_get_gpu_memory_busy_percent +from .amdsmi_interface import amdsmi_get_gpu_memory_reserved_pages # # Events from .amdsmi_interface import AmdSmiEventReader # # Device Identification information -from .amdsmi_interface import amdsmi_dev_get_vendor_name -from .amdsmi_interface import amdsmi_dev_get_id -from .amdsmi_interface import amdsmi_dev_get_vram_vendor -from .amdsmi_interface import amdsmi_dev_get_drm_render_minor -from .amdsmi_interface import amdsmi_dev_get_subsystem_id -from .amdsmi_interface import amdsmi_dev_get_subsystem_name +from .amdsmi_interface import amdsmi_get_gpu_vendor_name +from .amdsmi_interface import amdsmi_get_gpu_id +from .amdsmi_interface import amdsmi_get_gpu_vram_vendor +from .amdsmi_interface import amdsmi_get_gpu_drm_render_minor +from .amdsmi_interface import amdsmi_get_gpu_subsystem_id +from .amdsmi_interface import amdsmi_get_gpu_subsystem_name # # Version information from .amdsmi_interface import amdsmi_get_version @@ -171,7 +169,7 @@ from .amdsmi_interface import amdsmi_get_version_str # # Hardware topology query from .amdsmi_interface import amdsmi_topo_get_numa_node_number from .amdsmi_interface import amdsmi_topo_get_link_weight -from .amdsmi_interface import amdsmi_get_minmax_bandwidth +from .amdsmi_interface import amdsmi_get_minmax_bandwidth from .amdsmi_interface import amdsmi_topo_get_link_type from .amdsmi_interface import amdsmi_is_P2P_accessible from .amdsmi_interface import amdsmi_get_xgmi_info diff --git a/projects/amdsmi/py-interface/amdsmi_interface.py b/projects/amdsmi/py-interface/amdsmi_interface.py index 0e93d31111..cafe277edb 100644 --- a/projects/amdsmi/py-interface/amdsmi_interface.py +++ b/projects/amdsmi/py-interface/amdsmi_interface.py @@ -293,11 +293,11 @@ class AmdSmiUtilizationCounterType(IntEnum): class AmdSmiEventReader: def __init__( - self, device_handle: amdsmi_wrapper.amdsmi_device_handle, *event_types + self, processor_handle: amdsmi_wrapper.amdsmi_processor_handle, *event_types ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(event_types, Iterable): raise AmdSmiParameterException( @@ -310,20 +310,20 @@ class AmdSmiEventReader: event_type, AmdSmiEvtNotificationType ) - self.device_handle = device_handle + self.processor_handle = processor_handle mask = 0 for event_type in event_types: mask |= (1 << (int(event_type) - 1)) - _check_res(amdsmi_wrapper.amdsmi_init_event_notification(device_handle)) - _check_res(amdsmi_wrapper. amdsmi_set_event_notification_mask( - device_handle, ctypes.c_uint64(mask))) + _check_res(amdsmi_wrapper.amdsmi_init_gpu_event_notification(processor_handle)) + _check_res(amdsmi_wrapper. amdsmi_set_gpu_event_notification_mask( + processor_handle, ctypes.c_uint64(mask))) def read(self, timestamp, num_elem=10): self.event_info = ( amdsmi_wrapper.amdsmi_evt_notification_data_t * num_elem)() _check_res( - amdsmi_wrapper. amdsmi_get_event_notification( + amdsmi_wrapper. amdsmi_get_gpu_event_notification( ctypes.c_int(timestamp), ctypes.byref(ctypes.c_uint32(num_elem)), self.event_info, @@ -337,7 +337,7 @@ class AmdSmiEventReader: ): ret.append( { - "device_handle": self.event_info[i].device_handle, + "processor_handle": self.event_info[i].processor_handle, "event": AmdSmiEvtNotificationType( self.event_info[i].event ).name, @@ -348,8 +348,8 @@ class AmdSmiEventReader: return ret def stop(self): - _check_res(amdsmi_wrapper.amdsmi_stop_event_notification( - self.device_handle)) + _check_res(amdsmi_wrapper.amdsmi_stop_gpu_event_notification( + self.processor_handle)) def __enter__(self): return self @@ -508,31 +508,31 @@ def amdsmi_get_socket_info(socket_handle): return socket_info.value.decode() -def amdsmi_get_device_handles() -> List[amdsmi_wrapper.amdsmi_device_handle]: +def amdsmi_get_processor_handles() -> List[amdsmi_wrapper.amdsmi_processor_handle]: socket_handles = amdsmi_get_socket_handles() devices = [] for socket in socket_handles: device_count = ctypes.c_uint32() - null_ptr = ctypes.POINTER(amdsmi_wrapper.amdsmi_device_handle)() + null_ptr = ctypes.POINTER(amdsmi_wrapper.amdsmi_processor_handle)() _check_res( - amdsmi_wrapper.amdsmi_get_device_handles( + amdsmi_wrapper.amdsmi_get_processor_handles( socket, ctypes.byref(device_count), null_ptr, ) ) - device_handles = ( - amdsmi_wrapper.amdsmi_device_handle * device_count.value)() + processor_handles = ( + amdsmi_wrapper.amdsmi_processor_handle * device_count.value)() _check_res( - amdsmi_wrapper.amdsmi_get_device_handles( + amdsmi_wrapper.amdsmi_get_processor_handles( socket, ctypes.byref(device_count), - device_handles, + processor_handles, ) ) devices.extend( [ - amdsmi_wrapper.amdsmi_device_handle(device_handles[dev_idx]) + amdsmi_wrapper.amdsmi_processor_handle(processor_handles[dev_idx]) for dev_idx in range(device_count.value) ] ) @@ -550,54 +550,53 @@ def amdsmi_shut_down(): _check_res(amdsmi_wrapper.amdsmi_shut_down()) -def amdsmi_get_device_type( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_processor_type( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> ctypes.c_uint32: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) - dev_type = amdsmi_wrapper.device_type_t() + dev_type = amdsmi_wrapper.processor_type_t() _check_res( - amdsmi_wrapper.amdsmi_get_device_type( - device_handle, ctypes.byref(dev_type)) + amdsmi_wrapper.amdsmi_get_processor_type( + processor_handle, ctypes.byref(dev_type)) ) return dev_type.value -def amdsmi_get_device_bdf(device_handle: amdsmi_wrapper.amdsmi_device_handle) -> str: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_device_bdf(processor_handle: amdsmi_wrapper.amdsmi_processor_handle) -> str: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) bdf_info = amdsmi_wrapper.amdsmi_bdf_t() _check_res( - amdsmi_wrapper.amdsmi_get_device_bdf( - device_handle, ctypes.byref(bdf_info)) + amdsmi_wrapper.amdsmi_get_gpu_device_bdf( + processor_handle, ctypes.byref(bdf_info)) ) return _format_bdf(bdf_info) -def amdsmi_get_asic_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_asic_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) asic_info = amdsmi_wrapper.amdsmi_asic_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_asic_info( - device_handle, ctypes.byref(asic_info)) + amdsmi_wrapper.amdsmi_get_gpu_asic_info( + processor_handle, ctypes.byref(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, @@ -606,17 +605,17 @@ def amdsmi_get_asic_info( def amdsmi_get_power_cap_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) power_info = amdsmi_wrapper.amdsmi_power_cap_info_t() _check_res( amdsmi_wrapper.amdsmi_get_power_cap_info( - device_handle, ctypes.c_uint32(0), ctypes.byref(power_info) + processor_handle, ctypes.c_uint32(0), ctypes.byref(power_info) ) ) @@ -626,93 +625,66 @@ 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( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + +def amdsmi_get_gpu_vbios_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle - ) - - gpu_caps = amdsmi_wrapper.amdsmi_gpu_caps_t() - _check_res( - amdsmi_wrapper.amdsmi_get_caps_info( - device_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_vbios_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, -) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): - raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) vbios_info = amdsmi_wrapper.amdsmi_vbios_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_vbios_info( - device_handle, ctypes.byref(vbios_info)) + amdsmi_wrapper.amdsmi_get_gpu_vbios_info( + processor_handle, ctypes.byref(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, } def amdsmi_get_gpu_activity( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) engine_usage = amdsmi_wrapper.amdsmi_engine_usage_t() _check_res( amdsmi_wrapper.amdsmi_get_gpu_activity( - device_handle, ctypes.byref(engine_usage) + processor_handle, ctypes.byref(engine_usage) ) ) 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, } -def amdsmi_get_clock_measure( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_clock_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clock_type: amdsmi_wrapper.amdsmi_clk_type_t, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(clock_type, AmdSmiClkType): raise AmdSmiParameterException(clock_type, AmdSmiClkType) - clock_measure = amdsmi_wrapper.amdsmi_clk_measure_t() + clock_measure = amdsmi_wrapper.amdsmi_clk_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_clock_measure( - device_handle, + amdsmi_wrapper.amdsmi_get_clock_info( + processor_handle, amdsmi_wrapper.amdsmi_clk_type_t(clock_type), ctypes.byref(clock_measure), ) @@ -720,26 +692,25 @@ def amdsmi_get_clock_measure( 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, } -def amdsmi_get_bad_page_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_bad_page_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Union[list, str]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) num_pages = ctypes.c_uint32() retired_page_record = ctypes.POINTER( amdsmi_wrapper.amdsmi_retired_page_record_t)() _check_res( - amdsmi_wrapper.amdsmi_get_bad_page_info( - device_handle, ctypes.byref(num_pages), retired_page_record + amdsmi_wrapper.amdsmi_get_gpu_bad_page_info( + processor_handle, ctypes.byref(num_pages), retired_page_record ) ) table_records = _format_bad_page_info(retired_page_record, num_pages) @@ -751,21 +722,21 @@ def amdsmi_get_bad_page_info( return table_records -def amdsmi_get_target_frequency_range( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_target_frequency_range( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clock_type: amdsmi_wrapper.amdsmi_clk_type_t, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(clock_type, AmdSmiClkType): raise AmdSmiParameterException(clock_type, AmdSmiClkType) freq_range = amdsmi_wrapper.amdsmi_frequency_range_t() _check_res( - amdsmi_wrapper.amdsmi_get_target_frequency_range( - device_handle, + amdsmi_wrapper.amdsmi_get_gpu_target_frequency_range( + processor_handle, amdsmi_wrapper.amdsmi_clk_type_t(clock_type), ctypes.byref(freq_range), ) @@ -779,18 +750,18 @@ def amdsmi_get_target_frequency_range( } -def amdsmi_get_ecc_error_count( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_ecc_error_count( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) error_count = amdsmi_wrapper.amdsmi_error_count_t() _check_res( - amdsmi_wrapper.amdsmi_get_ecc_error_count( - device_handle, ctypes.byref(error_count) + amdsmi_wrapper.amdsmi_get_gpu_ecc_error_count( + processor_handle, ctypes.byref(error_count) ) ) @@ -800,45 +771,47 @@ def amdsmi_get_ecc_error_count( } -def amdsmi_get_board_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_board_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) board_info = amdsmi_wrapper.amdsmi_board_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_board_info( - device_handle, ctypes.byref(board_info)) + amdsmi_wrapper.amdsmi_get_gpu_board_info( + processor_handle, ctypes.byref(board_info)) ) return { "serial_number": board_info.serial_number, + "model_number": board_info.model_number.decode("utf-8"), "product_serial": board_info.product_serial.decode("utf-8"), "product_name": board_info.product_name.decode("utf-8"), + "manufacturer_name" : board_info.product_name.decode("utf-8") } -def amdsmi_get_ras_block_features_enabled( - device_handle: amdsmi_wrapper.amdsmi_device_handle, -) -> List[Dict[str, str]]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_ras_block_features_enabled( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> Dict[str, Any]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) ras_state = amdsmi_wrapper.amdsmi_ras_err_state_t() ras_states = [] for gpu_block in AmdSmiGpuBlock: - if gpu_block.name == "RESERVED": + if gpu_block.name == "RESERVED" or gpu_block.name == "INVALID": continue if gpu_block.name == "LAST": gpu_block.name = "FUSE" _check_res( - amdsmi_wrapper.amdsmi_get_ras_block_features_enabled( - device_handle, + amdsmi_wrapper.amdsmi_get_gpu_ras_block_features_enabled( + processor_handle, amdsmi_wrapper.amdsmi_gpu_block_t(gpu_block.value), ctypes.byref(ras_state), ) @@ -853,41 +826,41 @@ def amdsmi_get_ras_block_features_enabled( return ras_states -def amdsmi_get_process_list( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_process_list( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> List[amdsmi_wrapper.amdsmi_process_handle]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) max_processes = ctypes.c_uint32(0) process_list = (amdsmi_wrapper.amdsmi_process_handle * max_processes.value)() _check_res( - amdsmi_wrapper.amdsmi_get_process_list( - device_handle, process_list, ctypes.byref(max_processes) + amdsmi_wrapper.amdsmi_get_gpu_process_list( + processor_handle, process_list, ctypes.byref(max_processes) ) ) process_list = (amdsmi_wrapper.amdsmi_process_handle * max_processes.value)() _check_res( - amdsmi_wrapper.amdsmi_get_process_list( - device_handle, process_list, ctypes.byref(max_processes) + amdsmi_wrapper.amdsmi_get_gpu_process_list( + processor_handle, process_list, ctypes.byref(max_processes) ) ) return [amdsmi_wrapper.amdsmi_process_handle(x) for x in list(process_list)] -def amdsmi_get_process_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_process_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, process: amdsmi_wrapper.amdsmi_process_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(process, amdsmi_wrapper.amdsmi_process_handle): @@ -896,8 +869,8 @@ def amdsmi_get_process_info( info = amdsmi_wrapper.amdsmi_proc_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_process_info( - device_handle, process, ctypes.byref(info) + amdsmi_wrapper.amdsmi_get_gpu_process_info( + processor_handle, process, ctypes.byref(info) ) ) @@ -907,10 +880,7 @@ def amdsmi_get_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, @@ -920,10 +890,10 @@ def amdsmi_get_process_info( } -def amdsmi_get_device_uuid(device_handle: amdsmi_wrapper.amdsmi_device_handle) -> str: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_device_uuid(processor_handle: amdsmi_wrapper.amdsmi_processor_handle) -> str: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) uuid = ctypes.create_string_buffer(_AMDSMI_GPU_UUID_SIZE) @@ -932,20 +902,20 @@ def amdsmi_get_device_uuid(device_handle: amdsmi_wrapper.amdsmi_device_handle) - uuid_length.value = _AMDSMI_GPU_UUID_SIZE _check_res( - amdsmi_wrapper.amdsmi_get_device_uuid( - device_handle, ctypes.byref(uuid_length), uuid + amdsmi_wrapper.amdsmi_get_gpu_device_uuid( + processor_handle, ctypes.byref(uuid_length), uuid ) ) return uuid.value.decode("utf-8") -def amdsmi_get_driver_version( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_driver_version( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> str: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) length = ctypes.c_int() @@ -954,46 +924,45 @@ def amdsmi_get_driver_version( version = ctypes.create_string_buffer(_AMDSMI_MAX_DRIVER_VERSION_LENGTH) _check_res( - amdsmi_wrapper.amdsmi_get_driver_version( - device_handle, ctypes.byref(length), version + amdsmi_wrapper.amdsmi_get_gpu_driver_version( + processor_handle, ctypes.byref(length), version ) ) return version.value.decode("utf-8") -def amdsmi_get_power_measure( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_power_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) - power_measure = amdsmi_wrapper.amdsmi_power_measure_t() + power_measure = amdsmi_wrapper.amdsmi_power_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_power_measure( - device_handle, ctypes.byref(power_measure) + amdsmi_wrapper.amdsmi_get_power_info( + processor_handle, ctypes.byref(power_measure) ) ) return { "average_socket_power": power_measure.average_socket_power, - "voltage_gfx": power_measure.voltage_gfx, - "energy_accumulator": power_measure.energy_accumulator, + "gfx_voltage": power_measure.gfx_voltage, "power_limit" : power_measure.power_limit, } def amdsmi_get_fw_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle + processor_handle: amdsmi_wrapper.amdsmi_processor_handle ) -> List[Dict[str, Any]]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle) + processor_handle, amdsmi_wrapper.amdsmi_processor_handle) fw_info = amdsmi_wrapper.amdsmi_fw_info_t() _check_res(amdsmi_wrapper.amdsmi_get_fw_info( - device_handle, ctypes.byref(fw_info))) + processor_handle, ctypes.byref(fw_info))) firmwares = list() for i in range(0, fw_info.num_fw_info): firmwares.append({ @@ -1005,35 +974,35 @@ def amdsmi_get_fw_info( } -def amdsmi_get_vram_usage( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_vram_usage( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) vram_info = amdsmi_wrapper.amdsmi_vram_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_vram_usage( - device_handle, ctypes.byref(vram_info)) + amdsmi_wrapper.amdsmi_get_gpu_vram_usage( + processor_handle, ctypes.byref(vram_info)) ) return {"vram_total": vram_info.vram_total, "vram_used": vram_info.vram_used} def amdsmi_get_pcie_link_status( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) pcie_info = amdsmi_wrapper.amdsmi_pcie_info_t() _check_res( amdsmi_wrapper.amdsmi_get_pcie_link_status( - device_handle, ctypes.byref(pcie_info) + processor_handle, ctypes.byref(pcie_info) ) ) @@ -1041,39 +1010,39 @@ def amdsmi_get_pcie_link_status( def amdsmi_get_pcie_link_caps( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) pcie_info = amdsmi_wrapper.amdsmi_pcie_info_t() _check_res( amdsmi_wrapper.amdsmi_get_pcie_link_caps( - device_handle, ctypes.byref(pcie_info)) + processor_handle, ctypes.byref(pcie_info)) ) return {"pcie_lanes": pcie_info.pcie_lanes, "pcie_speed": pcie_info.pcie_speed} -def amdsmi_get_device_handle_from_bdf(bdf): +def amdsmi_get_processor_handle_from_bdf(bdf): bdf = _parse_bdf(bdf) if bdf is None: raise AmdSmiBdfFormatException(bdf) amdsmi_bdf = _make_amdsmi_bdf_from_list(bdf) - device_handle = amdsmi_wrapper.amdsmi_device_handle() - _check_res(amdsmi_wrapper.amdsmi_get_device_handle_from_bdf( - amdsmi_bdf, ctypes.byref(device_handle))) - return device_handle + processor_handle = amdsmi_wrapper.amdsmi_processor_handle() + _check_res(amdsmi_wrapper.amdsmi_get_processor_handle_from_bdf( + amdsmi_bdf, ctypes.byref(processor_handle))) + return processor_handle -def amdsmi_dev_get_vendor_name( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_vendor_name( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> str: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) length = ctypes.c_uint64() @@ -1082,30 +1051,30 @@ def amdsmi_dev_get_vendor_name( vendor_name = ctypes.create_string_buffer(_AMDSMI_STRING_LENGTH) _check_res( - amdsmi_wrapper.amdsmi_dev_get_vendor_name( - device_handle, vendor_name, length) + amdsmi_wrapper.amdsmi_get_gpu_vendor_name( + processor_handle, vendor_name, length) ) return vendor_name.value.decode("utf-8") -def amdsmi_dev_get_id(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_id(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) id = ctypes.c_uint16() - _check_res(amdsmi_wrapper.amdsmi_dev_get_id( - device_handle, ctypes.byref(id))) + _check_res(amdsmi_wrapper.amdsmi_get_gpu_id( + processor_handle, ctypes.byref(id))) return id.value -def amdsmi_dev_get_vram_vendor(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_vram_vendor(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) length = ctypes.c_uint32() @@ -1114,48 +1083,48 @@ def amdsmi_dev_get_vram_vendor(device_handle: amdsmi_wrapper.amdsmi_device_handl vram_vendor = ctypes.create_string_buffer(_AMDSMI_STRING_LENGTH) _check_res( - amdsmi_wrapper.amdsmi_dev_get_vram_vendor( - device_handle, vram_vendor, length) + amdsmi_wrapper.amdsmi_get_gpu_vram_vendor( + processor_handle, vram_vendor, length) ) return vram_vendor.value.decode("utf-8") -def amdsmi_dev_get_drm_render_minor(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_drm_render_minor(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) minor = ctypes.c_uint32() _check_res( - amdsmi_wrapper.amdsmi_dev_get_drm_render_minor( - device_handle, ctypes.byref(minor) + amdsmi_wrapper.amdsmi_get_gpu_drm_render_minor( + processor_handle, ctypes.byref(minor) ) ) return minor.value -def amdsmi_dev_get_subsystem_id(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_subsystem_id(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) id = ctypes.c_uint16() _check_res( - amdsmi_wrapper.amdsmi_dev_get_subsystem_id( - device_handle, ctypes.byref(id)) + amdsmi_wrapper.amdsmi_get_gpu_subsystem_id( + processor_handle, ctypes.byref(id)) ) return id.value -def amdsmi_dev_get_subsystem_name(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_subsystem_name(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) length = ctypes.c_uint64() @@ -1164,8 +1133,8 @@ def amdsmi_dev_get_subsystem_name(device_handle: amdsmi_wrapper.amdsmi_device_ha name = ctypes.create_string_buffer(_AMDSMI_STRING_LENGTH) _check_res( - amdsmi_wrapper.amdsmi_dev_get_subsystem_name( - device_handle, name, length) + amdsmi_wrapper.amdsmi_get_gpu_subsystem_name( + processor_handle, name, length) ) return name.value.decode("utf-8") @@ -1200,18 +1169,18 @@ def amdsmi_get_version_str(sw_component: AmdSmiSwComponent): def amdsmi_topo_get_numa_node_number( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) numa_node_number = ctypes.c_uint32() _check_res( amdsmi_wrapper.amdsmi_topo_get_numa_node_number( - device_handle, ctypes.byref(numa_node_number) + processor_handle, ctypes.byref(numa_node_number) ) ) @@ -1219,24 +1188,24 @@ def amdsmi_topo_get_numa_node_number( def amdsmi_topo_get_link_weight( - device_handle_src: amdsmi_wrapper.amdsmi_device_handle, - device_handle_dst: amdsmi_wrapper.amdsmi_device_handle, + processor_handle_src: amdsmi_wrapper.amdsmi_processor_handle, + processor_handle_dst: amdsmi_wrapper.amdsmi_processor_handle, ): - if not isinstance(device_handle_src, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_src, amdsmi_wrapper.amdsmi_device_handle + processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle ) - if not isinstance(device_handle_dst, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_dst, amdsmi_wrapper.amdsmi_device_handle + processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle ) weight = ctypes.c_uint64() _check_res( amdsmi_wrapper.amdsmi_topo_get_link_weight( - device_handle_src, device_handle_dst, ctypes.byref(weight) + processor_handle_src, processor_handle_dst, ctypes.byref(weight) ) ) @@ -1244,17 +1213,17 @@ def amdsmi_topo_get_link_weight( def amdsmi_get_minmax_bandwidth( - device_handle_src: amdsmi_wrapper.amdsmi_device_handle, - device_handle_dst: amdsmi_wrapper.amdsmi_device_handle, + processor_handle_src: amdsmi_wrapper.amdsmi_processor_handle, + processor_handle_dst: amdsmi_wrapper.amdsmi_processor_handle, ): - if not isinstance(device_handle_src, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_src, amdsmi_wrapper.amdsmi_device_handle + processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle ) - if not isinstance(device_handle_dst, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_dst, amdsmi_wrapper.amdsmi_device_handle + processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle ) min_bandwidth = ctypes.c_uint64() @@ -1262,8 +1231,8 @@ def amdsmi_get_minmax_bandwidth( _check_res( amdsmi_wrapper. amdsmi_get_minmax_bandwidth( - device_handle_src, - device_handle_dst, + processor_handle_src, + processor_handle_dst, ctypes.byref(min_bandwidth), ctypes.byref(max_bandwidth), ) @@ -1273,17 +1242,17 @@ def amdsmi_get_minmax_bandwidth( def amdsmi_topo_get_link_type( - device_handle_src: amdsmi_wrapper.amdsmi_device_handle, - device_handle_dst: amdsmi_wrapper.amdsmi_device_handle, + processor_handle_src: amdsmi_wrapper.amdsmi_processor_handle, + processor_handle_dst: amdsmi_wrapper.amdsmi_processor_handle, ): - if not isinstance(device_handle_src, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_src, amdsmi_wrapper.amdsmi_device_handle + processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle ) - if not isinstance(device_handle_dst, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_dst, amdsmi_wrapper.amdsmi_device_handle + processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle ) hops = ctypes.c_uint64() @@ -1292,8 +1261,8 @@ def amdsmi_topo_get_link_type( _check_res( amdsmi_wrapper.amdsmi_topo_get_link_type( - #device_handle_src, device_handle_dst, ctypes.byref(hops), type - device_handle_src, device_handle_dst, ctypes.byref( + #processor_handle_src, processor_handle_dst, ctypes.byref(hops), type + processor_handle_src, processor_handle_dst, ctypes.byref( hops), ctypes.byref(type) ) ) @@ -1302,39 +1271,39 @@ def amdsmi_topo_get_link_type( def amdsmi_is_P2P_accessible( - device_handle_src: amdsmi_wrapper.amdsmi_device_handle, - device_handle_dst: amdsmi_wrapper.amdsmi_device_handle, + processor_handle_src: amdsmi_wrapper.amdsmi_processor_handle, + processor_handle_dst: amdsmi_wrapper.amdsmi_processor_handle, ): - if not isinstance(device_handle_src, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_src, amdsmi_wrapper.amdsmi_device_handle + processor_handle_src, amdsmi_wrapper.amdsmi_processor_handle ) - if not isinstance(device_handle_dst, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle_dst, amdsmi_wrapper.amdsmi_device_handle + processor_handle_dst, amdsmi_wrapper.amdsmi_processor_handle ) accessible = ctypes.c_bool() _check_res( amdsmi_wrapper.amdsmi_is_P2P_accessible( - device_handle_src, device_handle_dst, ctypes.byref(accessible) + processor_handle_src, processor_handle_dst, ctypes.byref(accessible) ) ) return accessible.value -def amdsmi_get_xgmi_info(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_xgmi_info(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) xgmi_info = amdsmi_wrapper.amdsmi_xgmi_info_t() - _check_res(amdsmi_wrapper.amdsmi_get_xgmi_info(device_handle, xgmi_info)) + _check_res(amdsmi_wrapper.amdsmi_get_xgmi_info(processor_handle, xgmi_info)) return { "xgmi_lanes": xgmi_info.xgmi_lanes, @@ -1344,53 +1313,53 @@ def amdsmi_get_xgmi_info(device_handle: amdsmi_wrapper.amdsmi_device_handle): } -def amdsmi_dev_counter_group_supported( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_gpu_counter_group_supported( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, event_group: AmdSmiEventGroup, ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(event_group, AmdSmiEventGroup): raise AmdSmiParameterException(event_group, AmdSmiEventGroup) _check_res( - amdsmi_wrapper.amdsmi_dev_counter_group_supported( - device_handle, event_group) + amdsmi_wrapper.amdsmi_gpu_counter_group_supported( + processor_handle, event_group) ) -def amdsmi_dev_create_counter( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_gpu_create_counter( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, event_type: AmdSmiEventType, ) -> amdsmi_wrapper.amdsmi_event_handle_t: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(event_type, AmdSmiEventType): raise AmdSmiParameterException(event_type, AmdSmiEventType) event_handle = amdsmi_wrapper.amdsmi_event_handle_t() _check_res( - amdsmi_wrapper.amdsmi_dev_create_counter( - device_handle, event_type, ctypes.byref(event_handle) + amdsmi_wrapper.amdsmi_gpu_create_counter( + processor_handle, event_type, ctypes.byref(event_handle) ) ) return event_handle -def amdsmi_dev_destroy_counter(event_handle: amdsmi_wrapper.amdsmi_event_handle_t): +def amdsmi_gpu_destroy_counter(event_handle: amdsmi_wrapper.amdsmi_event_handle_t): if not isinstance(event_handle, amdsmi_wrapper.amdsmi_event_handle_t): raise AmdSmiParameterException( event_handle, amdsmi_wrapper.amdsmi_event_handle_t ) - _check_res(amdsmi_wrapper.amdsmi_dev_destroy_counter(event_handle)) + _check_res(amdsmi_wrapper.amdsmi_gpu_destroy_counter(event_handle)) -def amdsmi_control_counter( +def amdsmi_gpu_control_counter( event_handle: amdsmi_wrapper.amdsmi_event_handle_t, counter_command: AmdSmiCounterCommand, ): @@ -1403,13 +1372,13 @@ def amdsmi_control_counter( command_args = ctypes.c_void_p() _check_res( - amdsmi_wrapper.amdsmi_control_counter( + amdsmi_wrapper.amdsmi_gpu_control_counter( event_handle, counter_command, command_args ) ) -def amdsmi_read_counter( +def amdsmi_gpu_read_counter( event_handle: amdsmi_wrapper.amdsmi_event_handle_t, ) -> Dict[str, Any]: if not isinstance(event_handle, amdsmi_wrapper.amdsmi_event_handle_t): @@ -1420,7 +1389,7 @@ def amdsmi_read_counter( counter_value = amdsmi_wrapper.amdsmi_counter_value_t() _check_res( - amdsmi_wrapper.amdsmi_read_counter( + amdsmi_wrapper.amdsmi_gpu_read_counter( event_handle, ctypes.byref(counter_value)) ) @@ -1431,48 +1400,48 @@ def amdsmi_read_counter( } -def amdsmi_counter_get_available_counters( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_available_counters( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, event_group: AmdSmiEventGroup, ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(event_group, AmdSmiEventGroup): raise AmdSmiParameterException(event_group, AmdSmiEventGroup) available = ctypes.c_uint32() _check_res( - amdsmi_wrapper. amdsmi_counter_get_available_counters( - device_handle, event_group, ctypes.byref(available) + amdsmi_wrapper. amdsmi_get_gpu_available_counters( + processor_handle, event_group, ctypes.byref(available) ) ) return available.value -def amdsmi_dev_set_perf_level( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_gpu_perf_level( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, perf_level: AmdSmiDevPerfLevel, ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(perf_level, AmdSmiDevPerfLevel): raise AmdSmiParameterException(perf_level, AmdSmiDevPerfLevel) - _check_res(amdsmi_wrapper. amdsmi_dev_set_perf_level( - device_handle, perf_level)) + _check_res(amdsmi_wrapper. amdsmi_set_gpu_perf_level( + processor_handle, perf_level)) -def amdsmi_dev_get_power_profile_presets( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_idx: int +def amdsmi_get_gpu_power_profile_presets( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_idx, int): raise AmdSmiParameterException(sensor_idx, int) @@ -1481,8 +1450,8 @@ def amdsmi_dev_get_power_profile_presets( status = amdsmi_wrapper.amdsmi_power_profile_status_t() _check_res( - amdsmi_wrapper. amdsmi_dev_get_power_profile_presets( - device_handle, sensor_idx, ctypes.byref(status) + amdsmi_wrapper. amdsmi_get_gpu_power_profile_presets( + processor_handle, sensor_idx, ctypes.byref(status) ) ) @@ -1493,38 +1462,38 @@ def amdsmi_dev_get_power_profile_presets( } -def amdsmi_dev_reset_gpu(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_reset_gpu(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) - _check_res(amdsmi_wrapper.amdsmi_dev_reset_gpu(device_handle)) + _check_res(amdsmi_wrapper.amdsmi_reset_gpu(processor_handle)) -def amdsmi_set_perf_determinism_mode( - device_handle: amdsmi_wrapper.amdsmi_device_handle, clock_value: int +def amdsmi_set_gpu_perf_determinism_mode( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clock_value: int ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(clock_value, int): raise AmdSmiParameterException(clock_value, int) clock_value = ctypes.c_uint64(clock_value) _check_res( - amdsmi_wrapper.amdsmi_set_perf_determinism_mode( - device_handle, clock_value) + amdsmi_wrapper.amdsmi_set_gpu_perf_determinism_mode( + processor_handle, clock_value) ) -def amdsmi_dev_set_fan_speed( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_idx: int, fan_speed: int +def amdsmi_set_gpu_fan_speed( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int, fan_speed: int ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_idx, int): raise AmdSmiParameterException(sensor_idx, int) @@ -1534,33 +1503,33 @@ def amdsmi_dev_set_fan_speed( fan_speed = ctypes.c_uint64(fan_speed) _check_res( - amdsmi_wrapper.amdsmi_dev_set_fan_speed( - device_handle, sensor_idx, fan_speed) + amdsmi_wrapper.amdsmi_set_gpu_fan_speed( + processor_handle, sensor_idx, fan_speed) ) -def amdsmi_dev_reset_fan( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_idx: int +def amdsmi_reset_gpu_fan( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_idx, int): raise AmdSmiParameterException(sensor_idx, int) sensor_idx = ctypes.c_uint32(sensor_idx) - _check_res(amdsmi_wrapper.amdsmi_dev_reset_fan(device_handle, sensor_idx)) + _check_res(amdsmi_wrapper.amdsmi_reset_gpu_fan(processor_handle, sensor_idx)) -def amdsmi_dev_set_clk_freq( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_clk_freq( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clk_type: AmdSmiClkType, freq_bitmask: int, ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(clk_type, AmdSmiClkType): raise AmdSmiParameterException(clk_type, AmdSmiParameterException) @@ -1568,80 +1537,80 @@ def amdsmi_dev_set_clk_freq( raise AmdSmiParameterException(freq_bitmask, int) freq_bitmask = ctypes.c_uint64(freq_bitmask) _check_res( - amdsmi_wrapper. amdsmi_dev_set_clk_freq( - device_handle, clk_type, freq_bitmask + amdsmi_wrapper. amdsmi_set_clk_freq( + processor_handle, clk_type, freq_bitmask ) ) -def amdsmi_dev_set_overdrive_level_v1( - device_handle: amdsmi_wrapper.amdsmi_device_handle, overdrive_value: int +def amdsmi_set_gpu_overdrive_level_v1( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, overdrive_value: int ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(overdrive_value, int): raise AmdSmiParameterException(overdrive_value, int) overdrive_value = ctypes.c_uint32(overdrive_value) _check_res( - amdsmi_wrapper. amdsmi_dev_set_overdrive_level_v1( - device_handle, overdrive_value) + amdsmi_wrapper. amdsmi_set_gpu_overdrive_level_v1( + processor_handle, overdrive_value) ) -def amdsmi_dev_set_overdrive_level( - device_handle: amdsmi_wrapper.amdsmi_device_handle, overdrive_value: int +def amdsmi_set_gpu_overdrive_level( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, overdrive_value: int ): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(overdrive_value, int): raise AmdSmiParameterException(overdrive_value, int) overdrive_value = ctypes.c_uint32(overdrive_value) _check_res( - amdsmi_wrapper. amdsmi_dev_set_overdrive_level( - device_handle, overdrive_value) + amdsmi_wrapper. amdsmi_set_gpu_overdrive_level( + processor_handle, overdrive_value) ) -def amdsmi_dev_open_supported_func_iterator( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_open_supported_func_iterator( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> amdsmi_wrapper.amdsmi_func_id_iter_handle_t: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) obj_handle = amdsmi_wrapper.amdsmi_func_id_iter_handle_t() _check_res( - amdsmi_wrapper.amdsmi_dev_open_supported_func_iterator( - device_handle, ctypes.byref(obj_handle) + amdsmi_wrapper.amdsmi_open_supported_func_iterator( + processor_handle, ctypes.byref(obj_handle) ) ) return obj_handle -def amdsmi_dev_get_pci_id(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_pci_id(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) bdfid = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_pci_id( - device_handle, ctypes.byref(bdfid)) + amdsmi_wrapper.amdsmi_get_gpu_pci_id( + processor_handle, ctypes.byref(bdfid)) ) return bdfid.value -def amdsmi_dev_open_supported_variant_iterator( +def amdsmi_open_supported_variant_iterator( obj_handle: amdsmi_wrapper.amdsmi_func_id_iter_handle_t, ) -> amdsmi_wrapper.amdsmi_func_id_iter_handle_t: if not isinstance(obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t): @@ -1651,7 +1620,7 @@ def amdsmi_dev_open_supported_variant_iterator( var_iter = amdsmi_wrapper.amdsmi_func_id_iter_handle_t() _check_res( - amdsmi_wrapper.amdsmi_dev_open_supported_variant_iterator( + amdsmi_wrapper.amdsmi_open_supported_variant_iterator( obj_handle, ctypes.byref(var_iter) ) ) @@ -1659,7 +1628,7 @@ def amdsmi_dev_open_supported_variant_iterator( return var_iter -def amdsmi_dev_close_supported_func_iterator( +def amdsmi_close_supported_func_iterator( obj_handle: amdsmi_wrapper.amdsmi_func_id_iter_handle_t, ) -> None: if not isinstance(obj_handle, amdsmi_wrapper.amdsmi_func_id_iter_handle_t): @@ -1668,7 +1637,7 @@ def amdsmi_dev_close_supported_func_iterator( ) _check_res( - amdsmi_wrapper.amdsmi_dev_close_supported_func_iterator( + amdsmi_wrapper.amdsmi_close_supported_func_iterator( obj_handle, ctypes.byref(obj_handle) ) ) @@ -1716,20 +1685,20 @@ def amdsmi_get_func_iter_value( } -def amdsmi_dev_set_pci_bandwidth( - device_handle: amdsmi_wrapper.amdsmi_device_handle, bitmask: int +def amdsmi_set_gpu_pci_bandwidth( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, bitmask: int ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(bitmask, int): raise AmdSmiParameterException(bitmask, int) _check_res( - amdsmi_wrapper. amdsmi_dev_set_pci_bandwidth( - device_handle, ctypes.c_uint64(bitmask) + amdsmi_wrapper. amdsmi_set_gpu_pci_bandwidth( + processor_handle, ctypes.c_uint64(bitmask) ) ) @@ -1742,17 +1711,17 @@ def _format_transfer_rate(transfer_rate): } -def amdsmi_dev_get_pci_bandwidth(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_pci_bandwidth(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) bandwidth = amdsmi_wrapper.amdsmi_pcie_bandwidth_t() _check_res( - amdsmi_wrapper.amdsmi_dev_get_pci_bandwidth( - device_handle, ctypes.byref(bandwidth)) + amdsmi_wrapper.amdsmi_get_gpu_pci_bandwidth( + processor_handle, ctypes.byref(bandwidth)) ) transfer_rate = _format_transfer_rate(bandwidth.transfer_rate) @@ -1763,10 +1732,10 @@ def amdsmi_dev_get_pci_bandwidth(device_handle: amdsmi_wrapper.amdsmi_device_han } -def amdsmi_dev_get_pci_throughput(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_pci_throughput(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) sent = ctypes.c_uint64() @@ -1774,7 +1743,7 @@ def amdsmi_dev_get_pci_throughput(device_handle: amdsmi_wrapper.amdsmi_device_ha max_pkt_sz = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_pci_throughput(device_handle, ctypes.byref( + amdsmi_wrapper.amdsmi_get_gpu_pci_throughput(processor_handle, ctypes.byref( sent), ctypes.byref(received), ctypes.byref(max_pkt_sz)) ) @@ -1785,44 +1754,44 @@ def amdsmi_dev_get_pci_throughput(device_handle: amdsmi_wrapper.amdsmi_device_ha } -def amdsmi_dev_get_pci_replay_counter(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_pci_replay_counter(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) counter = ctypes.c_uint64() _check_res( - amdsmi_wrapper. amdsmi_dev_get_pci_replay_counter( - device_handle, ctypes.byref(counter)) + amdsmi_wrapper. amdsmi_get_gpu_pci_replay_counter( + processor_handle, ctypes.byref(counter)) ) return counter.value -def amdsmi_topo_get_numa_affinity(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_topo_numa_affinity(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) numa_node = ctypes.c_uint32() _check_res( - amdsmi_wrapper.amdsmi_topo_get_numa_affinity( - device_handle, ctypes.byref(numa_node)) + amdsmi_wrapper.amdsmi_get_gpu_topo_numa_affinity( + processor_handle, ctypes.byref(numa_node)) ) return numa_node.value -def amdsmi_dev_set_power_cap( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_ind: int, cap: int +def amdsmi_set_power_cap( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_ind: int, cap: int ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_ind, int): @@ -1832,36 +1801,20 @@ def amdsmi_dev_set_power_cap( raise AmdSmiParameterException(cap, int) _check_res( - amdsmi_wrapper. amdsmi_dev_set_power_cap( - device_handle, ctypes.c_uint32(sensor_ind), ctypes.c_uint64(cap) + amdsmi_wrapper. amdsmi_set_power_cap( + processor_handle, ctypes.c_uint32(sensor_ind), ctypes.c_uint64(cap) ) ) -def amdsmi_dev_get_power_ave(device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_id: ctypes.c_uint32): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): - raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle - ) - - power = ctypes.c_uint64() - - _check_res( - amdsmi_wrapper.amdsmi_dev_get_power_ave( - device_handle, sensor_id, ctypes.byref(power)) - ) - - return power.value - - -def amdsmi_dev_set_power_profile( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_gpu_power_profile( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, reserved: int, profile: AmdSmiPowerProfilePresetMasks, ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(reserved, int): @@ -1871,16 +1824,16 @@ def amdsmi_dev_set_power_profile( raise AmdSmiParameterException(profile, AmdSmiPowerProfilePresetMasks) _check_res( - amdsmi_wrapper. amdsmi_dev_set_power_profile( - device_handle, ctypes.c_uint32(reserved), profile + amdsmi_wrapper. amdsmi_set_gpu_power_profile( + processor_handle, ctypes.c_uint32(reserved), profile ) ) -def amdsmi_dev_get_energy_count(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_energy_count(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) power = ctypes.c_uint64() @@ -1888,7 +1841,7 @@ def amdsmi_dev_get_energy_count(device_handle: amdsmi_wrapper.amdsmi_device_hand timestamp = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_energy_count(device_handle, ctypes.byref( + amdsmi_wrapper.amdsmi_get_energy_count(processor_handle, ctypes.byref( power), ctypes.byref(counter_resolution), ctypes.byref(timestamp)) ) @@ -1899,15 +1852,15 @@ def amdsmi_dev_get_energy_count(device_handle: amdsmi_wrapper.amdsmi_device_hand } -def amdsmi_dev_set_clk_range( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_gpu_clk_range( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, min_clk_value: int, max_clk_value: int, clk_type: AmdSmiClkType, ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(min_clk_value, int): @@ -1920,8 +1873,8 @@ def amdsmi_dev_set_clk_range( raise AmdSmiParameterException(clk_type, AmdSmiClkType) _check_res( - amdsmi_wrapper.amdsmi_dev_set_clk_range( - device_handle, + amdsmi_wrapper.amdsmi_set_gpu_clk_range( + processor_handle, ctypes.c_uint64(min_clk_value), ctypes.c_uint64(max_clk_value), clk_type, @@ -1929,10 +1882,10 @@ def amdsmi_dev_set_clk_range( ) -def amdsmi_dev_get_memory_total(device_handle: amdsmi_wrapper.amdsmi_device_handle, mem_type: AmdSmiMemoryType): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_memory_total(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, mem_type: AmdSmiMemoryType): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(mem_type, AmdSmiMemoryType): @@ -1943,22 +1896,22 @@ def amdsmi_dev_get_memory_total(device_handle: amdsmi_wrapper.amdsmi_device_hand total = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_memory_total( - device_handle, mem_type, ctypes.byref(total)) + amdsmi_wrapper.amdsmi_get_gpu_memory_total( + processor_handle, mem_type, ctypes.byref(total)) ) return total.value -def amdsmi_dev_set_od_clk_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_gpu_od_clk_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, level: AmdSmiFreqInd, value: int, clk_type: AmdSmiClkType, ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(level, AmdSmiFreqInd): @@ -1971,16 +1924,16 @@ def amdsmi_dev_set_od_clk_info( raise AmdSmiParameterException(clk_type, AmdSmiClkType) _check_res( - amdsmi_wrapper. amdsmi_dev_set_od_clk_info( - device_handle, level, ctypes.c_uint64(value), clk_type + amdsmi_wrapper. amdsmi_set_gpu_od_clk_info( + processor_handle, level, ctypes.c_uint64(value), clk_type ) ) -def amdsmi_dev_get_memory_usage(device_handle: amdsmi_wrapper.amdsmi_device_handle, mem_type: AmdSmiMemoryType): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_memory_usage(processor_handle: amdsmi_wrapper.amdsmi_processor_handle, mem_type: AmdSmiMemoryType): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(mem_type, AmdSmiMemoryType): @@ -1991,22 +1944,22 @@ def amdsmi_dev_get_memory_usage(device_handle: amdsmi_wrapper.amdsmi_device_hand used = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_memory_usage( - device_handle, mem_type, ctypes.byref(used)) + amdsmi_wrapper.amdsmi_get_gpu_memory_usage( + processor_handle, mem_type, ctypes.byref(used)) ) return used.value -def amdsmi_dev_set_od_volt_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_gpu_od_volt_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, vpoint: int, clk_value: int, volt_value: int, ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(vpoint, int): @@ -2019,8 +1972,8 @@ def amdsmi_dev_set_od_volt_info( raise AmdSmiParameterException(volt_value, int) _check_res( - amdsmi_wrapper. amdsmi_dev_set_od_volt_info( - device_handle, + amdsmi_wrapper. amdsmi_set_gpu_od_volt_info( + processor_handle, ctypes.c_uint32(vpoint), ctypes.c_uint64(clk_value), ctypes.c_uint64(volt_value), @@ -2028,103 +1981,103 @@ def amdsmi_dev_set_od_volt_info( ) -def amdsmi_dev_get_memory_busy_percent(device_handle: amdsmi_wrapper.amdsmi_device_handle): - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_memory_busy_percent(processor_handle: amdsmi_wrapper.amdsmi_processor_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) busy_percent = ctypes.c_uint32() _check_res( - amdsmi_wrapper.amdsmi_dev_get_memory_busy_percent( - device_handle, ctypes.byref(busy_percent)) + amdsmi_wrapper.amdsmi_get_gpu_memory_busy_percent( + processor_handle, ctypes.byref(busy_percent)) ) return busy_percent.value -def amdsmi_dev_set_perf_level_v1( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_set_gpu_perf_level_v1( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, perf_lvl: AmdSmiDevPerfLevel, ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(perf_lvl, AmdSmiDevPerfLevel): raise AmdSmiParameterException(perf_lvl, AmdSmiDevPerfLevel) - _check_res(amdsmi_wrapper. amdsmi_dev_set_perf_level_v1( - device_handle, perf_lvl)) + _check_res(amdsmi_wrapper. amdsmi_set_gpu_perf_level_v1( + processor_handle, perf_lvl)) -def amdsmi_dev_get_fan_rpms( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_idx: int +def amdsmi_get_gpu_fan_rpms( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_idx, int): raise AmdSmiParameterException(sensor_idx, int) fan_speed = ctypes.c_int64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_fan_rpms( - device_handle, sensor_idx, ctypes.byref(fan_speed) + amdsmi_wrapper.amdsmi_get_gpu_fan_rpms( + processor_handle, sensor_idx, ctypes.byref(fan_speed) ) ) return fan_speed.value -def amdsmi_dev_get_fan_speed( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_idx: int +def amdsmi_get_gpu_fan_speed( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_idx, int): raise AmdSmiParameterException(sensor_idx, int) fan_speed = ctypes.c_int64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_fan_speed( - device_handle, sensor_idx, ctypes.byref(fan_speed) + amdsmi_wrapper.amdsmi_get_gpu_fan_speed( + processor_handle, sensor_idx, ctypes.byref(fan_speed) ) ) return fan_speed.value -def amdsmi_dev_get_fan_speed_max( - device_handle: amdsmi_wrapper.amdsmi_device_handle, sensor_idx: int +def amdsmi_get_gpu_fan_speed_max( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_idx, int): raise AmdSmiParameterException(sensor_idx, int) fan_speed = ctypes.c_uint64() _check_res( - amdsmi_wrapper.amdsmi_dev_get_fan_speed_max( - device_handle, sensor_idx, ctypes.byref(fan_speed) + amdsmi_wrapper.amdsmi_get_gpu_fan_speed_max( + processor_handle, sensor_idx, ctypes.byref(fan_speed) ) ) return fan_speed.value -def amdsmi_dev_get_temp_metric( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_temp_metric( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_type: AmdSmiTemperatureType, metric: AmdSmiTemperatureMetric, ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_type, AmdSmiTemperatureType): raise AmdSmiParameterException(sensor_type, AmdSmiTemperatureType) @@ -2133,22 +2086,22 @@ def amdsmi_dev_get_temp_metric( temp_value = ctypes.c_int64() _check_res( - amdsmi_wrapper. amdsmi_dev_get_temp_metric( - device_handle, sensor_type, metric, ctypes.byref(temp_value) + amdsmi_wrapper. amdsmi_get_temp_metric( + processor_handle, sensor_type, metric, ctypes.byref(temp_value) ) ) return temp_value.value -def amdsmi_dev_get_volt_metric( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_volt_metric( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_type: AmdSmiVoltageType, metric: AmdSmiVoltageMetric, ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(sensor_type, AmdSmiVoltageType): raise AmdSmiParameterException(sensor_type, AmdSmiVoltageType) @@ -2157,26 +2110,26 @@ def amdsmi_dev_get_volt_metric( voltage = ctypes.c_int64() _check_res( - amdsmi_wrapper. amdsmi_dev_get_volt_metric( - device_handle, sensor_type, metric, ctypes.byref(voltage) + amdsmi_wrapper. amdsmi_get_gpu_volt_metric( + processor_handle, sensor_type, metric, ctypes.byref(voltage) ) ) return voltage.value -def amdsmi_dev_get_busy_percent( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_busy_percent( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) busy_percent = ctypes.c_uint32() _check_res( - amdsmi_wrapper.amdsmi_dev_get_busy_percent( - device_handle, ctypes.byref(busy_percent) + amdsmi_wrapper.amdsmi_get_busy_percent( + processor_handle, ctypes.byref(busy_percent) ) ) @@ -2184,12 +2137,12 @@ def amdsmi_dev_get_busy_percent( def amdsmi_get_utilization_count( - device_handle: amdsmi_wrapper.amdsmi_device_handle, + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, *counter_types: Tuple[AmdSmiUtilizationCounterType] ) -> List[Dict[str, Any]]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not len(counter_types): raise AmdSmiLibraryException(amdsmi_wrapper.AMDSMI_STATUS_INVAL) @@ -2210,7 +2163,7 @@ def amdsmi_get_utilization_count( _check_res( amdsmi_wrapper.amdsmi_get_utilization_count( - device_handle, util_counter_list, count, ctypes.byref(timestamp) + processor_handle, util_counter_list, count, ctypes.byref(timestamp) ) ) if count.value != len(counters): @@ -2229,19 +2182,19 @@ def amdsmi_get_utilization_count( return result -def amdsmi_dev_get_perf_level( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_perf_level( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> str: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) perf = amdsmi_wrapper.amdsmi_dev_perf_level_t() _check_res( - amdsmi_wrapper.amdsmi_dev_get_perf_level( - device_handle, ctypes.byref(perf)) + amdsmi_wrapper.amdsmi_get_gpu_perf_level( + processor_handle, ctypes.byref(perf)) ) result = amdsmi_wrapper.c__EA_amdsmi_dev_perf_level_t__enumvalues[perf.value] @@ -2253,38 +2206,52 @@ def amdsmi_dev_get_perf_level( return result -def amdsmi_dev_get_overdrive_level( - device_handle: amdsmi_wrapper.amdsmi_device_handle, -) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_set_gpu_perf_determinism_mode( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clkvalue: int +) -> None: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + if not isinstance(clkvalue, int): + raise AmdSmiParameterException(clkvalue, int) + + _check_res(amdsmi_wrapper.amdsmi_set_gpu_perf_determinism_mode( + processor_handle, clkvalue)) + + +def amdsmi_get_gpu_overdrive_level( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, +) -> int: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) od_level = ctypes.c_uint32() _check_res( - amdsmi_wrapper.amdsmi_dev_get_overdrive_level( - device_handle, ctypes.byref(od_level) + amdsmi_wrapper.amdsmi_get_gpu_overdrive_level( + processor_handle, ctypes.byref(od_level) ) ) return od_level.value -def amdsmi_dev_get_gpu_clk_freq( - device_handle: amdsmi_wrapper.amdsmi_device_handle, clk_type: AmdSmiClkType +def amdsmi_get_clk_freq( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clk_type: AmdSmiClkType ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(clk_type, AmdSmiClkType): raise AmdSmiParameterException(clk_type, AmdSmiClkType) freq = amdsmi_wrapper.amdsmi_frequencies_t() _check_res( - amdsmi_wrapper. amdsmi_dev_get_gpu_clk_freq( - device_handle, clk_type, ctypes.byref(freq) + amdsmi_wrapper. amdsmi_get_clk_freq( + processor_handle, clk_type, ctypes.byref(freq) ) ) @@ -2295,18 +2262,18 @@ def amdsmi_dev_get_gpu_clk_freq( } -def amdsmi_dev_get_od_volt_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_od_volt_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) freq_data = amdsmi_wrapper.amdsmi_od_volt_freq_data_t() _check_res( - amdsmi_wrapper. amdsmi_dev_get_od_volt_info( - device_handle, ctypes.byref(freq_data) + amdsmi_wrapper. amdsmi_get_gpu_od_volt_info( + processor_handle, ctypes.byref(freq_data) ) ) @@ -2332,18 +2299,18 @@ def amdsmi_dev_get_od_volt_info( } -def amdsmi_dev_get_gpu_metrics_info( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_metrics_info( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Dict[str, Any]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) gpu_metrics = amdsmi_wrapper.amdsmi_gpu_metrics_t() _check_res( - amdsmi_wrapper. amdsmi_dev_get_gpu_metrics_info( - device_handle, ctypes.byref(gpu_metrics) + amdsmi_wrapper. amdsmi_get_gpu_metrics_info( + processor_handle, ctypes.byref(gpu_metrics) ) ) @@ -2385,12 +2352,12 @@ def amdsmi_dev_get_gpu_metrics_info( } -def amdsmi_dev_get_od_volt_curve_regions( - device_handle: amdsmi_wrapper.amdsmi_device_handle, num_regions: int +def amdsmi_get_gpu_od_volt_curve_regions( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, num_regions: int ) -> List[Dict[str, Any]]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(num_regions, int): raise AmdSmiParameterException(num_regions, int) @@ -2398,8 +2365,8 @@ def amdsmi_dev_get_od_volt_curve_regions( region_count = ctypes.c_uint32(num_regions) buffer = (amdsmi_wrapper.amdsmi_freq_volt_region_t * num_regions)() _check_res( - amdsmi_wrapper. amdsmi_dev_get_od_volt_curve_regions( - device_handle, ctypes.byref(region_count), buffer + amdsmi_wrapper. amdsmi_get_gpu_od_volt_curve_regions( + processor_handle, ctypes.byref(region_count), buffer ) ) @@ -2424,12 +2391,36 @@ def amdsmi_dev_get_od_volt_curve_regions( return result -def amdsmi_dev_get_ecc_count( - device_handle: amdsmi_wrapper.amdsmi_device_handle, block: AmdSmiGpuBlock -) -> Dict[str, int]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): +def amdsmi_get_gpu_power_profile_presets( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, sensor_idx: int +) -> Dict[str, Any]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle + ) + if not isinstance(sensor_idx, int): + raise AmdSmiParameterException(sensor_idx, int) + + status = amdsmi_wrapper.amdsmi_power_profile_status_t() + _check_res( + amdsmi_wrapper. amdsmi_get_gpu_power_profile_presets( + processor_handle, sensor_idx, ctypes.byref(status) + ) + ) + + return { + "available_profiles": status.available_profiles, + "current": status.current, + "num_profiles": status.num_profiles, + } + + +def amdsmi_get_gpu_ecc_count( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, block: AmdSmiGpuBlock +) -> Dict[str, int]: + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): + raise AmdSmiParameterException( + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(block, AmdSmiGpuBlock): @@ -2437,8 +2428,8 @@ def amdsmi_dev_get_ecc_count( ec = amdsmi_wrapper.amdsmi_error_count_t() _check_res( - amdsmi_wrapper.amdsmi_dev_get_ecc_count( - device_handle, block, ctypes.byref(ec)) + amdsmi_wrapper. amdsmi_get_gpu_ecc_count( + processor_handle, block, ctypes.byref(ec)) ) return { @@ -2447,29 +2438,29 @@ def amdsmi_dev_get_ecc_count( } -def amdsmi_dev_get_ecc_enabled( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_ecc_enabled( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> int: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) blocks = ctypes.c_uint64(0) _check_res( - amdsmi_wrapper. amdsmi_dev_get_ecc_enabled( - device_handle, ctypes.byref(blocks)) + amdsmi_wrapper. amdsmi_get_gpu_ecc_enabled( + processor_handle, ctypes.byref(blocks)) ) return blocks.value -def amdsmi_dev_get_ecc_status( - device_handle: amdsmi_wrapper.amdsmi_device_handle, block: AmdSmiGpuBlock +def amdsmi_get_gpu_ecc_status( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, block: AmdSmiGpuBlock ) -> AmdSmiRasErrState: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) if not isinstance(block, AmdSmiGpuBlock): @@ -2477,8 +2468,8 @@ def amdsmi_dev_get_ecc_status( state = amdsmi_wrapper.amdsmi_ras_err_state_t() _check_res( - amdsmi_wrapper. amdsmi_dev_get_ecc_status( - device_handle, block, ctypes.byref(state) + amdsmi_wrapper. amdsmi_get_gpu_ecc_status( + processor_handle, block, ctypes.byref(state) ) ) @@ -2497,17 +2488,17 @@ def amdsmi_status_string(status: amdsmi_wrapper.amdsmi_status_t) -> str: return amdsmi_wrapper.string_cast(status_string_p_p.contents) -def amdsmi_get_compute_process_info() -> List[Dict[str, int]]: +def amdsmi_get_gpu_compute_process_info() -> List[Dict[str, int]]: num_items = ctypes.c_uint32(0) nullptr = ctypes.POINTER(amdsmi_wrapper.amdsmi_process_info_t)() _check_res( - amdsmi_wrapper.amdsmi_get_compute_process_info( + amdsmi_wrapper.amdsmi_get_gpu_compute_process_info( nullptr, ctypes.byref(num_items)) ) procs = (amdsmi_wrapper.amdsmi_process_info_t * num_items.value)() _check_res( - amdsmi_wrapper.amdsmi_get_compute_process_info( + amdsmi_wrapper.amdsmi_get_gpu_compute_process_info( procs, ctypes.byref(num_items)) ) @@ -2523,13 +2514,13 @@ def amdsmi_get_compute_process_info() -> List[Dict[str, int]]: ] -def amdsmi_get_compute_process_info_by_pid(pid: int) -> Dict[str, int]: +def amdsmi_get_gpu_compute_process_info_by_pid(pid: int) -> Dict[str, int]: if not isinstance(pid, int): raise AmdSmiParameterException(pid, int) proc = amdsmi_wrapper.amdsmi_process_info_t() _check_res( - amdsmi_wrapper.amdsmi_get_compute_process_info_by_pid( + amdsmi_wrapper.amdsmi_get_gpu_compute_process_info_by_pid( ctypes.c_uint32(pid), ctypes.byref(proc) ) ) @@ -2543,21 +2534,21 @@ def amdsmi_get_compute_process_info_by_pid(pid: int) -> Dict[str, int]: } -def amdsmi_get_compute_process_gpus(pid: int) -> List[int]: +def amdsmi_get_gpu_compute_process_gpus(pid: int) -> List[int]: if not isinstance(pid, int): raise AmdSmiParameterException(pid, int) num_devices = ctypes.c_uint32(0) nullptr = ctypes.POINTER(ctypes.c_uint32)() _check_res( - amdsmi_wrapper.amdsmi_get_compute_process_gpus( + amdsmi_wrapper.amdsmi_get_gpu_compute_process_gpus( pid, nullptr, ctypes.byref(num_devices) ) ) dv_indices = (ctypes.c_uint32 * num_devices.value)() _check_res( - amdsmi_wrapper.amdsmi_get_compute_process_gpus( + amdsmi_wrapper.amdsmi_get_gpu_compute_process_gpus( pid, dv_indices, ctypes.byref(num_devices) ) ) @@ -2565,48 +2556,48 @@ def amdsmi_get_compute_process_gpus(pid: int) -> List[int]: return [dv_index.value for dv_index in dv_indices] -def amdsmi_dev_xgmi_error_status( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_gpu_xgmi_error_status( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> AmdSmiXgmiStatus: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) status = amdsmi_wrapper.amdsmi_xgmi_status_t() _check_res( - amdsmi_wrapper.amdsmi_dev_xgmi_error_status( - device_handle, ctypes.byref(status)) + amdsmi_wrapper.amdsmi_gpu_xgmi_error_status( + processor_handle, ctypes.byref(status)) ) return AmdSmiXgmiStatus(status.value) -def amdsmi_dev_reset_xgmi_error( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_reset_gpu_xgmi_error( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> None: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) - _check_res(amdsmi_wrapper.amdsmi_dev_reset_xgmi_error(device_handle)) + _check_res(amdsmi_wrapper.amdsmi_reset_gpu_xgmi_error(processor_handle)) -def amdsmi_dev_get_memory_reserved_pages( - device_handle: amdsmi_wrapper.amdsmi_device_handle, +def amdsmi_get_gpu_memory_reserved_pages( + processor_handle: amdsmi_wrapper.amdsmi_processor_handle, ) -> Union[list, str]: - if not isinstance(device_handle, amdsmi_wrapper.amdsmi_device_handle): + if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): raise AmdSmiParameterException( - device_handle, amdsmi_wrapper.amdsmi_device_handle + processor_handle, amdsmi_wrapper.amdsmi_processor_handle ) num_pages = ctypes.c_uint32() retired_page_record = ctypes.POINTER( amdsmi_wrapper.amdsmi_retired_page_record_t)() _check_res( - amdsmi_wrapper.amdsmi_dev_get_memory_reserved_pages( - device_handle, ctypes.byref(num_pages), retired_page_record + amdsmi_wrapper.amdsmi_get_gpu_memory_reserved_pages( + processor_handle, ctypes.byref(num_pages), retired_page_record ) ) diff --git a/projects/amdsmi/py-interface/amdsmi_wrapper.py b/projects/amdsmi/py-interface/amdsmi_wrapper.py index fbb3b5de19..c69f13d1b5 100644 --- a/projects/amdsmi/py-interface/amdsmi_wrapper.py +++ b/projects/amdsmi/py-interface/amdsmi_wrapper.py @@ -165,26 +165,29 @@ def char_pointer_cast(string, encoding='utf-8'): return ctypes.cast(string, ctypes.POINTER(ctypes.c_char)) - +### Match edits in generator.py from start to end +### Start match _libraries = {} from pathlib import Path -libamd_smi_optrocm = Path(__file__).parents[3] / "/lib/libamd_smi.so" libamd_smi_cpack = Path("@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libamd_smi.so") +libamd_smi_optrocm = Path("/opt/rocm/lib/libamd_smi.so") libamd_smi_parent_dir = Path(__file__).resolve().parent / "libamd_smi.so" libamd_smi_cwd = Path.cwd() / "libamd_smi.so" -if libamd_smi_optrocm.is_file(): - # try /opt/rocm/lib as a fallback - _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_optrocm) -elif libamd_smi_cpack.is_file(): +if libamd_smi_cpack.is_file(): # try to find library in install directory provided by CMake _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_cpack) +elif libamd_smi_optrocm.is_file(): + # try /opt/rocm/lib as a fallback + _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_optrocm) elif libamd_smi_parent_dir.is_file(): # try to fall back to parent directory _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_parent_dir) else: # lastly - search in current working directory _libraries['libamd_smi.so'] = ctypes.CDLL(libamd_smi_cwd) +### End match + # values for enumeration 'c__EA_amdsmi_init_flags_t' @@ -229,11 +232,11 @@ CONTAINER_DOCKER = 1 c__EA_amdsmi_container_types_t = ctypes.c_uint32 # enum amdsmi_container_types_t = c__EA_amdsmi_container_types_t amdsmi_container_types_t__enumvalues = c__EA_amdsmi_container_types_t__enumvalues -amdsmi_device_handle = ctypes.POINTER(None) +amdsmi_processor_handle = ctypes.POINTER(None) amdsmi_socket_handle = ctypes.POINTER(None) -# values for enumeration 'c__EA_device_type_t' -c__EA_device_type_t__enumvalues = { +# values for enumeration 'c__EA_processor_type_t' +c__EA_processor_type_t__enumvalues = { 0: 'UNKNOWN', 1: 'AMD_GPU', 2: 'AMD_CPU', @@ -245,9 +248,9 @@ AMD_GPU = 1 AMD_CPU = 2 NON_AMD_GPU = 3 NON_AMD_CPU = 4 -c__EA_device_type_t = ctypes.c_uint32 # enum -device_type_t = c__EA_device_type_t -device_type_t__enumvalues = c__EA_device_type_t__enumvalues +c__EA_processor_type_t = ctypes.c_uint32 # enum +processor_type_t = c__EA_processor_type_t +processor_type_t__enumvalues = c__EA_processor_type_t__enumvalues # values for enumeration 'c__EA_amdsmi_status_t' c__EA_amdsmi_status_t__enumvalues = { @@ -497,49 +500,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_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), -] - -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), -] - -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 @@ -602,10 +567,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), ] @@ -640,14 +604,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 @@ -667,36 +629,32 @@ struct_c__SA_amdsmi_board_info_t._fields_ = [ ] amdsmi_board_info_t = struct_c__SA_amdsmi_board_info_t -class struct_c__SA_amdsmi_power_measure_t(Structure): +class struct_c__SA_amdsmi_power_info_t(Structure): pass -struct_c__SA_amdsmi_power_measure_t._pack_ = 1 # source:False -struct_c__SA_amdsmi_power_measure_t._fields_ = [ +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), - ('voltage_gfx', ctypes.c_uint32), - ('voltage_soc', ctypes.c_uint32), - ('voltage_mem', ctypes.c_uint32), + ('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_measure_t = struct_c__SA_amdsmi_power_measure_t -class struct_c__SA_amdsmi_clk_measure_t(Structure): +amdsmi_power_info_t = struct_c__SA_amdsmi_power_info_t +class struct_c__SA_amdsmi_clk_info_t(Structure): pass -struct_c__SA_amdsmi_clk_measure_t._pack_ = 1 # source:False -struct_c__SA_amdsmi_clk_measure_t._fields_ = [ +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), ] -amdsmi_clk_measure_t = struct_c__SA_amdsmi_clk_measure_t +amdsmi_clk_info_t = struct_c__SA_amdsmi_clk_info_t class struct_c__SA_amdsmi_engine_usage_t(Structure): pass @@ -704,8 +662,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 @@ -729,10 +687,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 @@ -744,7 +699,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 @@ -899,7 +854,7 @@ class struct_c__SA_amdsmi_evt_notification_data_t(Structure): struct_c__SA_amdsmi_evt_notification_data_t._pack_ = 1 # source:False struct_c__SA_amdsmi_evt_notification_data_t._fields_ = [ - ('device_handle', ctypes.POINTER(None)), + ('processor_handle', ctypes.POINTER(None)), ('event', amdsmi_evt_notification_type_t), ('message', ctypes.c_char * 64), ('PADDING_0', ctypes.c_ubyte * 4), @@ -1411,313 +1366,307 @@ size_t = ctypes.c_uint64 amdsmi_get_socket_info = _libraries['libamd_smi.so'].amdsmi_get_socket_info amdsmi_get_socket_info.restype = amdsmi_status_t amdsmi_get_socket_info.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_char), size_t] -amdsmi_get_device_handles = _libraries['libamd_smi.so'].amdsmi_get_device_handles -amdsmi_get_device_handles.restype = amdsmi_status_t -amdsmi_get_device_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))] -amdsmi_get_device_type = _libraries['libamd_smi.so'].amdsmi_get_device_type -amdsmi_get_device_type.restype = amdsmi_status_t -amdsmi_get_device_type.argtypes = [amdsmi_device_handle, ctypes.POINTER(c__EA_device_type_t)] -amdsmi_get_device_handle_from_bdf = _libraries['libamd_smi.so'].amdsmi_get_device_handle_from_bdf -amdsmi_get_device_handle_from_bdf.restype = amdsmi_status_t -amdsmi_get_device_handle_from_bdf.argtypes = [amdsmi_bdf_t, ctypes.POINTER(ctypes.POINTER(None))] -amdsmi_dev_get_id = _libraries['libamd_smi.so'].amdsmi_dev_get_id -amdsmi_dev_get_id.restype = amdsmi_status_t -amdsmi_dev_get_id.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint16)] -amdsmi_dev_get_vendor_name = _libraries['libamd_smi.so'].amdsmi_dev_get_vendor_name -amdsmi_dev_get_vendor_name.restype = amdsmi_status_t -amdsmi_dev_get_vendor_name.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_char), size_t] +amdsmi_get_processor_handles = _libraries['libamd_smi.so'].amdsmi_get_processor_handles +amdsmi_get_processor_handles.restype = amdsmi_status_t +amdsmi_get_processor_handles.argtypes = [amdsmi_socket_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.POINTER(None))] +amdsmi_get_processor_type = _libraries['libamd_smi.so'].amdsmi_get_processor_type +amdsmi_get_processor_type.restype = amdsmi_status_t +amdsmi_get_processor_type.argtypes = [amdsmi_processor_handle, ctypes.POINTER(c__EA_processor_type_t)] +amdsmi_get_processor_handle_from_bdf = _libraries['libamd_smi.so'].amdsmi_get_processor_handle_from_bdf +amdsmi_get_processor_handle_from_bdf.restype = amdsmi_status_t +amdsmi_get_processor_handle_from_bdf.argtypes = [amdsmi_bdf_t, ctypes.POINTER(ctypes.POINTER(None))] +amdsmi_get_gpu_id = _libraries['libamd_smi.so'].amdsmi_get_gpu_id +amdsmi_get_gpu_id.restype = amdsmi_status_t +amdsmi_get_gpu_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_vendor_name = _libraries['libamd_smi.so'].amdsmi_get_gpu_vendor_name +amdsmi_get_gpu_vendor_name.restype = amdsmi_status_t +amdsmi_get_gpu_vendor_name.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), size_t] uint32_t = ctypes.c_uint32 -amdsmi_dev_get_vram_vendor = _libraries['libamd_smi.so'].amdsmi_dev_get_vram_vendor -amdsmi_dev_get_vram_vendor.restype = amdsmi_status_t -amdsmi_dev_get_vram_vendor.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_char), uint32_t] -amdsmi_dev_get_subsystem_id = _libraries['libamd_smi.so'].amdsmi_dev_get_subsystem_id -amdsmi_dev_get_subsystem_id.restype = amdsmi_status_t -amdsmi_dev_get_subsystem_id.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint16)] -amdsmi_dev_get_subsystem_name = _libraries['libamd_smi.so'].amdsmi_dev_get_subsystem_name -amdsmi_dev_get_subsystem_name.restype = amdsmi_status_t -amdsmi_dev_get_subsystem_name.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_char), size_t] -amdsmi_dev_get_drm_render_minor = _libraries['libamd_smi.so'].amdsmi_dev_get_drm_render_minor -amdsmi_dev_get_drm_render_minor.restype = amdsmi_status_t -amdsmi_dev_get_drm_render_minor.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32)] -amdsmi_dev_get_pci_bandwidth = _libraries['libamd_smi.so'].amdsmi_dev_get_pci_bandwidth -amdsmi_dev_get_pci_bandwidth.restype = amdsmi_status_t -amdsmi_dev_get_pci_bandwidth.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_bandwidth_t)] -amdsmi_dev_get_pci_id = _libraries['libamd_smi.so'].amdsmi_dev_get_pci_id -amdsmi_dev_get_pci_id.restype = amdsmi_status_t -amdsmi_dev_get_pci_id.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_topo_get_numa_affinity = _libraries['libamd_smi.so'].amdsmi_topo_get_numa_affinity -amdsmi_topo_get_numa_affinity.restype = amdsmi_status_t -amdsmi_topo_get_numa_affinity.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32)] -amdsmi_dev_get_pci_throughput = _libraries['libamd_smi.so'].amdsmi_dev_get_pci_throughput -amdsmi_dev_get_pci_throughput.restype = amdsmi_status_t -amdsmi_dev_get_pci_throughput.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_get_pci_replay_counter = _libraries['libamd_smi.so'].amdsmi_dev_get_pci_replay_counter -amdsmi_dev_get_pci_replay_counter.restype = amdsmi_status_t -amdsmi_dev_get_pci_replay_counter.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_set_pci_bandwidth = _libraries['libamd_smi.so'].amdsmi_dev_set_pci_bandwidth -amdsmi_dev_set_pci_bandwidth.restype = amdsmi_status_t -amdsmi_dev_set_pci_bandwidth.argtypes = [amdsmi_device_handle, uint64_t] -amdsmi_dev_get_power_ave = _libraries['libamd_smi.so'].amdsmi_dev_get_power_ave -amdsmi_dev_get_power_ave.restype = amdsmi_status_t -amdsmi_dev_get_power_ave.argtypes = [amdsmi_device_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_get_energy_count = _libraries['libamd_smi.so'].amdsmi_dev_get_energy_count -amdsmi_dev_get_energy_count.restype = amdsmi_status_t -amdsmi_dev_get_energy_count.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_float), ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_set_power_cap = _libraries['libamd_smi.so'].amdsmi_dev_set_power_cap -amdsmi_dev_set_power_cap.restype = amdsmi_status_t -amdsmi_dev_set_power_cap.argtypes = [amdsmi_device_handle, uint32_t, uint64_t] -amdsmi_dev_set_power_profile = _libraries['libamd_smi.so'].amdsmi_dev_set_power_profile -amdsmi_dev_set_power_profile.restype = amdsmi_status_t -amdsmi_dev_set_power_profile.argtypes = [amdsmi_device_handle, uint32_t, amdsmi_power_profile_preset_masks_t] -amdsmi_dev_get_memory_total = _libraries['libamd_smi.so'].amdsmi_dev_get_memory_total -amdsmi_dev_get_memory_total.restype = amdsmi_status_t -amdsmi_dev_get_memory_total.argtypes = [amdsmi_device_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_get_memory_usage = _libraries['libamd_smi.so'].amdsmi_dev_get_memory_usage -amdsmi_dev_get_memory_usage.restype = amdsmi_status_t -amdsmi_dev_get_memory_usage.argtypes = [amdsmi_device_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_get_bad_page_info = _libraries['libamd_smi.so'].amdsmi_get_bad_page_info -amdsmi_get_bad_page_info.restype = amdsmi_status_t -amdsmi_get_bad_page_info.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_retired_page_record_t)] -amdsmi_get_ras_block_features_enabled = _libraries['libamd_smi.so'].amdsmi_get_ras_block_features_enabled -amdsmi_get_ras_block_features_enabled.restype = amdsmi_status_t -amdsmi_get_ras_block_features_enabled.argtypes = [amdsmi_device_handle, amdsmi_gpu_block_t, ctypes.POINTER(c__EA_amdsmi_ras_err_state_t)] -amdsmi_dev_get_memory_busy_percent = _libraries['libamd_smi.so'].amdsmi_dev_get_memory_busy_percent -amdsmi_dev_get_memory_busy_percent.restype = amdsmi_status_t -amdsmi_dev_get_memory_busy_percent.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32)] -amdsmi_dev_get_memory_reserved_pages = _libraries['libamd_smi.so'].amdsmi_dev_get_memory_reserved_pages -amdsmi_dev_get_memory_reserved_pages.restype = amdsmi_status_t -amdsmi_dev_get_memory_reserved_pages.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_retired_page_record_t)] -amdsmi_dev_get_fan_rpms = _libraries['libamd_smi.so'].amdsmi_dev_get_fan_rpms -amdsmi_dev_get_fan_rpms.restype = amdsmi_status_t -amdsmi_dev_get_fan_rpms.argtypes = [amdsmi_device_handle, uint32_t, ctypes.POINTER(ctypes.c_int64)] -amdsmi_dev_get_fan_speed = _libraries['libamd_smi.so'].amdsmi_dev_get_fan_speed -amdsmi_dev_get_fan_speed.restype = amdsmi_status_t -amdsmi_dev_get_fan_speed.argtypes = [amdsmi_device_handle, uint32_t, ctypes.POINTER(ctypes.c_int64)] -amdsmi_dev_get_fan_speed_max = _libraries['libamd_smi.so'].amdsmi_dev_get_fan_speed_max -amdsmi_dev_get_fan_speed_max.restype = amdsmi_status_t -amdsmi_dev_get_fan_speed_max.argtypes = [amdsmi_device_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_get_temp_metric = _libraries['libamd_smi.so'].amdsmi_dev_get_temp_metric -amdsmi_dev_get_temp_metric.restype = amdsmi_status_t -amdsmi_dev_get_temp_metric.argtypes = [amdsmi_device_handle, amdsmi_temperature_type_t, amdsmi_temperature_metric_t, ctypes.POINTER(ctypes.c_int64)] -amdsmi_dev_get_volt_metric = _libraries['libamd_smi.so'].amdsmi_dev_get_volt_metric -amdsmi_dev_get_volt_metric.restype = amdsmi_status_t -amdsmi_dev_get_volt_metric.argtypes = [amdsmi_device_handle, amdsmi_voltage_type_t, amdsmi_voltage_metric_t, ctypes.POINTER(ctypes.c_int64)] -amdsmi_dev_reset_fan = _libraries['libamd_smi.so'].amdsmi_dev_reset_fan -amdsmi_dev_reset_fan.restype = amdsmi_status_t -amdsmi_dev_reset_fan.argtypes = [amdsmi_device_handle, uint32_t] -amdsmi_dev_set_fan_speed = _libraries['libamd_smi.so'].amdsmi_dev_set_fan_speed -amdsmi_dev_set_fan_speed.restype = amdsmi_status_t -amdsmi_dev_set_fan_speed.argtypes = [amdsmi_device_handle, uint32_t, uint64_t] -amdsmi_dev_get_busy_percent = _libraries['libamd_smi.so'].amdsmi_dev_get_busy_percent -amdsmi_dev_get_busy_percent.restype = amdsmi_status_t -amdsmi_dev_get_busy_percent.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_vram_vendor = _libraries['libamd_smi.so'].amdsmi_get_gpu_vram_vendor +amdsmi_get_gpu_vram_vendor.restype = amdsmi_status_t +amdsmi_get_gpu_vram_vendor.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), uint32_t] +amdsmi_get_gpu_subsystem_id = _libraries['libamd_smi.so'].amdsmi_get_gpu_subsystem_id +amdsmi_get_gpu_subsystem_id.restype = amdsmi_status_t +amdsmi_get_gpu_subsystem_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint16)] +amdsmi_get_gpu_subsystem_name = _libraries['libamd_smi.so'].amdsmi_get_gpu_subsystem_name +amdsmi_get_gpu_subsystem_name.restype = amdsmi_status_t +amdsmi_get_gpu_subsystem_name.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_char), size_t] +amdsmi_get_gpu_drm_render_minor = _libraries['libamd_smi.so'].amdsmi_get_gpu_drm_render_minor +amdsmi_get_gpu_drm_render_minor.restype = amdsmi_status_t +amdsmi_get_gpu_drm_render_minor.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_pci_bandwidth = _libraries['libamd_smi.so'].amdsmi_get_gpu_pci_bandwidth +amdsmi_get_gpu_pci_bandwidth.restype = amdsmi_status_t +amdsmi_get_gpu_pci_bandwidth.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_bandwidth_t)] +amdsmi_get_gpu_pci_id = _libraries['libamd_smi.so'].amdsmi_get_gpu_pci_id +amdsmi_get_gpu_pci_id.restype = amdsmi_status_t +amdsmi_get_gpu_pci_id.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_topo_numa_affinity = _libraries['libamd_smi.so'].amdsmi_get_gpu_topo_numa_affinity +amdsmi_get_gpu_topo_numa_affinity.restype = amdsmi_status_t +amdsmi_get_gpu_topo_numa_affinity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_pci_throughput = _libraries['libamd_smi.so'].amdsmi_get_gpu_pci_throughput +amdsmi_get_gpu_pci_throughput.restype = amdsmi_status_t +amdsmi_get_gpu_pci_throughput.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_pci_replay_counter = _libraries['libamd_smi.so'].amdsmi_get_gpu_pci_replay_counter +amdsmi_get_gpu_pci_replay_counter.restype = amdsmi_status_t +amdsmi_get_gpu_pci_replay_counter.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +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_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)] +amdsmi_set_power_cap = _libraries['libamd_smi.so'].amdsmi_set_power_cap +amdsmi_set_power_cap.restype = amdsmi_status_t +amdsmi_set_power_cap.argtypes = [amdsmi_processor_handle, uint32_t, uint64_t] +amdsmi_set_gpu_power_profile = _libraries['libamd_smi.so'].amdsmi_set_gpu_power_profile +amdsmi_set_gpu_power_profile.restype = amdsmi_status_t +amdsmi_set_gpu_power_profile.argtypes = [amdsmi_processor_handle, uint32_t, amdsmi_power_profile_preset_masks_t] +amdsmi_get_gpu_memory_total = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_total +amdsmi_get_gpu_memory_total.restype = amdsmi_status_t +amdsmi_get_gpu_memory_total.argtypes = [amdsmi_processor_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_memory_usage = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_usage +amdsmi_get_gpu_memory_usage.restype = amdsmi_status_t +amdsmi_get_gpu_memory_usage.argtypes = [amdsmi_processor_handle, amdsmi_memory_type_t, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_bad_page_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_bad_page_info +amdsmi_get_gpu_bad_page_info.restype = amdsmi_status_t +amdsmi_get_gpu_bad_page_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_retired_page_record_t)] +amdsmi_get_gpu_ras_block_features_enabled = _libraries['libamd_smi.so'].amdsmi_get_gpu_ras_block_features_enabled +amdsmi_get_gpu_ras_block_features_enabled.restype = amdsmi_status_t +amdsmi_get_gpu_ras_block_features_enabled.argtypes = [amdsmi_processor_handle, amdsmi_gpu_block_t, ctypes.POINTER(c__EA_amdsmi_ras_err_state_t)] +amdsmi_get_gpu_memory_busy_percent = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_busy_percent +amdsmi_get_gpu_memory_busy_percent.restype = amdsmi_status_t +amdsmi_get_gpu_memory_busy_percent.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_memory_reserved_pages = _libraries['libamd_smi.so'].amdsmi_get_gpu_memory_reserved_pages +amdsmi_get_gpu_memory_reserved_pages.restype = amdsmi_status_t +amdsmi_get_gpu_memory_reserved_pages.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_retired_page_record_t)] +amdsmi_get_gpu_fan_rpms = _libraries['libamd_smi.so'].amdsmi_get_gpu_fan_rpms +amdsmi_get_gpu_fan_rpms.restype = amdsmi_status_t +amdsmi_get_gpu_fan_rpms.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_int64)] +amdsmi_get_gpu_fan_speed = _libraries['libamd_smi.so'].amdsmi_get_gpu_fan_speed +amdsmi_get_gpu_fan_speed.restype = amdsmi_status_t +amdsmi_get_gpu_fan_speed.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_int64)] +amdsmi_get_gpu_fan_speed_max = _libraries['libamd_smi.so'].amdsmi_get_gpu_fan_speed_max +amdsmi_get_gpu_fan_speed_max.restype = amdsmi_status_t +amdsmi_get_gpu_fan_speed_max.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_temp_metric = _libraries['libamd_smi.so'].amdsmi_get_temp_metric +amdsmi_get_temp_metric.restype = amdsmi_status_t +amdsmi_get_temp_metric.argtypes = [amdsmi_processor_handle, amdsmi_temperature_type_t, amdsmi_temperature_metric_t, ctypes.POINTER(ctypes.c_int64)] +amdsmi_get_gpu_volt_metric = _libraries['libamd_smi.so'].amdsmi_get_gpu_volt_metric +amdsmi_get_gpu_volt_metric.restype = amdsmi_status_t +amdsmi_get_gpu_volt_metric.argtypes = [amdsmi_processor_handle, amdsmi_voltage_type_t, amdsmi_voltage_metric_t, ctypes.POINTER(ctypes.c_int64)] +amdsmi_reset_gpu_fan = _libraries['libamd_smi.so'].amdsmi_reset_gpu_fan +amdsmi_reset_gpu_fan.restype = amdsmi_status_t +amdsmi_reset_gpu_fan.argtypes = [amdsmi_processor_handle, uint32_t] +amdsmi_set_gpu_fan_speed = _libraries['libamd_smi.so'].amdsmi_set_gpu_fan_speed +amdsmi_set_gpu_fan_speed.restype = amdsmi_status_t +amdsmi_set_gpu_fan_speed.argtypes = [amdsmi_processor_handle, uint32_t, uint64_t] +amdsmi_get_busy_percent = _libraries['libamd_smi.so'].amdsmi_get_busy_percent +amdsmi_get_busy_percent.restype = amdsmi_status_t +amdsmi_get_busy_percent.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] amdsmi_get_utilization_count = _libraries['libamd_smi.so'].amdsmi_get_utilization_count amdsmi_get_utilization_count.restype = amdsmi_status_t -amdsmi_get_utilization_count.argtypes = [amdsmi_device_handle, struct_c__SA_amdsmi_utilization_counter_t * 0, uint32_t, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_utilization_count.argtypes = [amdsmi_processor_handle, struct_c__SA_amdsmi_utilization_counter_t * 0, uint32_t, ctypes.POINTER(ctypes.c_uint64)] amdsmi_get_pcie_link_status = _libraries['libamd_smi.so'].amdsmi_get_pcie_link_status amdsmi_get_pcie_link_status.restype = amdsmi_status_t -amdsmi_get_pcie_link_status.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_info_t)] +amdsmi_get_pcie_link_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_info_t)] amdsmi_get_pcie_link_caps = _libraries['libamd_smi.so'].amdsmi_get_pcie_link_caps amdsmi_get_pcie_link_caps.restype = amdsmi_status_t -amdsmi_get_pcie_link_caps.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_info_t)] -amdsmi_dev_get_perf_level = _libraries['libamd_smi.so'].amdsmi_dev_get_perf_level -amdsmi_dev_get_perf_level.restype = amdsmi_status_t -amdsmi_dev_get_perf_level.argtypes = [amdsmi_device_handle, ctypes.POINTER(c__EA_amdsmi_dev_perf_level_t)] -amdsmi_set_perf_determinism_mode = _libraries['libamd_smi.so'].amdsmi_set_perf_determinism_mode -amdsmi_set_perf_determinism_mode.restype = amdsmi_status_t -amdsmi_set_perf_determinism_mode.argtypes = [amdsmi_device_handle, uint64_t] -amdsmi_dev_get_overdrive_level = _libraries['libamd_smi.so'].amdsmi_dev_get_overdrive_level -amdsmi_dev_get_overdrive_level.restype = amdsmi_status_t -amdsmi_dev_get_overdrive_level.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32)] -amdsmi_dev_get_gpu_clk_freq = _libraries['libamd_smi.so'].amdsmi_dev_get_gpu_clk_freq -amdsmi_dev_get_gpu_clk_freq.restype = amdsmi_status_t -amdsmi_dev_get_gpu_clk_freq.argtypes = [amdsmi_device_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_frequencies_t)] -amdsmi_dev_reset_gpu = _libraries['libamd_smi.so'].amdsmi_dev_reset_gpu -amdsmi_dev_reset_gpu.restype = amdsmi_status_t -amdsmi_dev_reset_gpu.argtypes = [amdsmi_device_handle] -amdsmi_dev_get_od_volt_info = _libraries['libamd_smi.so'].amdsmi_dev_get_od_volt_info -amdsmi_dev_get_od_volt_info.restype = amdsmi_status_t -amdsmi_dev_get_od_volt_info.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_od_volt_freq_data_t)] -amdsmi_dev_get_gpu_metrics_info = _libraries['libamd_smi.so'].amdsmi_dev_get_gpu_metrics_info -amdsmi_dev_get_gpu_metrics_info.restype = amdsmi_status_t -amdsmi_dev_get_gpu_metrics_info.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_gpu_metrics_t)] -amdsmi_dev_set_clk_range = _libraries['libamd_smi.so'].amdsmi_dev_set_clk_range -amdsmi_dev_set_clk_range.restype = amdsmi_status_t -amdsmi_dev_set_clk_range.argtypes = [amdsmi_device_handle, uint64_t, uint64_t, amdsmi_clk_type_t] -amdsmi_dev_set_od_clk_info = _libraries['libamd_smi.so'].amdsmi_dev_set_od_clk_info -amdsmi_dev_set_od_clk_info.restype = amdsmi_status_t -amdsmi_dev_set_od_clk_info.argtypes = [amdsmi_device_handle, amdsmi_freq_ind_t, uint64_t, amdsmi_clk_type_t] -amdsmi_dev_set_od_volt_info = _libraries['libamd_smi.so'].amdsmi_dev_set_od_volt_info -amdsmi_dev_set_od_volt_info.restype = amdsmi_status_t -amdsmi_dev_set_od_volt_info.argtypes = [amdsmi_device_handle, uint32_t, uint64_t, uint64_t] -amdsmi_dev_get_od_volt_curve_regions = _libraries['libamd_smi.so'].amdsmi_dev_get_od_volt_curve_regions -amdsmi_dev_get_od_volt_curve_regions.restype = amdsmi_status_t -amdsmi_dev_get_od_volt_curve_regions.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_freq_volt_region_t)] -amdsmi_dev_get_power_profile_presets = _libraries['libamd_smi.so'].amdsmi_dev_get_power_profile_presets -amdsmi_dev_get_power_profile_presets.restype = amdsmi_status_t -amdsmi_dev_get_power_profile_presets.argtypes = [amdsmi_device_handle, uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_power_profile_status_t)] -amdsmi_dev_set_perf_level = _libraries['libamd_smi.so'].amdsmi_dev_set_perf_level -amdsmi_dev_set_perf_level.restype = amdsmi_status_t -amdsmi_dev_set_perf_level.argtypes = [amdsmi_device_handle, amdsmi_dev_perf_level_t] -amdsmi_dev_set_perf_level_v1 = _libraries['libamd_smi.so'].amdsmi_dev_set_perf_level_v1 -amdsmi_dev_set_perf_level_v1.restype = amdsmi_status_t -amdsmi_dev_set_perf_level_v1.argtypes = [amdsmi_device_handle, amdsmi_dev_perf_level_t] -amdsmi_dev_set_overdrive_level = _libraries['libamd_smi.so'].amdsmi_dev_set_overdrive_level -amdsmi_dev_set_overdrive_level.restype = amdsmi_status_t -amdsmi_dev_set_overdrive_level.argtypes = [amdsmi_device_handle, uint32_t] -amdsmi_dev_set_overdrive_level_v1 = _libraries['libamd_smi.so'].amdsmi_dev_set_overdrive_level_v1 -amdsmi_dev_set_overdrive_level_v1.restype = amdsmi_status_t -amdsmi_dev_set_overdrive_level_v1.argtypes = [amdsmi_device_handle, uint32_t] -amdsmi_dev_set_clk_freq = _libraries['libamd_smi.so'].amdsmi_dev_set_clk_freq -amdsmi_dev_set_clk_freq.restype = amdsmi_status_t -amdsmi_dev_set_clk_freq.argtypes = [amdsmi_device_handle, amdsmi_clk_type_t, uint64_t] +amdsmi_get_pcie_link_caps.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_pcie_info_t)] +amdsmi_get_gpu_perf_level = _libraries['libamd_smi.so'].amdsmi_get_gpu_perf_level +amdsmi_get_gpu_perf_level.restype = amdsmi_status_t +amdsmi_get_gpu_perf_level.argtypes = [amdsmi_processor_handle, ctypes.POINTER(c__EA_amdsmi_dev_perf_level_t)] +amdsmi_set_gpu_perf_determinism_mode = _libraries['libamd_smi.so'].amdsmi_set_gpu_perf_determinism_mode +amdsmi_set_gpu_perf_determinism_mode.restype = amdsmi_status_t +amdsmi_set_gpu_perf_determinism_mode.argtypes = [amdsmi_processor_handle, uint64_t] +amdsmi_get_gpu_overdrive_level = _libraries['libamd_smi.so'].amdsmi_get_gpu_overdrive_level +amdsmi_get_gpu_overdrive_level.restype = amdsmi_status_t +amdsmi_get_gpu_overdrive_level.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_clk_freq = _libraries['libamd_smi.so'].amdsmi_get_clk_freq +amdsmi_get_clk_freq.restype = amdsmi_status_t +amdsmi_get_clk_freq.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_frequencies_t)] +amdsmi_reset_gpu = _libraries['libamd_smi.so'].amdsmi_reset_gpu +amdsmi_reset_gpu.restype = amdsmi_status_t +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_c__SA_amdsmi_od_volt_freq_data_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_c__SA_amdsmi_gpu_metrics_t)] +amdsmi_set_gpu_clk_range = _libraries['libamd_smi.so'].amdsmi_set_gpu_clk_range +amdsmi_set_gpu_clk_range.restype = amdsmi_status_t +amdsmi_set_gpu_clk_range.argtypes = [amdsmi_processor_handle, uint64_t, uint64_t, amdsmi_clk_type_t] +amdsmi_set_gpu_od_clk_info = _libraries['libamd_smi.so'].amdsmi_set_gpu_od_clk_info +amdsmi_set_gpu_od_clk_info.restype = amdsmi_status_t +amdsmi_set_gpu_od_clk_info.argtypes = [amdsmi_processor_handle, amdsmi_freq_ind_t, uint64_t, amdsmi_clk_type_t] +amdsmi_set_gpu_od_volt_info = _libraries['libamd_smi.so'].amdsmi_set_gpu_od_volt_info +amdsmi_set_gpu_od_volt_info.restype = amdsmi_status_t +amdsmi_set_gpu_od_volt_info.argtypes = [amdsmi_processor_handle, uint32_t, uint64_t, uint64_t] +amdsmi_get_gpu_od_volt_curve_regions = _libraries['libamd_smi.so'].amdsmi_get_gpu_od_volt_curve_regions +amdsmi_get_gpu_od_volt_curve_regions.restype = amdsmi_status_t +amdsmi_get_gpu_od_volt_curve_regions.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_freq_volt_region_t)] +amdsmi_get_gpu_power_profile_presets = _libraries['libamd_smi.so'].amdsmi_get_gpu_power_profile_presets +amdsmi_get_gpu_power_profile_presets.restype = amdsmi_status_t +amdsmi_get_gpu_power_profile_presets.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_power_profile_status_t)] +amdsmi_set_gpu_perf_level = _libraries['libamd_smi.so'].amdsmi_set_gpu_perf_level +amdsmi_set_gpu_perf_level.restype = amdsmi_status_t +amdsmi_set_gpu_perf_level.argtypes = [amdsmi_processor_handle, amdsmi_dev_perf_level_t] +amdsmi_set_gpu_perf_level_v1 = _libraries['libamd_smi.so'].amdsmi_set_gpu_perf_level_v1 +amdsmi_set_gpu_perf_level_v1.restype = amdsmi_status_t +amdsmi_set_gpu_perf_level_v1.argtypes = [amdsmi_processor_handle, amdsmi_dev_perf_level_t] +amdsmi_set_gpu_overdrive_level = _libraries['libamd_smi.so'].amdsmi_set_gpu_overdrive_level +amdsmi_set_gpu_overdrive_level.restype = amdsmi_status_t +amdsmi_set_gpu_overdrive_level.argtypes = [amdsmi_processor_handle, uint32_t] +amdsmi_set_gpu_overdrive_level_v1 = _libraries['libamd_smi.so'].amdsmi_set_gpu_overdrive_level_v1 +amdsmi_set_gpu_overdrive_level_v1.restype = amdsmi_status_t +amdsmi_set_gpu_overdrive_level_v1.argtypes = [amdsmi_processor_handle, uint32_t] +amdsmi_set_clk_freq = _libraries['libamd_smi.so'].amdsmi_set_clk_freq +amdsmi_set_clk_freq.restype = amdsmi_status_t +amdsmi_set_clk_freq.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, uint64_t] amdsmi_get_version = _libraries['libamd_smi.so'].amdsmi_get_version amdsmi_get_version.restype = amdsmi_status_t amdsmi_get_version.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_version_t)] amdsmi_get_version_str = _libraries['libamd_smi.so'].amdsmi_get_version_str amdsmi_get_version_str.restype = amdsmi_status_t amdsmi_get_version_str.argtypes = [amdsmi_sw_component_t, ctypes.POINTER(ctypes.c_char), uint32_t] -amdsmi_dev_get_ecc_count = _libraries['libamd_smi.so'].amdsmi_dev_get_ecc_count -amdsmi_dev_get_ecc_count.restype = amdsmi_status_t -amdsmi_dev_get_ecc_count.argtypes = [amdsmi_device_handle, amdsmi_gpu_block_t, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] -amdsmi_dev_get_ecc_enabled = _libraries['libamd_smi.so'].amdsmi_dev_get_ecc_enabled -amdsmi_dev_get_ecc_enabled.restype = amdsmi_status_t -amdsmi_dev_get_ecc_enabled.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_get_ecc_status = _libraries['libamd_smi.so'].amdsmi_dev_get_ecc_status -amdsmi_dev_get_ecc_status.restype = amdsmi_status_t -amdsmi_dev_get_ecc_status.argtypes = [amdsmi_device_handle, amdsmi_gpu_block_t, ctypes.POINTER(c__EA_amdsmi_ras_err_state_t)] +amdsmi_get_gpu_ecc_count = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_count +amdsmi_get_gpu_ecc_count.restype = amdsmi_status_t +amdsmi_get_gpu_ecc_count.argtypes = [amdsmi_processor_handle, amdsmi_gpu_block_t, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] +amdsmi_get_gpu_ecc_enabled = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_enabled +amdsmi_get_gpu_ecc_enabled.restype = amdsmi_status_t +amdsmi_get_gpu_ecc_enabled.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_gpu_ecc_status = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_status +amdsmi_get_gpu_ecc_status.restype = amdsmi_status_t +amdsmi_get_gpu_ecc_status.argtypes = [amdsmi_processor_handle, amdsmi_gpu_block_t, ctypes.POINTER(c__EA_amdsmi_ras_err_state_t)] amdsmi_status_string = _libraries['libamd_smi.so'].amdsmi_status_string amdsmi_status_string.restype = amdsmi_status_t amdsmi_status_string.argtypes = [amdsmi_status_t, ctypes.POINTER(ctypes.POINTER(ctypes.c_char))] -amdsmi_dev_counter_group_supported = _libraries['libamd_smi.so'].amdsmi_dev_counter_group_supported -amdsmi_dev_counter_group_supported.restype = amdsmi_status_t -amdsmi_dev_counter_group_supported.argtypes = [amdsmi_device_handle, amdsmi_event_group_t] -amdsmi_dev_create_counter = _libraries['libamd_smi.so'].amdsmi_dev_create_counter -amdsmi_dev_create_counter.restype = amdsmi_status_t -amdsmi_dev_create_counter.argtypes = [amdsmi_device_handle, amdsmi_event_type_t, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_destroy_counter = _libraries['libamd_smi.so'].amdsmi_dev_destroy_counter -amdsmi_dev_destroy_counter.restype = amdsmi_status_t -amdsmi_dev_destroy_counter.argtypes = [amdsmi_event_handle_t] -amdsmi_control_counter = _libraries['libamd_smi.so'].amdsmi_control_counter -amdsmi_control_counter.restype = amdsmi_status_t -amdsmi_control_counter.argtypes = [amdsmi_event_handle_t, amdsmi_counter_command_t, ctypes.POINTER(None)] -amdsmi_read_counter = _libraries['libamd_smi.so'].amdsmi_read_counter -amdsmi_read_counter.restype = amdsmi_status_t -amdsmi_read_counter.argtypes = [amdsmi_event_handle_t, ctypes.POINTER(struct_c__SA_amdsmi_counter_value_t)] -amdsmi_counter_get_available_counters = _libraries['libamd_smi.so'].amdsmi_counter_get_available_counters -amdsmi_counter_get_available_counters.restype = amdsmi_status_t -amdsmi_counter_get_available_counters.argtypes = [amdsmi_device_handle, amdsmi_event_group_t, ctypes.POINTER(ctypes.c_uint32)] -amdsmi_get_compute_process_info = _libraries['libamd_smi.so'].amdsmi_get_compute_process_info -amdsmi_get_compute_process_info.restype = amdsmi_status_t -amdsmi_get_compute_process_info.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_process_info_t), ctypes.POINTER(ctypes.c_uint32)] -amdsmi_get_compute_process_info_by_pid = _libraries['libamd_smi.so'].amdsmi_get_compute_process_info_by_pid -amdsmi_get_compute_process_info_by_pid.restype = amdsmi_status_t -amdsmi_get_compute_process_info_by_pid.argtypes = [uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_process_info_t)] -amdsmi_get_compute_process_gpus = _libraries['libamd_smi.so'].amdsmi_get_compute_process_gpus -amdsmi_get_compute_process_gpus.restype = amdsmi_status_t -amdsmi_get_compute_process_gpus.argtypes = [uint32_t, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)] -amdsmi_dev_xgmi_error_status = _libraries['libamd_smi.so'].amdsmi_dev_xgmi_error_status -amdsmi_dev_xgmi_error_status.restype = amdsmi_status_t -amdsmi_dev_xgmi_error_status.argtypes = [amdsmi_device_handle, ctypes.POINTER(c__EA_amdsmi_xgmi_status_t)] -amdsmi_dev_reset_xgmi_error = _libraries['libamd_smi.so'].amdsmi_dev_reset_xgmi_error -amdsmi_dev_reset_xgmi_error.restype = amdsmi_status_t -amdsmi_dev_reset_xgmi_error.argtypes = [amdsmi_device_handle] +amdsmi_gpu_counter_group_supported = _libraries['libamd_smi.so'].amdsmi_gpu_counter_group_supported +amdsmi_gpu_counter_group_supported.restype = amdsmi_status_t +amdsmi_gpu_counter_group_supported.argtypes = [amdsmi_processor_handle, amdsmi_event_group_t] +amdsmi_gpu_create_counter = _libraries['libamd_smi.so'].amdsmi_gpu_create_counter +amdsmi_gpu_create_counter.restype = amdsmi_status_t +amdsmi_gpu_create_counter.argtypes = [amdsmi_processor_handle, amdsmi_event_type_t, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_gpu_destroy_counter = _libraries['libamd_smi.so'].amdsmi_gpu_destroy_counter +amdsmi_gpu_destroy_counter.restype = amdsmi_status_t +amdsmi_gpu_destroy_counter.argtypes = [amdsmi_event_handle_t] +amdsmi_gpu_control_counter = _libraries['libamd_smi.so'].amdsmi_gpu_control_counter +amdsmi_gpu_control_counter.restype = amdsmi_status_t +amdsmi_gpu_control_counter.argtypes = [amdsmi_event_handle_t, amdsmi_counter_command_t, ctypes.POINTER(None)] +amdsmi_gpu_read_counter = _libraries['libamd_smi.so'].amdsmi_gpu_read_counter +amdsmi_gpu_read_counter.restype = amdsmi_status_t +amdsmi_gpu_read_counter.argtypes = [amdsmi_event_handle_t, ctypes.POINTER(struct_c__SA_amdsmi_counter_value_t)] +amdsmi_get_gpu_available_counters = _libraries['libamd_smi.so'].amdsmi_get_gpu_available_counters +amdsmi_get_gpu_available_counters.restype = amdsmi_status_t +amdsmi_get_gpu_available_counters.argtypes = [amdsmi_processor_handle, amdsmi_event_group_t, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_compute_process_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_compute_process_info +amdsmi_get_gpu_compute_process_info.restype = amdsmi_status_t +amdsmi_get_gpu_compute_process_info.argtypes = [ctypes.POINTER(struct_c__SA_amdsmi_process_info_t), ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_compute_process_info_by_pid = _libraries['libamd_smi.so'].amdsmi_get_gpu_compute_process_info_by_pid +amdsmi_get_gpu_compute_process_info_by_pid.restype = amdsmi_status_t +amdsmi_get_gpu_compute_process_info_by_pid.argtypes = [uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_process_info_t)] +amdsmi_get_gpu_compute_process_gpus = _libraries['libamd_smi.so'].amdsmi_get_gpu_compute_process_gpus +amdsmi_get_gpu_compute_process_gpus.restype = amdsmi_status_t +amdsmi_get_gpu_compute_process_gpus.argtypes = [uint32_t, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)] +amdsmi_gpu_xgmi_error_status = _libraries['libamd_smi.so'].amdsmi_gpu_xgmi_error_status +amdsmi_gpu_xgmi_error_status.restype = amdsmi_status_t +amdsmi_gpu_xgmi_error_status.argtypes = [amdsmi_processor_handle, ctypes.POINTER(c__EA_amdsmi_xgmi_status_t)] +amdsmi_reset_gpu_xgmi_error = _libraries['libamd_smi.so'].amdsmi_reset_gpu_xgmi_error +amdsmi_reset_gpu_xgmi_error.restype = amdsmi_status_t +amdsmi_reset_gpu_xgmi_error.argtypes = [amdsmi_processor_handle] amdsmi_topo_get_numa_node_number = _libraries['libamd_smi.so'].amdsmi_topo_get_numa_node_number amdsmi_topo_get_numa_node_number.restype = amdsmi_status_t -amdsmi_topo_get_numa_node_number.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32)] +amdsmi_topo_get_numa_node_number.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] amdsmi_topo_get_link_weight = _libraries['libamd_smi.so'].amdsmi_topo_get_link_weight amdsmi_topo_get_link_weight.restype = amdsmi_status_t -amdsmi_topo_get_link_weight.argtypes = [amdsmi_device_handle, amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64)] +amdsmi_topo_get_link_weight.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64)] amdsmi_get_minmax_bandwidth = _libraries['libamd_smi.so'].amdsmi_get_minmax_bandwidth amdsmi_get_minmax_bandwidth.restype = amdsmi_status_t -amdsmi_get_minmax_bandwidth.argtypes = [amdsmi_device_handle, amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] +amdsmi_get_minmax_bandwidth.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint64)] amdsmi_topo_get_link_type = _libraries['libamd_smi.so'].amdsmi_topo_get_link_type amdsmi_topo_get_link_type.restype = amdsmi_status_t -amdsmi_topo_get_link_type.argtypes = [amdsmi_device_handle, amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(c__EA_AMDSMI_IO_LINK_TYPE)] +amdsmi_topo_get_link_type.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(c__EA_AMDSMI_IO_LINK_TYPE)] amdsmi_is_P2P_accessible = _libraries['libamd_smi.so'].amdsmi_is_P2P_accessible amdsmi_is_P2P_accessible.restype = amdsmi_status_t -amdsmi_is_P2P_accessible.argtypes = [amdsmi_device_handle, amdsmi_device_handle, ctypes.POINTER(ctypes.c_bool)] -amdsmi_dev_open_supported_func_iterator = _libraries['libamd_smi.so'].amdsmi_dev_open_supported_func_iterator -amdsmi_dev_open_supported_func_iterator.restype = amdsmi_status_t -amdsmi_dev_open_supported_func_iterator.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] -amdsmi_dev_open_supported_variant_iterator = _libraries['libamd_smi.so'].amdsmi_dev_open_supported_variant_iterator -amdsmi_dev_open_supported_variant_iterator.restype = amdsmi_status_t -amdsmi_dev_open_supported_variant_iterator.argtypes = [amdsmi_func_id_iter_handle_t, ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] +amdsmi_is_P2P_accessible.argtypes = [amdsmi_processor_handle, amdsmi_processor_handle, ctypes.POINTER(ctypes.c_bool)] +amdsmi_open_supported_func_iterator = _libraries['libamd_smi.so'].amdsmi_open_supported_func_iterator +amdsmi_open_supported_func_iterator.restype = amdsmi_status_t +amdsmi_open_supported_func_iterator.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] +amdsmi_open_supported_variant_iterator = _libraries['libamd_smi.so'].amdsmi_open_supported_variant_iterator +amdsmi_open_supported_variant_iterator.restype = amdsmi_status_t +amdsmi_open_supported_variant_iterator.argtypes = [amdsmi_func_id_iter_handle_t, ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] amdsmi_next_func_iter = _libraries['libamd_smi.so'].amdsmi_next_func_iter amdsmi_next_func_iter.restype = amdsmi_status_t amdsmi_next_func_iter.argtypes = [amdsmi_func_id_iter_handle_t] -amdsmi_dev_close_supported_func_iterator = _libraries['libamd_smi.so'].amdsmi_dev_close_supported_func_iterator -amdsmi_dev_close_supported_func_iterator.restype = amdsmi_status_t -amdsmi_dev_close_supported_func_iterator.argtypes = [ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] +amdsmi_close_supported_func_iterator = _libraries['libamd_smi.so'].amdsmi_close_supported_func_iterator +amdsmi_close_supported_func_iterator.restype = amdsmi_status_t +amdsmi_close_supported_func_iterator.argtypes = [ctypes.POINTER(ctypes.POINTER(struct_amdsmi_func_id_iter_handle))] amdsmi_get_func_iter_value = _libraries['libamd_smi.so'].amdsmi_get_func_iter_value amdsmi_get_func_iter_value.restype = amdsmi_status_t amdsmi_get_func_iter_value.argtypes = [amdsmi_func_id_iter_handle_t, ctypes.POINTER(union_c__UA_amdsmi_func_id_value_t)] -amdsmi_init_event_notification = _libraries['libamd_smi.so'].amdsmi_init_event_notification -amdsmi_init_event_notification.restype = amdsmi_status_t -amdsmi_init_event_notification.argtypes = [amdsmi_device_handle] -amdsmi_set_event_notification_mask = _libraries['libamd_smi.so'].amdsmi_set_event_notification_mask -amdsmi_set_event_notification_mask.restype = amdsmi_status_t -amdsmi_set_event_notification_mask.argtypes = [amdsmi_device_handle, uint64_t] -amdsmi_get_event_notification = _libraries['libamd_smi.so'].amdsmi_get_event_notification -amdsmi_get_event_notification.restype = amdsmi_status_t -amdsmi_get_event_notification.argtypes = [ctypes.c_int32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_evt_notification_data_t)] -amdsmi_stop_event_notification = _libraries['libamd_smi.so'].amdsmi_stop_event_notification -amdsmi_stop_event_notification.restype = amdsmi_status_t -amdsmi_stop_event_notification.argtypes = [amdsmi_device_handle] -amdsmi_get_device_bdf = _libraries['libamd_smi.so'].amdsmi_get_device_bdf -amdsmi_get_device_bdf.restype = amdsmi_status_t -amdsmi_get_device_bdf.argtypes = [amdsmi_device_handle, ctypes.POINTER(union_c__UA_amdsmi_bdf_t)] -amdsmi_get_device_uuid = _libraries['libamd_smi.so'].amdsmi_get_device_uuid -amdsmi_get_device_uuid.restype = amdsmi_status_t -amdsmi_get_device_uuid.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_char)] -amdsmi_get_driver_version = _libraries['libamd_smi.so'].amdsmi_get_driver_version -amdsmi_get_driver_version.restype = amdsmi_status_t -amdsmi_get_driver_version.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_char)] -amdsmi_get_asic_info = _libraries['libamd_smi.so'].amdsmi_get_asic_info -amdsmi_get_asic_info.restype = amdsmi_status_t -amdsmi_get_asic_info.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_asic_info_t)] -amdsmi_get_board_info = _libraries['libamd_smi.so'].amdsmi_get_board_info -amdsmi_get_board_info.restype = amdsmi_status_t -amdsmi_get_board_info.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_board_info_t)] +amdsmi_init_gpu_event_notification = _libraries['libamd_smi.so'].amdsmi_init_gpu_event_notification +amdsmi_init_gpu_event_notification.restype = amdsmi_status_t +amdsmi_init_gpu_event_notification.argtypes = [amdsmi_processor_handle] +amdsmi_set_gpu_event_notification_mask = _libraries['libamd_smi.so'].amdsmi_set_gpu_event_notification_mask +amdsmi_set_gpu_event_notification_mask.restype = amdsmi_status_t +amdsmi_set_gpu_event_notification_mask.argtypes = [amdsmi_processor_handle, uint64_t] +amdsmi_get_gpu_event_notification = _libraries['libamd_smi.so'].amdsmi_get_gpu_event_notification +amdsmi_get_gpu_event_notification.restype = amdsmi_status_t +amdsmi_get_gpu_event_notification.argtypes = [ctypes.c_int32, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(struct_c__SA_amdsmi_evt_notification_data_t)] +amdsmi_stop_gpu_event_notification = _libraries['libamd_smi.so'].amdsmi_stop_gpu_event_notification +amdsmi_stop_gpu_event_notification.restype = amdsmi_status_t +amdsmi_stop_gpu_event_notification.argtypes = [amdsmi_processor_handle] +amdsmi_get_gpu_device_bdf = _libraries['libamd_smi.so'].amdsmi_get_gpu_device_bdf +amdsmi_get_gpu_device_bdf.restype = amdsmi_status_t +amdsmi_get_gpu_device_bdf.argtypes = [amdsmi_processor_handle, ctypes.POINTER(union_c__UA_amdsmi_bdf_t)] +amdsmi_get_gpu_device_uuid = _libraries['libamd_smi.so'].amdsmi_get_gpu_device_uuid +amdsmi_get_gpu_device_uuid.restype = amdsmi_status_t +amdsmi_get_gpu_device_uuid.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_char)] +amdsmi_get_gpu_driver_version = _libraries['libamd_smi.so'].amdsmi_get_gpu_driver_version +amdsmi_get_gpu_driver_version.restype = amdsmi_status_t +amdsmi_get_gpu_driver_version.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_char)] +amdsmi_get_gpu_asic_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_asic_info +amdsmi_get_gpu_asic_info.restype = amdsmi_status_t +amdsmi_get_gpu_asic_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_asic_info_t)] +amdsmi_get_gpu_board_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_board_info +amdsmi_get_gpu_board_info.restype = amdsmi_status_t +amdsmi_get_gpu_board_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_board_info_t)] amdsmi_get_power_cap_info = _libraries['libamd_smi.so'].amdsmi_get_power_cap_info amdsmi_get_power_cap_info.restype = amdsmi_status_t -amdsmi_get_power_cap_info.argtypes = [amdsmi_device_handle, uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_power_cap_info_t)] +amdsmi_get_power_cap_info.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(struct_c__SA_amdsmi_power_cap_info_t)] 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_device_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_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_gpu_caps_t)] +amdsmi_get_xgmi_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_xgmi_info_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_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_fw_info_t)] -amdsmi_get_vbios_info = _libraries['libamd_smi.so'].amdsmi_get_vbios_info -amdsmi_get_vbios_info.restype = amdsmi_status_t -amdsmi_get_vbios_info.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_vbios_info_t)] +amdsmi_get_fw_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_fw_info_t)] +amdsmi_get_gpu_vbios_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_vbios_info +amdsmi_get_gpu_vbios_info.restype = amdsmi_status_t +amdsmi_get_gpu_vbios_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_vbios_info_t)] amdsmi_get_gpu_activity = _libraries['libamd_smi.so'].amdsmi_get_gpu_activity amdsmi_get_gpu_activity.restype = amdsmi_status_t -amdsmi_get_gpu_activity.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_engine_usage_t)] -amdsmi_get_power_measure = _libraries['libamd_smi.so'].amdsmi_get_power_measure -amdsmi_get_power_measure.restype = amdsmi_status_t -amdsmi_get_power_measure.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_power_measure_t)] -amdsmi_get_clock_measure = _libraries['libamd_smi.so'].amdsmi_get_clock_measure -amdsmi_get_clock_measure.restype = amdsmi_status_t -amdsmi_get_clock_measure.argtypes = [amdsmi_device_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_clk_measure_t)] -amdsmi_get_vram_usage = _libraries['libamd_smi.so'].amdsmi_get_vram_usage -amdsmi_get_vram_usage.restype = amdsmi_status_t -amdsmi_get_vram_usage.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_vram_info_t)] -amdsmi_get_target_frequency_range = _libraries['libamd_smi.so'].amdsmi_get_target_frequency_range -amdsmi_get_target_frequency_range.restype = amdsmi_status_t -amdsmi_get_target_frequency_range.argtypes = [amdsmi_device_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_frequency_range_t)] -amdsmi_get_process_list = _libraries['libamd_smi.so'].amdsmi_get_process_list -amdsmi_get_process_list.restype = amdsmi_status_t -amdsmi_get_process_list.argtypes = [amdsmi_device_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)] -amdsmi_get_process_info = _libraries['libamd_smi.so'].amdsmi_get_process_info -amdsmi_get_process_info.restype = amdsmi_status_t -amdsmi_get_process_info.argtypes = [amdsmi_device_handle, amdsmi_process_handle, ctypes.POINTER(struct_c__SA_amdsmi_proc_info_t)] -amdsmi_get_ecc_error_count = _libraries['libamd_smi.so'].amdsmi_get_ecc_error_count -amdsmi_get_ecc_error_count.restype = amdsmi_status_t -amdsmi_get_ecc_error_count.argtypes = [amdsmi_device_handle, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] +amdsmi_get_gpu_activity.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_engine_usage_t)] +amdsmi_get_power_info = _libraries['libamd_smi.so'].amdsmi_get_power_info +amdsmi_get_power_info.restype = amdsmi_status_t +amdsmi_get_power_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_power_info_t)] +amdsmi_get_clock_info = _libraries['libamd_smi.so'].amdsmi_get_clock_info +amdsmi_get_clock_info.restype = amdsmi_status_t +amdsmi_get_clock_info.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_clk_info_t)] +amdsmi_get_gpu_vram_usage = _libraries['libamd_smi.so'].amdsmi_get_gpu_vram_usage +amdsmi_get_gpu_vram_usage.restype = amdsmi_status_t +amdsmi_get_gpu_vram_usage.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_vram_info_t)] +amdsmi_get_gpu_target_frequency_range = _libraries['libamd_smi.so'].amdsmi_get_gpu_target_frequency_range +amdsmi_get_gpu_target_frequency_range.restype = amdsmi_status_t +amdsmi_get_gpu_target_frequency_range.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_frequency_range_t)] +amdsmi_get_gpu_process_list = _libraries['libamd_smi.so'].amdsmi_get_gpu_process_list +amdsmi_get_gpu_process_list.restype = amdsmi_status_t +amdsmi_get_gpu_process_list.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32)] +amdsmi_get_gpu_process_info = _libraries['libamd_smi.so'].amdsmi_get_gpu_process_info +amdsmi_get_gpu_process_info.restype = amdsmi_status_t +amdsmi_get_gpu_process_info.argtypes = [amdsmi_processor_handle, amdsmi_process_handle, ctypes.POINTER(struct_c__SA_amdsmi_proc_info_t)] +amdsmi_get_gpu_ecc_error_count = _libraries['libamd_smi.so'].amdsmi_get_gpu_ecc_error_count +amdsmi_get_gpu_ecc_error_count.restype = amdsmi_status_t +amdsmi_get_gpu_ecc_error_count.argtypes = [amdsmi_processor_handle, ctypes.POINTER(struct_c__SA_amdsmi_error_count_t)] __all__ = \ ['AMDSMI_CNTR_CMD_START', 'AMDSMI_CNTR_CMD_STOP', 'AMDSMI_COARSE_GRAIN_GFX_ACTIVITY', @@ -1843,49 +1792,18 @@ __all__ = \ 'TEMPERATURE_TYPE_VRAM', 'TEMPERATURE_TYPE__MAX', 'UNKNOWN', 'amd_metrics_table_header_t', 'amdsmi_asic_info_t', 'amdsmi_bdf_t', 'amdsmi_bit_field_t', 'amdsmi_board_info_t', - 'amdsmi_clk_measure_t', 'amdsmi_clk_type_t', - 'amdsmi_clk_type_t__enumvalues', 'amdsmi_container_types_t', - 'amdsmi_container_types_t__enumvalues', 'amdsmi_control_counter', + 'amdsmi_clk_info_t', 'amdsmi_clk_type_t', + 'amdsmi_clk_type_t__enumvalues', + 'amdsmi_close_supported_func_iterator', + 'amdsmi_container_types_t', + 'amdsmi_container_types_t__enumvalues', 'amdsmi_counter_command_t', - 'amdsmi_counter_command_t__enumvalues', - 'amdsmi_counter_get_available_counters', 'amdsmi_counter_value_t', - 'amdsmi_dev_close_supported_func_iterator', - 'amdsmi_dev_counter_group_supported', 'amdsmi_dev_create_counter', - 'amdsmi_dev_destroy_counter', 'amdsmi_dev_get_busy_percent', - 'amdsmi_dev_get_drm_render_minor', 'amdsmi_dev_get_ecc_count', - 'amdsmi_dev_get_ecc_enabled', 'amdsmi_dev_get_ecc_status', - 'amdsmi_dev_get_energy_count', 'amdsmi_dev_get_fan_rpms', - 'amdsmi_dev_get_fan_speed', 'amdsmi_dev_get_fan_speed_max', - 'amdsmi_dev_get_gpu_clk_freq', 'amdsmi_dev_get_gpu_metrics_info', - 'amdsmi_dev_get_id', 'amdsmi_dev_get_memory_busy_percent', - 'amdsmi_dev_get_memory_reserved_pages', - 'amdsmi_dev_get_memory_total', 'amdsmi_dev_get_memory_usage', - 'amdsmi_dev_get_od_volt_curve_regions', - 'amdsmi_dev_get_od_volt_info', 'amdsmi_dev_get_overdrive_level', - 'amdsmi_dev_get_pci_bandwidth', 'amdsmi_dev_get_pci_id', - 'amdsmi_dev_get_pci_replay_counter', - 'amdsmi_dev_get_pci_throughput', 'amdsmi_dev_get_perf_level', - 'amdsmi_dev_get_power_ave', - 'amdsmi_dev_get_power_profile_presets', - 'amdsmi_dev_get_subsystem_id', 'amdsmi_dev_get_subsystem_name', - 'amdsmi_dev_get_temp_metric', 'amdsmi_dev_get_vendor_name', - 'amdsmi_dev_get_volt_metric', 'amdsmi_dev_get_vram_vendor', - 'amdsmi_dev_open_supported_func_iterator', - 'amdsmi_dev_open_supported_variant_iterator', + 'amdsmi_counter_command_t__enumvalues', 'amdsmi_counter_value_t', 'amdsmi_dev_perf_level_t', 'amdsmi_dev_perf_level_t__enumvalues', - 'amdsmi_dev_reset_fan', 'amdsmi_dev_reset_gpu', - 'amdsmi_dev_reset_xgmi_error', 'amdsmi_dev_set_clk_freq', - 'amdsmi_dev_set_clk_range', 'amdsmi_dev_set_fan_speed', - 'amdsmi_dev_set_od_clk_info', 'amdsmi_dev_set_od_volt_info', - 'amdsmi_dev_set_overdrive_level', - 'amdsmi_dev_set_overdrive_level_v1', - 'amdsmi_dev_set_pci_bandwidth', 'amdsmi_dev_set_perf_level', - 'amdsmi_dev_set_perf_level_v1', 'amdsmi_dev_set_power_cap', - 'amdsmi_dev_set_power_profile', 'amdsmi_dev_xgmi_error_status', - 'amdsmi_device_handle', 'amdsmi_engine_usage_t', - 'amdsmi_error_count_t', 'amdsmi_event_group_t', - 'amdsmi_event_group_t__enumvalues', 'amdsmi_event_handle_t', - 'amdsmi_event_type_t', 'amdsmi_event_type_t__enumvalues', + 'amdsmi_engine_usage_t', 'amdsmi_error_count_t', + 'amdsmi_event_group_t', 'amdsmi_event_group_t__enumvalues', + 'amdsmi_event_handle_t', 'amdsmi_event_type_t', + 'amdsmi_event_type_t__enumvalues', 'amdsmi_evt_notification_data_t', 'amdsmi_evt_notification_type_t', 'amdsmi_evt_notification_type_t__enumvalues', 'amdsmi_freq_ind_t', @@ -1893,56 +1811,91 @@ __all__ = \ 'amdsmi_frequencies_t', 'amdsmi_frequency_range_t', '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_asic_info', - 'amdsmi_get_bad_page_info', 'amdsmi_get_board_info', - 'amdsmi_get_caps_info', 'amdsmi_get_clock_measure', - 'amdsmi_get_compute_process_gpus', - 'amdsmi_get_compute_process_info', - 'amdsmi_get_compute_process_info_by_pid', 'amdsmi_get_device_bdf', - 'amdsmi_get_device_handle_from_bdf', 'amdsmi_get_device_handles', - 'amdsmi_get_device_type', 'amdsmi_get_device_uuid', - 'amdsmi_get_driver_version', 'amdsmi_get_ecc_error_count', - 'amdsmi_get_event_notification', 'amdsmi_get_func_iter_value', + 'amdsmi_fw_info_t', 'amdsmi_get_busy_percent', + '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', + 'amdsmi_get_gpu_compute_process_info_by_pid', + 'amdsmi_get_gpu_device_bdf', 'amdsmi_get_gpu_device_uuid', + 'amdsmi_get_gpu_driver_version', + 'amdsmi_get_gpu_drm_render_minor', 'amdsmi_get_gpu_ecc_count', + 'amdsmi_get_gpu_ecc_enabled', 'amdsmi_get_gpu_ecc_error_count', + 'amdsmi_get_gpu_ecc_status', 'amdsmi_get_gpu_event_notification', + 'amdsmi_get_gpu_fan_rpms', 'amdsmi_get_gpu_fan_speed', + 'amdsmi_get_gpu_fan_speed_max', 'amdsmi_get_gpu_id', + 'amdsmi_get_gpu_memory_busy_percent', + 'amdsmi_get_gpu_memory_reserved_pages', + 'amdsmi_get_gpu_memory_total', 'amdsmi_get_gpu_memory_usage', + 'amdsmi_get_gpu_metrics_info', + 'amdsmi_get_gpu_od_volt_curve_regions', + 'amdsmi_get_gpu_od_volt_info', 'amdsmi_get_gpu_overdrive_level', + 'amdsmi_get_gpu_pci_bandwidth', 'amdsmi_get_gpu_pci_id', + 'amdsmi_get_gpu_pci_replay_counter', + 'amdsmi_get_gpu_pci_throughput', 'amdsmi_get_gpu_perf_level', + 'amdsmi_get_gpu_power_profile_presets', + 'amdsmi_get_gpu_process_info', 'amdsmi_get_gpu_process_list', + 'amdsmi_get_gpu_ras_block_features_enabled', + 'amdsmi_get_gpu_subsystem_id', 'amdsmi_get_gpu_subsystem_name', + 'amdsmi_get_gpu_target_frequency_range', + 'amdsmi_get_gpu_topo_numa_affinity', 'amdsmi_get_gpu_vbios_info', + '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_cap_info', - 'amdsmi_get_power_measure', 'amdsmi_get_process_info', - 'amdsmi_get_process_list', - 'amdsmi_get_ras_block_features_enabled', + '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_target_frequency_range', - 'amdsmi_get_utilization_count', 'amdsmi_get_vbios_info', + 'amdsmi_get_temp_metric', 'amdsmi_get_utilization_count', 'amdsmi_get_version', 'amdsmi_get_version_str', - 'amdsmi_get_vram_usage', 'amdsmi_get_xgmi_info', - 'amdsmi_gpu_block_t', 'amdsmi_gpu_block_t__enumvalues', - 'amdsmi_gpu_caps_t', 'amdsmi_gpu_metrics_t', 'amdsmi_init', - 'amdsmi_init_event_notification', 'amdsmi_init_flags_t', - 'amdsmi_init_flags_t__enumvalues', 'amdsmi_is_P2P_accessible', + 'amdsmi_get_xgmi_info', 'amdsmi_gpu_block_t', + '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', + 'amdsmi_init', 'amdsmi_init_flags_t', + 'amdsmi_init_flags_t__enumvalues', + 'amdsmi_init_gpu_event_notification', 'amdsmi_is_P2P_accessible', 'amdsmi_memory_page_status_t', 'amdsmi_memory_page_status_t__enumvalues', 'amdsmi_memory_type_t', 'amdsmi_memory_type_t__enumvalues', 'amdsmi_mm_ip_t', 'amdsmi_mm_ip_t__enumvalues', 'amdsmi_next_func_iter', 'amdsmi_od_vddc_point_t', 'amdsmi_od_volt_curve_t', - 'amdsmi_od_volt_freq_data_t', 'amdsmi_pcie_bandwidth_t', - 'amdsmi_pcie_info_t', 'amdsmi_power_cap_info_t', - 'amdsmi_power_measure_t', 'amdsmi_power_profile_preset_masks_t', + 'amdsmi_od_volt_freq_data_t', + 'amdsmi_open_supported_func_iterator', + 'amdsmi_open_supported_variant_iterator', + 'amdsmi_pcie_bandwidth_t', 'amdsmi_pcie_info_t', + 'amdsmi_power_cap_info_t', 'amdsmi_power_info_t', + 'amdsmi_power_profile_preset_masks_t', 'amdsmi_power_profile_preset_masks_t__enumvalues', 'amdsmi_power_profile_status_t', 'amdsmi_proc_info_t', 'amdsmi_process_handle', 'amdsmi_process_info_t', - 'amdsmi_range_t', 'amdsmi_ras_err_state_t', - 'amdsmi_ras_err_state_t__enumvalues', 'amdsmi_read_counter', - 'amdsmi_retired_page_record_t', - 'amdsmi_set_event_notification_mask', - 'amdsmi_set_perf_determinism_mode', 'amdsmi_shut_down', - 'amdsmi_socket_handle', 'amdsmi_status_string', 'amdsmi_status_t', - 'amdsmi_status_t__enumvalues', 'amdsmi_stop_event_notification', - 'amdsmi_sw_component_t', 'amdsmi_sw_component_t__enumvalues', + 'amdsmi_processor_handle', 'amdsmi_range_t', + 'amdsmi_ras_err_state_t', 'amdsmi_ras_err_state_t__enumvalues', + 'amdsmi_reset_gpu', 'amdsmi_reset_gpu_fan', + 'amdsmi_reset_gpu_xgmi_error', 'amdsmi_retired_page_record_t', + 'amdsmi_set_clk_freq', 'amdsmi_set_gpu_clk_range', + 'amdsmi_set_gpu_event_notification_mask', + 'amdsmi_set_gpu_fan_speed', 'amdsmi_set_gpu_od_clk_info', + 'amdsmi_set_gpu_od_volt_info', 'amdsmi_set_gpu_overdrive_level', + 'amdsmi_set_gpu_overdrive_level_v1', + 'amdsmi_set_gpu_pci_bandwidth', + 'amdsmi_set_gpu_perf_determinism_mode', + 'amdsmi_set_gpu_perf_level', 'amdsmi_set_gpu_perf_level_v1', + 'amdsmi_set_gpu_power_profile', 'amdsmi_set_power_cap', + 'amdsmi_shut_down', 'amdsmi_socket_handle', + 'amdsmi_status_string', 'amdsmi_status_t', + 'amdsmi_status_t__enumvalues', + 'amdsmi_stop_gpu_event_notification', 'amdsmi_sw_component_t', + 'amdsmi_sw_component_t__enumvalues', 'amdsmi_temperature_metric_t', 'amdsmi_temperature_metric_t__enumvalues', 'amdsmi_temperature_type_t', 'amdsmi_temperature_type_t__enumvalues', 'amdsmi_topo_get_link_type', 'amdsmi_topo_get_link_weight', - 'amdsmi_topo_get_numa_affinity', 'amdsmi_topo_get_numa_node_number', 'amdsmi_utilization_counter_t', 'amdsmi_vbios_info_t', 'amdsmi_version_t', 'amdsmi_voltage_metric_t', @@ -1964,13 +1917,13 @@ __all__ = \ 'c__EA_amdsmi_temperature_metric_t', 'c__EA_amdsmi_temperature_type_t', 'c__EA_amdsmi_voltage_metric_t', 'c__EA_amdsmi_voltage_type_t', - 'c__EA_amdsmi_xgmi_status_t', 'c__EA_device_type_t', - 'device_type_t', 'device_type_t__enumvalues', 'size_t', + 'c__EA_amdsmi_xgmi_status_t', 'c__EA_processor_type_t', + 'processor_type_t', 'processor_type_t__enumvalues', 'size_t', 'struct_amdsmi_func_id_iter_handle', 'struct_c__SA_amd_metrics_table_header_t', 'struct_c__SA_amdsmi_asic_info_t', 'struct_c__SA_amdsmi_board_info_t', - 'struct_c__SA_amdsmi_clk_measure_t', + 'struct_c__SA_amdsmi_clk_info_t', 'struct_c__SA_amdsmi_counter_value_t', 'struct_c__SA_amdsmi_engine_usage_t', 'struct_c__SA_amdsmi_error_count_t', @@ -1980,9 +1933,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', @@ -1990,7 +1940,7 @@ __all__ = \ 'struct_c__SA_amdsmi_pcie_bandwidth_t', 'struct_c__SA_amdsmi_pcie_info_t', 'struct_c__SA_amdsmi_power_cap_info_t', - 'struct_c__SA_amdsmi_power_measure_t', + 'struct_c__SA_amdsmi_power_info_t', 'struct_c__SA_amdsmi_power_profile_status_t', 'struct_c__SA_amdsmi_proc_info_t', 'struct_c__SA_amdsmi_proc_info_t_0', diff --git a/projects/amdsmi/py-interface/pyproject.toml b/projects/amdsmi/py-interface/pyproject.toml index ce8aa66a12..d7f95a869a 100644 --- a/projects/amdsmi/py-interface/pyproject.toml +++ b/projects/amdsmi/py-interface/pyproject.toml @@ -10,11 +10,14 @@ name = "amdsmi" authors = [ {name = "AMD", email = "amd-smi.support@amd.com"}, ] -version = '0.3' +version = '1.0' license = {file = "amdsmi/LICENSE"} readme = {file = "amdsmi/README.md", content-type = "text/markdown"} description = "SMI LIB - AMD GPU Monitoring Library" requires-python = ">=3.7" +dependencies = [ + 'PyYAML >= 5.0', +] [project.urls] "Homepage" = "https://github.com/RadeonOpenCompute/amdsmi" diff --git a/projects/amdsmi/py-interface/rocm_smi_tool.py b/projects/amdsmi/py-interface/rocm_smi_tool.py index 9df8409ca0..b478db80d8 100644 --- a/projects/amdsmi/py-interface/rocm_smi_tool.py +++ b/projects/amdsmi/py-interface/rocm_smi_tool.py @@ -100,16 +100,16 @@ class CmdLineParser: return True return False - def _get_device_handle_from_id(self, gpu_id, vf_id=None): - devices = smi_api.amdsmi_get_device_handles() + def _get_processor_handle_from_id(self, gpu_id, vf_id=None): + devices = smi_api.amdsmi_get_processor_handles() self._check_range("gpu id", gpu_id, 0, len(devices) - 1) - device_handle = devices[gpu_id] + processor_handle = devices[gpu_id] if vf_id is not None: - partitions = smi_api.amdsmi_get_vf_partition_info(device_handle) + partitions = smi_api.amdsmi_get_vf_partition_info(processor_handle) self._check_range("vf id", vf_id, 0, len(partitions) - 1) - device_handle = smi_api.amdsmi_get_vf_handle_from_vf_index(device_handle, vf_id) - return device_handle + processor_handle = smi_api.amdsmi_get_vf_handle_from_vf_index(processor_handle, vf_id) + return processor_handle def _parse_vf_id_if_exists(self): gpu_id = None @@ -156,32 +156,32 @@ class CmdLineParser: return self.command_entry[0] - def get_device_handle(self): - device_handles = [] + def get_processor_handle(self): + processor_handles = [] - def parse_device_handle(position): - self._check_if_arg_exists("Device identifier", "device bdf or device id", position) + def parse_processor_handle(possition): + self._check_if_arg_exists("Device identifier", "device bdf or device id", possition) ids = self._parse_vf_id_if_exists() if ids["gpu_id"] is not None and ids["vf_id"] is not None: - device_handle = self._get_device_handle_from_id(ids["gpu_id"], ids["vf_id"]) + processor_handle = self._get_processor_handle_from_id(ids["gpu_id"], ids["vf_id"]) else: gpu_arg = self.cmd_args[position] if gpu_arg.isdigit(): - device_handle = self._get_device_handle_from_id(int(gpu_arg)) + processor_handle = self._get_processor_handle_from_id(int(gpu_arg)) else: self._check_bdf(gpu_arg) - device_handle = smi_api.amdsmi_get_device_handle_from_bdf(gpu_arg) - device_handles.append(device_handle) + processor_handle = smi_api.amdsmi_get_processor_handle_from_bdf(gpu_arg) + processor_handles.append(processor_handle) for i in range(len(self.command_entry)): if f"device_identifier{i + 1}" in self.command_entry[1]: - parse_device_handle(i + 2) + parse_processor_handle(i + 2) - if len(device_handles) == 0: + if len(processor_handles) == 0: return None - return device_handles + return processor_handles def get_command_args(self): offset = 2 + self.extra_args @@ -234,7 +234,7 @@ class Formatter: self.print_dict(result) elif isinstance(result, list): self.print_list(result) - elif isinstance(result, smi_api.amdsmi_wrapper.amdsmi_device_handle): + elif isinstance(result, smi_api.amdsmi_wrapper.amdsmi_processor_handle): self.print_handle("\n" + result) else: print(result) @@ -263,7 +263,7 @@ class Formatter: print("{}{:25} :{}".format(space, self.style.background(key), str(value))) def print_handle(self, handle): - bdf = smi_api.amdsmi_get_device_bdf(handle) + bdf = smi_api.amdsmi_get_gpu_device_bdf(handle) print("{:25} :{}".format(self.style.background("BDF"), str(bdf))) def print_usage(self): @@ -287,84 +287,83 @@ class Formatter: | | | """ + self.style.header("COMMANDS:") + """ | | | - | """ + self.style.text(" 1 Get device vendor name. Api: amdsmi_dev_get_vendor_name ") + """ | - | """ + self.style.text(" 2 Get device id. Api: amdsmi_dev_get_id ") + """ | - | """ + self.style.text(" 3 Get device vram vendor. Api: amdsmi_dev_get_vram_vendor ") + """ | - | """ + self.style.text(" 4 Get device drm render minor. Api: amdsmi_dev_get_drm_render_minor ") + """ | - | """ + self.style.text(" 5 Get device subsystem id. Api: amdsmi_dev_get_subsystem_id ") + """ | - | """ + self.style.text(" 6 Get device subsystem name. Api: amdsmi_dev_get_subsystem_name ") + """ | - | """ + self.style.text(" 7 Get device pci id. Api: amdsmi_dev_get_pci_id ") + """ | - | """ + self.style.text(" 8 Get device pci bandwidth. Api: amdsmi_dev_get_pci_bandwidth ") + """ | - | """ + self.style.text(" 9 Get device pci throughput. Api: amdsmi_dev_get_pci_throughput ") + """ | - | """ + self.style.text("10 Get device pci replay counter. Api: amdsmi_dev_get_pci_replay_counter ") + """ | - | """ + self.style.text("11 Get topo numa affinity. Api: amdsmi_topo_get_numa_affinity ") + """ | - | """ + self.style.text("12 Get device power ave. Api: amdsmi_dev_get_power_ave ") + """ | - | """ + self.style.text("13 Get device energy count. Api: amdsmi_dev_get_energy_count ") + """ | - | """ + self.style.text("14 Get device memory total. Api: amdsmi_dev_get_memory_total ") + """ | - | """ + self.style.text("15 Get device memory usage. Api: amdsmi_dev_get_memory_usage ") + """ | - | """ + self.style.text("16 Get device memory busy percent. Api: amdsmi_dev_get_memory_busy_percent ") + """ | - | """ + self.style.text("17 Get device memory reserved pages. Api: amdsmi_dev_get_memory_reserved_pages ") + """ | - | """ + self.style.text("18 Get device fan rpms. Api: amdsmi_dev_get_fan_rpms ") + """ | - | """ + self.style.text("19 Get device fan speed. Api: amdsmi_dev_get_fan_speed ") + """ | - | """ + self.style.text("20 Get device fan speed max. Api: amdsmi_dev_get_fan_speed_max ") + """ | - | """ + self.style.text("21 Get device temp metric. Api: amdsmi_dev_get_temp_metric ") + """ | - | """ + self.style.text("22 Get device volt metric. Api: amdsmi_dev_get_volt_metric ") + """ | - | """ + self.style.text("23 Get device busy percent. Api: amdsmi_dev_get_busy_percent ") + """ | + | """ + self.style.text(" 1 Get device vendor name. Api: amdsmi_get_gpu_vendor_name ") + """ | + | """ + self.style.text(" 2 Get device id. Api: amdsmi_get_gpu_id ") + """ | + | """ + self.style.text(" 3 Get device vram vendor. Api: amdsmi_get_gpu_vram_vendor ") + """ | + | """ + self.style.text(" 4 Get device drm render minor. Api: amdsmi_get_gpu_drm_render_minor ") + """ | + | """ + self.style.text(" 5 Get device subsystem id. Api: amdsmi_get_gpu_subsystem_id ") + """ | + | """ + self.style.text(" 6 Get device subsystem name. Api: amdsmi_get_gpu_subsystem_name ") + """ | + | """ + self.style.text(" 7 Get device pci id. Api: amdsmi_get_gpu_pci_id ") + """ | + | """ + self.style.text(" 8 Get device pci bandwidth. Api: amdsmi_get_gpu_pci_bandwidth ") + """ | + | """ + self.style.text(" 9 Get device pci throughput. Api: amdsmi_get_gpu_pci_throughput ") + """ | + | """ + self.style.text("10 Get device pci replay counter. Api: amdsmi_get_gpu_pci_replay_counter ") + """ | + | """ + self.style.text("11 Get topo numa affinity. Api: amdsmi_get_gpu_topo_numa_affinity ") + """ | + | """ + self.style.text("13 Get device energy count. Api: amdsmi_get_energy_count ") + """ | + | """ + self.style.text("14 Get device memory total. Api: amdsmi_get_gpu_memory_total ") + """ | + | """ + self.style.text("15 Get device memory usage. Api: amdsmi_get_gpu_memory_usage ") + """ | + | """ + self.style.text("16 Get device memory busy percent. Api: amdsmi_get_gpu_memory_busy_percent ") + """ | + | """ + self.style.text("17 Get device memory reserved pages. Api: amdsmi_get_gpu_memory_reserved_pages ") + """ | + | """ + self.style.text("18 Get device fan rpms. Api: amdsmi_get_gpu_fan_rpms ") + """ | + | """ + self.style.text("19 Get device fan speed. Api: amdsmi_get_gpu_fan_speed ") + """ | + | """ + self.style.text("20 Get device fan speed max. Api: amdsmi_get_gpu_fan_speed_max ") + """ | + | """ + self.style.text("21 Get device temp metric. Api: amdsmi_get_temp_metric ") + """ | + | """ + self.style.text("22 Get device volt metric. Api: amdsmi_get_gpu_volt_metric ") + """ | + | """ + self.style.text("23 Get device busy percent. Api: amdsmi_get_busy_percent ") + """ | | """ + self.style.text("24 Get utilization count. Api: amdsmi_get_utilization_count ") + """ | - | """ + self.style.text("25 Get device perf level. Api: amdsmi_dev_get_perf_level ") + """ | - | """ + self.style.text("26 Set perf determinism mode. Api: amdsmi_set_perf_determinism_mode ") + """ | - | """ + self.style.text("27 Get device overdrive level. Api: amdsmi_dev_get_overdrive_level ") + """ | - | """ + self.style.text("28 Get device gpu clk freq. Api: amdsmi_dev_get_gpu_clk_freq ") + """ | - | """ + self.style.text("29 Get device od volt. Api: amdsmi_dev_get_od_volt_info ") + """ | - | """ + self.style.text("30 Get device gpu metrics. Api: amdsmi_dev_get_gpu_metrics_info ") + """ | - | """ + self.style.text("31 Get device od volt curve regions. Api: amdsmi_dev_get_od_volt_curve_regions ") + """ | - | """ + self.style.text("32 Get device power profile presets. Api: amdsmi_dev_get_power_profile_presets ") + """ | + | """ + self.style.text("25 Get device perf level. Api: amdsmi_get_gpu_perf_level ") + """ | + | """ + self.style.text("26 Set perf determinism mode. Api: amdsmi_set_gpu_perf_determinism_mode ") + """ | + | """ + self.style.text("27 Get device overdrive level. Api: amdsmi_get_gpu_overdrive_level ") + """ | + | """ + self.style.text("28 Get device gpu clk freq. Api: amdsmi_get_clk_freq ") + """ | + | """ + self.style.text("29 Get device od volt. Api: amdsmi_get_gpu_od_volt_info ") + """ | + | """ + self.style.text("30 Get device gpu metrics. Api: amdsmi_get_gpu_metrics_info ") + """ | + | """ + self.style.text("31 Get device od volt curve regions. Api: amdsmi_get_gpu_od_volt_curve_regions ") + """ | + | """ + self.style.text("32 Get device power profile presets. Api: amdsmi_get_gpu_power_profile_presets ") + """ | | """ + self.style.text("33 Get the build version. Api: amdsmi_get_version ") + """ | | """ + self.style.text("34 Get version string. Api: amdsmi_get_version_str ") + """ | - | """ + self.style.text("35 Get device ecc counter. Api: amdsmi_dev_get_ecc_count ") + """ | - | """ + self.style.text("36 Get device ecc enable. Api: amdsmi_dev_get_ecc_enabled ") + """ | - | """ + self.style.text("37 Get device ecc status. Api: amdsmi_dev_get_ecc_status ") + """ | + | """ + self.style.text("35 Get device ecc counter. Api: amdsmi_get_gpu_ecc_count ") + """ | + | """ + self.style.text("36 Get device ecc enable. Api: amdsmi_get_gpu_ecc_enabled ") + """ | + | """ + self.style.text("37 Get device ecc status. Api: amdsmi_get_gpu_ecc_status ") + """ | | """ + self.style.text("38 Get status string. Api: amdsmi_status_string ") + """ | - | """ + self.style.text("39 Get compute process info. Api: amdsmi_get_compute_process_info ") + """ | - | """ + self.style.text("40 Get compute process info by pid. Api: amdsmi_get_compute_process_info_by_pid ") + """ | - | """ + self.style.text("41 Get compute process gpus. Api: amdsmi_get_compute_process_gpus ") + """ | - | """ + self.style.text("42 Get device xgmi_error_status. Api: amdsmi_dev_xgmi_error_status ") + """ | - | """ + self.style.text("43 Get device xgmi error reset. Api: amdsmi_dev_reset_xgmi_error ") + """ | + | """ + self.style.text("39 Get compute process info. Api: amdsmi_get_gpu_compute_process_info ") + """ | + | """ + self.style.text("40 Get compute process info by pid. Api: amdsmi_get_gpu_compute_process_info_by_pid ") + """ | + | """ + self.style.text("41 Get compute process gpus. Api: amdsmi_get_gpu_compute_process_gpus ") + """ | + | """ + self.style.text("42 Get device xgmi_error_status. Api: amdsmi_gpu_xgmi_error_status ") + """ | + | """ + self.style.text("43 Get device xgmi error reset. Api: amdsmi_reset_gpu_xgmi_error ") + """ | | """ + self.style.text("44 Get topo get numa node number. Api: amdsmi_topo_get_numa_node_number ") + """ | | """ + self.style.text("45 Get topo get link weight. Api: amdsmi_topo_get_link_weight ") + """ | | """ + self.style.text("46 Get minmax_bandwidth_get. Api: amdsmi_get_minmax_bandwidth ") + """ | | """ + self.style.text("47 Get topo get link type. Api: amdsmi_topo_get_link_type ") + """ | | """ + self.style.text("48 Get is P2P accessible. Api: amdsmi_is_P2P_accessible ") + """ | - | """ + self.style.text("49 Get asic info. Api: amdsmi_get_asic_info ") + """ | - | """ + self.style.text("50 Get device_handles. Api: amdsmi_get_device_handles ") + """ | - | """ + self.style.text("51 Get event notification. Api: amdsmi_get_event_notification ") + """ | - | """ + self.style.text("52 Init event notification. Api: amdsmi_init_event_notification ") + """ | - | """ + self.style.text("53 Set event notification mask. Api: amdsmi_set_event_notification_mask ") + """ | - | """ + self.style.text("54 Get event notification. Api: amdsmi_stop_event_notification ") + """ | + | """ + self.style.text("49 Get asic info. Api: amdsmi_get_gpu_asic_info ") + """ | + | """ + self.style.text("50 Get processor_handles. Api: amdsmi_get_processor_handles ") + """ | + | """ + self.style.text("51 Get event notification. Api: amdsmi_get_gpu_event_notification ") + """ | + | """ + self.style.text("52 Init event notification. Api: amdsmi_init_gpu_event_notification ") + """ | + | """ + self.style.text("53 Set event notification mask. Api: amdsmi_set_gpu_event_notification_mask ") + """ | + | """ + self.style.text("54 Get event notification. Api: amdsmi_stop_gpu_event_notification ") + """ | | """ + self.style.text("55 Init. Api: amdsmi_init ") + """ | | """ + self.style.text("56 Shut down. Api: amdsmi_shut_down ") + """ | | """ + self.style.text("57 Get fw info. Api: amdsmi_get_fw_info ") + """ | - | """ + self.style.text("58 Get vbios info. Api: amdsmi_get_vbios_info ") + """ | - | """ + self.style.text("59 Get counter available counters. Api: amdsmi_counter_get_available_counters ") + """ | - | """ + self.style.text("60 Get counter control. Api: amdsmi_control_counter ") + """ | - | """ + self.style.text("61 Get counter read. Api: amdsmi_read_counter ") + """ | - | """ + self.style.text("62 Set dev clk range. Api: amdsmi_dev_set_clk_range ") + """ | - | """ + self.style.text("63 Get dev counter group supported. Api: amdsmi_dev_counter_group_supported ") + """ | - | """ + self.style.text("64 Reset dev fan. Api: amdsmi_dev_reset_fan ") + """ | - | """ + self.style.text("65 Set dev fan speed. Api: amdsmi_dev_set_fan_speed ") + """ | - | """ + self.style.text("66 Set dev gpu clk freq. Api: amdsmi_dev_set_clk_freq ") + """ | - | """ + self.style.text("67 Reset dev gpu. Api: amdsmi_dev_reset_gpu ") + """ | - | """ + self.style.text("68 Set dev od clk info. Api: amdsmi_dev_set_od_clk_info ") + """ | - | """ + self.style.text("69 Set dev od volt info. Api: amdsmi_dev_set_od_volt_info ") + """| - | """ + self.style.text("70 Set dev overdrive level. Api: amdsmi_dev_set_overdrive_level ") + """ | - | """ + self.style.text("71 Set v1 dev overdrive level. Api: amdsmi_dev_set_overdrive_level_v1 ") + """ | - | """ + self.style.text("72 Set dev pci bandwidth. Api: amdsmi_dev_set_pci_bandwidth ") + """ | - | """ + self.style.text("73 Set dev perf level. Api: amdsmi_dev_set_perf_level ") + """ | - | """ + self.style.text("74 Set dev perf level v1. Api: amdsmi_dev_set_perf_level_v1 ") + """ | - | """ + self.style.text("75 Set dev power cap. Api: amdsmi_dev_set_power_cap ") + """ | - | """ + self.style.text("76 Set dev power profile. Api: amdsmi_dev_set_power_profile ") + """ | - | """ + self.style.text("77 Close dev supported func iterator. Api: amdsmi_dev_close_supported_func_iterator ") + """ | - | """ + self.style.text("78 Pen dev supported func iterator. Api: amdsmi_dev_open_supported_func_iterator ") + """ | + | """ + self.style.text("58 Get vbios info. Api: amdsmi_get_gpu_vbios_info ") + """ | + | """ + self.style.text("59 Get counter available counters. Api: amdsmi_get_gpu_available_counters ") + """ | + | """ + self.style.text("60 Get counter control. Api: amdsmi_gpu_control_counter ") + """ | + | """ + self.style.text("61 Get counter read. Api: amdsmi_gpu_read_counter ") + """ | + | """ + self.style.text("62 Set dev clk range. Api: amdsmi_set_gpu_clk_range ") + """ | + | """ + self.style.text("63 Get dev counter group supported. Api: amdsmi_gpu_counter_group_supported ") + """ | + | """ + self.style.text("64 Reset dev fan. Api: amdsmi_reset_gpu_fan ") + """ | + | """ + self.style.text("65 Set dev fan speed. Api: amdsmi_set_gpu_fan_speed ") + """ | + | """ + self.style.text("66 Set dev gpu clk freq. Api: amdsmi_set_clk_freq ") + """ | + | """ + self.style.text("67 Reset dev gpu. Api: amdsmi_reset_gpu ") + """ | + | """ + self.style.text("68 Set dev od clk info. Api: amdsmi_set_gpu_od_clk_info ") + """ | + | """ + self.style.text("69 Set dev od volt info. Api: amdsmi_set_gpu_od_volt_info ") + """| + | """ + self.style.text("70 Set dev overdrive level. Api: amdsmi_set_gpu_overdrive_level ") + """ | + | """ + self.style.text("71 Set v1 dev overdrive level. Api: amdsmi_set_gpu_overdrive_level_v1 ") + """ | + | """ + self.style.text("72 Set dev pci bandwidth. Api: amdsmi_set_gpu_pci_bandwidth ") + """ | + | """ + self.style.text("73 Set dev perf level. Api: amdsmi_set_gpu_perf_level ") + """ | + | """ + self.style.text("74 Set dev perf level v1. Api: amdsmi_set_gpu_perf_level_v1 ") + """ | + | """ + self.style.text("75 Set dev power cap. Api: amdsmi_set_power_cap ") + """ | + | """ + self.style.text("76 Set dev power profile. Api: amdsmi_set_gpu_power_profile ") + """ | + | """ + self.style.text("77 Close dev supported func iterator. Api: amdsmi_close_supported_func_iterator ") + """ | + | """ + self.style.text("78 Pen dev supported func iterator. Api: amdsmi_open_supported_func_iterator ") + """ | | """ + self.style.text("79 Get func iter next. Api: amdsmi_next_func_iter ") + """ | | """ + self.style.text("80 Get power cap info. Api: amdsmi_get_power_cap_info ") + """ | | """ + self.style.text("81 Get xgmi info. Api: amdsmi_get_xgmi_info ") + """ | @@ -375,15 +374,11 @@ class Formatter: ############################################## # SMI tool wrapper ############################################## -def amdsmi_tool_dev_power_ave_get(dev, dic): - sensor_id = dic["sensor_id"] - return smi_api.amdsmi_dev_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: try: - value = smi_api.amdsmi_dev_get_memory_total(dev, memory_type) + value = smi_api.amdsmi_get_gpu_memory_total(dev, memory_type) result.update({memory_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(memory_type.name, e)) @@ -394,7 +389,7 @@ def amdsmi_tool_dev_memory_usage_get(dev): result = {} for memory_type in smi_api.AmdSmiMemoryType: try: - value = smi_api.amdsmi_dev_get_memory_usage(dev, memory_type) + value = smi_api.amdsmi_get_gpu_memory_usage(dev, memory_type) result.update({memory_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(memory_type.name, e)) @@ -403,22 +398,22 @@ def amdsmi_tool_dev_memory_usage_get(dev): def amdsmi_tool_dev_fan_rpms_get(dev, dic): sensor_idx = dic["sensor_idx"] - return smi_api.amdsmi_dev_get_fan_rpms(dev, sensor_idx) + return smi_api.amdsmi_get_gpu_fan_rpms(dev, sensor_idx) def amdsmi_tool_dev_fan_speed_get(dev, dic): sensor_idx = dic["sensor_idx"] - return smi_api.amdsmi_dev_get_fan_speed(dev, sensor_idx) + return smi_api.amdsmi_get_gpu_fan_speed(dev, sensor_idx) def amdsmi_tool_dev_fan_speed_max_get(dev, dic): sensor_idx = dic["sensor_idx"] - return smi_api.amdsmi_dev_get_fan_speed_max(dev, sensor_idx) + return smi_api.amdsmi_get_gpu_fan_speed_max(dev, sensor_idx) def amdsmi_tool_dev_temp_metric_get(dev): result = {} for temperature_type in smi_api.AmdSmiTemperatureType: for temperature_metric in smi_api.AmdSmiTemperatureMetric: try: - value = smi_api. amdsmi_dev_get_temp_metric(dev, temperature_type, temperature_metric) + value = smi_api. amdsmi_get_temp_metric(dev, temperature_type, temperature_metric) result.update({"AmdSmiTemperatureType: " + temperature_type.name + ", AmdSmiTemperatureMetric: " + temperature_metric.name: value}) except smi_api.AmdSmiException as e: print("{},{}:\t{}".format(temperature_type.name, temperature_metric.name, e)) @@ -430,7 +425,7 @@ def amdsmi_tool_dev_volt_metric_get(dev): for voltage_type in smi_api.AmdSmiVoltageType: for voltage_metric in smi_api.AmdSmiVoltageMetric: try: - value = smi_api. amdsmi_dev_get_volt_metric(dev, voltage_type, voltage_metric) + value = smi_api. amdsmi_get_gpu_volt_metric(dev, voltage_type, voltage_metric) result.update({"AmdSmiVoltageType: " + voltage_type.name + ", AmdSmiVoltageMetric: " + voltage_metric.name: value}) except smi_api.AmdSmiException as e: print("{},{}:\t{}".format(voltage_type.name, voltage_metric.name, e)) @@ -450,11 +445,11 @@ def amdsmi_tool_utilization_count_get(dev): def amdsmi_tool_perf_determinism_mode_set(dev, dic): clock_value = dic["clock_value"] - return smi_api.amdsmi_set_perf_determinism_mode(dev, clock_value) + return smi_api.amdsmi_set_gpu_perf_determinism_mode(dev, clock_value) def amdsmi_tool_dev_power_profile_presets_get(dev, dic): sensor_idx = dic["sensor_idx"] - return smi_api. amdsmi_dev_get_power_profile_presets(dev, sensor_idx) + return smi_api. amdsmi_get_gpu_power_profile_presets(dev, sensor_idx) def amdsmi_tool_version_str_get(): result = {} @@ -469,31 +464,31 @@ def amdsmi_tool_version_str_get(): def amdsmi_tool_dev_fan_reset(dev, dic): sensor_idx = dic["sensor_idx"] - return smi_api.amdsmi_dev_reset_fan(dev, sensor_idx) + return smi_api.amdsmi_reset_gpu_fan(dev, sensor_idx) def amdsmi_tool_dev_fan_speed_set(dev, dic): sensor_idx = dic["sensor_idx"] fan_speed = dic["fan_speed"] - return smi_api.amdsmi_dev_set_fan_speed(dev, sensor_idx, fan_speed) + return smi_api.amdsmi_set_gpu_fan_speed(dev, sensor_idx, fan_speed) def amdsmi_tool_dev_overdrive_level_set(dev, dic): overdrive_value = dic["overdrive_value"] - return smi_api. amdsmi_dev_set_overdrive_level(dev, overdrive_value) + return smi_api. amdsmi_set_gpu_overdrive_level(dev, overdrive_value) def amdsmi_tool_dev_overdrive_level_set_v1(dev, dic): overdrive_value = dic["overdrive_value"] - return smi_api. amdsmi_dev_set_overdrive_level(dev, overdrive_value) + return smi_api. amdsmi_set_gpu_overdrive_level(dev, overdrive_value) def amdsmi_tool_dev_pci_bandwidth_set(dev, dic): bitmask = dic["bitmask"] - return smi_api. amdsmi_dev_set_pci_bandwidth(dev, bitmask) + return smi_api. amdsmi_set_gpu_pci_bandwidth(dev, bitmask) def amdsmi_tool_dev_gpu_clk_freq_get(dev): result = {} for clock_type in smi_api.AmdSmiClkType: try: - value = smi_api. amdsmi_dev_get_gpu_clk_freq(dev, clock_type) + value = smi_api. amdsmi_get_clk_freq(dev, clock_type) result.update({clock_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(clock_type.name, e)) @@ -502,14 +497,14 @@ def amdsmi_tool_dev_gpu_clk_freq_get(dev): def amdsmi_tool_dev_od_volt_curve_regions_get(dev, dic): num_regions = dic["num_regions"] - return smi_api. amdsmi_dev_get_od_volt_curve_regions(dev, num_regions) + return smi_api. amdsmi_get_gpu_od_volt_curve_regions(dev, num_regions) def amdsmi_tool_dev_ecc_count_get(dev): result = {} for gpu_block in smi_api.AmdSmiGpuBlock: try: - value = smi_api. amdsmi_dev_get_ecc_count(dev, gpu_block) + value = smi_api. amdsmi_get_gpu_ecc_count(dev, gpu_block) result.update({gpu_block.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(gpu_block.name, e)) @@ -520,7 +515,7 @@ def amdsmi_tool_dev_ecc_status_get(dev): result = {} for gpu_block in smi_api.AmdSmiGpuBlock: try: - value = smi_api. amdsmi_dev_get_ecc_status(dev, gpu_block) + value = smi_api. amdsmi_get_gpu_ecc_status(dev, gpu_block) result.update({gpu_block.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(gpu_block.name, e)) @@ -533,11 +528,11 @@ def amdsmi_tool_status_string(dic): def amdsmi_tool_compute_process_gpus_get(dic): pid = dic["pid"] - return smi_api.amdsmi_get_compute_process_gpus(pid) + return smi_api.amdsmi_get_gpu_compute_process_gpus(pid) def amdsmi_tool_compute_process_info_by_pid_get(dic): pid = dic["pid"] - return smi_api.amdsmi_get_compute_process_info_by_pid(pid) + return smi_api.amdsmi_get_gpu_compute_process_info_by_pid(pid) def amdsmi_tool_topo_get_link_weight(dev): return smi_api.amdsmi_topo_get_link_weight(dev[0], dev[1]) @@ -564,14 +559,14 @@ def amdsmi_tool_event_notification_get(dev): return result def amdsmi_tool_event_notification_init(dev): - return smi_api.amdsmi_wrapper.amdsmi_init_event_notification(dev) + return smi_api.amdsmi_wrapper.amdsmi_init_gpu_event_notification(dev) def amdsmi_tool_event_notification_mask_set(dev, dic): mask = dic["mask"] - return smi_api.amdsmi_wrapper. amdsmi_set_event_notification_mask(dev, ctypes.c_uint64(mask)) + return smi_api.amdsmi_wrapper. amdsmi_set_gpu_event_notification_mask(dev, ctypes.c_uint64(mask)) def amdsmi_tool_event_notification_stop(dev): - return smi_api.amdsmi_wrapper.amdsmi_stop_event_notification(dev) + return smi_api.amdsmi_wrapper.amdsmi_stop_gpu_event_notification(dev) def amdsmi_tool_shut_down(): smi_api.amdsmi_init() @@ -582,7 +577,7 @@ def amdsmi_tool_counter_available_counters_get(dev): result = {} for event_group in smi_api.AmdSmiEventGroup: try: - value = smi_api. amdsmi_counter_get_available_counters(dev, event_group) + value = smi_api. amdsmi_get_gpu_available_counters(dev, event_group) result.update({event_group.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(event_group.name, e)) @@ -594,8 +589,8 @@ def amdsmi_tool_counter_control(dev): for event_type in smi_api.AmdSmiEventType: for counter_command in smi_api.AmdSmiCounterCommand: try: - event_handle = smi_api.amdsmi_dev_create_counter(dev, event_type) - value = smi_api.amdsmi_control_counter(event_handle, counter_command) + event_handle = smi_api.amdsmi_gpu_create_counter(dev, event_type) + value = smi_api.amdsmi_gpu_control_counter(event_handle, counter_command) result.update({event_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(event_type.name, e)) @@ -606,8 +601,8 @@ def amdsmi_tool_counter_read(dev): result = {} for event_type in smi_api.AmdSmiEventType: try: - event_handle = smi_api.amdsmi_dev_create_counter(dev, event_type) - value = smi_api.amdsmi_read_counter(event_handle) + event_handle = smi_api.amdsmi_gpu_create_counter(dev, event_type) + value = smi_api.amdsmi_gpu_read_counter(event_handle) result.update({event_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(event_type.name, e)) @@ -620,7 +615,7 @@ def amdsmi_tool_dev_clk_range_set(dev, dic): max_clk = dic["max_clk"] for clock_type in smi_api.AmdSmiClkType: try: - value = smi_api.amdsmi_dev_set_clk_range(dev, min_clk, max_clk, clock_type) + value = smi_api.amdsmi_set_gpu_clk_range(dev, min_clk, max_clk, clock_type) result.update({clock_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(clock_type.name, e)) @@ -631,7 +626,7 @@ def amdsmi_tool_dev_counter_group_supported(dev): result = {} for event_group in smi_api.AmdSmiEventGroup: try: - value = smi_api.amdsmi_dev_counter_group_supported(dev, event_group) + value = smi_api.amdsmi_gpu_counter_group_supported(dev, event_group) result.update({event_group.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(event_group.name, e)) @@ -643,7 +638,7 @@ def amdsmi_tool_dev_gpu_clk_freq_set(dev, dic): freq_bitmask = dic["freq_bitmask"] for clock_type in smi_api.AmdSmiClkType: try: - value = smi_api. amdsmi_dev_set_clk_freq(dev, clock_type, freq_bitmask) + value = smi_api. amdsmi_set_clk_freq(dev, clock_type, freq_bitmask) result.update({clock_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(clock_type.name, e)) @@ -656,7 +651,7 @@ def amdsmi_tool_dev_od_clk_info_set(dev, dic): for freq_ind in smi_api.AmdSmiFreqInd: for clock_type in smi_api.AmdSmiClkType: try: - value = smi_api. amdsmi_dev_set_od_clk_info(dev, freq_ind, value, clock_type) + value = smi_api. amdsmi_set_gpu_od_clk_info(dev, freq_ind, value, clock_type) result.update({"AmdSmiFreqInd: " + freq_ind.name + ", AmdSmiClkType: " + clock_type.name: value}) except smi_api.AmdSmiException as e: print("{},{}:\t{}".format(freq_ind.name, clock_type.name, e)) @@ -667,13 +662,13 @@ def amdsmi_tool_dev_od_volt_info_set(dev, dic): vpoint = dic["vpoint"] clk_value = dic["clk_value"] volt_value = dic["volt_value"] - return smi_api. amdsmi_dev_set_od_volt_info(dev, vpoint, clk_value, volt_value) + return smi_api. amdsmi_set_gpu_od_volt_info(dev, vpoint, clk_value, volt_value) def amdsmi_tool_dev_perf_level_set(dev): result = {} for dev_perf_level in smi_api.AmdSmiDevPerfLevel: try: - value = smi_api. amdsmi_dev_set_perf_level(dev, dev_perf_level) + value = smi_api. amdsmi_set_gpu_perf_level(dev, dev_perf_level) result.update({dev_perf_level.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(dev_perf_level.name, e)) @@ -684,7 +679,7 @@ def amdsmi_tool_dev_perf_level_set_v1(dev): result = {} for dev_perf_level in smi_api.AmdSmiDevPerfLevel: try: - value = smi_api. amdsmi_dev_set_perf_level_v1(dev, dev_perf_level) + value = smi_api. amdsmi_set_gpu_perf_level_v1(dev, dev_perf_level) result.update({dev_perf_level.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(dev_perf_level.name, e)) @@ -694,14 +689,14 @@ def amdsmi_tool_dev_perf_level_set_v1(dev): def amdsmi_tool_dev_power_cap_set(dev, dic): sensor_ind = dic["sensor_ind"] cap = dic["cap"] - return smi_api. amdsmi_dev_set_power_cap(dev, sensor_ind, cap) + return smi_api. amdsmi_set_power_cap(dev, sensor_ind, cap) def amdsmi_tool_dev_power_profile_set(dev, dic): result = {} reserved = dic["reserved"] for power_profile_preset_maks in smi_api.AmdSmiPowerProfilePresetMasks: try: - value = smi_api. amdsmi_dev_set_power_profile(dev, reserved, power_profile_preset_maks) + value = smi_api. amdsmi_set_gpu_power_profile(dev, reserved, power_profile_preset_maks) result.update({power_profile_preset_maks.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(power_profile_preset_maks.name, e)) @@ -709,11 +704,11 @@ def amdsmi_tool_dev_power_profile_set(dev, dic): return result def amdsmi_tool_dev_supported_func_iterator_close(dev): - obj_handle = smi_api.amdsmi_dev_open_supported_func_iterator(dev) - return smi_api.amdsmi_dev_close_supported_func_iterator(obj_handle) + obj_handle = smi_api.amdsmi_open_supported_func_iterator(dev) + return smi_api.amdsmi_close_supported_func_iterator(obj_handle) def amdsmi_tool_func_iter_next(dev): - obj_handle = smi_api.amdsmi_dev_open_supported_func_iterator(dev) + obj_handle = smi_api.amdsmi_open_supported_func_iterator(dev) return smi_api.amdsmi_next_func_iter(obj_handle) ############################################## @@ -722,44 +717,44 @@ def amdsmi_tool_func_iter_next(dev): commands = { # idx: [func, {arg_name : [arg_type, is_arg_obligatory]}] - 1: [smi_api.amdsmi_dev_get_vendor_name, { + 1: [smi_api.amdsmi_get_gpu_vendor_name, { "device_identifier1": [None, True] }], - 2: [smi_api.amdsmi_dev_get_id, { + 2: [smi_api.amdsmi_get_gpu_id, { "device_identifier1": [None, True] }], - 3: [smi_api.amdsmi_dev_get_vram_vendor, { + 3: [smi_api.amdsmi_get_gpu_vram_vendor, { "device_identifier1": [None, True] }], - 4: [smi_api.amdsmi_dev_get_drm_render_minor, { + 4: [smi_api.amdsmi_get_gpu_drm_render_minor, { "device_identifier1": [None, True] }], - 5: [smi_api.amdsmi_dev_get_subsystem_id, { + 5: [smi_api.amdsmi_get_gpu_subsystem_id, { "device_identifier1": [None, True] }], - 6: [smi_api.amdsmi_dev_get_subsystem_name, { + 6: [smi_api.amdsmi_get_gpu_subsystem_name, { "device_identifier1": [None, True] }], - 7: [smi_api.amdsmi_dev_get_pci_id, { + 7: [smi_api.amdsmi_get_gpu_pci_id, { "device_identifier1": [None, True] }], - 8: [smi_api.amdsmi_dev_get_pci_bandwidth, { + 8: [smi_api.amdsmi_get_gpu_pci_bandwidth, { "device_identifier1": [None, True] }], - 9: [smi_api.amdsmi_dev_get_pci_throughput, { + 9: [smi_api.amdsmi_get_gpu_pci_throughput, { "device_identifier1": [None, True] }], - 10: [smi_api. amdsmi_dev_get_pci_replay_counter, { + 10: [smi_api. amdsmi_get_gpu_pci_replay_counter, { "device_identifier1": [None, True] }], - 11: [smi_api.amdsmi_topo_get_numa_affinity, { + 11: [smi_api.amdsmi_get_gpu_topo_numa_affinity, { "device_identifier1": [None, True] }], 12: [amdsmi_tool_dev_power_ave_get, { "device_identifier1": [None, True], "sensor_id": [int, True] }], - 13: [smi_api.amdsmi_dev_get_energy_count, { + 13: [smi_api.amdsmi_get_energy_count, { "device_identifier1": [None, True] }], 14: [amdsmi_tool_dev_memory_total_get, { @@ -768,10 +763,10 @@ commands = { 15: [amdsmi_tool_dev_memory_usage_get, { "device_identifier1": [None, True] }], - 16: [smi_api.amdsmi_dev_get_memory_busy_percent, { + 16: [smi_api.amdsmi_get_gpu_memory_busy_percent, { "device_identifier1": [None, True] }], - 17: [smi_api.amdsmi_dev_get_memory_reserved_pages, { + 17: [smi_api.amdsmi_get_gpu_memory_reserved_pages, { "device_identifier1": [None, True] }], 18: [amdsmi_tool_dev_fan_rpms_get, { @@ -792,29 +787,29 @@ commands = { 22: [amdsmi_tool_dev_volt_metric_get, { "device_identifier1": [None, True], }], - 23: [smi_api.amdsmi_dev_get_busy_percent, { + 23: [smi_api.amdsmi_get_busy_percent, { "device_identifier1": [None, True] }], 24: [amdsmi_tool_utilization_count_get, { "device_identifier1": [None, True], }], - 25: [smi_api.amdsmi_dev_get_perf_level, { + 25: [smi_api.amdsmi_get_gpu_perf_level, { "device_identifier1": [None, True] }], 26: [amdsmi_tool_perf_determinism_mode_set, { "device_identifier1": [None, True], "clock_value": [int, True] }], - 27: [smi_api.amdsmi_dev_get_overdrive_level, { + 27: [smi_api.amdsmi_get_gpu_overdrive_level, { "device_identifier1": [None, True] }], 28: [amdsmi_tool_dev_gpu_clk_freq_get, { "device_identifier1": [None, True] }], - 29: [smi_api. amdsmi_dev_get_od_volt_info, { + 29: [smi_api. amdsmi_get_gpu_od_volt_info, { "device_identifier1": [None, True] }], - 30: [smi_api. amdsmi_dev_get_gpu_metrics_info, { + 30: [smi_api. amdsmi_get_gpu_metrics_info, { "device_identifier1": [None, True] }], 31: [amdsmi_tool_dev_od_volt_curve_regions_get, { @@ -830,7 +825,7 @@ commands = { 35: [amdsmi_tool_dev_ecc_count_get, { "device_identifier1": [None, True] }], - 36: [smi_api. amdsmi_dev_get_ecc_enabled, { + 36: [smi_api. amdsmi_get_gpu_ecc_enabled, { "device_identifier1": [None, True] }], 37: [amdsmi_tool_dev_ecc_status_get, { @@ -839,17 +834,17 @@ commands = { 38: [amdsmi_tool_status_string, { "status": [int, True] }], - 39: [smi_api.amdsmi_get_compute_process_info, {}], + 39: [smi_api.amdsmi_get_gpu_compute_process_info, {}], 40: [amdsmi_tool_compute_process_info_by_pid_get, { "pid": [int, True] }], 41: [amdsmi_tool_compute_process_gpus_get, { "pid": [int, True] }], - 42: [smi_api.amdsmi_dev_xgmi_error_status, { + 42: [smi_api.amdsmi_gpu_xgmi_error_status, { "device_identifier1": [None, True] }], - 43: [smi_api.amdsmi_dev_reset_xgmi_error, { + 43: [smi_api.amdsmi_reset_gpu_xgmi_error, { "device_identifier1": [None, True] }], 44: [smi_api.amdsmi_topo_get_numa_node_number, { @@ -871,10 +866,10 @@ commands = { "device_identifier1": [None, True], "device_identifier2": [None, True] }], - 49: [smi_api.amdsmi_get_asic_info, { + 49: [smi_api.amdsmi_get_gpu_asic_info, { "device_identifier1": [None, True] }], - 50: [smi_api.amdsmi_get_device_handles, {}], + 50: [smi_api.amdsmi_get_processor_handles, {}], 51: [amdsmi_tool_event_notification_get, { "device_identifier1": [None, True] }], @@ -893,7 +888,7 @@ commands = { 57: [smi_api.amdsmi_get_fw_info, { "device_identifier1": [None, True] }], - 58: [smi_api.amdsmi_get_vbios_info, { + 58: [smi_api.amdsmi_get_gpu_vbios_info, { "device_identifier1": [None, True] }], 59: [amdsmi_tool_counter_available_counters_get, { @@ -926,7 +921,7 @@ commands = { "device_identifier1": [None, True], "freq_bitmask": [int, True] }], - 67: [smi_api.amdsmi_dev_reset_gpu, { + 67: [smi_api.amdsmi_reset_gpu, { "device_identifier1": [None, True] }], 68: [amdsmi_tool_dev_od_clk_info_set, { @@ -969,7 +964,7 @@ commands = { 77: [amdsmi_tool_dev_supported_func_iterator_close, { "device_identifier1": [None, True] }], - 78: [smi_api.amdsmi_dev_open_supported_func_iterator, { + 78: [smi_api.amdsmi_open_supported_func_iterator, { "device_identifier1": [None, True] }], 79: [amdsmi_tool_func_iter_next, { @@ -994,22 +989,22 @@ if __name__ == "__main__": smi_api.amdsmi_init() command = parser.get_command_handle() - device_handles = parser.get_device_handle() + processor_handles = parser.get_processor_handle() command_args = parser.get_command_args() result = None - if not device_handles and not command_args: + if not processor_handles and not command_args: result = command() - elif not device_handles and command_args: + elif not processor_handles and command_args: result = command(command_args) - elif len(device_handles) == 1 and not command_args: - result = command(device_handles[0]) - elif len(device_handles) > 1 and not command_args: - result = command(device_handles) - elif len(device_handles) == 1 and command_args: - result = command(device_handles[0], command_args) + elif len(processor_handles) == 1 and not command_args: + result = command(processor_handles[0]) + elif len(processor_handles) > 1 and not command_args: + result = command(processor_handles) + elif len(processor_handles) == 1 and command_args: + result = command(processor_handles[0], command_args) else: - result = command(device_handles, command_args) + result = command(processor_handles, command_args) formatter.print_output(result) diff --git a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h index a8f4cfa848..d40b4e5404 100755 --- a/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h +++ b/projects/amdsmi/rocm_smi/include/rocm_smi/rocm_smi_utils.h @@ -198,6 +198,10 @@ class ScopedAcquire { DISALLOW_COPY_AND_ASSIGN(ScopedAcquire); }; +// The best effort way to decide whether it is in VM guest environment: +// In VM environment, the /proc/cpuinfo set hypervisor flag by default +bool is_vm_guest(); + } // namespace smi } // namespace amd diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi.cc b/projects/amdsmi/rocm_smi/src/rocm_smi.cc index 12b8061a0c..75e92aff2e 100755 --- a/projects/amdsmi/rocm_smi/src/rocm_smi.cc +++ b/projects/amdsmi/rocm_smi/src/rocm_smi.cc @@ -850,6 +850,11 @@ rsmi_dev_overdrive_level_get(uint32_t dv_ind, uint32_t *od) { CHK_SUPPORT_NAME_ONLY(od) DEVICE_MUTEX + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + rsmi_status_t ret = get_dev_value_str(amd::smi::kDevOverDriveLevel, dv_ind, &val_str); if (ret != RSMI_STATUS_SUCCESS) { @@ -886,6 +891,12 @@ rsmi_dev_overdrive_level_set_v1(uint32_t dv_ind, uint32_t od) { if (od > kMaxOverdriveLevel) { return RSMI_STATUS_INVALID_ARGS; } + + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + DEVICE_MUTEX return set_dev_value(amd::smi::kDevOverDriveLevel, dv_ind, od); CATCH @@ -905,6 +916,11 @@ rsmi_dev_perf_level_set_v1(uint32_t dv_ind, rsmi_dev_perf_level_t perf_level) { return RSMI_STATUS_INVALID_ARGS; } + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + DEVICE_MUTEX return set_dev_value(amd::smi::kDevPerfLevel, dv_ind, perf_level); CATCH @@ -992,6 +1008,10 @@ static rsmi_status_t get_power_profiles(uint32_t dv_ind, } assert(val_vec.size() <= RSMI_MAX_NUM_POWER_PROFILES); if (val_vec.size() > RSMI_MAX_NUM_POWER_PROFILES + 1 || val_vec.size() < 1) { + // Guest may not have power related information. + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } return RSMI_STATUS_UNEXPECTED_SIZE; } // -1 for the header line, below @@ -1177,6 +1197,11 @@ rsmi_status_t rsmi_dev_clk_range_set(uint32_t dv_ind, uint64_t minclkvalue, return RSMI_STATUS_INVALID_ARGS; } + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + // Can only set the clock type for sys and mem type if (clkType != RSMI_CLK_TYPE_SYS && clkType != RSMI_CLK_TYPE_MEM) { return RSMI_STATUS_NOT_SUPPORTED; @@ -1601,6 +1626,11 @@ rsmi_dev_gpu_clk_freq_set(uint32_t dv_ind, return RSMI_STATUS_INVALID_ARGS; } + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + ret = rsmi_dev_gpu_clk_freq_get(dv_ind, clk_type, &freqs); if (ret != RSMI_STATUS_SUCCESS) { @@ -2058,6 +2088,10 @@ rsmi_dev_pci_bandwidth_set(uint32_t dv_ind, uint64_t bw_bitmask) { TRY REQUIRE_ROOT_ACCESS DEVICE_MUTEX + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } ret = rsmi_dev_pci_bandwidth_get(dv_ind, &bws); if (ret != RSMI_STATUS_SUCCESS) { @@ -2369,6 +2403,11 @@ rsmi_dev_fan_speed_set(uint32_t dv_ind, uint32_t sensor_ind, uint64_t speed) { REQUIRE_ROOT_ACCESS DEVICE_MUTEX + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + ret = rsmi_dev_fan_speed_max_get(dv_ind, sensor_ind, &max_speed); if (ret != RSMI_STATUS_SUCCESS) { @@ -2580,6 +2619,11 @@ rsmi_dev_power_cap_set(uint32_t dv_ind, uint32_t sensor_ind, uint64_t cap) { REQUIRE_ROOT_ACCESS DEVICE_MUTEX + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } + ret = rsmi_dev_power_cap_range_get(dv_ind, sensor_ind, &max, &min); if (ret != RSMI_STATUS_SUCCESS) { return ret; @@ -2622,6 +2666,10 @@ rsmi_dev_power_profile_set(uint32_t dv_ind, uint32_t dummy, (void)dummy; DEVICE_MUTEX + // Bare Metal only feature + if (amd::smi::is_vm_guest()) { + return RSMI_STATUS_NOT_SUPPORTED; + } rsmi_status_t ret = set_power_profile(dv_ind, profile); return ret; CATCH diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc index 473d1e2b67..93ff80be74 100755 --- a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc +++ b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc @@ -234,5 +234,24 @@ rsmi_status_t ErrnoToRsmiStatus(int err) { } } +bool is_vm_guest() { + // the cpuinfo will set hypervisor flag in VM guest + const std::string hypervisor = "hypervisor"; + std::string line; + + // default to false if cannot find the file + std::ifstream infile("/proc/cpuinfo"); + if (infile.fail()) { + return false; + } + + while (std::getline(infile, line)) { + if (line.find(hypervisor) != std::string::npos) { + return true; + } + } + return false; +} + } // namespace smi } // namespace amd diff --git a/projects/amdsmi/src/CMakeLists.txt b/projects/amdsmi/src/CMakeLists.txt index 48cc43ecc6..07b45cf3b4 100644 --- a/projects/amdsmi/src/CMakeLists.txt +++ b/projects/amdsmi/src/CMakeLists.txt @@ -41,7 +41,7 @@ set(SRC_LIST set(INC_LIST "${INC_DIR}/amdsmi.h" "${INC_DIR}/impl/amd_smi_common.h" - "${INC_DIR}/impl/amd_smi_device.h" + "${INC_DIR}/impl/amd_smi_processor.h" "${INC_DIR}/impl/amd_smi_drm.h" "${INC_DIR}/impl/amd_smi_gpu_device.h" "${INC_DIR}/impl/amd_smi_lib_loader.h" diff --git a/projects/amdsmi/src/amd_smi/amd_smi.cc b/projects/amdsmi/src/amd_smi/amd_smi.cc index 1b0790b93f..87ff9f566a 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi.cc @@ -76,21 +76,21 @@ static bool initialized_lib = false; } \ } while (0) -static amdsmi_status_t get_gpu_device_from_handle(amdsmi_device_handle device_handle, +static amdsmi_status_t get_gpu_device_from_handle(amdsmi_processor_handle processor_handle, amd::smi::AMDSmiGPUDevice** gpudevice) { AMDSMI_CHECK_INIT(); - if (device_handle == nullptr || gpudevice == nullptr) + if (processor_handle == nullptr || gpudevice == nullptr) return AMDSMI_STATUS_INVAL; - amd::smi::AMDSmiDevice* device = nullptr; + amd::smi::AMDSmiProcessor* device = nullptr; amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance() - .handle_to_device(device_handle, &device); + .handle_to_processor(processor_handle, &device); if (r != AMDSMI_STATUS_SUCCESS) return r; - if (device->get_device_type() == AMD_GPU) { - *gpudevice = static_cast(device_handle); + if (device->get_processor_type() == AMD_GPU) { + *gpudevice = static_cast(processor_handle); return AMDSMI_STATUS_SUCCESS; } @@ -99,12 +99,12 @@ static amdsmi_status_t get_gpu_device_from_handle(amdsmi_device_handle device_ha template amdsmi_status_t rsmi_wrapper(F && f, - amdsmi_device_handle device_handle, Args &&... args) { + amdsmi_processor_handle processor_handle, Args &&... args) { AMDSMI_CHECK_INIT(); amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -214,12 +214,12 @@ amdsmi_status_t amdsmi_get_socket_info( return AMDSMI_STATUS_SUCCESS; } -amdsmi_status_t amdsmi_get_device_handles(amdsmi_socket_handle socket_handle, - uint32_t* device_count, - amdsmi_device_handle* device_handles) { +amdsmi_status_t amdsmi_get_processor_handles(amdsmi_socket_handle socket_handle, + uint32_t* processor_count, + amdsmi_processor_handle* processor_handles) { AMDSMI_CHECK_INIT(); - if (device_count == nullptr) { + if (processor_count == nullptr) { return AMDSMI_STATUS_INVAL; } @@ -230,44 +230,44 @@ amdsmi_status_t amdsmi_get_device_handles(amdsmi_socket_handle socket_handle, if (r != AMDSMI_STATUS_SUCCESS) return r; - std::vector& devices = socket->get_devices(); - uint32_t device_size = static_cast(devices.size()); - // Get the device count only - if (device_handles == nullptr) { - *device_count = device_size; + std::vector& processors = socket->get_processors(); + uint32_t processor_size = static_cast(processors.size()); + // Get the processor count only + if (processor_handles == nullptr) { + *processor_count = processor_size; return AMDSMI_STATUS_SUCCESS; } - // If the device_handles can hold all devices, return all of them. - *device_count = *device_count >= device_size ? device_size : *device_count; + // If the processor_handles can hold all processors, return all of them. + *processor_count = *processor_count >= processor_size ? processor_size : *processor_count; - // Copy the device handles - for (uint32_t i = 0; i < *device_count; i++) { - device_handles[i] = reinterpret_cast(devices[i]); + // Copy the processor handles + for (uint32_t i = 0; i < *processor_count; i++) { + processor_handles[i] = reinterpret_cast(processors[i]); } return AMDSMI_STATUS_SUCCESS; } -amdsmi_status_t amdsmi_get_device_type(amdsmi_device_handle device_handle , - device_type_t* device_type) { +amdsmi_status_t amdsmi_get_processor_type(amdsmi_processor_handle processor_handle , + processor_type_t* processor_type) { AMDSMI_CHECK_INIT(); - if (device_type == nullptr) { + if (processor_type == nullptr) { return AMDSMI_STATUS_INVAL; } - amd::smi::AMDSmiDevice* device = nullptr; + amd::smi::AMDSmiProcessor* processor = nullptr; amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance() - .handle_to_device(device_handle, &device); + .handle_to_processor(processor_handle, &processor); if (r != AMDSMI_STATUS_SUCCESS) return r; - *device_type = device->get_device_type(); + *processor_type = processor->get_processor_type(); return AMDSMI_STATUS_SUCCESS; } amdsmi_status_t -amdsmi_get_device_bdf(amdsmi_device_handle device_handle, amdsmi_bdf_t *bdf) { +amdsmi_get_gpu_device_bdf(amdsmi_processor_handle processor_handle, amdsmi_bdf_t *bdf) { AMDSMI_CHECK_INIT(); @@ -276,7 +276,7 @@ amdsmi_get_device_bdf(amdsmi_device_handle device_handle, amdsmi_bdf_t *bdf) { } amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -286,7 +286,7 @@ amdsmi_get_device_bdf(amdsmi_device_handle device_handle, amdsmi_bdf_t *bdf) { return AMDSMI_STATUS_SUCCESS; } -amdsmi_status_t amdsmi_get_board_info(amdsmi_device_handle device_handle, amdsmi_board_info_t *board_info) { +amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_handle, amdsmi_board_info_t *board_info) { AMDSMI_CHECK_INIT(); @@ -296,7 +296,7 @@ amdsmi_status_t amdsmi_get_board_info(amdsmi_device_handle device_handle, amdsmi amdsmi_status_t status; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -307,11 +307,11 @@ amdsmi_status_t amdsmi_get_board_info(amdsmi_device_handle device_handle, amdsmi else { // ignore the errors so that it can populate as many fields as possible. // call rocm-smi which search multiple places for device name - status = rsmi_wrapper(rsmi_dev_name_get, device_handle, + status = rsmi_wrapper(rsmi_dev_name_get, processor_handle, board_info->product_name, AMDSMI_PRODUCT_NAME_LENGTH); if (board_info->product_serial[0] == '\0') { - status = rsmi_wrapper(rsmi_dev_serial_number_get, device_handle, + status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle, board_info->product_serial, AMDSMI_NORMAL_STRING_LENGTH); } } @@ -319,7 +319,7 @@ amdsmi_status_t amdsmi_get_board_info(amdsmi_device_handle device_handle, amdsmi return AMDSMI_STATUS_SUCCESS; } -amdsmi_status_t amdsmi_dev_get_temp_metric(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_temp_metric(amdsmi_processor_handle processor_handle, amdsmi_temperature_type_t sensor_type, amdsmi_temperature_metric_t metric, int64_t *temperature) { @@ -332,21 +332,21 @@ amdsmi_status_t amdsmi_dev_get_temp_metric(amdsmi_device_handle device_handle, // Get the PLX temperature from the gpu_metrics if (sensor_type == TEMPERATURE_TYPE_PLX) { amdsmi_gpu_metrics_t metric_info; - auto r_status = amdsmi_dev_get_gpu_metrics_info( - device_handle, &metric_info); + auto r_status = amdsmi_get_gpu_metrics_info( + processor_handle, &metric_info); if (r_status != AMDSMI_STATUS_SUCCESS) return r_status; *temperature = metric_info.temperature_vrsoc; return r_status; } - amdsmi_status_t amdsmi_status = rsmi_wrapper(rsmi_dev_temp_metric_get, device_handle, + amdsmi_status_t amdsmi_status = rsmi_wrapper(rsmi_dev_temp_metric_get, processor_handle, static_cast(sensor_type), static_cast(metric), temperature); *temperature /= 1000; return amdsmi_status; } -amdsmi_status_t amdsmi_get_vram_usage(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_vram_usage(amdsmi_processor_handle processor_handle, amdsmi_vram_info_t *vram_info) { AMDSMI_CHECK_INIT(); @@ -355,17 +355,17 @@ amdsmi_status_t amdsmi_get_vram_usage(amdsmi_device_handle device_handle, return AMDSMI_STATUS_INVAL; } - amd::smi::AMDSmiDevice* device = nullptr; + amd::smi::AMDSmiProcessor* device = nullptr; amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance() - .handle_to_device(device_handle, &device); + .handle_to_processor(processor_handle, &device); if (ret != AMDSMI_STATUS_SUCCESS) return ret; - if (device->get_device_type() != AMD_GPU) { + if (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(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -388,132 +388,42 @@ amdsmi_status_t amdsmi_get_vram_usage(amdsmi_device_handle device_handle, return AMDSMI_STATUS_SUCCESS; } -amdsmi_status_t amdsmi_get_caps_info(amdsmi_device_handle device_handle, - amdsmi_gpu_caps_t *info) { - - AMDSMI_CHECK_INIT(); - - if (info == nullptr) { - return AMDSMI_STATUS_INVAL; - } - - amd::smi::AMDSmiDevice* amd_device = nullptr; - amdsmi_status_t ret = amd::smi::AMDSmiSystem::getInstance() - .handle_to_device(device_handle, &amd_device); - if (ret != AMDSMI_STATUS_SUCCESS) return ret; - - if (amd_device->get_device_type() != AMD_GPU) { - return AMDSMI_STATUS_NOT_SUPPORTED; - } - amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_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(count); - - info->ras_supported = false; - - return AMDSMI_STATUS_SUCCESS; -} - -amdsmi_status_t amdsmi_dev_get_fan_rpms(amdsmi_device_handle device_handle, +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, device_handle, sensor_ind, + return rsmi_wrapper(rsmi_dev_fan_rpms_get, processor_handle, sensor_ind, speed); } -amdsmi_status_t amdsmi_dev_get_fan_speed(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_fan_speed(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, int64_t *speed) { - return rsmi_wrapper(rsmi_dev_fan_speed_get, device_handle, + return rsmi_wrapper(rsmi_dev_fan_speed_get, processor_handle, sensor_ind, speed); } -amdsmi_status_t amdsmi_dev_get_fan_speed_max(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_fan_speed_max(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t *max_speed) { - return rsmi_wrapper(rsmi_dev_fan_speed_max_get, device_handle, + return rsmi_wrapper(rsmi_dev_fan_speed_max_get, processor_handle, sensor_ind, max_speed); } -amdsmi_status_t amdsmi_dev_reset_fan(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_reset_gpu_fan(amdsmi_processor_handle processor_handle, uint32_t sensor_ind) { - return rsmi_wrapper(rsmi_dev_fan_reset, device_handle, sensor_ind); + return rsmi_wrapper(rsmi_dev_fan_reset, processor_handle, sensor_ind); } -amdsmi_status_t amdsmi_dev_set_fan_speed(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_fan_speed(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t speed) { - return rsmi_wrapper(rsmi_dev_fan_speed_set, device_handle, + return rsmi_wrapper(rsmi_dev_fan_speed_set, processor_handle, sensor_ind, speed); } -amdsmi_status_t amdsmi_dev_get_id(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_id(amdsmi_processor_handle processor_handle, uint16_t *id) { - return rsmi_wrapper(rsmi_dev_id_get, device_handle, id); + return rsmi_wrapper(rsmi_dev_id_get, processor_handle, id); } // TODO(bliu) : add fw info from libdrm -amdsmi_status_t amdsmi_get_fw_info(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_fw_info(amdsmi_processor_handle processor_handle, amdsmi_fw_info_t *info) { const std::map fw_in_rsmi = { { FW_ID_ASD, RSMI_FW_BLOCK_ASD}, @@ -547,7 +457,7 @@ amdsmi_status_t amdsmi_get_fw_info(amdsmi_device_handle device_handle, // collect all rsmi supported fw block for (auto ite = fw_in_rsmi.begin(); ite != fw_in_rsmi.end(); ite ++) { - auto status = rsmi_wrapper(rsmi_dev_firmware_version_get, device_handle, + auto status = rsmi_wrapper(rsmi_dev_firmware_version_get, processor_handle, (*ite).second, &(info->fw_info_list[info->num_fw_info].fw_version)); if (status == AMDSMI_STATUS_SUCCESS) { @@ -559,7 +469,7 @@ amdsmi_status_t amdsmi_get_fw_info(amdsmi_device_handle device_handle, } amdsmi_status_t -amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *info) { +amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_info_t *info) { AMDSMI_CHECK_INIT(); @@ -572,7 +482,7 @@ amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *inf uint16_t subvendor_id = 0; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -592,28 +502,27 @@ amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *inf status = smi_amdgpu_get_market_name_from_dev_id(dev_info.device_id, info->market_name); if (status != AMDSMI_STATUS_SUCCESS) { - rsmi_wrapper(rsmi_dev_brand_get, device_handle, + rsmi_wrapper(rsmi_dev_brand_get, processor_handle, info->market_name, AMDSMI_NORMAL_STRING_LENGTH); } 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(); } // For other sysfs related information, get from rocm-smi else { - status = rsmi_wrapper(rsmi_dev_serial_number_get, device_handle, + status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle, info->asic_serial, AMDSMI_NORMAL_STRING_LENGTH); - status = rsmi_wrapper(rsmi_dev_brand_get, device_handle, + status = rsmi_wrapper(rsmi_dev_brand_get, processor_handle, info->market_name, AMDSMI_NORMAL_STRING_LENGTH); - status = rsmi_wrapper(rsmi_dev_vendor_id_get, device_handle, + status = rsmi_wrapper(rsmi_dev_vendor_id_get, processor_handle, &vendor_id); if (status == AMDSMI_STATUS_SUCCESS) info->vendor_id = vendor_id; - status = rsmi_wrapper(rsmi_dev_subsystem_vendor_id_get, device_handle, + status = rsmi_wrapper(rsmi_dev_subsystem_vendor_id_get, processor_handle, &subvendor_id); if (status == AMDSMI_STATUS_SUCCESS) info->subvendor_id = subvendor_id; } @@ -622,40 +531,40 @@ amdsmi_get_asic_info(amdsmi_device_handle device_handle, amdsmi_asic_info_t *inf } -amdsmi_status_t amdsmi_dev_get_subsystem_id(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_subsystem_id(amdsmi_processor_handle processor_handle, uint16_t *id) { - return rsmi_wrapper(rsmi_dev_subsystem_id_get, device_handle, id); + return rsmi_wrapper(rsmi_dev_subsystem_id_get, processor_handle, id); } -amdsmi_status_t amdsmi_dev_get_subsystem_name( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_subsystem_name( + amdsmi_processor_handle processor_handle, char *name, size_t len) { - return rsmi_wrapper(rsmi_dev_subsystem_name_get, device_handle, name, len); + return rsmi_wrapper(rsmi_dev_subsystem_name_get, processor_handle, name, len); } -amdsmi_status_t amdsmi_dev_get_vendor_name( - amdsmi_device_handle device_handle, char *name, size_t len) { - return rsmi_wrapper(rsmi_dev_vendor_name_get, device_handle, name, len); +amdsmi_status_t amdsmi_get_gpu_vendor_name( + amdsmi_processor_handle processor_handle, char *name, size_t len) { + return rsmi_wrapper(rsmi_dev_vendor_name_get, processor_handle, name, len); } -amdsmi_status_t amdsmi_dev_get_vram_vendor(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_vram_vendor(amdsmi_processor_handle processor_handle, char *brand, uint32_t len) { - return rsmi_wrapper(rsmi_dev_vram_vendor_get, device_handle, brand, len); + return rsmi_wrapper(rsmi_dev_vram_vendor_get, processor_handle, brand, len); } amdsmi_status_t -amdsmi_init_event_notification(amdsmi_device_handle device_handle) { - return rsmi_wrapper(rsmi_event_notification_init, device_handle); +amdsmi_init_gpu_event_notification(amdsmi_processor_handle processor_handle) { + return rsmi_wrapper(rsmi_event_notification_init, processor_handle); } amdsmi_status_t - amdsmi_set_event_notification_mask(amdsmi_device_handle device_handle, + amdsmi_set_gpu_event_notification_mask(amdsmi_processor_handle processor_handle, uint64_t mask) { - return rsmi_wrapper(rsmi_event_notification_mask_set, device_handle, mask); + return rsmi_wrapper(rsmi_event_notification_mask_set, processor_handle, mask); } amdsmi_status_t - amdsmi_get_event_notification(int timeout_ms, + amdsmi_get_gpu_event_notification(int timeout_ms, uint32_t *num_elem, amdsmi_evt_notification_data_t *data) { AMDSMI_CHECK_INIT(); @@ -678,38 +587,38 @@ amdsmi_status_t strncpy(data[i].message, rsmi_data.message, MAX_EVENT_NOTIFICATION_MSG_SIZE); amdsmi_status_t r = amd::smi::AMDSmiSystem::getInstance() - .gpu_index_to_handle(rsmi_data.dv_ind, &(data[i].device_handle)); + .gpu_index_to_handle(rsmi_data.dv_ind, &(data[i].processor_handle)); if (r != AMDSMI_STATUS_SUCCESS) return r; } return AMDSMI_STATUS_SUCCESS; } -amdsmi_status_t amdsmi_stop_event_notification( - amdsmi_device_handle device_handle) { - return rsmi_wrapper(rsmi_event_notification_stop, device_handle); +amdsmi_status_t amdsmi_stop_gpu_event_notification( + amdsmi_processor_handle processor_handle) { + return rsmi_wrapper(rsmi_event_notification_stop, processor_handle); } -amdsmi_status_t amdsmi_dev_counter_group_supported( - amdsmi_device_handle device_handle, amdsmi_event_group_t group) { - return rsmi_wrapper(rsmi_dev_counter_group_supported, device_handle, +amdsmi_status_t amdsmi_gpu_counter_group_supported( + amdsmi_processor_handle processor_handle, amdsmi_event_group_t group) { + return rsmi_wrapper(rsmi_dev_counter_group_supported, processor_handle, static_cast(group)); } -amdsmi_status_t amdsmi_dev_create_counter(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_gpu_create_counter(amdsmi_processor_handle processor_handle, amdsmi_event_type_t type, amdsmi_event_handle_t *evnt_handle) { - return rsmi_wrapper(rsmi_dev_counter_create, device_handle, + return rsmi_wrapper(rsmi_dev_counter_create, processor_handle, static_cast(type), static_cast(evnt_handle)); } -amdsmi_status_t amdsmi_dev_destroy_counter(amdsmi_event_handle_t evnt_handle) { +amdsmi_status_t amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle) { rsmi_status_t r = rsmi_dev_counter_destroy( static_cast(evnt_handle)); return amd::smi::rsmi_to_amdsmi_status(r); } -amdsmi_status_t amdsmi_control_counter(amdsmi_event_handle_t evt_handle, +amdsmi_status_t amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_command_t cmd, void *cmd_args) { rsmi_status_t r = rsmi_counter_control( static_cast(evt_handle), @@ -718,7 +627,7 @@ amdsmi_status_t amdsmi_control_counter(amdsmi_event_handle_t evt_handle, } amdsmi_status_t -amdsmi_read_counter(amdsmi_event_handle_t evt_handle, +amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_value_t *value) { rsmi_status_t r = rsmi_counter_read( static_cast(evt_handle), @@ -727,29 +636,29 @@ amdsmi_read_counter(amdsmi_event_handle_t evt_handle, } amdsmi_status_t - amdsmi_counter_get_available_counters(amdsmi_device_handle device_handle, + amdsmi_get_gpu_available_counters(amdsmi_processor_handle processor_handle, amdsmi_event_group_t grp, uint32_t *available) { - return rsmi_wrapper(rsmi_counter_available_counters_get, device_handle, + return rsmi_wrapper(rsmi_counter_available_counters_get, processor_handle, static_cast(grp), available); } amdsmi_status_t -amdsmi_topo_get_numa_node_number(amdsmi_device_handle device_handle, uint32_t *numa_node) { - return rsmi_wrapper(rsmi_topo_get_numa_node_number, device_handle, numa_node); +amdsmi_topo_get_numa_node_number(amdsmi_processor_handle processor_handle, uint32_t *numa_node) { + return rsmi_wrapper(rsmi_topo_get_numa_node_number, processor_handle, numa_node); } amdsmi_status_t -amdsmi_topo_get_link_weight(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst, +amdsmi_topo_get_link_weight(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, uint64_t *weight) { AMDSMI_CHECK_INIT(); amd::smi::AMDSmiGPUDevice* src_device = nullptr; amd::smi::AMDSmiGPUDevice* dst_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle_src, &src_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle_src, &src_device); if (r != AMDSMI_STATUS_SUCCESS) return r; - r = get_gpu_device_from_handle(device_handle_dst, &dst_device); + r = get_gpu_device_from_handle(processor_handle_dst, &dst_device); if (r != AMDSMI_STATUS_SUCCESS) return r; auto rstatus = rsmi_topo_get_link_weight(src_device->get_gpu_id(), dst_device->get_gpu_id(), @@ -758,16 +667,16 @@ amdsmi_topo_get_link_weight(amdsmi_device_handle device_handle_src, amdsmi_devic } amdsmi_status_t - amdsmi_get_minmax_bandwidth(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst, + amdsmi_get_minmax_bandwidth(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, uint64_t *min_bandwidth, uint64_t *max_bandwidth) { AMDSMI_CHECK_INIT(); amd::smi::AMDSmiGPUDevice* src_device = nullptr; amd::smi::AMDSmiGPUDevice* dst_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle_src, &src_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle_src, &src_device); if (r != AMDSMI_STATUS_SUCCESS) return r; - r = get_gpu_device_from_handle(device_handle_dst, &dst_device); + r = get_gpu_device_from_handle(processor_handle_dst, &dst_device); if (r != AMDSMI_STATUS_SUCCESS) return r; auto rstatus = rsmi_minmax_bandwidth_get(src_device->get_gpu_id(), dst_device->get_gpu_id(), @@ -776,16 +685,16 @@ amdsmi_status_t } amdsmi_status_t -amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src, amdsmi_device_handle device_handle_dst, +amdsmi_topo_get_link_type(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst, uint64_t *hops, AMDSMI_IO_LINK_TYPE *type) { AMDSMI_CHECK_INIT(); amd::smi::AMDSmiGPUDevice* src_device = nullptr; amd::smi::AMDSmiGPUDevice* dst_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle_src, &src_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle_src, &src_device); if (r != AMDSMI_STATUS_SUCCESS) return r; - r = get_gpu_device_from_handle(device_handle_dst, &dst_device); + r = get_gpu_device_from_handle(processor_handle_dst, &dst_device); if (r != AMDSMI_STATUS_SUCCESS) return r; auto rstatus = rsmi_topo_get_link_type(src_device->get_gpu_id(), dst_device->get_gpu_id(), @@ -794,17 +703,17 @@ amdsmi_topo_get_link_type(amdsmi_device_handle device_handle_src, amdsmi_device_ } amdsmi_status_t -amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, - amdsmi_device_handle device_handle_dst, +amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, + amdsmi_processor_handle processor_handle_dst, bool *accessible) { AMDSMI_CHECK_INIT(); amd::smi::AMDSmiGPUDevice* src_device = nullptr; amd::smi::AMDSmiGPUDevice* dst_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle_src, &src_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle_src, &src_device); if (r != AMDSMI_STATUS_SUCCESS) return r; - r = get_gpu_device_from_handle(device_handle_dst, &dst_device); + r = get_gpu_device_from_handle(processor_handle_dst, &dst_device); if (r != AMDSMI_STATUS_SUCCESS) return r; auto rstatus = rsmi_is_P2P_accessible(src_device->get_gpu_id(), dst_device->get_gpu_id(), @@ -814,39 +723,39 @@ amdsmi_is_P2P_accessible(amdsmi_device_handle device_handle_src, // TODO(bliu) : other xgmi related information amdsmi_status_t -amdsmi_get_xgmi_info(amdsmi_device_handle device_handle, amdsmi_xgmi_info_t *info) { +amdsmi_get_xgmi_info(amdsmi_processor_handle processor_handle, amdsmi_xgmi_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_xgmi_hive_id_get, device_handle, + return rsmi_wrapper(rsmi_dev_xgmi_hive_id_get, processor_handle, &(info->xgmi_hive_id)); } amdsmi_status_t -amdsmi_dev_xgmi_error_status(amdsmi_device_handle device_handle, amdsmi_xgmi_status_t *status) { - return rsmi_wrapper(rsmi_dev_xgmi_error_status, device_handle, +amdsmi_gpu_xgmi_error_status(amdsmi_processor_handle processor_handle, amdsmi_xgmi_status_t *status) { + return rsmi_wrapper(rsmi_dev_xgmi_error_status, processor_handle, reinterpret_cast(status)); } amdsmi_status_t -amdsmi_dev_reset_xgmi_error(amdsmi_device_handle device_handle) { - return rsmi_wrapper(rsmi_dev_xgmi_error_reset, device_handle); +amdsmi_reset_gpu_xgmi_error(amdsmi_processor_handle processor_handle) { + return rsmi_wrapper(rsmi_dev_xgmi_error_reset, processor_handle); } amdsmi_status_t -amdsmi_dev_open_supported_func_iterator(amdsmi_device_handle device_handle, +amdsmi_open_supported_func_iterator(amdsmi_processor_handle processor_handle, amdsmi_func_id_iter_handle_t *handle) { AMDSMI_CHECK_INIT(); if (handle == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_supported_func_iterator_open, device_handle, + return rsmi_wrapper(rsmi_dev_supported_func_iterator_open, processor_handle, reinterpret_cast(handle)); } amdsmi_status_t -amdsmi_dev_open_supported_variant_iterator(amdsmi_func_id_iter_handle_t obj_h, +amdsmi_open_supported_variant_iterator(amdsmi_func_id_iter_handle_t obj_h, amdsmi_func_id_iter_handle_t *var_iter) { AMDSMI_CHECK_INIT(); @@ -868,7 +777,7 @@ amdsmi_next_func_iter(amdsmi_func_id_iter_handle_t handle) { } amdsmi_status_t -amdsmi_dev_close_supported_func_iterator(amdsmi_func_id_iter_handle_t *handle) { +amdsmi_close_supported_func_iterator(amdsmi_func_id_iter_handle_t *handle) { AMDSMI_CHECK_INIT(); if (handle == nullptr) @@ -888,68 +797,67 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle, return AMDSMI_STATUS_INVAL; static const std::map rsmi_2_amdsmi = { - {"rsmi_dev_vram_vendor_get", "amdsmi_dev_get_vram_vendor"}, - {"rsmi_dev_id_get", "amdsmi_dev_get_id"}, - {"rsmi_dev_vendor_id_get", "amdsmi_get_asic_info"}, - {"rsmi_dev_name_get", "amdsmi_get_board_info"}, - {"rsmi_dev_sku_get", "amdsmi_get_board_info"}, - {"rsmi_dev_brand_get", "amdsmi_get_asic_info"}, - {"rsmi_dev_vendor_name_get", "amdsmi_dev_get_vendor_name"}, - {"rsmi_dev_serial_number_get", "amdsmi_get_asic_info"}, - {"rsmi_dev_subsystem_id_get", "amdsmi_dev_get_subsystem_id"}, - {"rsmi_dev_subsystem_name_get", "amdsmi_dev_get_subsystem_name"}, - {"rsmi_dev_drm_render_minor_get", "amdsmi_dev_get_drm_render_minor"}, - {"rsmi_dev_subsystem_vendor_id_get", "amdsmi_get_asic_info"}, - {"rsmi_dev_unique_id_get", "amdsmi_get_board_info"}, - {"rsmi_dev_pci_bandwidth_get", "amdsmi_dev_get_pci_bandwidth"}, - {"rsmi_dev_pci_id_get", "amdsmi_dev_get_pci_id"}, - {"rsmi_dev_pci_throughput_get", "amdsmi_dev_get_pci_throughput"}, - {"rsmi_dev_pci_replay_counter_get", " amdsmi_dev_get_pci_replay_counter"}, - {"rsmi_dev_pci_bandwidth_set", " amdsmi_dev_set_pci_bandwidth"}, - {"rsmi_dev_power_profile_set", " amdsmi_dev_set_power_profile"}, - {"rsmi_dev_memory_busy_percent_get", "amdsmi_dev_get_memory_busy_percent"}, - {"rsmi_dev_busy_percent_get", "amdsmi_dev_get_busy_percent"}, - {"rsmi_dev_memory_reserved_pages_get", "amdsmi_dev_get_memory_reserved_pages"}, - {"rsmi_dev_overdrive_level_get", "amdsmi_dev_get_overdrive_level"}, - {"rsmi_dev_power_profile_presets_get", " amdsmi_dev_get_power_profile_presets"}, - {"rsmi_dev_perf_level_set", " amdsmi_dev_set_perf_level"}, - {"rsmi_dev_perf_level_set_v1", " amdsmi_dev_set_perf_level_v1"}, - {"rsmi_dev_perf_level_get", "amdsmi_dev_get_perf_level"}, - {"rsmi_perf_determinism_mode_set", "amdsmi_set_perf_determinism_mode"}, - {"rsmi_dev_overdrive_level_set", " amdsmi_dev_set_overdrive_level"}, - {"rsmi_dev_vbios_version_get", "amdsmi_get_vbios_info"}, - {"rsmi_dev_od_volt_info_get", " amdsmi_dev_get_od_volt_info"}, - {"rsmi_dev_od_volt_info_set", " amdsmi_dev_set_od_volt_info"}, - {"rsmi_dev_od_volt_curve_regions_get", " amdsmi_dev_get_od_volt_curve_regions"}, - {"rsmi_dev_ecc_enabled_get", " amdsmi_dev_get_ecc_enabled"}, - {"rsmi_dev_ecc_status_get", " amdsmi_dev_get_ecc_status"}, - {"rsmi_dev_counter_group_supported", "amdsmi_dev_counter_group_supported"}, - {"rsmi_dev_counter_create", "amdsmi_dev_create_counter"}, - {"rsmi_dev_xgmi_error_status", "amdsmi_dev_xgmi_error_status"}, - {"rsmi_dev_xgmi_error_reset", "amdsmi_dev_reset_xgmi_error"}, - {"rsmi_dev_memory_reserved_pages_get", "amdsmi_dev_get_memory_reserved_pages"}, - {"rsmi_topo_numa_affinity_get", "amdsmi_topo_get_numa_affinity"}, - {"rsmi_dev_gpu_metrics_info_get", " amdsmi_dev_get_gpu_metrics_info"}, - {"rsmi_dev_gpu_reset", "amdsmi_dev_reset_gpu"}, - {"rsmi_dev_memory_total_get", "amdsmi_dev_get_memory_total"}, - {"rsmi_dev_memory_usage_get", "amdsmi_dev_get_memory_usage"}, - {"rsmi_dev_gpu_clk_freq_get", " amdsmi_dev_get_gpu_clk_freq"}, - {"rsmi_dev_gpu_clk_freq_set", " amdsmi_dev_set_clk_freq"}, + {"rsmi_dev_vram_vendor_get", "amdsmi_get_gpu_vram_vendor"}, + {"rsmi_dev_id_get", "amdsmi_get_gpu_id"}, + {"rsmi_dev_vendor_id_get", "amdsmi_get_gpu_asic_info"}, + {"rsmi_dev_name_get", "amdsmi_get_gpu_board_info"}, + {"rsmi_dev_sku_get", "amdsmi_get_gpu_board_info"}, + {"rsmi_dev_brand_get", "amdsmi_get_gpu_asic_info"}, + {"rsmi_dev_vendor_name_get", "amdsmi_get_gpu_vendor_name"}, + {"rsmi_dev_serial_number_get", "amdsmi_get_gpu_asic_info"}, + {"rsmi_dev_subsystem_id_get", "amdsmi_get_gpu_subsystem_id"}, + {"rsmi_dev_subsystem_name_get", "amdsmi_get_gpu_subsystem_name"}, + {"rsmi_dev_drm_render_minor_get", "amdsmi_get_gpu_drm_render_minor"}, + {"rsmi_dev_subsystem_vendor_id_get", "amdsmi_get_gpu_asic_info"}, + {"rsmi_dev_unique_id_get", "amdsmi_get_gpu_board_info"}, + {"rsmi_dev_pci_bandwidth_get", "amdsmi_get_gpu_pci_bandwidth"}, + {"rsmi_dev_pci_id_get", "amdsmi_get_gpu_pci_id"}, + {"rsmi_dev_pci_throughput_get", "amdsmi_get_gpu_pci_throughput"}, + {"rsmi_dev_pci_replay_counter_get", " amdsmi_get_gpu_pci_replay_counter"}, + {"rsmi_dev_pci_bandwidth_set", " amdsmi_set_gpu_pci_bandwidth"}, + {"rsmi_dev_power_profile_set", " amdsmi_set_gpu_power_profile"}, + {"rsmi_dev_memory_busy_percent_get", "amdsmi_get_gpu_memory_busy_percent"}, + {"rsmi_dev_busy_percent_get", "amdsmi_get_busy_percent"}, + {"rsmi_dev_memory_reserved_pages_get", "amdsmi_get_gpu_memory_reserved_pages"}, + {"rsmi_dev_overdrive_level_get", "amdsmi_get_gpu_overdrive_level"}, + {"rsmi_dev_power_profile_presets_get", " amdsmi_get_gpu_power_profile_presets"}, + {"rsmi_dev_perf_level_set", " amdsmi_set_gpu_perf_level"}, + {"rsmi_dev_perf_level_set_v1", " amdsmi_set_gpu_perf_level_v1"}, + {"rsmi_dev_perf_level_get", "amdsmi_get_gpu_perf_level"}, + {"rsmi_perf_determinism_mode_set", "amdsmi_set_gpu_perf_determinism_mode"}, + {"rsmi_dev_overdrive_level_set", " amdsmi_set_gpu_overdrive_level"}, + {"rsmi_dev_vbios_version_get", "amdsmi_get_gpu_vbios_info"}, + {"rsmi_dev_od_volt_info_get", " amdsmi_get_gpu_od_volt_info"}, + {"rsmi_dev_od_volt_info_set", " amdsmi_set_gpu_od_volt_info"}, + {"rsmi_dev_od_volt_curve_regions_get", " amdsmi_get_gpu_od_volt_curve_regions"}, + {"rsmi_dev_ecc_enabled_get", " amdsmi_get_gpu_ecc_enabled"}, + {"rsmi_dev_ecc_status_get", " amdsmi_get_gpu_ecc_status"}, + {"rsmi_dev_counter_group_supported", "amdsmi_gpu_counter_group_supported"}, + {"rsmi_dev_counter_create", "amdsmi_gpu_create_counter"}, + {"rsmi_dev_xgmi_error_status", "amdsmi_gpu_xgmi_error_status"}, + {"rsmi_dev_xgmi_error_reset", "amdsmi_reset_gpu_xgmi_error"}, + {"rsmi_dev_memory_reserved_pages_get", "amdsmi_get_gpu_memory_reserved_pages"}, + {"rsmi_topo_numa_affinity_get", "amdsmi_get_gpu_topo_numa_affinity"}, + {"rsmi_dev_gpu_metrics_info_get", " amdsmi_get_gpu_metrics_info"}, + {"rsmi_dev_gpu_reset", "amdsmi_reset_gpu"}, + {"rsmi_dev_memory_total_get", "amdsmi_get_gpu_memory_total"}, + {"rsmi_dev_memory_usage_get", "amdsmi_get_gpu_memory_usage"}, + {"rsmi_dev_gpu_clk_freq_get", " amdsmi_get_clk_freq"}, + {"rsmi_dev_gpu_clk_freq_set", " amdsmi_set_clk_freq"}, {"rsmi_dev_firmware_version_get", "amdsmi_get_fw_info"}, - {"rsmi_dev_ecc_count_get", " amdsmi_dev_get_ecc_count"}, - {"rsmi_counter_available_counters_get", " amdsmi_counter_get_available_counters"}, - {"rsmi_dev_power_ave_get", "amdsmi_dev_get_power_ave"}, + {"rsmi_dev_ecc_count_get", " amdsmi_get_gpu_ecc_count"}, + {"rsmi_counter_available_counters_get", " amdsmi_get_gpu_available_counters"}, {"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"}, - {"rsmi_dev_power_cap_set", " amdsmi_dev_set_power_cap"}, - {"rsmi_dev_fan_rpms_get", "amdsmi_dev_get_fan_rpms"}, - {"rsmi_dev_fan_speed_get", "amdsmi_dev_get_fan_speed"}, - {"rsmi_dev_fan_speed_max_get", "amdsmi_dev_get_fan_speed_max"}, - {"rsmi_dev_temp_metric_get", " amdsmi_dev_get_temp_metric"}, - {"rsmi_dev_fan_reset", "amdsmi_dev_reset_fan"}, - {"rsmi_dev_fan_speed_set", "amdsmi_dev_set_fan_speed"}, - {"rsmi_dev_volt_metric_get", " amdsmi_dev_get_volt_metric"} + {"rsmi_dev_power_cap_set", " amdsmi_set_power_cap"}, + {"rsmi_dev_fan_rpms_get", "amdsmi_get_gpu_fan_rpms"}, + {"rsmi_dev_fan_speed_get", "amdsmi_get_gpu_fan_speed"}, + {"rsmi_dev_fan_speed_max_get", "amdsmi_get_gpu_fan_speed_max"}, + {"rsmi_dev_temp_metric_get", " amdsmi_get_temp_metric"}, + {"rsmi_dev_fan_reset", "amdsmi_reset_gpu_fan"}, + {"rsmi_dev_fan_speed_set", "amdsmi_set_gpu_fan_speed"}, + {"rsmi_dev_volt_metric_get", " amdsmi_get_gpu_volt_metric"} }; auto rocm_func_handle = @@ -975,7 +883,7 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle, } amdsmi_status_t -amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items) { +amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items) { AMDSMI_CHECK_INIT(); if (num_items == nullptr) @@ -986,7 +894,7 @@ amdsmi_get_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_item return amd::smi::rsmi_to_amdsmi_status(r); } -amdsmi_status_t amdsmi_get_compute_process_info_by_pid(uint32_t pid, +amdsmi_status_t amdsmi_get_gpu_compute_process_info_by_pid(uint32_t pid, amdsmi_process_info_t *proc) { AMDSMI_CHECK_INIT(); @@ -998,7 +906,7 @@ amdsmi_status_t amdsmi_get_compute_process_info_by_pid(uint32_t pid, } amdsmi_status_t -amdsmi_get_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, +amdsmi_get_gpu_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, uint32_t *num_devices) { AMDSMI_CHECK_INIT(); @@ -1008,60 +916,60 @@ amdsmi_get_compute_process_gpus(uint32_t pid, uint32_t *dv_indices, return amd::smi::rsmi_to_amdsmi_status(r); } -amdsmi_status_t amdsmi_dev_get_ecc_count(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_error_count_t *ec) { AMDSMI_CHECK_INIT(); if (ec == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_ecc_count_get, device_handle, + return rsmi_wrapper(rsmi_dev_ecc_count_get, processor_handle, static_cast(block), reinterpret_cast(ec)); } -amdsmi_status_t amdsmi_dev_get_ecc_enabled(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_ecc_enabled(amdsmi_processor_handle processor_handle, uint64_t *enabled_blocks) { AMDSMI_CHECK_INIT(); if (enabled_blocks == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_ecc_enabled_get, device_handle, + return rsmi_wrapper(rsmi_dev_ecc_enabled_get, processor_handle, enabled_blocks); } -amdsmi_status_t amdsmi_dev_get_ecc_status(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_ras_err_state_t *state) { AMDSMI_CHECK_INIT(); if (state == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_ecc_status_get, device_handle, + return rsmi_wrapper(rsmi_dev_ecc_status_get, processor_handle, static_cast(block), reinterpret_cast(state)); } amdsmi_status_t -amdsmi_dev_get_busy_percent(amdsmi_device_handle device_handle, +amdsmi_get_busy_percent(amdsmi_processor_handle processor_handle, uint32_t *busy_percent) { AMDSMI_CHECK_INIT(); if (busy_percent == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_busy_percent_get, device_handle, + return rsmi_wrapper(rsmi_dev_busy_percent_get, processor_handle, busy_percent); } -amdsmi_status_t amdsmi_dev_get_gpu_metrics_info( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_metrics_info( + amdsmi_processor_handle processor_handle, amdsmi_gpu_metrics_t *pgpu_metrics) { AMDSMI_CHECK_INIT(); if (pgpu_metrics == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, device_handle, + return rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, processor_handle, reinterpret_cast(pgpu_metrics)); } amdsmi_status_t -amdsmi_get_power_cap_info(amdsmi_device_handle device_handle, +amdsmi_get_power_cap_info(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_cap_info_t *info) { AMDSMI_CHECK_INIT(); @@ -1071,9 +979,13 @@ amdsmi_get_power_cap_info(amdsmi_device_handle device_handle, bool set_ret_success = false; amd::smi::AMDSmiGPUDevice* gpudevice = nullptr; + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpudevice); + if (r != AMDSMI_STATUS_SUCCESS) + return r; + amdsmi_status_t status; - status = get_gpu_device_from_handle(device_handle, &gpudevice); + status = get_gpu_device_from_handle(processor_handle, &gpudevice); if (status != AMDSMI_STATUS_SUCCESS) { return status; @@ -1097,20 +1009,20 @@ amdsmi_get_power_cap_info(amdsmi_device_handle device_handle, info->dpm_cap = dpm; } else { - status = rsmi_wrapper(rsmi_dev_power_cap_get, device_handle, + status = rsmi_wrapper(rsmi_dev_power_cap_get, processor_handle, sensor_ind, &(info->power_cap)); if ((status == AMDSMI_STATUS_SUCCESS) && !set_ret_success) set_ret_success = true; } // Get other information from rocm-smi - status = rsmi_wrapper(rsmi_dev_power_cap_default_get, device_handle, + status = rsmi_wrapper(rsmi_dev_power_cap_default_get, processor_handle, &(info->default_power_cap)); if ((status == AMDSMI_STATUS_SUCCESS) && !set_ret_success) set_ret_success = true; - status = rsmi_wrapper(rsmi_dev_power_cap_range_get, device_handle, sensor_ind, + status = rsmi_wrapper(rsmi_dev_power_cap_range_get, processor_handle, sensor_ind, &(info->max_power_cap), &(info->min_power_cap)); if ((status == AMDSMI_STATUS_SUCCESS) && !set_ret_success) @@ -1120,85 +1032,75 @@ amdsmi_get_power_cap_info(amdsmi_device_handle device_handle, } amdsmi_status_t - amdsmi_dev_set_power_cap(amdsmi_device_handle device_handle, + amdsmi_set_power_cap(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, uint64_t cap) { - return rsmi_wrapper(rsmi_dev_power_cap_set, device_handle, + return rsmi_wrapper(rsmi_dev_power_cap_set, processor_handle, sensor_ind, cap); } amdsmi_status_t -amdsmi_dev_get_power_ave(amdsmi_device_handle device_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, device_handle, - sensor_ind, power); -} -amdsmi_status_t - amdsmi_dev_get_power_profile_presets(amdsmi_device_handle device_handle, + amdsmi_get_gpu_power_profile_presets(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_profile_status_t *status) { AMDSMI_CHECK_INIT(); if (status == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_power_profile_presets_get, device_handle, + return rsmi_wrapper(rsmi_dev_power_profile_presets_get, processor_handle, sensor_ind, reinterpret_cast(status)); } -amdsmi_status_t amdsmi_set_perf_determinism_mode( - amdsmi_device_handle device_handle, uint64_t clkvalue) { - return rsmi_wrapper(rsmi_perf_determinism_mode_set, device_handle, +amdsmi_status_t amdsmi_set_gpu_perf_determinism_mode( + amdsmi_processor_handle processor_handle, uint64_t clkvalue) { + return rsmi_wrapper(rsmi_perf_determinism_mode_set, processor_handle, clkvalue); } amdsmi_status_t - amdsmi_dev_set_power_profile(amdsmi_device_handle device_handle, + amdsmi_set_gpu_power_profile(amdsmi_processor_handle processor_handle, uint32_t reserved, amdsmi_power_profile_preset_masks_t profile) { - return rsmi_wrapper(rsmi_dev_power_profile_set, device_handle, + return rsmi_wrapper(rsmi_dev_power_profile_set, processor_handle, reserved, static_cast(profile)); } -amdsmi_status_t amdsmi_dev_get_perf_level(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t *perf) { AMDSMI_CHECK_INIT(); if (perf == nullptr) return AMDSMI_STATUS_INVAL; - return rsmi_wrapper(rsmi_dev_perf_level_get, device_handle, + return rsmi_wrapper(rsmi_dev_perf_level_get, processor_handle, reinterpret_cast(perf)); } amdsmi_status_t - amdsmi_dev_set_perf_level(amdsmi_device_handle device_handle, + amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t perf_lvl) { - return rsmi_wrapper(rsmi_dev_perf_level_set, device_handle, + return rsmi_wrapper(rsmi_dev_perf_level_set, processor_handle, static_cast(perf_lvl)); } amdsmi_status_t - amdsmi_dev_set_perf_level_v1(amdsmi_device_handle device_handle, + amdsmi_set_gpu_perf_level_v1(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t perf_lvl) { - return rsmi_wrapper(rsmi_dev_perf_level_set_v1, device_handle, + return rsmi_wrapper(rsmi_dev_perf_level_set_v1, processor_handle, static_cast(perf_lvl)); } -amdsmi_status_t amdsmi_dev_set_pci_bandwidth(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, uint64_t bw_bitmask) { - return rsmi_wrapper(rsmi_dev_pci_bandwidth_set, device_handle, + return rsmi_wrapper(rsmi_dev_pci_bandwidth_set, processor_handle, bw_bitmask); } -amdsmi_status_t amdsmi_dev_get_pci_bandwidth(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, amdsmi_pcie_bandwidth_t *bandwidth) { - return rsmi_wrapper(rsmi_dev_pci_bandwidth_get, device_handle, + return rsmi_wrapper(rsmi_dev_pci_bandwidth_get, processor_handle, reinterpret_cast(bandwidth)); } // TODO(bliu): other frequencies in amdsmi_clk_type_t -amdsmi_status_t amdsmi_dev_get_gpu_clk_freq(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f) { AMDSMI_CHECK_INIT(); @@ -1211,8 +1113,8 @@ amdsmi_status_t amdsmi_dev_get_gpu_clk_freq(amdsmi_device_handle device_handle, clk_type == CLK_TYPE_DCLK0 || clk_type == CLK_TYPE_DCLK1 ) { amdsmi_gpu_metrics_t metric_info; - auto r_status = amdsmi_dev_get_gpu_metrics_info( - device_handle, &metric_info); + auto r_status = amdsmi_get_gpu_metrics_info( + processor_handle, &metric_info); if (r_status != AMDSMI_STATUS_SUCCESS) return r_status; @@ -1237,12 +1139,12 @@ amdsmi_status_t amdsmi_dev_get_gpu_clk_freq(amdsmi_device_handle device_handle, return r_status; } - return rsmi_wrapper(rsmi_dev_gpu_clk_freq_get, device_handle, + return rsmi_wrapper(rsmi_dev_gpu_clk_freq_get, processor_handle, static_cast(clk_type), reinterpret_cast(f)); } -amdsmi_status_t amdsmi_dev_set_clk_freq(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, uint64_t freq_bitmask) { AMDSMI_CHECK_INIT(); @@ -1254,142 +1156,142 @@ amdsmi_status_t amdsmi_dev_set_clk_freq(amdsmi_device_handle device_handle, return AMDSMI_STATUS_NOT_SUPPORTED; } - return rsmi_wrapper(rsmi_dev_gpu_clk_freq_set, device_handle, + return rsmi_wrapper(rsmi_dev_gpu_clk_freq_set, processor_handle, static_cast(clk_type), freq_bitmask); } amdsmi_status_t -amdsmi_dev_get_memory_reserved_pages(amdsmi_device_handle device_handle, +amdsmi_get_gpu_memory_reserved_pages(amdsmi_processor_handle processor_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *records) { - return rsmi_wrapper(rsmi_dev_memory_reserved_pages_get, device_handle, + return rsmi_wrapper(rsmi_dev_memory_reserved_pages_get, processor_handle, num_pages, reinterpret_cast(records)); } -amdsmi_status_t amdsmi_dev_get_memory_total(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_memory_total(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, uint64_t *total) { - return rsmi_wrapper(rsmi_dev_memory_total_get, device_handle, + return rsmi_wrapper(rsmi_dev_memory_total_get, processor_handle, static_cast(mem_type), total); } -amdsmi_status_t amdsmi_dev_get_memory_usage(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_memory_usage(amdsmi_processor_handle processor_handle, amdsmi_memory_type_t mem_type, uint64_t *used) { - return rsmi_wrapper(rsmi_dev_memory_usage_get, device_handle, + return rsmi_wrapper(rsmi_dev_memory_usage_get, processor_handle, static_cast(mem_type), used); } -amdsmi_status_t amdsmi_dev_get_overdrive_level( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_overdrive_level( + amdsmi_processor_handle processor_handle, uint32_t *od) { - return rsmi_wrapper(rsmi_dev_overdrive_level_get, device_handle, od); + return rsmi_wrapper(rsmi_dev_overdrive_level_get, processor_handle, od); } -amdsmi_status_t amdsmi_dev_set_overdrive_level( - amdsmi_device_handle device_handle, uint32_t od) { - return rsmi_wrapper(rsmi_dev_overdrive_level_set, device_handle, od); +amdsmi_status_t amdsmi_set_gpu_overdrive_level( + amdsmi_processor_handle processor_handle, uint32_t od) { + return rsmi_wrapper(rsmi_dev_overdrive_level_set, processor_handle, od); } -amdsmi_status_t amdsmi_dev_get_pci_replay_counter( - amdsmi_device_handle device_handle, uint64_t *counter) { +amdsmi_status_t amdsmi_get_gpu_pci_replay_counter( + amdsmi_processor_handle processor_handle, uint64_t *counter) { return rsmi_wrapper(rsmi_dev_pci_replay_counter_get, - device_handle, counter); + processor_handle, counter); } -amdsmi_status_t amdsmi_dev_get_pci_throughput( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_pci_throughput( + amdsmi_processor_handle processor_handle, uint64_t *sent, uint64_t *received, uint64_t *max_pkt_sz) { - return rsmi_wrapper(rsmi_dev_pci_throughput_get, device_handle, + return rsmi_wrapper(rsmi_dev_pci_throughput_get, processor_handle, sent, received, max_pkt_sz); } -amdsmi_status_t amdsmi_dev_get_od_volt_info(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_od_volt_info(amdsmi_processor_handle processor_handle, amdsmi_od_volt_freq_data_t *odv) { - return rsmi_wrapper(rsmi_dev_od_volt_info_get, device_handle, + return rsmi_wrapper(rsmi_dev_od_volt_info_get, processor_handle, reinterpret_cast(odv)); } -amdsmi_status_t amdsmi_dev_get_od_volt_curve_regions( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_od_volt_curve_regions( + amdsmi_processor_handle processor_handle, uint32_t *num_regions, amdsmi_freq_volt_region_t *buffer) { - return rsmi_wrapper(rsmi_dev_od_volt_curve_regions_get, device_handle, + return rsmi_wrapper(rsmi_dev_od_volt_curve_regions_get, processor_handle, num_regions, reinterpret_cast(buffer)); } -amdsmi_status_t amdsmi_dev_get_volt_metric(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_volt_metric(amdsmi_processor_handle processor_handle, amdsmi_voltage_type_t sensor_type, amdsmi_voltage_metric_t metric, int64_t *voltage) { - return rsmi_wrapper(rsmi_dev_volt_metric_get, device_handle, + return rsmi_wrapper(rsmi_dev_volt_metric_get, processor_handle, static_cast(sensor_type), static_cast(metric), voltage); } -amdsmi_status_t amdsmi_dev_set_od_clk_info(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_od_clk_info(amdsmi_processor_handle processor_handle, amdsmi_freq_ind_t level, uint64_t clkvalue, amdsmi_clk_type_t clkType) { - return rsmi_wrapper(rsmi_dev_od_clk_info_set, device_handle, + return rsmi_wrapper(rsmi_dev_od_clk_info_set, processor_handle, static_cast(level), clkvalue, static_cast(clkType)); } -amdsmi_status_t amdsmi_dev_set_od_volt_info(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_od_volt_info(amdsmi_processor_handle processor_handle, uint32_t vpoint, uint64_t clkvalue, uint64_t voltvalue) { - return rsmi_wrapper(rsmi_dev_od_volt_info_set, device_handle, + return rsmi_wrapper(rsmi_dev_od_volt_info_set, processor_handle, vpoint, clkvalue, voltvalue); } -amdsmi_status_t amdsmi_dev_set_clk_range(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_clk_range(amdsmi_processor_handle processor_handle, uint64_t minclkvalue, uint64_t maxclkvalue, amdsmi_clk_type_t clkType) { - return rsmi_wrapper(rsmi_dev_clk_range_set, device_handle, + return rsmi_wrapper(rsmi_dev_clk_range_set, processor_handle, minclkvalue, maxclkvalue, static_cast(clkType)); } -amdsmi_status_t amdsmi_dev_set_overdrive_level_v1( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_set_gpu_overdrive_level_v1( + amdsmi_processor_handle processor_handle, uint32_t od) { - return rsmi_wrapper(rsmi_dev_overdrive_level_set_v1, device_handle, + return rsmi_wrapper(rsmi_dev_overdrive_level_set_v1, processor_handle, od); } -amdsmi_status_t amdsmi_dev_reset_gpu(amdsmi_device_handle device_handle) { - return rsmi_wrapper(rsmi_dev_gpu_reset, device_handle); +amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle) { + return rsmi_wrapper(rsmi_dev_gpu_reset, processor_handle); } -amdsmi_status_t amdsmi_get_utilization_count(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_utilization_count(amdsmi_processor_handle processor_handle, amdsmi_utilization_counter_t utilization_counters[], uint32_t count, uint64_t *timestamp) { - return rsmi_wrapper(rsmi_utilization_count_get, device_handle, + return rsmi_wrapper(rsmi_utilization_count_get, processor_handle, reinterpret_cast(utilization_counters), count, timestamp); } -amdsmi_status_t amdsmi_dev_get_memory_busy_percent( - amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_gpu_memory_busy_percent( + amdsmi_processor_handle processor_handle, uint32_t *busy_percent) { - return rsmi_wrapper(rsmi_dev_memory_busy_percent_get, device_handle, + return rsmi_wrapper(rsmi_dev_memory_busy_percent_get, processor_handle, busy_percent); } -amdsmi_status_t amdsmi_dev_get_energy_count(amdsmi_device_handle device_handle, +amdsmi_status_t amdsmi_get_energy_count(amdsmi_processor_handle processor_handle, uint64_t *power, float *counter_resolution, uint64_t *timestamp) { - return rsmi_wrapper(rsmi_dev_energy_count_get, device_handle, + return rsmi_wrapper(rsmi_dev_energy_count_get, processor_handle, power, counter_resolution, timestamp); } -amdsmi_status_t amdsmi_dev_get_drm_render_minor( - amdsmi_device_handle device_handle, uint32_t *minor) { - return rsmi_wrapper(rsmi_dev_drm_render_minor_get, device_handle, +amdsmi_status_t amdsmi_get_gpu_drm_render_minor( + amdsmi_processor_handle processor_handle, uint32_t *minor) { + return rsmi_wrapper(rsmi_dev_drm_render_minor_get, processor_handle, minor); } -amdsmi_status_t amdsmi_dev_get_pci_id( - amdsmi_device_handle device_handle, uint64_t *bdfid) { - return rsmi_wrapper(rsmi_dev_pci_id_get, device_handle, +amdsmi_status_t amdsmi_get_gpu_pci_id( + amdsmi_processor_handle processor_handle, uint64_t *bdfid) { + return rsmi_wrapper(rsmi_dev_pci_id_get, processor_handle, bdfid); } -amdsmi_status_t amdsmi_topo_get_numa_affinity( - amdsmi_device_handle device_handle, uint32_t *numa_node) { - return rsmi_wrapper(rsmi_topo_numa_affinity_get, device_handle, +amdsmi_status_t amdsmi_get_gpu_topo_numa_affinity( + amdsmi_processor_handle processor_handle, uint32_t *numa_node) { + return rsmi_wrapper(rsmi_topo_numa_affinity_get, processor_handle, numa_node); } @@ -1418,7 +1320,7 @@ amdsmi_status_t amdsmi_get_version_str(amdsmi_sw_component_t component, } amdsmi_status_t -amdsmi_get_vbios_info(amdsmi_device_handle device_handle, amdsmi_vbios_info_t *info) { +amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1429,7 +1331,7 @@ amdsmi_get_vbios_info(amdsmi_device_handle device_handle, amdsmi_vbios_info_t *i amdsmi_status_t status; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1442,19 +1344,18 @@ amdsmi_get_vbios_info(amdsmi_device_handle device_handle, amdsmi_vbios_info_t *i 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 char vbios_version[AMDSMI_NORMAL_STRING_LENGTH]; - status = rsmi_wrapper(rsmi_dev_vbios_version_get, device_handle, + status = rsmi_wrapper(rsmi_dev_vbios_version_get, processor_handle, vbios_version, AMDSMI_NORMAL_STRING_LENGTH); // 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); } } @@ -1463,7 +1364,7 @@ amdsmi_get_vbios_info(amdsmi_device_handle device_handle, amdsmi_vbios_info_t *i } amdsmi_status_t -amdsmi_get_gpu_activity(amdsmi_device_handle device_handle, amdsmi_engine_usage_t *info) { +amdsmi_get_gpu_activity(amdsmi_processor_handle processor_handle, amdsmi_engine_usage_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1472,23 +1373,23 @@ amdsmi_get_gpu_activity(amdsmi_device_handle device_handle, amdsmi_engine_usage_ amdsmi_gpu_metrics_t metrics = {}; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; amdsmi_status_t status; - status = amdsmi_dev_get_gpu_metrics_info(device_handle, &metrics); + status = amdsmi_get_gpu_metrics_info(processor_handle, &metrics); if (status != AMDSMI_STATUS_SUCCESS) { 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; } amdsmi_status_t -amdsmi_get_clock_measure(amdsmi_device_handle device_handle, amdsmi_clk_type_t clk_type, amdsmi_clk_measure_t *info) { +amdsmi_get_clock_info(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_clk_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1501,12 +1402,12 @@ amdsmi_get_clock_measure(amdsmi_device_handle device_handle, amdsmi_clk_type_t c amdsmi_gpu_metrics_t metrics = {}; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; amdsmi_status_t status; - status = amdsmi_dev_get_gpu_metrics_info(device_handle, &metrics); + status = amdsmi_get_gpu_metrics_info(processor_handle, &metrics); if (status != AMDSMI_STATUS_SUCCESS) { return status; } @@ -1520,19 +1421,15 @@ amdsmi_get_clock_measure(amdsmi_device_handle device_handle, amdsmi_clk_type_t c 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: @@ -1543,7 +1440,7 @@ amdsmi_get_clock_measure(amdsmi_device_handle device_handle, amdsmi_clk_type_t c } amdsmi_status_t -amdsmi_get_ras_block_features_enabled(amdsmi_device_handle device_handle, amdsmi_gpu_block_t block, amdsmi_ras_err_state_t *state) { +amdsmi_get_gpu_ras_block_features_enabled(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block, amdsmi_ras_err_state_t *state) { AMDSMI_CHECK_INIT(); if (state == nullptr || block > AMDSMI_GPU_BLOCK_LAST) { @@ -1552,7 +1449,7 @@ amdsmi_get_ras_block_features_enabled(amdsmi_device_handle device_handle, amdsmi uint64_t features_mask = 0; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1567,7 +1464,7 @@ amdsmi_get_ras_block_features_enabled(amdsmi_device_handle device_handle, amdsmi } amdsmi_status_t -amdsmi_get_bad_page_info(amdsmi_device_handle device_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *info) { +amdsmi_get_gpu_bad_page_info(amdsmi_processor_handle processor_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *info) { AMDSMI_CHECK_INIT(); if (num_pages == nullptr) { @@ -1575,7 +1472,7 @@ amdsmi_get_bad_page_info(amdsmi_device_handle device_handle, uint32_t *num_pages } amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1594,7 +1491,7 @@ amdsmi_get_bad_page_info(amdsmi_device_handle device_handle, uint32_t *num_pages } amdsmi_status_t -amdsmi_get_ecc_error_count(amdsmi_device_handle device_handle, amdsmi_error_count_t *ec) { +amdsmi_get_gpu_ecc_error_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec) { AMDSMI_CHECK_INIT(); if (ec == nullptr) { @@ -1602,7 +1499,7 @@ amdsmi_get_ecc_error_count(amdsmi_device_handle device_handle, amdsmi_error_coun } amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1621,7 +1518,7 @@ amdsmi_get_ecc_error_count(amdsmi_device_handle device_handle, amdsmi_error_coun } amdsmi_status_t -amdsmi_get_process_list(amdsmi_device_handle device_handle, amdsmi_process_handle *list, uint32_t *max_processes) { +amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, amdsmi_process_handle *list, uint32_t *max_processes) { AMDSMI_CHECK_INIT(); if (max_processes == nullptr) { @@ -1633,7 +1530,7 @@ amdsmi_get_process_list(amdsmi_device_handle device_handle, amdsmi_process_handl uint64_t size = 0; amdsmi_status_t status; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1669,7 +1566,7 @@ amdsmi_get_process_list(amdsmi_device_handle device_handle, amdsmi_process_handl } amdsmi_status_t -amdsmi_get_process_info(amdsmi_device_handle device_handle, amdsmi_process_handle process, amdsmi_proc_info_t *info) { +amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_process_handle process, amdsmi_proc_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1677,7 +1574,7 @@ amdsmi_get_process_info(amdsmi_device_handle device_handle, amdsmi_process_handl } amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1694,7 +1591,7 @@ amdsmi_get_process_info(amdsmi_device_handle device_handle, amdsmi_process_handl } amdsmi_status_t -amdsmi_get_power_measure(amdsmi_device_handle device_handle, amdsmi_power_measure_t *info) { +amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1703,20 +1600,20 @@ amdsmi_get_power_measure(amdsmi_device_handle device_handle, amdsmi_power_measur amdsmi_gpu_metrics_t metrics = {}; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; amdsmi_status_t status; - status = amdsmi_dev_get_gpu_metrics_info(device_handle, &metrics); + status = amdsmi_get_gpu_metrics_info(processor_handle, &metrics); if (status != AMDSMI_STATUS_SUCCESS) { return status; } int64_t voltage_read = 0; - status = amdsmi_dev_get_volt_metric(device_handle, AMDSMI_VOLT_TYPE_VDDGFX, AMDSMI_VOLT_CURRENT, &voltage_read); + status = amdsmi_get_gpu_volt_metric(processor_handle, AMDSMI_VOLT_TYPE_VDDGFX, AMDSMI_VOLT_CURRENT, &voltage_read); if (status != AMDSMI_STATUS_SUCCESS) { return status; } @@ -1728,16 +1625,15 @@ amdsmi_get_power_measure(amdsmi_device_handle device_handle, amdsmi_power_measur } info->power_limit = power_limit; - info->voltage_gfx = voltage_read; + info->gfx_voltage = voltage_read; info->average_socket_power = metrics.average_socket_power; - info->energy_accumulator = metrics.energy_accumulator; return status; } amdsmi_status_t -amdsmi_get_target_frequency_range(amdsmi_device_handle device_handle, amdsmi_clk_type_t clk_type, amdsmi_frequency_range_t *range) { +amdsmi_get_gpu_target_frequency_range(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_frequency_range_t *range) { AMDSMI_CHECK_INIT(); if (range == nullptr || clk_type > CLK_TYPE__MAX) { @@ -1746,14 +1642,14 @@ amdsmi_get_target_frequency_range(amdsmi_device_handle device_handle, amdsmi_clk amdsmi_gpu_metrics_t metrics = {}; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; amdsmi_status_t status; int min = 0, max = 0; - status = amdsmi_dev_get_gpu_metrics_info(device_handle, &metrics); + status = amdsmi_get_gpu_metrics_info(processor_handle, &metrics); if (status != AMDSMI_STATUS_SUCCESS) { return status; } @@ -1788,7 +1684,7 @@ amdsmi_get_target_frequency_range(amdsmi_device_handle device_handle, amdsmi_clk } amdsmi_status_t -amdsmi_get_driver_version(amdsmi_device_handle device_handle, int *length, char *version) { +amdsmi_get_gpu_driver_version(amdsmi_processor_handle processor_handle, int *length, char *version) { AMDSMI_CHECK_INIT(); if (length == nullptr || version == nullptr) { @@ -1796,7 +1692,7 @@ amdsmi_get_driver_version(amdsmi_device_handle device_handle, int *length, char } amdsmi_status_t status = AMDSMI_STATUS_SUCCESS; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1806,7 +1702,7 @@ amdsmi_get_driver_version(amdsmi_device_handle device_handle, int *length, char } amdsmi_status_t -amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_length, char *uuid) { +amdsmi_get_gpu_device_uuid(amdsmi_processor_handle processor_handle, unsigned int *uuid_length, char *uuid) { AMDSMI_CHECK_INIT(); if (uuid_length == nullptr || uuid == nullptr) { @@ -1814,7 +1710,7 @@ amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_le } amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1828,7 +1724,7 @@ amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_le const uint8_t fcn = 0xff; std::string path = "/sys/class/drm/" + gpu_device->get_gpu_path() + "/device/uuid_info"; - status = amdsmi_get_asic_info(device_handle, &asic_info); + status = amdsmi_get_gpu_asic_info(processor_handle, &asic_info); if (status != AMDSMI_STATUS_SUCCESS) { printf("Getting asic info failed. Return code: %d", status); return status; @@ -1854,7 +1750,7 @@ amdsmi_get_device_uuid(amdsmi_device_handle device_handle, unsigned int *uuid_le } amdsmi_status_t -amdsmi_get_pcie_link_status(amdsmi_device_handle device_handle, amdsmi_pcie_info_t *info){ +amdsmi_get_pcie_link_status(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info){ AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1862,8 +1758,8 @@ amdsmi_get_pcie_link_status(amdsmi_device_handle device_handle, amdsmi_pcie_info } amdsmi_status_t status = AMDSMI_STATUS_SUCCESS; amdsmi_gpu_metrics_t metric_info = {}; - status = amdsmi_dev_get_gpu_metrics_info( - device_handle, &metric_info); + status = amdsmi_get_gpu_metrics_info( + processor_handle, &metric_info); if (status != AMDSMI_STATUS_SUCCESS) return status; @@ -1873,7 +1769,7 @@ amdsmi_get_pcie_link_status(amdsmi_device_handle device_handle, amdsmi_pcie_info return status; } -amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_device_handle device_handle, amdsmi_pcie_info_t *info) { +amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info) { AMDSMI_CHECK_INIT(); if (info == nullptr) { @@ -1882,7 +1778,7 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_device_handle device_handle, am amdsmi_status_t status = AMDSMI_STATUS_SUCCESS; amd::smi::AMDSmiGPUDevice* gpu_device = nullptr; - amdsmi_status_t r = get_gpu_device_from_handle(device_handle, &gpu_device); + amdsmi_status_t r = get_gpu_device_from_handle(processor_handle, &gpu_device); if (r != AMDSMI_STATUS_SUCCESS) return r; @@ -1919,7 +1815,7 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_device_handle device_handle, am return AMDSMI_STATUS_API_FAILED; } - status = amdsmi_get_asic_info(device_handle, &asic_info); + status = amdsmi_get_gpu_asic_info(processor_handle, &asic_info); if (status != AMDSMI_STATUS_SUCCESS) return status; @@ -1931,18 +1827,18 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_device_handle device_handle, am return status; } -amdsmi_status_t amdsmi_get_device_handle_from_bdf(amdsmi_bdf_t bdf, - amdsmi_device_handle* device_handle) +amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf, + amdsmi_processor_handle* processor_handle) { amdsmi_status_t status; uint32_t socket_count = 0; uint32_t device_count = AMDSMI_MAX_DEVICES; - amdsmi_device_handle devs[AMDSMI_MAX_DEVICES]; + amdsmi_processor_handle devs[AMDSMI_MAX_DEVICES]; AMDSMI_CHECK_INIT(); - if (device_handle == nullptr) { + if (processor_handle == nullptr) { return AMDSMI_STATUS_INVAL; } @@ -1959,7 +1855,7 @@ amdsmi_status_t amdsmi_get_device_handle_from_bdf(amdsmi_bdf_t bdf, } for (unsigned int i = 0; i < socket_count; i++) { - status = amdsmi_get_device_handles(sockets[i], &device_count, devs); + status = amdsmi_get_processor_handles(sockets[i], &device_count, devs); if (status != AMDSMI_STATUS_SUCCESS) { return status; } @@ -1975,7 +1871,7 @@ amdsmi_status_t amdsmi_get_device_handle_from_bdf(amdsmi_bdf_t bdf, bdf.device_number == found_bdf.device_number && bdf.domain_number == found_bdf.domain_number && bdf.function_number == found_bdf.function_number) { - *device_handle = devs[idx]; + *processor_handle = devs[idx]; return AMDSMI_STATUS_SUCCESS; } } diff --git a/projects/amdsmi/src/amd_smi/amd_smi_socket.cc b/projects/amdsmi/src/amd_smi/amd_smi_socket.cc index 0c824e513b..a563d72b93 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi_socket.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi_socket.cc @@ -49,14 +49,14 @@ namespace amd { namespace smi { AMDSmiSocket::~AMDSmiSocket() { - for (uint32_t i = 0; i < devices_.size(); i++) { - delete devices_[i]; + for (uint32_t i = 0; i < processors_.size(); i++) { + delete processors_[i]; } - devices_.clear(); + processors_.clear(); } -amdsmi_status_t AMDSmiSocket::get_device_count(uint32_t* device_count) const { - *device_count = static_cast(devices_.size()); +amdsmi_status_t AMDSmiSocket::get_processor_count(uint32_t* processor_count) const { + *processor_count = static_cast(processors_.size()); return AMDSMI_STATUS_SUCCESS; } diff --git a/projects/amdsmi/src/amd_smi/amd_smi_system.cc b/projects/amdsmi/src/amd_smi/amd_smi_system.cc index b104294a06..a872674acf 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi_system.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi_system.cc @@ -57,7 +57,7 @@ namespace smi { amdsmi_status_t AMDSmiSystem::init(uint64_t flags) { init_flag_ = flags; amdsmi_status_t amd_smi_status; - // populate sockets and devices + // populate sockets and processors if (flags & AMDSMI_INIT_AMD_GPUS) { amd_smi_status = populate_amd_gpu_devices(); if (amd_smi_status != AMDSMI_STATUS_SUCCESS) @@ -104,9 +104,9 @@ amdsmi_status_t AMDSmiSystem::populate_amd_gpu_devices() { sockets_.push_back(socket); } - AMDSmiDevice* device = new AMDSmiGPUDevice(i, drm_); - socket->add_device(device); - devices_.insert(device); + AMDSmiProcessor* device = new AMDSmiGPUDevice(i, drm_); + socket->add_processor(device); + processors_.insert(device); } return AMDSMI_STATUS_SUCCESS; } @@ -136,7 +136,7 @@ amdsmi_status_t AMDSmiSystem::cleanup() { for (uint32_t i = 0; i < sockets_.size(); i++) { delete sockets_[i]; } - devices_.clear(); + processors_.clear(); sockets_.clear(); init_flag_ = AMDSMI_INIT_ALL_DEVICES; rsmi_status_t ret = rsmi_shut_down(); @@ -164,37 +164,37 @@ amdsmi_status_t AMDSmiSystem::handle_to_socket( return AMDSMI_STATUS_INVAL; } -amdsmi_status_t AMDSmiSystem::handle_to_device( - amdsmi_device_handle device_handle, - AMDSmiDevice** device) { - if (device_handle == nullptr || device == nullptr) { +amdsmi_status_t AMDSmiSystem::handle_to_processor( + amdsmi_processor_handle processor_handle, + AMDSmiProcessor** processor) { + if (processor_handle == nullptr || processor == nullptr) { return AMDSMI_STATUS_INVAL; } - *device = static_cast(device_handle); + *processor = static_cast(processor_handle); // double check handlers is here - if (std::find(devices_.begin(), devices_.end(), *device) - != devices_.end()) { + if (std::find(processors_.begin(), processors_.end(), *processor) + != processors_.end()) { return AMDSMI_STATUS_SUCCESS; } return AMDSMI_STATUS_NOT_FOUND; } amdsmi_status_t AMDSmiSystem::gpu_index_to_handle(uint32_t gpu_index, - amdsmi_device_handle* device_handle) { - if (device_handle == nullptr) + amdsmi_processor_handle* processor_handle) { + if (processor_handle == nullptr) return AMDSMI_STATUS_INVAL; - auto iter = devices_.begin(); - for (; iter != devices_.end(); iter++) { + auto iter = processors_.begin(); + for (; iter != processors_.end(); iter++) { auto cur_device = (*iter); - if (cur_device->get_device_type() != AMD_GPU) + if (cur_device->get_processor_type() != AMD_GPU) continue; amd::smi::AMDSmiGPUDevice* gpu_device = static_cast(cur_device); uint32_t cur_gpu_index = gpu_device->get_gpu_id(); if (gpu_index == cur_gpu_index) { - *device_handle = cur_device; + *processor_handle = cur_device; return AMDSMI_STATUS_SUCCESS; } } diff --git a/projects/amdsmi/src/amd_smi/fdinfo.cc b/projects/amdsmi/src/amd_smi/fdinfo.cc index 0876e7990a..7bb794e00a 100644 --- a/projects/amdsmi/src/amd_smi/fdinfo.cc +++ b/projects/amdsmi/src/amd_smi/fdinfo.cc @@ -149,76 +149,71 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid, std::string file = path + dir->d_name; std::ifstream fdinfo(file.c_str()); - for (std::string line; getline(fdinfo, line);) { - if (line.find("pasid:") != std::string::npos) { - int pasid; + for (std::string bdfline; getline(fdinfo, bdfline);) { + if (bdfline.find("drm-pdev:") != std::string::npos) { + char fd_bdf_str[13]; - if (sscanf(line.c_str(), "pasid: %d", &pasid) != 1) + /* Only check against fdinfo files that contain a bdf */ + if (sscanf(bdfline.c_str(), "drm-pdev: %s", &fd_bdf_str) != 1) continue; - auto it = std::find(pasids.begin(), pasids.end(), pasid); + /* Populate amdsmi_proc_info_t struct only if the bdf in + * the fdinfo file matches the passed bdf */ + if (strncmp(bdf_str, fd_bdf_str, 13) == 0){ + std::ifstream fdinfo(file.c_str()); - if (it == pasids.end()) - pasids.push_back(pasid); - } else if (line.find("drm-memory-gtt:") != std::string::npos) { - unsigned long mem; + for (std::string line; getline(fdinfo, line);) { + if (line.find("pasid:") != std::string::npos) { + int pasid; - if (sscanf(line.c_str(), "drm-memory-gtt: %lu", &mem) != 1) - continue; + if (sscanf(line.c_str(), "pasid: %d", &pasid) != 1) + continue; - info.mem += mem * 1024; - info.memory_usage.gtt_mem += mem * 1024; - } else if (line.find("drm-memory-cpu:") != std::string::npos) { - unsigned long mem; + auto it = std::find(pasids.begin(), pasids.end(), pasid); - if (sscanf(line.c_str(), "drm-memory-cpu: %lu", &mem) != 1) - continue; + if (it == pasids.end()) + pasids.push_back(pasid); + } else if (line.find("drm-memory-gtt:") != std::string::npos) { + unsigned long mem; - info.mem += mem * 1024; - info.memory_usage.cpu_mem += mem * 1024; - } else if (line.find("drm-memory-vram:") != std::string::npos) { - unsigned long mem; + if (sscanf(line.c_str(), "drm-memory-gtt: %lu", &mem) != 1) + continue; - if (sscanf(line.c_str(), "drm-memory-vram: %lu", &mem) != 1) - continue; + info.mem += mem * 1024; + info.memory_usage.gtt_mem += mem * 1024; + } else if (line.find("drm-memory-cpu:") != std::string::npos) { + unsigned long mem; - info.mem += mem * 1024; - info.memory_usage.vram_mem += mem * 1024; - } else if (line.find("drm-engine-gfx") != std::string::npos) { - uint64_t engine_gfx; + if (sscanf(line.c_str(), "drm-memory-cpu: %lu", &mem) != 1) + continue; - if (sscanf(line.c_str(), "drm-engine-gfx: %lu", &engine_gfx) != 1) - continue; + info.mem += mem * 1024; + info.memory_usage.cpu_mem += mem * 1024; + } else if (line.find("drm-memory-vram:") != std::string::npos) { + unsigned long mem; - 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-memory-vram: %lu", &mem) != 1) + continue; - if (sscanf(line.c_str(), "drm-engine-compute: %lu", &engine_compute) != 1) - continue; + info.mem += mem * 1024; + info.memory_usage.vram_mem += mem * 1024; + } else if (line.find("drm-engine-gfx") != std::string::npos) { + uint64_t engine_gfx; - 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-gfx: %lu", &engine_gfx) != 1) + continue; - if (sscanf(line.c_str(), "drm-engine-dma: %lu", &engine_dma) != 1) - continue; + info.engine_usage.gfx = engine_gfx; + } else if (line.find("drm-engine-enc") != std::string::npos) { + uint64_t engine_enc; - info.engine_usage.dma = engine_dma; - } else if (line.find("drm-engine-enc") != std::string::npos) { - uint64_t engine_enc; + if (sscanf(line.c_str(), "drm-engine-enc: %lu", &engine_enc) != 1) + continue; - if (sscanf(line.c_str(), "drm-engine-enc: %lu", &engine_enc) != 1) - 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; + info.engine_usage.enc = engine_enc; + } + } + } } } } diff --git a/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt b/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt index 93c2bbab04..122adcf29f 100644 --- a/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt +++ b/projects/amdsmi/tests/amd_smi_test/CMakeLists.txt @@ -70,3 +70,8 @@ install( TARGETS ${TEST} gtest gtest_main DESTINATION ${SHARE_INSTALL_PREFIX}/tests COMPONENT tests) + +install( + FILES amdsmitst.exclude + DESTINATION ${SHARE_INSTALL_PREFIX}/tests + COMPONENT tests) diff --git a/projects/amdsmi/tests/amd_smi_test/functional/api_support_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/api_support_read.cc index 5856ea1b91..25dee643fe 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/api_support_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/api_support_read.cc @@ -102,11 +102,11 @@ void TestAPISupportRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { IF_VERB(STANDARD) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); std::cout << "Supported AMDSMI Functions:" << std::endl; std::cout << "\tVariants (Monitors)" << std::endl; } - err = amdsmi_dev_open_supported_func_iterator(device_handles_[i], &iter_handle); + err = amdsmi_open_supported_func_iterator(processor_handles_[i], &iter_handle); CHK_ERR_ASRT(err) while (1) { @@ -115,7 +115,7 @@ void TestAPISupportRead::Run(void) { IF_VERB(STANDARD) { std::cout << "Function Name: " << value.name << std::endl; } - err = amdsmi_dev_open_supported_variant_iterator(iter_handle, &var_iter); + err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter); if (err != AMDSMI_STATUS_NO_DATA) { CHK_ERR_ASRT(err) IF_VERB(STANDARD) { @@ -133,7 +133,7 @@ void TestAPISupportRead::Run(void) { std::cout << " ("; } err = - amdsmi_dev_open_supported_variant_iterator(var_iter, &sub_var_iter); + amdsmi_open_supported_variant_iterator(var_iter, &sub_var_iter); if (err != AMDSMI_STATUS_NO_DATA) { CHK_ERR_ASRT(err) @@ -150,7 +150,7 @@ void TestAPISupportRead::Run(void) { } CHK_ERR_ASRT(err) } - err = amdsmi_dev_close_supported_func_iterator(&sub_var_iter); + err = amdsmi_close_supported_func_iterator(&sub_var_iter); CHK_ERR_ASRT(err) } @@ -167,7 +167,7 @@ void TestAPISupportRead::Run(void) { IF_VERB(STANDARD) { std::cout << std::endl; } - err = amdsmi_dev_close_supported_func_iterator(&var_iter); + err = amdsmi_close_supported_func_iterator(&var_iter); CHK_ERR_ASRT(err) } @@ -178,10 +178,10 @@ void TestAPISupportRead::Run(void) { } CHK_ERR_ASRT(err) - // err = amdsmi_dev_open_supported_variant_iterator(iter_handle, &var_iter); + // err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter); // } - err = amdsmi_dev_close_supported_func_iterator(&iter_handle); + err = amdsmi_close_supported_func_iterator(&iter_handle); CHK_ERR_ASRT(err) } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc index ca57be0c24..c63d561fa1 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/err_cnt_read.cc @@ -98,9 +98,9 @@ void TestErrCntRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); - err = amdsmi_dev_get_ecc_enabled(device_handles_[i], &enabled_mask); + err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], &enabled_mask); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << @@ -108,7 +108,7 @@ void TestErrCntRead::Run(void) { << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_ecc_enabled(device_handles_[i], nullptr); + err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); continue; @@ -116,7 +116,7 @@ void TestErrCntRead::Run(void) { CHK_ERR_ASRT(err) // Verify api support checking functionality is working - err = amdsmi_dev_get_ecc_enabled(device_handles_[i], nullptr); + err = amdsmi_get_gpu_ecc_enabled(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); IF_VERB(STANDARD) { @@ -126,7 +126,7 @@ void TestErrCntRead::Run(void) { } for (uint32_t b = AMDSMI_GPU_BLOCK_FIRST; b <= AMDSMI_GPU_BLOCK_LAST; b = b*2) { - err = amdsmi_dev_get_ecc_status(device_handles_[i], static_cast(b), + err = amdsmi_get_gpu_ecc_status(processor_handles_[i], static_cast(b), &err_state); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { @@ -135,11 +135,11 @@ void TestErrCntRead::Run(void) { " block: " << GetErrStateNameStr(err_state) << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_ecc_status(device_handles_[i], static_cast(b), + err = amdsmi_get_gpu_ecc_status(processor_handles_[i], static_cast(b), nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); - err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast(b), &ec); + err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast(b), &ec); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { @@ -148,7 +148,7 @@ void TestErrCntRead::Run(void) { ": Not supported for this device" << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast(b), + err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast(b), nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); @@ -164,7 +164,7 @@ void TestErrCntRead::Run(void) { << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_ecc_count(device_handles_[i], static_cast(b), + err = amdsmi_get_gpu_ecc_count(processor_handles_[i], static_cast(b), nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/evt_notif_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/evt_notif_read_write.cc index e7f820b1b5..5061c6f097 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/evt_notif_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/evt_notif_read_write.cc @@ -109,7 +109,7 @@ void TestEvtNotifReadWrite::Run(void) { } for (dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - ret = amdsmi_init_event_notification(device_handles_[dv_ind]); + ret = amdsmi_init_gpu_event_notification(processor_handles_[dv_ind]); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << @@ -119,7 +119,7 @@ void TestEvtNotifReadWrite::Run(void) { return; } ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS); - ret = amdsmi_set_event_notification_mask(device_handles_[dv_ind], mask); + ret = amdsmi_set_gpu_event_notification_mask(processor_handles_[dv_ind], mask); ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS); } @@ -127,13 +127,13 @@ void TestEvtNotifReadWrite::Run(void) { uint32_t num_elem = 10; bool read_again = false; - ret = amdsmi_get_event_notification(10000, &num_elem, data); + ret = amdsmi_get_gpu_event_notification(10000, &num_elem, data); if (ret == AMDSMI_STATUS_SUCCESS || ret == AMDSMI_STATUS_INSUFFICIENT_SIZE) { EXPECT_LE(num_elem, 10) << "Expected the number of elements found to be <= buffer size (10)"; IF_VERB(STANDARD) { for (uint32_t i = 0; i < num_elem; ++i) { - std::cout << "\tdv_handle=" << data[i].device_handle << + std::cout << "\tdv_handle=" << data[i].processor_handle << " Type: " << NameFromEvtNotifType(data[i].event) << " Mesg: " << data[i].message << std::endl; if (data[i].event == AMDSMI_EVT_NOTIF_GPU_PRE_RESET) { @@ -155,19 +155,19 @@ void TestEvtNotifReadWrite::Run(void) { } else { // This should always fail. We want to print out the return code. EXPECT_EQ(ret, AMDSMI_STATUS_SUCCESS) << - "Unexpected return code for amdsmi_get_event_notification()"; + "Unexpected return code for amdsmi_get_gpu_event_notification()"; } // In case GPU Pre reset event was collected in the previous read, // read again to get the GPU Post reset event. if (read_again) { - ret = amdsmi_get_event_notification(10000, &num_elem, data); + ret = amdsmi_get_gpu_event_notification(10000, &num_elem, data); if (ret == AMDSMI_STATUS_SUCCESS || ret == AMDSMI_STATUS_INSUFFICIENT_SIZE) { EXPECT_LE(num_elem, 10) << "Expected the number of elements found to be <= buffer size (10)"; IF_VERB(STANDARD) { for (uint32_t i = 0; i < num_elem; ++i) { - std::cout << "\tdv_handle=" << data[i].device_handle << + std::cout << "\tdv_handle=" << data[i].processor_handle << " Type: " << NameFromEvtNotifType(data[i].event) << " Mesg: " << data[i].message << std::endl; } @@ -186,12 +186,12 @@ void TestEvtNotifReadWrite::Run(void) { } else { // This should always fail. We want to print out the return code. EXPECT_EQ(ret, AMDSMI_STATUS_SUCCESS) << - "Unexpected return code for amdsmi_get_event_notification()"; + "Unexpected return code for amdsmi_get_gpu_event_notification()"; } } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - ret = amdsmi_stop_event_notification(device_handles_[dv_ind]); + ret = amdsmi_stop_gpu_event_notification(processor_handles_[dv_ind]); ASSERT_EQ(ret, AMDSMI_STATUS_SUCCESS); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc index 53ce8322b2..5829567ec7 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/fan_read.cc @@ -96,12 +96,12 @@ void TestFanRead::Run(void) { } for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); IF_VERB(STANDARD) { std::cout << "\t**Current Fan Speed: "; } - err = amdsmi_dev_get_fan_speed(device_handles_[i], 0, &val_i64); + err = amdsmi_get_gpu_fan_speed(processor_handles_[i], 0, &val_i64); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << "\t**" << ": " << @@ -114,30 +114,30 @@ void TestFanRead::Run(void) { // Verify api support checking functionality is working - err = amdsmi_dev_get_fan_speed(device_handles_[i], 0, nullptr); + err = amdsmi_get_gpu_fan_speed(processor_handles_[i], 0, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); - err = amdsmi_dev_get_fan_speed_max(device_handles_[i], 0, &val_ui64); + err = amdsmi_get_gpu_fan_speed_max(processor_handles_[i], 0, &val_ui64); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << val_i64/static_cast(val_ui64)*100; std::cout << "% ("<< val_i64 << "/" << val_ui64 << ")" << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_fan_speed_max(device_handles_[i], 0, nullptr); + err = amdsmi_get_gpu_fan_speed_max(processor_handles_[i], 0, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); IF_VERB(STANDARD) { std::cout << "\t**Current fan RPMs: "; } - err = amdsmi_dev_get_fan_rpms(device_handles_[i], 0, &val_i64); + err = amdsmi_get_gpu_fan_rpms(processor_handles_[i], 0, &val_i64); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << val_i64 << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_fan_rpms(device_handles_[i], 0, nullptr); + err = amdsmi_get_gpu_fan_rpms(processor_handles_[i], 0, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc index ade6fdd04a..1ca1313f8d 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc @@ -98,9 +98,9 @@ void TestFanReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); - ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &orig_speed); + ret = amdsmi_get_gpu_fan_speed(processor_handles_[dv_ind], 0, &orig_speed); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << "\t**" << ": " << @@ -120,7 +120,7 @@ void TestFanReadWrite::Run(void) { return; } - ret = amdsmi_dev_get_fan_speed_max(device_handles_[dv_ind], 0, &max_speed); + ret = amdsmi_get_gpu_fan_speed_max(processor_handles_[dv_ind], 0, &max_speed); CHK_ERR_ASRT(ret) new_speed = 1.1 * orig_speed; @@ -136,12 +136,12 @@ void TestFanReadWrite::Run(void) { std::cout << "Setting fan speed to " << new_speed << std::endl; } - ret = amdsmi_dev_set_fan_speed(device_handles_[dv_ind], 0, new_speed); + ret = amdsmi_set_gpu_fan_speed(processor_handles_[dv_ind], 0, new_speed); CHK_ERR_ASRT(ret) sleep(4); - ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &cur_speed); + ret = amdsmi_get_gpu_fan_speed(processor_handles_[dv_ind], 0, &cur_speed); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -163,12 +163,12 @@ void TestFanReadWrite::Run(void) { std::cout << "Resetting fan control to auto..." << std::endl; } - ret = amdsmi_dev_reset_fan(device_handles_[dv_ind], 0); + ret = amdsmi_reset_gpu_fan(processor_handles_[dv_ind], 0); CHK_ERR_ASRT(ret) sleep(3); - ret = amdsmi_dev_get_fan_speed(device_handles_[dv_ind], 0, &cur_speed); + ret = amdsmi_get_gpu_fan_speed(processor_handles_[dv_ind], 0, &cur_speed); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc index 3f4e7e727f..0cb51149e5 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read.cc @@ -116,12 +116,12 @@ void TestFrequenciesRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { auto freq_output = [&](amdsmi_clk_type_t t, const char *name) { - err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, &f); + err = amdsmi_get_clk_freq(processor_handles_[i], t, &f); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Get " << name << ": Not supported on this machine" << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, nullptr); + err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) { std::cout << "\t**Get " << name << @@ -133,13 +133,13 @@ void TestFrequenciesRead::Run(void) { std::cout << f.num_supported << std::endl; print_frequencies(&f); // Verify api support checking functionality is working - err = amdsmi_dev_get_gpu_clk_freq(device_handles_[i], t, nullptr); + err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } }; - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); freq_output(CLK_TYPE_MEM, "Supported GPU Memory"); freq_output(CLK_TYPE_SYS, "Supported GPU"); @@ -147,12 +147,12 @@ void TestFrequenciesRead::Run(void) { freq_output(CLK_TYPE_DCEF, "Display Controller Engine Clock"); freq_output(CLK_TYPE_SOC, "SOC Clock"); - err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], &b); + err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], &b); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine" << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], nullptr); + err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) { std::cout << "\t**Get PCIE Bandwidth " @@ -164,7 +164,7 @@ void TestFrequenciesRead::Run(void) { std::cout << b.transfer_rate.num_supported << std::endl; print_frequencies(&b.transfer_rate, b.lanes); // Verify api support checking functionality is working - err = amdsmi_dev_get_pci_bandwidth(device_handles_[i], nullptr); + err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read_write.cc index 818662683c..778f6a4446 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/frequencies_read_write.cc @@ -102,7 +102,7 @@ void TestFrequenciesReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); for (uint32_t clk = (uint32_t)CLK_TYPE_FIRST; clk <= CLK_TYPE__MAX; ++clk) { @@ -113,7 +113,7 @@ void TestFrequenciesReadWrite::Run(void) { std::cout << amdsmi_clk << std::endl; if (amdsmi_clk == CLK_TYPE_PCIE) return false; - ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[dv_ind], amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f); std::cout << ret << std::endl; if (ret == AMDSMI_STATUS_NOT_SUPPORTED || @@ -151,7 +151,7 @@ void TestFrequenciesReadWrite::Run(void) { FreqEnumToStr(amdsmi_clk) << " to 0b" << freq_bm_str << " ..." << std::endl; } - ret = amdsmi_dev_set_clk_freq(device_handles_[dv_ind], amdsmi_clk, freq_bitmask); + ret = amdsmi_set_clk_freq(processor_handles_[dv_ind], amdsmi_clk, freq_bitmask); //Certain ASICs does not allow to set particular clocks. If set function for a clock returns //permission error despite root access, manually set ret value to success and return if (ret == AMDSMI_STATUS_NO_PERM && geteuid() == 0) { @@ -166,7 +166,7 @@ void TestFrequenciesReadWrite::Run(void) { return; } CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[dv_ind], amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f); if (ret != AMDSMI_STATUS_SUCCESS) { return; } @@ -175,12 +175,12 @@ void TestFrequenciesReadWrite::Run(void) { std::cout << "Frequency is now index " << f.current << std::endl; std::cout << "Resetting mask to all frequencies." << std::endl; } - ret = amdsmi_dev_set_clk_freq(device_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF); + ret = amdsmi_set_clk_freq(processor_handles_[dv_ind], amdsmi_clk, 0xFFFFFFFF); if (ret != AMDSMI_STATUS_SUCCESS) { return; } - ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); + ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); if (ret != AMDSMI_STATUS_SUCCESS) { return; } @@ -194,7 +194,7 @@ void TestFrequenciesReadWrite::Run(void) { freq_write(); CHK_ERR_ASRT(ret) #if 0 - ret = amdsmi_dev_get_gpu_clk_freq(dv_ind, amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(dv_ind, amdsmi_clk, &f); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -215,20 +215,20 @@ void TestFrequenciesReadWrite::Run(void) { std::cout << "Setting frequency mask for clock " << amdsmi_clk << " to 0b" << freq_bm_str << " ..." << std::endl; } - ret = amdsmi_dev_set_clk_freq(dv_ind, amdsmi_clk, freq_bitmask); + ret = amdsmi_set_clk_freq(dv_ind, amdsmi_clk, freq_bitmask); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_gpu_clk_freq(dv_ind, amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(dv_ind, amdsmi_clk, &f); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "Frequency is now index " << f.current << std::endl; std::cout << "Resetting mask to all frequencies." << std::endl; } - ret = amdsmi_dev_set_clk_freq(dv_ind, amdsmi_clk, 0xFFFFFFFF); + ret = amdsmi_set_clk_freq(dv_ind, amdsmi_clk, 0xFFFFFFFF); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_set_perf_level(dv_ind, AMDSMI_DEV_PERF_LEVEL_AUTO); + ret = amdsmi_set_gpu_perf_level(dv_ind, AMDSMI_DEV_PERF_LEVEL_AUTO); CHK_ERR_ASRT(ret) #endif } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/gpu_busy_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/gpu_busy_read.cc index 66dda12b44..636b0cec88 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/gpu_busy_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/gpu_busy_read.cc @@ -97,9 +97,9 @@ void TestGPUBusyRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); - err = amdsmi_dev_get_busy_percent(device_handles_[i], &val_ui32); + err = amdsmi_get_busy_percent(processor_handles_[i], &val_ui32); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_FILE_ERROR) { IF_VERB(STANDARD) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/gpu_metrics_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/gpu_metrics_read.cc index 4f81758626..4bfadfca10 100644 --- a/projects/amdsmi/tests/amd_smi_test/functional/gpu_metrics_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/gpu_metrics_read.cc @@ -97,13 +97,13 @@ void TestGpuMetricsRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); IF_VERB(STANDARD) { std::cout << "\t**GPU METRICS:\n"; } amdsmi_gpu_metrics_t smu; - err = amdsmi_dev_get_gpu_metrics_info(device_handles_[i], &smu); + err = amdsmi_get_gpu_metrics_info(processor_handles_[i], &smu); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { @@ -188,7 +188,7 @@ void TestGpuMetricsRead::Run(void) { } // Verify api support checking functionality is working - err = amdsmi_dev_get_gpu_metrics_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_metrics_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/hw_topology_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/hw_topology_read.cc index a7fdc9029d..68204afb7f 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/hw_topology_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/hw_topology_read.cc @@ -113,7 +113,7 @@ void TestHWTopologyRead::Run(void) { std::vector numa_numbers(num_devices); for (uint32_t dv_ind = 0; dv_ind < num_devices; ++dv_ind) { - amdsmi_device_handle dev_handle = device_handles_[dv_ind]; + amdsmi_processor_handle dev_handle = processor_handles_[dv_ind]; err = amdsmi_topo_get_numa_node_number(dev_handle, &numa_numbers[dv_ind]); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { @@ -138,8 +138,8 @@ void TestHWTopologyRead::Run(void) { gpu_links[dv_ind_src][dv_ind_dst].accessible = true; } else { AMDSMI_IO_LINK_TYPE type; - err = amdsmi_topo_get_link_type(device_handles_[dv_ind_src], - device_handles_[dv_ind_dst], + err = amdsmi_topo_get_link_type(processor_handles_[dv_ind_src], + processor_handles_[dv_ind_dst], &gpu_links[dv_ind_src][dv_ind_dst].hops, &type); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { @@ -170,8 +170,8 @@ void TestHWTopologyRead::Run(void) { } } } - err = amdsmi_topo_get_link_weight(device_handles_[dv_ind_src], - device_handles_[dv_ind_dst], + err = amdsmi_topo_get_link_weight(processor_handles_[dv_ind_src], + processor_handles_[dv_ind_dst], &gpu_links[dv_ind_src][dv_ind_dst].weight); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { @@ -185,8 +185,8 @@ void TestHWTopologyRead::Run(void) { CHK_ERR_ASRT(err) } } - err = amdsmi_is_P2P_accessible(device_handles_[dv_ind_src], - device_handles_[dv_ind_dst], + err = amdsmi_is_P2P_accessible(processor_handles_[dv_ind_src], + processor_handles_[dv_ind_dst], &gpu_links[dv_ind_src][dv_ind_dst].accessible); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/id_info_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/id_info_read.cc index bcdb428324..5b1cb1d635 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/id_info_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/id_info_read.cc @@ -105,11 +105,11 @@ void TestIdInfoRead::Run(void) { } // Get the device ID, name, vendor ID and vendor name for the device - err = amdsmi_dev_get_id(device_handles_[i], &id); + err = amdsmi_get_gpu_id(processor_handles_[i], &id); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { amdsmi_status_t ret; // Verify api support checking functionality is working - ret = amdsmi_dev_get_id(device_handles_[i], nullptr); + ret = amdsmi_get_gpu_id(processor_handles_[i], nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -118,25 +118,25 @@ void TestIdInfoRead::Run(void) { std::cout << "\t**Device ID: 0x" << std::hex << id << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_id(device_handles_[i], nullptr); + err = amdsmi_get_gpu_id(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } // vendor_id, unique_id amdsmi_asic_info_t asci_info; - err = amdsmi_get_asic_info(device_handles_[0], &asci_info); + err = amdsmi_get_gpu_asic_info(processor_handles_[0], &asci_info); CHK_ERR_ASRT(err) // device name, brand, serial_number amdsmi_board_info_t board_info; - err = amdsmi_get_board_info(device_handles_[0], &board_info); + err = amdsmi_get_gpu_board_info(processor_handles_[0], &board_info); CHK_ERR_ASRT(err) - err = amdsmi_dev_get_vram_vendor(device_handles_[i], buffer, kBufferLen); + err = amdsmi_get_gpu_vram_vendor(processor_handles_[i], buffer, kBufferLen); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Vram Vendor string not supported on this system." << std::endl; - err = amdsmi_dev_get_vram_vendor(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_vram_vendor(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -145,10 +145,10 @@ void TestIdInfoRead::Run(void) { } } - err = amdsmi_dev_get_drm_render_minor(device_handles_[i], &drm_render_minor); + err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], &drm_render_minor); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { // Verify api support checking functionality is working - err = amdsmi_dev_get_drm_render_minor(device_handles_[i], nullptr); + err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -156,15 +156,15 @@ void TestIdInfoRead::Run(void) { std::cout << "\t**DRM Render Minor: " << drm_render_minor << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_drm_render_minor(device_handles_[i], nullptr); + err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } - err = amdsmi_dev_get_vendor_name(device_handles_[i], buffer, kBufferLen); + err = amdsmi_get_gpu_vendor_name(processor_handles_[i], buffer, kBufferLen); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Device Vendor name string not found on this system." << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -172,15 +172,15 @@ void TestIdInfoRead::Run(void) { std::cout << "\t**Device Vendor name: " << buffer << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } // Get the device ID, name, vendor ID and vendor name for the sub-device - err = amdsmi_dev_get_subsystem_id(device_handles_[i], &id); + err = amdsmi_get_gpu_subsystem_id(processor_handles_[i], &id); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { // Verify api support checking functionality is working - err = amdsmi_dev_get_subsystem_id(device_handles_[i], nullptr); + err = amdsmi_get_gpu_subsystem_id(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -188,15 +188,15 @@ void TestIdInfoRead::Run(void) { std::cout << "\t**Subsystem ID: 0x" << std::hex << id << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_subsystem_id(device_handles_[i], nullptr); + err = amdsmi_get_gpu_subsystem_id(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } - err = amdsmi_dev_get_subsystem_name(device_handles_[i], buffer, kBufferLen); + err = amdsmi_get_gpu_subsystem_name(processor_handles_[i], buffer, kBufferLen); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Subsystem name string not found on this system." << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_subsystem_name(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_subsystem_name(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -204,7 +204,7 @@ void TestIdInfoRead::Run(void) { std::cout << "\t**Subsystem name: " << buffer << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_subsystem_name(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_subsystem_name(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } @@ -213,13 +213,13 @@ void TestIdInfoRead::Run(void) { asci_info.subvendor_id << std::endl; } - err = amdsmi_dev_get_vendor_name(device_handles_[i], buffer, kBufferLen); + err = amdsmi_get_gpu_vendor_name(processor_handles_[i], buffer, kBufferLen); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Subsystem Vendor name string not found on this system." << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) @@ -227,11 +227,11 @@ void TestIdInfoRead::Run(void) { std::cout << "\t**Subsystem Vendor name: " << buffer << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_vendor_name(device_handles_[i], nullptr, kBufferLen); + err = amdsmi_get_gpu_vendor_name(processor_handles_[i], nullptr, kBufferLen); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } - err = amdsmi_dev_get_pci_id(device_handles_[i], &val_ui64); + err = amdsmi_get_gpu_pci_id(processor_handles_[i], &val_ui64); // Don't check for AMDSMI_STATUS_NOT_SUPPORTED since this should always be // supported. It is not based on a sysfs file. CHK_ERR_ASRT(err) @@ -240,7 +240,7 @@ void TestIdInfoRead::Run(void) { std::cout << " (" << std::dec << val_ui64 << ")" << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_pci_id(device_handles_[i], nullptr); + err = amdsmi_get_gpu_pci_id(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/mem_page_info_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/mem_page_info_read.cc index c662726722..d706f83722 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/mem_page_info_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/mem_page_info_read.cc @@ -94,9 +94,9 @@ void TestMemPageInfoRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); - err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], &num_pages, nullptr); + err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], &num_pages, nullptr); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << @@ -104,7 +104,7 @@ void TestMemPageInfoRead::Run(void) { << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], nullptr, nullptr); + err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], nullptr, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); continue; @@ -115,7 +115,7 @@ void TestMemPageInfoRead::Run(void) { std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], nullptr, nullptr); + err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], nullptr, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } @@ -124,7 +124,7 @@ void TestMemPageInfoRead::Run(void) { assert(records != nullptr); - err = amdsmi_dev_get_memory_reserved_pages(device_handles_[i], &num_pages, records); + err = amdsmi_get_gpu_memory_reserved_pages(processor_handles_[i], &num_pages, records); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Getting Memory Page Retirement Status not " "supported for this device" << std::endl; diff --git a/projects/amdsmi/tests/amd_smi_test/functional/mem_util_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/mem_util_read.cc index f9a1bac7d1..1a5701f1d8 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/mem_util_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/mem_util_read.cc @@ -116,11 +116,11 @@ void TestMemUtilRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); #if 0 - err = amdsmi_dev_get_memory_busy_percent(i, &mem_busy_percent); - err_chk("amdsmi_dev_get_memory_busy_percent()"); + err = amdsmi_get_gpu_memory_busy_percent(i, &mem_busy_percent); + err_chk("amdsmi_get_gpu_memory_busy_percent()"); if (err != AMDSMI_STATUS_SUCCESS) { return; } @@ -131,16 +131,16 @@ void TestMemUtilRead::Run(void) { #endif for (uint32_t mem_type = AMDSMI_MEM_TYPE_FIRST; mem_type <= AMDSMI_MEM_TYPE_LAST; ++mem_type) { - err = amdsmi_dev_get_memory_total(device_handles_[i], + err = amdsmi_get_gpu_memory_total(processor_handles_[i], static_cast(mem_type), &total); - err_chk("amdsmi_dev_get_memory_total()"); + err_chk("amdsmi_get_gpu_memory_total()"); if (err != AMDSMI_STATUS_SUCCESS) { return; } - err = amdsmi_dev_get_memory_usage(device_handles_[i], + err = amdsmi_get_gpu_memory_usage(processor_handles_[i], static_cast(mem_type), &usage); - err_chk("amdsmi_dev_get_memory_usage()"); + err_chk("amdsmi_get_gpu_memory_usage()"); if (err != AMDSMI_STATUS_SUCCESS) { return; } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/metrics_counter_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/metrics_counter_read.cc index 0bb6cf4510..2c24576fba 100644 --- a/projects/amdsmi/tests/amd_smi_test/functional/metrics_counter_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/metrics_counter_read.cc @@ -97,7 +97,7 @@ void TestMetricsCounterRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); IF_VERB(STANDARD) { std::cout << "\t**GPU METRICS ENERGY COUNTER:\n"; @@ -106,7 +106,7 @@ void TestMetricsCounterRead::Run(void) { uint64_t power; uint64_t timestamp; float counter_resolution; - err = amdsmi_dev_get_energy_count(device_handles_[i], &power, &counter_resolution, ×tamp); + err = amdsmi_get_energy_count(processor_handles_[i], &power, &counter_resolution, ×tamp); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { @@ -128,14 +128,14 @@ void TestMetricsCounterRead::Run(void) { } // Verify api support checking functionality is working - err = amdsmi_dev_get_energy_count(device_handles_[i], nullptr, nullptr, nullptr); + err = amdsmi_get_energy_count(processor_handles_[i], nullptr, nullptr, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); // Coarse Grain counters amdsmi_utilization_counter_t utilization_counters[2]; utilization_counters[0].type = AMDSMI_COARSE_GRAIN_GFX_ACTIVITY; utilization_counters[1].type = AMDSMI_COARSE_GRAIN_MEM_ACTIVITY; - err = amdsmi_get_utilization_count(device_handles_[i], utilization_counters, + err = amdsmi_get_utilization_count(processor_handles_[i], utilization_counters, 2, ×tamp); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { @@ -158,7 +158,7 @@ void TestMetricsCounterRead::Run(void) { } // Verify api support checking functionality is working - err = amdsmi_get_utilization_count(device_handles_[i], nullptr, + err = amdsmi_get_utilization_count(processor_handles_[i], nullptr, 1 , nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } // end for diff --git a/projects/amdsmi/tests/amd_smi_test/functional/mutual_exclusion.cc b/projects/amdsmi/tests/amd_smi_test/functional/mutual_exclusion.cc index 0f5b92f81b..116b624d2a 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/mutual_exclusion.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/mutual_exclusion.cc @@ -197,117 +197,116 @@ void TestMutualExclusion::Run(void) { std::cout << "at " << __FILE__ << ":" << __LINE__ << std::endl; \ } \ } - ret = amdsmi_dev_get_id(device_handles_[0], &dmy_ui16); + ret = amdsmi_get_gpu_id(processor_handles_[0], &dmy_ui16); // vendor_id, unique_id amdsmi_asic_info_t asci_info; - ret = amdsmi_get_asic_info(device_handles_[0], &asci_info); + ret = amdsmi_get_gpu_asic_info(processor_handles_[0], &asci_info); CHECK_RET(ret, AMDSMI_STATUS_BUSY); // device name, brand, serial_number amdsmi_board_info_t board_info; - ret = amdsmi_get_board_info(device_handles_[0], &board_info); + ret = amdsmi_get_gpu_board_info(processor_handles_[0], &board_info); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_vendor_name(device_handles_[0], dmy_str, 10); + ret = amdsmi_get_gpu_vendor_name(processor_handles_[0], dmy_str, 10); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_vram_vendor(device_handles_[0], dmy_str, 10); + ret = amdsmi_get_gpu_vram_vendor(processor_handles_[0], dmy_str, 10); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_subsystem_id(device_handles_[0], &dmy_ui16); + ret = amdsmi_get_gpu_subsystem_id(processor_handles_[0], &dmy_ui16); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_pci_id(device_handles_[0], &dmy_ui64); + ret = amdsmi_get_gpu_pci_id(processor_handles_[0], &dmy_ui64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_pci_throughput(device_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64); + ret = amdsmi_get_gpu_pci_throughput(processor_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_pci_replay_counter(device_handles_[0], &dmy_ui64); + ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[0], &dmy_ui64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_set_pci_bandwidth(device_handles_[0], 0); + ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[0], 0); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_fan_rpms(device_handles_[0], dmy_ui32, &dmy_i64); + ret = amdsmi_get_gpu_fan_rpms(processor_handles_[0], dmy_ui32, &dmy_i64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_fan_speed(device_handles_[0], 0, &dmy_i64); + ret = amdsmi_get_gpu_fan_speed(processor_handles_[0], 0, &dmy_i64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_fan_speed_max(device_handles_[0], 0, &dmy_ui64); + ret = amdsmi_get_gpu_fan_speed_max(processor_handles_[0], 0, &dmy_ui64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_temp_metric(device_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64); + ret = amdsmi_get_temp_metric(processor_handles_[0], TEMPERATURE_TYPE_EDGE, AMDSMI_TEMP_CURRENT, &dmy_i64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_reset_fan(device_handles_[0], 0); + ret = amdsmi_reset_gpu_fan(processor_handles_[0], 0); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_set_fan_speed(device_handles_[0], dmy_ui32, 0); + ret = amdsmi_set_gpu_fan_speed(processor_handles_[0], dmy_ui32, 0); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_perf_level(device_handles_[0], &dmy_perf_lvl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[0], &dmy_perf_lvl); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_overdrive_level(device_handles_[0], &dmy_ui32); + ret = amdsmi_get_gpu_overdrive_level(processor_handles_[0], &dmy_ui32); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_gpu_clk_freq(device_handles_[0], CLK_TYPE_SYS, &dmy_freqs); + ret = amdsmi_get_clk_freq(processor_handles_[0], CLK_TYPE_SYS, &dmy_freqs); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_od_volt_info(device_handles_[0], &dmy_od_volt); + ret = amdsmi_get_gpu_od_volt_info(processor_handles_[0], &dmy_od_volt); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_od_volt_curve_regions(device_handles_[0], &dmy_ui32, &dmy_vlt_reg); + ret = amdsmi_get_gpu_od_volt_curve_regions(processor_handles_[0], &dmy_ui32, &dmy_vlt_reg); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_set_overdrive_level_v1(device_handles_[0], dmy_i32); + ret = amdsmi_set_gpu_overdrive_level_v1(processor_handles_[0], dmy_i32); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_set_clk_freq(device_handles_[0], CLK_TYPE_SYS, 0); + ret = amdsmi_set_clk_freq(processor_handles_[0], CLK_TYPE_SYS, 0); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_ecc_count(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt); + ret = amdsmi_get_gpu_ecc_count(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_ecc_enabled(device_handles_[0], &dmy_ui64); + ret = amdsmi_get_gpu_ecc_enabled(processor_handles_[0], &dmy_ui64); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_ecc_status(device_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st); + ret = amdsmi_get_gpu_ecc_status(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_ras_err_st); CHECK_RET(ret, AMDSMI_STATUS_BUSY); /* Other functions holding device mutexes. Listed for reference. amdsmi_dev_sku_get - amdsmi_dev_set_perf_level_v1 - amdsmi_dev_set_od_clk_info - amdsmi_dev_set_od_volt_info + amdsmi_set_gpu_perf_level_v1 + amdsmi_set_gpu_od_clk_info + amdsmi_set_gpu_od_volt_info amdsmi_dev_firmware_version_get amdsmi_dev_firmware_version_get amdsmi_dev_name_get amdsmi_dev_brand_get - amdsmi_dev_get_vram_vendor - amdsmi_dev_get_subsystem_name - amdsmi_dev_get_drm_render_minor - amdsmi_dev_get_vendor_name - amdsmi_dev_get_pci_bandwidth - amdsmi_dev_set_pci_bandwidth - amdsmi_dev_get_pci_throughput - amdsmi_dev_get_temp_metric - amdsmi_dev_get_volt_metric - amdsmi_dev_get_fan_speed - amdsmi_dev_get_fan_rpms - amdsmi_dev_reset_fan - amdsmi_dev_set_fan_speed - amdsmi_dev_get_fan_speed_max - amdsmi_dev_get_od_volt_info - amdsmi_dev_get_gpu_metrics_info - amdsmi_dev_get_od_volt_curve_regions + amdsmi_get_gpu_vram_vendor + amdsmi_get_gpu_subsystem_name + amdsmi_get_gpu_drm_render_minor + amdsmi_get_gpu_vendor_name + amdsmi_get_gpu_pci_bandwidth + amdsmi_set_gpu_pci_bandwidth + amdsmi_get_gpu_pci_throughput + amdsmi_get_temp_metric + amdsmi_get_gpu_volt_metric + amdsmi_get_gpu_fan_speed + amdsmi_get_gpu_fan_rpms + amdsmi_reset_gpu_fan + amdsmi_set_gpu_fan_speed + amdsmi_get_gpu_fan_speed_max + amdsmi_get_gpu_od_volt_info + amdsmi_get_gpu_metrics_info + amdsmi_get_gpu_od_volt_curve_regions amdsmi_dev_power_max_get - amdsmi_dev_get_power_ave amdsmi_dev_power_cap_get amdsmi_dev_power_cap_range_get - amdsmi_dev_set_power_cap - amdsmi_dev_get_power_profile_presets - amdsmi_dev_set_power_profile - amdsmi_dev_get_memory_total - amdsmi_dev_get_memory_usage - amdsmi_dev_get_memory_busy_percent - amdsmi_dev_get_busy_percent + amdsmi_set_power_cap + amdsmi_get_gpu_power_profile_presets + amdsmi_set_gpu_power_profile + amdsmi_get_gpu_memory_total + amdsmi_get_gpu_memory_usage + amdsmi_get_gpu_memory_busy_percent + amdsmi_get_busy_percent amdsmi_dev_vbios_version_get amdsmi_dev_serial_number_get - amdsmi_dev_get_pci_replay_counter + amdsmi_get_gpu_pci_replay_counter amdsmi_dev_unique_id_get - amdsmi_dev_create_counter - amdsmi_counter_get_available_counters - amdsmi_dev_counter_group_supported - amdsmi_dev_get_memory_reserved_pages - amdsmi_dev_xgmi_error_status - amdsmi_dev_reset_xgmi_error + amdsmi_gpu_create_counter + amdsmi_get_gpu_available_counters + amdsmi_gpu_counter_group_supported + amdsmi_get_gpu_memory_reserved_pages + amdsmi_gpu_xgmi_error_status + amdsmi_reset_gpu_xgmi_error amdsmi_dev_xgmi_hive_id_get amdsmi_topo_get_link_weight - amdsmi_set_event_notification_mask - amdsmi_init_event_notification - amdsmi_stop_event_notification + amdsmi_set_gpu_event_notification_mask + amdsmi_init_gpu_event_notification + amdsmi_stop_gpu_event_notification */ IF_VERB(STANDARD) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read.cc index 025e919a37..4c609c50d4 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read.cc @@ -96,14 +96,20 @@ void TestOverdriveRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); - err = amdsmi_dev_get_overdrive_level(device_handles_[i], &val_ui32); + err = amdsmi_get_gpu_overdrive_level(processor_handles_[i], &val_ui32); + if (err == AMDSMI_STATUS_NOT_SUPPORTED) { + IF_VERB(STANDARD) { + std::cout << "\t** Not supported on this machine" << std::endl; + } + continue; + } CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**OverDrive Level:" << val_ui32 << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_overdrive_level(device_handles_[i], nullptr); + err = amdsmi_get_gpu_overdrive_level(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read_write.cc index 030ece5e55..55662bae28 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/overdrive_read_write.cc @@ -95,27 +95,33 @@ void TestOverdriveReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); IF_VERB(STANDARD) { std::cout << "Set Overdrive level to 0%..." << std::endl; } - ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 0); + ret = amdsmi_set_gpu_overdrive_level(processor_handles_[dv_ind], 0); + if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { + IF_VERB(STANDARD) { + std::cout << "\t** Not supported on this machine" << std::endl; + } + continue; + } CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "Set Overdrive level to 10%..." << std::endl; } - ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 10); + ret = amdsmi_set_gpu_overdrive_level(processor_handles_[dv_ind], 10); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_overdrive_level(device_handles_[dv_ind], &val); + ret = amdsmi_get_gpu_overdrive_level(processor_handles_[dv_ind], &val); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "\t**New OverDrive Level:" << val << std::endl; std::cout << "Reset Overdrive level to 0%..." << std::endl; } - ret = amdsmi_dev_set_overdrive_level(device_handles_[dv_ind], 0); + ret = amdsmi_set_gpu_overdrive_level(processor_handles_[dv_ind], 0); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_overdrive_level(device_handles_[dv_ind], &val); + ret = amdsmi_get_gpu_overdrive_level(processor_handles_[dv_ind], &val); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "\t**New OverDrive Level:" << val << std::endl; diff --git a/projects/amdsmi/tests/amd_smi_test/functional/pci_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/pci_read_write.cc index e0e5ec663d..f08b8e4c17 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/pci_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/pci_read_write.cc @@ -98,17 +98,17 @@ void TestPciReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); - ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], &u64int); + ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[dv_ind], &u64int); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << - "\t** amdsmi_dev_get_pci_replay_counter() is not supported" + "\t** amdsmi_get_gpu_pci_replay_counter() is not supported" " on this machine" << std::endl; // Verify api support checking functionality is working - ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], nullptr); + ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[dv_ind], nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(ret) @@ -116,11 +116,11 @@ void TestPciReadWrite::Run(void) { std::cout << "\tPCIe Replay Counter: " << u64int << std::endl; } // Verify api support checking functionality is working - ret = amdsmi_dev_get_pci_replay_counter(device_handles_[dv_ind], nullptr); + ret = amdsmi_get_gpu_pci_replay_counter(processor_handles_[dv_ind], nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_INVAL); } - ret = amdsmi_dev_get_pci_throughput(device_handles_[dv_ind], &sent, &received, &max_pkt_sz); + ret = amdsmi_get_gpu_pci_throughput(processor_handles_[dv_ind], &sent, &received, &max_pkt_sz); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "TEST FAILURE: Current PCIe throughput is not detected. " "This is likely because it is not indicated in the pcie_bw sysfs " @@ -141,14 +141,14 @@ void TestPciReadWrite::Run(void) { std::cout << std::endl; } - ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], &bw); + ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], &bw); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "TEST FAILURE: Current PCIe bandwidth is not detected. " "This is likely because it is not indicated in the pp_dpm_pcie sysfs " "file. Aborting test." << std::endl; // Verify api support checking functionality is working - ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], nullptr); + ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED); return; @@ -163,7 +163,7 @@ void TestPciReadWrite::Run(void) { std::endl; } // Verify api support checking functionality is working - ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], nullptr); + ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_INVAL); // First set the bitmask to all supported bandwidths @@ -182,10 +182,10 @@ void TestPciReadWrite::Run(void) { std::cout << "\tSetting bandwidth mask to " << "0b" << freq_bm_str << " ..." << std::endl; } - ret = amdsmi_dev_set_pci_bandwidth(device_handles_[dv_ind], freq_bitmask); + ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[dv_ind], freq_bitmask); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_pci_bandwidth(device_handles_[dv_ind], &bw); + ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], &bw); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -193,10 +193,10 @@ void TestPciReadWrite::Run(void) { std::endl; std::cout << "\tResetting mask to all bandwidths." << std::endl; } - ret = amdsmi_dev_set_pci_bandwidth(device_handles_[dv_ind], 0xFFFFFFFF); + ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[dv_ind], 0xFFFFFFFF); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); + ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); CHK_ERR_ASRT(ret) } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc index e223be4715..804b462a54 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc @@ -110,25 +110,25 @@ void TestPerfCntrReadWrite::Close() { // Refactor this to handle different event groups once we have > 1 event group -void TestPerfCntrReadWrite::CountEvents(amdsmi_device_handle dv_ind, +void TestPerfCntrReadWrite::CountEvents(amdsmi_processor_handle dv_ind, amdsmi_event_type_t evnt, amdsmi_counter_value_t *val, int32_t sleep_sec) { amdsmi_event_handle_t evt_handle; amdsmi_status_t ret; - ret = amdsmi_dev_create_counter(dv_ind, + ret = amdsmi_gpu_create_counter(dv_ind, static_cast(evnt), &evt_handle); CHK_ERR_ASRT(ret) - // Note that amdsmi_dev_create_counter() should never return + // Note that amdsmi_gpu_create_counter() should never return // AMDSMI_STATUS_NOT_SUPPORTED. It will return AMDSMI_STATUS_OUT_OF_RESOURCES // if it is unable to create a counter. - ret = amdsmi_dev_create_counter(dv_ind, + ret = amdsmi_gpu_create_counter(dv_ind, static_cast(evnt), nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_INVAL); - ret = amdsmi_control_counter(evt_handle, AMDSMI_CNTR_CMD_START, nullptr); + ret = amdsmi_gpu_control_counter(evt_handle, AMDSMI_CNTR_CMD_START, nullptr); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { - std::cout << "amdsmi_control_counter() returned " + std::cout << "amdsmi_gpu_control_counter() returned " "AMDSMI_STATUS_NOT_SUPPORTED" << std::endl; throw AMDSMI_STATUS_NOT_SUPPORTED; } else { @@ -136,7 +136,7 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_device_handle dv_ind, } sleep(sleep_sec); - ret = amdsmi_read_counter(evt_handle, val); + ret = amdsmi_gpu_read_counter(evt_handle, val); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -146,7 +146,7 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_device_handle dv_ind, std::cout << "\t\t\tEvents/Second Running: " << val->value/static_cast(val->time_running) << std::endl; } - ret = amdsmi_dev_destroy_counter(evt_handle); + ret = amdsmi_gpu_destroy_counter(evt_handle); CHK_ERR_ASRT(ret) } @@ -157,7 +157,7 @@ static const uint64_t kVg20Level1Bandwidth = 23; // 23 GB/sec void -TestPerfCntrReadWrite::testEventsIndividually(amdsmi_device_handle dv_ind) { +TestPerfCntrReadWrite::testEventsIndividually(amdsmi_processor_handle dv_ind) { amdsmi_status_t ret; amdsmi_counter_value_t val; uint64_t throughput; @@ -202,7 +202,7 @@ TestPerfCntrReadWrite::testEventsIndividually(amdsmi_device_handle dv_ind) { std::cout << "****************************" << std::endl; } for (PerfCntrEvtGrp grp : s_event_groups) { - ret = amdsmi_dev_counter_group_supported(dv_ind, grp.group()); + ret = amdsmi_gpu_counter_group_supported(dv_ind, grp.group()); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { continue; } @@ -231,7 +231,7 @@ TestPerfCntrReadWrite::testEventsIndividually(amdsmi_device_handle dv_ind) { } void -TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { +TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_processor_handle dv_ind) { amdsmi_status_t ret; amdsmi_counter_value_t val; uint32_t avail_counters; @@ -248,7 +248,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { * handling 1 event at a time. */ for (PerfCntrEvtGrp grp : s_event_groups) { - ret = amdsmi_dev_counter_group_supported(dv_ind, grp.group()); + ret = amdsmi_gpu_counter_group_supported(dv_ind, grp.group()); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << "\tEvent Group " << grp.name() << @@ -261,7 +261,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { std::cout << "Testing Event Group " << grp.name() << std::endl; } - ret = amdsmi_counter_get_available_counters(dv_ind, grp.group(), + ret = amdsmi_get_gpu_available_counters(dv_ind, grp.group(), &avail_counters); IF_VERB(STANDARD) { std::cout << "Available Counters: " << avail_counters << std::endl; @@ -294,7 +294,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { std::cout << "\tEvent Type " << tmp << std::endl; } - ret = amdsmi_dev_create_counter(dv_ind, + ret = amdsmi_gpu_create_counter(dv_ind, static_cast(tmp), &evt_handle.get()[j]); CHK_ERR_ASRT(ret) } @@ -307,11 +307,11 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { for (j = 0; j < num_created; ++j) { tmp = static_cast(evnt + j); - ret = amdsmi_control_counter(evt_handle.get()[j], AMDSMI_CNTR_CMD_START, + ret = amdsmi_gpu_control_counter(evt_handle.get()[j], AMDSMI_CNTR_CMD_START, nullptr); CHK_ERR_ASRT(ret) - ret = amdsmi_counter_get_available_counters(dv_ind, grp.group(), + ret = amdsmi_get_gpu_available_counters(dv_ind, grp.group(), &tmp_cntrs); CHK_ERR_ASRT(ret) ASSERT_EQ(tmp_cntrs, (avail_counters - j - 1)); @@ -325,7 +325,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { for (j = 0; j < num_created; ++j) { tmp = static_cast(evnt + j); - ret = amdsmi_read_counter(evt_handle.get()[j], &val); + ret = amdsmi_gpu_read_counter(evt_handle.get()[j], &val); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -337,7 +337,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_device_handle dv_ind) { } } for (j = 0; j < num_created; ++j) { - ret = amdsmi_dev_destroy_counter(evt_handle.get()[j]); + ret = amdsmi_gpu_destroy_counter(evt_handle.get()[j]); CHK_ERR_ASRT(ret) } } @@ -352,7 +352,7 @@ void TestPerfCntrReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - amdsmi_device_handle dev_handle = device_handles_[dv_ind]; + amdsmi_processor_handle dev_handle = processor_handles_[dv_ind]; PrintDeviceHeader(dev_handle); try { testEventsIndividually(dev_handle); diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.h b/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.h index 96e29199dd..1aef41d396 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.h +++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.h @@ -72,11 +72,11 @@ class TestPerfCntrReadWrite : public TestBase { virtual void DisplayTestInfo(void); private: - void CountEvents(amdsmi_device_handle dv_ind, + void CountEvents(amdsmi_processor_handle dv_ind, amdsmi_event_type_t evnt, amdsmi_counter_value_t *val, int32_t sleep_sec = 1); - void testEventsIndividually(amdsmi_device_handle dv_ind); - void testEventsSimultaneously(amdsmi_device_handle dv_ind); + void testEventsIndividually(amdsmi_processor_handle dv_ind); + void testEventsSimultaneously(amdsmi_processor_handle dv_ind); }; class PerfCntrEvtGrp { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc b/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc index c931b61308..f20215606e 100644 --- a/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_determinism.cc @@ -102,8 +102,8 @@ void TestPerfDeterminism::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); - err = amdsmi_dev_get_od_volt_info(device_handles_[i], &odv); + PrintDeviceHeader(processor_handles_[i]); + err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << "\t** Not supported on this machine" << std::endl; @@ -114,14 +114,14 @@ void TestPerfDeterminism::Run(void) { clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50; } - err = amdsmi_set_perf_determinism_mode(device_handles_[i], clkvalue); + err = amdsmi_set_gpu_perf_determinism_mode(processor_handles_[i], clkvalue); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << "\t**Not supported on this machine" << std::endl; } return; } else { - ret = amdsmi_dev_get_perf_level(device_handles_[i], &pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) << @@ -130,9 +130,9 @@ void TestPerfDeterminism::Run(void) { } std::cout << "\t**Resetting performance determinism" << std::endl; - err = amdsmi_dev_set_perf_level(device_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);; + err = amdsmi_set_gpu_perf_level(processor_handles_[i], AMDSMI_DEV_PERF_LEVEL_AUTO);; CHK_ERR_ASRT(err) - ret = amdsmi_dev_get_perf_level(device_handles_[i], &pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) << diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read.cc index 490dfc8e4c..bb8d996120 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read.cc @@ -96,16 +96,16 @@ void TestPerfLevelRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); - err = amdsmi_dev_get_perf_level(device_handles_[i], &pfl); + err = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Performance Level:" << std::dec << (uint32_t)pfl << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_perf_level(device_handles_[i], nullptr); + err = amdsmi_get_gpu_perf_level(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read_write.cc index 16d73191ec..0e59053cb7 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_level_read_write.cc @@ -99,9 +99,9 @@ void TestPerfLevelReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); - ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &orig_pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &orig_pfl); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -120,14 +120,14 @@ void TestPerfLevelReadWrite::Run(void) { GetPerfLevelStr(static_cast(pfl_i)) << " ..." << std::endl; } - ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], + ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], static_cast(pfl_i)); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**" << GetPerfLevelStr(static_cast(pfl_i)) << " returned AMDSMI_STATUS_NOT_SUPPORTED" << std::endl; } else { CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) << @@ -139,9 +139,15 @@ void TestPerfLevelReadWrite::Run(void) { std::cout << "Reset Perf level to " << GetPerfLevelStr(orig_pfl) << " ..." << std::endl; } - ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], orig_pfl); + ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], orig_pfl); + if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { + IF_VERB(STANDARD) { + std::cout << "\t** Not supported on this machine" << std::endl; + } + continue; + } CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/power_cap_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/power_cap_read_write.cc index 9c87cd1b91..f6fd038ba4 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/power_cap_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/power_cap_read_write.cc @@ -100,13 +100,13 @@ void TestPowerCapReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); amdsmi_power_cap_info_t info; - ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info); + ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info); CHK_ERR_ASRT(ret) // Verify api support checking functionality is working - ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, nullptr); + ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_INVAL); min = info.min_power_cap; max = info.max_power_cap; @@ -121,13 +121,19 @@ void TestPowerCapReadWrite::Run(void) { std::cout << "Setting new cap to " << new_cap << "..." << std::endl; } start = clock(); - ret = amdsmi_dev_set_power_cap(device_handles_[dv_ind], 0, new_cap); + ret = amdsmi_set_power_cap(processor_handles_[dv_ind], 0, new_cap); end = clock(); cpu_time_used = ((double) (end - start)) * 1000000UL / CLOCKS_PER_SEC; + if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { + IF_VERB(STANDARD) { + std::cout << "\t** Not supported on this machine" << std::endl; + } + continue; + } CHK_ERR_ASRT(ret) - ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info); + ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info); CHK_ERR_ASRT(ret) new_cap = info.default_power_cap; @@ -139,10 +145,10 @@ void TestPowerCapReadWrite::Run(void) { std::cout << "Resetting cap to " << orig << "..." << std::endl; } - ret = amdsmi_dev_set_power_cap(device_handles_[dv_ind], 0, orig); + ret = amdsmi_set_power_cap(processor_handles_[dv_ind], 0, orig); CHK_ERR_ASRT(ret) - ret = amdsmi_get_power_cap_info(device_handles_[dv_ind], 0, &info); + ret = amdsmi_get_power_cap_info(processor_handles_[dv_ind], 0, &info); CHK_ERR_ASRT(ret) new_cap = info.default_power_cap; diff --git a/projects/amdsmi/tests/amd_smi_test/functional/power_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/power_read.cc index 6d69e708bc..d1f9a4a7e4 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/power_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/power_read.cc @@ -97,10 +97,10 @@ void TestPowerRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); amdsmi_power_cap_info_t info; - err = amdsmi_get_power_cap_info(device_handles_[i], 0, &info); + err = amdsmi_get_power_cap_info(processor_handles_[i], 0, &info); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Current Power Cap: " << info.power_cap << "uW" <(val_ui64)/1000 << " mW" << std::endl; - } - // Verify api support checking functionality is working - err = amdsmi_dev_get_power_ave(device_handles_[i], 0, nullptr); - ASSERT_EQ(err, AMDSMI_STATUS_INVAL); - } } } } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc index fa45c9c11f..f341c7c069 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/power_read_write.cc @@ -120,9 +120,9 @@ void TestPowerReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - PrintDeviceHeader(device_handles_[dv_ind]); + PrintDeviceHeader(processor_handles_[dv_ind]); - ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status); + ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "The power profile presets settings is not supported. " << std::endl; @@ -131,7 +131,7 @@ void TestPowerReadWrite::Run(void) { CHK_ERR_ASRT(ret) // Verify api support checking functionality is working - ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, nullptr); + ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_INVAL); IF_VERB(STANDARD) { @@ -172,27 +172,27 @@ void TestPowerReadWrite::Run(void) { return; } - ret = amdsmi_dev_set_power_profile(device_handles_[dv_ind], 0, new_prof); + ret = amdsmi_set_gpu_power_profile(processor_handles_[dv_ind], 0, new_prof); CHK_ERR_ASRT(ret) amdsmi_dev_perf_level_t pfl; - ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl); CHK_ERR_ASRT(ret) ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_MANUAL); - ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status); + ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status); CHK_ERR_ASRT(ret) ASSERT_EQ(status.current, new_prof); - ret = amdsmi_dev_set_perf_level(device_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); + ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_perf_level(device_handles_[dv_ind], &pfl); + ret = amdsmi_get_gpu_perf_level(processor_handles_[dv_ind], &pfl); CHK_ERR_ASRT(ret) ASSERT_EQ(pfl, AMDSMI_DEV_PERF_LEVEL_AUTO); - ret = amdsmi_dev_get_power_profile_presets(device_handles_[dv_ind], 0, &status); + ret = amdsmi_get_gpu_power_profile_presets(processor_handles_[dv_ind], 0, &status); CHK_ERR_ASRT(ret) ASSERT_EQ(status.current, orig_profile); diff --git a/projects/amdsmi/tests/amd_smi_test/functional/process_info_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/process_info_read.cc index 181b36cb90..18bb30d258 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/process_info_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/process_info_read.cc @@ -104,7 +104,7 @@ void TestProcInfoRead::Run(void) { uint32_t num_devices = num_monitor_devs(); - err = amdsmi_get_compute_process_info(nullptr, &num_proc_found); + err = amdsmi_get_gpu_compute_process_info(nullptr, &num_proc_found); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { @@ -129,7 +129,7 @@ void TestProcInfoRead::Run(void) { procs = new amdsmi_process_info_t[num_proc_found]; val_ui32 = num_proc_found; - err = amdsmi_get_compute_process_info(procs, &val_ui32); + err = amdsmi_get_gpu_compute_process_info(procs, &val_ui32); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_INSUFFICIENT_SIZE) { IF_VERB(STANDARD) { @@ -162,7 +162,7 @@ void TestProcInfoRead::Run(void) { uint32_t amt_allocd = num_devices; for (uint32_t j = 0; j < num_proc_found; j++) { - err = amdsmi_get_compute_process_gpus(procs[j].process_id, dev_inds, + err = amdsmi_get_gpu_compute_process_gpus(procs[j].process_id, dev_inds, &amt_allocd); if (err == AMDSMI_STATUS_NOT_FOUND) { std::cout << "\t** Process " << procs[j].process_id << @@ -191,13 +191,13 @@ void TestProcInfoRead::Run(void) { amdsmi_process_info_t proc_info; for (uint32_t j = 0; j < num_proc_found; j++) { memset(&proc_info, 0x0, sizeof(amdsmi_process_info_t)); - err = amdsmi_get_compute_process_info_by_pid(procs[j].process_id, + err = amdsmi_get_gpu_compute_process_info_by_pid(procs[j].process_id, &proc_info); if (err == AMDSMI_STATUS_NOT_FOUND) { std::cout << - "\t** WARNING: amdsmi_get_compute_process_info() found process " << + "\t** WARNING: amdsmi_get_gpu_compute_process_info() found process " << procs[j].process_id << ", but subsequently, " - "amdsmi_get_compute_process_info_by_pid() did not" + "amdsmi_get_gpu_compute_process_info_by_pid() did not" " find this same process." << std::endl; } else { CHK_ERR_ASRT(err) @@ -217,10 +217,10 @@ void TestProcInfoRead::Run(void) { if (num_proc_found > 1) { amdsmi_process_info_t tmp_proc; val_ui32 = 1; - err = amdsmi_get_compute_process_info(&tmp_proc, &val_ui32); + err = amdsmi_get_gpu_compute_process_info(&tmp_proc, &val_ui32); if (err != AMDSMI_STATUS_INSUFFICIENT_SIZE) { - std::cout << "Expected amdsmi_get_compute_process_info() to tell us" + std::cout << "Expected amdsmi_get_gpu_compute_process_info() to tell us" " there are more processes available, but instead go return code " << err << std::endl; } diff --git a/projects/amdsmi/tests/amd_smi_test/functional/sys_info_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/sys_info_read.cc index 3bc9be8c7b..334b30e79a 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/sys_info_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/sys_info_read.cc @@ -100,10 +100,10 @@ void TestSysInfoRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); amdsmi_vbios_info_t info; - err = amdsmi_get_vbios_info(device_handles_[i], &info); + err = amdsmi_get_gpu_vbios_info(processor_handles_[i], &info); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_FILE_ERROR) { @@ -112,11 +112,11 @@ void TestSysInfoRead::Run(void) { << std::endl; } // Verify api support checking functionality is working - err = amdsmi_get_vbios_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_vbios_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { // Verify api support checking functionality is working - err = amdsmi_get_vbios_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_vbios_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); CHK_ERR_ASRT(err) @@ -124,40 +124,40 @@ void TestSysInfoRead::Run(void) { } else { IF_VERB(STANDARD) { std::cout << "\t**VBIOS Version: " - << info.vbios_version_string << std::endl; + << info.version << std::endl; } } - err = amdsmi_dev_get_pci_id(device_handles_[i], &val_ui64); + err = amdsmi_get_gpu_pci_id(processor_handles_[i], &val_ui64); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64; std::cout << " (" << std::dec << val_ui64 << ")" << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_pci_id(device_handles_[i], nullptr); + err = amdsmi_get_gpu_pci_id(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); - err = amdsmi_topo_get_numa_affinity(device_handles_[i], &val_ui32); + err = amdsmi_get_gpu_topo_numa_affinity(processor_handles_[i], &val_ui32); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**NUMA NODE: 0x" << std::hex << val_ui32; std::cout << " (" << std::dec << val_ui32 << ")" << std::endl; } // Verify api support checking functionality is working - err = amdsmi_topo_get_numa_affinity(device_handles_[i], nullptr); + err = amdsmi_get_gpu_topo_numa_affinity(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); // vendor_id, unique_id amdsmi_asic_info_t asci_info; - err = amdsmi_get_asic_info(device_handles_[0], &asci_info); + err = amdsmi_get_gpu_asic_info(processor_handles_[0], &asci_info); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**amdsmi_dev_unique_id() is not supported" " on this machine" << std::endl; // Verify api support checking functionality is working - err = amdsmi_get_asic_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_asic_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { if (err == AMDSMI_STATUS_SUCCESS) { @@ -169,7 +169,7 @@ void TestSysInfoRead::Run(void) { */ } // Verify api support checking functionality is working - err = amdsmi_get_asic_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_asic_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } else { std::cout << "amdsmi_dev_unique_id_get() failed with error " << @@ -190,11 +190,11 @@ void TestSysInfoRead::Run(void) { std::cout << std::setbase(10); amdsmi_fw_info_t fw_info; - err = amdsmi_get_fw_info(device_handles_[i], &fw_info); + err = amdsmi_get_fw_info(processor_handles_[i], &fw_info); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**No FW " << " available on this system" << std::endl; - err = amdsmi_get_fw_info(device_handles_[i], nullptr); + err = amdsmi_get_fw_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) diff --git a/projects/amdsmi/tests/amd_smi_test/functional/temp_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/temp_read.cc index 7ddd429c71..e9c337ac1b 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/temp_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/temp_read.cc @@ -110,11 +110,11 @@ void TestTempRead::Run(void) { uint32_t type; for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); auto print_temp_metric = [&](amdsmi_temperature_metric_t met, std::string label) { - err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast(type), met, &val_i64); + err = amdsmi_get_temp_metric(processor_handles_[i], static_cast(type), met, &val_i64); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { @@ -124,7 +124,7 @@ void TestTempRead::Run(void) { } // Verify api support checking functionality is working - err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast(type), met, nullptr); + err = amdsmi_get_temp_metric(processor_handles_[i], static_cast(type), met, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); return; } else { @@ -132,7 +132,7 @@ void TestTempRead::Run(void) { } } // Verify api support checking functionality is working - err = amdsmi_dev_get_temp_metric(device_handles_[i], static_cast(type), met, nullptr); + err = amdsmi_get_temp_metric(processor_handles_[i], static_cast(type), met, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); IF_VERB(STANDARD) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc index a0c18ee7ba..9796115dd7 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/volt_freq_curv_read.cc @@ -155,22 +155,22 @@ void TestVoltCurvRead::Run(void) { } for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); - err = amdsmi_dev_get_od_volt_info(device_handles_[i], &odv); + err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { std::cout << - "\t** amdsmi_dev_get_od_volt_info: Not supported on this machine" + "\t** amdsmi_get_gpu_od_volt_info: Not supported on this machine" << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_get_od_volt_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); } else { CHK_ERR_ASRT(err) // Verify api support checking functionality is working - err = amdsmi_dev_get_od_volt_info(device_handles_[i], nullptr); + err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } @@ -184,7 +184,7 @@ void TestVoltCurvRead::Run(void) { ASSERT_TRUE(regions != nullptr); num_regions = odv.num_regions; - err = amdsmi_dev_get_od_volt_curve_regions(device_handles_[i], &num_regions, regions); + err = amdsmi_get_gpu_od_volt_curve_regions(processor_handles_[i], &num_regions, regions); CHK_ERR_ASRT(err) ASSERT_TRUE(num_regions == odv.num_regions); diff --git a/projects/amdsmi/tests/amd_smi_test/functional/volt_read.cc b/projects/amdsmi/tests/amd_smi_test/functional/volt_read.cc index 961115d816..62a0c2b6b4 100644 --- a/projects/amdsmi/tests/amd_smi_test/functional/volt_read.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/volt_read.cc @@ -100,11 +100,11 @@ void TestVoltRead::Run(void) { amdsmi_voltage_type_t type = AMDSMI_VOLT_TYPE_VDDGFX; for (uint32_t i = 0; i < num_monitor_devs(); ++i) { - PrintDeviceHeader(device_handles_[i]); + PrintDeviceHeader(processor_handles_[i]); auto print_volt_metric = [&](amdsmi_voltage_metric_t met, std::string label) { - err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, &val_i64); + err = amdsmi_get_gpu_volt_metric(processor_handles_[i], type, met, &val_i64); if (err != AMDSMI_STATUS_SUCCESS) { if (err == AMDSMI_STATUS_NOT_SUPPORTED) { @@ -113,7 +113,7 @@ void TestVoltRead::Run(void) { "Not supported on this machine" << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, nullptr); + err = amdsmi_get_gpu_volt_metric(processor_handles_[i], type, met, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); return; } @@ -122,7 +122,7 @@ void TestVoltRead::Run(void) { } } // Verify api support checking functionality is working - err = amdsmi_dev_get_volt_metric(device_handles_[i], type, met, nullptr); + err = amdsmi_get_gpu_volt_metric(processor_handles_[i], type, met, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); IF_VERB(STANDARD) { diff --git a/projects/amdsmi/tests/amd_smi_test/functional/xgmi_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/xgmi_read_write.cc index 2a8f391e35..756e793db3 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/xgmi_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/xgmi_read_write.cc @@ -98,7 +98,7 @@ void TestXGMIReadWrite::Run(void) { } for (uint32_t dv_ind = 0; dv_ind < num_monitor_devs(); ++dv_ind) { - auto device = device_handles_[dv_ind]; + auto device = processor_handles_[dv_ind]; PrintDeviceHeader(device); amdsmi_xgmi_info_t info; @@ -116,7 +116,7 @@ void TestXGMIReadWrite::Run(void) { } } - err = amdsmi_dev_xgmi_error_status(device, &err_stat); + err = amdsmi_gpu_xgmi_error_status(device, &err_stat); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { IF_VERB(STANDARD) { @@ -124,7 +124,7 @@ void TestXGMIReadWrite::Run(void) { << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_xgmi_error_status(device, nullptr); + err = amdsmi_gpu_xgmi_error_status(device, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED); continue; @@ -135,12 +135,12 @@ void TestXGMIReadWrite::Run(void) { static_cast(err_stat) << std::endl; } // Verify api support checking functionality is working - err = amdsmi_dev_xgmi_error_status(device, nullptr); + err = amdsmi_gpu_xgmi_error_status(device, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); // TODO(cfree) We need to find a way to generate xgmi errors so this // test won't be meaningless - err = amdsmi_dev_reset_xgmi_error(device); + err = amdsmi_reset_gpu_xgmi_error(device); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Successfully reset XGMI Error Status: " << std::endl; diff --git a/projects/amdsmi/tests/amd_smi_test/test_base.cc b/projects/amdsmi/tests/amd_smi_test/test_base.cc index 2ae7662076..b83f6a7a96 100644 --- a/projects/amdsmi/tests/amd_smi_test/test_base.cc +++ b/projects/amdsmi/tests/amd_smi_test/test_base.cc @@ -124,16 +124,16 @@ void TestBase::SetUp(uint64_t init_flags) { for (uint32_t i=0; i < socket_count_; i++) { // Get all devices of the socket uint32_t device_count = 0; - err = amdsmi_get_device_handles(sockets_[i], + err = amdsmi_get_processor_handles(sockets_[i], &device_count, nullptr); if (err != AMDSMI_STATUS_SUCCESS) { setup_failed_ = true; } ASSERT_EQ(err, AMDSMI_STATUS_SUCCESS); - std::vector device_handles(device_count); - err = amdsmi_get_device_handles(sockets_[i], - &device_count, &device_handles[0]); + std::vector processor_handles(device_count); + err = amdsmi_get_processor_handles(sockets_[i], + &device_count, &processor_handles[0]); if (err != AMDSMI_STATUS_SUCCESS) { setup_failed_ = true; } @@ -144,7 +144,7 @@ void TestBase::SetUp(uint64_t init_flags) { setup_failed_ = true; ASSERT_EQ(AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS, AMDSMI_STATUS_SUCCESS); } - device_handles_[num_monitor_devs_] = device_handles[j]; + processor_handles_[num_monitor_devs_] = processor_handles[j]; num_monitor_devs_++; } } @@ -159,7 +159,7 @@ void TestBase::SetUp(uint64_t init_flags) { return; } -void TestBase::PrintDeviceHeader(amdsmi_device_handle dv_ind) { +void TestBase::PrintDeviceHeader(amdsmi_processor_handle dv_ind) { amdsmi_status_t err; uint16_t val_ui16; amdsmi_asic_info_t info; @@ -167,19 +167,19 @@ void TestBase::PrintDeviceHeader(amdsmi_device_handle dv_ind) { IF_VERB(STANDARD) { std::cout << "\t**Device handle: " << dv_ind << std::endl; } - err = amdsmi_dev_get_id(dv_ind, &val_ui16); + err = amdsmi_get_gpu_id(dv_ind, &val_ui16); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << std::endl; } amdsmi_board_info_t board_info; - err = amdsmi_get_board_info(dv_ind, &board_info); + err = amdsmi_get_gpu_board_info(dv_ind, &board_info); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Device name: " << board_info.product_name << std::endl; - err = amdsmi_get_asic_info(dv_ind, &info); + err = amdsmi_get_gpu_asic_info(dv_ind, &info); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Device Vendor ID: 0x" << std::hex << @@ -187,7 +187,7 @@ void TestBase::PrintDeviceHeader(amdsmi_device_handle dv_ind) { } } - err = amdsmi_dev_get_subsystem_id(dv_ind, &val_ui16); + err = amdsmi_get_gpu_subsystem_id(dv_ind, &val_ui16); CHK_ERR_ASRT(err) IF_VERB(STANDARD) { std::cout << "\t**Subsystem ID: 0x" << std::hex << val_ui16 << std::endl; diff --git a/projects/amdsmi/tests/amd_smi_test/test_base.h b/projects/amdsmi/tests/amd_smi_test/test_base.h index 9d98ccb628..104e450db4 100644 --- a/projects/amdsmi/tests/amd_smi_test/test_base.h +++ b/projects/amdsmi/tests/amd_smi_test/test_base.h @@ -121,11 +121,11 @@ class TestBase { protected: void MakeHeaderStr(const char *inStr, std::string *outStr) const; - void PrintDeviceHeader(amdsmi_device_handle dv_ind); + void PrintDeviceHeader(amdsmi_processor_handle dv_ind); bool setup_failed_; ///< Record that setup failed to return ierr in Run uint32_t num_monitor_devs_; ///< Number of monitor devices found ///< device handles - amdsmi_device_handle device_handles_[MAX_MONITOR_DEVICES]; + amdsmi_processor_handle processor_handles_[MAX_MONITOR_DEVICES]; uint32_t socket_count_; ///< socket count std::vector sockets_; ///< sockets diff --git a/projects/amdsmi/tools/generator.py b/projects/amdsmi/tools/generator.py index 1e9d8aa588..d3771512d4 100644 --- a/projects/amdsmi/tools/generator.py +++ b/projects/amdsmi/tools/generator.py @@ -106,17 +106,17 @@ def main(): library_path = os.path.join(os.path.dirname(__file__), library) line_to_replace = "_libraries['{}'] = ctypes.CDLL('{}')".format(library_name, library_path) new_line = f"""from pathlib import Path -libamd_smi_optrocm = Path(__file__).parents[3] / "/lib/{library_name}" libamd_smi_cpack = Path("@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/{library_name}") +libamd_smi_optrocm = Path("/opt/rocm/lib/{library_name}") libamd_smi_parent_dir = Path(__file__).resolve().parent / "{library_name}" libamd_smi_cwd = Path.cwd() / "{library_name}" -if libamd_smi_optrocm.is_file(): - # try /opt/rocm/lib as a fallback - _libraries['{library_name}'] = ctypes.CDLL(libamd_smi_optrocm) -elif libamd_smi_cpack.is_file(): +if libamd_smi_cpack.is_file(): # try to find library in install directory provided by CMake _libraries['{library_name}'] = ctypes.CDLL(libamd_smi_cpack) +elif libamd_smi_optrocm.is_file(): + # try /opt/rocm/lib as a fallback + _libraries['{library_name}'] = ctypes.CDLL(libamd_smi_optrocm) elif libamd_smi_parent_dir.is_file(): # try to fall back to parent directory _libraries['{library_name}'] = ctypes.CDLL(libamd_smi_parent_dir)