From 96922d70a7b7d4b094f09e76c88648f3d4b201ca Mon Sep 17 00:00:00 2001 From: Seunghoon Lee Date: Thu, 26 Sep 2024 13:34:11 +0900 Subject: [PATCH] rocm&zluda handle apu --- installer.py | 8 ++++++-- modules/rocm.py | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/installer.py b/installer.py index 962aa798a..25f755a73 100644 --- a/installer.py +++ b/installer.py @@ -493,8 +493,12 @@ def install_rocm_zluda(): os.environ.setdefault('HIP_VISIBLE_DEVICES', str(idx)) # if os.environ.get('TENSORFLOW_PACKAGE') == 'tensorflow-rocm': # do not use tensorflow-rocm for navi 3x # os.environ['TENSORFLOW_PACKAGE'] = 'tensorflow==2.13.0' - break - log.debug(f'ROCm: HSA_OVERRIDE_GFX_VERSION auto config skipped for {gpu.name}') + if not device.is_apu: + # although apu was found, there can be a dedicated card. do not break loop. + # if no dedicated card was found, apu will be used. + break + else: + log.debug(f'ROCm: HSA_OVERRIDE_GFX_VERSION auto config skipped for {gpu.name}') else: device_id = int(args.device_id) if device_id < len(amd_gpus): diff --git a/modules/rocm.py b/modules/rocm.py index dd975f323..86075bf92 100644 --- a/modules/rocm.py +++ b/modules/rocm.py @@ -53,18 +53,20 @@ class MicroArchitecture(Enum): class Agent: name: str arch: MicroArchitecture + is_apu: bool if sys.platform != "win32": blaslt_supported: bool def __init__(self, name: str): self.name = name - gfx_version = name[3:7] - if len(gfx_version) == 4: + gfx = name[3:7] + if len(gfx) == 4: self.arch = MicroArchitecture.RDNA - elif gfx_version in ("908", "90a", "942",): + elif gfx in ("908", "90a", "942",): self.arch = MicroArchitecture.CDNA else: self.arch = MicroArchitecture.GCN + self.is_apu = gfx in ("801", "902", "90c", "1013", "1033", "1035", "1036", "1103",) if sys.platform != "win32": self.blaslt_supported = os.path.exists(os.path.join(HIPBLASLT_TENSILE_LIBPATH, f"extop_{name}.co"))