Formats: specialize the first two XMA FFT stages #3746

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/3746 into main
andrewpozdnakov7-jpg commented 2026-11-28 14:26:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T14:26:55Z.


The first two radix-2 FFT stages in the XMA inverse transform have the most blocks. Call the existing stage arithmetic with fixed lengths of two and four so the compiler can specialize those loops. The later stages use the same helper with their runtime length. Rotations, arithmetic order and output scaling are preserved.

In an optimized Windows x86-64 test binary, the exact main and proposed transforms produced the same 280,140 sample bits across nine sizes, two scales, generated coefficients, impulses, signed zero and subnormal values. In a separate run at the decoder's output scale, medians across 12 alternating pairs of 30,000 transforms were 1.831 to 1.518 µs for 128 samples, 3.445 to 2.983 µs for 256, and 7.379 to 6.100 µs for 512. Every pair in that run was faster. The first run with a different test scale gave median reductions of 14–18% across those sizes.

All 46 formats tests passed, with five ignored reference or benchmark tests. The existing test comparing against the untabled transform covers small sizes and heap scratch. Strict formats Clippy and the asset policy passed. #3702 changes only how the later post-rotation writes samples.

Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5541129804 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3746). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T14:26:55Z. --- The first two radix-2 FFT stages in the XMA inverse transform have the most blocks. Call the existing stage arithmetic with fixed lengths of two and four so the compiler can specialize those loops. The later stages use the same helper with their runtime length. Rotations, arithmetic order and output scaling are preserved. In an optimized Windows x86-64 test binary, the exact main and proposed transforms produced the same 280,140 sample bits across nine sizes, two scales, generated coefficients, impulses, signed zero and subnormal values. In a separate run at the decoder's output scale, medians across 12 alternating pairs of 30,000 transforms were 1.831 to 1.518 µs for 128 samples, 3.445 to 2.983 µs for 256, and 7.379 to 6.100 µs for 512. Every pair in that run was faster. The first run with a different test scale gave median reductions of 14–18% across those sizes. All 46 formats tests passed, with five ignored reference or benchmark tests. The existing test comparing against the untabled transform covers small sizes and heap scratch. Strict formats Clippy and the asset policy passed. #3702 changes only how the later post-rotation writes samples. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
andrewpozdnakov7-jpg commented 2026-11-28 14:30:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T14:30:58Z.


Windows CI passed on 47858da, including both Clippy configurations and the workspace tests. All 280,140 generated inverse-transform sample bits matched main in the paired release fixture. At the decoder's scale, the median transform time fell by 13–17% across the three subframe sizes. The integration with #3702 also preserved every sample bit.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding the change into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7240727682 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3746#issuecomment-7240727682). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T14:30:58Z. --- [Windows CI](https://github.com/Marvisak/VIctory/actions/runs/46154709354/job/141008696616) passed on `47858da`, including both Clippy configurations and the workspace tests. All 280,140 generated inverse-transform sample bits matched `main` in the paired release fixture. At the decoder's scale, the median transform time fell by 13–17% across the three subframe sizes. The [integration with #3702](https://github.com/Marvisak/VIctory/pull/3702#issuecomment-7240719548) also preserved every sample bit. The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding the change into another commit. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3746:upstream-pr/3746'
git switch 'upstream-pr/3746'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3746'
git switch 'upstream-pr/3746'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3746'
git switch 'upstream-pr/3746'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3746'
git switch 'main'
git merge --squash 'upstream-pr/3746'
git switch 'main'
git merge --ff-only 'upstream-pr/3746'
git switch 'main'
git merge 'upstream-pr/3746'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!3746
No description provided.