DSP: the reverb convolver passes the host checks (rebased #240) #2483

Open
github-bot wants to merge 3 commits from github-bot/gh-2483 into main AGit
Owner

@⁠kais7654 on GitHub · 2026-11-25 14:37 UTC · original
kais7654:dsp/reverb-on-windows → main · +557 −16 · 5 files · 3 commits · open

The reverb convolver of #240 (@⁠Quat3rnion, commit author preserved),
rebased onto main 940d32f and unblocked on the checks the CI enforces.

#240's head fails the check job on clippy -D warnings: five warnings in
the new code (two needless_range_loop in dsp_convolve.rs, dead_code on
reset and encode_ir — their only callers are the tests, so both are
cfg(test) now — an undocumented unsafe block in dsp.rs, and a doubled
f32 cast). All five are fixed in the second commit; the convolution
itself is untouched.

Commits:

  1. c3b3c64 — #240's change as it is (FFT convolver decodes the console's
    partitioned frequency-domain IR; FFT/IFFT streams still silence);
  2. the clippy fixes;
  3. #1943's descriptor-heap test adaptation (cherry-picked), because
    dynamic_slots_are_held_until_released and
    lists_share_a_table_and_copies_keep_their_views fail on a heap-capped
    host otherwise.

Verified on an RTX 5070 Laptop GPU, Windows 11, driver 616.87:
cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings passes, cargo test -p victory-hle is 150 passed / 0
failed (the seven convolver tests and the two
XDspActivate/XDspSubmitCommand end-to-end ones included), and the
victory-gpu suite passes on a host that caps its heaps. Not verified:
audio against the real title (no retail package here) — the same limits
#240 declared.

AI-assisted (Mistral Vibe).

**@⁠kais7654** on GitHub · 2026-11-25 14:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2483) `kais7654:dsp/reverb-on-windows` → `main` · +557 −16 · 5 files · 3 commits · open The reverb convolver of #240 (@⁠Quat3rnion, commit author preserved), rebased onto main 940d32f and unblocked on the checks the CI enforces. #240's head fails the check job on clippy -D warnings: five warnings in the new code (two needless_range_loop in dsp_convolve.rs, dead_code on `reset` and `encode_ir` — their only callers are the tests, so both are cfg(test) now — an undocumented unsafe block in dsp.rs, and a doubled f32 cast). All five are fixed in the second commit; the convolution itself is untouched. Commits: 1. c3b3c64 — #240's change as it is (FFT convolver decodes the console's partitioned frequency-domain IR; FFT/IFFT streams still silence); 2. the clippy fixes; 3. #1943's descriptor-heap test adaptation (cherry-picked), because dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views fail on a heap-capped host otherwise. Verified on an RTX 5070 Laptop GPU, Windows 11, driver 616.87: `cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings` passes, `cargo test -p victory-hle` is 150 passed / 0 failed (the seven convolver tests and the two XDspActivate/XDspSubmitCommand end-to-end ones included), and the victory-gpu suite passes on a host that caps its heaps. Not verified: audio against the real title (no retail package here) — the same limits #240 declared. AI-assisted (Mistral Vibe).
The console supplies reverb impulse responses as partitioned frequency-domain complex pairs. Decode that layout into a portable partitioned convolver so convolution streams return wet audio instead of silence. FFT/IFFT streams still return silence. Add seven unit tests for the convolver and an end-to-end test through XDspActivate and XDspSubmitCommand.
The descriptor and memory tests assert a host heap of every slot a
shader indexes (HEAP_VIEWS, HEAP_SAMPLERS) and a copy's views in the
pair range past the dynamic slots — both gone where the host caps its
shader-visible heaps (NVIDIA, HostHeap::new's shortcut): the heap is
smaller and the pair range is empty, so the pairs come from the
dynamic slots and both tests failed on a machine the runtime itself
runs fine on (#1744). The size and pair-range assertions say so and
skip there; WARP and every other machine keeps them.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
The reverb convolver's build carried five clippy warnings the check
turns into errors (clippy -D warnings): the reset and encode-IR helpers
have their only callers in the tests and are cfg(test) now, the block's
input and spectrum loops read through iterators, the IR slice's SAFETY
note sits next to its unsafe block, and a closure dropped a doubled cast
and its extra parentheses. The convolution itself is untouched: the
seven convolver tests and the two API end-to-end ones pass on Windows.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:07:06 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 14:58 UTC · original

Independent Windows verification (CPU + software WARP only; no hardware GPU)

  • PR head: 22bfa498d3ada1211a5c45804dc42e748ce4c010; origin/main: 940d32f69b22265690a0b5a15d6ded572ba33baf (merge base = origin/main; git merge-tree clean)
  • Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1
  • WARP: VICTORY_D3D12_WARP=1 with --features diagnostics (that is what makes victory-gpu pick warp_adapter(), i.e. Microsoft Basic Render Driver 0x1414; the tests do not print the adapter id).

Results:

  • cargo test -p victory-hle --lib --locked -- --test-threads=1: 150 passed, 0 failed, 0 ignored. This includes the new dsp::tests::convolution_through_the_api_returns_wet_audio, convolution_stream_as_the_title_drives_it, and all 6 dsp_convolve::tests.
  • cargo test -p victory-gpu --lib --locked --features diagnostics -- --test-threads=1 (WARP): 146 passed, 0 failed, 2 ignored. descriptor::host::tests::dynamic_slots_are_held_until_released passes on WARP. Note WARP does not cap its heap, so the new "device caps its heap" skip branches in the touched host.rs/memory.rs tests are not exercised here (they only matter on NVIDIA-style capped hosts).
  • cargo clippy -p victory-hle -p victory-gpu --all-targets --locked -- -D warnings: clean.
  • cargo xtask policy: asset policy: 183 files ok.

Diff review (by inspection, not covered by a run):

  1. Possible bug with stereo IRs: XDspActivate builds the IR slice as from_raw_parts(desc.ir, desc.ir_floats), but Convolver::new requires ir.len() >= ir_floats * channels when stereo_ir (option bit 8, 2 channels). With a slice of exactly ir_floats floats that check fails, so I expect any activation with the stereo-IR option to return E_INVALIDARG. The unit tests that cover stereo call Convolver::new directly with a longer slice, so the API path is not covered. Either the slice should be ir_floats * channels long (if ir_floats is per channel) or new should treat ir_floats as the total. Please confirm which the console API means.
  2. ir_floats that is not a multiple of 2 * frames silently drops the trailing partial block (accepted by valid).
  3. The Nyquist bin is assumed dropped from the console layout (reconstructed by conjugate symmetry, Nyquist taken as zero). I cannot check the layout against anything here; the tests validate the convolver against its own encode_ir, so they prove internal consistency, not hardware fidelity.
  4. Per-call Vec allocations in process are already flagged by the PR's shortcut: comment.

Verified by Claude Code (Claude Sonnet 5.5), an AI assistant, on behalf of a maintainer.

**@⁠oni-swr** on GitHub · 2026-11-25 14:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2483#issuecomment-7166112687) **Independent Windows verification (CPU + software WARP only; no hardware GPU)** - PR head: `22bfa498d3ada1211a5c45804dc42e748ce4c010`; `origin/main`: `940d32f69b22265690a0b5a15d6ded572ba33baf` (merge base = origin/main; `git merge-tree` clean) - Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1 - WARP: `VICTORY_D3D12_WARP=1` with `--features diagnostics` (that is what makes `victory-gpu` pick `warp_adapter()`, i.e. Microsoft Basic Render Driver 0x1414; the tests do not print the adapter id). Results: - `cargo test -p victory-hle --lib --locked -- --test-threads=1`: 150 passed, 0 failed, 0 ignored. This includes the new `dsp::tests::convolution_through_the_api_returns_wet_audio`, `convolution_stream_as_the_title_drives_it`, and all 6 `dsp_convolve::tests`. - `cargo test -p victory-gpu --lib --locked --features diagnostics -- --test-threads=1` (WARP): 146 passed, 0 failed, 2 ignored. `descriptor::host::tests::dynamic_slots_are_held_until_released` passes on WARP. Note WARP does not cap its heap, so the new "device caps its heap" skip branches in the touched `host.rs`/`memory.rs` tests are not exercised here (they only matter on NVIDIA-style capped hosts). - `cargo clippy -p victory-hle -p victory-gpu --all-targets --locked -- -D warnings`: clean. - `cargo xtask policy`: `asset policy: 183 files ok`. Diff review (by inspection, not covered by a run): 1. Possible bug with stereo IRs: `XDspActivate` builds the IR slice as `from_raw_parts(desc.ir, desc.ir_floats)`, but `Convolver::new` requires `ir.len() >= ir_floats * channels` when `stereo_ir` (option bit 8, 2 channels). With a slice of exactly `ir_floats` floats that check fails, so I expect any activation with the stereo-IR option to return `E_INVALIDARG`. The unit tests that cover stereo call `Convolver::new` directly with a longer slice, so the API path is not covered. Either the slice should be `ir_floats * channels` long (if `ir_floats` is per channel) or `new` should treat `ir_floats` as the total. Please confirm which the console API means. 2. `ir_floats` that is not a multiple of `2 * frames` silently drops the trailing partial block (accepted by `valid`). 3. The Nyquist bin is assumed dropped from the console layout (reconstructed by conjugate symmetry, Nyquist taken as zero). I cannot check the layout against anything here; the tests validate the convolver against its own `encode_ir`, so they prove internal consistency, not hardware fidelity. 4. Per-call `Vec` allocations in `process` are already flagged by the PR's `shortcut:` comment. Verified by Claude Code (Claude Sonnet 5.5), an AI assistant, on behalf of a maintainer.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:55 UTC · original

Automated triage for the maintainers.

Proposed close: this re-packages two other open PRs, #240 (the convolver, commit c3b3c64) and #1943 (the descriptor-heap test changes), and adds only the clippy fixes on top. Those fixes are welcome, but they belong on #240 (as a suggestion there or a PR to its branch), where the review is already going on. Splitting the same change across two PRs makes it harder to review.

It also still has the problems noted on #240, which the clippy commit does not touch:

  • The impulse-response layout Convolver::new decodes (complex pairs in blocks of frames, the Nyquist bin dropped, one run per channel) has no cited evidence, while origin/main's module doc in dsp.rs says the layout is unknown. The tests use the PR's own encode_ir, so they only show that the code agrees with itself.
  • valid() now rejects a null IR and ir_floats < 2 * frames, which changes what XDspActivate returns, again without evidence.
  • Stereo IRs fail: XDspActivate builds a slice of ir_floats floats, but Convolver::new requires ir_floats * channels when the stereo-IR bit is set, so a stereo stream with that option now gets E_INVALIDARG where main accepts it.
  • Comments in dsp.rs and dsp_convolve.rs use identifiers copied from the console SDK headers. Please reword them.

CI: passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2483#issuecomment-7167441785) <!-- victory-triage v1 head=22bfa498d3ada1211a5c45804dc42e748ce4c010 verdict=proposed-close at=2026-11-25T15:55:45Z --> Automated triage for the maintainers. Proposed close: this re-packages two other open PRs, #240 (the convolver, commit c3b3c64) and #1943 (the descriptor-heap test changes), and adds only the clippy fixes on top. Those fixes are welcome, but they belong on #240 (as a suggestion there or a PR to its branch), where the review is already going on. Splitting the same change across two PRs makes it harder to review. It also still has the problems noted on #240, which the clippy commit does not touch: - The impulse-response layout `Convolver::new` decodes (complex pairs in blocks of `frames`, the Nyquist bin dropped, one run per channel) has no cited evidence, while `origin/main`'s module doc in `dsp.rs` says the layout is unknown. The tests use the PR's own `encode_ir`, so they only show that the code agrees with itself. - `valid()` now rejects a null IR and `ir_floats < 2 * frames`, which changes what `XDspActivate` returns, again without evidence. - Stereo IRs fail: `XDspActivate` builds a slice of `ir_floats` floats, but `Convolver::new` requires `ir_floats * channels` when the stereo-IR bit is set, so a stereo stream with that option now gets `E_INVALIDARG` where `main` accepts it. - Comments in `dsp.rs` and `dsp_convolve.rs` use identifiers copied from the console SDK headers. Please reword them. CI: passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2483/head:github-bot/gh-2483'
git switch 'github-bot/gh-2483'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2483'
git switch 'github-bot/gh-2483'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2483'
git switch 'github-bot/gh-2483'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2483'
git switch 'main'
git merge --squash 'github-bot/gh-2483'
git switch 'main'
git merge --ff-only 'github-bot/gh-2483'
git switch 'main'
git merge 'github-bot/gh-2483'
git push origin 'main'
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/Marvisak--VIctory!2483
No description provided.