Repository navigation
Conversation
Late release (e7da8a1) holds a resource whose last Release comes while a queue may still use it, but res_release still gave back what XCL placed under it at the title's Release: the unified-memory block went back on the free list (the next resource could get it while the GPU still used it), and a sparse block was decommitted and its tiles unpinned. The bookkeeping still goes at the title's Release. A held resource's block and its sparse tile pins go to late_release, which unpins the tiles before the resource's final Release (its address is no other resource's yet) and frees the block after it. A release that is not held frees at once, as before. Fixes xcl-dev#1040 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Upstream PR xcl-dev#1070 was closed or merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Late release (
e7da8a1) holds a resource whose lastReleasecomes while a queue may still have work on it. Butres_releasestill gave back, at the title'sRelease, what XCL had placed under the resource. The unified-memory block went back on the free list, so the next resource XCL placed could get it while the GPU still used it. A sparse block was decommitted and its address range returned, and the buffer's tiles were unpinned (sparse::forget_buffer→release_if_unused). The held resource's in-flight work could then read another resource's data or unmapped tiles.e7da8a1measured 356 held releases on the retail title.XCL's bookkeeping for the resource still goes at the title's
Release, as before (a held object keeps its address). A held resource's block and its tile pins go tolate_releasewith it:drain_knownunpins the tiles before the finalRelease(while the resource is alive, its address is no other resource's) and frees the block after it. A release that is not held frees at once, as before.vram::forget(arena release, which has its own delay) andtitle_textures::forget(bookkeeping) are unchanged. Fixes xcl-dev#1040.What is in it
crates/xcl/src/hle/d3d12x/real.rs:res_releasepasses the block tolate_release::holdwhen it holds the resource, and skipssparse::forget_bufferthen;free_backing(the UMA / sparse free, as before).crates/xcl/src/hle/d3d12x/late_release.rs: held entries carry their block;drain_knownunpins, releases, then frees. The two existing tests now carry the pair.crates/xcl/src/gpu/uma.rs:Uma::is_allocated, test-only (#[cfg(test)]).held_release_tests::a_held_resource_keeps_its_unified_memory_until_it_goes. A known queue stands still on a fence; an adopted buffer gets a unified-memory block recorded asplace_console_bufferdoes; its lastReleasegoes throughres_release. The block must stay allocated while the queue has work, and go once it has passed. On main it fails at the first check ("the block under a held resource went back while a queue still had work").Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at9aa0e9a(on main47efa2e): 742 passed, 0 failed, 41 ignored, 0 SKIPPED.cargo test -p xcl --lib held_release_tests: fails on main, passes with the change; 5 of 5 runs passed alone.late_release::tests(2) pass.Regression run
Not run yet: there's no runnable title on this machine. A tester with any unpacked Xbox Series title can supply the pair (the title need not reach this code): in clean checkouts of main and of this PR's head,
cargo build --release -p xclthen.\scripts\smoke.ps1 -Game '<folder>' -Seconds 60, same title and machine, and post bothxcl-smokeblocks here. I'll put them in this section.Not tested
free_backing/forget_buffercalls.XCL_LATE_RELEASE=0(nothing is held, so the change does nothing there).AI use
🤖 Generated with Claude Code
Mirror of xcl-dev#1070 (auto-synced, do not edit).