Skip to content
lemonade-sdkPublic
forked from ggml-org/llama.cpp

About

LLM inference in C/C++

Resources

Stars

13 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

8,865 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Lemonade llama.cpp fork

This repo is a "Github actions only" fork of llama.cpp that is built with more ROCm releases than upstream llama.cpp supports.

These are built for the purpose of Lemonade use, but they can be utilized by any project. Releases just need to be used with matching AMD ROCm SDK releases — see Using the ROCm builds.

Cadence

The builds are triggered every 12 hours, or can optionally be triggered on demand as well. A release is published when upstream llama.cpp has new commits, or to fill in a build an earlier run could not publish. The release tag is upstream's build number (b<count>), so a change to this repository alone ships with the next upstream commit.

Every ROCm build is checked before it is published — statically, and by running a model on an AMD Strix Halo (gfx1151) GPU on Windows and Linux. A ROCm version is published only when both its Windows and Linux builds pass both kinds of check. See .github/qualify-rocm.

Using the ROCm builds

Lemonade does all of this for you.

If you instead want to use a build on its own, follow these steps:

1. Find your GPU's gfx target

Every AMD GPU has a gfx target, for example:

GPU gfx target
Ryzen AI Max (Radeon 8060S, Strix Halo) gfx1151
Ryzen AI 300 (Radeon 890M) gfx1150
Ryzen 7040/8040 (Radeon 780M) gfx1103
Radeon RX 7900 XT/XTX gfx1100
Radeon RX 9070/9070 XT gfx1201

llama-server also prints it when started with -lv 4, in a line like Device 0: AMD Radeon(TM) 8060S Graphics, gfx1151 (0x1151).

The builds include code for gfx1010–gfx1012, gfx1030–gfx1036, gfx1100–gfx1103, gfx1150–gfx1153, gfx1200 and gfx1201, and on Linux also gfx908, gfx90a, gfx942 and gfx950.

They also include gfx1170 and gfx1171 (ROCm 10.1 and 10.2) and, on Linux, gfx900, gfx906 and gfx90c, but AMD's pip indexes have no runtime package (device-<gfx>) for those five, so step 3 does not work for them.

2. Download a build

On the Releases page, open the newest release that lists ROCm downloads. Not every release has them: when a ROCm version does not pass its checks, the release says so under "Not in this release". Pick one ROCm version (7.14, 10.0, 10.1 or 10.2) and download your OS's archive:

  • Windows: llama-b<N>-bin-win-rocm-<version>-x64.zip
  • Linux: llama-b<N>-bin-ubuntu-rocm-<version>-x64.tar.gz (Ubuntu 24.04 or newer)

You also need a model in GGUF format, for example Qwen3-0.6B-Q4_0.gguf (~380 MB), the one the release checks use.

3. Install the matching ROCm runtime

The ROCm archives contain llama.cpp (llama-server, the other tools and their libraries), and the Windows zip also the HIP runtime, but not ROCm's math libraries (hipBLAS, hipBLASLt, rocBLAS). Those come from AMD's ROCm runtime, installed with pip, and it must be the same ROCm version as the archive:

Archive Package index Version
rocm-7.14 https://repo.amd.com/rocm/whl-multi-arch/ 7.14.0
rocm-10.0, rocm-10.1, rocm-10.2 https://stable.repo.amd.com/rocm/whl-next/ 10.0.0, 10.1.0, 10.2.0

Pin the version exactly (==7.14.0, not 7.14.*): the 7.14 index also carries later 7.14 releases.

Use Python 3.12 or 3.13. The commands below are for ROCm 10.2 on a gfx1151; replace the index, the version and gfx1151 with yours.

Windows (PowerShell):

python -m venv rocm-10.2
.\rocm-10.2\Scripts\python.exe -m pip install --index-url https://stable.repo.amd.com/rocm/whl-next/ "rocm[libraries,device-gfx1151]==10.2.0"

Linux:

python3 -m venv rocm-10.2
./rocm-10.2/bin/python -m pip install --index-url https://stable.repo.amd.com/rocm/whl-next/ "rocm[libraries,device-gfx1151]==10.2.0"

4. Unpack and start llama-server

Windows (PowerShell, from the folder holding rocm-10.2):

Expand-Archive llama-b<N>-bin-win-rocm-10.2-x64.zip -DestinationPath llama
$site = "$PWD\rocm-10.2\Lib\site-packages"
$env:PATH = "$site\_rocm_sdk_core\bin;$site\_rocm_sdk_libraries\bin;$env:PATH"
.\llama\llama-server.exe -m Qwen3-0.6B-Q4_0.gguf --port 8080

Keep the amdhip64_7.dll, amd_comgr.dll and rocm_kpack.dll that came in the zip next to llama-server.exe. Windows looks for DLLs in the program's folder before System32, so they win over the amdhip64_7.dll the AMD display driver puts there, which can be a different version.

Linux (from the folder holding rocm-10.2):

tar -xzf llama-b<N>-bin-ubuntu-rocm-10.2-x64.tar.gz
SITE=$(./rocm-10.2/bin/python -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")
export LD_LIBRARY_PATH="$SITE/_rocm_sdk_core/lib:$SITE/_rocm_sdk_libraries/lib:$LD_LIBRARY_PATH"
./llama-b<N>/llama-server -m Qwen3-0.6B-Q4_0.gguf --port 8080

5. Send a request

Open http://127.0.0.1:8080 in a browser to chat, or call the OpenAI-style API. Qwen3 thinks before it answers: the answer is in choices[0].message.content, the thinking in reasoning_content, and max_tokens must leave room for both.

Windows (PowerShell):

$body = '{"messages":[{"role":"user","content":"What is the capital of France?"}],"max_tokens":512}'
$r = Invoke-RestMethod -Uri http://127.0.0.1:8080/v1/chat/completions -Method Post -ContentType "application/json" -Body $body
$r.choices[0].message.content

Linux:

curl -s http://127.0.0.1:8080/v1/chat/completions -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"What is the capital of France?"}],"max_tokens":512}' \
  | python3 -c "import json, sys; print(json.load(sys.stdin)['choices'][0]['message']['content'])"

Is it using the GPU?

A build that cannot use the GPU still works — on the CPU, slower, without an error.

Start llama-server with -lv 4 as its first option (before -ngl, if you pass that), for example .\llama\llama-server.exe -lv 4 -m Qwen3-0.6B-Q4_0.gguf --port 8080, and check its output for:

Device 0: AMD Radeon(TM) 8060S Graphics, gfx1151 (0x1151), VMM: no, Wave Size: 32, VRAM: 107131 MiB
load_backend: loaded ROCm backend from ...ggml-hip.dll
llama_prepare_model_devices: using device ROCm0 (AMD Radeon(TM) 8060S Graphics) (0000:c3:00.0) - 106971 MiB free
load_tensors:        ROCm0 model buffer size =   358.78 MiB

The Device line and the last two are what the release checks require. offloaded 29/29 layers to GPU proves nothing: it is printed on the CPU too.

Running on the CPU, none of these lines appear, and the model buffers are CPU_Mapped.

Troubleshooting

Symptom Cause
Answers arrive, but the -lv 4 output has no loaded ROCm backend line llama-server did not find the ROCm runtime, so it runs on the CPU without saying why: the runtime is not installed (step 3) or not on PATH / LD_LIBRARY_PATH (step 4)
error while handling argument "--device": invalid device: ROCm0 The same, with --device ROCm0 given
Windows: llama-server.exe exits at once with code -1073741515 (0xC0000135) A DLL it needs is missing. The zip does not include the Microsoft Visual C++ runtime (msvcp140.dll, vcruntime140.dll); install the Visual C++ Redistributable (x64)

About

LLM inference in C/C++

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors