Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions electron/stt/gpuDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GpuProbeResult> {
switch (process.platform) {
Expand Down
7 changes: 7 additions & 0 deletions electron/stt/whisperServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,16 @@ 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);

// 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();
}
Expand Down
10 changes: 9 additions & 1 deletion electron/stt/whisperServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,16 @@ 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).
// 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(false);
return await launch(cpuLabelled);
} catch (err) {
const startupLog = `${err instanceof Error ? err.message : String(err)} ${this.stderrTail}`;
const startupLines = startupLog.split(/\r?\n/);
Expand Down
Loading