Skip to content

Feature Request: vulkan build - with step by step guide and a pull request #89

Description

@scriptnapps

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

U need this fix to run on vulkan 12a345f1518643dc471f9cbf84528313e6aea07b

git fetch origin pull/88/head:pr-88
git checkout pr-88
git submodule update --init --recursive

I used this to compile with vulkan and it worked after a small fix in the code

ran the command without turbo just to test if it runs anything:
llama-cli -m
Qwen_Qwen3.6-35B-A3B-IQ4_XS.gguf
--spec-type dflash --spec-draft-model
qwen36-35b-a3b-dflash-IQ4_XS.gguf
--spec-draft-ngl all --flash-attn on

place this build.bat outside beellama.cpp, it will auto detect
visual studio https://visualstudio.microsoft.com/downloads/
and
vulkan sdk https://vulkan.lunarg.com/sdk/home#windows

@echo off
setlocal enabledelayedexpansion

rem ============================================================
rem  build-bee-vulkan.bat - Build beellama.cpp with Vulkan (MSVC x64)
rem  Usage:  build-bee-vulkan.bat          (Release build)
rem          build-bee-vulkan.bat Debug    (Debug build)
rem          build-bee-vulkan.bat clean    (delete build folder)
rem ============================================================

set "ROOT=%~dp0"
set "SRC=%ROOT%beellama.cpp"
set "BUILD=%ROOT%build-bee-vulkan"
set "CONFIG=Release"

if /i "%~1"=="Debug" set "CONFIG=Debug"
if /i "%~1"=="clean" (
    echo Removing %BUILD% ...
    rmdir /s /q "%BUILD%" 2>nul
    echo Done.
    exit /b 0
)

if not exist "%SRC%\CMakeLists.txt" (
    echo ERROR: beellama.cpp source not found at %SRC%
    exit /b 1
)

rem --- Locate the Vulkan SDK ---
if not defined VULKAN_SDK (
    for /f "delims=" %%d in ('dir /b /ad /o-n "C:\VulkanSDK" 2^>nul') do (
        if not defined VULKAN_SDK set "VULKAN_SDK=C:\VulkanSDK\%%d"
    )
)
if not defined VULKAN_SDK (
    echo ERROR: Vulkan SDK not found. Install it from https://vulkan.lunarg.com/
    exit /b 1
)
if not exist "%VULKAN_SDK%\Bin\glslc.exe" (
    echo ERROR: glslc.exe not found in %VULKAN_SDK%\Bin
    exit /b 1
)
echo Using Vulkan SDK: %VULKAN_SDK%
set "PATH=%VULKAN_SDK%\Bin;%PATH%"

rem --- Locate Visual Studio via vswhere ---
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" (
    echo ERROR: vswhere.exe not found. Is Visual Studio installed?
    exit /b 1
)

for /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSPATH=%%i"
if not defined VSPATH (
    echo ERROR: No Visual Studio with C++ tools found.
    exit /b 1
)
echo Using Visual Studio: %VSPATH%

rem --- Set up the x64 developer environment ---
call "%VSPATH%\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64 -no_logo
if errorlevel 1 (
    echo ERROR: Failed to initialize Visual Studio environment.
    exit /b 1
)

rem --- Use CMake from PATH, or fall back to the one bundled with VS ---
where cmake >nul 2>nul
if errorlevel 1 set "PATH=%VSPATH%\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;%PATH%"

rem --- Configure ---
rem LLAMA_CURL=OFF: curl dev libs are not installed on this machine
cmake -S "%SRC%" -B "%BUILD%" -DGGML_VULKAN=ON -DLLAMA_CURL=OFF -DLLAMA_BUILD_TESTS=OFF
if errorlevel 1 (
    echo ERROR: CMake configure failed.
    exit /b 1
)

rem --- Build ---
cmake --build "%BUILD%" --config %CONFIG% -j %NUMBER_OF_PROCESSORS%
if errorlevel 1 (
    echo ERROR: Build failed.
    exit /b 1
)

echo.
echo ============================================================
echo  beellama Vulkan build succeeded. Binaries are in:
echo    %BUILD%\bin\%CONFIG%
echo ============================================================
pause

Motivation

wanted to use vulkan as its faster then rocm on 9070 xt 16gb

Possible Implementation

could you add vulkan to the pre built's please

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions