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>
このコミットが含まれているのは:
Yuan, Perry
2025-03-31 10:58:36 +08:00
committed by GitHub
コミット 3bdca8b8b6
16個のファイルの変更365行の追加5行の削除
+51
ファイルの表示
@@ -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.
*
+4
ファイルの表示
@@ -43,8 +43,12 @@ class RdcHandler {
// Discovery API
virtual rdc_status_t rdc_device_get_all(uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES],
uint32_t* count) = 0;
virtual rdc_status_t rdc_device_get_all_cpu(uint32_t cpu_index_list[RDC_MAX_NUM_DEVICES],
uint32_t* count) = 0;
virtual rdc_status_t rdc_device_get_attributes(uint32_t gpu_index,
rdc_device_attributes_t* p_rdc_attr) = 0;
virtual rdc_status_t rdc_device_get_cpu_attributes(uint32_t cpu_index,
rdc_device_attributes_t* p_rdc_attr) = 0;
virtual rdc_status_t rdc_device_get_component_version(rdc_component_t component,
rdc_component_version_t* p_rdc_compv) = 0;
+2 -1
ファイルの表示
@@ -39,7 +39,8 @@ class RdcMetricFetcher {
virtual rdc_status_t fetch_smi_field(uint32_t gpu_index, rdc_field_t field_id,
rdc_field_value* value) = 0;
virtual rdc_status_t fetch_smi_cpu_field(uint32_t cpu_index, rdc_field_t field_id,
rdc_field_value* value) = 0;
virtual rdc_status_t bulk_fetch_smi_fields(
rdc_gpu_field_t* fields, uint32_t fields_count,
std::vector<rdc_gpu_field_value_t>& results) = 0; // NOLINT
+5
ファイルの表示
@@ -53,8 +53,13 @@ class RdcEmbeddedHandler final : public RdcHandler {
// Discovery API
rdc_status_t rdc_device_get_all(uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES],
uint32_t* count) override;
// Discovery API For CPU
rdc_status_t rdc_device_get_all_cpu(uint32_t cpu_index_list[RDC_MAX_NUM_DEVICES],
uint32_t* count) override;
rdc_status_t rdc_device_get_attributes(uint32_t gpu_index,
rdc_device_attributes_t* p_rdc_attr) override;
rdc_status_t rdc_device_get_cpu_attributes(uint32_t cpu_index,
rdc_device_attributes_t* p_rdc_attr) override;
rdc_status_t rdc_device_get_component_version(rdc_component_t component,
rdc_component_version_t* p_rdc_compv) override;
+2
ファイルの表示
@@ -71,6 +71,8 @@ class RdcMetricFetcherImpl final : public RdcMetricFetcher {
public:
rdc_status_t fetch_smi_field(uint32_t gpu_index, rdc_field_t field_id,
rdc_field_value* value) override;
rdc_status_t fetch_smi_cpu_field(uint32_t cpu_index, rdc_field_t field_id,
rdc_field_value* value) override;
rdc_status_t bulk_fetch_smi_fields(
rdc_gpu_field_t* fields, uint32_t fields_count,
std::vector<rdc_gpu_field_value_t>& results) override; // NOLINT
+4
ファイルの表示
@@ -47,8 +47,12 @@ class RdcStandaloneHandler : public RdcHandler {
// Discovery RdcAPI
rdc_status_t rdc_device_get_all(uint32_t gpu_index_list[RDC_MAX_NUM_DEVICES],
uint32_t* count) override;
rdc_status_t rdc_device_get_all_cpu(uint32_t cpu_index_list[RDC_MAX_NUM_DEVICES],
uint32_t* count) override;
rdc_status_t rdc_device_get_attributes(uint32_t gpu_index,
rdc_device_attributes_t* p_rdc_attr) override;
rdc_status_t rdc_device_get_cpu_attributes(uint32_t cpu_index,
rdc_device_attributes_t* p_rdc_attr) override;
rdc_status_t rdc_device_get_component_version(rdc_component_t component,
rdc_component_version_t* p_rdc_compv) override;