Repository navigation
D3D12.X: unmap a superseded texture only once the work before it is done - #2270
joeypercia wants to merge 1 commit into
Conversation
`unmap_superseded` NULL-mapped a placed texture's tiles on the tile-mapping queue the moment a newer placement covered it, with nothing ordering that against work already submitted that copies to or samples the texture. On NVIDIA Ampere and Blackwell GPUs a reserved texture whose tiles go NULL while a copy into it runs removes the device: the synthetic probe on xcl-dev#2057 (copies on one queue, the mapping flipped to NULL on another) gives 0x887a0006 on an RTX 5070 after 1.8 s, and passes on an RTX 4070 Ti (Ada). Title runs on xcl-dev#2057 on those GPUs end in a DRED page fault inside a run of CopyTextureRegion on a live texture. A mark (a fence signal) now goes on every title queue and upload queue, and the unmap, with the return of the texture's tiles, waits in a list until the CPU sees every mark done; `before_execute` makes the ones that are. The mapping queue never waits for a title queue, so the cycle found in xcl-dev#594 (a title queue waiting for work submitted later, behind the mapping queue) can't form. The design is upipibi's and Ali-AbdulHadii's from xcl-dev#594. A texture mapped again before its unmap is made keeps its tiles.
|
RTX 5080 16 GB (Blackwell), driver 621.40: two runs with this PR and two without, on #2057's head. One of each was removed and one of each ran to the 420 s limit, so on this card these runs show no difference either way. The probe passes all 13 cases here. @joeypercia, thanks for the probe and the fix. Numbers below. Setup: NVIDIA GeForce RTX 5080 16 GB (driver 621.40), AMD Ryzen 9 9950X, 32 GB RAM, Windows 11 Pro 26200, release. Retail title of #505, 1.0.2.1, Trees
Probe ( Title runs, all with
I could not tell from the log whether an unmap was actually held in runs 34 and 35: nothing logs it. Not tested: more than two runs per tree; this PR on AI use: Claude Code (Claude Opus 5.5) built the trees, ran the probe and the title on this machine, and wrote this report. |
|
Independent Windows verification of exact PR head Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver GPU regression test: Release and title regression run: Main: PR head: Limits: These brief startup runs do not establish whether the title exercised the superseded-texture unmap path, and frame counts are not a performance comparison. I did not run the full workspace suite on this PR head; the author reports it separately. The focused fixture's exact GPU identity remains unverified because it hard-codes DXGI adapter 0. AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows test and release build, monitored the paired title runs, checked the clean exact head, and drafted this report. No game data was uploaded. |
|
@kanade333 thanks, that's the result that was missing. Run 35 shows the in-world copy fault still happens with this PR, so this race isn't, or isn't the only, cause of it. I've added your runs to the description and narrowed what the PR claims to the race the probe shows on the RTX 5070. A held unmap isn't logged, as you found. A count of held and released unmaps under AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Independent dual-GPU Windows verification on exact PR head Tested
Not tested
AI use
|
|
AMD RDNA3 (native wave64) test report for exact head Tested
Not tested
AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above. |
…#2296, xcl-dev#2297, xcl-dev#2320, xcl-dev#2323, xcl-dev#2329, xcl-dev#2333 Integrates shader heap-base addresses (xcl-dev#1803), fenced superseded texture unmaps (xcl-dev#2270), cross-queue VRAM heap reclamation fencing (xcl-dev#2275, using create_raw_fence under Wine), PcCall frame clamping and orphan PSO drop (xcl-dev#2296), PSO pointer guards (xcl-dev#2297), KickoffX idle spare list switching (xcl-dev#2320, preserving UnadoptGuard), console-list descriptor heap binding (xcl-dev#2323), ClearUnorderedAccessView PC handles (xcl-dev#2329), and dispatch_chain PSO retention (xcl-dev#2333).
Integrates upstream PR xcl-dev#2306 (opt-in per-level texture page allocation via XCL_TEXTURE_LEVEL_PAGES=1), composed cleanly with xcl-dev#2270's HeldUnmap.
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Test report on an RTX 3090 Ti (Ampere): with this PR on #2057 the retail title's silent Setup
Not tested: this PR on its own head or with AI use: Claude Code (Claude Opus 5.5) merged the trees, ran everything above and wrote this report. |
vram::unmap_supersededNULL-maps a placed texture's tiles on the tile-mapping queue the moment a newer placement covers it. Nothing orders that against work already submitted that copies to or samples the texture. Changing a reserved texture's mappings under a copy that's running removes the device on at least one NVIDIA Blackwell card. With the probe, which copies on one queue while the mapping flips to NULL on another:0x887A0006after 1.8 s (Dezmonius).Title runs on #2057 on an RTX 5080 and an RTX 3080 Ti end in a DRED page fault on a live texture inside a run of
CopyTextureRegions (kanade333, dhillonjagdeep650-boop). This race is a cause that fits; whether it's the cause of those runs is not shown yet.Update: on an RTX 5080 (driver 621.40), @kanade333 ran #2057 with and without this PR, two runs each. One run with it was still removed by the same fault (
0x887a0006, DRED page fault at VA0x0inside a run ofCopyTextureRegions), and one without it reached the 420 s limit. So this race isn't, or isn't the only, cause of that in-world fault, and the probe passes on that card with that driver. What this PR fixes is the race the probe shows on the RTX 5070.Now
unmap_supersededputs a mark (a fence signal) on every queue the title submitted to and on XCL's upload queues. The unmap, with the return of the texture's tiles to the pool, waits in a list until the CPU sees every mark done.before_executemakes the ones that are. The mapping queue never waits for a title queue. That is the cycle found in #594: a title queue waiting for work submitted later on another queue, which waits behind the mapping queue. The design is @upipibi's from #594 and the variant @Ali-AbdulHadii ran there. #594 itself (@Abdellah-Khanani) waits on the GPU and conflicts withmainnow. This PR replaces that approach, and I'm happy to close it in favour of an update of #594 if its authors prefer.Part of #1773. Related: #475, #594.
What is in it (
crates/xcl/src/hle/d3d12x/vram.rs, one commit)Pages::mark(a reusable fence per queue),HeldUnmapandPages::release_held.unmap_supersededholds the unmap. If a mark can't be made, the texture stays mapped, as before any unmap.before_executemakes the held unmaps whose marks are done. Their textures are let go of afterPAGESis unlocked, because the last reference's release comes back toforget_pages.remap_if_unmappeddrops a held unmap: the texture never lost its tiles.a_superseded_texture_keeps_its_tiles_until_the_work_before_it_is_done. A title queue's submitted work is held behind a fence. The superseded texture keeps its tiles until that work is done and gets no NULL mapping before then, then the tiles go back. A texture mapped again before its unmap keeps its tiles, and its unmap is dropped. With the unmap made at once (as onmain), the test fails at "no unmap yet".Tested
XCL_ADAPTER=Radeon; Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug for the tests, release for the runs.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4onb7f6b76:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, which fails the same way onmain1a0bbe3on this iGPU (DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115).... ok), not skipped.SKIPPED: RTX 4070 Ti: the wave64 cases of thelower/lower_dxilGPU tests,gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64). RDNA2: the mesh-shader tests. Both:heap_window_out_of_memory_falls_back_to_the_switch_form,pso_measurement_compiles_an_exact_synthetic_record(no Developer Mode),test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_state, and thelower_dxilf16 / f32 cases the direct backend refuses.Regression run
RTX 4070 Ti (driver 621.40), release builds, 60 s each,
scripts/smoke.ps1 -Game <folder> -Title retail-titleon the newer retail title, one after the other from the same shell with the same settings.main1a0bbe3(this PR's base) and this PR's head (no uncommitted changes):main:
PR:
Not tested
r_null_during_copyqturned into XCL calls, would settle it.title_texturesshadows it).AI use