1 Commits
Author SHA1 Message Date
Jake WriterandClaude Opus 5.5 21fdf1c59c Canvas and Opus follow a claimed CPU vendor (Intel/AMD); vendor joins the fingerprint (#1024)
* Canvas: reproduce Intel's or AMD's RCPPS/RSQRTPS, chosen per identity

Skia's raster pipeline uses x86's estimate instructions for the
non-separable and dodge/burn blend modes, perspective and matrix
inversion. Intel and AMD implement them with different tables (the same
across each vendor's generations and OSes), so canvas readback shows the
host's CPU vendor.

- cpu-vendor-estimates.patch: pref gfx.skia.cpu_vendor_estimates
  (0 host, 1 Intel, 2 AMD). When it names the other vendor, rcp_approx
  and rsqrt_approx in the HSW and SSE paths compute that vendor's bits
  from a recorded table (SkCpuEstimates.h, SkCpuEstimateTables.h).
- browser/tests/cpu-estimates: records each vendor's table and checks the
  emulation against the native instruction over all 2^32 inputs, and
  against the other vendor's recorded hashes.
- Launcher (Python and TypeScript): cpu_vendor option and cpu:vendor key.
  The identity derives it from the GPU where only one vendor carries that
  GPU, and otherwise draws it at Firefox's x86 share (81.4% Intel). A
  coherence rule warns when the two disagree. Apple Silicon gets none.
- Guard cpu-vendor-estimates: stock Firefox 159 hashes from an Intel and
  an AMD CPU; the build matches each when told to.

Audio is not affected: its render splits x86-64 from ARM64, not Intel
from AMD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Opus: encode with the claimed CPU vendor's RCPPS/RSQRTPS; add the CPU probe

libopus's PVQ search (celt/x86/vq_sse2.c) uses the same two estimate
instructions as Skia, so a WebCodecs, MediaRecorder or WebRTC Opus stream
showed the host's vendor: stock Firefox 159 gives one byte stream on Intel
and another on AMD. libopus lives in libgkcodecs, which cannot read prefs,
so Gecko hands it the table gfx.skia.cpu_vendor_estimates selects
(opus_mozilla_set_cpu_estimates) before each encoder is created, and the
SSE2 search computes the estimates from it lane by lane.

The guard now also encodes one second of Opus and checks it against both
vendors' stock streams, on a secure page since WebCodecs needs one. It
passes on an AMD host for both vendors.

browser/tests/cpu-probe/ is the probe that found it: Math, DOMMatrix,
layout, canvas, WebGL, relaxed SIMD, Web Audio and WebCodecs, with stock
Firefox 159 results from Intel and AMD on Linux and Windows and from an
Apple M4 on macOS and Linux. Intel and AMD differ only in the six
estimate-based composite operations and Opus; ARM64 differs in much more,
which docs/HOST-PARITY.md now lists as not emulated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cpu:vendor: a core count only Intel ships implies Intel

No AMD x86 CPU since 2015 reports 10, 14, 18, 22 or 28 logical cores:
AMD runs one or two threads per core, and its one-thread parts have 2 to 8
cores. Intel's hybrids report all of them (Core Ultra 5 225, 245K, 125H,
155H; i7-14700K). So an identity with such a hardwareConcurrency is drawn
Intel, and a cpu_vendor='amd' beside it is reported and repaired.

The GPU still decides first: a Radeon APU beside an Intel-only count keeps
AMD and is reported, since no vendor matches both. The rule is renamed
cpu-vendor-matches-hardware. The counts live in launcher-constants.json
(intelOnlyCoreCounts) for both launchers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cpu {arch, manufacturer}: ARM64 emulation on x86 alongside Intel/AMD

The fingerprint's CPU is now { arch: "x86" | "arm", manufacturer } instead
of a bare vendor, validated per OS (launcher-constants cpuManufacturers):
e.g. Apple + x86 or AMD on macOS is rejected, as is a GPU that never sits
beside the claimed CPU. general.cpu_identity = 3 makes an x86 build compute
what Firefox's aarch64 build computes:

- Skia: the NEON raster pipeline and blend kernels, emulated lane for lane
  (SkOpts_neonemu, SkNeonEmu.h, SkArmEstimates.h).
- Opus: the aarch64 CELT kernels and the NEON inverse MDCT (celt_neonemu.c,
  celt_tx_neonemu.c, translated from celt_tx_neon.S by scripts/a64toc.py),
  for decode and encode.
- WebAudio / wasm / NaN payloads follow the ARM rules.
- libvpx: Firefox configures libvpx realtime-only for linux/arm64 and
  win/aarch64 (not mac/arm64), which changes WebCodecs VP9 output and
  rejects quality-mode VP8. The ARM64 configs are now the full encoder and
  realtime-only is a runtime switch (media.libvpx.realtime_only), so either
  build can produce either result. libvpx NEON itself is bit-exact with x86.

The launchers (Python and TypeScript) set general.cpu_identity and, for an
ARM Windows/Linux identity, media.libvpx.realtime_only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ARM64 identity: make the guard's probe reproducible, fail loudly in ffvpx

The guard served only the probe's own files, so the two webfonts 404ed and
the layout step threw. The probe page draws every input from one seeded
stream, so the throw shifted every later key and made wasm relaxed SIMD and
the convolver look wrong. The fonts now ship beside the probe (both freely
licensed, from Firefox's layout reftests), and the guard fails on any probe
step that errors where stock does not.

Canvas text is rasterized at the identity's devicePixelRatio, which the
launcher draws, so the guard leaves it out; at a ratio of 1 it matches the
M4's.

FFVPXRuntimeLinker asserts that libmozavutil exports the ARM64 switch
instead of skipping it silently. cpu:vendor is kept in properties.json as
removed, and the tribal rule, docs and the constants test follow the
general.cpu_identity pref.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 05:59:20 +00:00