File size: 6,476 Bytes
fefef5a cd50f31 fefef5a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | ---
tags:
- benchmark
- amd
- rocm
- gemma4
- local-llm
- linux
- spanish
- latam
language:
- es
- en
license: apache-2.0
---
# Gemma 4 on AMD RX 6700 XT + ROCm
> 🇲🇽 [Versión en Español](#versión-en-español) | 🇺🇸 [English Version](#english-version)
Benchmarks of Google's Gemma 4 (April 2026) running on AMD GPU with ROCm on Linux.
**This documentation doesn't exist in Spanish — for the LatAm community.**
---
## English Version
### Why this matters
Most local AI guides assume:
- NVIDIA GPU (CUDA)
- Apple Silicon (macOS)
- $1,500+ USD budget
This repo documents that a **budget AMD GPU on Linux** running Gemma 4 — released April 2026 — outperforms a brand new Mac Mini M4 in decode speed, at a fraction of the cost.
### Hardware
| Component | Detail |
|-----------|--------|
| GPU | AMD RX 6700 XT 12GB (gfx1031) |
| CPU | AMD Ryzen 5 5600G |
| RAM | 16GB |
| OS | Pop!_OS 24.04 LTS |
| Ollama | 0.20.2 |
| ROCm override | HSA_OVERRIDE_GFX_VERSION=10.3.0 |
### Results (average of 3 runs)
| Model | Prefill (tok/s) | Decode (tok/s) | VRAM | Status |
|-------|----------------|----------------|------|--------|
| gemma4:e2b | 1022.39 | 85.00 | ~2GB | ROCm ✅ full GPU |
| gemma4:e4b | 697.91 | 57.34 | ~4GB | ROCm ✅ full GPU |
| gemma4:26b | 157.94 | 10.70 | 12GB + RAM offload | ROCm ⚠️ partial |
> **Note:** Prefill varies between runs due to KV cache warming.
> Decode is the number that matters for user experience — very consistent.
### Platform comparison (decode ~4B models)
| Hardware | Decode tok/s | Price (approx USD) |
|----------|--------------|--------------------|
| **RX 6700 XT + ROCm (this repo)** | **57-85** | existing hardware |
| Mac Mini M4 16GB | 25-40 | ~$600 new |
| RTX 3070 12GB | 50-80 | ~$500 used |
**The RX 6700 XT doubles the Mac Mini M4 16GB in decode speed for models that fit in VRAM.**
### The gfx1031 problem
The RX 6700 XT reports `gfx1031` architecture, but ROCm doesn't officially support it.
Without the override, Ollama falls back to CPU (~3-5 tok/s).
**Fix:**
```bash
sudo mkdir -p /etc/systemd/system/ollama.service.d
sudo tee /etc/systemd/system/ollama.service.d/rocm-fix.conf << 'CONF'
[Service]
Environment="HSA_OVERRIDE_GFX_VERSION=10.3.0"
Environment="ROCR_VISIBLE_DEVICES=0"
CONF
sudo systemctl daemon-reload
sudo systemctl restart ollama
```
**Verify it worked:**
```bash
journalctl -u ollama -n 10 --no-pager | grep "AMD Radeon"
# Expected output:
# description="AMD Radeon RX 6700 XT" total="12.0 GiB" available="11.1 GiB"
```
### Full setup
```bash
# 1. Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# 2. Apply ROCm fix (see above)
# 3. Pull models
ollama pull gemma4:e2b # 2B - fast, fits easily
ollama pull gemma4:e4b # 4B - great quality, fits in VRAM
ollama pull gemma4:26b # 26B - requires RAM offload on 12GB
# 4. Run
ollama run gemma4:e4b "Hello, what is MLOps?"
```
### Run the benchmark yourself
```bash
chmod +x bench_gemma4.sh
./bench_gemma4.sh
```
Runs 3 iterations per model, saves results to `gemma4_benchmark_results.md`.
---
## Versión en Español
### Por qué esto importa
La mayoría de guías de AI local asumen:
- GPU NVIDIA (CUDA)
- Apple Silicon (macOS)
- Presupuesto de $1,500 USD o más
Este repo documenta que una **GPU AMD de segunda mano en Linux** corriendo Gemma 4 (lanzada en abril 2026) supera en velocidad a un Mac Mini M4 nuevo, a una fracción del costo.
### Hardware
| Componente | Detalle |
|------------|---------|
| GPU | AMD RX 6700 XT 12GB (gfx1031) |
| CPU | AMD Ryzen 5 5600G |
| RAM | 16GB |
| OS | Pop!_OS 24.04 LTS |
| Ollama | 0.20.2 |
| Override ROCm | HSA_OVERRIDE_GFX_VERSION=10.3.0 |
### Resultados (promedio de 3 corridas)
| Modelo | Prefill (tok/s) | Decode (tok/s) | VRAM | Estado |
|--------|----------------|----------------|------|--------|
| gemma4:e2b | 1022.39 | 85.00 | ~2GB | ROCm ✅ GPU completa |
| gemma4:e4b | 697.91 | 57.34 | ~4GB | ROCm ✅ GPU completa |
| gemma4:26b | 157.94 | 10.70 | 12GB + offload a RAM | ROCm ⚠️ parcial |
> **Nota:** El prefill varía entre corridas por el KV cache warming.
> El decode es el número relevante para experiencia de usuario y es muy consistente.
### Comparativa vs otras plataformas (decode modelos ~4B)
| Hardware | Decode tok/s | Precio aprox MXN |
|----------|-------------|-----------------|
| **RX 6700 XT + ROCm (este repo)** | **57-85** | hardware existente |
| Mac Mini M4 16GB | 25-40 | ~$23,000 MXN nuevo |
| RTX 3070 12GB | 50-80 | ~$10,000 MXN usado |
**La RX 6700 XT dobla en velocidad al Mac Mini M4 16GB en modelos que caben en VRAM.**
### El problema del gfx1031
La RX 6700 XT reporta arquitectura `gfx1031` pero ROCm no la tiene en su lista de soporte oficial.
Sin el override, Ollama cae a CPU (~3-5 tok/s).
**Fix:**
```bash
sudo mkdir -p /etc/systemd/system/ollama.service.d
sudo tee /etc/systemd/system/ollama.service.d/rocm-fix.conf << 'CONF'
[Service]
Environment="HSA_OVERRIDE_GFX_VERSION=10.3.0"
Environment="ROCR_VISIBLE_DEVICES=0"
CONF
sudo systemctl daemon-reload
sudo systemctl restart ollama
```
**Verificar que funcionó:**
```bash
journalctl -u ollama -n 10 --no-pager | grep "AMD Radeon"
# Output esperado:
# description="AMD Radeon RX 6700 XT" total="12.0 GiB" available="11.1 GiB"
```
### Setup completo
```bash
# 1. Instalar Ollama
curl -fsSL https://ollama.com/install.sh | sh
# 2. Aplicar fix de ROCm (ver arriba)
# 3. Descargar modelos
ollama pull gemma4:e2b # 2B - rápido, cabe fácil
ollama pull gemma4:e4b # 4B - buena calidad, cabe en VRAM
ollama pull gemma4:26b # 26B - requiere offload a RAM en 12GB
# 4. Correr
ollama run gemma4:e4b "Hola, explica qué es MLOps"
```
### Correr el benchmark tú mismo
```bash
chmod +x bench_gemma4.sh
./bench_gemma4.sh
```
Corre 3 iteraciones por modelo y guarda los resultados en `gemma4_benchmark_results.md`.
### Modelos probados
| Modelo | Parámetros | Tipo | ¿Cabe en 12GB? |
|--------|-----------|------|----------------|
| gemma4:e2b | 2B | Dense | ✅ GPU completa |
| gemma4:e4b | 4B | Dense | ✅ GPU completa |
| gemma4:26b | 26B (4B activos, MoE) | MoE | ⚠️ offload parcial |
---
## About / Sobre este repo
Made in CDMX with second-hand hardware and free software.
Hecho en CDMX con hardware de segunda mano y software libre.
*[Positronica Labs](https://github.com/G10hdz) — Building AI tools for Latin America.*
*Hardware de segunda mano. Software libre. AI para todos.*
|