llama.cpp inference on ROCm#
llama.cpp is an open-source inference engine for running LLMs locally. It runs quantized models efficiently on consumer hardware and has become a pillar of local LLM inference. This page explains how to set up and run llama.cpp on AMD GPUs and APUs.
See also
The lemonade-sdk/llamacpp-rocm
community project publishes nightly llama.cpp builds for Ubuntu that
bundle the ROCm runtime, in per-architecture packages. With one of those
builds you can skip installing ROCm and configuring LD_LIBRARY_PATH;
the AMD GPU driver is still required. It provides builds for all supported
Radeon and Ryzen targets, as well as the Instinct MI200 series (gfx90a)
and MI100 (gfx908).
The lemonade-sdk/llamacpp-rocm community
project publishes nightly llama.cpp builds for Windows that bundle the ROCm
runtime, in per-architecture packages. With one of those builds you can skip
installing ROCm, configuring PATH, and copying the HIP runtime
libraries; the AMD Software: Adrenalin Edition driver is still required.
It provides builds for all supported Radeon and Ryzen targets.
Prerequisites#
To run llama.cpp with ROCm, you need the following prerequisites:
Operating system: Ubuntu 26.04 or 24.04
Operating system: Windows 11
GPU platform: AMD Instinct, AMD Radeon, and AMD Ryzen devices supported by ROCm. Use the device family and GPU selectors to match your hardware.
Group membership: your user must be a member of the
videoandrendergroups.Additional packages:
libgomp1andlibcurl4.Install the additional packages if they are not already present:
sudo apt update && sudo apt install libgomp1 libcurl4
Install ROCm#
llama.cpp requires a ROCm installation on the host system.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Instinct
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: apt (package manager)
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Instinct
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: pip
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Instinct
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: Tarball
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: apt (package manager)
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: pip
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: Tarball
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: pip
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: Tarball
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: apt (package manager)
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: pip
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: Tarball
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: pip
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 7.14.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: Tarball
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Instinct
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: apt (package manager)
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Instinct
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: pip
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Instinct
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: Tarball
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: apt (package manager)
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: pip
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: Tarball
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: pip
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Radeon
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: Tarball
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: apt (package manager)
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: pip
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Ubuntu
Installation method: Tarball
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: pip
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
See the Install ROCm 10.0.0 guide for instructions; use the selector on the page to update the instructions based on your environment. Your ROCm installation should target the same environment you plan to install llama.cpp in.
Device family: AMD Ryzen
Select your GPU – importantly,
gfxarchitecture – from the dropdown list.Use case: Compute
Operating system: Windows
Installation method: Tarball
Important
When installing via package manager, ROCm is installed system-wide
under /opt/rocm. This is the installation method the ROCm
documentation recommends if you are unsure which to choose.
Install the libraries extra and the device extra matching your GPU, for example
rocm[libraries,device-gfx1201]. The devel extra is not required to run the
prebuilt llama.cpp binaries; it supplies the rocm-sdk command-line tool and
build-time files only.
Record the path of the virtual environment you create. You need it to Configure your environment.
This guide assumes ROCM_PATH and LD_LIBRARY_PATH are set according to the
ROCm installation via tarball instructions.
Install llama.cpp#
AMD does not publish its own binaries for llama.cpp. Download a prebuilt ROCm-enabled release from the llama.cpp releases page. Release assets are named in the following format:
llama-<build>-bin-ubuntu-rocm-10.0-x64.tar.gz
For ROCm 10.0, that is any asset containing ubuntu-rocm-10.0, for
example llama-b10864-bin-ubuntu-rocm-10.0-x64.tar.gz.
Extract the archive:
tar -xf llama-b10864-bin-ubuntu-rocm-10.0-x64.tar.gz
The archive extracts into a directory named after the build, for example llama-b10864.
llama-<build>-bin-win-rocm-10.0-x64.zip
For ROCm 10.0, that is any asset containing win-rocm-10.0, for example
llama-b10864-bin-win-rocm-10.0-x64.zip.
Extract the archive. This guide assumes you extract to C:\llamacpp.
tar -xf llama-b10864-bin-win-rocm-10.0-x64.zip -C C:\llamacpp
llama-<build>-bin-ubuntu-rocm-7.14-x64.tar.gz
For ROCm 7.14, that is any asset containing ubuntu-rocm-7.14, for
example llama-b10628-bin-ubuntu-rocm-7.14-x64.tar.gz.
Extract the archive:
tar -xf llama-b10628-bin-ubuntu-rocm-7.14-x64.tar.gz
The archive extracts into a directory named after the build, for example llama-b10628.
llama-<build>-bin-win-rocm-7.14-x64.zip
For ROCm 7.14, that is any asset containing win-rocm-7.14, for example
llama-b10628-bin-win-rocm-7.14-x64.zip.
Extract the archive. This guide assumes you extract to C:\llamacpp.
tar -xf llama-b10628-bin-win-rocm-7.14-x64.zip -C C:\llamacpp
Note
The archive contains only the llama.cpp executables and their ggml
backend libraries. It does not include the ROCm runtime, which must be
installed separately as described in the previous section.
Configure your environment#
llama.cpp loads the ROCm math libraries at run time and must be able to find them.
ROCm libraries are installed in /opt/rocm/lib. This directory is not added to the
system library search path by the packages, so add it to LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH
A pip installation places the ROCm runtime inside the virtual environment, in two directories:
<venv>/lib/python<version>/site-packages/_rocm_sdk_core/lib<venv>/lib/python<version>/site-packages/_rocm_sdk_libraries/lib
Add both to LD_LIBRARY_PATH, replacing <venv> with the path of your virtual
environment.
SP=<venv>/lib/python3.14/site-packages
export LD_LIBRARY_PATH="$SP/_rocm_sdk_core/lib:$SP/_rocm_sdk_libraries/lib:$LD_LIBRARY_PATH"
SP=<venv>/lib/python3.12/site-packages
export LD_LIBRARY_PATH="$SP/_rocm_sdk_core/lib:$SP/_rocm_sdk_libraries/lib:$LD_LIBRARY_PATH"
Note
Activating the virtual environment is not sufficient. It sets PATH, which ROCm’s
own tools use, but not LD_LIBRARY_PATH, which the llama.cpp executables need.
The tarball installation instructions
already set LD_LIBRARY_PATH to $ROCM_PATH/lib. No further
configuration is required.
The tarball installation instructions
already set LD_LIBRARY_PATH to $ROCM_PATH/lib. No further
configuration is required.
To make any of these settings permanent, update your shell startup file;
~/.bashrc, for instance.
llama.cpp loads the ROCm math libraries at run time and must be able to find them.
A pip installation places the ROCm runtime inside the virtual environment in two directories:
<venv>\Lib\site-packages\_rocm_sdk_core\bin<venv>\Lib\site-packages\_rocm_sdk_libraries\bin
Add both to your PATH in the command prompt you use to launch llama.cpp,
replacing <venv> with the actual path of your virtual environment, for
example:
set "PATH=C:\llamacpp\.venv\Lib\site-packages\_rocm_sdk_core\bin;C:\llamacpp\.venv\Lib\site-packages\_rocm_sdk_libraries\bin;%PATH%"
This setting applies to the current command prompt only. To make it
permanent, add both directories to your user or system PATH in your
Windows settings.
The tarball installation instructions
already add C:\TheRock\build\bin to the system PATH. No further
configuration is required.
The tarball installation instructions
already add C:\TheRock\build\bin to the system PATH. No further
configuration is required.
If the ROCm libraries are not on your PATH, llama.cpp does not report an
error. It silently falls back to the CPU backend and runs several times
slower. Use Verify the installation to confirm
the GPU is detected.
Copy the HIP runtime libraries#
Copy the following three files from your ROCm installation into the directory
that contains llama-cli.exe: <venv>\Lib\site-packages\_rocm_sdk_core\bin
amdhip64_7.dllrocm_kpack.dllamd_comgr.dll
Copy all three files. Copying amdhip64_7.dll on its own prevents
llama.cpp from using the GPU: the HIP runtime supplied by ROCm depends on
the matching rocm_kpack.dll and amd_comgr.dll, and
rocm_kpack.dll is not present in System32.
copy "<venv>\Lib\site-packages\_rocm_sdk_core\bin\amdhip64_7.dll" C:\llamacpp\
copy "<venv>\Lib\site-packages\_rocm_sdk_core\bin\rocm_kpack.dll" C:\llamacpp\
copy "<venv>\Lib\site-packages\_rocm_sdk_core\bin\amd_comgr.dll" C:\llamacpp\
Copy the following three files from your ROCm installation into the directory
that contains llama-cli.exe: C:\TheRock\build\bin
amdhip64_7.dllrocm_kpack.dllamd_comgr.dll
Important
Copy all three files. Copying amdhip64_7.dll on its own prevents
llama.cpp from using the GPU: the HIP runtime supplied by ROCm depends on
the matching rocm_kpack.dll and amd_comgr.dll, and
rocm_kpack.dll is not present in System32.
copy "C:\TheRock\build\bin\amdhip64_7.dll" C:\llamacpp\
copy "C:\TheRock\build\bin\rocm_kpack.dll" C:\llamacpp\
copy "C:\TheRock\build\bin\amd_comgr.dll" C:\llamacpp\
Note
The AMD display driver installs its own copy of amdhip64_7.dll in
C:\Windows\System32. Windows searches System32 before PATH, so
the driver’s version is loaded in preference to the one supplied by ROCm,
even when ROCm is on PATH. Because Windows searches the directory
containing the executable first, copying these libraries next to
llama-cli.exe ensures the ROCm version is used.
Verify the installation#
List the devices visible to llama.cpp:
# Replace <build> with your llama.cpp build number
cd llama-<build>
./llama-cli --list-devices
The output shows the detected GPU and its available memory:
Available devices:
ROCm0: AMD Radeon RX 9070 XT (16304 MiB, 15770 MiB free)
If Available devices is empty, the ROCm libraries were not found. Review
Configure your environment.
If instead you see error while loading shared libraries: libgomp.so.1, install
the additional packages listed in System requirements.
Listing the devices confirms that the ROCm libraries were found, but it does not confirm that computation runs on the GPU. To verify that, run a short benchmark with a model in GGUF format; see Run a llama.cpp example.
List the devices visible to llama.cpp. Make sure to cd into where the llama.cpp
binaries are located and that you’re in the same shell in which you set your PATH.
cd C:\llamacpp
llama-cli.exe --list-devices
The output shows the detected GPU and its available memory. For example:
Available devices:
ROCm0: AMD Radeon RX 7900 XT (20464 MiB, 20315 MiB free)
If the device is listed but the reported memory is 0 MiB, the installation
is not usable. This occurs when the LLVM_PATH environment variable is set,
which the ROCm tarball instructions do system-wide. Copying the HIP runtime
libraries as described in the previous section resolves it. Alternatively, clear LLVM_PATH
before running llama.cpp.
If no devices are listed at all, the ROCm runtime cannot be found. Review Configure your environment.
Select the GPUs to use#
Systems with both a discrete GPU and an integrated GPU report more than one ROCm device:
Available devices:
ROCm0: AMD Radeon RX 9070 XT (16304 MiB, 15770 MiB free)
ROCm1: AMD Radeon Graphics (63199 MiB, 63174 MiB free)
The integrated GPU reports a large amount of shared system memory and may not be a
supported ROCm device. To restrict llama.cpp to specific GPUs, set
HIP_VISIBLE_DEVICES to a comma-separated list of their indices:
# Use ROCm0 only
export HIP_VISIBLE_DEVICES=0
# Use ROCm0 and ROCm1 together, for example two discrete GPUs
export HIP_VISIBLE_DEVICES=0,1
The indices refer to the devices as numbered in the --list-devices output.
llama.cpp distributes a model across all visible GPUs, so listing more than one
lets you run models that do not fit in the memory of a single GPU.
Alternatively, pass the devices to a single command with --device, using the
names from --list-devices rather than the indices:
./llama-cli -m <model>.gguf -ngl 999 --device ROCm0,ROCm1
Run a llama.cpp example#
Once your llama.cpp environment is set up, experiment with the following steps to run a model and benchmark your installation. The prebuilt llama.cpp release includes the executables to exercise the functionality of your installation.
The two most popular use cases are:
llama-cli: The main executable to run the model interactively or get a response to a prompt.llama-bench: Run a benchmark of your model with different configurations.
See also
See GGUF models for llama.cpp for a list of GGUF-formatted models available to download from Hugging Face.
The following examples assume the llama.cpp executables are in your
llama-<build> directory from the previous installation step and you’ve downloaded a model in GGUF format to run.
The following examples assume the llama.cpp executables are in C:\llamacpp
and you’ve downloaded a model in GGUF format to run.
llama-cli#
Use the CLI tool to start the client, replacing
<model>.ggufwith the path to a model on your system:# Replace <build> with your llama.cpp build number cd llama-<build> ./llama-cli -m <model>.gguf -ngl 999
cd C:\llamacpp llama-cli.exe -m <model>.gguf -ngl 999
A prompt appears when the client is ready, and you can start interacting with the model:
> Explain what a GPU kernel is in one sentence. A GPU kernel is a specialized program within a GPU (Graphics Processing Unit) designed to execute instructions for rendering graphical content, such as images or video, on a GPU's hardware architecture. [ Prompt: 593.4 t/s | Generation: 286.4 t/s ]
To exit, enter
/exitor pressCtrl+C.
To send a single prompt and exit instead of starting an interactive session, add the -p and -st flags:
./llama-cli -m <model>.gguf -p "Explain what a GPU kernel is in one sentence." -ngl 999 -st
llama-cli.exe -m <model>.gguf -p "Explain what a GPU kernel is in one sentence." -ngl 999 -st
Note
Without -st, llama-cli answers the prompt supplied by -p and
then continues waiting for further input. Use ./llama-completion for
non-interactive generation.
Without -st, llama-cli answers the prompt supplied by -p and
then continues waiting for further input. Use llama-completion.exe for
non-interactive generation.
llama-bench#
Use the CLI tool to start the application, replacing
<model>.ggufwith the path to a model on your system:./llama-bench -m <model>.gguf -p 16,32,64,128,256,512,1024 -n 64,128 -ngl 999
llama-bench.exe -m <model>.gguf -p 16,32,64,128,256,512,1024 -n 64,128 -ngl 999
The result of the command above should be similar to the following when running on an AMD Radeon RX 7900 XT system:
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 20464 MiB): Device 0: AMD Radeon RX 7900 XT, gfx1100 (0x1100), VMM: no, Wave Size: 32, VRAM: 20464 MiB load_backend: loaded ROCm backend from /home/user/llama-b10539/libggml-hip.so load_backend: loaded RPC backend from /home/user/llama-b10539/libggml-rpc.so load_backend: loaded CPU backend from /home/user/llama-b10539/libggml-cpu-haswell.so
ggml_cuda_init: found 1 ROCm devices (Total VRAM: 20464 MiB): Device 0: AMD Radeon RX 7900 XT, gfx1100 (0x1100), VMM: no, Wave Size: 32, VRAM: 20464 MiB load_backend: loaded ROCm backend from C:\llamacpp\ggml-hip.dll load_backend: loaded RPC backend from C:\llamacpp\ggml-rpc.dll load_backend: loaded CPU backend from C:\llamacpp\ggml-cpu-haswell.dll
| model | size | params | backend | ngl | test | t/s | | ------------------------------ | ---------: | ---------: | ---------- | --: | --------------: | -------------------: | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp16 | 2406.95 ± 704.75 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp32 | 3842.56 ± 500.15 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp64 | 7104.29 ± 1218.73 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp128 | 8628.19 ± 928.69 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp256 | 16444.29 ± 1662.23 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp512 | 24628.13 ± 2498.10 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | pp1024 | 26143.12 ± 73.58 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | tg64 | 373.29 ± 9.81 | | qwen2 1B Q4_K - Medium | 462.96 MiB | 630.17 M | ROCm | 999 | tg128 | 375.70 ± 3.49 | build: 78ec4c378 (10539)
The
backendcolumn showsROCmwhen the GPU is in use. If it showsCPU, the ROCm libraries were not found. Review Configure your environment to troubleshoot.
You can enable Flash Attention using -fa 1:
./llama-bench -m <model>.gguf -p 512 -n 64 -ngl 999 -fa 1
llama-bench.exe -m <model>.gguf -p 512 -n 64 -ngl 999 -fa 1