fix: use getLlamaGpuTypes("supported") to detect actual GPU availability#243
Open
DanieleSalatti wants to merge 1 commit intotobi:mainfrom
Open
fix: use getLlamaGpuTypes("supported") to detect actual GPU availability#243DanieleSalatti wants to merge 1 commit intotobi:mainfrom
DanieleSalatti wants to merge 1 commit intotobi:mainfrom
Conversation
Without the "supported" argument, getLlamaGpuTypes() returns all GPU types valid for the platform (e.g. "cuda" on any Linux box) rather than only those with actual drivers and libraries installed. This causes QMD to attempt a CUDA build from source on machines without NVIDIA hardware, resulting in a slow CMake failure on every invocation before falling back to CPU.
Author
|
I failed at copy & pasting the draft, updating description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Linux machines without NVIDIA GPUs, QMD attempts to compile llama.cpp with CUDA support on every invocation. This adds ~30 seconds of noisy CMake failures to every
qmdcommand before falling back to CPU.Root cause
getLlamaGpuTypes()called without an argument returns all GPU types valid for the platform — on Linux that's always["cuda", "vulkan", false]regardless of installed hardware. QMD then triesgetLlama({gpu: "cuda"}), which triggers a source build of llama.cpp withGGML_CUDA=1, fails because there's no CUDA toolkit, and falls back to CPU.Fix
Pass
"supported"togetLlamaGpuTypes(), which checks for actual driver/library presence before including a GPU type. This is the intended API per node-llama-cpp docs.Also removes the now-unnecessary @ts-expect-error directive — "supported" is a properly typed argument, so the type suppression was masking the issue.
Testing
Verified on Intel NUC (i7-1165G7, no discrete GPU) running Arch Linux
Before: every QMD command triggers ~30s of CUDA CMake build spam
After: instant startup, correctly detects CPU-only and skips GPU entirely
tsc passes clean with zero errors