Fix Vulkan build: add glslc/shader compiler check

- Update build.sh to check for glslc before attempting build
- Update README with correct package names (glslang-tools/glslang)
- Add troubleshooting for missing glslc error
parent 02fb99fa
......@@ -81,18 +81,20 @@ Requires:
- AMD GPU with Vulkan support (RX 400 series and newer)
- Vulkan drivers and SDK
**Install Vulkan drivers:**
**Install Vulkan drivers and tools:**
```bash
# Debian/Ubuntu
sudo apt install libvulkan-dev vulkan-tools mesa-vulkan-drivers
sudo apt install libvulkan-dev vulkan-tools mesa-vulkan-drivers glslang-tools
# Fedora
sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers
sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers glslang
# Arch Linux
sudo pacman -S vulkan-headers vulkan-icd-loader vulkan-radeon
sudo pacman -S vulkan-headers vulkan-icd-loader vulkan-radeon glslang
```
**Note:** The `glslang-tools` (Debian/Ubuntu) or `glslang` (Fedora/Arch) package provides `glslc`, the Vulkan shader compiler required to build llama-cpp-python with Vulkan support.
Models: GGUF format (from HuggingFace or local files)
**Note**: The Vulkan backend uses llama-cpp-python with GGUF models, which provides excellent performance on AMD GPUs without requiring ROCm.
......@@ -604,18 +606,23 @@ python coderai --model TheBloke/Llama-2-7B-GGUF --backend vulkan
**Problem**: "Vulkan backend not available" or llama-cpp fails to load
**Solutions**:
1. **Verify Vulkan drivers are installed:**
1. **Verify Vulkan drivers and shader compiler are installed:**
```bash
# Check Vulkan installation
vulkaninfo | grep "deviceName"
# Check glslc (shader compiler) - REQUIRED for building
glslc --version
# Or install if missing
# Debian/Ubuntu:
sudo apt install libvulkan-dev vulkan-tools mesa-vulkan-drivers
sudo apt install libvulkan-dev vulkan-tools mesa-vulkan-drivers glslang-tools
# Fedora:
sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers
sudo dnf install vulkan-loader-devel vulkan-tools mesa-vulkan-drivers glslang
```
**Note:** `glslc` is required to compile llama-cpp-python with Vulkan support. If you see "Could NOT find Vulkan (missing: glslc)", install the `glslang-tools` (Debian/Ubuntu) or `glslang` (Fedora/Arch) package.
2. **Reinstall llama-cpp-python with Vulkan:**
```bash
......
......@@ -96,8 +96,21 @@ elif [ "$BACKEND" = "vulkan" ]; then
echo -e "${YELLOW}Attempting installation anyway...${NC}"
fi
# Check for glslc (Vulkan shader compiler) which is required for building
if ! command -v glslc &> /dev/null; then
echo -e "${YELLOW}Warning: glslc (Vulkan shader compiler) not found${NC}"
echo -e "${YELLOW}You need to install the shader compiler:${NC}"
echo " Debian/Ubuntu: sudo apt install glslang-tools"
echo " Fedora: sudo dnf install glslang"
echo " Arch: sudo pacman -S glslang"
echo ""
echo -e "${RED}Error: Cannot build llama-cpp-python with Vulkan without glslc${NC}"
exit 1
fi
# Install llama-cpp-python with Vulkan support
# CMAKE_ARGS is used to enable Vulkan during compilation
echo -e "${YELLOW}Building llama-cpp-python with Vulkan support (this may take a few minutes)...${NC}"
CMAKE_ARGS="-DGGML_VULKAN=ON" pip install llama-cpp-python --no-cache-dir
echo -e "${YELLOW}Installing Vulkan-specific requirements...${NC}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment