fix: [rocm/amd_smi_lib] TestFrequenciesRead & TestPciReadWrite test cases failed
Fixes asserts in unit tests, and 'pp_dpm_pcie' condition Code changes related to the following: * rsmi_dev_pci_bandwidth_set() * Functional tests Change-Id: Id5e6851393fa3b51bb8cad87daca1efaf500a7e0 Signed-off-by: Oliveira, Daniel <daniel.oliveira@amd.com>
This commit is contained in:
committed by
Maisam Arif
parent
a719ae9707
commit
475424525e
@@ -2642,7 +2642,10 @@ rsmi_dev_pci_bandwidth_set(uint32_t dv_ind, uint64_t bw_bitmask) {
|
||||
|
||||
int32_t ret_i;
|
||||
ret_i = dev->writeDevInfo(amd::smi::kDevPCIEClk, freq_enable_str);
|
||||
|
||||
//
|
||||
// NOTE: kDevPCIEClk sysfs file maybe not exist for all cases.
|
||||
// If it doesn't exist (pp_dpm_pcie), it shouldn't be an error
|
||||
// and will get translated to RSMI_STATUS_NOT_SUPPORTED.
|
||||
return amd::smi::ErrnoToRsmiStatus(ret_i);
|
||||
|
||||
CATCH
|
||||
|
||||
@@ -181,8 +181,9 @@ void TestFrequenciesRead::Run(void) {
|
||||
std::cout << b.transfer_rate.num_supported << std::endl;
|
||||
print_frequencies(&b.transfer_rate, b.lanes);
|
||||
// Verify api support checking functionality is working
|
||||
// NOTE: We expect AMDSMI_STATUS_NOT_SUPPORTED, if rsmi_pcie_bandwidth_t* is NULL
|
||||
err = amdsmi_get_gpu_pci_bandwidth(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +163,9 @@ void TestPciReadWrite::Run(void) {
|
||||
std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
// NOTE: We expect AMDSMI_STATUS_NOT_SUPPORTED, if rsmi_pcie_bandwidth_t* is NULL
|
||||
ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], nullptr);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_INVAL);
|
||||
ASSERT_EQ(ret, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
// First set the bitmask to all supported bandwidths
|
||||
freq_bitmask = ~(~0u << bw.transfer_rate.num_supported);
|
||||
@@ -183,7 +184,14 @@ void TestPciReadWrite::Run(void) {
|
||||
" ..." << std::endl;
|
||||
}
|
||||
ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[dv_ind], freq_bitmask);
|
||||
CHK_ERR_ASRT(ret)
|
||||
if (ret != amdsmi_status_t::AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
else {
|
||||
auto status_string("");
|
||||
amdsmi_status_code_to_string(ret, &status_string);
|
||||
std::cout << "\t\t** amdsmi_set_gpu_pci_bandwidth(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
ret = amdsmi_get_gpu_pci_bandwidth(processor_handles_[dv_ind], &bw);
|
||||
CHK_ERR_ASRT(ret)
|
||||
@@ -194,7 +202,14 @@ void TestPciReadWrite::Run(void) {
|
||||
std::cout << "\tResetting mask to all bandwidths." << std::endl;
|
||||
}
|
||||
ret = amdsmi_set_gpu_pci_bandwidth(processor_handles_[dv_ind], 0xFFFFFFFF);
|
||||
CHK_ERR_ASRT(ret)
|
||||
if (ret != amdsmi_status_t::AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
CHK_ERR_ASRT(ret)
|
||||
}
|
||||
else {
|
||||
auto status_string("");
|
||||
amdsmi_status_code_to_string(ret, &status_string);
|
||||
std::cout << "\t\t** amdsmi_set_gpu_pci_bandwidth(): " << status_string << "\n";
|
||||
}
|
||||
|
||||
ret = amdsmi_set_gpu_perf_level(processor_handles_[dv_ind], AMDSMI_DEV_PERF_LEVEL_AUTO);
|
||||
CHK_ERR_ASRT(ret)
|
||||
|
||||
Reference in New Issue
Block a user