Repository navigation
Conversation
Split ImdctPlan twiddles into SoA stage-contiguous arrays and add a runtime-detected (is_x86_feature_detected!(avx2) && ma) AVX2+FMA implementation of ImdctPlan::imdct_half covering pre-rotation, fused multiply-free half=1/2 radix-4 stages, 4-wide/8-wide radix-2 FFT butterflies, and post-rotation interleave, keeping the scalar path as fallback. Measured in release mode on Intel Core i9-9900K (200k iterations per size): - N=64: 409.7 -> 83.1 ns/call (4.93x) - N=128: 808.6 -> 141.4 ns/call (5.72x) - N=256: 1643.3 -> 259.4 ns/call (6.33x) - N=512: 3281.9 -> 530.9 ns/call (6.18x) Part of xcl-dev#459. Assisted-by: Antigravity (Gemini 4 Neon)
ufoptg
pushed a commit
that referenced
this pull request
Nov 24, 2026
…nment GetResourceAllocationInfo (#25) and GetResourceAllocationInfo2 (#108) laid several resources out one after another, each at its own alignment, but returned the end of the last one as the size. The PC's docs for GetResourceAllocationInfo with several descriptions: "the C++ algorithm for calculating a structure size and alignment are used" - a 4 MiB-aligned resource between two 64 KiB-aligned ones takes 12 MiB, first or last 8 MiB, the alignment 4 MiB. XCL answered 8 MiB + 64 KiB and 4 MiB + 128 KiB: a title sizing one heap for the group from it got a heap that does not end on the alignment its resources need. The arithmetic of both is now one function, `allocation_of`, which pads the total to the largest alignment when there is more than one resource. One resource's info is still the driver's or XG's as it is (#108 asks #25 for each one alone); the per-resource offsets #108 writes are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Upstream PR xcl-dev#1030 was closed or merged. |
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.
Part of xcl-dev#459 (item 2: XMA IMDCT / FFT).
Splits
ImdctPlan's twiddle tables into SoA stage-contiguous arrays and adds a runtime-detected (is_x86_feature_detected!("avx2")&&fma) AVX2+FMA implementation ofImdctPlan::imdct_half, keeping the scalar implementation as fallback (for non-AVX2/FMA CPUs and sizes< 32).Overlap note: touches only
ImdctPlan(crates/xcl/src/hle/xma2/mod.rs:455-660) and adds one unit test — disjoint from xcl-dev#525 (quantizer gains), xcl-dev#526 (PCM output), xcl-dev#884 (bit reservoir), and xcl-dev#861 (extradata tests).What is in it
crates/xcl/src/hle/xma2/mod.rs:exp_r/exp_iand stage-contiguousstage_tw_r/stage_tw_iinImdctPlan::new.ImdctPlan::imdct_half_avx2(#[target_feature(enable = "avx2,fma")]): 8-wide pre-rotation, fused multiply-freehalf = 1, 2radix-4 pass, 4-wide VEX FMAhalf = 4pass, 8-wide aligned AVX2+FMAhalf = 8..len2/2passes, and 16-sample post-rotation/interleave.avx2_imdct_matches_scalar_for_all_xma_sizes: verifies AVX2+FMA matches scalar (max_err < 1e-5) across all XMA sizes (N = 64, 128, 256, 512) and multiple seeds.Measured speedup (
--release, Intel Core i9-9900K, 200,000 iterations per size)N)ns/call)ns/call)Tested
26300), Intel Core i9-9900K, AMD Radeon RX 6800 (16337 MiB VRAM, driver32.0.21045.29003),rustc 1.100.0(x86_64-pc-windows-msvc), DXC1.9.2602.17(debugfor tests,releasefor benchmark & smoke runs).cargo test -p xcl --lib hle::xma2::: 8 passed, 0 failed (includingdecodes_xma2_and_xma1_bitstreams_matching_ffmpeg,fast_imdct_matches_naive_reference_for_all_xma_sizes, andavx2_imdct_matches_scalar_for_all_xma_sizes).XCL_REQUIRE_GPU=wave64,mesh+cargo test --workspace --no-fail-fast -- --test-threads=4oncdf2078: 725 passed, 3 failed, 41 ignored, 0 GPU skipped (xcllib: 683 passed / 3 failed / 21 ignored; integration/e2e: 42 passed / 0 failed / 20 ignored;XCL_SAMPLE_*unset).placed_title_textures_share_vram_and_preserve_pixels(3D 64x64x64 4 mips: subresource 2 mismatch, fixed by open PR D3D12.X: map a one-slice title texture's packed mips where D3D12 addresses them xcl-dev/xcl#470) plus its 2VRAM_TEST_LOCKPoisonErrorcascades.Regression run
Both runs below used the same warmed shader/PSO cache on
YouKnowWho(60 s):main(09940bb87fa1):PR head (
cdf2078e9bbc):Not tested
YouKnowWhouses Opus, so its smoke run above is a regression check only; XMA2 decoding itself is verified against the FFmpeg reference test vectors indecodes_xma2_and_xma1_bitstreams_matching_ffmpeg).XCL_SAMPLE_*unset).avx2_imdct_matches_scalar_for_all_xma_sizes).AI use
Mirror of xcl-dev#1030 (auto-synced, do not edit).