Handle case where PCIe information is not implemented in system
Also add a new error code for this.
[ROCm/rocm_smi_lib commit: 5e6424cab3]
This commit is contained in:
@@ -84,9 +84,14 @@ typedef enum {
|
||||
RSMI_STATUS_INTERNAL_EXCEPTION, //!< An internal exception was caught
|
||||
RSMI_STATUS_INPUT_OUT_OF_BOUNDS, //!< The provided input is out of
|
||||
//!< allowable or safe range
|
||||
RSMI_INITIALIZATION_ERROR, //!< An error occurred when rsmi
|
||||
RSMI_STATUS_INIT_ERROR, //!< An error occurred when rsmi
|
||||
//!< initializing internal data
|
||||
//!< structures
|
||||
RSMI_INITIALIZATION_ERROR = RSMI_STATUS_INIT_ERROR,
|
||||
RSMI_STATUS_NOT_YET_IMPLEMENTED, //!< The requested function has not
|
||||
//!< yet been implemented in the
|
||||
//!< current system for the current
|
||||
//!< devices
|
||||
RSMI_STATUS_UNKNOWN_ERROR = 0xFFFFFFFF, //!< An unknown error occurred
|
||||
} rsmi_status_t;
|
||||
|
||||
|
||||
@@ -464,6 +464,10 @@ static rsmi_status_t get_frequencies(amd::smi::DevInfoTypes type,
|
||||
}
|
||||
assert(val_vec.size() <= RSMI_MAX_NUM_FREQUENCIES);
|
||||
|
||||
if (val_vec.size() == 0) {
|
||||
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
|
||||
}
|
||||
|
||||
f->num_supported = val_vec.size();
|
||||
bool current = false;
|
||||
f->current = RSMI_MAX_NUM_FREQUENCIES + 1; // init to an invalid value
|
||||
@@ -1092,6 +1096,16 @@ rsmi_status_string(rsmi_status_t status, const char **status_string) {
|
||||
*status_string = "The provided input is out of allowable or safe range";
|
||||
break;
|
||||
|
||||
case RSMI_STATUS_INIT_ERROR:
|
||||
*status_string = "An error occurred during initialization, during "
|
||||
"monitor discovery or when when initializing internal data structures";
|
||||
break;
|
||||
|
||||
case RSMI_STATUS_NOT_YET_IMPLEMENTED:
|
||||
*status_string = "The called function has not been implemented in this "
|
||||
"system for this device type";
|
||||
break;
|
||||
|
||||
default:
|
||||
*status_string = "An unknown error occurred";
|
||||
return RSMI_STATUS_UNKNOWN_ERROR;
|
||||
|
||||
@@ -611,13 +611,17 @@ void TestSanity::Run(void) {
|
||||
print_frequencies(&f);
|
||||
}
|
||||
err = rsmi_dev_pci_bandwidth_get(i, &b);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported PCIe bandwidths: ";
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
if (err == RSMI_STATUS_NOT_YET_IMPLEMENTED) {
|
||||
std::cout << "\t**Get PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Supported PCIe bandwidths: ";
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
}
|
||||
}
|
||||
|
||||
err = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_SYS, &f);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
@@ -766,8 +770,12 @@ void TestSanity::Run(void) {
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
|
||||
err = test_set_pci_bw(i);
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
|
||||
if (err == RSMI_STATUS_NOT_YET_IMPLEMENTED) {
|
||||
std::cout << "\t**Set PCIE Bandwidth: Not supported on this machine"
|
||||
<< std::endl;
|
||||
} else {
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
}
|
||||
err = test_set_fan_speed(i);
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user