Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

berthd --gpu-backend amd exits at startup on a desktop session: "process VRAM exceeds card usage"

オープン
#196 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go, linux
領域
backend, devtools

調査の方向性

Start by tracing the AMD GPU inventory path that reports “process VRAM exceeds card usage” and inspect how it reads and sums amdgpu fdinfo, especially purgeable and shared memory fields. Reproduce with the supplied desktop-session data and compare the per-process totals with card1's mem_info_vram_used. Done means the AMD observation can start on this workload and reports or handles overcounting safely; the issue does not name test files or source paths.

索引モデルが issue の本文から書いたものです。

説明

Version: berth 0.3.4 (linux-amd64, release binary, SHA256 verified) Backend: berth daemon --gpu-backend amd --gpu 1 --poll 2s (experimental Linux AMD path)

Environment
GPU: AMD Radeon AI PRO R9700, 32 GB, Navi 48 / gfx1201 (PCI 1002:7551 rev c0), DRM card1, pdev 0000:03:00.0
Second amdgpu device: Ryzen 9 7950X3D iGPU (1002:164e), DRM card0
OS / kernel: Ubuntu 26.04.1 LTS, 7.0.0-38-generic
Full GNOME desktop session on the same machine (gnome-shell, Xwayland, Chrome, several Electron apps), plus ComfyUI (PyTorch/ROCm) and a llama-server (Vulkan) on the R9700. No ROCm SDK tools needed or installed for Berth.
What happens

The daemon refuses to start and systemd restart-loops it:

[ERROR] gpu inventory: GPU observation unavailable: AMD: process VRAM exceeds card usage; memory changed during scan, retrying

It is not transient: it reproduces on every start, and under a manual foreground run (berth daemon --gpu-backend amd --gpu 1 --poll 2s --socket /tmp/x.sock).

Data

/sys/class/drm/card1/device/mem_info_vram_used = 29.27 GiB.

Summing amdgpu fdinfo across every process visible to my user (deduplicated per pid + drm-client-id, drm-pdev = the R9700 only):

Accounting Sum vs card used
drm-memory-vram (= drm-resident-vram) 43.78 GiB exceeds by 14.5 GiB
drm-total-vram 35.77 GiB exceeds by 6.5 GiB
drm-resident-vram minus drm-purgeable-vram 32.59 GiB exceeds by 3.3 GiB

None of these fit under the card total. Only my user's processes are visible, so the true sum would be higher still.

The largest contributor is the compositor. One fd of gnome-shell reports:

drm-total-vram: 1867012 KiB (1.78 GiB)
drm-shared-vram: 587136 KiB
drm-resident-vram: 11729968 KiB (11.19 GiB)
drm-purgeable-vram: 10440192 KiB (9.96 GiB)
drm-memory-vram: 11729968 KiB

For contrast, ComfyUI (PyTorch/ROCm) is consistent: total = resident = memory = 19047308 KiB, purgeable 0.

What I think is going on (not verified against the Berth source)
drm-memory-vram/resident includes a large purgeable portion for desktop clients (buffers the kernel may reclaim), so it is not "memory this process is holding hostage".
Even after discounting purgeable, a residual ~3 GiB remains. Buffers shared between clients (compositor + apps) are plausibly counted once per client.
Suggestion

On a desktop machine the invariant sum(process VRAM) <= card used cannot be assumed from fdinfo. Options that would let the probe run here:

subtract purgeable (and shared) from per-process figures, and
treat a residual overcount as a warning that clamps or scales the attribution, instead of making the whole observation unavailable and exiting.

A flag to downgrade the check would also work as a stopgap.

Why it matters

Machines with a discrete AMD card often also drive the desktop from it. This one is a single-GPU workstation that also runs ComfyUI and vision/text models, which is the case Berth is for. Happy to run a debug build or send more fdinfo dumps.

Side note

berth service install --harbor panicked (nil deref at internal/cli/service.go:183) when run from a shell with no user-session D-Bus (XDG_RUNTIME_DIR / DBUS_SESSION_BUS_ADDRESS unset), instead of printing an error. It wrote the unit files and worked once those variables were set.

主要言語
Go
スター
226
フォーク
20
平均マージ
51分
マージ済み PR(30日)
225

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

T-Crypt/berth のほかの issue

T-Crypt/berth の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。