Memory: serialize sparse commits and decommits with uploads #236
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!236
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-236"
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?
@utkarshxdev on GitHub · 2026-11-23 21:43 UTC · original
utkarshxdev:intro-render-fixes-latest→main· +303 −126 · 3 files · 1 commits · openSerialize sparse CPU page updates with the upload scan. Previously, the scan could read a page while Windows was decommitting it, or a delayed commit record could mark a decommitted page live again.
What is in it
STATE. A sparse release returns the reservation to the allocator after successful decommit.VirtualAllocin sparse windows requiresMEM_COMMITand a range within one live reservation. Non-commit calls, includingMEM_RESETandMEM_RESET_UNDO, return null andERROR_INVALID_ADDRESS. This changes the previous host passthrough.VirtualQuerybefore attempting a read.Tested
cargo check --locked --target x86_64-pc-windows-msvc --offline --all-targetspassed, with one existing deprecation warning.03d4a86merged into0e946cf: Ryzen 5 5600G, RX 7800 XT driver 32.0.32029.2010, Windows 11 26300, Rust 1.100.0 MSVC.cargo test --workspace -- --test-threads=4reported 655 passed, 0 failed, 40 ignored, and no skips.Regression run
Historical A/B runs from the earlier revision. The display adapter is named in the output. XCL ran on the RX 7800 XT.
Main baseline
Earlier PR revision merged locally
Not tested
xcl-smokepair. The historical retail run did not exercise the sparseVirtualAlloccommit path.AI use
@srcamarda on GitHub · 2026-11-23 23:33 UTC · original
AMD run of
03d4a86merged ontomain0e946cf(clean merge), with a retail title, plus a few points from reading the diff.Tested
command_list_slots_include_131_and_132,intro_sparse_reservation_matches_the_observed_request,sparse_commit_rejects_invalid_ranges, the early-commit ones)cargo test --workspace -- --test-threads=4: 655 passed, 0 failed, 40 ignored, noSKIPPEDscripts/smoke.ps1, 90 s, six runs of each binary (two batches of three, each starting with a cold translation cache):main738 / 1 100 / 892 / 1 035 / 1 216 / 1 134 frames, this PR 1 052 / 1 026 / 947 / 948 / 1 194 / 976. Mean ~1 020 for both; no crash or device removal; the same peak commit (~17.2 GB).What the title does with it
mainthe same calls already reach the guard's stub (ID3D12GraphicsCommandList10::#131 (not on PC), 4 + 3 calls; #132 4 + 1), which returns 0 as well. So on this title the new handlers change nothing but the log, andmaindoes not crash there. Which title or build showed the null-vtable crash?XCL_TRACE_MEM, the title's reservations in 90 s are these, and none is0x1_3800_0000with plainMEM_RESERVE/PAGE_NOACCESS; every one carries extra flag bits: (plus three 64K-page / coherent-window ones and the placeholders). NoVirtualAlloc (sparse commit)line either, so the reworked commit path is not reached by this title. A different build of the game?Points from reading the diff
VirtualAlloc: onmaina call on an address in a sparse window withoutMEM_COMMIT(e.g.MEM_RESET/MEM_RESET_UNDO) goes on to the normal path. With this PR it now fails withERROR_INVALID_ADDRESS. Intended? It isn't in the description and has no test.xcl-smokeblocks forPR checks.Regression run (
gpu:names a virtual display adapter here, but XCL ran on the RX 7800 XT). The second run of the second batch for each:main:this PR merged onto
main(local merge commit):Not tested
ERROR_INVALID_ADDRESSpath, the PR on its own, NVIDIA.AI use
@ryosen0 on GitHub · 2026-11-23 23:47 UTC · original
Test report on our machine with this PR's head (03d4a86) stacked on current main (
db1ddb2) + #300 + #294 + #273 + #304: Ryzen 7 9800X3D, RTX 3060 Ti 8 GB (wave32), driver 32.0.16.1742, Windows 11.XCL_NETWORK=0 XCL_RUN_SECONDS=240 XCL_ACTIVITY=1 xcl run <retail folder>: clean exit at the timer, 3987 frames shown, no crash, no device removal. Intro stretch ~t=60-165 s at 4.9-6.4 fps, then a steady 30.0 fps to the end; the character loading screen is reached. BCPack refusals in the same run: BC5 44, BC7 20 requests (BC1 unpacked). The 41 console-MS-in-AS-slot refusals are unchanged.The same run without this PR (main + #300 + #294 + #273 + #304, 180 s): the same shape - dip 4.4-8.6 fps at t=44-166 s, 29.9 fps after. So on this hardware the PR neither helped nor hurt the intro pace measurably; the slow stretch looks bounded by something else (we see 6.5 GB local + 4.6 GB non-local video memory on the 8 GB card during it).
Not tested: the command-list slots 131/132 paths in isolation; no unit-test run for this report (run-only data point).
AI use: GPT-6.2 Astra (API model selector) ran the builds and runs and wrote this report; the human contributor watched the screen and reviewed it.
@ivall on GitHub · 2026-11-23 23:52 UTC · original
Thanks for this, and thanks @srcamarda and @ryosen0 for the runs. Not merged yet - what would get it in, in this PR:
MEM_RESERVE/PAGE_NOACCESSreservation of0x1_3800_0000, so the path never runs; if a real reservation needs to be in the sparse windows, the rule should come from what the reservation is (its flags / protection), not who makes it.mainthese calls already reach the guard's stub, which returns 0 too, so the new handlers only change the log, and no run showed the null-vtable crash they are meant to prevent. Either drop them, or say which title/build crashed there and with what log.STATE.lock()is the part worth having. Two things for it: say in the description (and cover with a test) the behaviour change srcamarda found -VirtualAllocwithoutMEM_COMMIT(MEM_RESET/MEM_RESET_UNDO) on an address in a sparse window now fails withERROR_INVALID_ADDRESSinstead of taking the normal path; and add a test that shows the race it closes (the upload scan reading a page mid-decommit), failing without the change.The two A/B runs above found no difference on a retail title either way, so with 1 and 2 gone and 3 tested this is a small, safe change. Please keep Tested (suite counts) and the
xcl-smokepair in the description.@utkarshxdev on GitHub · 2026-11-24 16:11 UTC · original
Hey @ivall, thanks for the guidance!
I've rebased on latest
mainand addressed all three review items:VirtualAllocnon-commit rejection (ERROR_INVALID_ADDRESS), and added the regression test for the upload scan / decommit ordering race.Branch is clean and rebased with zero conflicts. Ready for workflow approval and review whenever you're free!
@DavidM1911 on GitHub · 2026-11-25 15:19 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.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.