Implement CPU discovery support (#77)

* Implement CPU discovery support

SWDEV-482949:

enable the CPU model name info support to the RDC, rdci command
can detect GPU and CPU modules at the same time.
It will query the CPU info through the amdsmi interface like below:

1 GPUs found.
-----------------------------------------------------------------
GPU Index        Device Information
0               AMD Radeon PRO W7800
=================================================================
1 CPUs found.
-----------------------------------------------------------------
CPU Index        Device Information
0               AMD Ryzen Threadripper PRO 7995WX 96-Cores
-----------------------------------------------------------------

Change-Id: Ibc6533c9a61000cd86c45b1bae14c3eb6788c119
Signed-off-by: Perry Yuan <perry.yuan@amd.com>

* CMAKE - Add required version for amdsmi

Change-Id: I341a89351d196ec66cce215a5d1d3953302fcc66
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>

---------

Signed-off-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Co-authored-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
This commit is contained in:
Yuan, PerryandGalantsev, Dmitrii authored and GitHub committed 2025-03-31 10:58:36 +08:00
1 parent 80ee980cdb
commit 3bdca8b8b6
16 files changed
+365 -5

No files matched your search

+51
View File
@@ -410,6 +410,21 @@ typedef enum {
RDC_HEALTH_EEPROM_CONFIG_VALID, //!< Reads the EEPROM and verifies the checksums
RDC_HEALTH_POWER_THROTTLE_TIME, //!< Power throttle status counter
RDC_HEALTH_THERMAL_THROTTLE_TIME, //!< Total time in thermal throttle status (microseconds)
/**
* @brief RDC CPU related fields
*/
RDC_FI_DEV_CPU_UTIL_TOTAL = 10001, //!< CPU total percentage of time in use
RDC_FI_DEV_CPU_UTIL_USER, //!< The percentage of time in use by the user
RDC_FI_DEV_CPU_UTIL_NICE, //!< The percentage of time in use by low priority (high nice score) programs
RDC_FI_DEV_CPU_UTIL_SYS, //!< The percentage of time in use by the system
RDC_FI_DEV_CPU_UTIL_IRQ, //!< The percentage of time in use by interrupts
RDC_FI_DEV_CPU_TEMP_CURRENT, //!< Instantaneous temperature (Celsius)
RDC_FI_DEV_CPU_CLOCK_CURRENT, //!< Instantaneous clock speed (KHz)
RDC_FI_DEV_CPU_POWER_UTIL_CURRENT, //!< Instantaneous power usage (watts)
RDC_FI_DEV_CPU_POWER_LIMIT, //!< Instantaneous power limit (watts)
RDC_FI_DEV_CPU_VENDOR, //!< The name of the vendor
RDC_FI_DEV_CPU_MODEL, //!< The name of the model
RDC_FI_DEV_CPU_COUNT,
} rdc_field_t;
// even and odd numbers are used for correctable and uncorrectable errors
@@ -1041,6 +1056,25 @@ rdc_status_t rdc_field_update_all(rdc_handle_t p_rdc_handle, uint32_t wait_for_u
rdc_status_t rdc_device_get_all(rdc_handle_t p_rdc_handle,
uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES], uint32_t* count);
/**
* @brief Get indexes corresponding to all the devices on the system.
*
* @details Indexes represents RDC CPU Id corresponding to each CPU on the
* system and is immutable during the lifespan of the engine. The list
* should be queried again if the engine is restarted.
*
* @param[in] p_rdc_handle The RDC handler.
*
* @param[out] cpu_index_list Array reference to fill CPU indexes present on
* the system.
*
* @param[out] count Number of CPUs returned in cpu_index_list.
*
* @retval ::RDC_ST_OK is returned upon successful call.
*/
rdc_status_t rdc_device_get_all_cpu(rdc_handle_t p_rdc_handle,
uint32_t cpu_index_list[RDC_MAX_NUM_DEVICES], uint32_t* count);
/**
* @brief Gets device attributes corresponding to the gpu_index.
*
@@ -1058,6 +1092,23 @@ rdc_status_t rdc_device_get_all(rdc_handle_t p_rdc_handle,
rdc_status_t rdc_device_get_attributes(rdc_handle_t p_rdc_handle, uint32_t gpu_index,
rdc_device_attributes_t* p_rdc_attr);
/**
* @brief Gets device attributes corresponding to the cpu_index.
*
* @details Fetch the attributes, such as device name, of a CPU.
*
* @param[in] p_rdc_handle The RDC handler.
*
* @param[in] cpu_index CPU index corresponding to which the attributes
* should be fetched
*
* @param[out] p_rdc_attr CPU attribute corresponding to the cpu_index.
*
* @retval ::RDC_ST_OK is returned upon successful call.
*/
rdc_status_t rdc_device_get_cpu_attributes(rdc_handle_t p_rdc_handle, uint32_t cpu_index,
rdc_device_attributes_t* p_rdc_attr);
/**
* @brief Get version information of components used by rdc.
*