Skip to content

Commit

Permalink
[SWDEV-481004] Fix for incorrect gfx_version number (#8)
Browse files Browse the repository at this point in the history
The target_graphics_version was not formatted properly and was
showing incorrect Target Name. Corrected this by fomatting
major, minor and revision numbers.

Signed-off-by: Bindhiya Kanangot Balakrishnan <[email protected]>
  • Loading branch information
bkanango authored Jan 21, 2025
1 parent aefc865 commit 94dca70
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ $ rocm-smi --showmetrics

### Resolved issues

- **Fixed `rsmi_dev_target_graphics_version_get`, `rocm-smi --showhw`, and `rocm-smi --showprod` not displaying graphics version properly for MI2x, MI1x or Navi 3x ASICs.**

### Upcoming changes

## rocm_smi_lib for ROCm 6.3
Expand Down
5 changes: 1 addition & 4 deletions python_smi_tools/rocm_smi.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,8 @@ def getTargetGfxVersion(device, silent=False):
target_graphics_version = c_uint64()
gfx_ver_ret = "N/A"
ret = rocmsmi.rsmi_dev_target_graphics_version_get(device, byref(target_graphics_version))
target_graphics_version = str(target_graphics_version.value)
target_graphics_version = hex(target_graphics_version.value)[2:]
if rsmi_ret_ok(ret, device, 'get_target_gfx_version', silent=silent):
if target_graphics_version == "9010":
hex_part = str(hex(int(str(target_graphics_version)[2:]))).replace("0x", "")
target_graphics_version = str(target_graphics_version)[:2] + hex_part
gfx_ver_ret = "gfx" + str(target_graphics_version)
return gfx_ver_ret

Expand Down
2 changes: 1 addition & 1 deletion src/rocm_smi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5365,7 +5365,7 @@ rsmi_status_t rsmi_dev_target_graphics_version_get(uint32_t dv_ind,
}
if (ret == RSMI_STATUS_SUCCESS) {
version = amd::smi::removeString(version, "gfx");
*gfx_version = std::stoull(version);
*gfx_version = uint64_t(std::stoull(version, nullptr, 16));
}
ss << __PRETTY_FUNCTION__
<< " | ======= end ======= "
Expand Down
10 changes: 6 additions & 4 deletions src/rocm_smi_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1193,11 +1193,13 @@ rsmi_status_t rsmi_get_gfx_target_version(uint32_t dv_ind, std::string *gfx_vers
// separate out parts -> put back into normal graphics version format
major = static_cast<uint64_t>((orig_target_version / 10000) * 100);
minor = static_cast<uint64_t>((orig_target_version % 10000 / 100) * 10);
if ((minor == 0) && (countDigit(major) < 4)) {
major *= 10; // 0 as a minor is correct, but bump up by 10
}
rev = static_cast<uint64_t>(orig_target_version % 100);
*gfx_version = "gfx" + std::to_string(major + minor + rev);

ss << std::hex << rev;
std::string revision = ss.str();
*gfx_version = "gfx" + std::to_string((major + minor)/10) + revision;

ss.str("");
ss << __PRETTY_FUNCTION__
<< " | " << std::dec << "kfd_target_version = " << orig_target_version
<< "; major = " << major << "; minor = " << minor << "; rev = "
Expand Down

0 comments on commit 94dca70

Please sign in to comment.