Skip to content

Commit

Permalink
Add support for HSA_OVERRIDE_GFX_VERSION env var
Browse files Browse the repository at this point in the history
Change-Id: Iab75cbbba7da654dbf56f4206900d9c2ff5e4565
  • Loading branch information
dayatsin-amd committed Aug 24, 2023
1 parent 0978f20 commit dd16db1
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions rocm_agent_enumerator
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,28 @@ def readFromKFD():
if search_result is not None:
device_id = int(search_result.group(0).split(' ')[1], 10)
if device_id != 0:
major_ver = int((device_id / 10000) % 100)
minor_ver = int((device_id / 100) % 100)
stepping_ver = int(device_id % 100)
gfx_override = os.environ.get("HSA_OVERRIDE_GFX_VERSION")
if gfx_override is not None:
try:
override_tokens = gfx_override.split('.')
major_ver=int(override_tokens[0])
minor_ver=int(override_tokens[1])
stepping_ver=int(override_tokens[2])
if major_ver > 63 or minor_ver > 255 or stepping_ver > 255:
print('Invalid HSA_OVERRIDE_GFX_VERSION value')
major_ver=0
minor_ver=0
stepping_ver=0
except Exception as e:
print('Invalid HSA_OVERRIDE_GFX_VERSION format expected \"1.2.3\"')
major_ver=0
minor_ver=0
stepping_ver=0
else:
major_ver = int((device_id / 10000) % 100)
minor_ver = int((device_id / 100) % 100)
stepping_ver = int(device_id % 100)

target_list.append("gfx" + format(major_ver, 'd') + format(minor_ver, 'x') + format(stepping_ver, 'x'))
line = f.readline()

Expand Down

0 comments on commit dd16db1

Please sign in to comment.