D3D12.X: a presenter waits for its last present before it is released #732
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!732
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/732/head"
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?
@MrCheese5 on GitHub · 2026-11-24 04:14 UTC · original
MrCheese5:uw-a-presenter-wait→main· +674 −31 · 2 files · 2 commits · closed without mergingStacked on #555; only the top commit belongs here. It fixes a lifetime issue in #555's presenter, so it could also be folded into #555.
Dropping a
Presenterreleased the swap chain, the scaler's descriptor heaps and the title's image while the command list of its last present could still be running on the GPU. #555'sswap_chain_follows_the_windowdrops its presenter right after the lastpresent_frame. When that list is still running, the device is suspended (0x887A0005) and the GPU tests that run after it in the same process fail. That depends on timing, so it happens intermittently.Dropnow waits for the presenter's fence: 2 s at most, and not after a failedSignal, when the presenter is already disabled.On
mainwithout #555, a presenter is dropped only when the present queue changes, and that path already waits for the fence. So the fix belongs on top of #555.What is in it
crates/xcl/src/hle/d3d12x/present.rs:Drop for Presenterwaits for the last presentTested
swap_chain_follows_the_windowalready reproduces the failure, intermittentlycargo test --workspace -- --test-threads=1: 695 passed, 0 failed, 41 ignored; SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64)--test-threads=4, GPU tests on this machine hang or lose the device tonight onmaintoo (bdab194and91f9a5e;bdab194had passed with 4 threads earlier the same night, and the driver logs GPU errors). Single-threaded,main91f9a5epasses (cargo test -p xcl --lib -- --test-threads=1: 647 passed, 0 failed).Regression run
Both runs use a fresh data root of their own and the default settings (a 1280x720 window, nothing new turned on), so this shows that nothing else changes.
Not tested
AI use
🤖 Generated with Claude Code
@RandomGithub12309 on GitHub · 2026-11-24 04:39 UTC · original
Test run and review of
b7900d0010b2b808ec3c77243f25c8fe40dbe6ebmerged cleanly ontomain(f4ce27c):Tested
32.0.16.2114, wave32, SM 6.6), Intel Core Ultra 7 255HX (20 cores), Windows 11 Build 26300,rustc 1.100.0stable-x86_64-pc-windows-msvc, debug buildcargo build --workspace+cargo test --workspace -- --test-threads=4hle::d3d12x::present::downscale::tests::route_filters_only_when_the_window_is_smaller,downscale_matches_a_cpu_area_filter, andswap_chain_follows_the_windowpass)SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Review
Drop for Presenterstill waits on a fence signaled beforesc.Present: In#555's base commit (present_frameincrates/xcl/src/hle/d3d12x/present.rs),q.Signal(&p.fence, p.value)still runs beforesc.Present(0, DXGI_PRESENT(0)). Because DXGI'sPresentsubmits internal queue work referencing the swap-chain back buffer afterward, waiting forself.valueinDropcan return before DXGI'sPresentwork finishes unlessSignalmoves afterPresentorDropsignals a drain fence before waiting.Not tested
0x887A002Dunavailable on this host), retail title (xcl-smoke)AI use
b7900d0ontof4ce27c, audited the diff, ran the workspace suite, and wrote this report.@LocranKing on GitHub · 2026-11-24 04:46 UTC · original
Tested on Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB, wave32).
Tested
b7900d0010b2b808ec3c77243f25c8fe40dbe6eb(pr-732, clean tree)8024 MiB VRAM, driver32.0.16.2101),rustc 1.100.0(x86_64-pc-windows-msvc, MSVC14.44.35207), DXC1.9.2602.17(SDK10.0.26100.0),--releasecargo test --workspace --release --no-fail-fast -- --test-threads=4: 695 passed, 0 failed, 41 ignored, exit0;2 (no wave64)skipped (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware)Regression run (
scripts/smoke.ps1, 60 s,XCL_NETWORK=0, title folder name redacted)main (
64b3f35):PR #732 (
b7900d0):Not tested: Debug build,
XCL_SAMPLE_*tests on this branch, AMD / wave64 hardware.AI use: Antigravity (
Gemini 4 Hydrogen) ran the build, tests, and smoke runs and drafted this report from the command outputs.@MesshM on GitHub · 2026-11-24 04:47 UTC · original
Test run of
b7900d0010b2b808ec3c77243f25c8fe40dbe6ebon AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge), so the tree tested includes the stack under it (#555).Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 704 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 663 passed, 0 failed, 21 ignoredSKIPPED; thepresenttests pass.Review: Waiting for the last present's fence before the presenter's swap chain, scaler heaps and image are released closes the lifetime gap described. Since it fixes #555's own presenter, folding it into #555 (as the description offers) would keep #555 from landing with the gap.
Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@JJAutoCompare on GitHub · 2026-11-25 06:03 UTC · original
Empirical test report (
b7900d00)PR #732 head
b7900d0010b2b808ec3c77243f25c8fe40dbe6eb.Hardware / environment
32.0.101.9175, WDDM 3.2) and a Microsoft Basic Display Adapter.1.100.0 (0ef1bc386 2026-11-09), unoptimized test profile, DXC1.9.2609.5 (01b62ad47).XCL_ADAPTER=A770. The fixture requests the default D3D12 device with a WARP fallback, so the device used by this test was unconfirmed.Commands and results
cargo test --workspace --no-runcompleted outside the GPU lock with exit code 0.Invoke-ArcTest.ps1acquired the GPU lock and ran the compiledxcllibrary test executable withhle::d3d12x::present::downscale::tests::swap_chain_follows_the_window --exactandRUST_TEST_NOCAPTURE=1. Exit code 101. 0 passed, 1 failed, 0 ignored, 0 skipped. The harness filtered out 675 other tests.Observed behavior
The fixture initialized D3D12 and the area filter. Its first 1280×720 frame failed at
CreateSwapChainForHwndwith0x887A0022(DXGI_ERROR_NOT_CURRENTLY_AVAILABLE), then panicked on the frame-shown assertion. This is consistent with the swap-chain restrictions Microsoft documents for Session 0. The first-frame failure prevented the fixture from reaching its final present or teardown after a successful present. The fixture also explicitly waits before dropping the presenter, limiting its ability to isolate the new destructor wait. Microsoft DXGI documentationNot tested
Interactive desktop presentation, teardown with a present in flight, the full GPU workspace suite, and game smoke runs were omitted.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr732-focused.logand published.@DavidM1911 on GitHub · 2026-11-25 11:38 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Prime1997 on GitHub · 2026-11-26 00:52 UTC · original
Closing because main already has this PR's own change.
587d77be(merged via #1988) makesDrop for Presenterwait on the presenter's fence for its last present, and skips the wait when the presenter is disabled or never signalled. The only difference is a 1 s timeout instead of 2 s. The downscale commit stacked under this PR belongs to #555, which is closed; its branch still holds that work.Compared at head
b7900d00against main08db802. Reviewed with Claude Code (Claude Opus 5.5); I checked the comparison before closing.Pull request closed