Skip to content

D3D12.X: fence-quarantine released shared descriptor ranges - #2782

Merged
Prime1997 merged 1 commit into
xcl-dev:nvidia-devfrom
itsSio:d3d12x/nvidia-dev-console-heap-quarantine
Nov 28, 2026
Merged

Prime1997 merged 1 commit into
xcl-dev:nvidia-devfrom
itsSio:d3d12x/nvidia-dev-console-heap-quarantine

Conversation

@itsSio

@itsSio itsSio commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

On nvidia-dev, release_global immediately overwrote freed shared view ranges with fill_nulls, cleared NAMES, and returned them to GLOBAL.free, while release_global_sampler returned freed sampler ranges straight to GLOBAL_SAMPLER.free without coalescing or waiting for the GPU. Any in-flight command list still reading those shader-visible descriptor slots could observe nulled or overwritten descriptors.

This change quarantines released shared view and sampler ranges behind per-queue completion fences across all live device queues (signaled outside SLOT_WRITES, HEAPS, GLOBAL, and GLOBAL_SAMPLER locks, preserving lock order). For GLOBAL, fill_nulls and NAMES.clear are deferred until every signaled queue passes its fence mark when draining completed ranges back into free. drain_global_retired is serialized under GLOBAL_DRAIN (GLOBAL_DRAIN -> SLOT_WRITES -> GLOBAL, never held alongside HEAPS), keeps GLOBAL_RETIRED set until merge_release finishes, and bumps GLOBAL_DRAIN_SEQ under GLOBAL on each merge (checked after GLOBAL_RETIRED in slot()) so a concurrent slot() or second drainer cannot miss descriptors mid-drain and return an unmapped index. Zero-queue unit tests release immediately, and failed fence signals keep ranges safely quarantined without blocking later healthy ranges.

What is in it

  • D3D12.X: fence-quarantine released shared descriptor ranges (9ddd2feb): crates/xcl/src/hle/d3d12x/console_heap.rs (per-queue fence quarantine for GLOBAL and GLOBAL_SAMPLER, batched release on heap unregister, serialized deferred fill_nulls + NAMES.clear drain under GLOBAL_DRAIN with GLOBAL_DRAIN_SEQ synchronization for slot(), coalesced sampler free list, and unit tests for multi-queue quarantine, coalescing, deferred view null-fill, mid-drain concurrent slot() and second-drainer waiting, zero-queue immediate release, and failed fence signals)

Tested
Commit 9ddd2feb57a2e1bee79d387c5a3cf057798eed47 (based on nvidia-dev af2cecc40886a8682ecf3267f5328c6dc4b66ad7, clean worktree).

  • PC 1: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 7 9800X3D, 32 GB RAM, Windows 11 Pro build 26200, rustc 1.97.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, XCL_ADAPTER=NVIDIA.
    • At 9ddd2feb: cargo test -p xcl --lib console_heap -- --test-threads=4 (debug): 22 passed, 0 failed (slot_waits_for_in_flight_drain_before_returning_unmapped passed); cargo test --release -p xcl --lib console_heap -- --test-threads=4: 22 passed, 0 failed.
    • At 9ddd2feb: cargo build --release -p xcl (exit 0) + 60 s retail scripts/smoke.ps1 (XCL_PREPARE=0, RTX 5080): 1640 frames, 15757 MB peak commit, 0 removals, 0 crashes.
    • Prior full workspace suite at b7552237 (debug, cargo test --workspace --no-fail-fast -- --test-threads=4): 1749 passed, 7 failed, 48 ignored, 27 SKIPPED (6 failures reproduce on unmodified nvidia-dev af2cecc4: texture_upload::tests ×2, d3d12_mesh_stream, gpu_compute_e2e, gpu_two_pass_cache_e2e ×2; the 7th was intermittent e2e NVIDIA umdlogs, which passed 4/0/0 ×3 standalone on both af2cecc4 and b7552237).
  • PC 2: NVIDIA GeForce RTX 2080 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600X, 16 GB RAM, Windows 11 Pro build 26200, rustc 1.99.1 (stable-x86_64-pc-windows-msvc), Windows SDK 10.0.26100 DXC 1.8.2502.11, XCL_ADAPTER=NVIDIA.
    • On the identical console_heap.rs diff immediately before squashing to 9ddd2feb: cargo test -p xcl --lib console_heap -- --test-threads=4 (debug): 22 passed, 0 failed; cargo test --release -p xcl --lib console_heap -- --test-threads=4: 22 passed, 0 failed.
    • Prior full workspace suite at b7552237 (debug, cargo test --workspace --no-fail-fast -- --test-threads=4 --nocapture): 1749 passed, 7 failed, 48 ignored, 30 SKIPPED (same 6 pre-existing af2cecc4 failures plus unrelated parallel flake gamesave::tests::atomic_writes_preserve_xcltmp_blobs_and_skip_leftover_temps, which passed 3/3 standalone on both b7552237 and af2cecc4).

Regression run

main (b49be183, RTX 5080, release):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1019 (PresentX 1019)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14670 MB

PR (9ddd2feb, RTX 5080, release, XCL_PREPARE=0):

xcl-smoke v1
commit: 9ddd2feb57a2e1bee79d387c5a3cf057798eed47
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1640 (PresentX 1640)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15757 MB

Not tested

  • Full workspace suite re-run on 9ddd2feb after the console_heap.rs-only concurrency fix (covered by debug + release console_heap tests on both PCs and the fresh RTX 5080 smoke on 9ddd2feb).
  • AMD / Intel GPUs, native wave64, Linux / Wine / vkd3d-proton, and retail scripts/smoke.ps1 on the RTX 2080 SUPER.
  • Multi-minute past-world-load gameplay stress on nvidia-dev (the 60 s smoke verifies stability and memory parity).

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Gemini 4 Hydrogen (High)): implemented the original fence-quarantine patch and unit tests in b7552237, and performed the independent read-only concurrency audit of the drain_global_retired fix (catching a check-order race in slot() and confirming PASS after the fix).
  • OpenCode (Claude Opus 5.5): ran the full Build PC (RTX 2080 SUPER) and Main PC (RTX 5080) workspace suites on b7552237.
  • Google Antigravity CLI (Gemini 4 Neon (High)): designed the lock-order contract, implemented the GLOBAL_DRAIN / GLOBAL_DRAIN_SEQ fix and deterministic concurrency test for @KDenKC's review, ran the dual-PC console_heap debug/release checks and fresh RTX 5080 smoke on 9ddd2feb, ran scripts/pr_check.py --local, updated this description, and pushed 9ddd2feb.

@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Source review of b7552237, no run. One window in drain_global_retired (console_heap.rs ~584-617):

The ready ranges are popped from s.retired and GLOBAL_RETIRED is stored as !s.retired.is_empty() under GLOBAL. Then GLOBAL is dropped while fill_nulls runs under SLOT_WRITES, and only afterwards are the ranges merged into s.free. In between, those ranges are neither retired nor free, and the flag can already read false. A concurrent slot() on a hosted heap with no page (~852) checks GLOBAL_RETIRED, sees false, skips the drain, and returns finish_view_slot(h, k, None): the unmapped index. The same happens to a second caller that enters drain_global_retired during the first one's fill_nulls. So when the shared heap is exhausted, a view can get the null slot even though descriptors are about to be free.

Keeping the flag (or a small "draining" count) set until the merge is done, or having a caller that sees the flag drop wait on the drain in progress, would close it.

Not tested: no build or run on our side.

AI use: Gemini (Antigravity) found it in a review. Claude Code (Claude Opus 5.5) checked it against the source at b7552237 and wrote this.

@DarkPanda69

DarkPanda69 commented Nov 26, 2026 •

Copy link
Copy Markdown

Update for head 9ddd2fe: same result. On nvidia-dev af2cecc, console_heap gives 22 passed, 0 failed, 0 SKIPPED with this PR (19 without), slot_waits_for_in_flight_drain_before_returning_unmapped among them. As below, these tests run on the default adapter, the RX 9070 XT.


AMD run (listed as untested): the new tests pass on an RX 9070 XT.

Base nvidia-dev af2cecc, then head b755223 applied, debug, Windows 11 Pro 26200, cargo test -p xcl --lib -- console_heap --nocapture --test-threads=4:

  • nvidia-dev: 19 passed, 0 failed.
  • this PR: 21 passed, 0 failed, no SKIPPED. released_shared_ranges_stay_quarantined_until_queue_completes and retired_descriptor_ranges_stay_quarantined_until_all_queues_complete are among them.

The new tests make their device with create_device(None, ..), so they ran on the default adapter, which is the RX 9070 XT (RDNA4, driver 32.0.32029.2010) on this machine. A run with XCL_ADAPTER=3060 gave the same counts, but it does not move these tests to the RTX 3060, so it is not an NVIDIA result for them.

Not tested: native wave64 GPU tests (this change is in console_heap.rs), Intel, Linux / Wine, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@Prime1997 Prime1997 mentioned this pull request Nov 26, 2026
release_global and release_global_sampler previously returned freed ranges straight to GLOBAL.free / GLOBAL_SAMPLER.free (and release_global immediately overwrote them with fill_nulls), allowing in-flight GPU command lists to read overwritten or nulled shader-visible descriptors.

Quarantine released shared view and sampler ranges behind per-queue completion fences across all live device queues (signaled outside GLOBAL/GLOBAL_SAMPLER/HEAPS/SLOT_WRITES locks, queried via real::fence_completed). For GLOBAL, defer fill_nulls and NAMES.clear until fence completion when draining into free (outside HEAPS and GLOBAL so SLOT_WRITES lock order is preserved), keeping zero-queue calls immediate and failed-signal ranges quarantined without wedging subsequent healthy ranges.

Serialize drain_global_retired under GLOBAL_DRAIN, keep GLOBAL_RETIRED set across fill_nulls until merge_release completes, and bump GLOBAL_DRAIN_SEQ under GLOBAL on every merge_release (checked in reverse Acquire order in slot() after GLOBAL_RETIRED) so a concurrent slot() or second drainer cannot miss descriptors mid-drain and return an unmapped index while ranges are about to become free.

Tested: cargo test -p xcl --lib console_heap -- --test-threads=4 (22 passed, 0 failed, debug and release on RTX 5080 and RTX 2080 SUPER, including deterministic concurrency test for both slot() and second-drainer mid-fill_nulls paths).

Assisted-by: Google Antigravity CLI (Gemini 4 Hydrogen (High))
Assisted-by: Google Antigravity CLI (Gemini 4 Neon (High))
@itsSio

itsSio commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for catching that window, @KDenKC — squashed the fix into 9ddd2feb (crates/xcl/src/hle/d3d12x/console_heap.rs) and refreshed the PR description and smoke run:

  • Serialized drain_global_retired under GLOBAL_DRAIN (GLOBAL_DRAIN -> SLOT_WRITES -> GLOBAL, never held alongside HEAPS) and kept GLOBAL_RETIRED set across fill_nulls until merge_release finishes.
  • Added GLOBAL_DRAIN_SEQ (incremented under GLOBAL on every merge_release, read in reverse Acquire order after GLOBAL_RETIRED in slot()) so neither a concurrent slot() nor a second drainer can observe GLOBAL_RETIRED == false while descriptors are still mid-drain and return an unmapped slot.
  • Added deterministic concurrency test slot_waits_for_in_flight_drain_before_returning_unmapped covering both a concurrent slot() and a second drain_global_retired entering mid-fill_nulls.

Tested

  • PC 1 (RTX 5080, driver 32.0.16.1088, Ryzen 7 9800X3D, Win11 26200, rustc 1.97.0, DXC 1.9.2609.5, 9ddd2feb): cargo test -p xcl --lib console_heap -- --test-threads=4 22 passed, 0 failed (debug and release); fresh 60 s RTX 5080 release smoke (XCL_PREPARE=0): 1640 frames, 15757 MB peak commit, 0 removals, 0 crashes.
  • PC 2 (RTX 2080 SUPER, driver 32.0.16.1088, Ryzen 5 5600X, Win11 26200, rustc 1.99.1, DXC 1.8.2502.11, identical console_heap.rs bytes prior to squash): cargo test -p xcl --lib console_heap -- --test-threads=4 22 passed, 0 failed (debug and release).

Not tested

  • AMD / Intel GPUs, native wave64, Linux / Wine / vkd3d-proton, and full workspace re-run on 9ddd2feb.

AI use
Ran via Samaritan:

  • Google Antigravity CLI (Gemini 4 Neon (High)): implemented the fix and deterministic concurrency test, ran the dual-PC console_heap checks and RTX 5080 smoke, pushed 9ddd2feb, and wrote this reply.
  • Google Antigravity CLI (Gemini 4 Hydrogen (High)): performed the independent read-only concurrency audit (catching a check-order race in slot() and verifying PASS after the fix).

@itsSio
itsSio force-pushed the d3d12x/nvidia-dev-console-heap-quarantine branch from b755223 to 9ddd2fe Compare November 26, 2026 14:39

@Prime1997 Prime1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated source status: retain; validation pending. Rechecked current head 9ddd2feb57a2e1bee79d387c5a3cf057798eed47 against the previously reviewed b755223752d79186a0aca209a3c86641c18a7eed, targeting nvidia-dev at af2cecc40886a8682ecf3267f5328c6dc4b66ad7.

The new revision directly addresses the earlier retired/free publication gap: GLOBAL_DRAIN serializes draining through null-fill and free-range publication, GLOBAL_RETIRED stays set during that interval, and GLOBAL_DRAIN_SEQ lets an exhausted allocation observe a completed concurrent drain and retry. The fallback drops HEAPS before waiting on the drain and reacquires/re-finds the heap afterward. The previous exact-head finding should not be treated as an unchanged defect or a reason to close this revision.

I inspected the full175-line delta and the surrounding allocation path. The added child-isolated fixture exercises an in-flight drain and the sequence-observation helper with owned fake COM objects. I have not built or run this new head, the new fixture, or a GPU lifetime workload. Its80ms sleep also should not be presented as proof of every scheduling interleaving. The earlier native results for other PRs do not transfer to this revision.

Disposition is blocked on current-head validation and the remaining integration checks, rather than rejection. No merge or closure is made by this report.

AI use: Codex (GPT-6) inspected the revision and relevant call path; no new execution is claimed. Optional temporary Discord for coordinating contributor work, testing and comparing results.

@SlopTart

Copy link
Copy Markdown

Two Linux/Wine lanes on head 9ddd2feb (base nvidia-dev af2cecc4), both lanes have same-day base numbers from the exact base commit, so the diffs below are head-vs-base on identical machines.

Lanes

  • A (AMD): Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT 20 GB (Navi 31), Arch, kernel 7.2.15, Mesa 26.2.5 RADV, wine-11.0 (Proton), rustc 1.94.0
  • B (NVIDIA): i5-10600K, 16 GB DDR4, GTX 1070 8 GB, driver 550.163.01, Debian 13, stock wine-10.0, xvfb
    Both: cargo test --release --locked -p xcl --lib --target x86_64-pc-windows-gnu -- --test-threads=2 --skip gpu::, full wine env per lane (runner: Proton wine / /usr/bin/wine, WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b", VKD3D_CONFIG=ignore_shared_fence, XCL_DXC_DIR set).
Lane Base af2cecc4 Head 9ddd2feb Delta
A RDNA3/wine-11 869 pass / 6 fail 872 pass / 6 fail +3 green (the new console_heap tests), red set identical
B Pascal/wine-10 865 pass / 10 fail 868 pass / 10 fail +3 green, red set identical

All 22 console_heap tests green on both lanes, including slot_waits_for_in_flight_drain_before_returning_unmapped, matching @DarkPanda69's 22 on RDNA4. Contention probe for the window @KDenKC raised (drain vs concurrent slot()): the whole module re-run 3 times with --test-threads=8 per lane, 6 of 6 runs 22 passed, 0 failed on both vendors.

Not cleared by this PR (expected, different code path): the two real::descriptor_heap_tests reds on the Pascal lane (a_copy_of_a_destroyed_resources_view_is_the_null_view, zero_sampler...) are unchanged by head 9ddd2feb. The first of those is Wine-specific (red on both Wine lanes, green on Windows per #2688 thread); the second is only red on this Pascal/wine-10 box.

Tested: head + base full lib suite and console_heap stress on both Linux/Wine lanes, release. Not tested: Windows, native Linux, in-game.
AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

@throny

throny commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Test report: in the world on an RTX 4080 16 GB. No harm seen; it does not change this card's device losses.

Tested

tree world runs device removed (0x887a0005, no nvlddmkm event) other ends
with #2782 + #2768 3 3, after 152 s, 140 s and 110 s of world –
the same tree without them (2 runs before, 3 after) 5 2, after 110 s and 126 s 2 title stops (0xc0000005 in title code) after 297 s and 226 s, 1 ended by my guard
  • 3 of 3 against 2 of 5 is too few runs to call a difference in either direction; what it does show is that the removal on this card is not the released-descriptor window this PR closes.
  • No new crash, hang or assert with the PR in 400 s of world submits; frame rate as before (0.18–0.23 presents/s).

Not tested

AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.

@Decodere

Copy link
Copy Markdown
Contributor

Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2782 at 9ddd2feb57a2e1bee79d387c5a3cf057798eed47 (parent & merge-base origin/nvidia-dev af2cecc40886a8682ecf3267f5328c6dc4b66ad7). Measurements and targeted test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0, default flags, no input)

Targeted RTX 4060 release unit & GPU tests (9ddd2feb)

  • cargo test --release -p xcl --lib released_shared_ranges_stay_quarantined_until_queue_completes -- --nocapture: 1 passed, 0 failed, 0 ignored (0.32 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib retired_descriptor_ranges_stay_quarantined_until_all_queues_complete -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib slot_waits_for_in_flight_drain_before_returning_unmapped -- --nocapture: 1 passed, 0 failed, 0 ignored (0.17 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib hle::d3d12x::console_heap:: (3 consecutive parallel passes): 21 passed, 0 failed, 0 ignored on all 3 passes (0.36 s / 0.36 s / 0.36 s, 0 SKIPPED).
  • cargo test --release -p xcl --lib hle::d3d12x::real::: 94 passed, 0 failed, 0 ignored (0.49 s, 0 SKIPPED).

Paired 60 s RTX 4060 smoke (nvidia-dev af2cecc4 vs 9ddd2feb)

Both runs completed cleanly at steady 60/2 s pacing with 0 device removals and 0 crashes (xcl.log memory & descriptor parity):

Metric (60 s quiet default-flags run) nvidia-dev base (af2cecc4) PR #2782 (9ddd2feb)
Frames shown / PresentX 1547 / 1547 1477 / 1477
Presents per 2 s (last 3) 60 60 60 60 60 60
Peak process commit 16342 MB 16264 MB
End process commit (xcl.log) 15009 MB 15163 MB
Peak / end local VRAM 6245 MB / 6182 MB 6181 MB / 6181 MB
End non-local VRAM 4749 MB 4722 MB
Console descriptor heap log lines 16 (1,000,000-slot shared heap) 16 (1,000,000-slot shared heap)
Translated draws / dispatches (last log line) 18,382 draws / 1,024 dispatches (0 skipped) 18,448 draws / 1,024 dispatches (0 skipped)

Base origin/nvidia-dev (af2cecc4):

xcl-smoke v1
commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1547 (PresentX 1547)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16342 MB

PR #2782 head (9ddd2feb):

xcl-smoke v1
commit: 9ddd2feb57a2e1bee79d387c5a3cf057798eed47
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1477 (PresentX 1477)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16264 MB

Limits of coverage

  • Full workspace test suite was not run on 9ddd2feb (only the 3 new tests individually, 3 parallel passes of hle::d3d12x::console_heap::, hle::d3d12x::real::, and the paired 60 s default-flags smokes).
  • The 60 s no-input menu/intro smoke confirms clean steady-state behavior on an 8 GB desktop RTX 4060, but heavy interactive world-load descriptor-heap release/reclaim contention was covered only by the targeted D3D12 unit tests (released_shared_ranges_stay_quarantined_until_queue_completes, retired_descriptor_ranges_stay_quarantined_until_all_queues_complete, and slot_waits_for_in_flight_drain_before_returning_unmapped).
  • Single discrete NVIDIA 8 GB GPU (RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.

AI use

Ran the targeted release tests, paired quiet 60 s smoke runs, and xcl.log comparisons with assistance from Google Antigravity (Gemini 4 Neon); all test counts, memory figures, and smoke blocks were extracted directly from cargo test, xcl.log, and scripts/smoke.ps1 outputs.

@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Checked at 9ddd2feb: GLOBAL_RETIRED now stays set across fill_nulls until the merge, drains are serialized by GLOBAL_DRAIN, and a caller that finds no work sees whether a drain finished meanwhile through GLOBAL_DRAIN_SEQ (console_heap.rs:~594-631). That closes the window. Thanks @itsSio.

AI use: Claude Code (Claude Opus 5.5) checked the source at that head and wrote this.

@Aniseto

Aniseto commented Nov 26, 2026

Copy link
Copy Markdown

Ran the shared-descriptor-range quarantine tests at 9ddd2feb on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

. D:\XCL\env.ps1
$env:XCL_ADAPTER = 'NVIDIA'
$env:CARGO_TARGET_DIR = 'D:\XCL\target-2782'
cargo test -p xcl --lib console_heap -- --test-threads=1
22 passed; 0 failed; 0 ignored; 0 measured; 1629 filtered out      (exit 0)

All 22 pass here, including slot_waits_for_in_flight_drain_before_returning_unmapped, the child-process test of the concurrent drain window. I used a dedicated CARGO_TARGET_DIR for this run: a first attempt with the shared cache silently reused a binary built for another PR head (19 tests, no recompile), so I discarded those numbers and repeated with a confirmed fresh compile of 9ddd2feb. The thread has RTX 5080, 5090, 4080, 4060 and Linux/Wine reports but no 5070 Ti.

Not tested: a real second D3D12 queue under the title, a paired 60 s smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64, Wine, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@thehollowedone

thehollowedone commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: d1be8103644791b7a65f068954324e93d4b1b565 (nvidia-dev)
head: 9ddd2feb57a2e1bee79d387c5a3cf057798eed47
merge: clean trial merge into the current nvidia-dev tip; the merged diff changes only console_heap.rs (+520/-34).
build: cargo build --locked --workspace -> ok.
tests: cargo test --locked --workspace --no-fail-fast -- --test-threads=4 -> 1,827 passed, 8 failed, 48 ignored, with 27 GPU SKIPPED notices. All three new quarantine tests passed. The eight failures are a subset of the nine failing test instances on the untouched exact base: two texture-upload tests, the console-MS test, the async-compute PSO test, split-compute in two targets, and the two-pass driver-cache test in two targets. The base's mesh-cache failure did not recur in this run; no new suite failure appeared.
review: A fresh title queue is missing from the fence snapshot. signal_live_queues_for reads present::known_queues(), populated only by present::note_execute after ordinary submission. KickoffX can submit directly on a newly created queue before that happens. If the queue waits on a gate, then a heap is released and its range reused, the queued work can read replacement descriptors. In the existing gated GPU test, I substituted list_x::on_queue_create for present::note_execute, leaving the rest of its checks intact: 0 passed, 1 failed, at view range returned to free while queue in flight. The unmodified test passed in the full suite. Track eligible queues with safe lifetime ownership before native submission on both normal Execute and KickoffX paths; test the first gated KickoffX submission, release and reuse before opening the gate.
performance: each release signals fences on known queues, and slot() checks retired ranges before allocating. These add CPU work and queue signals when descriptor heaps churn; I did not measure frame-time cost. The quarantine deliberately delays reuse, which can increase descriptor pressure.
verdict: not yet: the fresh-queue path returns a live range to free before its GPU work completes.
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), rustc 1.99.1 MSVC, SDK DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the trial merge, build, full suite and focused GPU regression, reviewed the merged code, and wrote this check; Codex (GPT-6.2 Astra) independently traced queue and descriptor lifetime paths.

One more boundary needs a focused test: when a retired range is temporarily the only fitting range, slot() can return index zero and a one-time SRV write skips publish. A later allocation cannot repair a T# word already copied by a title. The current gated test retries slot() after opening the gate; please add a case that writes the descriptor once while the gate is closed, then samples through that same descriptor after completion. This is source-review reasoning; I did not run that second scenario.

Not tested here: retail frame time, AMD, Intel, or a production fix. This is a test-only local probe, with no production changes.

Test-only change that reproduces the fresh-queue failure
@@ -1948,7 +1948,12 @@ mod tests {
             let queue: ID3D12CommandQueue = dev.CreateCommandQueue(&D3D12_COMMAND_QUEUE_DESC { Type: D3D12_COMMAND_LIST_TYPE_DIRECT, ..Default::default() }).unwrap();
             let gate: ID3D12Fence = dev.CreateFence(0, D3D12_FENCE_FLAG_NONE).unwrap();
             queue.Wait(&gate, 1).unwrap();
-            super::super::present::note_execute(queue.as_raw(), &[]);
+            // A fresh title queue is eligible for KickoffX before its first ordinary Execute.
+            super::super::list_x::on_queue_create(
+                queue.as_raw() as usize,
+                dev.as_raw() as usize,
+                D3D12_COMMAND_LIST_TYPE_DIRECT,
+            );
 
             let base = crate::gpu::recomp::MEM_HEAP_BASE + crate::gpu::uma::MAX_HEAP_WINDOWS as u32;

@throny

throny commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

merge-check claim
head: 9ddd2fe

@throny

throny commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

merge-check
base: d1be810 (nvidia-dev)
head: 9ddd2fe
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1827 passed, 8 failed, 48 ignored (27 SKIPPED lines). The 8 failures are the base's own on this GPU, the same six names with and without the PR (async_compute_pso_registers_real_pso_and_not_standin, split_compute_prefers_the_offline_whole_pipeline, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, two texture_upload tests; #2771 and #2788 fix three of them). Base alone: 1824 passed, 8 failed, 48 ignored.
review: no blocking bug found. Lock order holds (drain lock, slot writes, global table; the heap table is dropped before draining; queues are signalled with no lock held). Edges: a range whose Signal failed is never retried and leaks; a known queue stalled on a Wait blocks every later range because the drain is first-in first-out (bounded by the heap's cap, after which views get null slots). Not verified: that a Signal through a title queue's hooked vtable lands on the newer queue layout (indirect evidence in another PR's run says it does). The tests fail without the change; the earlier race is fixed on this head.
performance: default path, and the open question: every descriptor write costs an atomic load, and while ranges are retired it also takes two locks and reads fences, which serialises descriptor-writing threads; every released page signals every known queue. The thread has one 60 s run each way (about 4.5 % fewer frames with the PR), which is within what single runs vary by.
verdict: not yet: a paired measurement over several runs of the frame cost. I can add world entries on this card with and without the PR (same build otherwise) if that helps; say so and I will queue them.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

@andrewDoing

Copy link
Copy Markdown
Contributor

I checked the open hooked-queue Signal question on RTX 5070 / NVIDIA 616.92 at head 9ddd2feb57a2e1bee79d387c5a3cf057798eed47 with a test-only native fixture. XCL adopted the queue, the newer console layout was selected, and the test verified that its signal slot differed from the original driver slot.

With the known queue held behind a real GPU fence gate, XCL's retirement fence remained at 0 of 2, and neither the retired view nor sampler range was reusable. After opening the gate, it reached 2 of 2, and the allocator returned the original view index 20 and sampler index 1. The focused run passed without skips.

This establishes the internal retirement signal on that adopted queue and layout. It does not cover the separately reported fresh-queue/KickoffX gap, guest-issued signals, multi-queue contention, or retail frame cost.

AI use: OpenAI Codex with GPT-6.2 Astra built and ran the fixture; Codex reviewed and prepared this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants