diff --git a/gpu/amd.go b/gpu/amd.go index 84af6b37..c21b7741 100644 --- a/gpu/amd.go +++ b/gpu/amd.go @@ -2,6 +2,7 @@ package gpu import ( "bufio" + "errors" "fmt" "io" "log/slog" @@ -24,14 +25,23 @@ const ( ) func AMDDetected() bool { - _, err := AMDDriverVersion() - return err == nil + // Some driver versions (older?) don't have a version file, so just lookup the parent dir + sysfsDir := filepath.Dir(DriverVersionFile) + _, err := os.Stat(sysfsDir) + if errors.Is(err, os.ErrNotExist) { + slog.Debug("amd driver not detected " + sysfsDir) + return false + } else if err != nil { + slog.Debug(fmt.Sprintf("error looking up amd driver %s %s", sysfsDir, err)) + return false + } + return true } func AMDDriverVersion() (string, error) { _, err := os.Stat(DriverVersionFile) if err != nil { - return "", err + return "", fmt.Errorf("amdgpu file stat error: %s %w", DriverVersionFile, err) } fp, err := os.Open(DriverVersionFile) if err != nil { diff --git a/gpu/gpu.go b/gpu/gpu.go index 3831ee4a..b5baff38 100644 --- a/gpu/gpu.go +++ b/gpu/gpu.go @@ -153,6 +153,9 @@ func GetGPUInfo() GpuInfo { ver, err := AMDDriverVersion() if err == nil { slog.Info("AMD Driver: " + ver) + } else { + // For now this is benign, but we may eventually need to fail compatibility checks + slog.Debug("error looking up amd driver version: %s", err) } gfx := AMDGFXVersions() tooOld := false