Issues / #560

#560 AMD/Linux desktop: default VRAM reserve (700 MiB) lets the driver evict ~24 GB to RAM, OOM kills kwin; --vram-reserve-mib 3072 fixes it

closed · @icodebot · 1 コメント · GitHub で見る

BenchmarksSetup & installServer & APIAMD / HIPModels & quantsLinux

本文

## Summary

On an AMD card under a Linux desktop (KDE Plasma 6, Wayland), the default `--vram-reserve-mib` (700 MiB) left only **624 MiB of VRAM free** with IQ3_XXS loaded. When anything on the desktop then needed GPU memory (the browser that `--open` launches, or a terminal app starting), the amdgpu driver evicted GPU buffers to system RAM (GTT): **~24.5 GB in about one second**, on top of the ~42 GB Strata already holds in RAM. The kernel OOM killer then killed kwin_wayland and the desktop session crashed. The machine ran out of memory three times in 15 minutes (two of those crashed the desktop session; the GTT jump was captured on the last one). Re-running setup with `--vram-reserve-mib 3072` fixed it.

## Environment

- Strata `db4f91a`, engine 0.1.37, backend `hip`, ROCm 7.2.4
- GPU: AMD Radeon AI PRO R9700 32 GB (gfx1201), also driving the desktop
- RAM: 64 GB (60.2 GiB usable), zram swap
- OS: CachyOS, kernel 7.2.8, KDE Plasma 6.7 / KWin 6.7 (Wayland)
- Model: IQ3_XXS, `--max-context 131072 --kv int8`, `--expert-cache auto`

## What happened

With the default reserve:

```
strata generate: expert cache auto: 25.03 GiB free, 700 MiB reserved (+184 MiB for the draft head) -> 11138 slots
strata serve: 624 MiB of VRAM free with everything loaded
```

A script logged `/proc/meminfo` and `mem_info_gtt_used` every 0.5 s. Strata was idle at the time; the trigger was starting a desktop app:

```
15:18:54 avail_mb=15878 engine_rss_mb=41766 gtt_mb=304
15:18:55 avail_mb=14118 engine_rss_mb=41766 gtt_mb=25066
15:18:58 avail_mb=394   engine_rss_mb=38330 gtt_mb=25066
```

GTT went from 0.3 to 25 GB while Strata's own RSS did not grow. The 24.5 GB is about the size of the expert cache (14,862 slots, 24.16 GiB), so it looks like the cache was evicted to GTT, though I could not confirm whose buffers moved. Then:

```
Oct 02 15:19:38 kernel: Out of memory: Killed process 1312198 (opencode) ...
Oct 02 15:19:38 kernel: Out of memory: Killed process 1304834 (plasmashell) ...
Oct 02 15:19:39 kernel: Out of memory: Killed process 1304675 (kwin_wayland) ...
```

Earlier the same thing happened right after `run-iq3_xxs.sh` opened the browser (`--open`):

```
Oct 02 15:13:04 kernel: Out of memory: Killed process 1580 (kwin_wayland) ...
```

Killing the engine (SIGKILL at under 4 GB available) did not save the desktop; the OOM kills still came 40 s later.

## Fix that worked

`./setup.sh --setup --model IQ3_XXS --vram-reserve-mib 3072` (setup now keeps the reserve on later runs):

```
strata generate: expert cache auto: 25.03 GiB free, 3072 MiB reserved (+184 MiB for the draft head) -> 10070 slots
strata serve: 2994 MiB of VRAM free with everything loaded
```

After that, Firefox and OpenCode started without any GTT growth (it stayed at ~0.1 GB), with 2.4 GB of VRAM free in use. Cost: 13,455 instead of 14,862 experts in VRAM; generation was still 70-87 tok/s with a 93-96% decode hit rate.

For comparison, the Coder (IQ1_M) left 2.4 GB free with the default reserve and never crashed.

## Suggestions

- A larger automatic reserve when the card also drives a desktop session (Linux AMD), or when RAM can't absorb an eviction of the expert cache. With RAM nearly full, a GTT eviction has nowhere to go.
- A setup note that `--vram-reserve-mib` is the fix for desktop crashes / OOM after the model loads.
- Possibly not opening the browser from the start script by default, since that launch is a common trigger.

関連リンク

インストール・モデル・リリースへの站内リンク。