D3D12.X: forget released command queues from vram::Pages::waited #1899
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!1899
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1899"
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?
@emirduran707 on GitHub · 2026-11-24 22:46 UTC · original
emirduran707:d3d12x-vram-forget-released-queue→main· +51 −6 · 2 files · 1 commits · openvram::Pages::waitedcaches the last tile-mapping fence value each command queue waited on, keyed by the rawID3D12CommandQueueCOM pointer.real::q_releasenotifiedlist_x::on_queue_releasewhen a queue's refcount reached zero, but left its entry invram::Pages::waited.If a newly created command queue reuses a freed queue's COM pointer while
pages.valuehas not advanced,vram::before_executesees the stale entry and skipsqueue.Wait(&pages.fence, pages.value), allowing the new queue to execute against tiled resources before pendingUpdateTileMappingscomplete (and leaking a map entry for every destroyed queue).What is in it
crates/xcl/src/hle/d3d12x/vram.rs: extract the wait tracker intoFenceWaits, addvram::forget_queue, and add unit testreleased_queue_address_rewaits_on_reuse.crates/xcl/src/hle/d3d12x/real.rs: callsuper::vram::forget_queue(this as usize)inq_releasewhen the queue's refcount reaches zero.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on11fea40(rebased ontomain1a0bbe3): 1249 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpu;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record)gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_3) fail identically on unmodifiedmain1a0bbe3on this GPU (seeds 722 and 1599).cargo test -p xcl --lib released_queue_address_rewaits_on_reuse: 1 passed, 0 failedRegression run
main:
this PR:
Not tested
AI use
main1a0bbe3(a conflict incrates/xcl/src/hle/d3d12x/vram.rs: main rewrotebefore_execute; this PR'srecord_waitnow sits in main's version, andforget_queuefollows it) and reran the suite and smoke runs above.@upipibi on GitHub · 2026-11-24 22:51 UTC · original
An interaction to watch, from reading the diffs (not run). This PR, #1819 (
cpu_writes::on_queue_release) and #1691 all changeq_releaseinreal.rs.On
main, a queue the title submitted to rarely reachesn == 0:presentkeeps a reference to every such queue (#1668). #1691 (head81f6397) fixes that with a second path,n == 1 && present::forget_queue(this). That path drops the tracking reference and, when the count then reaches 0, callslist_x::on_queue_releaseagain. With #1691 in, that second path is how a released queue normally goes.This PR adds
vram::forget_queueonly in the firstif n == 0branch, and #1819 does the same for its hook. Whichever of them merges after #1691 would leave the stalevram::Pages::waitedentry (or theFENCESworker) in place on that normal path. One way to keep the three independent: a singleon_queue_gone(this)that calls every per-queue cleanup, used in both placesnreaches 0.AI-assisted (Claude Code).
@frenziedcoder on GitHub · 2026-11-24 23:21 UTC · original
NVIDIA test report for
7b493f3: no new test failures (the 4 that fail also fail on689f2db), its own testreleased_queue_address_rewaits_on_reusepasses, and a clean smoke pair on the retail title (1654 vs 1657 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head7b493f354667e57b5cd765f7dda4795d48118b34, no local changes.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 972 passed, 4 failed, 45 ignored; the PR's own testreleased_queue_address_rewaits_on_reusepasses. SKIPPED:gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu(no wave64),gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu(no wave64),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu(f16 packed, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 compares, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 conversions, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 rounding, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 three-source, wave64: no wave64),gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu(f32 transcendentals, wave64: no wave64),gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu(f64, wave64: no wave64),gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer arithmetic, wave64: no wave64),gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu(integer carries, wave64: no wave64),gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).fuzz_validate_and_gpu_0,fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_2,fuzz_validate_and_gpu_3ingpu::dxil::fuzz_tests. They fail the same way on the base689f2dbhere (0x8007000EfromCreateComputePipelineStateon seeds 70, 545, 1019 and 1507, the NVIDIA refusal @PHeitor1 reported on #1679), so this PR adds no failure.test_title_draws_with_a_root_signature_under_the_debug_layerreports ok, but this machine has no D3D12 debug layer (debug layer requested but unavailable … (0x887A002D)), so it ran without the layer and is no evidence either way.Regression run (
scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen;XCL_PSO_PRELOAD=0for both builds, because this machine's preload list holds the program of #1307)base (
689f2db, this PR's merge base withmain):this PR:
Not tested: the world load (the smoke runs stop at the start screen, so code that only runs later is not exercised there); AMD.
AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.
@DavidM1911 on GitHub · 2026-11-25 02:07 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
mainincrates/xcl/src/hle/d3d12x/vram.rs— needs a rebase before it can be tested.@JJAutoCompare on GitHub · 2026-11-25 04:14 UTC · original
XCL PR #1899 verification
Clean head
9c336500ee42c43197d6c7ec86cdeddaf169539don STOR-WINLAB. Windows 11 Enterprise Evaluation x64 (build 26200), Ryzen 7 3800X, Intel Arc A770 (driver 32.0.101.9175), DXC 1.9.2609.5, rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Debug/test profiles with debug info and incremental compilation disabled.Tested
cargo build --workspaceandcargo test --workspace --no-runboth succeeded outside the GPU mutex. Cargo built 19 test binaries.cargo test -p xcl --lib hle::d3d12x::vram::tests::released_queue_address_rewaits_on_reuse -- --exactwithXCL_ADAPTER=NONE_CPU_ONLYoutside the mutex yielded 1 passed, 0 failed, 0 ignored, 0 skips. The unit test verifies that a duplicate fence wait is suppressed, forgetting a released queue lets the same address request that wait again, and an advancing fence requests a new wait. The diff touches onlycrates/xcl/src/hle/d3d12x/{real,vram}.rs.cargo test --workspace --no-fail-fast -- --test-threads=4ran once underInvoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1. Cargo exited 101. Summing all 20test result:lines inpr1899-suite.log(19 binaries and one doc-test harness) yielded 1,110 reported passed, 28 failed and 46 ignored. The queue regression also passed in this run.Workspace failures and skips
xcllibrary had 27 GPU shader failures, includingCreateComputePipelineStateerrors (0x80070057) and shader result mismatches. Thee2etarget had one failure intest_title_runs_and_game_folder_is_untouched. ItsRSSetDepthBiasXcheck observed a blue pixel where it expected green.SKIPPED. They give no coverage for the skipped cases. Reasons include missing wave64 and D3D12 debug-layer support, per-lane forms refused by the recompiler, tiled-resource tier limits, unavailable heap windows, and inability to disable the driver cache.Not tested
Matched
mainbaseline, retail-title smoke run, other GPUs, sample-dependent paths (XCL_SAMPLE_*unset), and actual D3D12 queue address reuse.AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1899-suite.logand published.@thehollowedone on GitHub · 2026-11-25 09:38 UTC · original · edited 2026-11-25 12:57 UTC
Recheck on the rebased 11fea40
Same Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D and Rust 1.99.1 MSVC. The clean
cargo build --offline --locked --workspacepassed.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapturereported 1251 passed, 0 failed, 46 ignored. Cargo's passed count includes 25 runtime skips. The stock address-reuse test passed.I reran the same synthetic two-queue fixture separately with the D3D12 debug layer enabled. It passed with zero skips. Nonfinal release kept both records, and final release cleared only the releasing queue's record. Removing only the hook left both records and failed the same assertion. The debug layer printed live-object warnings at process exit. This fixture covers queue release and cache cleanup. It does not test a recycled native pointer with tile mappings still in flight or a retail run.
AI-assisted. Codex (GPT-6, exact variant unavailable) ran the recheck and drafted this update.
Earlier verification
Independent Windows run on 9c33650. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (621.35), Rust 1.99.1 MSVC, DXC 1.8.2502.11.
The clean
cargo build --workspace --offline --locked -j 4passed.cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --nocapture --test-threads=4finished with 1138 passed, 0 failed, 46 ignored. Cargo’s pass count includes 25 runtime skips (20 native wave64, three unsupported per-lane forms, one unavailable driver-cache control and one no heap windows). The stock address-reuse test passed.A scratch test used two real D3D12 queues on the same device. Both completed native waits on the mapping fence. Dropping a nonfinal reference preserved both wait records. Final release removed only the matching record, leaving the other queue’s record intact until its own final release. Omitting only the new cleanup call left the first queue’s stale record and failed the test. The focused filter
local_native_queue_final_release_forgets_only_its_own_waitpassed with the D3D12 debug layer enabled and no skips.The fixture covers native release without submission tracking. I also checked the exact #1691 and #1819 heads separately with
git merge-tree. Each conflicts with this head inreal.rs.I combined the three exact heads locally on 568e7db by sending both final-release paths through the same cleanup block. The same workspace build and test commands passed on the integration with 1159 passed, 0 failed, 46 ignored, including 25 runtime skips in Cargo’s pass count.
With the D3D12 debug layer enabled,
cargo test --offline --locked -j 4 -p xcl --lib local_combined_queue_cleanup_covers_both_final_release_paths -- --nocapture --test-threads=1passed 1 of 1 without skips. Using three native queues, the fixture verified that both final-release paths remove the tile-mapping wait record and CPU write worker. Intermediate releases preserved both records, and the third queue kept its records until its own final release. When cleanup was omitted only on the path where the tracking reference is the last one, both records remained and the test failed at that assertion. The fixture registered the queue with submission tracking directly. Coverage was sequential and synthetic.AI use: Codex (GPT-6, exact variant unspecified) prepared the scratch test, ran the checks and drafted this report.
@emirduran707 on GitHub · 2026-11-25 13:20 UTC · original
Thanks for pointing this out. Agreed: with #1691 in, the
n == 1 && present::forget_queue(this)path is how a released queue normally reaches 0, sovram::forget_queuehas to run there too. Whichever of this PR and #1691 merges second, I will rebase this one so both places where the count reaches 0 go through the same cleanup (a single per-queue "gone" helper, as you suggest), and add a test for the second path. Until one of them merges I am leaving the head as it is, so the reports above stay valid for it.AI use: Antigravity with Claude Opus 5.5 drafted this reply.
@oni-swr on GitHub · 2026-11-25 19:44 UTC · original
AMD RX 7800 XT test report
Tested locally by merging PR head
11fea400cd87edf8f562e359e1451d221f08183conto basemain3f2777019544c0ada2cd294aa792d3c378ff0df8(no push). The base is an ancestor of currentmainand both trees merge cleanly.Hardware and tools: AMD Radeon RX 7800 XT, driver 32.0.31035.1003; Windows 10 Pro; Rust 1.100.0 / Cargo 1.100.0; DXC 1.8.2502.11 (DXIL 1.8.2502.11). Debug test build.
cargo test --workspace --no-fail-fast -- --test-threads=4: 1,356 passed, 2 failed, 46 ignored. There were 7SKIPPEDreports: six GPU cases (wave32/wave64 variants for three unsupported instruction forms) and one heap-window case. The two failures and all 7SKIPPEDreports match the baseline (1,355 passed, 2 failed, 46 ignored).Not tested
AI use
Codex (gpt-6-luna) ran Phase 2 tests and wrote this report (Phase 1 pre-compile / initial baseline run used Claude Code (Claude Sonnet 5.5)).
@DavidM1911 on GitHub · 2026-11-26 00:34 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
github-bot referenced this pull request2026-11-26 06:18:31 +00:00
@ClosetPie107 on GitHub · 2026-11-26 06:49 UTC · original
AMD RDNA4 / Linux (Proton Experimental) test report on head
11fea400(merged cleanly ontomainb49be183):Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnuIsolated unit tests (
mainb49be183+ #189911fea400, debug,--test-threads=1,WINEDLLOVERRIDES="d3d12,d3d12core=n"):xcl.exe hle::d3d12x::vram:: -- --test-threads=1: 20 passed, 0 failed, 1 ignored (0 skipped).Combined 300 s retail sanity run (release,
mainb49be183+ #1540 + #1675 + #1844 + #1899 + #2123 + #2369 + #2422, retail 1.0.2.1 pressingApast menus):exit=0), 0 crashes, 0 device removals,2,014PresentXframes,131,072translated draws,660,943dispatches (44,546chained split-compute dispatches),102,631Opus packets (0 errors).Not tested
AI use
main, ran the Proton unit tests and combined retail run on this machine, and drafted this report.@Melow-code on GitHub · 2026-11-24 23:10 UTC · original · reviewed
The stale waited entry is a real bug — a reused COM pointer skipping a tile-mapping wait could corrupt GPU memory. Check how this interacts with #1691 and #1819 in q_release, since both touch the same cleanup path.
@bmjask on GitHub · 2026-11-25 21:25 UTC · original · reviewed
No concrete source defect found. q_release forgets queue only at refcount zero, and per-device clearing prevents reused raw queue address from suppressing required tile-mapping waits; current CI/smoke are green. Nonblocking gap: test covers FenceWaits directly rather than hooked q_release -> forget_queue -> before_execute with an address-reused queue. An integration seam would strengthen it, but I found no blocker.
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.