Skip to content

[Performance]: GLM-5.2 (744B MoE) on a single AMD R9700 32 GB: 0.15 tok/s, 80% expert hit — capacity-bound benchmark #583

Description

@limcheekin

Commit

81f08a0

Hardware and storage

Hi there,

I use Opus 4.8 to drive the benchmark, it add the following benchmark results to the docs/benchmarks.md, appreciate if you have any idea to improve the performance:

Community benchmarks (measured)

Real numbers from real machines, stock build (setup.sh, gcc 13), greedy decoding, --ngen 32, MTP active:

machine disk (iobench, 19 MB × 64, 8 threads) config measured
Intel i5-8600K (6C/6T, AVX2) · native Linux · 125 GB RAM · SATA SSD · AMD Radeon AI PRO R9700 32 GB (gfx1201/RDNA4, ROCm 7.2.2 HIP backend), measured 2026-07-24 — (SATA SSD, not iobench'd) HIP build · CUDA_EXPERT_GB=30 CUDA_RELEASE_HOST=1 DIRECT=0 · warm cache · 1586 pinned experts (30 GB VRAM) 0.15 tok/s · hit 80.2% · RSS 97.7 GB (64-tok, MTP acc 0%) · at 26 GB budget → 0.12 tok/s / 77%

AMD single-card setup (ROCm/HIP, R9700) — measured 2026-07-24

First end-to-end AMD-discrete datapoint (the GPU backends matrix
had a hip-test pass on gfx1201 but no tok/s). Two setup notes not in the build docs:

# 1) Build the HIP backend. The documented command links as a PIE and fails
#    (backend_cuda.o is not -fPIC), so force position-independent code:
rm -f c/backend_cuda.o c/colibri c/glm
ROCM_HOME=/opt/rocm-7.2.2 make -C c glm HIP=1 HIP_ARCH=gfx1201 \
  HIPCCFLAGS="-O3 -std=c++17 -x hip --offload-arch=gfx1201 -fPIC -Wall -Wextra"

# 2) The `coli` wrapper is NVIDIA-only: cuda_binary() greps ldd for libcudart
#    (a HIP build links libamdhip64), and resource_plan.discover_gpus() only calls
#    nvidia-smi. So `coli run --gpu` / doctor report "no GPU". Drive the engine
#    directly — it enumerates the AMD device via HIP itself:
SNAP=/path/to/glm52_i4 NGEN=64 \
  PROMPT='[gMASK]<sop><|user|>...<|assistant|><think></think>' \
  COLI_CUDA=1 COLI_GPUS=0 HIP_VISIBLE_DEVICES=0 \
  CUDA_EXPERT_GB=30 CUDA_RELEASE_HOST=1 DIRECT=0 ./c/colibri 8

Result: HIP init clean on gfx1201/ROCm 7.2.2, coherent greedy output. Raising the
VRAM expert budget 26 → 30 GB (1359 → 1586 resident experts) lifted decode
0.12 → 0.15 tok/s and hit rate 77 → 80%; a warm-cache priming pass cut
prefill 188 → 137 s (buffered pread, DIRECT=0) but barely moved steady-state
decode. Hit rate plateaus at ~80% even at 30 GB: this prompt's working set
(~2757 hot experts) exceeds what one 32 GB card holds, so ~20% of routes stay cold
disk reads. It is capacity-bound, not compute-bound (decode wall ≈ 280 s
disk-wait + 160 s compute over 64 tokens); the compute-only floor is ~0.4 tok/s.
More residency needs more VRAM (more cards), not tuning.

Software environment

OS Ubuntu 24.04.4 LTS · kernel 6.8.0-134-generic (x86-64)
CPU Intel Core i5-8600K (6C/6T, AVX2) @ 3.60 GHz
RAM 125 GiB
Disk 3.6 TB SATA SSD (/dev/sda1), model on /mnt/data (2.3 TB free)
GPU AMD Radeon AI PRO R9700, 32 GB VRAM (34.2 GB reported) · gfx1201 (RDNA4)
ROCm / HIP ROCm 7.2.2 · HIP 7.2.53211 · AMD clang 22.0.0git (roc-7.2.2)
Host compiler gcc 13.3.0 (Ubuntu)
Engine colibri 1.1.1 (c/colibri), built with the HIP backend
Model GLM-5.2 int4 + int8 MTP — /mnt/data/models/GLM-5.2-colibri-int4-with-int8-mtp
(~384 GB on disk, 144 shards, 9.9 GB dense resident, 19,456 experts)

Build and benchmark commands

# --- 1. Build the colibri HIP engine for gfx1201 -----------------------------
# NOTE: the documented `make ... HIP=1` links as a PIE and fails
# (backend_cuda.o is not position-independent), so add -fPIC explicitly.
cd /mnt/data/colibri
rm -f c/backend_cuda.o c/colibri c/glm
ROCM_HOME=/opt/rocm-7.2.2 make -C c glm HIP=1 HIP_ARCH=gfx1201 \
  HIPCCFLAGS="-O3 -std=c++17 -x hip --offload-arch=gfx1201 -fPIC -Wall -Wextra"
ldd c/colibri | grep amdhip     # verify libamdhip64 is linked

# --- 2. Run the benchmark (max VRAM budget + warm page cache) ----------------
# The `coli` wrapper is NVIDIA-only (cuda_binary() greps ldd for libcudart;
# resource_plan.discover_gpus() only calls nvidia-smi), so it refuses --gpu on a
# HIP build. Drive the engine binary directly — it enumerates the AMD GPU via HIP.
# argv[1] = prompt cap; everything else is read from the environment.
export SNAP=/mnt/data/models/GLM-5.2-colibri-int4-with-int8-mtp
export PROMPT='[gMASK]<sop><|user|>Explain what a mixture-of-experts model is in two sentences.<|assistant|><think></think>'
export COLI_CUDA=1 COLI_GPUS=0 HIP_VISIBLE_DEVICES=0   # select the AMD device
export CUDA_EXPERT_GB=30       # max expert tier on a 32 GB card (2 GB reserve)
export CUDA_RELEASE_HOST=1     # drop RAM copies of VRAM experts -> more warm RAM
export DIRECT=0                # buffered pread -> OS page cache is used (warmable)
export COLI_POLICY=quality

# prime pass (warms page cache + expert placement / .coli_usage), then measure:
NGEN=32 ./c/colibri 8          # prime
NGEN=64 ./c/colibri 8          # measured (read the steady-state tail [t=N ... tok/s])

Results

# --- Result -------------------------------------------------------------------
# CUDA_EXPERT_GB=30, warm: 0.15 tok/s decode · 80.2% expert hit · 1586 experts
#   resident in 30.00 GB VRAM · peak RSS 97.7 GB · prefill 137 s (warmed from 188 s).
# Baseline CUDA_EXPERT_GB=26: 0.12 tok/s · 76.9% hit · 1359 experts (25.99 GB).
# Capacity-bound at ~80% hit on one 32 GB card (working set ~2757 hot experts);
# compute-only floor ~0.4 tok/s. More throughput needs more VRAM (more GPUs).

Baseline comparison

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    benchmarkDatapoint di misurazione hardwareperformanceVelocità / tok-s / ottimizzazioni

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions