From 2b4f2bab8af9a1e1532c3e0e93d2043e29f64828 Mon Sep 17 00:00:00 2001 From: EtienneLescot Date: Thu, 19 Nov 2026 17:53:52 +0100 Subject: [PATCH 1/2] fix(stt): launch the CPU-labelled whisper helper with --cpu ggml turns Metal on by default for every Apple build, so the macOS x64 helper ships libggml-metal and, without --cpu, decodes on the Intel iGPU. Pass --cpu from the first launch whenever the backend is whispercpp-cpu. Refs #1594 --- electron/stt/gpuDetector.ts | 6 ++++-- electron/stt/whisperServer.test.ts | 3 +++ electron/stt/whisperServer.ts | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/electron/stt/gpuDetector.ts b/electron/stt/gpuDetector.ts index f7aba344fe..da6a72ee61 100644 --- a/electron/stt/gpuDetector.ts +++ b/electron/stt/gpuDetector.ts @@ -27,8 +27,10 @@ export interface ResolvedBinary { } /** - * Return the platform's default binary backend tag. This is only used for - * logging and as a fallback; the helper's response corrects it at runtime. + * Return the platform's default binary backend tag. The helper's response + * corrects it at runtime, with one exception: `whispercpp-cpu` makes + * `WhisperServerManager` launch the helper with `--cpu`, since the macOS x64 + * build still carries ggml's default-on Metal backend (#1594). */ export async function detectGpuBackend(): Promise { switch (process.platform) { diff --git a/electron/stt/whisperServer.test.ts b/electron/stt/whisperServer.test.ts index bd5796082d..647dc3b481 100644 --- a/electron/stt/whisperServer.test.ts +++ b/electron/stt/whisperServer.test.ts @@ -559,6 +559,9 @@ describe("WhisperServerManager", () => { expect(args).not.toContain("--cuda"); expect(args).not.toContain("--int8"); expect(args).not.toContain("--vad"); + // A CPU-labelled helper is CPU from the first launch: the macOS x64 build + // still carries ggml's default-on Metal backend (#1594). + expect(args).toContain("--cpu"); expect(args[args.indexOf("--threads") + 1]).toBe(String(inferenceThreads())); const os = await import("node:os"); expect(vi.mocked(os.default.setPriority)).toHaveBeenCalledWith(1234, 10); diff --git a/electron/stt/whisperServer.ts b/electron/stt/whisperServer.ts index dd75d8c99f..5adeaa455f 100644 --- a/electron/stt/whisperServer.ts +++ b/electron/stt/whisperServer.ts @@ -399,8 +399,12 @@ export class WhisperServerManager { return { port, backend: activeBackend }; }; + // A CPU-labelled helper runs with `--cpu` from its first launch. The label does + // not make the binary CPU-only: ggml turns Metal on by default for every Apple + // build, so the macOS x64 helper carries it, and without the flag whisper.cpp + // decodes on the Intel iGPU — which hung the UHD 630 render ring (#1594). try { - return await launch(false); + return await launch(resolved.backend === "whispercpp-cpu"); } catch (err) { const startupLog = `${err instanceof Error ? err.message : String(err)} ${this.stderrTail}`; const startupLines = startupLog.split(/\r?\n/); From 90c84c16ae0b45badf573547727650531234b2e9 Mon Sep 17 00:00:00 2001 From: EtienneLescot Date: Sat, 21 Nov 2026 21:49:36 +0100 Subject: [PATCH 2/2] fix(stt): force --cpu only for an explicit CPU backend, not for auto An explicit binaryPath with no backend is auto; its whispercpp-cpu default is a label only and must not force --cpu on first launch. Refs #1594 --- electron/stt/whisperServer.test.ts | 4 ++++ electron/stt/whisperServer.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/electron/stt/whisperServer.test.ts b/electron/stt/whisperServer.test.ts index 647dc3b481..f29e721153 100644 --- a/electron/stt/whisperServer.test.ts +++ b/electron/stt/whisperServer.test.ts @@ -565,6 +565,10 @@ describe("WhisperServerManager", () => { expect(args[args.indexOf("--threads") + 1]).toBe(String(inferenceThreads())); const os = await import("node:os"); expect(vi.mocked(os.default.setPriority)).toHaveBeenCalledWith(1234, 10); + + // An explicit binary with no backend is auto: its CPU default is a label only. + await new WhisperServerManager().start({ modelPath, binaryPath: fakeBinaryPath }); + expect(vi.mocked(spawn).mock.calls[1]?.[1]).not.toContain("--cpu"); } finally { vi.unstubAllGlobals(); } diff --git a/electron/stt/whisperServer.ts b/electron/stt/whisperServer.ts index 5adeaa455f..e027603da0 100644 --- a/electron/stt/whisperServer.ts +++ b/electron/stt/whisperServer.ts @@ -403,8 +403,12 @@ export class WhisperServerManager { // not make the binary CPU-only: ggml turns Metal on by default for every Apple // build, so the macOS x64 helper carries it, and without the flag whisper.cpp // decodes on the Intel iGPU — which hung the UHD 630 render ring (#1594). + // An explicit `binaryPath` with no backend is auto: its CPU default above is only + // a label, so it does not force the flag. + const cpuLabelled = + (options.binaryPath ? options.backend : resolved.backend) === "whispercpp-cpu"; try { - return await launch(resolved.backend === "whispercpp-cpu"); + return await launch(cpuLabelled); } catch (err) { const startupLog = `${err instanceof Error ? err.message : String(err)} ${this.stderrTail}`; const startupLines = startupLog.split(/\r?\n/);