Skip to content

Performance Research A09 Prepared Voice Controls

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

Prepared voice-control data

A09 — Implementation and validation notes

Field Value
Evidence state Source-backed duplicate derivation; complete invalidation not established
Inspected source 322986f4c5502b3fa887a9605ac8cd88e9b2c579
First experiment Per-invocation typed controls and input-keyed derivations
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

Avoid a misleading premise. The sample-fetch function already reads several controls before its sample loop. The opportunity is not to “hoist every per-sample parameter,” because much is already hoisted. More promising duplication exists across scheduling, voice_process(), and resampler/fetch invocations, plus expensive derived values such as pitch and filter parameters. Voice processing and accessors.

First implementation. Decode a small typed control structure once per defensible processing interval. Retain mutable cursors, envelope transitions, active flags, and notifications in the stateful path. Cache pure derivations by their actual input values before attempting a long-lived cache of guest memory.

Cross-frame trap. voice_get_mask() reads guest physical RAM. Invalidating only on known VP MMIO methods will miss writes that reach that memory by another route. A generation counter is useful only if every relevant writer advances it. Broadening the APU lock does not solve that automatically.

Gain and proof. Count eliminated physical reads and repeated pure derivations. A frame-local cache is lower-risk but may have smaller gain; a cross-frame cache needs a complete invalidation proof. Compare outputs and all control transitions against an always-read path, with deliberate direct RAM updates as a negative control.

Preferred small first patch. A11's finite-domain attenuation table avoids this invalidation problem altogether.

First patch boundary

Do not start with cross-frame RAM caching. Keep cursors, active flags, envelope transitions and notifiers in the existing stateful path.

RAM-backed controls -> per-invocation decode -> input-keyed pure derivation; mutable state remains live

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

git grep -n -E 'voice_get_mask|voice_get_samples|voice_process|get_voice_bin_src_dst|attenuate' -- 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
A09.01 Repeat an invocation with identical controls, then vary each derived-value input independently. Unchanged inputs reuse equivalent values; every changed input reaches the correct derivation.
A09.02 Mutate relevant controls by direct guest RAM writes rather than only known VP methods. The next eligible observation sees the change; an MMIO-only invalidation scheme fails this control.
A09.03 Advance envelope/cursor/active state during normal voice transitions. Prepared controls do not freeze mutable state or suppress required reads/writes.

Counters and rejection criteria

Collect: control_reads, decoded_fields, derived_value_calls, cache_hits, invalidations, control_prepare_cpu_ns, frame_cpu_ns. Keep exact counts separate from sampled durations; use an uninstrumented build for performance qualification.

Reject or hold: Reject a stale control. Report reductions against current code, not a claim that all current reads occur inside the sample loop.

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