HLE: offload async saves, reuse audio buffers, pin APU heap, and decouple input rumble/dialogs #237
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!237
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-237"
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?
@wbkepler on GitHub · 2026-11-24 01:42 UTC · original
wbkepler:hle/async-saves-and-audio-hitches→main· +850 −156 · 6 files · 1 commits · openSummary
Eliminates save, audio, and input frame hitches across
victory-hle:xasync&xgamesave:xasync::pending_withruns on the shared thread pool withArc-owned state and a cancel guard (preventing UAF onXAsyncCanceland per-call OS thread creation).xgamesave*Asyncmethods (initialize_async,quota_async,delete_async,read_async,submit_async) snapshot caller handles/buffers synchronously and offload blocking disk I/O +sync_all()with a FIFOSaveTicketorder guard preserving crash-safe atomic saves.apu.rs:Connection::stateinto per-stream mutexes (zero 46 KiB per-packet allocation and no dequeue/count lock contention while keeping synchronous completion semantics).audio.rs:HEAPtoRwLock, replaces unbounded-lifetimeheap_byteswithHeap::slice/Heap::ptrheld under a single read guard perpump()pass (blocking concurrentApuFreeUAF and removing per-256-byte relocking), and reusesVoice::scratchacross XMA frame decodes/flushes.gameinput.rs&xgameui.rs:set_rumblefromHub::sourcevia lock-free per-padAtomicU64slots flushed onHub::poll.xgameui.rswith a RAIIDialogGuardchecked bygameinput::host::focused()to suppress key leakage during modal text entry.Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passed (including crash-safe save test and all 5 new tests)cargo xtask policy— passed (151 files ok)@jeremygold02 on GitHub · 2026-11-24 05:01 UTC · original
Thanks @wbkepler for the combined async-save, audio-buffer, APU, and input work. I tested the open PR at head
203d9f38407edeb74f37ae03f7a44b323cf402fbwith:Result: 91 passed, 0 failed, 0 ignored. Representative coverage includes APU scratch reuse without holding the state lock, audio heap pinning and voice-buffer reuse, host rumble routing, cancellation of queued XAsync work, FIFO ordering for offloaded async saves, and typed dialog completion. The suite is HLE unit coverage; it does not launch a title or exercise a real host audio device/dialog.
Relevant tests: apu.rs, audio.rs, gameinput.rs, xasync.rs, xgamesave.rs, xgameui.rs.
@Marvisak on GitHub · 2026-11-25 00:23 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-hle/src/modules/xasync.rs,crates/victory-hle/src/modules/xgamesave.rs,crates/victory-hle/src/modules/xgameui.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 00:42 UTC · original
I checked the Opus allocation change on exact
203d9f38407edeb74f37ae03f7a44b323cf402fbagainst current main63bcca43. The same synthetic Windows test measured allocations on the calling thread after eight warm-up calls, then ran 128 commands alternating mono and stereo with a trimmed deinterleaved stereo output.63bcca43: 128 allocations, 4,423,680 bytes requested.203d9f38: 0 allocations and 0 bytes requested during the measured commands.The outputs reported the same frame and byte counts, with PCM checksum
c4ab76792457d6abon both revisions. This confirms the per-stream scratch change against an allocation count as well as the existing scratch-capacity test.git merge-treeagainst63bcca43also finds anapu.rsconflict. In that file, the activation hunk can keep main's upfront 1–2 channel guard and assign the decoder toslot.decoderon success. The test hunk can keep bothreuses_pcm_scratch_and_decouples_state_lockand main'sdecodes_into_unaligned_output_interleaved_and_deinterleaved.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.