Skip to content

Windows: GPU never re-detected after swapping CPU build for NVIDIA build in the same data dir #316

Closed

Description

@thcp

Summary

On Windows desktop, a user with an NVIDIA GPU who upgrades/switches from the CPU portable build to the NVIDIA build — reusing the same %LOCALAPPDATA%\StemDeck data dir — stays pinned to CPU. Stem separation runs on CPU and Settings shows CUDA (NVIDIA) — not available, despite a working GPU + driver and CUDA torch bundled in the NVIDIA build. The only recovery today is manually deleting %LOCALAPPDATA%\StemDeck and relaunching.

Root cause

The setup gate in desktop/ui/setup.js treats a persisted cpu-only-package device reason as permanently settled:

const torchDeviceSettled =
  runtime.torchDevice === "cuda" || runtime.torchDevice === "mps" ||
  (runtime.torchDevice === "cpu" && runtime.torchDeviceReason === "cpu-only-package");

When torchDeviceSettled is true (and version matches, which it always does on Windows — no runtime pack), setup early-returns and skips ensure_torch_device entirely. But ensure_torch_device is exactly the function whose clear_stale_cpu_marker + GPU re-probe (#247) would heal the swap. So the self-heal built for this case never gets to run.

The cpu-only-package reason is only valid while the current install is still the CPU-only build. After an in-place swap to the NVIDIA (CUDA) build, that assumption is stale but never re-checked.

Fix

Cross-check the persisted cpu-only-package reason against the current install (is_cpu_only_package(root)). If the persisted reason says CPU-only but the current package is not cpu-only, invalidate the reason so the device is treated as unsettled and setup re-runs ensure_torch_device (which clears the stale marker, detects the GPU, and persists cuda/verified). This reuses the existing #247 "unsettled reason self-heals" path — one heal, then it records the correct device and subsequent launches match.

Scope

  • Windows desktop: affected — this fix.
  • macOS desktop: not affected (uses versioned runtime pack; mps/mps-unavailable reasons are not treated as permanently settled).
  • Docker / self-hosted: not affected (no Tauri app / no persisted-device machinery; image upgrades are clean replacements; Linux torch is CUDA).

Separately tracked follow-up: make the Windows NVIDIA build install cu124 torch explicitly in make-portable.ps1 so its GPU support is reproducible rather than an implicit property of the CI runner's PyPI resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions