Audio DSP: the convolution's transforms as transforms of real signals, with AVX2 (1.6-2.25x per block) #4434

Closed
github-bot wants to merge 14 commits from github-bot/gh-4433 into main AGit
Owner

@⁠TolkoDev on GitHub · 2026-11-30 20:20 UTC · original
TolkoDev:pr/convolution-fft → main · +1109 −899 · 33 files · 14 commits · closed without merging

What it changes

Each block of the DSP's convolution ran two 2048-point complex FFTs on real signals: scalar, with the rotations read in strides. A title's command completes when it is submitted, so this runs on the thread that submits it.

  • The transforms are now 1024-point complex FFTs (even samples as the real part, odd ones as the imaginary part), with each stage's rotations side by side.
  • The block is also compiled for AVX2, chosen at run time. No FMA: the bits are the same with and without AVX2.

The low bits of the output differ from before.

How it was tested

  • GPU and profile: not a GPU change. Ryzen 7 7700, Windows 10.
  • Before / after, one 1024-sample block in a benchmark outside the game (rustc 1.98.1, fat LTO), with 1 / 46 / 187 response blocks: 26.4 / 34.6 / 62.2 us before, 11.7 / 17.5 / 39.8 us after.
  • Accuracy: against the same sums in f64 (noise for input and response), old and new both leave an error 134 to 137 dB under the output, within 1 dB of each other.
  • In the game: a build of v2026.11.30.02 with this change and other local changes, on Windows 10 with an RTX 5070. In one run of about 8 minutes the sound was normal by ear: no crackle, missing echo or odd tone noticed. In a later run, with a temporary log line in the block function (not part of this PR), the convolution ran in the game on the AVX2 path: 83 500 blocks in the 2 min 57 s from the first one (about 470 a second), with responses of 4 to 102 blocks at the logged moments. There was no side-by-side listening comparison with the old code.
  • Frame rate: not measured. None is expected.
  • cargo test: the 10 dsp tests of victory-hle pass (3 of them new or reworked for this: the transform against a plain sum, AVX2 against portable bits, and the existing direct-convolution test, which now goes through the new transform). The rest of the crate's tests were not run. Clippy reports nothing in dsp. CI's first Clippy step already fails on main (e1251c31) in victory-shader and victory-gpu.

Checked for overlap

  • Searched the file lists of the 803 open pull requests for convolve.rs: none changes it. Searched all pull requests for convolution and FFT. #623 (closed by its author on 2026-11-30, not merged) had also moved the convolution to real-input transforms and AVX2, among several other optimizations. It used the realfft crate and FMA. This one changes only convolve.rs, adds no dependency and uses no FMA.
**@⁠TolkoDev** on GitHub · 2026-11-30 20:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4433) `TolkoDev:pr/convolution-fft` → `main` · +1109 −899 · 33 files · 14 commits · closed without merging ## What it changes Each block of the DSP's convolution ran two 2048-point complex FFTs on real signals: scalar, with the rotations read in strides. A title's command completes when it is submitted, so this runs on the thread that submits it. - The transforms are now 1024-point complex FFTs (even samples as the real part, odd ones as the imaginary part), with each stage's rotations side by side. - The block is also compiled for AVX2, chosen at run time. No FMA: the bits are the same with and without AVX2. The low bits of the output differ from before. ## How it was tested - GPU and profile: not a GPU change. Ryzen 7 7700, Windows 10. - Before / after, one 1024-sample block in a benchmark outside the game (rustc 1.98.1, fat LTO), with 1 / 46 / 187 response blocks: 26.4 / 34.6 / 62.2 us before, 11.7 / 17.5 / 39.8 us after. - Accuracy: against the same sums in f64 (noise for input and response), old and new both leave an error 134 to 137 dB under the output, within 1 dB of each other. - In the game: a build of v2026.11.30.02 with this change and other local changes, on Windows 10 with an RTX 5070. In one run of about 8 minutes the sound was normal by ear: no crackle, missing echo or odd tone noticed. In a later run, with a temporary log line in the block function (not part of this PR), the convolution ran in the game on the AVX2 path: 83 500 blocks in the 2 min 57 s from the first one (about 470 a second), with responses of 4 to 102 blocks at the logged moments. There was no side-by-side listening comparison with the old code. - Frame rate: not measured. None is expected. - `cargo test`: the 10 `dsp` tests of `victory-hle` pass (3 of them new or reworked for this: the transform against a plain sum, AVX2 against portable bits, and the existing direct-convolution test, which now goes through the new transform). The rest of the crate's tests were not run. Clippy reports nothing in `dsp`. CI's first Clippy step already fails on main (e1251c31) in `victory-shader` and `victory-gpu`. ## Checked for overlap - [x] Searched the file lists of the 803 open pull requests for `convolve.rs`: none changes it. Searched all pull requests for convolution and FFT. #623 (closed by its author on 2026-11-30, not merged) had also moved the convolution to real-input transforms and AVX2, among several other optimizations. It used the `realfft` crate and FMA. This one changes only `convolve.rs`, adds no dependency and uses no FMA.
Each block ran two 2048-point complex FFTs on real signals, scalar, with
strided rotations. They are now 1024-point complex FFTs with each stage's
rotations side by side, and the block is compiled for AVX2 too (no FMA: the
same bits with and without).

One block on a Ryzen 7 7700, with 1, 46 and 187 response blocks: 26, 35 and
62 us before, 12, 18 and 40 us after (a benchmark outside the game). Against
the same sums in f64 both leave an error 134 to 137 dB under the output,
within 1 dB of each other; the low bits of the output differ from before.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 20:24:24 +00:00
Author
Owner

@⁠tikD1337 on GitHub · 2026-11-30 20:51 UTC · original

Tested headlessly on origin/main (e1251c31, Windows 11, no game run):

  • Merge check: clean against origin/main.
  • cargo test -p victory-hle -- modules::dsp::convolve: 4 passed, 0 failed (480 filtered), no new warnings.

(AI-assisted build/unit-test check; game runtime not launched.)

**@⁠tikD1337** on GitHub · 2026-11-30 20:51 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4433#issuecomment-7291559453) Tested headlessly on `origin/main` (`e1251c31`, Windows 11, no game run): - Merge check: clean against `origin/main`. - `cargo test -p victory-hle -- modules::dsp::convolve`: **4 passed, 0 failed** (480 filtered), no new warnings. *(AI-assisted build/unit-test check; game runtime not launched.)*
github-bot closed this pull request 2026-12-01 18:43:38 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:41 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4433#issuecomment-7321358324) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4434
No description provided.