[SWDEV-535200] Remove deprecated function amdsmi_get_power_info_v2 (#397)

Signed-off-by: josnarlo <Joseph.Narlo@amd.com>
Signed-off-by: Narlo, Joseph <Joseph.Narlo@amd.com>
Tento commit je obsažen v:
Narlo, Joseph
2025-05-28 18:09:13 -05:00
odevzdal GitHub
rodič 7b3c85e970
revize 38a1fadf44
7 změnil soubory, kde provedl 11 přidání a 100 odebrání
+6
Zobrazit soubor
@@ -12,6 +12,12 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
### Changed
- N/A
### Removed
- **Removed `amdsmi_get_power_info_v2()` **.
- The amdsmi_get_power_info() has been unified and the v2 function is no longer needed/used.
- **Updated `amdsmi_bdf_t` in `amdsmi.h`.**
- The `amdsmi_bdf_t` union was changed to have an identical unnamed struct for backwards compatiblity
- **The `amdsmi_get_gpu_vram_info` command gets the vendor name from the driver instead of using an emun to identify vendor.**
-21
Zobrazit soubor
@@ -6215,27 +6215,6 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios
amdsmi_status_t
amdsmi_get_gpu_activity(amdsmi_processor_handle processor_handle, amdsmi_engine_usage_t *info);
/**
* @brief Returns the current power and voltage of the GPU.
*
* @ingroup tagGPUMonitor
*
* @platform{gpu_bm_linux} @platform{guest_windows}
*
* @note amdsmi_power_info_t::socket_power metric can rarely spike above the socket power limit in some cases
*
* @param[in] processor_handle PF of a processor for which to query
*
* @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
* If a processor has more than one sensor, it could be greater than 0.
* Parameter @p sensor_ind is unused on @platform{host}.
*
* @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_info_v2(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_info_t *info);
/**
* @brief Returns the current power and voltage of the GPU.
*
+3 -6
Zobrazit soubor
@@ -2651,11 +2651,8 @@ def amdsmi_get_gpu_driver_info(
return driver_info
# NOTE: this uses amdsmi_get_power_info_v2 under the hood because the C api
# needs to be backwards compatible
def amdsmi_get_power_info(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
sensor_ind: int = 0
processor_handle: amdsmi_wrapper.amdsmi_processor_handle
) -> Dict[str, ctypes.c_uint32]:
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
raise AmdSmiParameterException(
@@ -2664,8 +2661,8 @@ def amdsmi_get_power_info(
power_measure = amdsmi_wrapper.amdsmi_power_info_t()
_check_res(
amdsmi_wrapper.amdsmi_get_power_info_v2(
processor_handle, sensor_ind, ctypes.byref(power_measure)
amdsmi_wrapper.amdsmi_get_power_info(
processor_handle, ctypes.byref(power_measure)
)
)
+1 -4
Zobrazit soubor
@@ -2814,9 +2814,6 @@ amdsmi_get_gpu_vbios_info.argtypes = [amdsmi_processor_handle, ctypes.POINTER(st
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_processor_handle, ctypes.POINTER(struct_amdsmi_engine_usage_t)]
amdsmi_get_power_info_v2 = _libraries['libamd_smi.so'].amdsmi_get_power_info_v2
amdsmi_get_power_info_v2.restype = amdsmi_status_t
amdsmi_get_power_info_v2.argtypes = [amdsmi_processor_handle, uint32_t, ctypes.POINTER(struct_amdsmi_power_info_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_amdsmi_power_info_t)]
@@ -3287,7 +3284,7 @@ __all__ = \
'amdsmi_get_link_metrics', 'amdsmi_get_link_topology_nearest',
'amdsmi_get_minmax_bandwidth_between_processors',
'amdsmi_get_pcie_info', 'amdsmi_get_power_cap_info',
'amdsmi_get_power_info', 'amdsmi_get_power_info_v2',
'amdsmi_get_power_info',
'amdsmi_get_processor_count_from_handles',
'amdsmi_get_processor_handle_from_bdf',
'amdsmi_get_processor_handles',
-54
Zobrazit soubor
@@ -5747,60 +5747,6 @@ pub fn amdsmi_get_gpu_activity(
Ok(info)
}
/// Get the power information for the device with the specified processor handle.
///
/// Given a processor handle `processor_handle`, this function retrieves the power information
/// for the specified processor.
///
/// # Arguments
///
/// * `processor_handle` - A handle to the processor for which the power information is being queried.
///
/// # Returns
///
/// * `AmdsmiResult<AmdsmiPowerInfoT>` - Returns `Ok(AmdsmiPowerInfoT)` containing the [`AmdsmiPowerInfoT`] if successful, or an error if it fails.
///
/// # Example
///
/// ```rust
/// # use amdsmi::*;
/// #
/// # fn main() {
/// # // Initialize the AMD SMI library
/// # amdsmi_init(AmdsmiInitFlagsT::AmdsmiInitAmdGpus).expect("Failed to initialize AMD SMI");
/// #
/// // Example processor_handle, assuming the number of processors is greater than zero
/// let processor_handle = amdsmi_get_processor_handles!()[0];
/// let sensor_ind = 0
///
/// // Retrieve the power information
/// match amdsmi_get_power_info_v2(processor_handle, sensor_ind) {
/// Ok(info) => println!("Power information: {:?}", info),
/// Err(e) => panic!("Failed to get power information: {}", e),
/// }
/// #
/// # // Shut down the AMD SMI library
/// # amdsmi_shut_down().expect("Failed to shut down AMD SMI");
/// # }
/// ```
///
/// # Errors
///
/// This function will return the error in [`AmdsmiStatusT`] if the underlying `amdsmi_wrapper::amdsmi_get_power_info_v2` call fails.
pub fn amdsmi_get_power_info_v2(
processor_handle: AmdsmiProcessorHandle,
sensor_ind: u32,
) -> AmdsmiResult<AmdsmiPowerInfoT> {
let mut info = MaybeUninit::<AmdsmiPowerInfoT>::uninit();
call_unsafe!(amdsmi_wrapper::amdsmi_get_power_info_v2(
processor_handle,
sensor_ind,
info.as_mut_ptr()
));
let info = unsafe { info.assume_init() };
Ok(info)
}
/// Get the power information for the device with the specified processor handle.
///
/// Given a processor handle `processor_handle`, this function retrieves the power information
-7
Zobrazit soubor
@@ -3023,13 +3023,6 @@ extern "C" {
info: *mut AmdsmiEngineUsageT,
) -> AmdsmiStatusT;
}
extern "C" {
pub fn amdsmi_get_power_info_v2(
processor_handle: AmdsmiProcessorHandle,
sensor_ind: u32,
info: *mut AmdsmiPowerInfoT,
) -> AmdsmiStatusT;
}
extern "C" {
pub fn amdsmi_get_power_info(
processor_handle: AmdsmiProcessorHandle,
+1 -8
Zobrazit soubor
@@ -4038,10 +4038,8 @@ amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, uint32_t *
return (max_processes_original_size >= static_cast<uint32_t>(compute_process_list.size()))
? AMDSMI_STATUS_SUCCESS : amdsmi_status_t::AMDSMI_STATUS_OUT_OF_RESOURCES;
}
amdsmi_status_t
amdsmi_get_power_info_v2(amdsmi_processor_handle processor_handle, __attribute__((unused)) uint32_t sensor_ind, amdsmi_power_info_t *info) {
amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_info_t *info) {
AMDSMI_CHECK_INIT();
if (info == nullptr) {
@@ -4080,11 +4078,6 @@ amdsmi_get_power_info_v2(amdsmi_processor_handle processor_handle, __attribute__
return status;
}
amdsmi_status_t
amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_info_t *info) {
return amdsmi_get_power_info_v2(processor_handle, 0, info);
}
amdsmi_status_t amdsmi_get_gpu_driver_info(amdsmi_processor_handle processor_handle,
amdsmi_driver_info_t *info) {
AMDSMI_CHECK_INIT();