D3D12.X: flush pending tile mappings before submit and fix VRAM unmap/retire races #2981

Open
github-bot wants to merge 2 commits from github-bot/gh-2981 into amd-dev AGit
Owner

@⁠Saksukella on GitHub · 2026-11-27 07:06 UTC · original
Saksukella:fix/vram-tile-map-sync-0x887a → amd-dev · +495 −22 · 3 files · 2 commits · open

Fixes four tile-mapping synchronization and VRAM retirement races that caused deterministic DXGI_ERROR_DEVICE_HUNG (0x887A0006) GPU page faults during world streaming on AMD RDNA 4 (RX 9070 XT).

Root causes & fixes (real.rs, sparse.rs, vram.rs)

  1. Missing post-record_deferred tile-mapping flush & wait (real.rs, sparse.rs, vram.rs):
    • q_execute_command_lists flushed sparse and vram tile mappings via title_textures::refresh before list_x::record_deferred, which can block for several milliseconds while compiling pipelines.
    • Any concurrent UpdateTileMappings or recycled-tile zero-fills queued on another thread during that record_deferred window were never flushed or waited on before execute_with_waits_on, letting active dispatches read pages whose tile mappings or GPU zero-fills were still in flight.
    • Added fast-path sparse::wait_pending_mappings(q) and vram::wait_pending_mappings(q) right before execute_with_waits_on (returns immediately with 0 signals / 0 waits when no concurrent thread dirtied mappings during record_deferred).
  2. seal_and_drain_unmaps TOCTOU & missing flush_signal (vram.rs):
    • seal_and_drain_unmaps previously dropped PAGES.lock(), called signal_device_queues, re-acquired the lock, and only then called std::mem::take(&mut pages.unsealed_unmaps) — attaching concurrent unmaps pushed after the signal to stale fence marks so UpdateTileMappings(NULL) could unmap tiles while a newer title submit was still reading them.
    • Now snapshots unsealed_unmaps before releasing PAGES.lock() (seal_snapshot_ops) and flushes pages.flush_signal() whenever pages.dirty_signal is true (covering PendingUnmapOp::Tiles).
  3. recycle_ready unsignaled unmap (vram.rs):
    • Calls pages.flush_signal() immediately after pages.unmap(res, info.total) before pushing the recycled resource back into reserved_pool.
  4. Retired zero_buf lifetime (vram.rs):
    • PoolHeaps::take_heap now returns (ID3D12Heap, Option<ID3D12Resource>) and retires both inside RetiringHeap { _zero_buf, _heap } in RetireQueue (dropping _zero_buf before its backing _heap) instead of dropping the placed alias buffer under PAGES.lock() while still in flight.

Tested

  • Unit tests on amd-dev (bf7c82ee + ebef6042, --test-threads=1, 0 new warnings):
    • cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=1: 36 passed; 0 failed; 1 ignored, including 3 new pure-CPU regression tests:
      • seal_and_drain_unmaps_does_not_attach_stale_marks_to_concurrent_unmaps
      • wait_pending_mappings_flushes_post_refresh_dirty_signal
      • retire_queue_keeps_zero_buf_alive_until_marks_complete
    • cargo test -p xcl --lib hle::d3d12x::sparse -- --test-threads=1: 37 passed; 0 failed; 1 ignored
    • Combined: 73 passed; 0 failed; 2 ignored.
  • Live 240 s extended world-streaming verification on AMD Radeon RX 9070 XT (XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 XCL_RT_GATE=miss XCL_DRED=1 XCL_GPU_CULPRIT=1):
    • Before this fix (71b8e6e0 base): deterministic 0x887A0006 DRED page fault (VA 0x1c7103000) at t=100.7s with vram pages queue work pending during a record_deferred window.
    • With this fix on amd-dev (bf7c82ee + ebef6042): survived full 240.04 s (1,464 frames, 0 0x887A0006, 0 0x887A0005, 0 DRED page faults, 0 crashes, 0 exceptions).

Not tested

  • Non-AMD GPUs (NVIDIA / Intel).
  • Multi-hour soak runs beyond 240 s.

Regression run
Baseline (main, b49be183):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 9070 XT
title: b8db18c2
seconds: 60
exit: 0x0
frames shown: 1624 (PresentX 1624)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19700 MB

This PR (ebef6042 on amd-dev bf7c82ee):

xcl-smoke v1
commit: ebef6042703497bf3ab66486bda939158c5850e0
gpu: AMD Radeon RX 9070 XT
title: b8db18c2
seconds: 60
exit: 0x0
frames shown: 1613 (PresentX 1614)
presents per 2 s (last 3): 64 60 60
device removals: 0
crashes: 0
peak commit: 13228 MB

AI use

  • Root-cause flight/DRED log analysis, patch drafting, and regression tests were assisted by AI; all unit tests, the 60 s smoke run, and the 240 s extended world-streaming verification were executed and verified locally on AMD Radeon RX 9070 XT.
**@⁠Saksukella** on GitHub · 2026-11-27 07:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981) `Saksukella:fix/vram-tile-map-sync-0x887a` → `amd-dev` · +495 −22 · 3 files · 2 commits · open Fixes four tile-mapping synchronization and VRAM retirement races that caused deterministic `DXGI_ERROR_DEVICE_HUNG` (`0x887A0006`) GPU page faults during world streaming on AMD RDNA 4 (RX 9070 XT). ### Root causes & fixes (`real.rs`, `sparse.rs`, `vram.rs`) 1. **Missing post-`record_deferred` tile-mapping flush & wait (`real.rs`, `sparse.rs`, `vram.rs`):** - `q_execute_command_lists` flushed `sparse` and `vram` tile mappings via `title_textures::refresh` *before* `list_x::record_deferred`, which can block for several milliseconds while compiling pipelines. - Any concurrent `UpdateTileMappings` or recycled-tile zero-fills queued on another thread during that `record_deferred` window were never flushed or waited on before `execute_with_waits_on`, letting active dispatches read pages whose tile mappings or GPU zero-fills were still in flight. - Added fast-path `sparse::wait_pending_mappings(q)` and `vram::wait_pending_mappings(q)` right before `execute_with_waits_on` (returns immediately with 0 signals / 0 waits when no concurrent thread dirtied mappings during `record_deferred`). 2. **`seal_and_drain_unmaps` TOCTOU & missing `flush_signal` (`vram.rs`):** - `seal_and_drain_unmaps` previously dropped `PAGES.lock()`, called `signal_device_queues`, re-acquired the lock, and only then called `std::mem::take(&mut pages.unsealed_unmaps)` — attaching concurrent unmaps pushed after the signal to stale fence marks so `UpdateTileMappings(NULL)` could unmap tiles while a newer title submit was still reading them. - Now snapshots `unsealed_unmaps` *before* releasing `PAGES.lock()` (`seal_snapshot_ops`) and flushes `pages.flush_signal()` whenever `pages.dirty_signal` is true (covering `PendingUnmapOp::Tiles`). 3. **`recycle_ready` unsignaled unmap (`vram.rs`):** - Calls `pages.flush_signal()` immediately after `pages.unmap(res, info.total)` before pushing the recycled resource back into `reserved_pool`. 4. **Retired `zero_buf` lifetime (`vram.rs`):** - `PoolHeaps::take_heap` now returns `(ID3D12Heap, Option<ID3D12Resource>)` and retires both inside `RetiringHeap { _zero_buf, _heap }` in `RetireQueue` (dropping `_zero_buf` before its backing `_heap`) instead of dropping the placed alias buffer under `PAGES.lock()` while still in flight. **Tested** - Unit tests on `amd-dev` (`bf7c82ee` + `ebef6042`, `--test-threads=1`, 0 new warnings): - `cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=1`: **`36 passed; 0 failed; 1 ignored`**, including 3 new pure-CPU regression tests: - `seal_and_drain_unmaps_does_not_attach_stale_marks_to_concurrent_unmaps` - `wait_pending_mappings_flushes_post_refresh_dirty_signal` - `retire_queue_keeps_zero_buf_alive_until_marks_complete` - `cargo test -p xcl --lib hle::d3d12x::sparse -- --test-threads=1`: **`37 passed; 0 failed; 1 ignored`** - Combined: **`73 passed; 0 failed; 2 ignored`**. - Live 240 s extended world-streaming verification on AMD Radeon RX 9070 XT (`XCL_DIRECT_DXIL=1 XCL_PER_LANE=1 XCL_RT_GATE=miss XCL_DRED=1 XCL_GPU_CULPRIT=1`): - Before this fix (`71b8e6e0` base): deterministic `0x887A0006` DRED page fault (`VA 0x1c7103000`) at `t=100.7s` with `vram pages queue` work pending during a `record_deferred` window. - With this fix on `amd-dev` (`bf7c82ee` + `ebef6042`): survived full **240.04 s** (`1,464` frames, `0` `0x887A0006`, `0` `0x887A0005`, `0` DRED page faults, `0` crashes, `0` exceptions). **Not tested** - Non-AMD GPUs (NVIDIA / Intel). - Multi-hour soak runs beyond 240 s. **Regression run** Baseline (`main`, `b49be183`): ```text xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: AMD Radeon RX 9070 XT title: b8db18c2 seconds: 60 exit: 0x0 frames shown: 1624 (PresentX 1624) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19700 MB ``` This PR (`ebef6042` on `amd-dev` `bf7c82ee`): ```text xcl-smoke v1 commit: ebef6042703497bf3ab66486bda939158c5850e0 gpu: AMD Radeon RX 9070 XT title: b8db18c2 seconds: 60 exit: 0x0 frames shown: 1613 (PresentX 1614) presents per 2 s (last 3): 64 60 60 device removals: 0 crashes: 0 peak commit: 13228 MB ``` **AI use** - Root-cause flight/DRED log analysis, patch drafting, and regression tests were assisted by AI; all unit tests, the 60 s smoke run, and the 240 s extended world-streaming verification were executed and verified locally on AMD Radeon RX 9070 XT.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 07:14:35 +00:00
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-27 07:16 UTC · original

Tested on unmodified PR head ebef6042703497bf3ab66486bda939158c5850e0 on Windows 11 Home 26200.9711, Ryzen 9 5980HX, integrated AMD Radeon Graphics and Radeon RX 6800M (driver 30.0.13002.13003), Rust 1.100.0 MSVC, debug. Both commands ran with XCL_ADAPTER=AMD Radeon RX 6800M and XCL_REQUIRE_GPU=1.

  • cargo +1.100.0 test --offline --locked -p xcl --lib hle::d3d12x::vram -- --nocapture --test-threads=1 — 36 passed, 0 failed, 1 ignored, 0 reported skips. All three new CPU regression tests passed. The small-texture fixture uses the named RX 6800M and verified pixel preservation across 512 BC1 textures, with 2 MiB of incremental allocation.
  • cargo +1.100.0 test --offline --locked -p xcl --lib hle::d3d12x::sparse:: -- --nocapture --test-threads=1 — 37 passed, 0 failed, 1 ignored, 0 reported skips.

The blocked-queue retirement and sparse fixtures use the D3D12 default adapter, which I checked is the integrated Radeon on this machine.

Not tested — The full workspace suite, retail-title smoke, the streaming race on RX 6800M, or a comparison with upstream main.

AI use — Codex (GPT-6, exact variant unavailable) selected and ran the tests and wrote this report.

**@⁠luckyteagirl** on GitHub · 2026-11-27 07:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7212313479) **Tested** on unmodified PR head `ebef6042703497bf3ab66486bda939158c5850e0` on Windows 11 Home 26200.9711, Ryzen 9 5980HX, integrated AMD Radeon Graphics and Radeon RX 6800M (driver 30.0.13002.13003), Rust 1.100.0 MSVC, debug. Both commands ran with `XCL_ADAPTER=AMD Radeon RX 6800M` and `XCL_REQUIRE_GPU=1`. - `cargo +1.100.0 test --offline --locked -p xcl --lib hle::d3d12x::vram -- --nocapture --test-threads=1` — 36 passed, 0 failed, 1 ignored, 0 reported skips. All three new CPU regression tests passed. The small-texture fixture uses the named RX 6800M and verified pixel preservation across 512 BC1 textures, with 2 MiB of incremental allocation. - `cargo +1.100.0 test --offline --locked -p xcl --lib hle::d3d12x::sparse:: -- --nocapture --test-threads=1` — 37 passed, 0 failed, 1 ignored, 0 reported skips. The blocked-queue retirement and sparse fixtures use the D3D12 default adapter, which I checked is the integrated Radeon on this machine. **Not tested** — The full workspace suite, retail-title smoke, the streaming race on RX 6800M, or a comparison with upstream main. **AI use** — Codex (GPT-6, exact variant unavailable) selected and ran the tests and wrote this report.
Author
Owner

@⁠bobosneefdev on GitHub · 2026-11-27 07:48 UTC · original

Tested (retail title, RX 6800): not the clean PR tree. This PR's three files (ebef6042) merged over amd-dev bf7c82ee with local changes: reverts of 00fe5aec and 287a931b, logging, and a local switch that compiles compute HLSL over 256 KB with -O0. Windows 11 Pro 26200, Radeon RX 6800 16 GB (driver 32.0.21045.29003), Ryzen 5 5600X3D, 64 GB, Rust 1.98.1 MSVC, release.

xcl run of GTA 6 with XCL_PREPARE=0 XCL_RT_GATE=miss XCL_PSO_MAX_KB=1100 XCL_DRED=1 XCL_INDIRECT_PRELUDE=0, one run with the PR and four without, same build otherwise. "Tiles in sealed unmap batches" is the highest value of a local log line printed every 10 s.

Run Tree Ended Video memory at the end (MB) Most tiles in sealed unmap batches
261 without (compute -O0 over 1 MB) 0x887a0007 at 509 s 14,581 of 15,170 10,400
262 without 0x887a0007 at 301 s 14,834 of 15,170 19,393 (in 17,766 batches, first batch's marks None)
263 without 0x887a0007 at 287 s 13,063 of 15,569 93
266 without, a local one-line guard on the seal 0x887a0007 at 254 s 13,301 of 15,569 15
267 with this PR 0x887a0007 at 264 s 13,716 of 15,569 47
  • With the PR the unmap batches did not pile up (47 tiles at most). Without it they piled up in two of three runs (261, 262) and not in the third (263), so one run with the PR does not show the race is closed here.
  • The device removal remains with the PR, 1.9 GB under the budget: DRED reports page fault at GPU VA 0x0; allocations there: []; recently freed: [], and every queue had moved within 500 ms. Runs 263 and 266 ended the same way without the PR, so it is a different cause from the tile backlog.

Not tested: the clean PR head, the test suite on this tree, scripts/smoke.ps1, more than one run with the PR, any other GPU.

AI use: Claude Code with Claude Fable 5.2 ran the title, read the logs and wrote this report.

**@⁠bobosneefdev** on GitHub · 2026-11-27 07:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7212843287) **Tested** (retail title, RX 6800): not the clean PR tree. This PR's three files (`ebef6042`) merged over amd-dev `bf7c82ee` with local changes: reverts of `00fe5aec` and `287a931b`, logging, and a local switch that compiles compute HLSL over 256 KB with `-O0`. Windows 11 Pro 26200, Radeon RX 6800 16 GB (driver 32.0.21045.29003), Ryzen 5 5600X3D, 64 GB, Rust 1.98.1 MSVC, release. `xcl run` of GTA 6 with `XCL_PREPARE=0 XCL_RT_GATE=miss XCL_PSO_MAX_KB=1100 XCL_DRED=1 XCL_INDIRECT_PRELUDE=0`, one run with the PR and four without, same build otherwise. "Tiles in sealed unmap batches" is the highest value of a local log line printed every 10 s. | Run | Tree | Ended | Video memory at the end (MB) | Most tiles in sealed unmap batches | |---|---|---|---|---| | 261 | without (compute `-O0` over 1 MB) | `0x887a0007` at 509 s | 14,581 of 15,170 | 10,400 | | 262 | without | `0x887a0007` at 301 s | 14,834 of 15,170 | 19,393 (in 17,766 batches, first batch's marks `None`) | | 263 | without | `0x887a0007` at 287 s | 13,063 of 15,569 | 93 | | 266 | without, a local one-line guard on the seal | `0x887a0007` at 254 s | 13,301 of 15,569 | 15 | | 267 | **with this PR** | `0x887a0007` at 264 s | 13,716 of 15,569 | 47 | - With the PR the unmap batches did not pile up (47 tiles at most). Without it they piled up in two of three runs (261, 262) and not in the third (263), so one run with the PR does not show the race is closed here. - The device removal remains with the PR, 1.9 GB under the budget: DRED reports `page fault at GPU VA 0x0; allocations there: []; recently freed: []`, and every queue had moved within 500 ms. Runs 263 and 266 ended the same way without the PR, so it is a different cause from the tile backlog. **Not tested**: the clean PR head, the test suite on this tree, `scripts/smoke.ps1`, more than one run with the PR, any other GPU. **AI use**: Claude Code with Claude Fable 5.2 ran the title, read the logs and wrote this report.
Author
Owner

@⁠SzczepanGrela on GitHub · 2026-11-27 07:50 UTC · original · edited 2026-11-27 09:16 UTC

Updated RX 9070 / Wine check on ecbbf96a041089ce086d654d8b8502d29989f0cc, including the new shipped-helper tests. The comparison for this update is its actual parent/previous head ebef6042703497bf3ab66486bda939158c5850e0; PR branch base remains amd-dev bf7c82ee1b2685bb40417e09c4128177aa68d719.

RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.6-1-cachyos, Mesa 26.3.1-5, GE-Proton11-12 / Wine 11.0 Staging, ntsync. Native vkd3d-proton 8293130ebe370b1+, local asserts-disabled build; Rust 1.97.1, Windows-GNU release. Private enabled caches per process. XCL_SPARSE_CPU_WAIT_MS=0, XCL_ZERO_TARGET_PAGES=1.

Tested

The four new tests each passed in a separate fresh process (1 passed / 0 failed), then together at both --test-threads=1 and 4 (4 passed / 0 failed each), 0 ignored/skipped. Passive observations confirmed RX 9070 vendor/device 1002:7550, LUID [0,1007] for every new test rather than relying on the default adapter selection.

Under hle::d3d12x::vram::tests:::

  • seal_and_drain_unmaps_leaves_concurrent_unmap_unsealed: the production helper seals only the old 0x1111 entry, leaving the callback's new 0x2222 entry unsealed. This is the test's synchronous injected interleaving, not a CPU-thread stress run.
  • vram_wait_pending_mappings_and_recycle_ready_flush_and_wait: the wait records fence value 1; recycling succeeds, advances the page fence from 1 to 2, clears dirty_signal and parks one resource.
  • pool_heaps_take_heap_keeps_zero_buf_alive_in_retire_queue: the actual placed zero-buffer COM refcount remains 2 while the retirement fence is 0, then falls to 1 after CPU-signaling fence 1 and dropping the retired item. This checks native COM retention; it does not submit GPU work using that alias.

Also hle::d3d12x::sparse::tests::sparse_wait_pending_mappings_flushes_queued_mapping: mapping_queued clears, sparse fence value becomes 1 and the recorded queue wait matches it. This checks the queued flag/wait bookkeeping, not copied data in that test.

  • The previous seven retire/cooling/run-coalescing CPU tests pass unchanged on both heads at --test-threads=1 and 4: 7 passed / 0 failed per invocation.
  • Repeated the local native late-mapping data probe on both heads, three fresh full processes each plus pilots. Six cases: dirty mapping, already-signaled mapping, pending zero, map plus zero, two reader queues, and clean. Each invocation: 1 passed / 0 failed. All 88 full 64 KiB first/tail readbacks, 1,441,792 words, independently checked. Both heads wait for the gate and return the intended remapped/zeroed data, with no stale first readback. Per source, captured 13 native late signals and 19 late queue waits, all HRESULT 0; device remains healthy in every data-probe case.

18 processes total. Copied source trees, original assertions unchanged; only passive test observations and the local native fixture added.

cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run
wine <test-exe> <new-test-filter> --exact --nocapture --test-threads=1
wine <test-exe> <all-four-new-filters> --exact --nocapture --test-threads=4
wine <test-exe> hle::d3d12x::vram::workflow_late_native::workflow_late_mappings_and_zero_fills_order_native_reads --exact --nocapture --test-threads=1

The last filter is a local fixture using actual Pages mapping/zero-fill/signal operations and the VRAM late-wait helper, with native buffers and queues. It is not an upstream test.

Earlier result retained: my original ebef6042 versus bf7c82ee native data comparison found 19 stale first readbacks on the pre-fix parent (311,296 wrong words), versus none on ebef6042. That archived comparison remains separate; the current update compares two heads that already contain the fix.

Not tested: full q_execute_command_lists / record_deferred caller, default CPU-wait route, real concurrent unmap stress, GPU use of the retiring zero-buffer alias, whole suite, title/smoke or performance. The new tests were run as shipped, with no reverse-mutation check here. Integration into main 623d02e4 conflicts in all three runtime files and was not built. No retail data used.

AI use: OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed both public revisions, added passive adapter/state observations, ran the new tests and native controls, independently checked the results, and updated this report. Publication authorized by the account owner.

**@⁠SzczepanGrela** on GitHub · 2026-11-27 07:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7212868000) · edited 2026-11-27 09:16 UTC Updated RX 9070 / Wine check on `ecbbf96a041089ce086d654d8b8502d29989f0cc`, including the new shipped-helper tests. The comparison for this update is its actual parent/previous head `ebef6042703497bf3ab66486bda939158c5850e0`; PR branch base remains `amd-dev` `bf7c82ee1b2685bb40417e09c4128177aa68d719`. RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.6-1-cachyos, Mesa 26.3.1-5, GE-Proton11-12 / Wine 11.0 Staging, ntsync. Native vkd3d-proton `8293130ebe370b1+`, local asserts-disabled build; Rust 1.97.1, Windows-GNU release. Private enabled caches per process. `XCL_SPARSE_CPU_WAIT_MS=0`, `XCL_ZERO_TARGET_PAGES=1`. **Tested** The four new tests each passed in a separate fresh process (1 passed / 0 failed), then together at both `--test-threads=1` and `4` (4 passed / 0 failed each), 0 ignored/skipped. Passive observations confirmed RX 9070 vendor/device `1002:7550`, LUID `[0,1007]` for every new test rather than relying on the default adapter selection. Under `hle::d3d12x::vram::tests::`: - `seal_and_drain_unmaps_leaves_concurrent_unmap_unsealed`: the production helper seals only the old `0x1111` entry, leaving the callback's new `0x2222` entry unsealed. This is the test's synchronous injected interleaving, not a CPU-thread stress run. - `vram_wait_pending_mappings_and_recycle_ready_flush_and_wait`: the wait records fence value 1; recycling succeeds, advances the page fence from 1 to 2, clears `dirty_signal` and parks one resource. - `pool_heaps_take_heap_keeps_zero_buf_alive_in_retire_queue`: the actual placed zero-buffer COM refcount remains 2 while the retirement fence is 0, then falls to 1 after CPU-signaling fence 1 and dropping the retired item. This checks native COM retention; it does not submit GPU work using that alias. Also `hle::d3d12x::sparse::tests::sparse_wait_pending_mappings_flushes_queued_mapping`: `mapping_queued` clears, sparse fence value becomes 1 and the recorded queue wait matches it. This checks the queued flag/wait bookkeeping, not copied data in that test. - The previous seven retire/cooling/run-coalescing CPU tests pass unchanged on both heads at `--test-threads=1` and `4`: 7 passed / 0 failed per invocation. - Repeated the local native late-mapping data probe on both heads, three fresh full processes each plus pilots. Six cases: dirty mapping, already-signaled mapping, pending zero, map plus zero, two reader queues, and clean. Each invocation: 1 passed / 0 failed. All 88 full 64 KiB first/tail readbacks, 1,441,792 words, independently checked. Both heads wait for the gate and return the intended remapped/zeroed data, with no stale first readback. Per source, captured 13 native late signals and 19 late queue waits, all HRESULT 0; device remains healthy in every data-probe case. 18 processes total. Copied source trees, original assertions unchanged; only passive test observations and the local native fixture added. ```text cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run wine <test-exe> <new-test-filter> --exact --nocapture --test-threads=1 wine <test-exe> <all-four-new-filters> --exact --nocapture --test-threads=4 wine <test-exe> hle::d3d12x::vram::workflow_late_native::workflow_late_mappings_and_zero_fills_order_native_reads --exact --nocapture --test-threads=1 ``` The last filter is a local fixture using actual `Pages` mapping/zero-fill/signal operations and the VRAM late-wait helper, with native buffers and queues. It is not an upstream test. **Earlier result retained**: my original `ebef6042` versus `bf7c82ee` native data comparison found 19 stale first readbacks on the pre-fix parent (311,296 wrong words), versus none on `ebef6042`. That archived comparison remains separate; the current update compares two heads that already contain the fix. **Not tested**: full `q_execute_command_lists` / `record_deferred` caller, default CPU-wait route, real concurrent unmap stress, GPU use of the retiring zero-buffer alias, whole suite, title/smoke or performance. The new tests were run as shipped, with no reverse-mutation check here. Integration into main `623d02e4` conflicts in all three runtime files and was not built. No retail data used. **AI use**: OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed both public revisions, added passive adapter/state observations, ran the new tests and native controls, independently checked the results, and updated this report. Publication authorized by the account owner.
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-27 08:25 UTC · original · edited 2026-11-27 10:13 UTC

Rerun on the new head ecbbf96 (adds tests only): the new tests now catch M1, but still not M2 (the RetiringHeap field order) or M3 (the wait_pending_mappings calls removed from submit).

Same machine. ecbbf96 merges into current amd-dev 5fbd90f without conflicts. I did not rerun the full suite: the new commit changes tests only.

result
the 4 new tests alone, 40 runs each; hle::d3d12x::vram:: (36 tests) and hle::d3d12x::sparse:: (38), --test-threads=8, 30 runs each 40 of 40 each; 30 of 30 each
M1 (seal the unmaps pushed after the snapshot) seal_and_drain_unmaps_leaves_concurrent_unmap_unsealed fails 3 of 3 (concurrent unmap must stay unsealed for a fresh fence mark, left 0, right 1)
M2 (_heap declared before _zero_buf) all 7 vram/sparse retire and mapping tests pass 3 of 3. pool_heaps_take_heap_keeps_zero_buf_alive_in_retire_queue checks that zero_buf stays alive, not which field drops first. thehollowedone's generic-RetiringHeap diff above does catch this
M3 (both wait_pending_mappings(q) calls removed from q_execute_command_lists) all pass. The new tests call wait_pending_mappings directly, so nothing checks that submit calls it

NVIDIA run (listed under Not tested): no new failure compared with amd-dev itself (all 18 failures also fail there), and the e2e debug-layer messages are the same. But none of the three new tests covers the shipped code: each of the three fixes can be put back as it was and all tests still pass.

Tested: ebef604 (its base is current amd-dev bf7c82e, so head = merged), and bf7c82e itself for comparison. RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug, Graphics Tools (D3D12 debug layer) installed.

result
cargo test --workspace --no-fail-fast -- --test-threads=4, ebef604 1783 passed, 18 failed, 47 ignored; 20 SKIPPED lines
same on amd-dev bf7c82e the lib binary aborted part-way (below); the other binaries fail the same 6 tests as on the PR
the 18, compared with amd-dev 17 also fail in bf7c82e's runs, e.g. the 3 e2e title tests ([FAIL] … Write64BitValueTopOfPipeX: 0x0, on both), giant_driver_compiles_have_their_own_lane, title_bytes_are_used_in_place_when_all_are_readable, physical_home_without_sparse_windows_uses_coherent_window (3 of 3 alone on both). The 18th, compositor_releases_root_sig_and_rejects_invalid_planes (psos_for leaked root_sig COM refs, left 2, right 1), failed once on the PR, in that suite run, and passed in 3 more lib runs. It is flaky on bf7c82e too: it failed 1 of 7 lib runs there with the same assertion (left 3), and passes 3 of 3 alone on both.
lib binary, --test-threads=4: 1 suite run + 3 more runs each aborts with thread 'xcl-pso-0' panicked at windows-core-0.62.2\src\interface.rs:41:18: null reference produced / non-unwinding panic. aborting.: 2 of 4 on bf7c82e (one more later run crashed with a segfault), 3 of 4 on the PR, so from amd-dev, not this PR
the 3 new vram tests alone, 40 runs each; hle::d3d12x::vram:: (33 tests) and hle::d3d12x::sparse:: (37), --test-threads=8, 30 runs each 40 of 40 each; 30 of 30 each
scratch M1: seal_and_drain_unmaps also seals the unmaps pushed after the snapshot (as before the fix) all 3 new tests and vram:: / sparse:: pass
scratch M2: RetiringHeap declares _heap before _zero_buf (the heap drops first) all pass
scratch M3: the two wait_pending_mappings(q) calls removed from q_execute_command_lists all pass
e2e test_title_draws_with_a_root_signature_under_the_debug_layer, PR vs bf7c82e the same messages on both: 3× error id 93, 1× error id 1046, 1× warning id 820, 8× id 0 at exit (the title fails the same way on both, see above)

The new tests run a copy of each fix rather than the code that ships:

  • seal_and_drain_unmaps_does_not_attach_stale_marks_to_concurrent_unmaps replays the snapshot sequence by hand and calls seal_snapshot_ops, not seal_and_drain_unmaps.
  • wait_pending_mappings_flushes_post_refresh_dirty_signal checks the needs_mapping_wait predicate only.
  • retire_queue_keeps_zero_buf_alive_until_marks_complete uses a test-only FakeRetiringHeap, so the drop order of the real RetiringHeap is not checked.

If you want the field order guarded, a test on RetiringHeap itself with stand-in fields would catch M2. Calling seal_and_drain_unmaps's two locked halves from a test would cover M1.

Not tested: a title on NVIDIA with this branch, a release build, Intel, a long run.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch mutations and wrote this report.

**@⁠fromthemoonx** on GitHub · 2026-11-27 08:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7213525870) · edited 2026-11-27 10:13 UTC **Rerun on the new head `ecbbf96` (adds tests only): the new tests now catch M1, but still not M2 (the `RetiringHeap` field order) or M3 (the `wait_pending_mappings` calls removed from submit).** Same machine. `ecbbf96` merges into current `amd-dev` `5fbd90f` without conflicts. I did not rerun the full suite: the new commit changes tests only. | | result | |---|---| | the 4 new tests alone, 40 runs each; `hle::d3d12x::vram::` (36 tests) and `hle::d3d12x::sparse::` (38), `--test-threads=8`, 30 runs each | 40 of 40 each; 30 of 30 each | | M1 (seal the unmaps pushed after the snapshot) | `seal_and_drain_unmaps_leaves_concurrent_unmap_unsealed` fails 3 of 3 (`concurrent unmap must stay unsealed for a fresh fence mark`, left `0`, right `1`) | | M2 (`_heap` declared before `_zero_buf`) | all 7 vram/sparse retire and mapping tests pass 3 of 3. `pool_heaps_take_heap_keeps_zero_buf_alive_in_retire_queue` checks that `zero_buf` stays alive, not which field drops first. thehollowedone's generic-`RetiringHeap` diff above does catch this | | M3 (both `wait_pending_mappings(q)` calls removed from `q_execute_command_lists`) | all pass. The new tests call `wait_pending_mappings` directly, so nothing checks that submit calls it | --- **NVIDIA run (listed under Not tested): no new failure compared with `amd-dev` itself (all 18 failures also fail there), and the e2e debug-layer messages are the same. But none of the three new tests covers the shipped code: each of the three fixes can be put back as it was and all tests still pass.** **Tested:** `ebef604` (its base is current `amd-dev` `bf7c82e`, so head = merged), and `bf7c82e` itself for comparison. RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug, Graphics Tools (D3D12 debug layer) installed. | | result | |---|---| | `cargo test --workspace --no-fail-fast -- --test-threads=4`, `ebef604` | 1783 passed, 18 failed, 47 ignored; 20 `SKIPPED` lines | | same on `amd-dev` `bf7c82e` | the lib binary aborted part-way (below); the other binaries fail the same 6 tests as on the PR | | the 18, compared with `amd-dev` | 17 also fail in `bf7c82e`'s runs, e.g. the 3 `e2e` title tests (`[FAIL] … Write64BitValueTopOfPipeX: 0x0`, on both), `giant_driver_compiles_have_their_own_lane`, `title_bytes_are_used_in_place_when_all_are_readable`, `physical_home_without_sparse_windows_uses_coherent_window` (3 of 3 alone on both). The 18th, `compositor_releases_root_sig_and_rejects_invalid_planes` (`psos_for leaked root_sig COM refs`, left `2`, right `1`), failed once on the PR, in that suite run, and passed in 3 more lib runs. It is flaky on `bf7c82e` too: it failed 1 of 7 lib runs there with the same assertion (left `3`), and passes 3 of 3 alone on both. | | lib binary, `--test-threads=4`: 1 suite run + 3 more runs each | aborts with `thread 'xcl-pso-0' panicked at windows-core-0.62.2\src\interface.rs:41:18: null reference produced` / `non-unwinding panic. aborting.`: 2 of 4 on `bf7c82e` (one more later run crashed with a segfault), 3 of 4 on the PR, so from `amd-dev`, not this PR | | the 3 new `vram` tests alone, 40 runs each; `hle::d3d12x::vram::` (33 tests) and `hle::d3d12x::sparse::` (37), `--test-threads=8`, 30 runs each | 40 of 40 each; 30 of 30 each | | scratch M1: `seal_and_drain_unmaps` also seals the unmaps pushed after the snapshot (as before the fix) | all 3 new tests and `vram::` / `sparse::` pass | | scratch M2: `RetiringHeap` declares `_heap` before `_zero_buf` (the heap drops first) | all pass | | scratch M3: the two `wait_pending_mappings(q)` calls removed from `q_execute_command_lists` | all pass | | `e2e` `test_title_draws_with_a_root_signature_under_the_debug_layer`, PR vs `bf7c82e` | the same messages on both: 3× error id 93, 1× error id 1046, 1× warning id 820, 8× id 0 at exit (the title fails the same way on both, see above) | The new tests run a copy of each fix rather than the code that ships: - `seal_and_drain_unmaps_does_not_attach_stale_marks_to_concurrent_unmaps` replays the snapshot sequence by hand and calls `seal_snapshot_ops`, not `seal_and_drain_unmaps`. - `wait_pending_mappings_flushes_post_refresh_dirty_signal` checks the `needs_mapping_wait` predicate only. - `retire_queue_keeps_zero_buf_alive_until_marks_complete` uses a test-only `FakeRetiringHeap`, so the drop order of the real `RetiringHeap` is not checked. If you want the field order guarded, a test on `RetiringHeap` itself with stand-in fields would catch M2. Calling `seal_and_drain_unmaps`'s two locked halves from a test would cover M1. **Not tested:** a title on NVIDIA with this branch, a release build, Intel, a long run. **AI use:** Claude Code (Claude Opus 5.5) ran the tests and the scratch mutations and wrote this report.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-27 08:28 UTC · original

Linux (Wine) run of #2981 on the NVIDIA+Wine lane: your fixes do not change this branch's behavior there - the suite still dies at the same place.

Boxb (i5-10600K, 16 GB DDR4, GTX 1070 8 GB, 550.163.01, Debian 13, wine-10.0, xvfb), pr/2981 head ebef6042 (amd-dev-based): the full suite died with the same red prefix and the same hard crash as plain amd-dev tip bf7c82ee run the same evening on the same machine:

  • identical FAILED set before the death: sm5_ambient_hlsl_shaders_compile_cleanly, gpu_two_pass_indirect_commands_keep_their_own_records, gpu_promoted_uav_clear_values_pass_create_committed_resource, a_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget, bitset_runs_emit_exact_contiguous_page_ranges, write_buffer_immediate_on_open_existing_heap_visible_to_cpu, compositor_releases_root_sig_and_rejects_invalid_planes, a_dispatch_with_a_pipeline_still_building_waits_at_the_submit
  • then: wine: Unhandled page fault on execute access to 00007FFFFE8A0428 - suite does not complete (the older tip b5c0275f still completed at 770/22 on this box, so the branch regressed on the NVIDIA+Wine lane independently of your change).

Solo deadlock test at tip bf7c82ee: FAILED 3/3 (~9.92 s dispatch 17 waited for the build, list_x.rs:8508:17) - your tile-flush work does not touch it. Details on the standing thread #2764.

AMD+Wine lane (rig, RX 7900 XT, wine-11.0 Proton) cannot complete any recent amd-dev suite (dies partway), so no rig numbers for this one.

AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-27 08:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7213579211) **Linux (Wine) run of #2981 on the NVIDIA+Wine lane: your fixes do not change this branch's behavior there - the suite still dies at the same place.** Boxb (i5-10600K, 16 GB DDR4, GTX 1070 8 GB, 550.163.01, Debian 13, wine-10.0, xvfb), `pr/2981` head `ebef6042` (amd-dev-based): the full suite died with the same red prefix and the same hard crash as plain amd-dev tip `bf7c82ee` run the same evening on the same machine: - identical FAILED set before the death: `sm5_ambient_hlsl_shaders_compile_cleanly`, `gpu_two_pass_indirect_commands_keep_their_own_records`, `gpu_promoted_uav_clear_values_pass_create_committed_resource`, `a_put_off_dispatch_runs_at_the_submit_when_its_build_outlasts_the_wait_budget`, `bitset_runs_emit_exact_contiguous_page_ranges`, `write_buffer_immediate_on_open_existing_heap_visible_to_cpu`, `compositor_releases_root_sig_and_rejects_invalid_planes`, `a_dispatch_with_a_pipeline_still_building_waits_at_the_submit` - then: `wine: Unhandled page fault on execute access to 00007FFFFE8A0428` - suite does not complete (the older tip `b5c0275f` still completed at 770/22 on this box, so the branch regressed on the NVIDIA+Wine lane independently of your change). Solo deadlock test at tip `bf7c82ee`: FAILED 3/3 (~9.92 s `dispatch 17 waited for the build`, `list_x.rs:8508:17`) - your tile-flush work does not touch it. Details on the standing thread #2764. AMD+Wine lane (rig, RX 7900 XT, wine-11.0 Proton) cannot complete any recent amd-dev suite (dies partway), so no rig numbers for this one. AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-27 08:40 UTC · original

Follow-up to the independent NVIDIA mutation check: I verified a small way for the existing retirement test to guard the production type's field order, rather than a separate FakeRetiringHeap.

On #2981 head ebef6042, I made RetiringHeap generic with its current COM types as defaults, then instantiated that same type with drop trackers in retire_queue_keeps_zero_buf_alive_until_marks_complete. The production instantiations and drop order remain as shipped. On Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC:

  • cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::vram:: -- --test-threads=1: 33 passed, 0 failed, 1 ignored with the candidate diff.
  • Reversing just the two fields of the production RetiringHeap definition then running cargo test --offline --locked -j 4 -p xcl --lib retire_queue_keeps_zero_buf_alive_until_marks_complete -- --nocapture --test-threads=1: 0 passed, 1 failed, 0 ignored. The failure was left: ["heap", "zero_buf"], right: ["zero_buf", "heap"]. I restored the correct order afterward.
Candidate test-only diff (production behavior unchanged)
--- a/crates/xcl/src/hle/d3d12x/vram.rs
+++ b/crates/xcl/src/hle/d3d12x/vram.rs
@@
-struct RetiringHeap {
-    _zero_buf: Option<ID3D12Resource>,
-    _heap: ID3D12Heap,
+struct RetiringHeap<Z = ID3D12Resource, H = ID3D12Heap> {
+    _zero_buf: Option<Z>,
+    _heap: H,
 }
@@
-        struct FakeRetiringHeap {
-            _zero_buf: Option<DropTracker>,
-            _heap: DropTracker,
-        }
         let dropped = Arc::new(AtomicUsize::new(0));
         let order = Arc::new(std::sync::Mutex::new(Vec::new()));
-        let item = FakeRetiringHeap {
+        let item = RetiringHeap {
             _zero_buf: Some(DropTracker(dropped.clone(), "zero_buf", order.clone())),
             _heap: DropTracker(dropped.clone(), "heap", order.clone()),
         };
-        let mut rq: RetireQueue<FakeRetiringHeap, Arc<AtomicU64>> = RetireQueue::new();
+        let mut rq: RetireQueue<RetiringHeap<DropTracker, DropTracker>, Arc<AtomicU64>> = RetireQueue::new();

This covers the field-order regression only. It does not establish the native COM lifetime, the late mapping wait, or the unmap snapshot race; those still need their own production-path evidence. No title executable or full workspace suite was run for this candidate. AI use: Codex (GPT-6.2 Sol) reviewed the code, wrote the local diff, and ran the passing and mutation checks.

**@⁠thehollowedone** on GitHub · 2026-11-27 08:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7213788901) Follow-up to [the independent NVIDIA mutation check](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2981): I verified a small way for the existing retirement test to guard the **production type's** field order, rather than a separate `FakeRetiringHeap`. On [#2981 head `ebef6042`](https://github.com/xcl-dev/xcl/commit/ebef6042703497bf3ab66486bda939158c5850e0), I made `RetiringHeap` generic with its current COM types as defaults, then instantiated that same type with drop trackers in `retire_queue_keeps_zero_buf_alive_until_marks_complete`. The production instantiations and drop order remain as shipped. On Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC: - `cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::vram:: -- --test-threads=1`: **33 passed, 0 failed, 1 ignored** with the candidate diff. - Reversing just the two fields of the production `RetiringHeap` definition then running `cargo test --offline --locked -j 4 -p xcl --lib retire_queue_keeps_zero_buf_alive_until_marks_complete -- --nocapture --test-threads=1`: **0 passed, 1 failed, 0 ignored**. The failure was `left: ["heap", "zero_buf"]`, `right: ["zero_buf", "heap"]`. I restored the correct order afterward. <details><summary>Candidate test-only diff (production behavior unchanged)</summary> ```diff --- a/crates/xcl/src/hle/d3d12x/vram.rs +++ b/crates/xcl/src/hle/d3d12x/vram.rs @@ -struct RetiringHeap { - _zero_buf: Option<ID3D12Resource>, - _heap: ID3D12Heap, +struct RetiringHeap<Z = ID3D12Resource, H = ID3D12Heap> { + _zero_buf: Option<Z>, + _heap: H, } @@ - struct FakeRetiringHeap { - _zero_buf: Option<DropTracker>, - _heap: DropTracker, - } let dropped = Arc::new(AtomicUsize::new(0)); let order = Arc::new(std::sync::Mutex::new(Vec::new())); - let item = FakeRetiringHeap { + let item = RetiringHeap { _zero_buf: Some(DropTracker(dropped.clone(), "zero_buf", order.clone())), _heap: DropTracker(dropped.clone(), "heap", order.clone()), }; - let mut rq: RetireQueue<FakeRetiringHeap, Arc<AtomicU64>> = RetireQueue::new(); + let mut rq: RetireQueue<RetiringHeap<DropTracker, DropTracker>, Arc<AtomicU64>> = RetireQueue::new(); ``` </details> This covers the field-order regression only. It does not establish the native COM lifetime, the late mapping wait, or the unmap snapshot race; those still need their own production-path evidence. No title executable or full workspace suite was run for this candidate. AI use: Codex (GPT-6.2 Sol) reviewed the code, wrote the local diff, and ran the passing and mutation checks.
Author
Owner

@⁠Saksukella on GitHub · 2026-11-27 09:03 UTC · original

Thanks @⁠fromthemoonx and @⁠thehollowedone! Pushed shipped-code tests directly exercising \seal_and_drain_unmaps_with, \ ram::wait_pending_mappings, \ ram::recycle_ready, \sparse::wait_pending_mappings, and \PoolHeaps::take_heap\ + \RetiringHeap\ COM refcount retention (\39/39\ \ ram, \38/38\ \sparse\ passed on RX 9070 XT).

**@⁠Saksukella** on GitHub · 2026-11-27 09:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7214220285) Thanks @⁠fromthemoonx and @⁠thehollowedone! Pushed shipped-code tests directly exercising \seal_and_drain_unmaps_with\, \ ram::wait_pending_mappings\, \ ram::recycle_ready\, \sparse::wait_pending_mappings\, and \PoolHeaps::take_heap\ + \RetiringHeap\ COM refcount retention (\39/39\ \ ram\, \38/38\ \sparse\ passed on RX 9070 XT).
Author
Owner

@⁠vibryxcx on GitHub · 2026-11-27 09:21 UTC · original · edited 2026-11-27 10:50 UTC

Clean-tree title A/B on an RX 6800 (RDNA2): with ebef6042, 2 of 2 300 s runs ended cleanly; on its base bf7c82ee, 0 of 2. That is a small sample, but it is the first title run of the unmodified PR tree on RDNA2 here (bobosneefdev's run above merged local reverts and switches).

Setup: RX 6800 16 GB, driver 32.0.21045.5002, i5-10600KF, 32 GB, Windows 11 Pro 26200, release builds of bf7c82ee and ebef6042 (clean worktrees), the same retail title with warm caches. Each run: xcl run with XCL_RUN_SECONDS=300, A pressed every 10 s, interleaved base / head / base / head, with 2 min between runs.

run tree end last present frames fps while presenting (avg / peak) longest gap without a present
1 base the title's own int3 (game_scarlett_master.exe+0x3bf4) near the end 326 s 2543 9.2 / 32 4 s
2 head clean at XCL_RUN_SECONDS 316 s 2409 8.5 / 32 4 s
3 base device removed 0x887a0006 at 229 s 227 s – 12.6 / 32 6 s
4 head clean at XCL_RUN_SECONDS 321 s 2629 9.6 / 32 4 s
  • Frame rate while presenting is about the same on both trees, so I see no speed change in these runs, only how they end. On this card bf7c82ee lost the device in 3 of 3 600 s soak runs earlier (#2874), so the two clean head runs fit "fewer unmap/retire races", but two runs cannot prove it.
  • Commit tested: ebef6042. The current head ecbbf96a adds tests (+266 lines in sparse.rs / vram.rs) and changes one runtime line (signal_device_queues(dev, dev_key, extra_queue)). I have not rerun the title on it.
  • The lib suite of ecbbf96a on this card aborts in pso_async::used_tests::a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use (0xc0000409), but so does base bf7c82ee in the same run order (the test passes alone on both), so that is not this PR.

Not tested: ecbbf96a on the title; more runs; runs longer than 300 s; NVIDIA.

AI use: Claude Code (Claude Opus 5.5) ran the A/B through a local test runner, read the logs and wrote this comment.


Update, on the current amd-dev (5fbd90f9, which has #2947): with this PR the device reset is not gone. I made a local merge of 5fbd90f9 and the current head ecbbf96a (2fc8305d, no conflict) and tested it against 5fbd90f9 itself, same card and settings as above, 600 s runs, interleaved:

run tree end last present fps while presenting
1 5fbd90f9 device reset 0x887a0007 at 341 s 341 s 8.3
2 + #2981 device reset 0x887a0007 at 329 s 327 s 10.0
3 5fbd90f9 device reset 0x887a0007 at 353 s 352 s 8.4
4 + #2981 the title's 0xc0000005 at game_scarlett_master.exe+0x2215c35 (the null write of #232 / #159) at about 180 s 178 s 17.1

So on this card the two clean 300 s runs above came from runs that were simply shorter than the reset, which happens at 330-350 s here. With 600 s runs the PR did not remove the reset. Please read the earlier table as "no reset within 300 s", not as a fix.

**@⁠vibryxcx** on GitHub · 2026-11-27 09:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7214590553) · edited 2026-11-27 10:50 UTC **Clean-tree title A/B on an RX 6800 (RDNA2): with `ebef6042`, 2 of 2 300 s runs ended cleanly; on its base `bf7c82ee`, 0 of 2.** That is a small sample, but it is the first title run of the unmodified PR tree on RDNA2 here (bobosneefdev's run above merged local reverts and switches). **Setup:** RX 6800 16 GB, driver 32.0.21045.5002, i5-10600KF, 32 GB, Windows 11 Pro 26200, release builds of `bf7c82ee` and `ebef6042` (clean worktrees), the same retail title with warm caches. Each run: `xcl run` with `XCL_RUN_SECONDS=300`, A pressed every 10 s, interleaved base / head / base / head, with 2 min between runs. | run | tree | end | last present | frames | fps while presenting (avg / peak) | longest gap without a present | |---|---|---|---|---:|---|---| | 1 | base | the title's own `int3` (`game_scarlett_master.exe+0x3bf4`) near the end | 326 s | 2543 | 9.2 / 32 | 4 s | | 2 | **head** | **clean** at `XCL_RUN_SECONDS` | 316 s | 2409 | 8.5 / 32 | 4 s | | 3 | base | device removed `0x887a0006` at 229 s | 227 s | – | 12.6 / 32 | 6 s | | 4 | **head** | **clean** at `XCL_RUN_SECONDS` | 321 s | 2629 | 9.6 / 32 | 4 s | - Frame rate while presenting is about the same on both trees, so I see no speed change in these runs, only how they end. On this card `bf7c82ee` lost the device in 3 of 3 600 s soak runs earlier (#2874), so the two clean head runs fit "fewer unmap/retire races", but two runs cannot prove it. - **Commit tested:** `ebef6042`. The current head `ecbbf96a` adds tests (+266 lines in `sparse.rs` / `vram.rs`) and changes one runtime line (`signal_device_queues(dev, dev_key, extra_queue)`). I have not rerun the title on it. - The lib suite of `ecbbf96a` on this card aborts in `pso_async::used_tests::a_pipeline_an_earlier_run_used_is_built_ahead_of_its_first_use` (`0xc0000409`), but so does base `bf7c82ee` in the same run order (the test passes alone on both), so that is not this PR. **Not tested:** `ecbbf96a` on the title; more runs; runs longer than 300 s; NVIDIA. AI use: Claude Code (Claude Opus 5.5) ran the A/B through a local test runner, read the logs and wrote this comment. --- **Update, on the current `amd-dev` (`5fbd90f9`, which has #2947): with this PR the device reset is not gone.** I made a local merge of `5fbd90f9` and the current head `ecbbf96a` (`2fc8305d`, no conflict) and tested it against `5fbd90f9` itself, same card and settings as above, 600 s runs, interleaved: | run | tree | end | last present | fps while presenting | |---|---|---|---|---| | 1 | `5fbd90f9` | device reset `0x887a0007` at 341 s | 341 s | 8.3 | | 2 | **+ #2981** | **device reset `0x887a0007` at 329 s** | 327 s | 10.0 | | 3 | `5fbd90f9` | device reset `0x887a0007` at 353 s | 352 s | 8.4 | | 4 | **+ #2981** | the title's `0xc0000005` at `game_scarlett_master.exe+0x2215c35` (the null write of #232 / #159) at about 180 s | 178 s | 17.1 | So on this card the two clean 300 s runs above came from runs that were simply shorter than the reset, which happens at 330-350 s here. With 600 s runs the PR did not remove the reset. Please read the earlier table as "no reset within 300 s", not as a fix.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 10:09 UTC · original

RDNA3 / Windows data for #2981 at the new head: 0 of 3 600 s runs hung with it; on the same setup the amd-dev tree hung in 1 of 3. That is "no hang seen in 3 runs", not a fix claim. RDNA2 counterpart: vibryxcx's run above (7214590553).

Setup: RX 7800 XT 16 GB (RDNA3), driver 32.0.31035.1003, Ryzen 7 5700X3D, 64 GB, Windows 11 build 26200, DXC 1.8.2502.11, release builds, the same retail title.

  • Base: amd-dev 5fbd90f9 (has #2947), unmodified (built from bfb40311, whose tree is identical).
  • PR: ecbbf96a merged onto 5fbd90f9 (clean merge, 3 files; the merge commit is local and only used for this test, since the PR branch is still based on bf7c82ee).
  • XCL_PREPARE=0 XCL_NETWORK=0 XCL_ACTIVITY=1, A pressed every 8 s, 600 s runs. Each arm: 3 consecutive runs on one isolated copy of the same warm shader cache and profile, each run starting from what the previous one wrote. No XCL_DRED. The arms ran one after the other, not interleaved.
run base 5fbd90f9 ecbbf96a on 5fbd90f9
1 exit 0 at 600 s exit 0 at 600 s
2 0x887a0006 (device hung) at 153 s exit 0 at 600 s
3 exit 0 at 600 s exit 0 at 600 s
  • Base hang (1 run): every XCL-signalled queue (title, vram pages, gpu-awake, sparse readback, texture uploads) had work pending and none had moved for about 1.5 s when the device was removed. The last events before it were mapping CPU waits and sparse readbacks. DRED was off, so I cannot say whether it was a page fault, or whether it has the signature in the description. I looked no further at tile mappings or unmaps in flight.
  • Presents are not changed by the PR: both arms present about 500-650 per 30 s until ~90 s, then stop. After that, 0-8 presents per 30 s until ~500 s in every completed run; 13-36 per 30 s in the last 90 s in one completed run of each arm (run 3).
  • No other device removal or crash in the five other runs.

Not tested: more than 3 runs per arm (1 vs 0 hangs is not a difference), DRED, a cold cache, other GPUs.

AI use: Claude Code (Claude Sonnet 5.5) built the trees, ran the title, read the logs and wrote this comment. Every number comes from those runs.

**@⁠oni-swr** on GitHub · 2026-11-27 10:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7215540901) **RDNA3 / Windows data for #2981 at the new head: 0 of 3 600 s runs hung with it; on the same setup the amd-dev tree hung in 1 of 3. That is "no hang seen in 3 runs", not a fix claim.** RDNA2 counterpart: vibryxcx's run above (7214590553). **Setup:** RX 7800 XT 16 GB (RDNA3), driver 32.0.31035.1003, Ryzen 7 5700X3D, 64 GB, Windows 11 build 26200, DXC 1.8.2502.11, release builds, the same retail title. - Base: `amd-dev` `5fbd90f9` (has #2947), unmodified (built from `bfb40311`, whose tree is identical). - PR: `ecbbf96a` merged onto `5fbd90f9` (clean merge, 3 files; the merge commit is local and only used for this test, since the PR branch is still based on `bf7c82ee`). - `XCL_PREPARE=0 XCL_NETWORK=0 XCL_ACTIVITY=1`, A pressed every 8 s, 600 s runs. Each arm: 3 consecutive runs on one isolated copy of the same warm shader cache and profile, each run starting from what the previous one wrote. No `XCL_DRED`. The arms ran one after the other, not interleaved. | run | base `5fbd90f9` | `ecbbf96a` on `5fbd90f9` | |---|---|---| | 1 | exit 0 at 600 s | exit 0 at 600 s | | 2 | `0x887a0006` (device hung) at 153 s | exit 0 at 600 s | | 3 | exit 0 at 600 s | exit 0 at 600 s | - **Base hang (1 run):** every XCL-signalled queue (title, vram pages, gpu-awake, sparse readback, texture uploads) had work pending and none had moved for about 1.5 s when the device was removed. The last events before it were mapping CPU waits and sparse readbacks. DRED was off, so I cannot say whether it was a page fault, or whether it has the signature in the description. I looked no further at tile mappings or unmaps in flight. - **Presents are not changed by the PR:** both arms present about 500-650 per 30 s until ~90 s, then stop. After that, 0-8 presents per 30 s until ~500 s in every completed run; 13-36 per 30 s in the last 90 s in one completed run of each arm (run 3). - No other device removal or crash in the five other runs. **Not tested:** more than 3 runs per arm (1 vs 0 hangs is not a difference), DRED, a cold cache, other GPUs. AI use: Claude Code (Claude Sonnet 5.5) built the trees, ran the title, read the logs and wrote this comment. Every number comes from those runs.
Author
Owner

@⁠spicbully-star on GitHub · 2026-11-27 10:51 UTC · original

Second RX 9070 XT data point, matching @⁠bobosneefdev's RX 6800 run above: with this PR the device removal and DRED page fault at GPU VA 0x0; allocations there: []; recently freed: [] remain here too. What changes is which queue stops first.

Setup: RX 9070 XT 16 GB, Windows 10 22H2 (19045), i7-9700K, 32 GB RAM. Release build of ecbbf96 plus bfb4031 (amd-dev, cherry-picked) plus the #662 XG fix.
Env: XCL_NETWORK=0 XCL_DIRECT_DXIL=1 XCL_RT_GATE=miss XCL_DRED=1 XCL_PREPARE=0 XCL_PSO_IMAGE_SKIP=1 XCL_HUGE_PSO_CONCURRENCY=3 plus Agility SDK, warm cache, no XCL_PER_LANE.

tree runs device removed (0x887a0007) texture page mappings did not reach lines first queues stopped
5fbd90f (without) 3 156 s, 216 s, 434 s many before each stop (49 in the 216 s run) a title queue / gpu-awake
ecbbf96 + bfb4031 (with) 1 136 s 98, from 112 s texture uploads (1924/1925), vram pages (13719/13721), sparse (39683/39685), all stalled for ~16 s; title queues idle

So on this machine, with the PR the title queues go idle, and the stuck work is on XCL's own upload, page and sparse queues. One run only, so the order may vary. Next I'm testing XCL_VRAM_ARENAS=1 (no tiled pages) to see whether the VA 0x0 fault needs the page path, and I'll add that result in #2996.

Tested with Claude Code (Claude Opus 5.5). The lines are from the run logs.

**@⁠spicbully-star** on GitHub · 2026-11-27 10:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/2981#issuecomment-7216381249) Second RX 9070 XT data point, matching @⁠bobosneefdev's RX 6800 run above: with this PR the device removal and `DRED page fault at GPU VA 0x0; allocations there: []; recently freed: []` remain here too. What changes is which queue stops first. **Setup:** RX 9070 XT 16 GB, **Windows 10 22H2** (19045), i7-9700K, 32 GB RAM. Release build of ecbbf96 plus bfb4031 (amd-dev, cherry-picked) plus the #662 XG fix. **Env:** `XCL_NETWORK=0 XCL_DIRECT_DXIL=1 XCL_RT_GATE=miss XCL_DRED=1 XCL_PREPARE=0 XCL_PSO_IMAGE_SKIP=1 XCL_HUGE_PSO_CONCURRENCY=3` plus Agility SDK, warm cache, no `XCL_PER_LANE`. | tree | runs | device removed (0x887a0007) | `texture page mappings did not reach` lines | first queues stopped | |---|---|---|---|---| | 5fbd90f (without) | 3 | 156 s, 216 s, 434 s | many before each stop (49 in the 216 s run) | a title queue / `gpu-awake` | | ecbbf96 + bfb4031 (with) | 1 | 136 s | 98, from 112 s | `texture uploads` (1924/1925), `vram pages` (13719/13721), `sparse` (39683/39685), all stalled for ~16 s; **title queues idle** | So on this machine, with the PR the title queues go idle, and the stuck work is on XCL's own upload, page and sparse queues. One run only, so the order may vary. Next I'm testing `XCL_VRAM_ARENAS=1` (no tiled pages) to see whether the VA 0x0 fault needs the page path, and I'll add that result in #2996. Tested with Claude Code (Claude Opus 5.5). The lines are from the run logs.
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/hle/d3d12x/vram.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

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