Repository navigation
v0.2.0 — Q4_K_M Support + Multi-Model Inference
ROCmForge v0.2.0
Q4_K_M quantization support and multi-model inference for AMD RDNA 4 (gfx1201).
Acknowledgement
This project builds on the foundational work of oldnordic. Without their original ROCmForge implementation — the model loader, the CPU inference path, the GGUF parser, and the overall architecture — none of the WMMA matrix-core optimizations, the multi-model support, or the interactive chat CLI would have been possible.
What's New in v0.2.0
Multi-Model Support
Three models now run from the same binary with automatic architecture detection:
| Model | Quant | Prefill pp256 | Decode | llama.cpp Decode |
|---|---|---|---|---|
| Qwen2.5-7B-Instruct | Q4_0 | 1,482 tok/s | 102 tok/s | 121 tok/s |
| Qwen3-8B | Q4_K_M | 470 tok/s | 30 tok/s | 87 tok/s |
| Llama-3.1-8B-Instruct | Q4_K_M | 475 tok/s | 31 tok/s | 93 tok/s |
Q4_K_M Quantization
Industry-standard K-quant format (4.5 bits/weight, hierarchical super-block structure) running on WMMA matrix cores. First open-source engine to do this on RDNA 4 without hipBLAS.
7 New GPU Kernels
- WMMA Q4_K_M prefill GEMM with inline dequantization
- Q4_K_M multi-row GEMV for decode
- Fused gate+up+SwiGLU Q4_K_M
- Multi-row Q6_K GEMV (4× faster than v0.1.0 baseline)
- GPU-native Q4_K token embedding
- RoPE frequency scaling (Llama-3.1 context extension)
- Batched per-head Q/K RMSNorm (Qwen3)
Architecture Auto-Detection
GQA ratio, RoPE base, norm epsilon, chat templates — all read from GGUF metadata. No model-name conditionals in dispatch code.
Llama-3 Tokenizer
GPT-4-style BPE pre-tokenizer with 7/7 token parity against llama.cpp.
Qwen2.5-7B Q4_0 (unchanged from v0.1.0)
| Metric | ROCmForge | llama.cpp | Ratio |
|---|---|---|---|
| Prefill pp256 | 1,482 | 4,951 | 0.30× |
| Real TTFT | 49 ms | 46 ms | 1.07× |
| Decode | 102 tok/s | 121 tok/s | 0.84× |
Known Limitations (Q4_K_M)
Q4_K_M support is functional but not yet performance-competitive with llama.cpp:
- Prefill: 0.13× llama.cpp — Q6_K mixed-precision layers fall back to GEMV-loop instead of batched GEMM
- Decode: 0.33× llama.cpp — Q4_K GEMV kernel needs fused norm+QKV+RoPE path and Q8-inline activation (both exist for Q4_0 but not yet for Q4_K)
These gaps have named causes and clear solutions — see roadmap below.
v0.2.1 Roadmap
- Batched Q6_K GEMM kernel (closes prefill gap)
- Fused norm+QKV+RoPE+KV-write for Q4_K decode
- Q8-inline activation for Q4_K decode
- WMMA Q6_K prefill kernel
Installation
See INSTALL.md. Quick start:
```bash
git clone https://github.com/maeddesg/ROCmForge.git
cd ROCmForge && cargo build --release --features gpu
Qwen3-8B (recommended):
./target/release/rocmforge chat --model ~/models/Qwen3-8B-Q4_K_M.gguf
Llama-3.1-8B:
./target/release/rocmforge chat --model ~/models/Meta-Llama-3.1-8B-Instruct-Q4_K_M.gguf
Qwen2.5-7B (fastest, v0.1.0 reference):
./target/release/rocmforge chat --model ~/models/Qwen2.5-7B-Instruct-Q4_0.gguf
```
Requirements: AMD GPU with RDNA 4 (gfx1201), ROCm 7.2.x, Rust toolchain, Arch Linux / CachyOS (tested).