ROCm SMI Python CLI & LIB: Add GPU Reset Functionality

The purpose of this patch is to implement GPU reset functionality
in the LIB, and to call it from the rocm_smi python CLI.

Signed-off-by: Ori Messinger <Ori.Messinger@amd.com>
Change-Id: Iaf525f7016f8354a7fd93af0209ca2e97ef4fd56
This commit is contained in:
Ori Messinger
2021-01-07 05:35:17 -05:00
bovenliggende 4f297bdeb3
commit 80f629b9be
5 gewijzigde bestanden met toevoegingen van 112 en 12 verwijderingen
+15
Bestand weergeven
@@ -2150,6 +2150,21 @@ rsmi_status_t rsmi_dev_overdrive_level_get(uint32_t dv_ind, uint32_t *od);
rsmi_status_t rsmi_dev_gpu_clk_freq_get(uint32_t dv_ind,
rsmi_clk_type_t clk_type, rsmi_frequencies_t *f);
/**
* @brief Reset the gpu associated with the device with provided device index
*
* @details Given a device index @p dv_ind, this function will reset the GPU
*
* @param[in] dv_ind a device index
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
*/
rsmi_status_t rsmi_dev_gpu_reset(int32_t dv_ind);
/**
* @brief This function retrieves the voltage/frequency curve information
*
+5 -1
Bestand weergeven
@@ -155,7 +155,8 @@ enum DevInfoTypes {
kDevSerialNumber,
kDevMemPageBad,
kDevNumaNode,
kDevGpuMetrics
kDevGpuMetrics,
kDevGpuReset
};
typedef struct {
@@ -216,8 +217,11 @@ class Device {
uint32_t card_indx_; // This index corresponds to the drm index (ie, card#)
uint32_t drm_render_minor_;
const RocmSMI_env_vars *env_;
template <typename T> int openDebugFileStream(DevInfoTypes type, T *fs,
const char *str = nullptr);
template <typename T> int openSysfsFileStream(DevInfoTypes type, T *fs,
const char *str = nullptr);
int readDebugInfoStr(DevInfoTypes type, std::string *retStr);
int readDevInfoStr(DevInfoTypes type, std::string *retStr);
int readDevInfoMultiLineStr(DevInfoTypes type,
std::vector<std::string> *retVec);