diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d4cb0d0a6..21f39b4532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,18 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr ### Changed +- N/A + +### Removed + +- **Removed unused definition `AMDSMI_MAX_NAME`** +- **Removed unused definition `AMDSMI_256_LENGTH`** +- **Removed unused definition `AMDSMI_MAX_DATE_LENGTH`** +- **Removed unused definition `MAX_AMDSMI_NAME_LENGTH`** +- **Removed unused definition `AMDSMI_LIB_VERSION_YEAR`** +- **Removed unused definition `AMDSMI_DEFAULT_VARIANT`** +- **Removed unused definition `AMDSMI_MAX_NUM_POWER_PROFILES`** +- **Removed unused member `year` in struct `amdsmi_version_t`** - **Updated `amdsmi_get_gpu_asic_info` in `amdsmi.h`.** - Added `subsystem_id` structure member. - **Removed `amdsmi_io_link_type_t` and replaced with amdsmi_link_type_t**. diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index cc5b382ec6..f4fec058f9 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -60,7 +60,6 @@ typedef enum { * @cond @tag{gpu_bm_linux} @tag{host} @tag{guest_windows} @endcond */ #define AMDSMI_MAX_MM_IP_COUNT 8 -#define AMDSMI_MAX_DATE_LENGTH 32 //!< YYYY-MM-DD:HH:MM:SS.MSC #define AMDSMI_MAX_STRING_LENGTH 256 #define AMDSMI_MAX_DEVICES 32 #define AMDSMI_MAX_DRIVER_VERSION_LENGTH 80 @@ -77,10 +76,8 @@ typedef enum { * * @cond @tag{gpu_bm_linux} @endcond */ -#define AMDSMI_MAX_NAME 32 #define AMDSMI_MAX_NUM_XGMI_PHYSICAL_LINK 64 #define AMDSMI_MAX_CONTAINER_TYPE 2 -#define AMDSMI_256_LENGTH AMDSMI_MAX_STRING_LENGTH //!< Deprecated /** * @brief The following structure holds the gpu metrics values for a device. @@ -197,9 +194,6 @@ typedef enum { * @cond @tag{gpu_bm_linux} @endcond */ -//! Year should follow the IP driver package version: 22.40/23.10 and similar -#define AMDSMI_LIB_VERSION_YEAR 25 //!< To Be Deprecated - //! Major version should be changed for every header change that breaks ABI //! Such as adding/deleting APIs, changing names, fields of structures, etc. #define AMDSMI_LIB_VERSION_MAJOR 25 @@ -1568,13 +1562,6 @@ typedef struct { amdsmi_memory_page_status_t status; //!< Page "reserved" status } amdsmi_retired_page_record_t; -/** - * @brief Number of possible power profiles that a system could support - * - * @cond @tag{gpu_bm_linux} @endcond - */ -#define AMDSMI_MAX_NUM_POWER_PROFILES (sizeof(amdsmi_bit_field_t) * 8) - /** * @brief This structure contains information about which power profiles are * supported by the system for a given device, and which power profile is @@ -1646,7 +1633,6 @@ typedef struct { * @cond @tag{gpu_bm_linux} @endcond */ typedef struct { - uint32_t year; //!< Last 2 digits of the Year released - To Be Deprecated uint32_t major; //!< Major version uint32_t minor; //!< Minor version uint32_t release; //!< Patch, build or stepping version @@ -1968,8 +1954,6 @@ typedef struct { uint64_t reserved[7]; } amdsmi_xgmi_link_status_t; -#define MAX_AMDSMI_NAME_LENGTH 64 - /** * @brief This structure holds the name value pairs * @@ -2068,9 +2052,6 @@ typedef enum { AMDSMI_AFFINITY_SCOPE_SOCKET = 1 // socket affinity } amdsmi_affinity_scope_t; - -#define AMDSMI_DEFAULT_VARIANT 0xFFFFFFFFFFFFFFFF - #ifdef ENABLE_ESMI_LIB /** diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index 50ad5fbb19..7462be6a93 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -77,17 +77,13 @@ AMDSMI_NUM_VOLTAGE_CURVE_POINTS = 3 # Max size definitions AMDSMI_MAX_MM_IP_COUNT = 8 -AMDSMI_MAX_DATE_LENGTH = 32 AMDSMI_MAX_STRING_LENGTH = 256 AMDSMI_MAX_DEVICES = 32 -AMDSMI_MAX_NAME = 32 AMDSMI_MAX_DRIVER_VERSION_LENGTH = 80 -AMDSMI_256_LENGTH = 256 AMDSMI_MAX_CONTAINER_TYPE = 2 AMDSMI_MAX_CACHE_TYPES = 10 AMDSMI_MAX_NUM_XGMI_PHYSICAL_LINK = 64 AMDSMI_GPU_UUID_SIZE = 38 -MAX_AMDSMI_NAME_LENGTH = 64 _AMDSMI_STRING_LENGTH = 80 diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index a89cabe36f..7efba50371 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -1835,10 +1835,10 @@ class struct_amdsmi_version_t(Structure): struct_amdsmi_version_t._pack_ = 1 # source:False struct_amdsmi_version_t._fields_ = [ - ('year', ctypes.c_uint32), ('major', ctypes.c_uint32), ('minor', ctypes.c_uint32), ('release', ctypes.c_uint32), + ('PADDING_0', ctypes.c_ubyte * 4), ('build', ctypes.POINTER(ctypes.c_char)), ] diff --git a/rust-interface/src/amdsmi.rs b/rust-interface/src/amdsmi.rs index a982268f1b..c652009fc9 100644 --- a/rust-interface/src/amdsmi.rs +++ b/rust-interface/src/amdsmi.rs @@ -193,7 +193,7 @@ pub fn amdsmi_get_socket_handles() -> AmdsmiResult> { /// /// This function will return the error in [`AmdsmiStatusT`] if the underlying `amdsmi_wrapper::amdsmi_get_socket_info` call fails. pub fn amdsmi_get_socket_info(socket_handle: AmdsmiSocketHandle) -> AmdsmiResult { - let (mut info, len) = define_cstr!(amdsmi_wrapper::AMDSMI_256_LENGTH); + let (mut info, len) = define_cstr!(amdsmi_wrapper::AMDSMI_MAX_STRING_LENGTH); call_unsafe!(amdsmi_wrapper::amdsmi_get_socket_info( socket_handle, len, @@ -4776,7 +4776,7 @@ pub fn amdsmi_topo_get_p2p_status( pub fn amdsmi_get_gpu_compute_partition( processor_handle: AmdsmiProcessorHandle, ) -> AmdsmiResult { - let (mut compute_partition, len) = define_cstr!(amdsmi_wrapper::AMDSMI_256_LENGTH); + let (mut compute_partition, len) = define_cstr!(amdsmi_wrapper::AMDSMI_MAX_STRING_LENGTH); call_unsafe!(amdsmi_wrapper::amdsmi_get_gpu_compute_partition( processor_handle, compute_partition.as_mut_ptr(), @@ -4884,7 +4884,7 @@ pub fn amdsmi_set_gpu_compute_partition( pub fn amdsmi_get_gpu_memory_partition( processor_handle: AmdsmiProcessorHandle, ) -> AmdsmiResult { - let (mut memory_partition, len) = define_cstr!(amdsmi_wrapper::AMDSMI_256_LENGTH); + let (mut memory_partition, len) = define_cstr!(amdsmi_wrapper::AMDSMI_MAX_STRING_LENGTH); call_unsafe!(amdsmi_wrapper::amdsmi_get_gpu_memory_partition( processor_handle, memory_partition.as_mut_ptr(), diff --git a/rust-interface/src/amdsmi_wrapper.rs b/rust-interface/src/amdsmi_wrapper.rs index 719e45164f..86680dea7f 100644 --- a/rust-interface/src/amdsmi_wrapper.rs +++ b/rust-interface/src/amdsmi_wrapper.rs @@ -102,11 +102,8 @@ where } } pub const AMDSMI_MAX_MM_IP_COUNT: u32 = 8; -pub const AMDSMI_MAX_DATE_LENGTH: u32 = 32; pub const AMDSMI_MAX_STRING_LENGTH: u32 = 256; -pub const AMDSMI_256_LENGTH: u32 = 256; pub const AMDSMI_MAX_DEVICES: u32 = 32; -pub const AMDSMI_MAX_NAME: u32 = 32; pub const AMDSMI_MAX_DRIVER_VERSION_LENGTH: u32 = 80; pub const AMDSMI_MAX_CONTAINER_TYPE: u32 = 2; pub const AMDSMI_MAX_CACHE_TYPES: u32 = 10; @@ -127,7 +124,6 @@ pub const AMDSMI_MAX_NUM_XCC: u32 = 8; pub const AMDSMI_MAX_NUM_XCP: u32 = 8; pub const AMDSMI_TIME_FORMAT: &[u8; 20] = b"%02d:%02d:%02d.%03d\0"; pub const AMDSMI_DATE_FORMAT: &[u8; 35] = b"%04d-%02d-%02d:%02d:%02d:%02d.%03d\0"; -pub const AMDSMI_LIB_VERSION_YEAR: u32 = 25; pub const AMDSMI_LIB_VERSION_MAJOR: u32 = 25; pub const AMDSMI_LIB_VERSION_MINOR: u32 = 4; pub const AMDSMI_LIB_VERSION_RELEASE: u32 = 2; @@ -136,7 +132,6 @@ pub const AMDSMI_MAX_FAN_SPEED: u32 = 255; pub const AMDSMI_NUM_VOLTAGE_CURVE_POINTS: u32 = 3; pub const AMDSMI_MAX_UTILIZATION_VALUES: u32 = 4; pub const AMDSMI_MAX_NUM_PM_POLICIES: u32 = 32; -pub const AMDSMI_DEFAULT_VARIANT: i32 = -1; #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum AmdsmiInitFlagsT { diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index c4e1f72015..328fb77e8c 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -710,17 +710,17 @@ amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_handle, amdsmi_board } if (board_info->product_name[0] == '\0') { status = rsmi_wrapper(rsmi_dev_name_get, processor_handle, 0, - board_info->product_name, AMDSMI_256_LENGTH); + board_info->product_name, AMDSMI_MAX_STRING_LENGTH); // Check if the value is in hex format if (status == AMDSMI_STATUS_SUCCESS) { if (board_info->product_name[0] == '0' && board_info->product_name[1] == 'x') { memset(board_info->product_name, 0, - AMDSMI_256_LENGTH * sizeof(board_info->product_name[0])); + AMDSMI_MAX_STRING_LENGTH * sizeof(board_info->product_name[0])); } } if (status != AMDSMI_STATUS_SUCCESS) { memset(board_info->product_name, 0, - AMDSMI_256_LENGTH * sizeof(board_info->product_name[0])); + AMDSMI_MAX_STRING_LENGTH * sizeof(board_info->product_name[0])); } } @@ -749,17 +749,17 @@ amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_handle, amdsmi_board if (board_info->product_name[0] == '\0') { status = rsmi_wrapper(rsmi_dev_name_get, processor_handle, 0, board_info->product_name, - AMDSMI_256_LENGTH); + AMDSMI_MAX_STRING_LENGTH); // Check if the value is in hex format if (status == AMDSMI_STATUS_SUCCESS) { if (board_info->product_name[0] == '0' && board_info->product_name[1] == 'x') { memset(board_info->product_name, 0, - AMDSMI_256_LENGTH * sizeof(board_info->product_name[0])); + AMDSMI_MAX_STRING_LENGTH * sizeof(board_info->product_name[0])); } } if (status != AMDSMI_STATUS_SUCCESS) { memset(board_info->product_name, 0, - AMDSMI_256_LENGTH * sizeof(board_info->product_name[0])); + AMDSMI_MAX_STRING_LENGTH * sizeof(board_info->product_name[0])); } ss << __PRETTY_FUNCTION__ << " | [rsmi_correction] board_info->product_name= |" << board_info->product_name << "|"; @@ -1443,7 +1443,7 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i amdsmi_status_t status = smi_amdgpu_get_market_name_from_dev_id(gpu_device, info->market_name); if (status != AMDSMI_STATUS_SUCCESS) { rsmi_wrapper(rsmi_dev_brand_get, processor_handle, 0, - info->market_name, AMDSMI_256_LENGTH); + info->market_name, AMDSMI_MAX_STRING_LENGTH); } std::string render_name = gpu_device->get_gpu_path(); @@ -3546,7 +3546,6 @@ amdsmi_status_t amdsmi_get_lib_version(amdsmi_version_t *version) { if (version == nullptr) return AMDSMI_STATUS_INVAL; - version->year = AMDSMI_LIB_VERSION_YEAR; version->major = AMDSMI_LIB_VERSION_MAJOR; version->minor = AMDSMI_LIB_VERSION_MINOR; version->release = AMDSMI_LIB_VERSION_RELEASE; diff --git a/src/amd_smi/amd_smi_utils.cc b/src/amd_smi/amd_smi_utils.cc index d3b484d6e5..66d33da6d5 100644 --- a/src/amd_smi/amd_smi_utils.cc +++ b/src/amd_smi/amd_smi_utils.cc @@ -659,7 +659,7 @@ amdsmi_status_t smi_amdgpu_get_market_name_from_dev_id(amd::smi::AMDSmiGPUDevice ret = amdgpu_device_initialize(fd, &major_version, &minor_version, &device_handle); if (ret != 0) { std::string empty = ""; - std::strncpy(market_name, empty.c_str(), AMDSMI_256_LENGTH - 1); + std::strncpy(market_name, empty.c_str(), AMDSMI_MAX_STRING_LENGTH - 1); amdgpu_device_deinitialize(device_handle); close(fd); return AMDSMI_STATUS_DRM_ERROR; @@ -668,8 +668,8 @@ amdsmi_status_t smi_amdgpu_get_market_name_from_dev_id(amd::smi::AMDSmiGPUDevice // Get the marketing name using libdrm's API const char *name = amdgpu_get_marketing_name(device_handle); if (name != nullptr) { - std::strncpy(market_name, name, AMDSMI_256_LENGTH - 1); - market_name[AMDSMI_256_LENGTH - 1] = '\0'; + std::strncpy(market_name, name, AMDSMI_MAX_STRING_LENGTH - 1); + market_name[AMDSMI_MAX_STRING_LENGTH - 1] = '\0'; amdgpu_device_deinitialize(device_handle); close(fd); libdrm_amdgpu_.AMDSmiLibraryLoader::unload(); diff --git a/tests/amd_smi_test/functional/sys_info_read.cc b/tests/amd_smi_test/functional/sys_info_read.cc index eac51cce66..aa62721e9e 100644 --- a/tests/amd_smi_test/functional/sys_info_read.cc +++ b/tests/amd_smi_test/functional/sys_info_read.cc @@ -70,7 +70,7 @@ void TestSysInfoRead::Run(void) { amdsmi_status_t err; uint64_t val_ui64; int32_t val_i32; - amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr}; + amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr}; TestBase::Run(); if (setup_failed_) { diff --git a/tests/amd_smi_test/functional/version_read.cc b/tests/amd_smi_test/functional/version_read.cc index 24a429ba09..12a325fa21 100644 --- a/tests/amd_smi_test/functional/version_read.cc +++ b/tests/amd_smi_test/functional/version_read.cc @@ -65,7 +65,7 @@ static const uint32_t kVerMaxStrLen = 80; void TestVersionRead::Run(void) { amdsmi_status_t err; - amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr}; + amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr}; TestBase::Run(); if (setup_failed_) {