rocminfo fails when amdgpu is built into the kernel

When amdgpu is built into the kernel, /sys/module/amdgpu/initstate will not be created even when the driver is functional. However, test shows /sys/module/amdgpu will be present. Adding an additional check for /sys/module/amdgpu when /sys/module/amdgpu/instate is not present.

Change-Id: Ie5c67c7e1eff8ac1683b211aaec802d0d342aeeb


[ROCm/rocminfo commit: c6f7a17c85]
Этот коммит содержится в:
Alex Xu
2024-09-24 10:39:23 -04:00
коммит произвёл Alex Xu
родитель eb5491e777
Коммит 6cc8f7ec13
+8 -3
Просмотреть файл
@@ -1220,9 +1220,14 @@ int CheckInitialState(void) {
return -1;
}
} else {
printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
COL_RED, COL_RESET);
return -1;
int module_dir;
module_dir = open("/sys/module/amdgpu", O_DIRECTORY);
if (module_dir < 0) {
printf("%sROCk module is NOT loaded, possibly no GPU devices%s\n",
COL_RED, COL_RESET);
return -1;
}
close(module_dir);
}
// Check if user belongs to the group for /dev/kfd (e.g. "video" or