Skip to content

Performance Research A06 Voice Worker Scheduling

github-actions[bot] edited this page Sep 15, 2026 · 1 revision

Voice-worker dispatch and reduction

A06 — Implementation and validation notes

Field Value
Evidence state Existing worker architecture; regrouping PCM counterexample reproduced
Inspected source 322986f4c5502b3fa887a9605ac8cd88e9b2c579
First experiment Inline small eligible work while preserving multipass grouping
Scope Addendum dated September 15, 2026; not a current-main benchmark or implementation status

Unproven performance research · Performance research — common test protocol · Performance research — reproducible checks

Evidence and implementation reasoning

Existing parallelism matters. xemu already has persistent voice workers, per-worker mix buffers, and a grouping scheduler for multipass dependencies. Empty work queues already avoid dispatch. The next idea is therefore adaptive granularity and cheaper reduction, not simply “add threads.” Worker implementation.

Specific opportunities. Run very small independent workloads inline; wake only useful workers; avoid clearing/reducing untouched bins where numerical and state semantics permit it. Measure whether serialized merge work and cache-line ownership transfers dominate as the worker count rises. Keep multipass source/clear/consumer groups intact.

Break-even model. Parallel work is worthwhile only when serial_work > scheduling + critical_worker_work + merge. Logical-core count alone is not a valid scheduling policy. Existing merges occur under the dispatch mutex in worker completion order, so do not assume today's output is already bit-deterministic across worker counts.

Numerical issue. Binary32 addition is not associative. The supplied checks include a normalized-amplitude counterexample. Changing reduction grouping can change mixer bits and, near a quantization boundary, the final 24-bit sample. Specify a canonical comparison order or an explicitly justified numerical acceptance policy instead of assuming mathematical real-number associativity.

Acceptance. Test 0/1/few/many voices, uneven HRTF loads, multipass groups, cancellation, saturation, different worker counts, pause/resume, and shutdown. Report scheduling, processing, merge, and total APU deadline misses independently.

First patch boundary

Measure the break-even point before choosing a threshold. Do not combine altered reduction order with a claim of bitwise-equivalent scheduling.

eligible voices -> dependency groups -> useful workers or inline -> defined reduction order

Locate the inspected seam before editing; names or ownership may have changed since the pinned review:

git grep -n -E 'voice_work_dispatch|voice_work_schedule|voice_worker_thread' -- hw/xbox/mcpx/apu/vp

Proposed focused tests

These are implementation gates to add or exercise, not claims that production tests already exist or passed. Retained standalone checks are on the checks page.

Test ID Setup / deliberate control Required oracle
A06.01 0, 1, 2, 4, 32 and 256 eligible voices; repeat with uneven HRTF cost and supported worker counts. All voices run exactly once; small-work overhead and imbalance are visible separately.
A06.02 Multipass source/clear/consumer groups; pause and shutdown with workers delayed. Dependency order survives; every pending owner completes or is canceled correctly.
A06.03 Run the binary32/PCM regrouping model and compare production output using a declared canonical order. The model yields PCM 1 versus 0; production output uses an explicitly defined equivalence policy, not real-number associativity.

Counters and rejection criteria

Collect: queued_voices, active_workers, empty_wakes, schedule_cpu_ns, worker_cpu_ns, merge_cpu_ns, deadline_misses. Keep exact counts separate from sampled durations; use an uninstrumented build for performance qualification.

Reject or hold: Reject lost/duplicated voices, broken multipass state or unexplained output drift. Compare total APU time and frame deadlines, not aggregate worker utilization.

Follow the common protocol for source identities, previous-main/fixed-baseline controls, raw results, confidence and retail/XISO qualification. No gain becomes proven from a model, cache hit, local operation count, or shifted wait label alone.

Clone this wiki locally