hle(dsp): replace O(N*TAPS) scalar convolution with partitioned overlap-save FFT (#17) #340
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/340"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by brainbudt on 2026-11-27T12:56:51Z.
Refs #17
VICTORY_GUESS_DSP=1incrates/victory-hle/src/modules/dsp.rspreviously ran a directO(frames * TAPS)scalar convolution loop (4800taps ×1024frames ×2channels ≈ 9.8M multiply-adds per block on the audio thread).What this changes
FftPlan+PartitionedConvolver) incrates/victory-hle/src/modules/dsp.rs.XDspActivate, and reuses all FDL/FFT scratch buffers acrossXDspSubmitCommandcalls (zero heap allocations on the audio path, including whencommand.input == command.outputviaprocess_in_place).VICTORY_GUESS_DSPunset: silence) andVICTORY_DUMP_DSP/VICTORY_TRACE_DSPdiagnostics are unchanged.Tests
cargo test -p victory-hle --locked: 98 passed, 0 failed, including:partitioned_fft_matches_scalar_reference_across_blocks_and_channels(exact comparison against theconvolve_mergedscalar reference across mono/stereo, multiple block sizes, and 12 consecutive blocks of512 × 2withTAPS = 4800, max error< 1e-3).partitioned_fft_unit_impulse_reproduces_ir_across_partitions(unit impulse across multiple partition boundaries and per-channel gains).partitioned_fft_in_place_matches_out_of_place(command.input == command.outputaliasing).cargo clippy --no-deps -p victory-hle --all-targets --locked: 0 warnings indsp.rs.cargo xtask policy: 376 files ok.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-27T13:28:50Z.
Check report:
befb6a09checked together with #337 and #340 merged onto main60baf130(M5 Pro 48 GB, arm64, with the converter):cargo test -p victory-hle -p victory -p victory-gpu -p xtask: all pass (victory-hle 144 passed, main 141 with the new tests of both PRs; victory-gpu 347 passed).cargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warnings: clean.cargo xtask policy: ok.Result: passes, and no review question is open. It can't be merged from my side (the branch rule requires an approving review), so it's ready for the maintainer. @brainbudt, one useful addition if you have time: a number for the speed-up (time per DSP block before/after for a typical IR length), since the tests show equivalence but not the gain.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by brainbudt on 2026-11-27T13:53:27Z.
Measured
--releasetime per DSP block (50blocks after warmup,TAPS = 4800/ 100 ms at 48 kHz, Intel Core i7-1165G7, Linux x86_64) comparingconvolve_merged(before) vsPartitionedConvolver::process(after):frames × ch)convolve_merged512 × 2(10.7 ms audio)4,854.3 µs60.3 µs1024 × 2(21.3 ms audio)9,714.0 µs115.9 µs1024 × 1(21.3 ms audio)4,835.6 µs58.1 µsAt
1024 × 2, per-block cost drops from ~46% of a 21.3 ms audio quantum to ~0.5% per stream, with zero heap allocations on the audio path.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:15:14Z.
Merged in
4cf84c83. Before pushing I ran the tests (native arm64), Windows clippy, the policy check, a release build, and one headless game run of the exact tree (170 s, Series S): menus at 30 fps, the world entered at about 81 s and kept presenting to the end at about 1 frame a second, 0 GPU errors, no crash. I did not listen for the reverb itself. Thanks.