From 90a7aeea51eec805b0332cf03e9f2543601f1a2f Mon Sep 17 00:00:00 2001 From: chicco83 Date: Fri, 23 Oct 2026 08:27:24 +0200 Subject: [PATCH] Setup wizard: show the VRAM of AMD cards on Windows from the engine's list when the host probe reports 0 (#3727, PR #3798 by chicco83) --- apps/host/src/components/OnboardingMemory.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/host/src/components/OnboardingMemory.tsx b/apps/host/src/components/OnboardingMemory.tsx index 92c05909..fe466570 100644 --- a/apps/host/src/components/OnboardingMemory.tsx +++ b/apps/host/src/components/OnboardingMemory.tsx @@ -8,9 +8,20 @@ export function OnboardingMemory({ hardware, native }: { hardware: Hardware | null; native: NativeState['hardware'] | undefined; }) { - const gpus = hardware ? hardware.gpus.filter(gpu => gpu.backend !== 'cpu').map(gpu => ({ id: gpu.id ?? String(gpu.index), name: gpu.name, memory: gpu.vramGb, shared: gpu.unified })) : native?.gpus.map(gpu => ({ id: String(gpu.index), name: gpu.name, memory: gpu.vram_gb, shared: false })) ?? []; + // The Windows host probe (Win32_VideoController) cannot read the VRAM of AMD cards and reports 0 for them; the engine's own list has + // the real size. For a dedicated card the host reports as 0, take the engine's figure for the card of the same name, or for the + // card in the same position when both lists have the same length. A card the engine does not list stays at 0. + const nativeGpus = native?.gpus ?? []; + const hostGpus = hardware ? hardware.gpus.filter(gpu => gpu.backend !== 'cpu') : []; + const engineVram = (name: string, position: number) => { + const norm = (value: string) => value.toLowerCase().replace(/[^a-z0-9]/g, ''); + const byName = nativeGpus.find(g => norm(g.name).includes(norm(name)) || norm(name).includes(norm(g.name))); + return (byName ?? (nativeGpus.length === hostGpus.length ? nativeGpus[position] : undefined))?.vram_gb || 0; + }; + const gpus = hardware ? hostGpus.map((gpu, position) => ({ id: gpu.id ?? String(gpu.index), name: gpu.name, memory: gpu.unified || gpu.vramGb > 0 ? gpu.vramGb : engineVram(gpu.name, position), shared: gpu.unified })) : nativeGpus.map(gpu => ({ id: String(gpu.index), name: gpu.name, memory: gpu.vram_gb, shared: false })); const dedicatedCount = gpus.filter(gpu => !gpu.shared).length; - const memory = hardware ? memoryInventory(hardware) : native ? { ram: native.ram_gb, vram: native.gpus.reduce((sum, gpu) => sum + Math.max(0, gpu.vram_gb || 0), 0), total: 0, shared: false } : null; + const base = hardware ? memoryInventory(hardware) : null; + const memory = base ? (base.shared ? base : { ...base, vram: gpus.reduce((sum, gpu) => sum + (gpu.shared ? 0 : Math.max(0, gpu.memory || 0)), 0) }) : native ? { ram: native.ram_gb, vram: native.gpus.reduce((sum, gpu) => sum + Math.max(0, gpu.vram_gb || 0), 0), total: 0, shared: false } : null; if (!memory) return
{tr("Reading memory\u2026")}
; const total = memory.ram + memory.vram;