Skip to content

Commit e2ccd59

Browse files
Merge commit '1a5c7ecb62aa655dc52385123d75ae13b4b6046f' into release/rocm-rel-7.0
2 parents ffa0f5e + 1a5c7ec commit e2ccd59

File tree

4 files changed

+67
-46
lines changed

4 files changed

+67
-46
lines changed

projects/rocm-smi-lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pkg_check_modules(DRM REQUIRED libdrm)
4444

4545
## Setup the package version based on git tags.
4646
set(PKG_VERSION_GIT_TAG_PREFIX "rsmi_pkg_ver")
47-
get_package_version_number("7.6.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
47+
get_package_version_number("7.8.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT)
4848
message("Package version: ${PKG_VERSION_STR}")
4949
set(${ROCM_SMI_LIBS_TARGET}_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}")
5050
set(${ROCM_SMI_LIBS_TARGET}_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}")

projects/rocm-smi-lib/include/rocm_smi/rocm_smi.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,9 @@ rsmi_status_t rsmi_dev_gpu_reset(uint32_t dv_ind);
29762976
* If this parameter is nullptr, this function will return
29772977
* ::RSMI_STATUS_INVALID_ARGS if the function is supported with the provided,
29782978
* arguments and ::RSMI_STATUS_NOT_SUPPORTED if it is not supported with the
2979-
* provided arguments.
2979+
* provided arguments. In the event where there are some values are missing from
2980+
* or not available on the device, the respective values will be set to
2981+
* UINT64_MAX.
29802982
*
29812983
* @retval ::RSMI_STATUS_SUCCESS call was successful
29822984
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not

projects/rocm-smi-lib/python_smi_tools/rocm_smi.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# Minor version - Increment when adding a new feature, set to 0 when major is incremented
5151
# Patch version - Increment when adding a fix, set to 0 when minor is incremented
5252
# Hash version - Shortened commit hash. Print here and not with lib for consistency with amd-smi
53-
SMI_MAJ = 3
53+
SMI_MAJ = 4
5454
SMI_MIN = 0
5555
SMI_PAT = 0
5656
# SMI_HASH is provided by rsmiBindings
@@ -2827,13 +2827,20 @@ def showRange(deviceList, rangeType):
28272827
return
28282828
printLogSpacer(' Show Valid %s Range ' % (rangeType))
28292829
odvf = rsmi_od_volt_freq_data_t()
2830+
uint64_max = UIntegerTypes.UINT64_T
28302831
for device in deviceList:
28312832
ret = rocmsmi.rsmi_dev_od_volt_info_get(device, byref(odvf))
28322833
if rsmi_ret_ok(ret, device, 'get_od_volt', silent=False):
28332834
if rangeType == 'sclk':
2835+
if odvf.curr_sclk_range.lower_bound == uint64_max or odvf.curr_sclk_range.upper_bound == uint64_max:
2836+
printLog(device, 'Unable to display %s range' % (rangeType), None)
2837+
continue
28342838
printLog(device, 'Valid sclk range: %sMhz - %sMhz' % (
28352839
int(odvf.curr_sclk_range.lower_bound / 1000000), int(odvf.curr_sclk_range.upper_bound / 1000000)), None)
28362840
if rangeType == 'mclk':
2841+
if odvf.curr_mclk_range.lower_bound == uint64_max or odvf.curr_mclk_range.upper_bound == uint64_max:
2842+
printLog(device, 'Unable to display %s range' % (rangeType), None)
2843+
continue
28372844
printLog(device, 'Valid mclk range: %sMhz - %sMhz' % (
28382845
int(odvf.curr_mclk_range.lower_bound / 1000000), int(odvf.curr_mclk_range.upper_bound / 1000000)), None)
28392846
if rangeType == 'voltage':

projects/rocm-smi-lib/src/rocm_smi.cc

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,12 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
13921392
return RSMI_STATUS_INVALID_ARGS;
13931393
}
13941394

1395+
// fill out rsmi_od_volt_freq_data_t p with default max values to indicate no valid data
1396+
p->curr_sclk_range.lower_bound = UINT64_MAX;
1397+
p->curr_sclk_range.upper_bound = UINT64_MAX;
1398+
p->curr_mclk_range.lower_bound = UINT64_MAX;
1399+
p->curr_mclk_range.upper_bound = UINT64_MAX;
1400+
13951401
ret = GetDevValueVec(amd::smi::kDevPowerODVoltage, dv_ind, &val_vec);
13961402
if (ret != RSMI_STATUS_SUCCESS) {
13971403
return ret;
@@ -1419,13 +1425,6 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
14191425
.set_key_data_splitter(":", amd::smi::TagSplitterPositional_t::kBETWEEN)
14201426
.structure_content();
14211427

1422-
//
1423-
// Note: We must have minimum of 'GFXCLK:' && 'MCLK:' OR:
1424-
// 'OD_SCLK:' && 'OD_MCLK:' tags.
1425-
if (txt_power_dev_od_voltage.get_title_size() < kMIN_VALID_LINES) {
1426-
return rsmi_status_t::RSMI_STATUS_NO_DATA;
1427-
}
1428-
14291428
// Note: For debug builds/purposes only.
14301429
assert(txt_power_dev_od_voltage.contains_title_key(kTAG_GFXCLK) ||
14311430
txt_power_dev_od_voltage.contains_title_key(kTAG_OD_SCLK));
@@ -1446,47 +1445,60 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
14461445
return std::vector<std::string>{upper_bound_data};
14471446
};
14481447

1449-
// Validates 'OD_SCLK' is in the structure
1450-
if (txt_power_dev_od_voltage.contains_structured_key(kTAG_OD_SCLK,
1448+
// track the number of keys found, if this goes down to 0 then that means that there is no valid data
1449+
const uint8_t kNumStructuredKeysToCheck = 6;
1450+
uint8_t structured_key_counter = kNumStructuredKeysToCheck;
1451+
// Validates 'OD_SCLK' is in the structure
1452+
if (txt_power_dev_od_voltage.contains_structured_key(kTAG_OD_SCLK,
14511453
KTAG_FIRST_FREQ_IDX)) {
14521454
p->curr_sclk_range.lower_bound = freq_string_to_int(build_lower_bound(kTAG_OD_SCLK), nullptr, nullptr, 0);
14531455
p->curr_sclk_range.upper_bound = freq_string_to_int(build_upper_bound(kTAG_OD_SCLK), nullptr, nullptr, 0);
1454-
1456+
}
1457+
else
1458+
structured_key_counter--;
14551459
// Validates 'OD_MCLK' is in the structure
1456-
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_OD_MCLK,
1457-
KTAG_FIRST_FREQ_IDX)) {
1458-
p->curr_mclk_range.lower_bound = freq_string_to_int(build_lower_bound(KTAG_OD_MCLK), nullptr, nullptr, 0);
1459-
p->curr_mclk_range.upper_bound = freq_string_to_int(build_upper_bound(KTAG_OD_MCLK), nullptr, nullptr, 0);
1460-
}
1460+
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_OD_MCLK,
1461+
KTAG_FIRST_FREQ_IDX)) {
1462+
p->curr_mclk_range.lower_bound = freq_string_to_int(build_lower_bound(KTAG_OD_MCLK), nullptr, nullptr, 0);
1463+
p->curr_mclk_range.upper_bound = freq_string_to_int(build_upper_bound(KTAG_OD_MCLK), nullptr, nullptr, 0);
1464+
}
1465+
else
1466+
structured_key_counter--;
14611467

1462-
// Validates 'OD_RANGE' is in the structure
1463-
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_OD_RANGE,
1464-
KTAG_SCLK)) {
1465-
od_value_pair_str_to_range(txt_power_dev_od_voltage
1466-
.get_structured_value_by_keys(KTAG_OD_RANGE, KTAG_SCLK),
1467-
&p->sclk_freq_limits);
1468-
}
1469-
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_OD_RANGE,
1470-
KTAG_MCLK)) {
1471-
od_value_pair_str_to_range(txt_power_dev_od_voltage
1472-
.get_structured_value_by_keys(KTAG_OD_RANGE, KTAG_MCLK),
1473-
&p->mclk_freq_limits);
1474-
}
1475-
}
1476-
// Validates 'GFXCLK' is in the structure
1477-
else if (txt_power_dev_od_voltage.contains_structured_key(kTAG_GFXCLK,
1478-
KTAG_FIRST_FREQ_IDX)) {
1479-
p->curr_sclk_range.lower_bound = freq_string_to_int(build_lower_bound(kTAG_GFXCLK), nullptr, nullptr, 0);
1480-
p->curr_sclk_range.upper_bound = freq_string_to_int(build_upper_bound(kTAG_GFXCLK), nullptr, nullptr, 0);
1481-
1482-
// Validates 'MCLK' is in the structure
1483-
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_MCLK,
1484-
KTAG_FIRST_FREQ_IDX)) {
1485-
p->curr_mclk_range.lower_bound = freq_string_to_int(build_lower_bound(KTAG_MCLK), nullptr, nullptr, 0);
1486-
p->curr_mclk_range.upper_bound = freq_string_to_int(build_upper_bound(KTAG_MCLK), nullptr, nullptr, 0);
1487-
}
1488-
}
1489-
else {
1468+
// Validates 'OD_RANGE' is in the structure
1469+
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_OD_RANGE,
1470+
KTAG_SCLK)) {
1471+
od_value_pair_str_to_range(txt_power_dev_od_voltage
1472+
.get_structured_value_by_keys(KTAG_OD_RANGE, KTAG_SCLK),
1473+
&p->sclk_freq_limits);
1474+
}
1475+
else
1476+
structured_key_counter--;
1477+
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_OD_RANGE,
1478+
KTAG_MCLK)) {
1479+
od_value_pair_str_to_range(txt_power_dev_od_voltage
1480+
.get_structured_value_by_keys(KTAG_OD_RANGE, KTAG_MCLK),
1481+
&p->mclk_freq_limits);
1482+
}
1483+
else
1484+
structured_key_counter--;
1485+
// Validates 'GFXCLK' is in the structure
1486+
if (txt_power_dev_od_voltage.contains_structured_key(kTAG_GFXCLK,
1487+
KTAG_FIRST_FREQ_IDX)) {
1488+
p->curr_sclk_range.lower_bound = freq_string_to_int(build_lower_bound(kTAG_GFXCLK), nullptr, nullptr, 0);
1489+
p->curr_sclk_range.upper_bound = freq_string_to_int(build_upper_bound(kTAG_GFXCLK), nullptr, nullptr, 0);
1490+
}
1491+
else
1492+
structured_key_counter--;
1493+
// Validates 'MCLK' is in the structure
1494+
if (txt_power_dev_od_voltage.contains_structured_key(KTAG_MCLK,
1495+
KTAG_FIRST_FREQ_IDX)) {
1496+
p->curr_mclk_range.lower_bound = freq_string_to_int(build_lower_bound(KTAG_MCLK), nullptr, nullptr, 0);
1497+
p->curr_mclk_range.upper_bound = freq_string_to_int(build_upper_bound(KTAG_MCLK), nullptr, nullptr, 0);
1498+
}
1499+
else
1500+
structured_key_counter--;
1501+
if (structured_key_counter == 0) {
14901502
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
14911503
}
14921504

0 commit comments

Comments
 (0)