D3D12.X: a queue the title releases is not kept alive by submit tracking #1691
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!1691
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1691"
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?
@b3IKK on GitHub · 2026-11-24 19:20 UTC · original
b3IKK:d3d12x/released-queue-not-retained→main· +248 −15 · 3 files · 1 commits · openFixes #1668.
present::note_executetook a reference to every command queue a title submitted work to (solate_releasecan fence what it holds), and never dropped it. The queue's own lastReleasetherefore only brought the count to 1,q_releasenever saw 0, and every queue a title ever submitted to — with the driver memory behind it — stayed allocated for the rest of the process.That is the asymmetry in the issue: "create and release unused queues" passes 128/128 (no submit, so no reference is taken), while "create, submit, synchronize and release" fails on the 64th queue with
E_OUTOFMEMORY.This drops the reference when a release brings the count down to it (
n == 1): the queue is forgotten by the submit tracking (and the present candidate that names it), the fencelate_releasekeeps for that queue is dropped, and the reference goes. The presenter now also holds its own reference to the queue it makes a swap chain for, so that pointer cannot dangle once the title lets its queues go.Since the review (@upipibi's race, validated by @DEViANCEVxXXxM on an RTX 3090): a tracked queue can now be freed, so the two readers of the list no longer take raw pointers out of it.
late_release::drain_knownandreal::drain_gpuget their references frompresent::known_queues_held(), which takes them while the list is locked.And the device loss from the follow-up runs: a queue has to outlive the work submitted to it. Dropping the reference as soon as the title's last release arrived could free a queue the GPU was still executing —
0x887A0005in 1 of 6 runs on @upipibi's RTX 3070 with this change merged ontomain. The released queue's reference now goes tolate_release, which signals a value on that queue's fence and lets the reference go once every earlier submission has passed it, exactly as it already holds a resource's last release.list_x's queue list is cleared when that reference finally goes, not before.What is in it
crates/xcl/src/hle/d3d12x/real.rs: inq_release, when the count reaches the one reference the submit tracking holds, hand the queue back (present::forget_queue) and pass the reference tolate_release::hold_queue;drain_gpusignals queues it holds a reference to. GPU testsa_queue_the_title_releases_is_not_kept_alive_by_the_submit_tracking,a_tracked_queue_a_reader_holds_outlives_the_titles_releaseanda_released_queue_is_held_until_its_submitted_work_is_done.crates/xcl/src/hle/d3d12x/present.rs:forget_queueuntracks a released queue and drops the present candidate naming it;known_queues_heldreturns the tracked queues with references taken under the lock;new_presenterholds its own reference to the queue andPresenter::dropreleases it.crates/xcl/src/hle/d3d12x/late_release.rs:forget_queuedrops the fence kept for a queue that is gone (a sealed batch keeps its own clone);hold_queuefences a released queue and drops its reference once the fence passes;take_released_queuesindrain_known; oneensure_threadstarts the drain thread for both paths (holdandhold_queue), so a title that does both does not run two.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 1246 passed, 0 failed, 46 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib -- a_released_queue_is_held: 1 passed. With the deferral taken out: 0 passed, 1 failed —the GPU may still run what was submitted to the queue: its reference is held.mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares,rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang,timestamps_outside_unified_memory_land_after_the_queue),--test-threads=2, 5 runs: 3 passed, 0 failed each time.cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=2, 2 runs: 180 passed, 0 failed, 2 ignored each time, no device removal.Regression run
main (
426a5a7, clean tree, no local changes):PR (
f71cf21, clean tree, no local changes):Not tested
hle::d3d12x::subset with two threads were clean on this RTX 5080, so the deferral is shown by the new test (the released queue is held while its work is in flight) rather than by a device removal that no longer happens.AI use
present/late_release/q_release, wrote the fix and the tests (and confirmed each fails with the change it covers taken out), applied the reviewers' ownership change and the deferred queue release, rebased onto568e7db, ran the test suite, the named tests and thescripts/smoke.ps1runs, and drafted this PR description.@DEViANCEVxXXxM on GitHub · 2026-11-24 19:36 UTC · original
Thanks for the quick fix! I'm the original reporter of #1668.
I have an RTX 3090 available and can independently validate this PR using the original synthetic regression, concurrent stress, endurance, and GPU data integrity tests.
I'll post the results here for comparison.
<html>Independent validation — PASS
Tested commit
Test | Result -- | -- Original unused queue regression | 128/128 Original submitted queue regression | 128/128 Concurrent stress repeatability | 10/10 runs Single-process endurance | 4096/4096 operations Concurrent GPU copy integrity | 1024/1024 copies Verified data values | 1,048,576/1,048,576 OOM, timeouts, reported D3D12 errors | None1de417cca5163665c181d5a3557bff6df77c59e5on my RTX 3090 (driver 621.01, Windows 26H1 build 28000.3501), with the D3D12 debug layer enabled.The original failure from #1668 no longer reproduces. All 12 additional stress runs passed using unchanged synthetic test binaries.
One additional observation: during the endurance test, the device reference count was 112, 131, 142, and 161 at rounds 128, 256, 384, and 512 respectively. The final Live Producer refcount was 155. These snapshots were taken under concurrent load, so this is not conclusive evidence of a remaining leak, but may be worth investigating separately.
The original queue exhaustion regression is confirmed fixed in my test environment.
Thanks for the fix!
</html>@upipibi on GitHub · 2026-11-24 19:47 UTC · original
Tested on an RTX 3070 (driver 616.56, Windows 11) at
1de417c.a_queue_the_title_releases_is_not_kept_alive_by_the_submit_trackingpasses.hle::d3d12x::146 passed, 0 failed, 3/3 runs. That's with #1523 applied. Without it, the subset crashes 3/3 with0xC0000005: that's the fake-fence crash #1523 fixes (it does the same onmain), not this PR.One race this PR opens. Before it, a queue in
QUEUESwas never freed, soknown_queues()returning raw pointers was safe. Nowq_releasecan free a queue right after it leaves the list, and both callers use the pointer after the lock is gone:late_release::drain_known(runs on the late-release thread and on everynote_execute): snapshot, thenfrom_raw_borrowed(..).clone().real::drain_gpu: snapshot, thenSignalon the borrowed pointer without a reference of its own.Interleaving: the reader snapshots → the title's last
Releasetakes the count to 1 →forget_queue→ the secondf(this)frees the queue → the reader AddRefs freed memory. This is from reading the code, not observed. Two threads (one making, submitting to and releasing 3000 queues, one readingknown_queues()likedrain_known) didn't crash in 5 runs, but a freed queue doesn't reliably fault.Suggested fix: take the references while the list is locked.
forget_queue's return value then decides which thread does the final release, because a reader's reference either lands before the queue is removed (the title's secondf(this)then returns 1 and the reader's drop frees it) or the reader doesn't see the queue at all.With this on top (and #1523):
hle::d3d12x::146/0, 3/3 runs, and the two-thread test passes.A side effect on the new test: it asserts
release(raw) == 0. While my reader thread ran in parallel, it gotleft: 2once in 5 runs, because the reader held a reference at that moment. In a normal parallel suite, any test that callsnote_execute(and sodrain_known) can do the same. Checking!known_queues().contains(..)after the release, rather than the exact count, would avoid adding another #1487-style flake.AI-assisted (Claude Code). No game files; synthetic tests only.
@DEViANCEVxXXxM on GitHub · 2026-11-24 21:27 UTC · original
@upipibi I independently validated your exact suggested patch on top of
1de417con my RTX 3090.Synthetic regression and stress tests:
Regarding the refcount assertion:
I added an isolated test that explicitly retains an owned queue snapshot during the title's release. All five runs produced:
This confirms your observation about the exact refcount assertion. One additional nuance: checking registry membership immediately after the title's release can also be unreliable while a snapshot remains alive. Checking membership after the temporary owner is dropped passed consistently.
Regarding #1523:
I tested all four combinations of the original PR, your ownership patch, and #1523 (
1362129).All eight serial suite runs passed. Four parallel runs also passed, but a subsequent parallel run with both patches encountered DXGI_ERROR_DEVICE_REMOVED / DXGI_ERROR_DEVICE_HUNG, accompanied by an NVIDIA driver event 153.
I stopped the remaining runs after the device loss. I did not reproduce the fake-fence access violation, and I cannot attribute the device loss to either patch.
Your ownership patch preserves the original queue exhaustion fix in my synthetic workloads. Thanks for the review!
@upipibi on GitHub · 2026-11-24 21:38 UTC · original
Thanks, DEViANCEVxXXxM, for the runs and the membership nuance.
The device loss in the parallel run with both patches matches #1727. There,
gpu_sparse_vram_descriptors_buffers_and_xmemre-initialises the backend while other tests use it, and parallel whole-lib runs lose the device (nvlddmkm 153). With #614 on top, 0 of 4 runs hung on an RTX 3070, against 3 of 4 onmain(numbers). So the device loss is likely neither patch. If you re-run, adding #614 would check that.@DavidM1911 on GitHub · 2026-11-24 22:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored.Thanks!
@DEViANCEVxXXxM on GitHub · 2026-11-24 22:04 UTC · original
<html>@upipibi Thanks for pointing me to #1727 and #614.
I ran additional validation on upstream
D3D12.X subset | Passed | Failed | Ignored -- | -- | -- | -- Serial | 156 | 0 | 2 Parallel (4 threads), run 1 | 156 | 0 | 2 Parallel (4 threads), run 2 | 156 | 0 | 2c4d37bewith the combined patches, using my RTX 3090 (driver 621.01) in release mode with the default translator.Both parallel runs completed with:
No device removal or hang.
No nvlddmkm event 153.
One sparse VRAM initialization per process.
The queue lifetime regression test passing.
One limitation: this subset does not include
gpu_sparse_vram_descriptors_buffers_and_xmem. These results are consistent with improved stability, but do not independently establish #614 as the cause of the improvement.Synthetic tests only. AI-assisted test planning and log analysis using ChatGPT (GPT-6.2).
</html>@b3IKK on GitHub · 2026-11-24 22:20 UTC · original
@upipibi you are right, and thanks @DEViANCEVxXXxM for running it. Before this PR nothing in
QUEUESwas ever freed, so the raw pointersknown_queues()handed out were safe by accident; with the handoff inq_releasethey are not.Pushed
81f6397(rebased onto689f2db), which takes your change as proposed:present::known_queues_held()takes the references while the list is locked;late_release::drain_knownandreal::drain_gpuuse it.known_queues()is left for membership checks only.n == 1rule. A reader's reference taken before the title's release: the title's release returns 2, the reader's drop goes through the hookedRelease, sees 1, forgets the queue and frees it. A reader that gets in between the title'sf(this)andforget_queue: the title's secondf(this)returns 1 and the reader's drop frees it. In both the queue is removed from the list exactly once, by whichever release sees the count at the tracking's one reference.release(raw) == 0. It waits (up to 5 s) for the queue to leave the list, which also covers the nuance about a snapshot still alive right after the release. A second test,a_tracked_queue_a_reader_holds_outlives_the_titles_release, holds a snapshot across the title's release: the release returns at least 2, the queue stays listed, and it goes when the snapshot is dropped.Both tests fail with the handoff disabled (0 passed, 2 failed) and pass with it. Full suite on this head: 977 passed, 0 failed, 45 ignored; smoke blocks for
689f2dband81f6397are in the description (1643 and 1641 frames, 0 crashes, 0 device removals).What this does not have is a test that fails on the previous head for the race itself: as you found, a freed queue does not reliably fault. That is stated under Not tested.
The device refcount growing during the endurance run (112 → 161) is not addressed here. I have not looked into it.
AI use: OpenCode, Claude Fable 5.2 made the change, ran the tests and wrote this comment.
@GustavoEllwanger on GitHub · 2026-11-25 00:26 UTC · original
Tested exact head
81f639749f3528ba2b951d4c704cbcd5a7fe4618on AMD RDNA3 (RX 7600).Tested
cargo test -p xcl --lib a_queue_the_title_releases_is_not_kept_alive_by_the_submit_tracking -- --nocapture: 1 passed, 0 failed.cargo test -p xcl --lib a_tracked_queue_a_reader_holds_outlives_the_titles_release -- --nocapture: 1 passed, 0 failed.XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e heap_window_out_of_memory_falls_back_to_the_switch_form -- --nocapture: 1 passed, 0 failed (RX 7600).cargo test --workspace --no-fail-fast -- --test-threads=4 --skip fuzz_validate_and_gpu_1: 976 passed, 0 failed, 45 ignored, 1 filtered out, 0 wave64/mesh capability skips.SKIPPEDlines reported in the default run (not counted as coverage): 6 per-lane#1426refusals (f16_programs_on_the_gpu/f32_programs_on_the_gpu), 1pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode not enabled,0x887A002D), 1heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows, separately verified above withXCL_HEAP_WINDOWS=1)..\scripts\test.ps1hit only the pre-existing AMDamdxc64failure ingpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722: res[30] = 0x1, CPU 0x7fffffff, documented in210f773). WithXCL_ADAPTER=warp,fuzz_validate_and_gpu_1validated all 500/500 modules (500..1000,GPU-compared 0).XCL_SAMPLE_*variables were unset.Not tested
XCL_SAMPLE_*game-data tests.AI use
Antigravity (Gemini 4 Neon) ran the commands and drafted this report; only the measured results above are posted.
@luckyteagirl on GitHub · 2026-11-25 03:09 UTC · original
Tested
81f639749f3528ba2b951d4c704cbcd5a7fe4618on Windows 11 build 26200, Ryzen 9 5980HX, AMD Radeon RX 6800M driver30.0.13002.13003plus an AMD integrated GPU, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5.XCL_ADAPTER=6800M,XCL_REQUIRE_GPU=1, andXCL_DIRECT_DXIL=0were set for the test commands.a_queue_the_title_releases_is_not_kept_alive_by_the_submit_trackinganda_tracked_queue_a_reader_holds_outlives_the_titles_releaseeach passed as a focused, single-threaded test: 1 passed, 0 failed, 0 ignored per run, with no explicit skip. These tests callD3D12CreateDevice(None)at feature level 12.0 and have no WARP fallback, so they exercised an AMD hardware adapter on this machine. They do not useXCL_ADAPTERto select that device, and I did not capture its LUID to distinguish the RX 6800M from the integrated AMD GPU.cargo test --locked -p xcl --lib -j 2 hle::d3d12x:: -- --test-threads=1 --show-output: 157 passed, 0 failed, 2 ignored. One explicitSKIPPEDline reported that the adapter makes no reserved cube with mips. Both queue regressions passed in this broader run too.cargo build --locked --workspace -j 2: passed.Not tested
AI use
OpenAI Codex (GPT-6, exact variant not exposed in this session) inspected the test and queue-lifetime paths, ran the AMD-machine tests and build, reviewed the logs, and drafted this report.
@JJAutoCompare on GitHub · 2026-11-25 04:33 UTC · original
XCL PR #1691 verification
Tested clean detached head
81f639749f3528ba2b951d4c704cbcd5a7fe4618on STOR-WINLAB. Windows 11 x64 build 10.0.26200.9974, 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). Used unoptimized Cargo profiles with debug info and incremental compilation disabled. The diff toucheslate_release.rs,present.rs, andreal.rsunderhle/d3d12x.Tested
cargo build --workspaceandcargo test --workspace --no-runexited 0 outside the Arc mutex. The latter built 19 test binaries.cargo test -p xcl --lib console_format_query_tests::a_ -- --nocapture --test-threads=1underInvoke-ArcTest.ps1withXCL_ADAPTER=A770returned 2 passed, 0 failed, 0 ignored, and 0 explicit skips. A probe under the same lock confirmed the default D3D12 feature-level 12.0 device was the A770. The tests created real command queues and called submit tracking directly. They verified that title release removes a tracked queue and that a reader's reference keeps it tracked until the reader releases it.cargo test --workspace --no-fail-fast -- --test-threads=4ran once under the same mutex withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1. Exit 101. Summing 20 result lines (19 binaries and one doctest harness) gave 952 passed, 25 failed, and 45 ignored. Both queue tests also passed here.Workspace failures and skips
The library had 24 GPU failures. Twenty reported
CreateComputePipelineStateerror0x80070057. Four failed assertions on FMA, mip sampling, packed f16, or wave64 reduction. The title E2E test failed its dynamic depth bias pixel check. The log had 25 explicitSKIPPEDlines, excluded from coverage. Seventeen cited no wave64, three cited refused per-lane lowering, and five cited tiled tier, driver-cache control, missing debug layers, or heap windows.Not tested
Matched main run, retail title smoke comparison, issue #1668's 128-queue loop, and AMD/NVIDIA GPUs. No
XCL_SAMPLE_*variables were set.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
pr1691-suite.logand published.@DEViANCEVxXXxM on GitHub · 2026-11-25 04:36 UTC · original
Independent validation update for #1691 and its interaction with #1945.
Tested revisions:
cbc296ab81f6397f58105781f0dbbBoth PRs merge individually with the tested main revision, but combining them requires resolving a conflict in
real.rs::q_release.The resolution preserves #1691's submit-tracking reference removal and calls both
list_x::on_queue_releaseandalloc_pool::forget_queueafter the final reference count reaches zero.Combined validation results:
The four production configurations (main, #1691, #1945, combined) also completed 120-second idle retail-title runs at 30 FPS and exited cleanly.
The existing retail-title crash remains reproducible in all four configurations with an identical exception signature. This does not appear to be a new regression introduced by #1691.
The combined lifecycle results are encouraging, although they do not establish the absence of all concurrent lifetime races.
No changes were made to upstream main.
AI assistance: ChatGPT (GPT-6.2) assisted with source review, test implementation and analysis. All reported test executions were performed on actual Windows hardware (RTX 3090).
@PracticalStudios on GitHub · 2026-11-25 05:24 UTC · original
Test report for
81f6397on Ampere: the two new queue tests pass, but the parallelhle::d3d12x::subset loses the GPU device with this PR and not onmain.a_queue_the_title_releases_is_not_kept_alive_by_the_submit_trackinganda_tracked_queue_a_reader_holds_outlives_the_titles_release(--test-threads=1): 1 passed each, 3 of 3 runs, on the PR's base and merged ontomaincbc296a.cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=2, runs alternating withmaincbc296a:cbc296a(clean merge): failed 3 of 3 (1–3 failures each) with0x887A0005/0x887A0006(device suspended / removed) or0x8007000E, in different tests each run (list_xmid_list_write64_wait64_split…,cross_queue_wait64_before_signal…,cpu_writesreadback_u64…,bindexecute_indirect_reads…); the same on the PR's own base (3 of 3);maincbc296aalone: passed 3 of 3 (177 passed).cargo test --workspace --no-fail-fast: 927 passed, 1 failed (xmem_virtual_query_marks_cpu_readable_memory, fails onmaintoo, #650).AI use: Claude Code (Claude Opus 5.5, with a Claude Sonnet subagent, exact version unknown) ran the tests and wrote this report.
@upipibi on GitHub · 2026-11-25 06:24 UTC · original · edited 2026-11-25 07:41 UTC
Update: this compared the PR at its old base with a newer
main. A run that controls for the base is here: #1691 (merged onto currentmain: 1 of 6 runs lost the device,main0 of 6).An Ampere data point for the device loss PracticalStudios reported with parallel
hle::d3d12xtests. RTX 3070 (driver 616.56), Windows 11, debug, same command (cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=2). I alternated this PR at81f6397withmainat6ea813a, 3 runs each, every run holding the GPU alone:mainmid_list_write64_wait64_split_avoids_cycle_and_reuses_spares(E_OUTOFMEMORYat list_x.rs:6069)rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang(list_x.rs:5895) andtimestamps_outside_unified_memory_land_after_the_queue(list_x.rs:5301), both0x887A0005(device instance suspended)So the failure isn't specific to the 3090: with two test threads, this PR loses the device or runs out of memory in 2 of 3 runs here, and
maindoesn't. The test counts differ because the PR's base is older thanmain. I haven't narrowed down which change causes it.AI-assisted (Claude Code). Synthetic tests only.
@upipibi on GitHub · 2026-11-25 07:41 UTC · original · edited 2026-11-25 08:13 UTC
Follow-up to my run above. That one compared this PR at its old base with a newer
main, so it didn't control for the base. This run is on the same RTX 3070 (driver 616.56, Windows 11, debug) with the same command (cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=2). It alternates four trees, every run holding the GPU alone:689f2db(this PR's base)81f6397(this PR)rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang+timestamps_outside_unified_memory_land_after_the_queue(device removed);mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares(E_OUTOFMEMORY)main568e7db568e7dbmid_list_write64_wait64_split_avoids_cycle_and_reuses_spares:0x887A0005(device instance suspended) at list_x.rs:6169So the failure isn't only an artefact of the old base: with this PR merged onto current
main, the same test lost the device in 1 of 6 runs, against 0 of 6 onmainalone. It's less frequent than on the PR's own base (2 of 3). Six runs per tree is too few to rule out a rarer failure onmain. A bisect inside the PR, or more runs of only the three named tests, would narrow it down. I haven't done either.AI-assisted (Claude Code). Synthetic tests only.
Caveat (added later): the same test hangs without this PR. With tiagonleal's filter on #2057 (
cargo test --release -p xcl --lib -- d3d12x::list_x d3d12x::fence_x d3d12x::sparse hle::acphal gpu::fence, default threads),mid_list_write64_wait64_split_avoids_cycle_and_reuses_spareswas among the tests still running after 60 s in 2 of 3 runs on bothf7e08e6and41303e4. #2057 doesn't contain #1691.main568e7dbwas clean in 3 of 3 runs with that filter (details). So this test is sensitive to other changes and to load too, and the 1-of-6 merged failure above doesn't by itself pin the problem on this PR.@b3IKK on GitHub · 2026-11-25 10:44 UTC · original
@upipibi thank you for the controlled rerun — that is what made the device loss visible as this PR's and not the base's.
You are right that the queue has to outlive what was submitted to it, and that is a real hole in what I had: the reference went the moment the title's last release arrived, so a queue with work in flight could be freed under the GPU. Pushed
1759519(rebased onto568e7db):q_releaseno longer drops the tracking reference itself. It hands it tolate_release::hold_queue, which signals a value on that queue's own fence and lets the reference go once every earlier submission has passed it — the same mechanism that already holds a resource's last release.list_x::on_queue_releasenow runs when that last reference actually goes, not before.a_released_queue_is_held_until_its_submitted_work_is_done: the queue is made to wait on a fence nobody has signalled, the title releases it, and the test checks that the reference is held (the queue is still alive and usable) until the fence is signalled. With the deferral taken out it fails at that check.--test-threads=2, 5 runs, 3 passed / 0 failed each; the wholehle::d3d12x::subset with two threads, 2 runs, 180 passed / 0 failed. So I have not reproduced your0x887A0005here; what I can show is that the queue is now held while its work is in flight.Suite on this head: 1157 passed, 0 failed, 46 ignored. Smoke blocks for
568e7dband1759519are in the description.If you still have the 3070, a rerun of the same six-run alternation against this head would be the check that matters — I am not claiming it fixes your 1-in-6 without it.
AI use: OpenCode, Claude Fable 5.2 made the change, ran the tests and wrote this comment.
@b3IKK on GitHub · 2026-11-25 11:26 UTC · original
Rebased onto
426a5a7(which has #2245, somain's two failing tests are gone) and tidied one thing I had left: the late-release thread had astatic Oncein bothholdandhold_queue, so a title that both released a queue and held a resource could start two of them. Oneensure_threadnow serves both.Head
f71cf21: 1246 passed, 0 failed, 46 ignored. Smoke blocks for426a5a7and this head are in the description (1642 / 1645 frames, both 60 60 60, 0 crashes, 0 device removals). AI use: OpenCode, Claude Fable 5.2.@IgorAntunes66 on GitHub · 2026-11-25 18:17 UTC · original
Test report on an RTX 5070 (Blackwell, wave32), plus one flaky test in the PR.
RTX 5070 12 GB, driver 621.24, Windows 11 26H2, rustc 1.100.0, DXC 1.9.2602.17, debug. Head
f71cf21merged onto main68a284a(clean merge).#1668 reproduction: a local loop test (not in the PR) that does what the issue describes through the hooked path:
CreateCommandQueue,Signal+ wait,adopt(.., Kind::CommandQueue),note_execute, then the hookedRelease, 128 times:known_queues()68a284aE_OUTOFMEMORYat the 65thSame result in 2 runs each.
Whole lib (
cargo test -p xcl --lib): 1218 passed, 5 failed, 26 ignored with--test-threads=1and with=4, no TDR or device removal in the System log. The 5 failures are the same on main68a284awithout this PR (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3:CreateComputePipelineState0x8007000E at seed 70;a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier), so not from this PR.Flaky test:
a_released_queue_is_held_until_its_submitted_work_is_donepasses alone (3/3), but when the three new tests run together (cargo test -p xcl --lib -- a_queue_the_title_releases_is_not_kept_alive_by_the_submit_tracking a_tracked_queue_a_reader_holds_outlives_the_titles_release a_released_queue_is_held_until_its_submitted_work_is_done) it fails 6 of 8 runs at real.rs:8007, "the GPU may still run what was submitted to the queue: its reference is held". Paired runs: witha_tracked_queue_a_reader_holds_outlives_the_titles_releaseit fails 4/5; witha_queue_the_title_releases_is_not_kept_alive_by_the_submit_tracking0/5.Reading the code, that fits: the reader test's
known_queues_held()takes a reference to every tracked queue, this test's included, so the title's release leaves 2 andq_releasedoes not reachhold_queueuntil the reader drops its reference. Waiting up to 5 s for the queue to show up inheld_queues(), asuntracked_soondoes in the other test, fixes it here: 0 of 10 runs failed within place of the immediate
assert!(.. held_queues().contains(..)).Not tested: AMD/Intel, release build, a retail title.
AI use: Claude Code (claude-opus-5-5) ran the tests, wrote the local repro and the polling change, and drafted this comment; I reviewed it.
@Lum7nt on GitHub · 2026-11-25 18:43 UTC · original
Tested on \71cf2147ecd3b4aa67b71c53ebcd8cfec326c2b\ (\71cf21, clean PR head):
ustc 1.100.0\ (\x86_64-pc-windows-msvc), DXC \1.8.2502.11\ (Windows SDK \10.0.26100.0), debug profile, \XCL_ADAPTER=nvidia.
@Chrysana on GitHub · 2026-11-25 21:08 UTC · original
AMD run of
f71cf21, for "AMD/Intel" in the reports so far. On AMD the leak from #1668 is there too, but it doesn't run intoE_OUTOFMEMORY: without this PR, 256 create/submit/release cycles all succeed and leave 256 queues tracked. With it, the same 256 succeed and leave 0. The three new tests pass alone, the suite matches its base, and IgorAntunes66's flaky test fails here every time the three run together (10 of 10). His polling change fixes it (10 of 10 pass).Setup: AMD Radeon RX 9070 XT 16 GB (RDNA4), driver 32.0.32015.2008; Ryzen 7 9800X3D with its RDNA2 Radeon iGPU; Windows 11 26200.9974; rustc 1.100.0 MSVC; debug.
f71cf21as pushed and its base426a5a7, each in its own checkout and target folder.#1668's loop on AMD. This is a local test, not for this PR, like IgorAntunes66's. On a device from the chosen adapter it runs, up to 256 times:
CreateCommandQueue,adopt(.., Kind::CommandQueue),present::note_execute,Signal+ wait, then the title's release. A control run does create + release only.known_queues()after426a5a7426a5a7f71cf21f71cf21So the AMD driver lets far more queues stay alive than NVIDIA's ~64 (IgorAntunes66's table above), and the issue doesn't show up as an error here. The tracking still keeps every queue the title submitted to on
main, and this PR still lets them go.The new tests (RX 9070 XT, which is the default adapter here; the tests take
D3D12CreateDevice(None)):--exact), 3 rounds: all pass, 9 of 9.cargo test -p xcl --lib -- a_queue_the_title_releases_is_not_kept_alive_by_the_submit_tracking a_tracked_queue_a_reader_holds_outlives_the_titles_release a_released_queue_is_held_until_its_submitted_work_is_done), 10 runs:a_released_queue_is_held_until_its_submitted_work_is_donefails in all 10, atreal.rs:7792, the immediateheld_queues().contains(..)assert. That's the flake IgorAntunes66 described, but here it happens every time.held_queues()), done locally: 10 of 10 pass.--test-threads=4) all three passed in my one run, as he saw.Suite (RX 9070 XT,
cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4, my local loop test skipped):f71cf21426a5a7The same 3 failures on both:
fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3(seeds 722 and 1599, the AMD seeds of #2115) andgpu::recomp::tests::gpu_image_get_resinfo_past_last_level.Not tested
main, a release build, a retail title.AI use
@DavidM1911 on GitHub · 2026-11-26 06:07 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
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.