Repository navigation
fix(studio): prefer CUDA llama-server build over CPU build on Windows - #5969
LeoBorcherding wants to merge 6 commits into
Conversation
When both build/bin/Release/llama-server.exe (CPU-only cmake build) and build-cuda/bin/Release/llama-server.exe (CUDA cmake build) exist under the same install root on Windows, _find_llama_server_binary() would always pick the CPU build because build/ sorts before build-cuda/ in the fixed search order. On machines with an NVIDIA GPU this causes GGUF inference to silently fall back to CPU even when a working CUDA binary is present alongside it. Fix: add a _nvidia_available() helper that runs 'nvidia-smi -L' and check build-cuda/bin/Release/ before build/bin/Release/ on Windows when NVIDIA is detected. The check is applied in all three cmake Windows sections: UNSLOTH_LLAMA_CPP_PATH, standard ~/.unsloth/llama.cpp search, and legacy in-tree build. Each section logs an INFO message when the CUDA build is selected so the choice is visible in Studio logs.
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to prefer the CUDA build of llama-server over the CPU build on Windows when an NVIDIA GPU is detected via nvidia-smi. However, the implementation incorrectly references LlamaCppServer._nvidia_available() instead of LlamaCppBackend._nvidia_available(), which will result in a NameError at runtime in multiple locations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac5fd93263
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…available() calls
|
Tested on Windows with RTX 5060 Ti: Manually reproduced the bug and verified the fix by importing Silently picks the CPU path with no log output, despite NVIDIA GPU being present. Correctly prefers the CUDA build and logs the decision visibly. Test plan item 1 confirmed - NVIDIA Windows with both builds present picks CUDA and logs |
Covers _find_llama_server_binary preferring the build-cuda cmake build over the CPU build/bin/Release build when NVIDIA is present (UNSLOTH_LLAMA_CPP_PATH and ~/.unsloth/llama.cpp paths), CPU fallback when no GPU is detected, a CUDA-only install not being selected without NVIDIA, Linux discovery being unchanged with the nvidia probe never running, and the _nvidia_available return values across nvidia-smi success, non-zero exit, missing GPU token, timeout, and missing binary.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c61188327e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Fixes #5941
Problem
On Windows, when both a CPU-only cmake build (
build/bin/Release/llama-server.exe) and a CUDA cmake build (build-cuda/bin/Release/llama-server.exe) exist under the same install root,_find_llama_server_binary()always picks the CPU build becausebuild/appears first in the fixed search order. On machines with an NVIDIA GPU this causes GGUF inference to silently fall back to CPU even when a working CUDA binary is present.Fix
_nvidia_available()static method — runsnvidia-smi -Lwith a 5s timeout_find_llama_server_binary()now checkbuild-cuda/bin/Release/beforebuild/bin/Release/when NVIDIA is detectedTest plan
build/andbuild-cuda/present: Studio should pick the CUDA build and log "Preferring CUDA llama-server build"build/bin/Release/still used