Skip to content

feat(addon): point AVX2-less users to the legacy-cpu compat packs - #544

Merged
buxuku merged 2 commits into
mainfrom
feat/legacy-cpu-pack-entry
Oct 14, 2026
Merged

buxuku merged 2 commits into
mainfrom
feat/legacy-cpu-pack-entry

Conversation

@buxuku

@buxuku buxuku commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Summary

Users whose CPU has AVX but not AVX2 (Sandy Bridge / Ivy Bridge, AMD Bulldozer era) already get a CPU advisory notice, but it only suggests cloud speech recognition or another engine. Compat packs built for an AVX-only baseline are published as the legacy-cpu pre-release on buxuku/whisper.cpp. They are manual-import only, so nobody could find them from inside the app.

This PR points eligible users to that release page, which carries the step-by-step download and import guide (Chinese first, then English). Nothing is downloaded or installed automatically.

What changed

  • Eligibility policy (renderer/lib/legacyCpuPack.ts): canUseLegacyCpuPack(advisory) is true only when the advisory is applicable and not translated, the platform is Windows or Linux, some feature is explicitly missing, and that feature is not AVX itself. A CPU without AVX cannot run the packs, and there are no macOS / ARM / translated variants.
  • CPU advisory notice: for eligible CPUs the existing warning keeps its text and gains a short paragraph plus a "Download and import guide" button that opens the release page through the existing openUrl IPC.
  • Custom addon already enabled: the notice switches to a neutral info state asking the user to confirm the imported file is the legacy pack, with no button. It refreshes live when the custom addon is set or cleared (it listens to the existing gpu-settings-changed window event).
  • Custom addon section (Engines → whisper.cpp (built-in) → GPU acceleration · Manage / Advanced): a second "Legacy CPU pack" link next to the existing "Download Packs" link, plus a short tip. The existing link targets the latest release, whose packs require AVX2, so the two links must not be mixed up.
  • zh / en strings for all of the above.

What does not change

  • CPUs that lack AVX, macOS, ARM and translated environments keep the previous notice and get no button.
  • No change to addon loading, crash protection, or the acceleration-mode logic. The custom addon is still only stored by path.
  • The error text shown after a crash is untouched.
  • Imported files are not validated beyond the existing .node check.

Verification

  • New and rewritten tests: LegacyCpuPack.test.ts (6), CpuAdvisoryNotice.test.tsx (14), GpuCustomAddonSection.test.tsx (4). They were written test-first, and removing the AVX guard from the policy makes the negative cases fail.
  • npm run typecheck exits 0, npm run check:i18n passes, and Prettier is clean on all changed files.
  • Full renderer suite: 77 suites / 746 tests pass. On a heavily loaded dev machine, two unrelated suites (EngineRuntimeImport, ProofreadImport) hit their default time budgets in separate runs; both pass in isolation and when only the time budgets are relaxed. This PR does not load either of them.

Notes for reviewers

  • The compat packs are experimental. They have not been run on a real pre-AVX2 CPU (static ISA scan, native smoke test, and qemu-user IvyBridge / SandyBridge for the Linux pack only). The release page says so, and this PR only routes users there.
  • The advisory notice itself has not shipped in a tagged release yet.

The built-in addon packs need AVX2/FMA/F16C/BMI2. On an older CPU the app
already warns about it, but gave no way forward. Compat packs built for an
AVX-only baseline are published on buxuku/whisper.cpp (tag legacy-cpu); they
are manual-import only, so users need to be told where to get them and how to
import them.

- CPU advisory notice: when the CPU has AVX but lacks AVX2 (Windows/Linux, not
  translated), add a "Download and import guide" button that opens the
  legacy-cpu release page. No button for CPUs without AVX, macOS, or
  translated environments, since no pack can run there.
- Once a custom addon is already enabled, the notice switches to a neutral
  info state asking the user to confirm it is the legacy pack, and refreshes
  live when the custom addon changes (gpu-settings-changed).
- Custom addon section: add a second "Legacy CPU pack" link next to the
  existing download link (the standard packs on the latest release require
  AVX2, so the two links must not be mixed up) plus a short tip.
- zh/en strings and tests for the eligibility policy, the notice and the
  custom addon section.
On Windows/Linux, CPU Only returned just the built-in CPU pack, so a
custom addon the user had picked was silently ignored. Auto, GPU Only and
macOS already put the custom addon first, which made the CPU advisory
notice ("custom addon enabled") untrue in CPU Only and forced the legacy
CPU pack guidance to tell users to keep the mode on Auto.

- addonLoader: the custom addon is now first in every mode. CPU Only
  resolves to custom -> built-in CPU, so a custom file that fails to load
  still falls back to the built-in pack.
- addonLoader: in CPU Only on Windows/Linux, force use_gpu=false on every
  native call. "Disable GPU acceleration entirely" and the CPU-only status
  card stay true even when the custom pack is a GPU build. macOS is
  unchanged, it never looked at the acceleration mode.
- Drop the "keep the acceleration mode on Auto" advice from the legacy
  pack copy (advisory notice and custom addon tip, zh/en) and the test
  assertions that required it.
- Add scripts/gpu/test-addon-candidates.ts (wired into
  test:gpu-enumeration): candidate order per mode and platform, the
  use_gpu override, and the fallback when the custom file fails to load.
@buxuku
buxuku merged commit b4210f0 into main Oct 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant