Merge 'master' into 'amd-master'

Change-Id: I6ae9012bf38869056f1e4b2d221f9957e8bbf5b2


[ROCm/amdsmi commit: 00876b1757]
This commit is contained in:
Jenkins
2019-03-06 04:09:56 -06:00
28 ha cambiato i file con 1357 aggiunte e 536 eliminazioni
File binario non mostrato.
+14 -13
Vedi File
@@ -80,7 +80,7 @@ static void print_test_header(const char *str, uint32_t dv_ind) {
}
static const char *
power_profile_string(rsmi_power_profile_preset_masks profile) {
power_profile_string(rsmi_power_profile_preset_masks_t profile) {
switch (profile) {
case RSMI_PWR_PROF_PRST_CUSTOM_MASK:
return "CUSTOM";
@@ -100,7 +100,7 @@ power_profile_string(rsmi_power_profile_preset_masks profile) {
}
static const char *
perf_level_string(rsmi_dev_perf_level perf_lvl) {
perf_level_string(rsmi_dev_perf_level_t perf_lvl) {
switch (perf_lvl) {
case RSMI_DEV_PERF_LEVEL_AUTO:
return "AUTO";
@@ -117,7 +117,7 @@ perf_level_string(rsmi_dev_perf_level perf_lvl) {
static rsmi_status_t test_power_profile(uint32_t dv_ind) {
rsmi_status_t ret;
rsmi_power_profile_status status;
rsmi_power_profile_status_t status;
print_test_header("Power Profile", dv_ind);
@@ -130,7 +130,7 @@ static rsmi_status_t test_power_profile(uint32_t dv_ind) {
while (tmp <= RSMI_PWR_PROF_PRST_LAST) {
if ((tmp & status.available_profiles) == tmp) {
std::cout << "\t" <<
power_profile_string((rsmi_power_profile_preset_masks)tmp) << std::endl;
power_profile_string((rsmi_power_profile_preset_masks_t)tmp) << std::endl;
}
tmp = tmp << 1;
}
@@ -138,8 +138,8 @@ static rsmi_status_t test_power_profile(uint32_t dv_ind) {
power_profile_string(status.current) << std::endl;
// Try setting the profile to a different power profile
rsmi_bit_field diff_profiles;
rsmi_power_profile_preset_masks new_prof;
rsmi_bit_field_t diff_profiles;
rsmi_power_profile_preset_masks_t new_prof;
diff_profiles = status.available_profiles & (~status.current);
if (diff_profiles & RSMI_PWR_PROF_PRST_COMPUTE_MASK) {
@@ -162,7 +162,7 @@ static rsmi_status_t test_power_profile(uint32_t dv_ind) {
ret = rsmi_dev_power_profile_set(dv_ind, 0, new_prof);
CHK_RSMI_RET(ret)
std::cout << "Done." << std::endl;
rsmi_dev_perf_level pfl;
rsmi_dev_perf_level_t pfl;
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
CHK_RSMI_RET(ret)
std::cout << "Performance Level is now " <<
@@ -305,7 +305,7 @@ static rsmi_status_t test_set_fan_speed(uint32_t dv_ind) {
static rsmi_status_t test_set_perf_level(uint32_t dv_ind) {
rsmi_status_t ret;
rsmi_dev_perf_level pfl, orig_pfl;
rsmi_dev_perf_level_t pfl, orig_pfl;
print_test_header("Performance Level Control", dv_ind);
@@ -314,7 +314,8 @@ static rsmi_status_t test_set_perf_level(uint32_t dv_ind) {
std::cout << "\t**Original Perf Level:" << perf_level_string(orig_pfl) <<
std::endl;
pfl = (rsmi_dev_perf_level)((orig_pfl + 1) % (RSMI_DEV_PERF_LEVEL_LAST + 1));
pfl =
(rsmi_dev_perf_level_t)((orig_pfl + 1) % (RSMI_DEV_PERF_LEVEL_LAST + 1));
std::cout << "Set Performance Level to " << (uint32_t)pfl << " ..." <<
std::endl;
@@ -334,7 +335,7 @@ static rsmi_status_t test_set_perf_level(uint32_t dv_ind) {
static rsmi_status_t test_set_freq(uint32_t dv_ind) {
rsmi_status_t ret;
rsmi_frequencies f;
rsmi_frequencies_t f;
uint32_t freq_bitmask;
rsmi_clk_type rsmi_clk;
@@ -379,7 +380,7 @@ static rsmi_status_t test_set_freq(uint32_t dv_ind) {
return RSMI_STATUS_SUCCESS;
}
static void print_frequencies(rsmi_frequencies *f) {
static void print_frequencies(rsmi_frequencies_t *f) {
assert(f != nullptr);
for (uint32_t j = 0; j < f->num_supported; ++j) {
std::cout << "\t** " << j << ": " << f->frequency[j];
@@ -400,8 +401,8 @@ int main() {
uint64_t val_ui64, val2_ui64;
int64_t val_i64;
uint32_t val_ui32;
rsmi_dev_perf_level pfl;
rsmi_frequencies f;
rsmi_dev_perf_level_t pfl;
rsmi_frequencies_t f;
uint32_t num_monitor_devs = 0;
rsmi_num_monitor_devices(&num_monitor_devs);
File diff soppresso perché troppo grande Carica Diff
@@ -1,6 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
@@ -70,6 +68,15 @@ enum DevInfoTypes {
kDevPowerODVoltage,
kDevVBiosVer,
kDevPCIEThruPut,
kDevErrCntSDMA,
kDevErrCntUMC,
kDevErrCntGFX,
kDevMemTotGTT,
kDevMemTotVisVRAM,
kDevMemTotVRAM,
kDevMemUsedGTT,
kDevMemUsedVisVRAM,
kDevMemUsedVRAM,
};
class Device {
@@ -83,9 +90,7 @@ class Device {
const std::shared_ptr<PowerMon>& power_monitor() {return power_monitor_;}
void set_power_monitor(std::shared_ptr<PowerMon> pm) {power_monitor_ = pm;}
#if 0 // This is not being used right now.
int readDevInfo(DevInfoTypes type, uint32_t *val);
#endif
int readDevInfo(DevInfoTypes type, uint64_t *val);
int readDevInfoLine(DevInfoTypes type, std::string *line);
int readDevInfo(DevInfoTypes type, std::string *val);
int readDevInfo(DevInfoTypes type, std::vector<std::string> *retVec);
@@ -1,6 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
+158 -29
Vedi File
@@ -1,6 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
@@ -177,7 +175,7 @@ static uint64_t freq_string_to_int(const std::vector<std::string> &freq_lines,
}
static void freq_volt_string_to_point(std::string in_line,
rsmi_od_vddc_point *pt) {
rsmi_od_vddc_point_t *pt) {
std::istringstream fs_vlt(in_line);
assert(pt != nullptr);
@@ -206,7 +204,7 @@ static void freq_volt_string_to_point(std::string in_line,
return;
}
static void od_value_pair_str_to_range(std::string in_line, rsmi_range *rg) {
static void od_value_pair_str_to_range(std::string in_line, rsmi_range_t *rg) {
std::istringstream fs_rng(in_line);
assert(rg != nullptr);
@@ -244,7 +242,7 @@ power_prof_string_to_int(std::string pow_prof_line, bool *is_curr,
std::string mode;
size_t tmp;
rsmi_power_profile_preset_masks ret = RSMI_PWR_PROF_PRST_INVALID;
rsmi_power_profile_preset_masks_t ret = RSMI_PWR_PROF_PRST_INVALID;
fs >> *prof_ind;
fs >> mode;
@@ -289,6 +287,13 @@ static rsmi_status_t get_dev_value_str(amd::smi::DevInfoTypes type,
return errno_to_rsmi_status(ret);
}
static rsmi_status_t get_dev_value_int(amd::smi::DevInfoTypes type,
uint32_t dv_ind, uint64_t *val_int) {
GET_DEV_FROM_INDX
int ret = dev->readDevInfo(type, val_int);
return errno_to_rsmi_status(ret);
}
static rsmi_status_t get_dev_value_line(amd::smi::DevInfoTypes type,
uint32_t dv_ind, std::string *val_str) {
@@ -433,6 +438,62 @@ rsmi_num_monitor_devices(uint32_t *num_devices) {
CATCH
}
rsmi_status_t
rsmi_dev_error_count_get(uint32_t dv_ind, rsmi_gpu_block_t block,
rsmi_error_count_t *ec) {
std::vector<std::string> val_vec;
rsmi_status_t ret;
TRY
if (ec == nullptr || block > RSMI_GPU_BLOCK_LAST) {
return RSMI_STATUS_INVALID_ARGS;
}
amd::smi::DevInfoTypes type;
switch (block) {
case RSMI_GPU_BLOCK_UMC:
type = amd::smi::kDevErrCntUMC;
break;
case RSMI_GPU_BLOCK_SDMA:
type = amd::smi::kDevErrCntSDMA;
break;
case RSMI_GPU_BLOCK_GFX:
type = amd::smi::kDevErrCntGFX;
break;
default:
assert(!"Unsupported block provided to rsmi_dev_error_count_get()");
return RSMI_STATUS_NOT_SUPPORTED;
}
ret = get_dev_value_vec(type, dv_ind, &val_vec);
if (ret == RSMI_STATUS_FILE_ERROR) {
return RSMI_STATUS_NOT_SUPPORTED;
}
if (ret != RSMI_STATUS_SUCCESS) {
return ret;
}
assert(val_vec.size() == 2);
std::string junk;
std::istringstream fs1(val_vec[0]);
fs1 >> junk;
assert(junk == "ue:");
fs1 >> ec->uncorrectable_err;
std::istringstream fs2(val_vec[1]);
fs2 >> junk;
assert(junk == "ce:");
fs2 >> ec->correctable_err;
return ret;
CATCH
}
rsmi_status_t
rsmi_dev_pci_id_get(uint32_t dv_ind, uint64_t *bdfid) {
TRY
@@ -466,7 +527,7 @@ rsmi_dev_id_get(uint32_t dv_ind, uint64_t *id) {
}
rsmi_status_t
rsmi_dev_perf_level_get(uint32_t dv_ind, rsmi_dev_perf_level *perf) {
rsmi_dev_perf_level_get(uint32_t dv_ind, rsmi_dev_perf_level_t *perf) {
TRY
std::string val_str;
rsmi_status_t ret = get_dev_value_str(amd::smi::kDevPerfLevel, dv_ind,
@@ -511,7 +572,7 @@ rsmi_dev_overdrive_level_set(int32_t dv_ind, uint32_t od) {
}
rsmi_status_t
rsmi_dev_perf_level_set(int32_t dv_ind, rsmi_dev_perf_level perf_level) {
rsmi_dev_perf_level_set(int32_t dv_ind, rsmi_dev_perf_level_t perf_level) {
TRY
if (perf_level > RSMI_DEV_PERF_LEVEL_LAST) {
return RSMI_STATUS_INVALID_ARGS;
@@ -522,7 +583,7 @@ rsmi_dev_perf_level_set(int32_t dv_ind, rsmi_dev_perf_level perf_level) {
}
static rsmi_status_t get_frequencies(amd::smi::DevInfoTypes type,
uint32_t dv_ind, rsmi_frequencies *f, uint32_t *lanes = nullptr) {
uint32_t dv_ind, rsmi_frequencies_t *f, uint32_t *lanes = nullptr) {
TRY
std::vector<std::string> val_vec;
rsmi_status_t ret;
@@ -571,8 +632,8 @@ static rsmi_status_t get_frequencies(amd::smi::DevInfoTypes type,
}
static rsmi_status_t get_power_profiles(uint32_t dv_ind,
rsmi_power_profile_status *p,
std::map<rsmi_power_profile_preset_masks, uint32_t> *ind_map) {
rsmi_power_profile_status_t *p,
std::map<rsmi_power_profile_preset_masks_t, uint32_t> *ind_map) {
TRY
std::vector<std::string> val_vec;
rsmi_status_t ret;
@@ -592,7 +653,7 @@ static rsmi_status_t get_power_profiles(uint32_t dv_ind,
p->current = RSMI_PWR_PROF_PRST_INVALID; // init to an invalid value
p->available_profiles = 0;
rsmi_power_profile_preset_masks prof;
rsmi_power_profile_preset_masks_t prof;
uint32_t prof_ind;
for (uint32_t i = 1; i < val_vec.size(); ++i) {
@@ -652,7 +713,7 @@ static const uint32_t kOD_VDDC_CURVE_num_lines =
kOD_VDDC_CURVE_start_index + 4;
static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
rsmi_od_volt_freq_data *p) {
rsmi_od_volt_freq_data_t *p) {
TRY
std::vector<std::string> val_vec;
rsmi_status_t ret;
@@ -708,7 +769,7 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
}
static void get_vc_region(uint32_t start_ind,
std::vector<std::string> *val_vec, rsmi_freq_volt_region *p) {
std::vector<std::string> *val_vec, rsmi_freq_volt_region_t *p) {
assert(p != nullptr);
assert(val_vec != nullptr);
// There must be at least 1 region to read in
@@ -729,7 +790,7 @@ static void get_vc_region(uint32_t start_ind,
* *num_regions regions. On
*/
static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
uint32_t *num_regions, rsmi_freq_volt_region *p) {
uint32_t *num_regions, rsmi_freq_volt_region_t *p) {
TRY
std::vector<std::string> val_vec;
rsmi_status_t ret;
@@ -766,18 +827,19 @@ static bool is_power_of_2(uint64_t n) {
return n && !(n & (n - 1));
}
static rsmi_status_t set_power_profile(uint32_t dv_ind,
rsmi_power_profile_preset_masks profile) {
rsmi_power_profile_preset_masks_t profile) {
TRY
rsmi_status_t ret;
rsmi_power_profile_status avail_profiles = {0, RSMI_PWR_PROF_PRST_INVALID, 0};
rsmi_power_profile_status_t avail_profiles =
{0, RSMI_PWR_PROF_PRST_INVALID, 0};
// Determine if the provided profile is valid
if (!is_power_of_2(profile)) {
return RSMI_STATUS_INPUT_OUT_OF_BOUNDS;
}
std::map<rsmi_power_profile_preset_masks, uint32_t> ind_map;
std::map<rsmi_power_profile_preset_masks_t, uint32_t> ind_map;
ret = get_power_profiles(dv_ind, &avail_profiles, &ind_map);
if (ret != RSMI_STATUS_SUCCESS) {
@@ -804,8 +866,8 @@ static rsmi_status_t set_power_profile(uint32_t dv_ind,
}
rsmi_status_t
rsmi_dev_gpu_clk_freq_get(uint32_t dv_ind, rsmi_clk_type clk_type,
rsmi_frequencies *f) {
rsmi_dev_gpu_clk_freq_get(uint32_t dv_ind, rsmi_clk_type_t clk_type,
rsmi_frequencies_t *f) {
TRY
switch (clk_type) {
case RSMI_CLK_TYPE_SYS:
@@ -836,9 +898,9 @@ static std::string bitfield_to_freq_string(uint64_t bitf,
rsmi_status_t
rsmi_dev_gpu_clk_freq_set(uint32_t dv_ind,
rsmi_clk_type clk_type, uint64_t freq_bitmask) {
rsmi_clk_type_t clk_type, uint64_t freq_bitmask) {
rsmi_status_t ret;
rsmi_frequencies freqs;
rsmi_frequencies_t freqs;
TRY
ret = rsmi_dev_gpu_clk_freq_get(dv_ind, clk_type, &freqs);
@@ -911,7 +973,7 @@ rsmi_dev_name_get(uint32_t dv_ind, char *name, size_t len) {
}
rsmi_status_t
rsmi_dev_pci_bandwidth_get(uint32_t dv_ind, rsmi_pcie_bandwidth *b) {
rsmi_dev_pci_bandwidth_get(uint32_t dv_ind, rsmi_pcie_bandwidth_t *b) {
TRY
assert(b != nullptr);
@@ -928,7 +990,7 @@ rsmi_dev_pci_bandwidth_get(uint32_t dv_ind, rsmi_pcie_bandwidth *b) {
rsmi_status_t
rsmi_dev_pci_bandwidth_set(uint32_t dv_ind, uint64_t bw_bitmask) {
rsmi_status_t ret;
rsmi_pcie_bandwidth bws;
rsmi_pcie_bandwidth_t bws;
TRY
ret = rsmi_dev_pci_bandwidth_get(dv_ind, &bws);
@@ -995,7 +1057,7 @@ rsmi_dev_pci_throughput_get(uint32_t dv_ind, uint64_t *sent,
rsmi_status_t
rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_ind,
rsmi_temperature_metric metric, int64_t *temperature) {
rsmi_temperature_metric_t metric, int64_t *temperature) {
TRY
if (temperature == nullptr) {
@@ -1174,7 +1236,7 @@ rsmi_dev_fan_speed_max_get(uint32_t dv_ind, uint32_t sensor_ind,
}
rsmi_status_t
rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data *odv) {
rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data_t *odv) {
TRY
rsmi_status_t ret = get_od_clk_volt_info(dv_ind, odv);
@@ -1183,7 +1245,7 @@ rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data *odv) {
}
rsmi_status_t rsmi_dev_od_volt_curve_regions_get(uint32_t dv_ind,
uint32_t *num_regions, rsmi_freq_volt_region *buffer) {
uint32_t *num_regions, rsmi_freq_volt_region_t *buffer) {
TRY
if (buffer == nullptr || num_regions == nullptr || *num_regions == 0) {
@@ -1298,7 +1360,7 @@ rsmi_dev_power_cap_set(uint32_t dv_ind, uint32_t sensor_ind, uint64_t cap) {
rsmi_status_t
rsmi_dev_power_profile_presets_get(uint32_t dv_ind, uint32_t sensor_ind,
rsmi_power_profile_status *status) {
rsmi_power_profile_status_t *status) {
TRY
++sensor_ind; // power sysfs files have 1-based indices
@@ -1310,7 +1372,7 @@ rsmi_dev_power_profile_presets_get(uint32_t dv_ind, uint32_t sensor_ind,
rsmi_status_t
rsmi_dev_power_profile_set(uint32_t dv_ind, uint32_t sensor_ind,
rsmi_power_profile_preset_masks profile) {
rsmi_power_profile_preset_masks_t profile) {
TRY
++sensor_ind; // power sysfs files have 1-based indices
@@ -1319,6 +1381,73 @@ rsmi_dev_power_profile_set(uint32_t dv_ind, uint32_t sensor_ind,
CATCH
}
rsmi_status_t
rsmi_dev_memory_total_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
uint64_t *total) {
TRY
rsmi_status_t ret;
amd::smi::DevInfoTypes mem_type_file;
if (total == nullptr) {
return RSMI_STATUS_INVALID_ARGS;
}
switch (mem_type) {
case RSMI_MEM_TYPE_GTT:
mem_type_file = amd::smi::kDevMemTotGTT;
break;
case RSMI_MEM_TYPE_VIS_VRAM:
mem_type_file = amd::smi::kDevMemTotVisVRAM;
break;
case RSMI_MEM_TYPE_VRAM:
mem_type_file = amd::smi::kDevMemTotVRAM;
break;
default:
assert(!"Unexpected memory type");
return RSMI_STATUS_INVALID_ARGS;
}
ret = get_dev_value_int(mem_type_file, dv_ind, total);
return ret;
CATCH
}
rsmi_status_t
rsmi_dev_memory_usage_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
uint64_t *used) {
TRY
rsmi_status_t ret;
amd::smi::DevInfoTypes mem_type_file;
if (used == nullptr) {
return RSMI_STATUS_INVALID_ARGS;
}
switch (mem_type) {
case RSMI_MEM_TYPE_GTT:
mem_type_file = amd::smi::kDevMemUsedGTT;
break;
case RSMI_MEM_TYPE_VIS_VRAM:
mem_type_file = amd::smi::kDevMemUsedVisVRAM;
break;
case RSMI_MEM_TYPE_VRAM:
mem_type_file = amd::smi::kDevMemUsedVRAM;
break;
default:
assert(!"Unexpected memory type");
return RSMI_STATUS_INVALID_ARGS;
}
ret = get_dev_value_int(mem_type_file, dv_ind, used);
return ret;
CATCH
}
rsmi_status_t
rsmi_status_string(rsmi_status_t status, const char **status_string) {
TRY
@@ -1427,7 +1556,7 @@ rsmi_dev_vbios_version_get(uint32_t dv_ind, char *vbios, uint32_t len) {
}
rsmi_status_t
rsmi_version_get(rsmi_version *version) {
rsmi_version_get(rsmi_version_t *version) {
TRY
if (version == nullptr) {
+34 -5
Vedi File
@@ -1,4 +1,4 @@
/* ROC Runtime Conformance Release License
/*
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
@@ -59,6 +59,7 @@
namespace amd {
namespace smi {
// Sysfs file names
static const char *kDevPerfLevelFName = "power_dpm_force_performance_level";
static const char *kDevDevIDFName = "device";
static const char *kDevOverDriveLevelFName = "pp_sclk_od";
@@ -70,6 +71,17 @@ static const char *kDevPowerODVoltageFName = "pp_od_clk_voltage";
static const char *kDevUsageFName = "gpu_busy_percent";
static const char *kDevVBiosVerFName = "vbios_version";
static const char *kDevPCIEThruPutFName = "pcie_bw";
static const char *kDevErrCntSDMAFName = "ras/sdma_err_count";
static const char *kDevErrCntUMCFName = "ras/umc_err_count";
static const char *kDevErrCntGFXFName = "ras/gfx_err_count";
static const char *kDevMemTotGTTFName = "mem_info_gtt_total";
static const char *kDevMemTotVisVRAMFName = "mem_info_vis_vram_total";
static const char *kDevMemTotVRAMFName = "mem_info_vram_total";
static const char *kDevMemUsedGTTFName = "mem_info_gtt_used";
static const char *kDevMemUsedVisVRAMFName = "mem_info_vis_vram_used";
static const char *kDevMemUsedVRAMFName = "mem_info_vram_used";
// Strings that are found within sysfs files
static const char *kDevPerfLevelAutoStr = "auto";
static const char *kDevPerfLevelLowStr = "low";
static const char *kDevPerfLevelHighStr = "high";
@@ -92,6 +104,15 @@ static const std::map<DevInfoTypes, const char *> kDevAttribNameMap = {
{kDevPowerODVoltage, kDevPowerODVoltageFName},
{kDevVBiosVer, kDevVBiosVerFName},
{kDevPCIEThruPut, kDevPCIEThruPutFName},
{kDevErrCntSDMA, kDevErrCntSDMAFName},
{kDevErrCntUMC, kDevErrCntUMCFName},
{kDevErrCntGFX, kDevErrCntGFXFName},
{kDevMemTotGTT, kDevMemTotGTTFName},
{kDevMemTotVisVRAM, kDevMemTotVisVRAMFName},
{kDevMemTotVRAM, kDevMemTotVRAMFName},
{kDevMemUsedGTT, kDevMemUsedGTTFName},
{kDevMemUsedVisVRAM, kDevMemUsedVisVRAMFName},
{kDevMemUsedVRAM, kDevMemUsedVRAMFName},
};
static const std::map<rsmi_dev_perf_level, const char *> kDevPerfLvlMap = {
@@ -287,8 +308,7 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type,
return 0;
}
#if 0
int Device::readDevInfo(DevInfoTypes type, uint32_t *val) {
int Device::readDevInfo(DevInfoTypes type, uint64_t *val) {
assert(val != nullptr);
std::string tempStr;
@@ -302,9 +322,15 @@ int Device::readDevInfo(DevInfoTypes type, uint32_t *val) {
case kDevUsage:
case kDevOverDriveLevel:
case kDevMemTotGTT:
case kDevMemTotVisVRAM:
case kDevMemTotVRAM:
case kDevMemUsedGTT:
case kDevMemUsedVisVRAM:
case kDevMemUsedVRAM:
ret = readDevInfoStr(type, &tempStr);
RET_IF_NONZERO(ret);
*val = std::stoi(tempStr, 0);
*val = std::stoul(tempStr, 0);
break;
default:
@@ -312,7 +338,7 @@ int Device::readDevInfo(DevInfoTypes type, uint32_t *val) {
}
return 0;
}
#endif
int Device::readDevInfo(DevInfoTypes type, std::vector<std::string> *val) {
assert(val != nullptr);
@@ -322,6 +348,9 @@ int Device::readDevInfo(DevInfoTypes type, std::vector<std::string> *val) {
case kDevPCIEClk:
case kDevPowerProfileMode:
case kDevPowerODVoltage:
case kDevErrCntSDMA:
case kDevErrCntUMC:
case kDevErrCntGFX:
return readDevInfoMultiLineStr(type, val);
break;
-3
Vedi File
@@ -1,7 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
@@ -1,6 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
@@ -1,6 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
-2
Vedi File
@@ -1,6 +1,4 @@
/*
* =============================================================================
* ROC Runtime Conformance Release License
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
@@ -0,0 +1,115 @@
/*
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2019, 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.
*
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include "gtest/gtest.h"
#include "rocm_smi/rocm_smi.h"
#include "rocm_smi_test/functional/err_cnt_read.h"
#include "rocm_smi_test/test_common.h"
TestErrCntRead::TestErrCntRead() : TestBase() {
set_title("RSMI Error Count Read Test");
set_description("The Error Count Read tests verifies that error counts"
" can be read properly.");
}
TestErrCntRead::~TestErrCntRead(void) {
}
void TestErrCntRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestErrCntRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestErrCntRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestErrCntRead::Close() {
// This will close handles opened within rsmitst utility calls and call
// rsmi_shut_down(), so it should be done after other hsa cleanup
TestBase::Close();
}
void TestErrCntRead::Run(void) {
rsmi_status_t err;
rsmi_error_count_t ec;
TestBase::Run();
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
for (uint32_t b = RSMI_GPU_BLOCK_FIRST; b <= RSMI_GPU_BLOCK_LAST; ++b) {
err = rsmi_dev_error_count_get(i, static_cast<rsmi_gpu_block_t>(b), &ec);
if (err == RSMI_STATUS_NOT_SUPPORTED) {
std::cout << "\t**Error Count for " <<
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) <<
": Not supported on this machine" << std::endl;
} else {
CHK_ERR_ASRT(err)
IF_VERB(STANDARD) {
std::cout << "\t**Error counts for " <<
GetBlockNameStr(static_cast<rsmi_gpu_block_t>(b)) << " block: "
<< std::endl;
std::cout << "\t\tCorrectable errors: " << ec.correctable_err
<< std::endl;
std::cout << "\t\tUncorrectable errors: " << ec.uncorrectable_err
<< std::endl;
}
}
}
}
}
@@ -0,0 +1,71 @@
/*
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2019, 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 TESTS_ROCM_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
#include "rocm_smi_test/test_base.h"
class TestErrCntRead : public TestBase {
public:
TestErrCntRead();
// @Brief: Destructor for test case of TestErrCntRead
virtual ~TestErrCntRead();
// @Brief: Setup the environment for measurement
virtual void SetUp();
// @Brief: Core measurement execution
virtual void Run();
// @Brief: Clean up and retrive the resource
virtual void Close();
// @Brief: Display results
virtual void DisplayResults() const;
// @Brief: Display information about what this test does
virtual void DisplayTestInfo(void);
};
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_ERR_CNT_READ_H_
@@ -85,7 +85,7 @@ void TestFrequenciesRead::Close() {
}
static void print_frequencies(rsmi_frequencies *f, uint32_t *l = nullptr) {
static void print_frequencies(rsmi_frequencies_t *f, uint32_t *l = nullptr) {
assert(f != nullptr);
for (uint32_t j = 0; j < f->num_supported; ++j) {
std::cout << "\t** " << j << ": " << f->frequency[j];
@@ -104,8 +104,8 @@ static void print_frequencies(rsmi_frequencies *f, uint32_t *l = nullptr) {
void TestFrequenciesRead::Run(void) {
rsmi_status_t err;
rsmi_frequencies f;
rsmi_pcie_bandwidth b;
rsmi_frequencies_t f;
rsmi_pcie_bandwidth_t b;
TestBase::Run();
@@ -91,7 +91,7 @@ void TestFrequenciesReadWrite::Close() {
void TestFrequenciesReadWrite::Run(void) {
rsmi_status_t ret;
rsmi_frequencies f;
rsmi_frequencies_t f;
uint32_t freq_bitmask;
rsmi_clk_type rsmi_clk;
@@ -0,0 +1,140 @@
/*
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2019, 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.
*
*/
#include <stdint.h>
#include <stddef.h>
#include <iostream>
#include <string>
#include <map>
#include "gtest/gtest.h"
#include "rocm_smi/rocm_smi.h"
#include "rocm_smi_test/functional/mem_util_read.h"
#include "rocm_smi_test/test_common.h"
TestMemUtilRead::TestMemUtilRead() : TestBase() {
set_title("Memory Utilization Read Test");
set_description("The Memory Utilization Read tests verifies that "
"memory utilization can be read properly.");
}
TestMemUtilRead::~TestMemUtilRead(void) {
}
void TestMemUtilRead::SetUp(void) {
TestBase::SetUp();
return;
}
void TestMemUtilRead::DisplayTestInfo(void) {
TestBase::DisplayTestInfo();
}
void TestMemUtilRead::DisplayResults(void) const {
TestBase::DisplayResults();
return;
}
void TestMemUtilRead::Close() {
// This will close handles opened within rsmitst utility calls and call
// rsmi_shut_down(), so it should be done after other hsa cleanup
TestBase::Close();
}
static const std::map<rsmi_memory_type_t, const char *>
kDevMemoryTypeNameMap = {
{RSMI_MEM_TYPE_VRAM, "VRAM memory"},
{RSMI_MEM_TYPE_VIS_VRAM, "Visible VRAM memory"},
{RSMI_MEM_TYPE_GTT, "GTT memory"},
};
void TestMemUtilRead::Run(void) {
rsmi_status_t err;
uint64_t total;
uint64_t usage;
TestBase::Run();
auto err_chk = [&](const char *str) {
if (err != RSMI_STATUS_SUCCESS) {
if (err == RSMI_STATUS_FILE_ERROR) {
IF_VERB(STANDARD) {
std::cout << "\t** " << str << ": Not supported on this machine"
<< std::endl;
}
} else {
CHK_ERR_ASRT(err)
}
}
};
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
for (uint32_t mem_type = RSMI_MEM_TYPE_FIRST;
mem_type <= RSMI_MEM_TYPE_LAST; ++mem_type) {
err = rsmi_dev_memory_total_get(i,
static_cast<rsmi_memory_type_t>(mem_type), &total);
err_chk("rsmi_dev_memory_total_get()");
if (err != RSMI_STATUS_SUCCESS) {
return;
}
err = rsmi_dev_memory_usage_get(i,
static_cast<rsmi_memory_type_t>(mem_type), &usage);
err_chk("rsmi_dev_memory_usage_get()");
if (err != RSMI_STATUS_SUCCESS) {
return;
}
IF_VERB(STANDARD) {
std::cout << "\t**" <<
kDevMemoryTypeNameMap.at(static_cast<rsmi_memory_type_t>(mem_type)) <<
" Utilization: " << (static_cast<float>(usage)*100)/total << "% ("<<
usage << "/" << total << ")" << std::endl;
}
}
}
}
@@ -0,0 +1,71 @@
/*
* =============================================================================
* The University of Illinois/NCSA
* Open Source License (NCSA)
*
* Copyright (c) 2019, 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 TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
#define TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
#include "rocm_smi_test/test_base.h"
class TestMemUtilRead : public TestBase {
public:
TestMemUtilRead();
// @Brief: Destructor for test case of TestMemUtilRead
virtual ~TestMemUtilRead();
// @Brief: Setup the environment for measurement
virtual void SetUp();
// @Brief: Core measurement execution
virtual void Run();
// @Brief: Clean up and retrive the resource
virtual void Close();
// @Brief: Display results
virtual void DisplayResults() const;
// @Brief: Display information about what this test does
virtual void DisplayTestInfo(void);
};
#endif // TESTS_ROCM_SMI_TEST_FUNCTIONAL_MEM_UTIL_READ_H_
@@ -87,7 +87,7 @@ void TestPciReadWrite::Close() {
void TestPciReadWrite::Run(void) {
rsmi_status_t ret;
rsmi_pcie_bandwidth bw;
rsmi_pcie_bandwidth_t bw;
uint32_t freq_bitmask;
uint64_t sent, received, max_pkt_sz;
@@ -87,7 +87,7 @@ void TestPerfLevelRead::Close() {
void TestPerfLevelRead::Run(void) {
rsmi_status_t err;
rsmi_dev_perf_level pfl;
rsmi_dev_perf_level_t pfl;
TestBase::Run();
@@ -54,7 +54,8 @@
#include "rocm_smi_test/functional/perf_level_read_write.h"
#include "rocm_smi_test/test_common.h"
static const std::map<rsmi_dev_perf_level, const char *> kDevPerfLvlNameMap = {
static const std::map<rsmi_dev_perf_level_t, const char *>
kDevPerfLvlNameMap = {
{RSMI_DEV_PERF_LEVEL_AUTO, "RSMI_DEV_PERF_LEVEL_AUTO"},
{RSMI_DEV_PERF_LEVEL_LOW, "RSMI_DEV_PERF_LEVEL_LOW"},
{RSMI_DEV_PERF_LEVEL_HIGH, "RSMI_DEV_PERF_LEVEL_HIGH"},
@@ -102,7 +103,7 @@ void TestPerfLevelReadWrite::Close() {
void TestPerfLevelReadWrite::Run(void) {
rsmi_status_t ret;
rsmi_dev_perf_level pfl, orig_pfl;
rsmi_dev_perf_level_t pfl, orig_pfl;
TestBase::Run();
@@ -125,11 +126,11 @@ void TestPerfLevelReadWrite::Run(void) {
IF_VERB(STANDARD) {
std::cout << "Set Performance Level to " <<
kDevPerfLvlNameMap.at(static_cast<rsmi_dev_perf_level>(pfl_i)) <<
kDevPerfLvlNameMap.at(static_cast<rsmi_dev_perf_level_t>(pfl_i)) <<
" ..." << std::endl;
}
ret = rsmi_dev_perf_level_set(dv_ind,
static_cast<rsmi_dev_perf_level>(pfl_i));
static_cast<rsmi_dev_perf_level_t>(pfl_i));
CHK_ERR_ASRT(ret)
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
CHK_ERR_ASRT(ret)
@@ -88,7 +88,7 @@ void TestPowerReadWrite::Close() {
}
static const char *
power_profile_string(rsmi_power_profile_preset_masks profile) {
power_profile_string(rsmi_power_profile_preset_masks_t profile) {
switch (profile) {
case RSMI_PWR_PROF_PRST_CUSTOM_MASK:
return "CUSTOM";
@@ -111,7 +111,7 @@ power_profile_string(rsmi_power_profile_preset_masks profile) {
void TestPowerReadWrite::Run(void) {
rsmi_status_t ret;
rsmi_power_profile_status status;
rsmi_power_profile_status_t status;
TestBase::Run();
@@ -127,7 +127,7 @@ void TestPowerReadWrite::Run(void) {
while (tmp <= RSMI_PWR_PROF_PRST_LAST) {
if ((tmp & status.available_profiles) == tmp) {
std::cout << "\t" <<
power_profile_string((rsmi_power_profile_preset_masks)tmp) <<
power_profile_string((rsmi_power_profile_preset_masks_t)tmp) <<
std::endl;
}
tmp = tmp << 1;
@@ -136,11 +136,11 @@ void TestPowerReadWrite::Run(void) {
power_profile_string(status.current) << std::endl;
}
rsmi_power_profile_preset_masks orig_profile = status.current;
rsmi_power_profile_preset_masks_t orig_profile = status.current;
// Try setting the profile to a different power profile
rsmi_bit_field diff_profiles;
rsmi_power_profile_preset_masks new_prof;
rsmi_bit_field_t diff_profiles;
rsmi_power_profile_preset_masks_t new_prof;
diff_profiles = status.available_profiles & (~status.current);
if (diff_profiles & RSMI_PWR_PROF_PRST_COMPUTE_MASK) {
@@ -162,7 +162,7 @@ void TestPowerReadWrite::Run(void) {
ret = rsmi_dev_power_profile_set(dv_ind, 0, new_prof);
CHK_ERR_ASRT(ret)
rsmi_dev_perf_level pfl;
rsmi_dev_perf_level_t pfl;
ret = rsmi_dev_perf_level_get(dv_ind, &pfl);
CHK_ERR_ASRT(ret)
ASSERT_EQ(pfl, RSMI_DEV_PERF_LEVEL_MANUAL);
@@ -89,7 +89,7 @@ void TestSysInfoRead::Run(void) {
rsmi_status_t err;
uint64_t val_ui64;
char buffer[80];
rsmi_version ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
rsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
TestBase::Run();
@@ -94,7 +94,7 @@ void TestTempRead::Run(void) {
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
PrintDeviceHeader(i);
auto print_temp_metric = [&](rsmi_temperature_metric met,
auto print_temp_metric = [&](rsmi_temperature_metric_t met,
std::string label) {
err = rsmi_dev_temp_metric_get(i, 0, met, &val_i64);
@@ -86,7 +86,7 @@ void TestVersionRead::Close() {
void TestVersionRead::Run(void) {
rsmi_status_t err;
rsmi_version ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
rsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
TestBase::Run();
@@ -100,7 +100,7 @@ static void pt_rng_mV(std::string title, rsmi_range *r) {
" mV" << std::endl;
}
static void print_pnt(rsmi_od_vddc_point *pt) {
static void print_pnt(rsmi_od_vddc_point_t *pt) {
std::cout << "\t\t** Frequency: " << pt->frequency/1000000 << "MHz" <<
std::endl;
std::cout << "\t\t** Voltage: " << pt->voltage << "mV" << std::endl;
@@ -113,7 +113,7 @@ static void pt_vddc_curve(rsmi_od_volt_curve *c) {
}
}
static void print_rsmi_od_volt_freq_data(rsmi_od_volt_freq_data *odv) {
static void print_rsmi_od_volt_freq_data_t(rsmi_od_volt_freq_data_t *odv) {
assert(odv != nullptr);
std::cout.setf(std::ios::dec, std::ios::basefield);
@@ -131,13 +131,13 @@ static void print_rsmi_od_volt_freq_data(rsmi_od_volt_freq_data *odv) {
odv->num_regions << std::endl;
}
static void print_odv_region(rsmi_freq_volt_region *region) {
static void print_odv_region(rsmi_freq_volt_region_t *region) {
pt_rng_Mhz("\t\tFrequency range:", &region->freq_range);
pt_rng_mV("\t\tVoltage range:", &region->volt_range);
}
static void print_rsmi_od_volt_freq_regions(uint32_t num_regions,
rsmi_freq_volt_region *regions) {
rsmi_freq_volt_region_t *regions) {
for (uint32_t i = 0; i < num_regions; ++i) {
std::cout << "\tRegion " << i << ":" << std::endl;
print_odv_region(&regions[i]);
@@ -146,7 +146,7 @@ static void print_rsmi_od_volt_freq_regions(uint32_t num_regions,
void TestVoltCurvRead::Run(void) {
rsmi_status_t err;
rsmi_od_volt_freq_data odv;
rsmi_od_volt_freq_data_t odv;
TestBase::Run();
@@ -167,11 +167,11 @@ void TestVoltCurvRead::Run(void) {
if (err == RSMI_STATUS_SUCCESS) {
std::cout << "\t**Frequency-voltage curve data:" << std::endl;
print_rsmi_od_volt_freq_data(&odv);
print_rsmi_od_volt_freq_data_t(&odv);
rsmi_freq_volt_region *regions;
rsmi_freq_volt_region_t *regions;
uint32_t num_regions;
regions = new rsmi_freq_volt_region[odv.num_regions];
regions = new rsmi_freq_volt_region_t[odv.num_regions];
ASSERT_TRUE(regions != nullptr);
num_regions = odv.num_regions;
+10 -1
Vedi File
@@ -68,6 +68,8 @@
#include "functional/power_read_write.h"
#include "functional/power_cap_read_write.h"
#include "functional/version_read.h"
#include "functional/err_cnt_read.h"
#include "functional/mem_util_read.h"
static RSMITstGlobals *sRSMIGlvalues = nullptr;
@@ -181,7 +183,14 @@ TEST(rsmitstReadWrite, TestPowerCapReadWrite) {
TestPowerCapReadWrite tst;
RunGenericTest(&tst);
}
TEST(rsmitstReadOnly, TestErrCntRead) {
TestErrCntRead tst;
RunGenericTest(&tst);
}
TEST(rsmitstReadOnly, TestMemUtilRead) {
TestMemUtilRead tst;
RunGenericTest(&tst);
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
@@ -49,9 +49,17 @@
#include <iostream>
#include <string>
#include <map>
#include "rocm_smi_test/test_base.h"
#include "rocm_smi_test/test_common.h"
#include "rocm_smi/rocm_smi.h"
static const std::map<rsmi_gpu_block_t, const char *> kBlockNameMap = {
{RSMI_GPU_BLOCK_UMC, "UMC"},
{RSMI_GPU_BLOCK_SDMA, "SDMA"},
{RSMI_GPU_BLOCK_GFX, "GFX"},
};
static const struct option long_options[] = {
{"iterations", required_argument, nullptr, 'i'},
@@ -123,6 +131,12 @@ uint32_t ProcessCmdline(RSMITstGlobals* test, int arg_cnt, char** arg_list) {
return 0;
}
const char *GetBlockNameStr(rsmi_gpu_block_t id) {
return kBlockNameMap.at(id);
}
#if ENABLE_SMI
void DumpMonitorInfo(const TestBase *test) {
int ret = 0;
@@ -48,9 +48,8 @@
#include <memory>
#include <vector>
#if ENABLE_SMI
#include "rocm_smi/rocm_smi.h"
#endif
struct RSMITstGlobals {
uint32_t verbosity;
@@ -62,6 +61,7 @@ struct RSMITstGlobals {
uint32_t ProcessCmdline(RSMITstGlobals* test, int arg_cnt, char** arg_list);
void PrintTestHeader(uint32_t dv_ind);
const char *GetBlockNameStr(rsmi_gpu_block_t id);
#if ENABLE_SMI
void DumpMonitorInfo(const TestBase *test);