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

Open
github-bot wants to merge 1 commit from github-bot/gh-2782 into nvidia-dev AGit
Owner

@⁠itsSio on GitHub · 2026-11-26 12:23 UTC · original
itsSio:d3d12x/nvidia-dev-console-heap-quarantine → nvidia-dev · +520 −34 · 1 files · 1 commits · open

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.
**@⁠itsSio** on GitHub · 2026-11-26 12:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782) `itsSio:d3d12x/nvidia-dev-console-heap-quarantine` → `nvidia-dev` · +520 −34 · 1 files · 1 commits · open 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`.
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.

Tested: cargo test -p xcl --lib console_heap -- --test-threads=4 (21 passed, 0 failed); cargo test -p xcl --lib hle::d3d12x -- --test-threads=4 (499 passed, 2 pre-existing unrelated failures in texture_upload.rs:1002 overflow, 2 ignored, 1 skipped).

Assisted-by: Google Antigravity CLI (Gemini 4 Hydrogen (High))
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 12:25:56 +00:00
Author
Owner

@⁠KDenKC on GitHub · 2026-11-26 12:37 UTC · original

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.

**@⁠KDenKC** on GitHub · 2026-11-26 12:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782#issuecomment-7192235713) 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.
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-26 13:36 UTC · original · edited 2026-11-26 14:55 UTC

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.

**@⁠DarkPanda69** on GitHub · 2026-11-26 13:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782#issuecomment-7193593995) · edited 2026-11-26 14:55 UTC **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.
github-bot force-pushed github-bot/gh-2782 from b755223752 to 9ddd2feb57 2026-11-26 14:47:03 +00:00 Compare
Author
Owner

@⁠itsSio on GitHub · 2026-11-26 14:39 UTC · original

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** on GitHub · 2026-11-26 14:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782#issuecomment-7195127903) 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).
Author
Owner

@⁠Prime1997 on GitHub · 2026-11-26 15:20 UTC · original · reviewed

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.

**@⁠Prime1997** on GitHub · 2026-11-26 15:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782#pullrequestreview-6076651562) · **reviewed** **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](https://discord.gg/gK3y7WRRY) for coordinating contributor work, testing and comparing results.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-26 15:26 UTC · original

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.

**@⁠SlopTart** on GitHub · 2026-11-26 15:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782#issuecomment-7196264369) 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.
Author
Owner

@⁠throny on GitHub · 2026-11-26 15:35 UTC · original

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

Tested

  • RTX 4080 16 GB (driver 621.40, 1 GiB shader-heap profile of #2590), i9-12900K, 64 GB RAM, Windows 11 26300, release.
  • This PR's diff at its head together with #2768 (git apply, both as they are) on nvidia-dev af2cecc4 + #684 + #2697 + #2749 + #2729 + #2794 + the two-pass stack #2817. The retail title of #505, Series X profile, world from about 170 s; the card is 2.5 GB over its video memory budget there.
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

  • This PR without #2768, its tests and the suite, AMD, a card under its budget.

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

**@⁠throny** on GitHub · 2026-11-26 15:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/2782#issuecomment-7196470019) **Test report: in the world on an RTX 4080 16 GB. No harm seen; it does not change this card's device losses.** **Tested** - RTX 4080 16 GB (driver 621.40, 1 GiB shader-heap profile of #2590), i9-12900K, 64 GB RAM, Windows 11 26300, release. - This PR's diff at its head together with #2768 (`git apply`, both as they are) on `nvidia-dev` `af2cecc4` + #684 + #2697 + #2749 + #2729 + #2794 + the two-pass stack #2817. The retail title of #505, Series X profile, world from about 170 s; the card is 2.5 GB over its video memory budget there. | 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** - This PR without #2768, its tests and the suite, AMD, a card under its budget. AI use: Claude Code (Claude Fable 5.2) ran this on the owner's machine and wrote the report.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2782/head:github-bot/gh-2782'
git switch 'github-bot/gh-2782'

Merge

Merge the changes and update on Forgejo.
git switch 'nvidia-dev'
git merge --no-ff 'github-bot/gh-2782'
git switch 'github-bot/gh-2782'
git rebase 'nvidia-dev'
git switch 'nvidia-dev'
git merge --ff-only 'github-bot/gh-2782'
git switch 'github-bot/gh-2782'
git rebase 'nvidia-dev'
git switch 'nvidia-dev'
git merge --no-ff 'github-bot/gh-2782'
git switch 'nvidia-dev'
git merge --squash 'github-bot/gh-2782'
git switch 'nvidia-dev'
git merge --ff-only 'github-bot/gh-2782'
git switch 'nvidia-dev'
git merge 'github-bot/gh-2782'
git push origin 'nvidia-dev'
This discussion has been locked. Commenting is limited to contributors.
No description provided.