The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(gpu): der Mac behaelt seinen Speicherwert, und der Arch-Aufruf nur wo er zaehlt
purplef9ef3f3d862c
diff --git a/src/api/__tests__/fit-check-never-shows-system-ram.test.ts b/src/api/__tests__/fit-check-never-shows-system-ram.test.tsindex e2024bb0..dac8e286 100644--- a/src/api/__tests__/fit-check-never-shows-system-ram.test.ts+++ b/src/api/__tests__/fit-check-never-shows-system-ram.test.ts@@ -21,6 +21,9 @@* Run: npx vitest run src/api/__tests__/fit-check-never-shows-system-ram.test.ts*/import { describe, it, expect, vi, beforeEach } from 'vitest'+import { readFileSync } from 'fs'+import { fileURLToPath } from 'url'+import { dirname, join } from 'path'import { createElement } from 'react'import { render, screen, cleanup } from '@testing-library/react'@@ -32,12 +35,16 @@ vi.mock('../backend', () => ({fetchLocalhostBytes: vi.fn(),isTauri: () => false,backendCall: vi.fn(),+ isMacOS: () => false,}))import { pickDeviceVramBytes } from '../comfyui'import { HardwareChip } from '../../components/models/ModelTiles'import { comfyErrorHint } from '../vram-handoff'+const __filename = fileURLToPath(import.meta.url)+const __dirname = dirname(__filename)+const GB = 1024 * 1024 * 1024/** Zhorts' box: ComfyUI on the processor, so one device and it is the CPU. */@@ -103,6 +110,30 @@ describe('the CPU pseudo-device is not a graphics card', () => {})})+describe('a Mac shares one pool, so the CPU entry is the answer there', () => {+ // Review catch: detect_macos reports no size at all, so /system_stats is the+ // ONLY VRAM source on a Mac. ComfyUI started with --cpu reports a cpu device+ // there, and filtering it would have left every such Mac reading+ // "GPU unknown" and lost the "Fits my PC" filter with it.+ it('keeps the CPU device when the memory is unified', () => {+ expect(pickDeviceVramBytes(CPU_ONLY, { unifiedMemory: true })).toBe(62 * GB)+ })++ it('still prefers a real device over the shared pool', () => {+ const mps = [{ name: 'mps', type: 'mps', index: 0, vram_total: 96 * GB }]+ expect(pickDeviceVramBytes([...CPU_ONLY, ...mps], { unifiedMemory: true })).toBe(96 * GB)+ })++ it('does not soften the rule for anything else', () => {+ // NEGATIVE CONTROL: this is Zhorts' box, where the card has its own memory+ // and the CPU number is a different figure about a different thing. The+ // flag is off there and the 62 stays out.+ expect(pickDeviceVramBytes(CPU_ONLY)).toBeNull()+ expect(pickDeviceVramBytes(CPU_ONLY, {})).toBeNull()+ expect(pickDeviceVramBytes(CPU_ONLY, { unifiedMemory: false })).toBeNull()+ })+})+describe('the hardware chip', () => {it('says unknown for the side nothing measured', () => {render(createElement(HardwareChip, { vramGb: null, ramGb: 62 }))@@ -126,6 +157,26 @@ describe('the hardware chip', () => {})})+describe('a healthy ROCm install is not painted as a fault', () => {+ // hypocritical_rj (help-chat "GPU Detection", 26.08.) opened a thread just to+ // ask whether the yellow line was a problem. Amber is the colour of "LU could+ // not confirm this", and a correct install has to stop wearing it.+ const settings = () => readFileSync(join(__dirname, '../../components/settings/HardwareSettings.tsx'), 'utf8')++ it('hangs the colour off the severity the backend sent', () => {+ expect(settings()).toMatch(/g\.note_severity === 'info' \? 'text-gray-500' : 'text-amber-500\/80'/)+ })++ it('leaves every older note in the warning colour', () => {+ // NEGATIVE CONTROL: the notes that predate the field carry no severity, and+ // they are all warnings, so an unknown severity must not fall to the muted+ // branch. The comparison is against 'info' for exactly that reason.+ expect(settings()).not.toMatch(/note_severity === 'warn'/)+ // And the unconditional amber that was here is gone.+ expect(settings()).not.toMatch(/className="text-\[0\.55rem\] text-amber-500\/80 mt-0\.5/)+ })+})+describe('hipErrorInvalidValue names the architecture instead of the error', () => {// A12, artoriuskurokami (Discord 2026-09-02, RX 9070 XT): image generation// dies with this, the same run on the processor completes.@@ -157,6 +208,18 @@ describe('hipErrorInvalidValue names the architecture instead of the error', ()expect(other).not.toContain('hipErrorInvalidValue')})+ it('is the only branch that needs the architecture at all', () => {+ // Review catch: the lookup used to run before every branch, so an+ // out-of-memory message waited on detect_gpus shelling out to the vendor+ // tools. The gate at the call site is the source of truth, so it is checked+ // here as source rather than guessed at.+ const call = readFileSync(join(__dirname, '../vram-handoff.ts'), 'utf8')+ expect(call).toMatch(/\/hiperrorinvalidvalue\/i\.test\(raw\) \? await getAmdGpuArch\(\)/)+ // NEGATIVE CONTROL: an unconditional await would put the probe in front of+ // every ComfyUI failure there is.+ expect(call).not.toMatch(/const arch = await getAmdGpuArch\(\)\.catch/)+ })+it('says nothing about HIP for an error that is not about HIP', () => {// NEGATIVE CONTROL: a plain CUDA "invalid argument" on an NVIDIA box must// not be answered with AMD advice, so the match is on the HIP name alone.diff --git a/src/api/comfyui.ts b/src/api/comfyui.tsindex 4fb02ef2..09afaf36 100644--- a/src/api/comfyui.ts+++ b/src/api/comfyui.ts@@ -1,4 +1,4 @@-import { comfyuiUrl, localFetch, fetchLocalhostBytes, isTauri, backendCall } from "./backend"+import { comfyuiUrl, localFetch, fetchLocalhostBytes, isTauri, backendCall, isMacOS } from "./backend"import { log } from "../lib/logger"import { LU_CLIENT_PREFIX } from "./comfyui-ws"import { nodeComboOptions } from "./comfyui-enum"@@ -584,13 +584,26 @@ function isCpuDevice(dev: any): boolean {* Apple's `mps` device is NOT excluded. Unified memory really is the VRAM* there, so the number is right for the machine it comes from.*+ * `unifiedMemory` is the same point one step further, and it is the reason+ * macOS passes true. `detect_macos` reports no size at all, so /system_stats is+ * the ONLY VRAM source on a Mac, and a ComfyUI started with --cpu reports a cpu+ * device there. Dropping it would have turned the fit check on every such Mac+ * into "GPU unknown" and taken the "Fits my PC" filter with it. On a machine+ * where the graphics unit and the processor share one pool, the pool is the+ * honest answer for both, which is exactly what makes the Windows case wrong:+ * there the card has its own memory and the CPU figure is a different number+ * about a different thing.+ ** Pure and exported so the case above can be a test instead of a screenshot.*/-export function pickDeviceVramBytes(devices: unknown): number | null {+export function pickDeviceVramBytes(+ devices: unknown,+ opts: { unifiedMemory?: boolean } = {},+): number | null {if (!Array.isArray(devices)) return nulllet best = 0for (const dev of devices) {- if (isCpuDevice(dev)) continue+ if (!opts.unifiedMemory && isCpuDevice(dev)) continueconst bytes = (dev as any)?.vram_totalif (typeof bytes === 'number' && Number.isFinite(bytes) && bytes > best) best = bytes}@@ -604,7 +617,7 @@ export async function getSystemVRAM(): Promise<number | null> {if (!res.ok) return nullconst data = await res.json()// ComfyUI returns top-level devices[].vram_total in bytes- const vramBytes = pickDeviceVramBytes(data?.devices)+ const vramBytes = pickDeviceVramBytes(data?.devices, { unifiedMemory: isMacOS() })if (vramBytes !== null) {cachedVRAM = Math.round(vramBytes / (1024 * 1024 * 1024)) // bytes → GBreturn cachedVRAMdiff --git a/src/api/vram-handoff.ts b/src/api/vram-handoff.tsindex d993f87f..0a89c806 100644--- a/src/api/vram-handoff.ts+++ b/src/api/vram-handoff.ts@@ -1489,10 +1489,14 @@ async function pollAndExtract(promptId: string, prompt: string, kindLabel: strin|| history.status.messages?.map((m: any) => m?.[1]?.message).filter(Boolean).join(' | ')|| history.status.messages?.[0]?.[1]?.message|| 'Unknown ComfyUI error'- // The architecture only matters for one branch and costs one cached- // Tauri call, which is cheaper than the render that just failed.- const arch = await getAmdGpuArch().catch(() => null)- const hint = comfyErrorHint(errEntry?.node_type, errEntry?.exception_type, String(rawMsg), arch)+ // The architecture only matters for the hipErrorInvalidValue branch, so+ // it is only fetched for that branch. detect_gpus shells out to several+ // vendor tools, each bounded at five seconds, and putting that in front+ // of EVERY ComfyUI failure would have delayed an out-of-memory message+ // or a missing-node message by seconds for nothing.+ const raw = String(rawMsg)+ const arch = /hiperrorinvalidvalue/i.test(raw) ? await getAmdGpuArch().catch(() => null) : null+ const hint = comfyErrorHint(errEntry?.node_type, errEntry?.exception_type, raw, arch)return `${kindLabel} generation failed: ${rawMsg}${hint ? `\n\n${hint}` : ''}`}const projected = pace.projectedTotalMs()diff --git a/src/components/settings/HardwareSettings.tsx b/src/components/settings/HardwareSettings.tsxindex ecac60c5..14389849 100644--- a/src/components/settings/HardwareSettings.tsx+++ b/src/components/settings/HardwareSettings.tsx@@ -17,6 +17,7 @@ interface DetectedGpu {source: string/** Set when the card was found but its compute stack was not. */note?: string | null+ note_severity?: string | null}type GpuVendor = 'auto' | 'nvidia' | 'amd' | 'intel'@@ -181,8 +182,21 @@ export function HardwareSettings() {and selectable, and the line says what LU could notverify, so nobody rebuilds a working install chasinga driver problem that is not there (numbrain). */}+ {/* Amber is the colour of "LU could not confirm this".+ A correctly installed ROCm named in that colour reads as+ a fault and produced a support question of its own+ (hypocritical_rj asked what the yellow line meant), so a+ note that only states a healthy fact is muted instead.+ Unknown severity keeps the warning colour: the notes+ that predate this field are all warnings. */}{g.note && (- <div className="text-[0.55rem] text-amber-500/80 mt-0.5 leading-relaxed">{g.note}</div>+ <div+ className={`text-[0.55rem] mt-0.5 leading-relaxed ${+ g.note_severity === 'info' ? 'text-gray-500' : 'text-amber-500/80'+ }`}+ >+ {g.note}+ </div>)}</div></label>