AMD dropped ROCm for Polaris/GCN4 in v5.x. DirectML crashes with OpaqueTensorImpl. OpenVINO fails silently on Forge. The mainstream AI stack gave up on this card.
We didn't.
By compiling llama.cpp and stable-diffusion.cpp from source with Vulkan support, the RX 580 runs real, useful AI inference in 2026 — locally, offline, privately. This repository is the complete technical record of how.
Windows 10 Pro + WSL2 Ubuntu 22.04.5 / Ubuntu 26.04 LTS
AMD Driver
31.0.21924.61 (Amdnolk, Nov 2025)
Vulkan SDK
1.4.341.1
CMake
4.3.2
RX 580 2048SP note: The mining-variant with 2048 shader processors (vs the original 2304SP) performs identically through Vulkan. Both are Polaris/GCN4.
NVMe impact: Upgrading from HDD to NVMe reduced FLUX.1 model load time from 25 minutes to ~30 seconds. Storage is as critical as compute.
Benchmarks (Real Logs)
Workload
Model
Backend
Result
LLM inference
Mistral 7B Q4_K_M
RX 580 Vulkan
17–18 tok/s
LLM inference
Qwen3 4B Q4_K_M
RX 580 Vulkan (Linux)
~35 tok/s
LLM baseline
Mistral 7B Q4_K_M
Xeon CPU pure
3–5 tok/s
Image gen
DreamShaper 8 (SD 1.5)
RX 580 Vulkan
~72s / 512×512
Image gen
flux1-schnell-q4_k
GPU+CPU hybrid
~14 min @ 1024×1024
Image gen
FLUX.1 fp8 (16GB)
Xeon WSL2 CPU
~24 min
Audio transcription
Whisper large-v3-turbo
RX 580 Vulkan (Windows)
307s for 15min audio
Audio transcription
Whisper large-v3-turbo
RX 580 Vulkan (Linux)
23.58s for 106s audio
Video / AnimateDiff
SD 1.5 pipeline
Xeon WSL2 CPU
~141s/frame
Voice clone inference
Applio RVC
Xeon CPU (2h audio)
~30 min processing
Whisper on Linux (Mesa RADV) is absurdly faster than Windows — ~150× speedup over pure CPU. VRAM usage: only 1.6GB of 8GB available.
Architecture: Dual-Path Stack
The core insight of this project: not every workload fits in 8GB of VRAM. The solution is routing intelligently between GPU and CPU rather than forcing everything through one path.
If you see 3–5 t/s with no ggml_vulkan line — it's running on CPU. Check that --device Vulkan0 is present.
Quick Start: Image Generation via Vulkan
powershell
1# Clone with submodules (required for ggml dependency)2git clone --recursive https://github.com/leejet/stable-diffusion.cpp3cd stable-diffusion.cpp4mkdir build && cd build
5cmake ..-DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release
6cmake --build .--config Release -j20
78# Successful build log:9# -- Found Vulkan: C:/VulkanSDK/1.4.341.1/Lib/vulkan-1.lib10# [100%] Built target sd-server ✅1112# Start SD server (SD 1.5)13E:
14cd "E:\stable-diffusion.cpp\build\bin\Release"15.\sd-server.exe --listen-ip 0.0.0.0 --listen-port 7860 `
16-m "E:\models\dreamshaper8.gguf"1718# Server output confirms GPU:19# ggml_vulkan: 0 = AMD Radeon RX 580 2048SP | VRAM: 8192MB20# Server listening on http://0.0.0.0:7860 ✅
Flag compatibility note: Older builds use --host / --port. Newer builds (master-600+) use --listen-ip / --listen-port. Run sd-server.exe --help to check which your build expects.
FLUX Hybrid Setup (GPU + CPU)
FLUX.1 Schnell requires ~16GB total. The strategy: put the diffusion model on VRAM, offload T5XXL and VAE to RAM.
--vae-tiling is not optional — without it, VAE decode causes OOM and crashes the server.
To save RAM: replace t5xxl_fp16 (~9.3GB) with t5xxl_fp8 (~5GB).
Go to http://localhost:3000 → Admin Panel → Settings → Connections
Under OpenAI API, add:
URL: http://host.docker.internal:8081/v1
API Key: sk-local
Green badge = connected ✅
Connect image server:
Settings → Images → Engine: Automatic1111
URL: http://192.168.x.x:7860/ (use your local IP, not 127.0.0.1, with trailing slash)
Never use 127.0.0.1 for Docker connections — Docker runs in an isolated network and cannot reach the host's localhost. Use host.docker.internal for services, or your machine's LAN IP.
Windows Firewall fix (Docker subnet blocked by default):
powershell
1# Run as Administrator2New-NetFirewallRule-DisplayName "sd-server AIVisionsLab" `
3-Direction Inbound -Protocol TCP -LocalPort 7860 -Action Allow
⚠️ WSL2 does not expose the RX 580 to Vulkan — always use native Windows PowerShell for GPU transcription.
⚠️ --translate only outputs English. For other target languages, add a translation step after.
Applio RVC: Voice Cloning on AMD Windows
Full pipeline: Text → Balabolka (TTS) → WAV → Applio RVC (voice conversion) → final audio
Why this pipeline instead of pure TTS:
Aspect
Pure XTTS
Antônio Neural → Yuri RVC
Prosody
Artificial
Human (real actor)
Long texts
Degrades
Stable
Vocal identity
Generic
Cloned
Naturalness
60–70%
80–95%
Key findings for AMD Windows (2026):
DirectML acceleration is effectively dead — torch-directml requires torch==2.4.1 while Applio requires torch==2.7.1. The version conflict is irreconcilable. Use CPU mode — it works, just takes time.
Training speed on Xeon E5-2690 v3: ~6 min/epoch. 200 epochs = ~20 hours.
Critical gotchas:
powershell
1# NEVER set these — they silently break feature extraction:2# set CUDA_VISIBLE_DEVICES=-13# set ROCM_VISIBLE_DEVICES=-14# They leave logs/project/extracted/ empty, training "succeeds" but produces nothing.56# Always verify after extraction:7dir logs\my-project\extracted\ # Must contain .npy files
Create required mute files (missing from git install):
powershell
1python -c "
2import numpy as np, soundfile as sf, os
3[os.makedirs(d, exist_ok=True) for d in [
4 'logs/mute/sliced_audios','logs/mute/extracted',
5 'logs/mute/f0','logs/mute/f0_voiced'
6]]
7sf.write('logs/mute/sliced_audios/mute40000.wav', np.zeros(int(40000*3.7)), 40000)
8sf.write('logs/mute/sliced_audios/mute48000.wav', np.zeros(int(48000*3.7)), 48000)
9np.save('logs/mute/extracted/mute.npy', np.zeros((196, 768))) # shape (196,768) critical
10np.save('logs/mute/f0/mute.wav.npy', np.zeros(100))
11np.save('logs/mute/f0_voiced/mute.wav.npy', np.zeros(100))
12print('OK')
13"
AnimateDiff injects temporal attention modules into SD 1.5, converting still-image diffusion into coherent video loops. Runs on Xeon CPU via ComfyUI in WSL2.
--vae-tiling is mandatory on Linux too — without it, VAE decode crashes the GNOME display server.
Avoid --backend vulkan0 for heavy models on Linux — causes context-loss bugs.
⚠️ ROCm is not usable on Polaris/GCN4. AMD dropped support. Running Ollama with GPU via Docker on RX 580 will fail. Use llama-server compiled with Vulkan instead, and keep Docker for frontends only.
Windows vs Linux Benchmarks
Workload
Windows 10
Ubuntu 26.04 (Mesa RADV)
Winner
LLM Qwen3 4B @ 99 layers
~15–17 tok/s
~35 tok/s
🏆 Linux (2×)
LLM Qwen3.6 35B @ max layers
7.62 tok/s (max 10 layers)
5.18 tok/s (max 20 layers)
⚖️ Technical tie
SD 1.5 DreamShaper (50 steps)
~72s
~85s
🏆 Windows
FLUX Schnell (4 steps, 512×512)
~84s
~52s sampling (~95s total)
🏆 Linux
Whisper large-v3-turbo (106s audio)
307s · 2.6GB VRAM
23.58s · 1.6GB VRAM
🏆 Linux (absurd)
Why Linux is faster for LLM: Mesa RADV allows up to 20 GPU layers for the 35B model where Windows AMD drivers cap at 10. For smaller models, RADV's memory management is simply more efficient.
Why Windows wins SD 1.5: The proprietary AMD driver has more stable direct rendering for this specific workload.
Whisper gap explained: Mesa RADV's Vulkan compute path for whisper.cpp is significantly more optimized than the Windows AMD driver equivalent. A 13× speedup on the same GPU, same model.
Troubleshooting
generate_image returned no results / frozen terminal
Cause: sd-server integer overflow bug with random seeds (Seed: -1).
Fix: Set a fixed integer seed in OpenWebUI advanced options (e.g., 42, 1337).
Model trained successfully instantly (Applio)
This is a silent failure. Training completes in seconds and produces nothing.
Cause: CUDA_VISIBLE_DEVICES=-1 or similar environment variables were set, breaking feature extraction.
Fix: Open a clean PowerShell with no prior set commands. Verify logs/project/extracted/ contains .npy files after extraction before starting training.
FLUX OOM / DeviceMemoryAllocation crash
Fix: Ensure --vae-tiling flag is present. Confirm T5XXL is on CPU (--clip-on-cpu --vae-on-cpu). Consider switching to t5xxl_fp8 to save ~4.3GB RAM.
new_sd_ctx_t failed with FLUX GGUF
You're using a city96 GGUF. These only work in ComfyUI with the ComfyUI-GGUF node.
Fix: Download from leejet's repo instead.
Docker can't reach sd-server or llama-server
Cause: Windows Defender blocks Docker's 172.x.x.x subnet by default.
Fix: See OpenWebUI + Docker Integration — add the firewall rule.
Compilation errors in WSL2 for Vulkan builds
WSL2 does not expose the RX 580 for Vulkan compute. Compile and run GPU workloads from native Windows PowerShell only. Use WSL2 exclusively for CPU workloads (ComfyUI, Applio, Ollama CPU fallback).
--override-tensor exps=CPU slows down inference on Vulkan
This flag is optimized for CUDA/PCIe on Nvidia. Under Vulkan, the CPU↔GPU memory transfer overhead destroys any MoE offloading gains. Do not apply CUDA-optimized flags to Vulkan backends.
Automation Scripts
Save as iniciar_ia_server.bat on the Desktop:
batch
1@echo off2title Servidor IA Local - Producao3cls45:: Kill ghost processes holding VRAM/ports6taskkill/f/im sd-server.exe 2>nul7taskkill/f/im llama-server.exe 2>nul8timeout/t2/nobreak >nul910:: Start LLM server (Vulkan)11start"LLM Server - Vulkan RX580" C:\llama.cpp\build\bin\Release\llama-server.exe ^12-m"E:\models\Mistral-7B-Q4_K_M.gguf"^13--host0.0.0.0--port8081--device Vulkan01415timeout/t3/nobreak >nul1617:: Start SD server (Vulkan)18E:19cd"E:\stable-diffusion.cpp\build\bin\Release"20sd-server.exe --listen-ip0.0.0.0--listen-port7860^21-m"E:\models\dreamshaper8.gguf"2223pause
Critical rules:
taskkill before start: releases VRAM from stuck background processes
--host 0.0.0.0: required for Docker to reach the server
--device Vulkan0: without this, inference falls back to CPU (3–5 tok/s)
Never use .\ before executables in CMD — it breaks the shell
Jump drive (E:) before cd — CMD doesn't change drives automatically
Vulkan Diagnostics
Instant validation scripts — run before building anything.
If your card doesn't appear — driver or Vulkan SDK issue. See Master Documentation.
Community Timeline
Three independent researchers. Same GPU. Same conclusion: the hardware was never the problem.
Date
Author
Contribution
Jan 2025
艾米心 Amihart
First documented LLM via Vulkan on RX 580 — 24.56 tok/s on Debian. Declared SD via Vulkan "not viable" (limitation of sd.cpp at that time).
Dec 2025
DH / DadHacks
Refuted Amihart's SD conclusion. Used stable-diffusion.cpp with -DSD_VULKAN=ON, ran FLUX Schnell GGUF generation on RX 580 from terminal.
2026
AIVisionsLab
Full Windows production stack: Vulkan LLM + SD + FLUX hybrid + OpenWebUI + Docker networking + Applio RVC + AnimateDiff + whisper.cpp + Linux native benchmarks.
Capability
Amihart
DadHacks
AIVisionsLab
LLM Vulkan
✅ 24.56 tok/s
✅
✅ 15–35 tok/s
SD via Vulkan
❌
✅ CLI
✅ Server + API
FLUX GGUF
❌
✅ CLI
✅ Hybrid GPU/CPU
GUI / OpenWebUI
Docker only
❌
✅ Full integration
Windows native
❌
❌
✅
Automation scripts
❌
❌
✅ .bat double-click
Voice cloning
❌
❌
✅ Applio RVC
Video / AnimateDiff
❌
❌
✅
Audio transcription
❌
❌
✅ whisper.cpp
Linux native (Ubuntu 26.04)
Debian
Debian
✅ Ubuntu 26.04 LTS
GGUF format mapping
❌
❌
✅ city96 vs leejet
The shared technical foundation: ggml / llama.cpp / stable-diffusion.cpp by Georgi Gerganov. Vulkan compute backends in pure C++ that bypass the entire ROCm/CUDA ecosystem.
Credit: 艾米心 (Amihart), DH (DadHacks), leejet, ggerganov, woodrex, and all independent developers working on hardware preservation and open inference.
Pushing the 35B Limit: Qwen3.5 MoE Hybrid Experiment
Two lab sessions pushed the dual-path stack to its extreme: running a 34.66B-parameter MoE model (Qwen3.5-35B) on the same RX 580 8GB, using llama.cpp's automatic GPU/RAM fitting across 4 memory tiers (VRAM → DDR4 ECC → NVMe → HDD swap).
Quick links — six focused docs, one question each:
Key takeaway: the RX 580 never crashed or throttled across either session (peak 80°C, limit ~90°C). Every failure traced back to software-side timeouts and context-buffer limits — not hardware capacity. With --ctx-size 8192 and Q4_K_M quantization, a 35B MoE model runs stable, full responses included, entirely on a 2017 GPU.
GPU from 2017 + CPU from 2014 ──► 34.66B parameters ──► 5.6–6.6 tok/s