D3D12.X: wait for tiled-texture queues in late_release #1304
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1314"
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?
Imported from ivall/xcl. Originally posted by ExoCalibra on 2026-11-24T14:38:34Z.
late_release::drain_knownwaited on title queues, the sparse tile-mapping queue, and title-texture upload queues before running a held resource's final COMRelease, but omitted the tiled-texture tile-mapping queues owned byvram::Pages. A released placed texture could therefore reach its finalReleasewhileUpdateTileMappingswas still in flight onvram::Pages.queue.What is in it
crates/xcl/src/hle/d3d12x/vram.rs: trackvram::Pagesqueues in a separateVRAM_QUEUESmutex and exposevram::queues()solate_releasecan snapshot them without takingPAGES.crates/xcl/src/hle/d3d12x/late_release.rs: includevram::queues()indrain_known(viadrain_queues), and add GPU regression testdrain_queues_waits_for_vram_tile_mapping_queue.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug (scripts/test.ps1) + release (cargo build --release -p xcl)..\scripts\test.ps1(cargo test --workspace -- --test-threads=4): 736 passed, 0 failed, 41 ignored.SKIPPEDGPU tests on this adapter:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64).Regression run
Main (
67a3735):PR (
7aa9d68):Not tested
XCL_SAMPLE_*tests on local sample files (not set).AI use
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:50:42Z.
Full-suite run, since this PR has no test report yet. Tested exact head
7aa9d68(on its base67a3735).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 736 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.drain_queues_waits_for_vram_tile_mapping_queue.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 736 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-24T15:28:11Z.
A regression run under Wine on Linux, on a retail title.
Tested
x86_64-pc-windows-gnu.7aa9d68as it is andmain930e8b4, no uncommitted changes. This PR's merge base is67a3735; themainruns are of930e8b4, a later commit ofmain. Retail title 1.0.2.1,scripts/linux/smoke.sh(#257) for 60 s, no input. Nine runs in a row,mainfirst and last, other PRs in between.Regression run
main (first run):
this PR:
The last
mainrun: 1338 frames,exit: 0x0, no device removal, no crash. Under Wine,peak commitreads 0 MB, so these blocks do not check memory.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:38:46Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, ~21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:47:39Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by safesearch77 on 2026-11-26T14:10:11Z.
I checked this against current
main(b49be183). The bug is still there, and the fix is still needed.On
main,late_release::drain_known(late_release.rs:131-139) fences the title's queues,sparse::queue()and the upload queues, but notvram::Pages::queue. Paths that queueUpdateTileMappingson that queue for a resource the title can then release:unmap_superseded→Pages::unmap(vram.rs:1036-1056,:727-748).bind/remap_if_unmapped/map_levels.A title queue is ordered after those mappings only at its next
before_executeWait (vram.rs:1207-1214). So a mapping queued after a queue's last Wait is not covered by the fence valueslate_releasesignals.The
vram.rshunk no longer applies (Pages::newis atvram.rs:618-650now, with aSetNamecall). Rebased, it is:and the
SendQueue/VRAM_QUEUES/queues()block unchanged, e.g. right afterforget_pages. Thelate_release.rspart applies as is. With that,cargo check --workspace --tests(x86_64-pc-windows-gnu) is clean apart from the 3 warningsmainalready has.Smaller points:
SendQueueand itsunsafe impl Sendare not needed.ID3D12CommandQueueis alreadySend:sparse.rs:416keeps one instatic QUEUE: Mutex<Option<ID3D12CommandQueue>>.Mutex<Vec<ID3D12CommandQueue>>removes oneunsafe impl.PAGESis the right design. It is the same reason assparse::QUEUE(sparse.rs:410-416): a lastReleasecan come from inside a D3D12 call while a holder of the state lock waits for that call. TakingPAGESinqueues()could deadlock the same way. The lock order is onlyPAGES→VRAM_QUEUES(the push inPages::newruns underPAGES,vram.rs:981), andqueues()takesVRAM_QUEUESalone, so there is no cycle."tiled tier < 2"and"no reserved textures". CONTRIBUTING andrunner::skip_testlistno GPU/no DXC/no wave64/no mesh shaders. WithXCL_REQUIRE_GPU=wave64, either of these other skips is turned into a failure (runner.rs:626-633).VRAM_TEST_LOCK.lock().unwrap(): most other vram tests (vram.rs:1700/1862/1965/2073,title_textures.rs:1528/1968) useunwrap_or_else(|e| e.into_inner()), so one failed vram test does not make this one fail too.I also checked
Held::drain's fence map for dead queues and its "one failedSignalkeeps the batch open" path. Neither is a bug onmain, so I am not asking for changes there:present::note_executeAddRefs title queues and never releases them (present.rs:292-314). The upload, sparse and tile-mapping queues are never dropped. So the map has no dead queues, and no address can be reused for a new queue.Signalfails in practice only on device removal (orE_OUTOFMEMORY), and all these queues are on the title's device.If #1691 (which releases queues) lands, its
forget_queuehandles the fence map.AI use: Antigravity (Claude Opus 5.5) helped trace the paths and rebase the hunk. I checked each point myself against
b49be183.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:24:59Z.
Triage (#1607) – head
7aa9d68#594 also concerns tiled texture pages, but the other way round: it makes vram's unmap wait for the title's queues, while this PR makes
late_releasewait for vram's tile-mapping queue. Not a duplicate.Main still does not include
vram's queue indrain_known.The PR conflicts with main:
late_release.rsnow builds the queue list in two places (active_queues_held()plussparse::queue()andupload_queues(), around lines 71 and 311), and both needvram::queues()after the rebase.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.