HLE: overlapped DirectStorage I/O and persistent xmem section views #234
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!234
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-234"
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:40 UTC · original
wbkepler:hle/streaming-io-and-xmem→main· +924 −171 · 3 files · 2 commits · openSummary
Eliminates DirectStorage kernel file-lock serialization and
xmemper-chunk TLB shootdowns during asset streaming:dstorage.rs:FILE_FLAG_OVERLAPPED(OwnedHandle) and issues concurrent positioned overlapped reads via thread-local manual-reset Win32 events (ReadFile+GetOverlappedResultloop handling partial reads and EOF/Win32 errors).THREAD_PRIORITY_BELOW_NORMAL, reuses per-workerScratchbuffers (trimmed above 8 MiB), and replaces unconditionalnotify_all()wakeups with targetednotify_one()and waiter-aware notifications.xmem.rs:MapViewOfFile3above 2^40 withMapViewOfFilefallback) and per-pageAtomicU64committed bitmap on eachSection(preserving Wine whole-sectionSEC_COMMIT), eliminating transientMapViewOfFile/UnmapViewOfFileTLB shootdowns inpage_window/write_physical.PHYSICALlock, coalesces contiguous runs inXMemMapPhysicalPagesScatterandmap_alias(with placeholder-boundary fallback), and guards zero-length map/unmap operations.Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passed (victory-hle: 90 passed, 1 ignored)cargo xtask policy— passed (151 files ok)@wbkepler on GitHub · 2026-11-24 03:22 UTC · original
Found and fixed a regression in this PR (423d3f4).
Coalescing consecutive
XMemMapPhysicalPagesScatter/map_aliaspages into multi-page views made later single-page remaps unsafe.unmapcannot shrink a view, so remapping one page of a coalesced view unmapped the whole view and then mapped the remainder back. Neighbouring pages were briefly unmapped while other threads read them, which caused access violations on unmapped title memory during world loading (3/3 runs).Scatter and alias now map one view per page again, as before this PR. The persistent section views, overlapped reads, single-lock scatter and run-coalesced unmaps are unchanged.
Tests: a new regression test checks that remapping one scattered page leaves its neighbours' views in place, and a one-view-per-page test replaces the coalescing test. Workspace clippy, tests and
cargo xtask policypass. A live run now loads into the world (~3k draws/frame, indirect draws > 0) with no exceptions.@wbkepler on GitHub · 2026-11-24 20:39 UTC · original
Rebased onto current main (
ffe310e) ase39fc9c; one small conflict in xmem.rsunmap(kept upstream's zero-length guard and comment with this PR's saturating end). Gate (clippy -D warnings, tests, policy) clean.AI-assisted (Claude Code); checked on Windows 11 / RTX 5090.
@Marvisak on GitHub · 2026-11-25 00:22 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/dstorage.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@crashbashash on GitHub · 2026-11-25 00:23 UTC · original
Data from Linux/Proton on the persistent-section-view part, in case it helps review. I measured the same idea in a minimal version (one view per section, mapped on first write, unmapped with the section; a page window holds its section), not this PR's code:
main70564aeplus #1849 and #994's Proton commits, RX 6800 XT, GE-Proton11-14, hands-free, 120 s in the world per run, 4 runs before and 3 after.server/mapping.c:is_valid_view_addr,find_mapped_view), and the game keeps 130,000+ views alive in the world. wineserver ran at 75 % of a core, 99.5 % of it in those two walks, about 0.5 ms per request. The per-read DirectStorage views were 27 % of its map/unmap requests.map_aliaspages had a source consecutive with the one before, so coalescing could not have saved views there.AI-assisted (Claude Code). No game data attached.
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.