Repository navigation
perf: vectorize noise-gate levels and gain with exact state parity - #85
Draft
chriscoveries wants to merge 4 commits into
Draft
chriscoveries wants to merge 4 commits into
chriscoveries wants to merge 4 commits into
Conversation
Move the private gate state and scalar processing into a shared inline unit. Preserve the existing transition order and compare samples and carried state against the original scalar loop, including overlapping channel planes and exceptional input values.
Enable the SIMD-path assertion on x86-64. The scalar characterization returns zero vector frames, so sse2_processes_disjoint_full_vectors fails with expected 8 SIMD frames. All sample and carried-state parity checks remain enabled.
Process four samples per SSE2 block while retaining the scalar state-transition order. Use the original sample loop for overlapping planes, NaN-containing blocks, mono and scalar tails. Keep both gain application and carried state bit-identical to the scalar reference in the differential tests.
Add a correctness-only runner and an explicit Linux timing adapter using the shared A/B statistics code. Retain raw interleaved rounds, environment/load metadata, mutation results and the remaining format and native-module gates.
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope
Fork-only review, refs #27. A clean, independently usable noise-gate slice of the performance work on
087a25c7d977ad3fbcc12a572d95ec05042824de. No history from the old approximate dynamics experiment is reused. Compressor, limiter, expander, public APIs and workflows are unchanged. No upstream-connected branch or upstream discussion is modified.The ordinary production callback calls a private sample-processing helper. SSE2 processes four channel-level and gain values at a time; the gate's state machine keeps the original scalar operation order. Overlapping channel planes and NaN-containing blocks use the original scalar sample order. Mono and non-SSE2 platforms retain scalar processing. There is no allocation in the processing loop.
Test-first commits
a8d986121bc259b9c3e702dc9fcd9da89997930a.67d8854ea6af74e2c26ec314963a1a3ddc00d3c0.5d3911a7b57c7f209f17aad0aa18b69ae480fcd6.d4ccac3f845734b6f918f0a9170092999556bf26, subject starts withreview:.Exact RED output:
The new CTest executable compares actual samples, untouched tails and carried state bit-for-bit with the original scalar loop under the same block partitions. Coverage includes 1–8 channels, 8/44.1/48/192 kHz, lengths 0–1025, long quiet/burst transitions, threshold equality, zero-time parameters, inverted thresholds, signed zero, subnormals, infinities, quiet NaNs, and exact/partial channel-plane overlap.
Observed locally:
Mutating the overlap guard caused 13 failures; disabling the NaN fallback caused 2,627; using current instead of previous level for the close decision caused 117,777. Each exited 1. The production header was restored and its blob verified:
a2b04dc2e5b00eae36164b4255871e9458d2b812.Indicative speed-up (not a measurement on the reviewer's hardware)
AMD EPYC 9V74 80-Core Processor; Linux container exposes 5 logical CPUs, affinity 5; Linux 6.18.44; Clang 17.0.0;
-std=c11 -O2 -DNDEBUG -fno-fast-math -ffp-contract=off.The adapter reuses the exact shared
tools/ab_bench/core.pyfrom fork #70, blob9fc69edd742c3c10c247da7cbfd0d0fbca10aeb9. Nine AB/BA rounds per case, warm-up, 8,192 measured 1,024-sample blocks per side per round. Output/state equality is checked before timing; final output/checksum equality is checked every round. Raw per-round JSON and receipt are in the final review commit.Aggregate busy load was 0.0% before; during median 20.31%, range 18.75–21.88%. During-load includes the benchmark. No process identities were collected. This is one indicative virtualized-environment microbenchmark, not an end-to-end result or a prediction for the owner's Mac.
For the noise-gate portion alone of a stereo mic plus 5.1 desktop pipeline:
48000/1024 = 46.875blocks/s per track.((7174.3472−4874.9386)+(8596.1787−4479.0997))*46.875/1e6 = 0.30077 CPU-ms/ssaved. At 60 fps that is0.005013 CPU-ms/frame, or0.03008%of a 16.6667 ms frame budget. Other filters and video work are not included.Run without timing
bash test/review/noise-gate/run.sh --check # SSE2 check under an existing Rosetta installation arch -x86_64 /bin/bash test/review/noise-gate/run.sh --checkThe standalone test needs no OBS process, hardware device or external dylib. Native arm64 exercises scalar fallback only. The runner never commits, pushes or dispatches CI. The timing adapter is explicit Linux-only opt-in.
Required formatting checks: blocked
Pinned formatter retrieval was attempted and failed on package-host DNS. These checks are outstanding, not passing. No Rust source changed.
Remaining gates and recommendation
Full OBS OFF/ON module builds, native platform checks and the required format/lint tools remain to run. The minimal CMake driver is not a full OBS build. Floating-point exception flags and signaling-NaN traps are outside the tested contract. Keep improving until those gates pass. The kernel improvement is measurable here; the overall streaming CPU saving is modest. All runners, notes and raw measurements are isolated in the final
review:commit.