amd-smi: fix cpu specific apis and header
1. provide prototype and documentation for esmi specific api. define structures and update classes as required 2. update cmake files as required and add esmi api to the amdsmi esmi integration example. Change-Id: I753ec176f9b381e74c9646525dfd9075237bf8d9
Dieser Commit ist enthalten in:
committet von
khashaik
Ursprung
8f3861e1d9
Commit
65eed73f4d
+158
-151
@@ -71,7 +71,8 @@ typedef enum {
|
||||
AMDSMI_INIT_AMD_CPUS = (1 << 0),
|
||||
AMDSMI_INIT_AMD_GPUS = (1 << 1),
|
||||
AMDSMI_INIT_NON_AMD_CPUS = (1 << 2),
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3)
|
||||
AMDSMI_INIT_NON_AMD_GPUS = (1 << 3),
|
||||
AMDSMI_INIT_AMD_APUS = (AMDSMI_INIT_AMD_CPUS | AMDSMI_INIT_AMD_GPUS)
|
||||
} amdsmi_init_flags_t;
|
||||
|
||||
/* Maximum size definitions AMDSMI */
|
||||
@@ -1626,32 +1627,67 @@ amdsmi_status_t amdsmi_get_socket_info(
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
/**
|
||||
* @brief Get information about the given cpu socket
|
||||
* @brief Get information about the given processor
|
||||
*
|
||||
* @details This function retrieves cpu socket information. The @p socket_handle must
|
||||
* be provided to retrieve the Socket ID.
|
||||
* @details This function retrieves processor information. The @p processor_handle must
|
||||
* be provided to retrieve the processor ID.
|
||||
*
|
||||
* @param[in] socket_handle a socket handle
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[out] sockid The id of the socket.
|
||||
* @param[out] name The id of the processor.
|
||||
*
|
||||
* @param[in] len the length of the caller provided buffer @p name.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpusocket_info(amdsmi_cpusocket_handle socket_handle, uint32_t sockid);
|
||||
amdsmi_status_t amdsmi_get_processor_info(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
size_t len, char *name);
|
||||
|
||||
/**
|
||||
* @brief Get information about the given cpu core
|
||||
* @brief Get respective processor counts from the processor handles
|
||||
*
|
||||
* @details This function retrieves cpu core information. The @p core_handle must
|
||||
* be provided to retrieve the core ID.
|
||||
* @details This function retrieves respective processor counts information.
|
||||
* The @p processor_handle must be provided to retrieve the processor ID.
|
||||
*
|
||||
* @param[in] core_handle a processor handle
|
||||
* @param[in] processor_handles A pointer to a block of memory to which the
|
||||
* ::amdsmi_processor_handle values will be written. This value may be NULL.
|
||||
*
|
||||
* @param[out] coreid The id of the core.
|
||||
* @param[in] processor_count total processor count per socket
|
||||
*
|
||||
* @param[out] nr_cpusockets Total number of cpu sockets
|
||||
*
|
||||
* @param[out] nr_cpucores Total number of cpu cores
|
||||
*
|
||||
* @param[out] nr_gpus Total number of gpu devices
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpucore_info(amdsmi_processor_handle core_handle, uint32_t coreid);
|
||||
amdsmi_status_t amdsmi_get_processor_count_from_handles(amdsmi_processor_handle* processor_handles,
|
||||
uint32_t* processor_count, uint32_t* nr_cpusockets,
|
||||
uint32_t* nr_cpucores, uint32_t* nr_gpus);
|
||||
|
||||
/**
|
||||
* @brief Get processor list as per processor type
|
||||
*
|
||||
* @details This function retrieves processor list as per the processor type
|
||||
* from the total processor handles list.
|
||||
* The @p list of processor_handles and processor type must be provided.
|
||||
*
|
||||
* @param[in] socket_handle socket handle
|
||||
*
|
||||
* @param[in] processor_type processor type
|
||||
*
|
||||
* @param[out] processor_handles list of processor handles as per processor type
|
||||
*
|
||||
* @param[out] processor_count processor count as per processor type selected
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_processor_handles_by_type(amdsmi_socket_handle socket_handle,
|
||||
processor_type_t processor_type,
|
||||
amdsmi_processor_handle* processor_handles,
|
||||
uint32_t* processor_count);
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -5340,27 +5376,25 @@ amdsmi_get_gpu_metrics_log(amdsmi_processor_handle processor_handle);
|
||||
* @brief Get the core energy for a given core.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - cpu core index
|
||||
*
|
||||
* @param[in,out] penergy - Input buffer to return the core energy
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_energy(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint64_t *penergy);
|
||||
uint64_t *penergy);
|
||||
|
||||
/**
|
||||
* @brief Get the socket energy for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] penergy - Input buffer to return the socket energy
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint64_t *penergy);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_processor_handle processor_handle,
|
||||
uint64_t *penergy);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5372,43 +5406,41 @@ amdsmi_status_t amdsmi_get_cpu_socket_energy(amdsmi_cpusocket_handle socket_hand
|
||||
/**
|
||||
* @brief Get SMU Firmware Version.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] amdsmi_smu_fw - Input buffer to return the firmware version
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_smu_fw_version_t *amdsmi_smu_fw);
|
||||
amdsmi_status_t amdsmi_get_cpu_smu_fw_version(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_smu_fw_version_t *amdsmi_smu_fw);
|
||||
|
||||
/**
|
||||
* @brief Get HSMP protocol Version.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] proto_ver - Input buffer to return the protocol version
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t *proto_ver);
|
||||
amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *proto_ver);
|
||||
|
||||
/**
|
||||
* @brief Get normalized status of the processor's PROCHOT status.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] prochot - Input buffer to return the procohot status.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *prochot);
|
||||
amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *prochot);
|
||||
|
||||
/**
|
||||
* @brief Get Data fabric clock and Memory clock in MHz.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] fclk - Input buffer to return fclk
|
||||
*
|
||||
@@ -5416,27 +5448,25 @@ amdsmi_status_t amdsmi_get_cpu_prochot_status(amdsmi_cpusocket_handle socket_han
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *fclk, uint32_t *mclk);
|
||||
amdsmi_status_t amdsmi_get_cpu_fclk_mclk(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *fclk, uint32_t *mclk);
|
||||
|
||||
/**
|
||||
* @brief Get core clock in MHz.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] cclk - Input buffer to return core clock
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *cclk);
|
||||
amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *cclk);
|
||||
|
||||
/**
|
||||
* @brief Get current active frequency limit of the socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] freq - Input buffer to return frequency value in MHz
|
||||
*
|
||||
@@ -5444,14 +5474,13 @@ amdsmi_status_t amdsmi_get_cpu_cclk_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint16_t *freq, char **src_type);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint16_t *freq, char **src_type);
|
||||
|
||||
/**
|
||||
* @brief Get socket frequency range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] fmax - Input buffer to return maximum frequency
|
||||
*
|
||||
@@ -5459,21 +5488,20 @@ amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(amdsmi_cpusocket
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint16_t *fmax, uint16_t *fmin);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_freq_range(amdsmi_processor_handle processor_handle,
|
||||
uint16_t *fmax, uint16_t *fmin);
|
||||
|
||||
/**
|
||||
* @brief Get socket frequency limit of the core.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in,out] freq - Input buffer to return frequency.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t *freq);
|
||||
uint32_t *freq);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5485,80 +5513,74 @@ amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(amdsmi_processor_handle p
|
||||
/**
|
||||
* @brief Get the socket power.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] ppower - Input buffer to return socket power
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *ppower);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ppower);
|
||||
|
||||
/**
|
||||
* @brief Get the socket power cap.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pcap - Input buffer to return power cap.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pcap);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pcap);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum power cap value for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pmax - Input buffer to return maximum power limit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pmax);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pmax);
|
||||
|
||||
/**
|
||||
* @brief Get the SVI based power telemetry for all rails.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] power - Input buffer to return svi based power value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *power);
|
||||
amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *power);
|
||||
|
||||
/**
|
||||
* @brief Set the power cap value for a given socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] power - Input power limit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t pcap);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_power_cap(amdsmi_processor_handle processor_handle,
|
||||
uint32_t pcap);
|
||||
|
||||
/**
|
||||
* @brief Set the power efficiency profile policy.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] mode - mode to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t mode);
|
||||
amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_processor_handle processor_handle,
|
||||
uint8_t mode);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5571,53 +5593,49 @@ amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(amdsmi_cpusocket_handle socke
|
||||
* @brief Get the core boost limit.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in,out] pboostlimit - Input buffer to fill the boostlimit value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_core_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t *pboostlimit);
|
||||
uint32_t *pboostlimit);
|
||||
|
||||
/**
|
||||
* @brief Get the socket c0 residency.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] pc0_residency - Input buffer to fill the c0 residency value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pc0_residency);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pc0_residency);
|
||||
|
||||
/**
|
||||
* @brief Set the core boostlimit value.
|
||||
*
|
||||
* @param[in] processor_handle Cpu core which to query
|
||||
* @param[in] core_ind - core index
|
||||
*
|
||||
* @param[in] boostlimit - boostlimit value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_core_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t core_ind, uint32_t boostlimit);
|
||||
uint32_t boostlimit);
|
||||
|
||||
/**
|
||||
* @brief Set the socket boostlimit value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] boostlimit - boostlimit value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t boostlimit);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_processor_handle processor_handle,
|
||||
uint32_t boostlimit);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5629,13 +5647,13 @@ amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(amdsmi_cpusocket_handle socket_
|
||||
/**
|
||||
* @brief Get the DDR bandwidth data.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] ddr_bw - Input buffer to fill ddr bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_ddr_bw_metrics_t *ddr_bw);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5647,15 +5665,14 @@ amdsmi_status_t amdsmi_get_cpu_ddr_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Get socket temperature.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] ptmon - Input buffer to fill temperature value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *ptmon);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *ptmon);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5667,41 +5684,41 @@ amdsmi_status_t amdsmi_get_cpu_socket_temperature(amdsmi_cpusocket_handle socket
|
||||
/**
|
||||
* @brief Get DIMM temperature range and refresh rate.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] rate - Input buffer to fill temperature range and refresh rate value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_temp_range_refresh_rate_t *rate);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_temp_range_refresh_rate_t *rate);
|
||||
|
||||
/**
|
||||
* @brief Get DIMM power consumption.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] rate - Input buffer to fill power consumption value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_dimm_power_t *dimm_pow);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_power_t *dimm_pow);
|
||||
|
||||
/**
|
||||
* @brief Get DIMM thermal sensor value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] dimm_addr - DIMM address
|
||||
* @param[in,out] dimm_temp - Input buffer to fill temperature value
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t dimm_addr, amdsmi_dimm_thermal_t *dimm_temp);
|
||||
amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_processor_handle processor_handle,
|
||||
uint8_t dimm_addr,
|
||||
amdsmi_dimm_thermal_t *dimm_temp);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5713,13 +5730,13 @@ amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(amdsmi_cpusocket_handle socke
|
||||
/**
|
||||
* @brief Set xgmi width.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] min - Minimum xgmi width to be set
|
||||
* @param[in] max - maximum xgmi width to be set
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min, uint8_t max);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5731,15 +5748,14 @@ amdsmi_status_t amdsmi_set_cpu_xgmi_width(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Set gmi3 link width range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] min_link_width - minimum link width to be set.
|
||||
* @param[in] max_link_width - maximum link width to be set.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t min_link_width, uint8_t max_link_width);
|
||||
amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t min_link_width, uint8_t max_link_width);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5751,78 +5767,72 @@ amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(amdsmi_cpusocket_handle soc
|
||||
/**
|
||||
* @brief Enable APB.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_cpusocket_handle socket_handle, uint32_t sock_ind);
|
||||
amdsmi_status_t amdsmi_cpu_apb_enable(amdsmi_processor_handle processor_handle);
|
||||
|
||||
/**
|
||||
* @brief Disable APB.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in] pstate - pstate value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint8_t pstate);
|
||||
amdsmi_status_t amdsmi_cpu_apb_disable(amdsmi_processor_handle processor_handle,
|
||||
uint8_t pstate);
|
||||
|
||||
/**
|
||||
* @brief Set NBIO lclk dpm level value.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] nbio_id - nbio index
|
||||
* @param[in] min - minimum value to be set
|
||||
* @param[in] max - maximum value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint8_t nbio_id, uint8_t min, uint8_t max);
|
||||
amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(amdsmi_processor_handle processor_handle,
|
||||
uint8_t nbio_id, uint8_t min, uint8_t max);
|
||||
|
||||
/**
|
||||
* @brief Get NBIO LCLK dpm level.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] nbio_id - nbio index
|
||||
* @param[in,out] nbio - Input buffer to fill lclk dpm level
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t nbio_id, amdsmi_dpm_level_t *nbio);
|
||||
amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(amdsmi_processor_handle processor_handle,
|
||||
uint8_t nbio_id, amdsmi_dpm_level_t *nbio);
|
||||
|
||||
/**
|
||||
* @brief Set pcie link rate.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] rate_ctrl - rate control value to be set.
|
||||
* @param[in,out] prev_mode - Input buffer to fill previous rate control value.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t rate_ctrl, uint8_t *prev_mode);
|
||||
amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(amdsmi_processor_handle processor_handle,
|
||||
uint8_t rate_ctrl, uint8_t *prev_mode);
|
||||
|
||||
/**
|
||||
* @brief Set df pstate range.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] max_pstate - maximum pstate value to be set
|
||||
* @param[in] min_pstate - minimum pstate value to be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, uint8_t max_pstate, uint8_t min_pstate);
|
||||
amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_processor_handle processor_handle,
|
||||
uint8_t max_pstate, uint8_t min_pstate);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5834,27 +5844,26 @@ amdsmi_status_t amdsmi_set_cpu_df_pstate_range(amdsmi_cpusocket_handle socket_ha
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] link - link id and bw type to which io bandwidth to be obtained
|
||||
* @param[in,out] io_bw - Input buffer to fill bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_cpusocket_handle socket_handle,
|
||||
uint8_t sock_ind, amdsmi_link_id_bw_type_t link, uint32_t *io_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *io_bw);
|
||||
|
||||
/**
|
||||
* @brief Get current input output bandwidth.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in] link - link id and bw type to which xgmi bandwidth to be obtained
|
||||
* @param[in,out] xgmi_bw - Input buffer to fill bandwidth data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_cpusocket_handle socket_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_link_id_bw_type_t link, uint32_t *xgmi_bw);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5866,25 +5875,24 @@ amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(amdsmi_cpusocket_handle socket_ha
|
||||
/**
|
||||
* @brief Get metrics table version
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_version input buffer to return the metrics table version.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t *metrics_version);
|
||||
amdsmi_status_t amdsmi_get_metrics_table_version(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *metrics_version);
|
||||
|
||||
/**
|
||||
* @brief Get metrics table
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
* @param[in,out] metrics_table input buffer to return the metrics table.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle, uint8_t sock_ind,
|
||||
struct hsmp_metric_table *metrics_table);
|
||||
amdsmi_status_t amdsmi_get_metrics_table(amdsmi_processor_handle processor_handle,
|
||||
struct hsmp_metric_table *metrics_table);
|
||||
|
||||
/** @} */
|
||||
|
||||
@@ -5896,15 +5904,14 @@ amdsmi_status_t amdsmi_get_metrics_table(amdsmi_cpusocket_handle socket_handle,
|
||||
/**
|
||||
* @brief Get first online core on socket.
|
||||
*
|
||||
* @param[in] socket_handle Cpu socket which to query
|
||||
* @param[in] sock_ind - socket index.
|
||||
* @param[in] processor_handle Cpu socket which to query
|
||||
*
|
||||
* @param[in,out] sockets - Input buffer to fill first online core on socket data
|
||||
* @param[in,out] pcore_ind - Input buffer to fill first online core on socket data
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_cpusocket_handle socket_handle,
|
||||
uint32_t sock_ind, uint32_t *pcore_ind);
|
||||
amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *pcore_ind);
|
||||
|
||||
/**
|
||||
* @brief Get a description of provided AMDSMI error status for esmi errors.
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
/*Subclass CPU Core*/
|
||||
class AMDSmiCpuCore : public AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiCpuCore(const uint32_t& core_idx):AMDSmiProcessor(AMD_CPU_CORE),core_idx_(core_idx) {}
|
||||
|
||||
virtual ~AMDSmiCpuCore() {}
|
||||
|
||||
const uint32_t& get_core_id() const { return core_idx_; }
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
|
||||
private:
|
||||
uint32_t core_idx_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_CPU_CORE_H_
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* =============================================================================
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
*
|
||||
* AMD Research and AMD ROC Software Development
|
||||
*
|
||||
* Advanced Micro Devices, Inc.
|
||||
*
|
||||
* www.amd.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal with the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimers.
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimers in
|
||||
* the documentation and/or other materials provided with the distribution.
|
||||
* - Neither the names of <Name of Development Group, Name of Institution>,
|
||||
* nor the names of its contributors may be used to endorse or promote
|
||||
* products derived from this Software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS WITH THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_cpu_core.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
|
||||
/*Subclass CPU Socket*/
|
||||
class AMDSmiCpuSocket : public AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiCpuSocket(const uint32_t& id):AMDSmiProcessor(AMD_CPU),socket_identifier_(id) {}
|
||||
|
||||
virtual ~AMDSmiCpuSocket() {}
|
||||
|
||||
amdsmi_status_t get_cpu_vendor() { return AMDSMI_STATUS_SUCCESS; }
|
||||
uint32_t get_cpu_id() const { return cpu_id_; }
|
||||
const uint32_t& get_socket_id() const { return socket_identifier_; }
|
||||
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
|
||||
private:
|
||||
uint32_t cpu_id_;
|
||||
uint32_t socket_identifier_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_CPU_SOCKET_H_
|
||||
@@ -44,6 +44,7 @@
|
||||
#ifndef AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
#define AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
|
||||
#include <string>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
namespace amd {
|
||||
@@ -51,14 +52,18 @@ namespace smi {
|
||||
|
||||
class AMDSmiProcessor {
|
||||
public:
|
||||
explicit AMDSmiProcessor(processor_type_t processor) : processor_type_(processor) {}
|
||||
explicit AMDSmiProcessor(processor_type_t type) : processor_type_(type) {}
|
||||
explicit AMDSmiProcessor(processor_type_t type, uint32_t index) : processor_type_(type), pindex_(index) {}
|
||||
explicit AMDSmiProcessor(const std::string& id) : processor_identifier_(id) {}
|
||||
virtual ~AMDSmiProcessor() {}
|
||||
processor_type_t get_processor_type() const { return processor_type_;}
|
||||
const std::string& get_processor_id() const { return processor_identifier_;}
|
||||
uint32_t get_processor_index() const { return pindex_;}
|
||||
private:
|
||||
processor_type_t processor_type_;
|
||||
uint32_t pindex_;
|
||||
std::string processor_identifier_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
@@ -56,14 +56,46 @@ namespace smi {
|
||||
class AMDSmiSocket {
|
||||
public:
|
||||
explicit AMDSmiSocket(const std::string& id) : socket_identifier_(id) {}
|
||||
explicit AMDSmiSocket(uint32_t index) : sindex_(index) {}
|
||||
~AMDSmiSocket();
|
||||
const std::string& get_socket_id() const { return socket_identifier_;}
|
||||
void add_processor(AMDSmiProcessor* processor) { processors_.push_back(processor); }
|
||||
uint32_t get_socket_index() { return sindex_;}
|
||||
void add_processor(AMDSmiProcessor* processor) {
|
||||
switch (processor->get_processor_type()) {
|
||||
case AMD_GPU:
|
||||
processors_.push_back(processor);
|
||||
break;
|
||||
case AMD_CPU:
|
||||
cpu_processors_.push_back(processor);
|
||||
break;
|
||||
case AMD_CPU_CORE:
|
||||
cpu_core_processors_.push_back(processor);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::vector<AMDSmiProcessor*>& get_processors() { return processors_;}
|
||||
std::vector<AMDSmiProcessor*>& get_processors(processor_type_t type) {
|
||||
switch (type) {
|
||||
case AMD_GPU:
|
||||
return processors_;
|
||||
case AMD_CPU:
|
||||
return cpu_processors_;
|
||||
case AMD_CPU_CORE:
|
||||
return cpu_core_processors_;
|
||||
default:
|
||||
return processors_;
|
||||
}
|
||||
}
|
||||
amdsmi_status_t get_processor_count(uint32_t* processor_count) const;
|
||||
amdsmi_status_t get_processor_count(processor_type_t type, uint32_t* processor_count) const;
|
||||
private:
|
||||
uint32_t sindex_;
|
||||
std::string socket_identifier_;
|
||||
std::vector<AMDSmiProcessor*> processors_;
|
||||
std::vector<AMDSmiProcessor*> cpu_processors_;
|
||||
std::vector<AMDSmiProcessor*> cpu_core_processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
#include "amd_smi/impl/amd_smi_socket.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
#include "amd_smi/impl/amd_smi_cpu_socket.h"
|
||||
#endif
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
@@ -78,25 +75,6 @@ class AMDSmiSystem {
|
||||
amdsmi_status_t gpu_index_to_handle(uint32_t gpu_index,
|
||||
amdsmi_processor_handle* processor_handle);
|
||||
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
std::vector<AMDSmiCpuSocket*>& get_cpu_sockets() {return cpu_sockets_;}
|
||||
|
||||
amdsmi_status_t handle_to_cpusocket(amdsmi_cpusocket_handle cpusock_handle,
|
||||
AMDSmiCpuSocket** cpu_socket);
|
||||
|
||||
amdsmi_status_t cpu_index_to_handle(uint32_t cpu_index,
|
||||
amdsmi_cpusocket_handle* cpusock_handle);
|
||||
|
||||
amdsmi_status_t get_cpu_sockets(uint32_t *socks);
|
||||
|
||||
amdsmi_status_t get_cpu_cores(uint32_t *cpus);
|
||||
|
||||
amdsmi_status_t get_threads_per_core(uint32_t *threads);
|
||||
|
||||
amdsmi_status_t get_cpu_family(uint32_t *family);
|
||||
|
||||
amdsmi_status_t get_cpu_model(uint32_t *model);
|
||||
#endif
|
||||
private:
|
||||
AMDSmiSystem() : init_flag_(AMDSMI_INIT_AMD_GPUS) {}
|
||||
|
||||
@@ -106,23 +84,12 @@ class AMDSmiSystem {
|
||||
*/
|
||||
amdsmi_status_t get_gpu_socket_id(uint32_t index, std::string& socketid);
|
||||
amdsmi_status_t populate_amd_gpu_devices();
|
||||
amdsmi_status_t populate_amd_cpus();
|
||||
uint64_t init_flag_;
|
||||
AMDSmiDrm drm_;
|
||||
std::vector<AMDSmiSocket*> sockets_;
|
||||
std::set<AMDSmiProcessor*> processors_; // Track valid processors
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
amdsmi_status_t populate_amd_cpus();
|
||||
std::vector<AMDSmiCpuSocket*> cpu_sockets_;
|
||||
static uint32_t sockets;
|
||||
static uint32_t cpus;
|
||||
static uint32_t threads;
|
||||
static uint32_t family;
|
||||
static uint32_t model;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren