xma2: borrow the bit reservoir instead of cloning it per frame #884
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!884
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-884"
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?
@mastrr9 on GitHub · 2026-11-24 07:24 UTC · original
mastrr9:perf/xma2-avoid-per-frame-reservoir-clone→main· +15 −2 · 1 files · 1 commits · openPart of #459. Eliminates the per-frame 32 KB
self.reservoir.buf.clone()heap allocation and copy incrates/xcl/src/hle/xma2/mod.rs(decode_frame):decode_frameonly reads the reservoir (its only writer,save_bits, is never called duringdecode_frame), so it now swaps the buffer out withstd::mem::takeintodecode_frame_fromand restores it immediately afterward.Tested
617.42/32.0.16.1742), Windows 11 Pro 25H2 (26200.9974),rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC debug, DXC Windows SDK10.0.26100.0,d3d12SDKLayers.dllinstalled6b825b83107a0f8cb729ea77630dbabdf1642f82cargo build --workspace: clean (no new warnings; only pre-existingfetch_updatedeprecation warning)cargo test --workspace -- --test-threads=4: 713 passed, 0 failed, 41 ignored (all 7hle::xma2::tests::*tests includingdecodes_xma2_and_xma1_bitstreams_matching_ffmpegpassed)SKIPPEDGPU tests:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64Regression run
Smoke run by @Toons29 in comment below: #884
Contributed by a community tester; the PR author did not run it. Both blocks are pasted as posted.
main:
PR:
Tester's setup and limits: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.Tester's AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; the tester checked the blocks before posting.Not tested
AI use
@ettehn on GitHub · 2026-11-24 07:27 UTC · original · edited 2026-11-24 07:29 UTC
Independent allocation check on Windows x64 (Ryzen 9 8945HX, rustc 1.97.1 MSVC, optimized). I built the unchanged XMA decoder modules from
beaa245and6b825b8in the same standalone harness, wrapping the system allocator to count alloc calls requesting exactly 32,832 bytes (the reservoir plus padding). After one warm-up, each build decoded the repository’s mono 48 kHz synthetic packet 100 times with EOS on the same decoder.Main made 1,200 allocations of that size; the PR made 0. Each decode produced 6,080 f32 samples equal to the warm-up, and the serialized PCM SHA-256 matched across both builds:
530d467ae72347511f4365fc3bb08406d284a88acfe768bca567397f63aa449d. In a separate optimized run with the default allocator, I timed 5,000 decodes after 200 warm-ups per process. Ten paired runs alternated main/head order. Median elapsed time was 194.95 ms on main and 159.58 ms on the PR (22.2% more samples/s on this mono fixture). The PR was faster in all ten pairs. This is decoder-only throughput on this CPU.OpenAI Codex (GPT-6.2 Astra) assisted with verification.
Originally posted by @ettehn in https://github.com/ivall/xcl/issues/884#issuecomment-7125021832
@SlopTart on GitHub · 2026-11-24 09:34 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
958c517onto main077ce40, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 706 passed, 10 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). bit-reservoir borrow tests green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@Toons29 on GitHub · 2026-11-25 03:06 UTC · original
Regression run of
958c517eon the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 100 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@JJAutoCompare on GitHub · 2026-11-25 05:45 UTC · original
Empirical test report (
958c517e)Tested commit
958c517e218843d9701b96d3d27603a5f92dbe90from PR #884.Hardware / environment
AuthenticAMD), 12 logical processors visible to the test process.rustc 1.100.0 (0ef1bc386 2026-11-09). DXC1.9.2609.5 (01b62ad47). Cargo used the test profile with debug info and incremental compilation disabled.Invoke-ArcTest.ps1. The focused run setXCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1. The selected tests use the Rust decoder and in-memory fixtures, with no D3D12 calls or GPU use.Commands and results
cargo test --workspace --no-runexited 0 after compiling the workspace test targets.cargo test -p xcl --lib hle::xma2::tests:: -- --nocaptureexited 0. 7 passed, 0 failed, 0 ignored, 0 skipped. No case-sensitiveSKIPPEDlines appeared in the captured output.Observed behavior
Not tested
The full GPU workspace suite and game smoke runs were omitted. This run also omitted XAudio2 playback and performance or allocation measurements.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr884-focused.logand published.@DavidM1911 on GitHub · 2026-11-25 09:52 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.