hex/android/app
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel 34bc8e4862
Android diagnostics: say where dictation's threads are kept, and name the speed test's rows by what they do (#2761)
* Android diagnostics: say where dictation's threads are kept, and name the speed test's rows by what they do

What:
- The report's Speech line adds "dictation threads: 4 kept ready on cpu
  4-7" (or "on any core", "started for every graph"), from the loaded
  model's pool, or before a load from the same check the pool will make.
- Each speed-test run and "Last dictation" say where that decode's threads
  were kept: hexspeech.cpp's timings gain an eighth value, read back from
  the decoding thread after the decode (-1 no pool, 0 any core, else a bit
  per core), so a refused sched_setaffinity reads as any core.
- pool_mask now also asks the kernel: it pins the calling thread to the
  mask and puts it back, and gives 0 (any core) if that is refused, so a
  pool is pinned to what the report says or not at all. New JNI:
  Whisper.usableCores, Whisper.poolCores.
- The speed test's rows are named by what they do, the same in every build
  from 2412: "new threads every graph", "threads kept ready, any core",
  "threads kept ready, fast cores" (only where Hex can tell the cores
  apart), "threads kept ready, 6"; the row this build's dictation uses is
  marked "(what dictation uses)". The faster-English row is unchanged.
- Debug builds only: am start --es cpu_capacity 300,300,1024,1024 (after a
  force-stop, before any dictation) stands in for the kernel's core
  ratings, so the emulator can take the pinned branch.

Why: after #2753, "as now" meant new threads per graph in 2409 reports and
a pinned pool afterwards, and nothing in a report said whether pinning
applied (it doesn't on an 8 Elite, where every core counts as fast), so
testers' reports couldn't be read.

Removed: the "as now" and "6 threads kept ready" labels.

Verified on basebook: ./gradlew testDebugUnitTest assembleDebug green (237
tests; StripTextTest's report cases now cover a pinned run, a refused one
reading as any core, the row marker, the Last dictation line and the words
for each pool state; hexspeech rebuilt). Not run on a device or emulator.

* Android diagnostics: no thread the speed test pins outlives its run; debug core ratings say so

What:
- SpeechModel.measure makes a fresh pool for every speed-test run on the
  test's own thread and frees it afterwards (Whisper.threadPool(handle, 0,
  0) before and after). Before, its finally put dictation's pool back from
  the test's thread: that pool's worker inherited the "Hex speed test"
  name and stayed pinned to the fast cores (the thread the gate emulator
  found on cpu 2-3 after the app speed test), and later rows could reuse a
  pool made elsewhere, whose workers the core sampler can't see.
- Dictation makes its pool again on the transcription thread when it next
  starts (ensurePool in prepare and before a standard decode; a no-op when
  the pool is there). dictationCores falls back to the cores a new pool
  would use when the model has none.
- The Processor line ends "(debug core ratings: ...)" under the debug
  override, so an emulator report can't pass for a phone's.

Checked, unchanged: the measuring thread itself (and the keyboard test's,
the same worker), a decode stopped with ✕ and a dictation's decode all get
their affinity back in hexspeech.cpp's decode, after the pool is paused;
freeing or replacing a pool (unload, release, another size or mask) joins
its workers, and ggml applies no affinity to the freeing thread; a paused
pool's creation applies none to its creator.

Removed: measure() no longer restores dictation's pool itself.

Verified on basebook: ./gradlew testDebugUnitTest assembleDebug green (237
tests; StripTextTest covers the Processor line with and without debug
ratings). The thread-affinity behaviour needs the emulator check.
2026-11-24 17:22:21 -05:00
..
src Android diagnostics: say where dictation's threads are kept, and name the speed test's rows by what they do (#2761) 2026-11-24 17:22:21 -05:00
build.gradle.kts Android: faster English dictation (Labs) (#2704) 2026-11-24 13:36:38 -05:00
proguard-rules.pro Android: faster English dictation (Labs) (#2704) 2026-11-24 13:36:38 -05:00