perf(victory): batch K32QueryWorkingSetEx queries in texture::mapped_bytes #439
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!439
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-439"
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?
@mauroalvare on GitHub · 2026-11-26 18:47 UTC · original
mauroalvare:perf/victory-mapped-bytes-batch→main· +289 −38 · 1 files · 2 commits · closed without mergingChange
texture::mapped_bytes()is called on every placed texture view scanned byState::heap_textures()(thousands of slots per frame during streaming) and duringresource::card_accounting().Previously, in the default
QueryWorkingSetExpath:committed(at, 1)andcommitted(end - 1, 1)separately — twoK32QueryWorkingSetExsyscalls even for completely unmapped ("away") slots or single-page ranges.readable(lo, 1, true)per block — oneK32QueryWorkingSetExsyscall per 64 KiB block (e.g. 65 syscalls for a 4 MiB texture, 257 syscalls for a 16 MiB texture, 2 syscalls even for a 64 KiB texture).This change batches
K32QueryWorkingSetExqueries intexture::mapped_bytes()while keeping identical block-probing semantics (including thehost::read_intofallback for committed-but-untouched pages not yet in the working set, and keepingVICTORY_COMMITTED_QUERY=1andVICTORY_MAPPED_BY_PAGE=1intact):[first_page, last_page](deduplicated to 1 entry when they are the same 4 KiB page) in a single 2-entryK32QueryWorkingSetExcall on a 32-byte stack buffer, avoiding any 4 KiB stack array initialization for unmapped ("away") or single-block (<= 64 KiB) textures.first_okfor block 0 (start's 64 KiB block) instead of re-querying it.K32QueryWorkingSetExsyscall (cutting a 4 MiB or 16 MiB resident texture from 65 / 257 syscalls down to 2).Verification
Base SHA:
c3cc02932fc596ee9d937e5743f73007c538365a(LooperSalty/AnyXboxX:main).Hardware: Windows x64, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (15995 MiB VRAM, driver
32.0.16.2140), 32 GB RAM.Synthetic streaming sweep benchmark (
--release, 10 sweeps × 2,900 slots = 29,000 calls)Command (identical test and
--releaseprofile on base vs fix):c3cc029)16MiB_full(100 slots)4MiB_full(400 slots)4MiB_half(400 slots)4MiB_away(1,600 slots)64KiB_full(400 slots)(All timings above are from the synthetic
mapped_bytes_streaming_sweep_benchmarktest; no game files or in-game FPS measurements were used.)Test & policy checks
Oracle and test data
VirtualAlloc(MEM_RESERVE/MEM_COMMIT/MEM_DECOMMIT/MEM_RELEASE) insidetexture::mapped_bytes_tests.mapped_bytes_matches_block_oracle_across_layoutsverifies exact byte-for-byte agreement against a 64 KiB block oracle across zero-length, unmapped, committed-but-untouched (read_intofallback), sub-page, single-block, unaligned start/end, middle-hole, >16 MiB (>256 blocks, multi-batch), unmapped-start/mapped-tail, and last-page-only single-block edge cases.Checklist
E_NOTIMPL), never a fake success.K32QueryWorkingSetExdocumentation).This change was investigated, implemented, and verified with AI assistance.
918dbad29bto5a253f8a045a253f8a04tob945c2f7f0@LooperSalty on GitHub · 2026-11-26 23:08 UTC · original
Closing after #454 moved
third_party/victoryto the Vice-Tay base (TaynanGT/Vice-Tay a252348).On the new base the default path counts mapped bytes through
inplace::shown_bytes(VICTORY_MAPPED_BY_VIEWS), so the per-blockK32QueryWorkingSetExloop is no longer on the hot path, and no gain was measured.Thanks for the work. If you measure a gain on the new base, a new PR against
mainis welcome.🤖 Closed by Claude Code on behalf of the maintainer
Pull request closed