diff --git a/src/adjustor/fuse/gpu.py b/src/adjustor/fuse/gpu.py index 659a060..bb7fb5d 100644 --- a/src/adjustor/fuse/gpu.py +++ b/src/adjustor/fuse/gpu.py @@ -3,7 +3,7 @@ from typing import Literal, NamedTuple from typing import Sequence -from adjustor.fuse.utils import find_igpu as find_amd_igpu +from adjustor.fuse.utils import find_amd_igpu logger = logging.getLogger(__name__) GPU_FREQUENCY_PATH = "device/pp_od_clk_voltage" diff --git a/src/adjustor/fuse/utils.py b/src/adjustor/fuse/utils.py index 3466599..23ce9fa 100644 --- a/src/adjustor/fuse/utils.py +++ b/src/adjustor/fuse/utils.py @@ -10,13 +10,13 @@ FUSE_MOUNT_SOCKET = "/run/hhd-tdp/socket" -def find_igpu(): +def find_amd_igpu(): for hw in os.listdir("/sys/class/hwmon"): if not hw.startswith("hwmon"): continue if not os.path.exists(f"/sys/class/hwmon/{hw}/name"): continue - with open(f"/sys/class/hwmon/{hw}/name", 'r') as f: + with open(f"/sys/class/hwmon/{hw}/name", "r") as f: if "amdgpu" not in f.read(): continue @@ -24,14 +24,9 @@ def find_igpu(): logger.error(f'No device symlink found for "{hw}"') continue - if not os.path.exists(f"/sys/class/hwmon/{hw}/device/local_cpulist"): - logger.warning( - f'No local_cpulist found for "{hw}". Assuming it is a dedicated unit.' - ) - continue - - pth = os.path.realpath(os.path.join("/sys/class/hwmon", hw)) - return pth + # This assume dGPU will come with VRAM vendor while iGPU will not + if not os.path.exists(f"/sys/class/hwmon/{hw}/device/mem_info_vram_vendor"): + return os.path.realpath(os.path.join("/sys/class/hwmon", hw)) logger.error("No iGPU found. Binding TDP attributes will not be possible.") return None @@ -39,7 +34,7 @@ def find_igpu(): def prepare_tdp_mount(debug: bool = False, passhtrough: bool = False): try: - gpu = find_igpu() + gpu = find_amd_igpu() logger.info(f"Found GPU at:\n'{gpu}'") if not gpu: return False