Fix: VRAM/Memory-Leiste nutzt echtes GTT-Budget (~124GB) statt 16GB-Fallback

Cockpit VRAM-HUD las einen hardcodierten 16GB-APU-Fallback als Pool-Kapazitaet -> Leiste
zeigte z.B. "11.3/16GB". Jetzt: gtt_total aus /api/system/status (unified memory, ~124GB).
Label zeigt zusaetzlich die reale GTT-Belegung (inkl. KV) ehrlich an.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-06-27 12:43:26 +02:00
parent 6758bbfbd9
commit 31d5e5d727
5 changed files with 410 additions and 405 deletions
+10 -5
View File
@@ -1,7 +1,7 @@
import { useState, useRef, useCallback } from "react"
import { Download, Trash2, Edit3, Activity, HardDrive, X, Check, Copy, Zap, Bot } from "lucide-react"
import { api, type ModelInfo } from "@/lib/api"
import { useModels, useRouting, useConnect, useUpdates, useHermesBrain, useQueryClient, qk } from "@/lib/queries"
import { useModels, useRouting, useConnect, useUpdates, useHermesBrain, useSystemStatus, useQueryClient, qk } from "@/lib/queries"
import { useDialog } from "@/lib/useDialog"
import { CapsChips } from "@/components/CapsChips"
import { cn } from "@/lib/utils"
@@ -16,6 +16,7 @@ export function Cockpit() {
const { data: connectData } = useConnect()
const { data: updates } = useUpdates(4_000)
const { data: brain } = useHermesBrain()
const { data: sysStatus } = useSystemStatus()
const { showAlert, showConfirm, showPrompt, dialogElement } = useDialog()
const models = modelsResp?.models ?? []
const running = modelsResp?.running ?? []
@@ -233,11 +234,15 @@ export function Cockpit() {
)
}
// VRAM calculation: APU fallback 16GB if sysfs returns 0
// Speicher-Pool = echtes GTT-Budget (unified memory, ~124 GB), nicht der alte 16-GB-Fallback.
const runningWithInfo = models.filter((m) => running.includes(m.name))
const totalRunningSize = runningWithInfo.reduce((acc, m) => acc + (m.size_bytes || 0), 0)
const virtualMax = 16 * 1024 ** 3 // 16 GB Default
const capacity = totalRunningSize > virtualMax ? totalRunningSize * 1.2 : virtualMax
const gttTotal = sysStatus?.gpu?.gtt_total || sysStatus?.gpu?.vram_total || 0
const gttUsed = sysStatus?.gpu?.gtt_used || 0
const virtualMax = 16 * 1024 ** 3 // Fallback, falls sysfs nichts liefert
const capacity = gttTotal > 2 * 1024 ** 3
? gttTotal
: (totalRunningSize > virtualMax ? totalRunningSize * 1.2 : virtualMax)
// Find model by role
const getModelForRole = (role: string) => models.find((m) => m.role === role)
@@ -270,7 +275,7 @@ export function Cockpit() {
</div>
<div className="flex items-center gap-3">
<span className="text-[10px] font-mono text-muted-foreground">
Llama Swap VRAM-Pool: {fmtSize(totalRunningSize)} / {fmtSize(capacity)} geladen
Speicher-Pool: {fmtSize(totalRunningSize)} Gewichte{gttUsed > 0 ? ` · ${fmtSize(gttUsed)} real belegt (inkl. KV)` : ""} / {fmtSize(capacity)}
</span>
{running.length > 0 && (
<button