fix(llama): respect NODE_LLAMA_CPP_GPU override#250
Closed
fix(llama): respect NODE_LLAMA_CPP_GPU override#250
Conversation
Author
|
Maybe non-critical, but on my particular setup qmd completely fails to detect my fully-functional AMD GPU (yes, I do have Vulkan installed properly; in fact with the fix above it works well) |
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 some systems with AMD GPUs (and potentially others),
getLlamaGpuTypes()returns an empty array even when Vulkan is available. This causes QMD to fall back to CPU-only mode, which is significantly slower for embedding operations.Root Cause
While the detection logic looks correct (see src/bindings/utils/getLlamaGpuTypes.ts), it appears to fail on some Linux/Vulkan configurations (tested on AMD 7900 XTX). The exact root cause is unclear - could be path resolution issues or async handling.
Solution
Check for
NODE_LLAMA_CPP_GPUenvironment variable before calling the potentially broken auto-detection. This allows users to explicitly specify their preferred GPU backend (cuda, metal, or vulkan).Why this variable? Because it is what
node-llama-cppalready uses: src/config.ts#L56Why this approach:
Usage:
Force Vulkan on AMD GPUs
Testing:
References: