You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf: audio: verify or force vectorization of mix add and output clamp #3006
rust/obs-media-io/src/ffi/audio_output.rs:283 (clamp_audio_output): clamp to [-1, 1] and NaN → 0, every tick per mix. C: libobs/media-io/audio-io.c.h:115. The is_nan branch may block vectorization.
Running today: the Rust, when the Rust ports are on.
Expected gain: low to medium.
Parity: the C is scalar, so output must stay bit-exact. Element-wise add, cmpord and min/max stay exact; no FMA.
Acceptance criteria
Assembly for both loops on x86_64 and aarch64 posted on this issue.
Where a loop isn't vectorized, restructure it (branchless clamp, chunked slices) or add a std::arch path in src/platform/.
The parity tests stay bit-exact, and the audiomix benchmark (sub-issue 1) shows no regression and, where code changed, a gain.
Failing-test sketch
RED: an assembly or benchmark check showing the clamp loop is scalar (no maxps/fmax vector op), or a benchmark bound on audiomix/clamp/1024 that fails.
Rules for this work (#756): portable stable Rust only (no std::simd/nightly), a scalar fallback with runtime CPU detection, ISA-specific code only in the crate's src/platform/ (Dylint ban_platform_cfg_outside_boundary). Tier 3 parity is bit-exact unless the C reference itself uses SIMD (docs/rust-port/testing-policy.md:296). RED then GREEN. Every kernel needs a benchmark in rust/tools/benchmarks/record.py first (sub-issue 1 of the meta issue).
Triage: well defined (acceptance criteria and a failing-test sketch are in the body), but not Ready yet. It depends on #3003 (benchmark baseline in record.py), which is open. It becomes Ready once #3003 merges, and the baseline numbers decide whether this one is still worth doing.
Closing per the #3029 baseline: the mix add is equal to the C on both machines, and the whole output tick with the clamp is already 3.3x faster in Rust on x86 (0.96x on aarch64). Nothing to gain. See #3009.
Activity
zackees commentedon Oct 30, 2026
Triage: well defined (acceptance criteria and a failing-test sketch are in the body), but not Ready yet. It depends on #3003 (benchmark baseline in
record.py), which is open. It becomes Ready once #3003 merges, and the baseline numbers decide whether this one is still worth doing.zackees commentedon Oct 30, 2026
Closing per the #3029 baseline: the mix add is equal to the C on both machines, and the whole output tick with the clamp is already 3.3x faster in Rust on x86 (0.96x on aarch64). Nothing to gain. See #3009.