D3D12.X: hand the title reserved textures with live page tables #3553

Merged
lucsoft merged 3 commits from upstream-pr/3553 into main 2026-12-02 13:52:19 +00:00
lucsoft commented 2026-11-30 23:49:08 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-11-30T23:49:08Z.


On amdgpu (Linux, RADV) a title can fault the GPU on a reserved texture XCL has just created for one of its placements: the GPU reads it through work submitted before the texture existed, and the kernel has not mapped it yet. This hands the title reserved textures whose page tables already exist, and makes the rare new one wait for its mapping. It is on by default only under Wine on an AMD GPU, where the problem exists; XCL_LIVE_RESERVED=1/0 forces it either way.

What is in it

  • Cause. amdgpu runs a process's page-table updates in order on one entity (vm->delayed). Every unmap, and every sparse rebind (REPLACE puts the old range on vm->freed), first waits for all of the VM's submitted work (amdgpu_vm_clear_freed, AMDGPU_SYNC_EQ_OWNER). A new submit waits for vm->last_update, but work already submitted does not. So while a long frame runs, a reserved texture created after that frame was submitted has no PTEs at all, not even the PRT ones from vkCreateImage. When the title writes its descriptor into memory that the already-submitted work reads (fine on the console), the read faults: [gfxhub] page fault … client TCP, PERMISSION_FAULTS 0x3, then DXGI_ERROR_DEVICE_REMOVED. Shown with RADV_DEBUG=bo_history, the kernel log on the same clock and a devcoredump: the faulting virtual BO was created 32–38 ms before the fault, and the hung IB is in a CS BO created 437 ms before the texture.
  • Stacked on #3566 at 94b0d761. The bottom commits cover failed mapping Signals and Waits on every platform. Only the top commit belongs to #3553.
  • Fix (vram.rs, one commit: the parts only work together. Without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame):
    • ReservedPool also takes render-target, depth and UAV textures and textures with an optimised clear value. The key copies and compares only the clear value's meaningful bytes: format + four colour floats, or depth float + stencil byte (the union's tail is never read).
    • Each placement tops its description up to XCL_RESERVED_SPARES (default 2) spares made ahead. A spare enters the pool only after a Signal on the mapping queue that was sent after it completes, so its PTEs exist. Missing spares are reserved under the pages lock (pooled, pending and in-flight ones count), so concurrent placements of one description do not over-create them; a drop guard returns the reservation on every early exit. Spares are kept out of the RESERVED registry (and so out of dumps) until handed out, and every pool eviction removes the entry before the release.
    • A texture that still has to be created new (the first of a description, or a burst that outruns the spares) sends its own Signal and waits for it, up to XCL_PLACE_MAP_WAIT_MS (default 1000; 0 = off), by polling the fence with short sleeps: no event is registered, so none can be left with vkd3d-proton after a timeout. If that Signal cannot be queued, the placement fails as a failed creation does (nothing is mapped or noted yet), instead of handing out a texture nothing covers.
    • Spares and new placements count on #3566's marks: a spare whose Signal fails is released, not pooled; a new texture whose readiness Signal cannot be queued (also after a retry) is not placed.
  • Gate: decided once per device. Default on only under Wine with an AMD GPU (vendor 0x1002), judged by the Vulkan physical device vkd3d-proton drives (through its ID3D12DXVKInteropDevice; DXVK's DXGI may report an NVIDIA GPU as AMD), else by the DXGI adapter. Windows drivers do not run page-table updates behind in-flight work, and the spares and the wait cost time on the title's thread. Elsewhere the previous behaviour is unchanged. XCL_LIVE_RESERVED=1/0 forces it; XCL_RESERVED_POOL=0 still turns the pool off.
  • Log lines: placements from the pool / new / spares made, the time spent making the spares on the placing threads (total and the longest call), and the new placements' waits (count, timeouts, total, longest).
  • Cost of the spares (review): about one CreateReservedResource per placement still runs on the placing thread. Measured in the retail run below: 66126 spares made in 2071 ms over 130 s (31 µs each on average, longest call 10 ms), about 1.6 % of one thread; the waits of new placements are on top (5.3 s over 125 s, longest 102 ms).
  • Related: #3124 also waits for a new lazy texture's mapping before handing it out (an explicit NULL mapping for an NVIDIA device removal, 5 s deadline); it touches the same spot in place_on_pages but solves a different problem.
  • Tests: the gate and the vendor source (Wine+AMD, NVIDIA behind an AMD-reporting DXGI, Windows, no adapter, forced), the depth clear key with garbage in the union tail, the fence wait (returns at the Signal; after a timeout the old fence does not signal a new event), injected Signal failures through bind, unmap, before_execute and recycling (the value stays reachable, no spares pooled, the work is held until a later Signal), a lazy placement without a readiness Signal, a depth clear value placed right before a no-access page, concurrent same-description placements (at most 2 spares), spares kept out of dumps, and a GPU test through place_on_pages (with the mapping queue held a new texture waits and gets two spares, the next comes from the pool without a wait; gate off: no spares, no wait).

Tested

  • AMD Radeon RX 7800 XT, Mesa RADV, Ryzen 7 7800X3D, Wine. Windows GNU release builds of the runtime and workspace test binaries completed.
  • Four-thread hle::d3d12x::vram::tests:: run on this head under Wine: ok. 83 passed; 0 failed; 1 ignored; 0 measured; 2702 filtered out; finished in 3.11s
  • Windows 11 / RTX 5070 Ti at 18547df7: 2,918 passed, 0 failed, 51 ignored in the four-thread workspace suite. Test report

Regression run

Both runs below were made with -Title <game name>; after the runs that flag was dropped from our wrapper, and the title: line of both blocks now shows smoke.ps1's default label instead (f651e787, the hash of the game folder's name). Nothing else in the blocks was changed; the runs are the same.

main:

xcl-smoke v1
commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce
gpu: AMD Radeon RX 7800 XT (RADV NAVI32)
title: f651e787
seconds: 180
exit: 0x0
frames shown: 2569 (PresentX 2569)
presents per 2 s (last 3): 1 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

PR:

xcl-smoke v1
commit: 5800b721b3c7ae0e1fe80afa5bb4b86777c8a959
gpu: AMD Radeon RX 7800 XT (RADV NAVI32)
title: f651e787
seconds: 180
exit: 0x0
frames shown: 2410 (PresentX 2410)
presents per 2 s (last 3): 1 1 0
device removals: 0
crashes: 0
peak commit: 0 MB

The PR's kernel log recorded 0 page faults, 0 ring timeouts, 0 ring resets, 0 coredumps, 0 bus losses.

Not tested

  • Native Windows GPU suite on this head.
  • A driver-generated mapping Signal or Wait failure. The regression test injects failures.
  • Wine reports peak commit as 0 MB in this comparison.
  • Windows with XCL_LIVE_RESERVED=1, NVIDIA under Wine, and other AMD generations.

AI use

  • Codex, GPT-6.2 Sol: addressed review findings in #3566, rebased #3553, and verified the revised stack.
  • Claude Code, Claude Opus 5.5: analysis, the code, tests and this description; reviewed by me.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5575911015 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-11-30T23:49:08Z. --- On amdgpu (Linux, RADV) a title can fault the GPU on a reserved texture XCL has just created for one of its placements: the GPU reads it through work submitted before the texture existed, and the kernel has not mapped it yet. This hands the title reserved textures whose page tables already exist, and makes the rare new one wait for its mapping. It is on by default only under Wine on an AMD GPU, where the problem exists; `XCL_LIVE_RESERVED=1/0` forces it either way. **What is in it** - **Cause.** amdgpu runs a process's page-table updates in order on one entity (`vm->delayed`). Every unmap, and every sparse rebind (`REPLACE` puts the old range on `vm->freed`), first waits for all of the VM's submitted work (`amdgpu_vm_clear_freed`, `AMDGPU_SYNC_EQ_OWNER`). A new submit waits for `vm->last_update`, but work already submitted does not. So while a long frame runs, a reserved texture created after that frame was submitted has no PTEs at all, not even the PRT ones from `vkCreateImage`. When the title writes its descriptor into memory that the already-submitted work reads (fine on the console), the read faults: `[gfxhub] page fault … client TCP`, `PERMISSION_FAULTS 0x3`, then `DXGI_ERROR_DEVICE_REMOVED`. Shown with `RADV_DEBUG=bo_history`, the kernel log on the same clock and a devcoredump: the faulting virtual BO was created 32–38 ms before the fault, and the hung IB is in a CS BO created 437 ms before the texture. - **Stacked on #3566** at `94b0d761`. The bottom commits cover failed mapping Signals and Waits on every platform. Only the top commit belongs to #3553. - **Fix** (`vram.rs`, one commit: the parts only work together. Without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame): - `ReservedPool` also takes render-target, depth and UAV textures and textures with an optimised clear value. The key copies and compares only the clear value's meaningful bytes: format + four colour floats, or depth float + stencil byte (the union's tail is never read). - Each placement tops its description up to `XCL_RESERVED_SPARES` (default 2) spares made ahead. A spare enters the pool only after a Signal on the mapping queue that was sent after it completes, so its PTEs exist. Missing spares are reserved under the pages lock (pooled, pending and in-flight ones count), so concurrent placements of one description do not over-create them; a drop guard returns the reservation on every early exit. Spares are kept out of the `RESERVED` registry (and so out of dumps) until handed out, and every pool eviction removes the entry before the release. - A texture that still has to be created new (the first of a description, or a burst that outruns the spares) sends its own Signal and waits for it, up to `XCL_PLACE_MAP_WAIT_MS` (default 1000; 0 = off), by polling the fence with short sleeps: no event is registered, so none can be left with vkd3d-proton after a timeout. If that Signal cannot be queued, the placement fails as a failed creation does (nothing is mapped or noted yet), instead of handing out a texture nothing covers. - Spares and new placements count on #3566's marks: a spare whose Signal fails is released, not pooled; a new texture whose readiness Signal cannot be queued (also after a retry) is not placed. - **Gate:** decided once per device. Default on only under Wine with an AMD GPU (vendor 0x1002), judged by the Vulkan physical device vkd3d-proton drives (through its `ID3D12DXVKInteropDevice`; DXVK's DXGI may report an NVIDIA GPU as AMD), else by the DXGI adapter. Windows drivers do not run page-table updates behind in-flight work, and the spares and the wait cost time on the title's thread. Elsewhere the previous behaviour is unchanged. `XCL_LIVE_RESERVED=1/0` forces it; `XCL_RESERVED_POOL=0` still turns the pool off. - Log lines: placements from the pool / new / spares made, the time spent making the spares on the placing threads (total and the longest call), and the new placements' waits (count, timeouts, total, longest). - **Cost of the spares** (review): about one `CreateReservedResource` per placement still runs on the placing thread. Measured in the retail run below: 66126 spares made in 2071 ms over 130 s (31 µs each on average, longest call 10 ms), about 1.6 % of one thread; the waits of new placements are on top (5.3 s over 125 s, longest 102 ms). - **Related:** #3124 also waits for a new lazy texture's mapping before handing it out (an explicit NULL mapping for an NVIDIA device removal, 5 s deadline); it touches the same spot in `place_on_pages` but solves a different problem. - Tests: the gate and the vendor source (Wine+AMD, NVIDIA behind an AMD-reporting DXGI, Windows, no adapter, forced), the depth clear key with garbage in the union tail, the fence wait (returns at the Signal; after a timeout the old fence does not signal a new event), injected Signal failures through bind, unmap, `before_execute` and recycling (the value stays reachable, no spares pooled, the work is held until a later Signal), a lazy placement without a readiness Signal, a depth clear value placed right before a no-access page, concurrent same-description placements (at most 2 spares), spares kept out of dumps, and a GPU test through `place_on_pages` (with the mapping queue held a new texture waits and gets two spares, the next comes from the pool without a wait; gate off: no spares, no wait). **Tested** - AMD Radeon RX 7800 XT, Mesa RADV, Ryzen 7 7800X3D, Wine. Windows GNU release builds of the runtime and workspace test binaries completed. - Four-thread `hle::d3d12x::vram::tests::` run on this head under Wine: ok. 83 passed; 0 failed; 1 ignored; 0 measured; 2702 filtered out; finished in 3.11s - Windows 11 / RTX 5070 Ti at `18547df7`: 2,918 passed, 0 failed, 51 ignored in the four-thread workspace suite. [Test report](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7325479415) **Regression run** Both runs below were made with `-Title <game name>`; after the runs that flag was dropped from our wrapper, and the `title:` line of both blocks now shows `smoke.ps1`'s default label instead (`f651e787`, the hash of the game folder's name). Nothing else in the blocks was changed; the runs are the same. main: ``` xcl-smoke v1 commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce gpu: AMD Radeon RX 7800 XT (RADV NAVI32) title: f651e787 seconds: 180 exit: 0x0 frames shown: 2569 (PresentX 2569) presents per 2 s (last 3): 1 0 0 device removals: 0 crashes: 0 peak commit: 0 MB ``` PR: ``` xcl-smoke v1 commit: 5800b721b3c7ae0e1fe80afa5bb4b86777c8a959 gpu: AMD Radeon RX 7800 XT (RADV NAVI32) title: f651e787 seconds: 180 exit: 0x0 frames shown: 2410 (PresentX 2410) presents per 2 s (last 3): 1 1 0 device removals: 0 crashes: 0 peak commit: 0 MB ``` The PR's kernel log recorded 0 page faults, 0 ring timeouts, 0 ring resets, 0 coredumps, 0 bus losses. **Not tested** - Native Windows GPU suite on this head. - A driver-generated mapping Signal or Wait failure. The regression test injects failures. - Wine reports peak commit as 0 MB in this comparison. - Windows with `XCL_LIVE_RESERVED=1`, NVIDIA under Wine, and other AMD generations. **AI use** - Codex, GPT-6.2 Sol: addressed review findings in #3566, rebased #3553, and verified the revised stack. - Claude Code, Claude Opus 5.5: analysis, the code, tests and this description; reviewed by me. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-01 00:19:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T00:19:42Z.


merge-check
base: d0832e614f
head: 83ed4c7e91
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored (the lib binary aborted with STATUS_ACCESS_VIOLATION after 2752/2775 tests in the first run, no failures before it; the 23 unreported tests pass alone, and a full rerun of cargo test -p xcl --lib -- --test-threads=4 gave 2744 passed / 0 failed / 31 ignored, counted here together with the other binaries' 148/0/20; matches the open intermittent issue #1487); SKIPPED: 28 (22 no wave64, 2 no heap windows (opt-in), 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 driver cache needs Developer Mode); failing: none
review: (1) "PR description" check fails: the Tested / Not tested / AI use sections are missing (no model named), and there are no xcl-smoke blocks for main or for head 83ed4c7e; CI build was still pending. (2) On by default on every platform, but measured only on Linux/Wine/RADV: make_spares (vram.rs:845-879, called at 2597) creates up to 2 reserved textures with CreateReservedResource on the title's thread whenever a description has fewer than 2 pooled or pending ones, which brings back the per-placement cost the pool was added to remove (#1268: 0.6-1.7 ms AMD, ~0.1 ms NVIDIA), and each new placement waits for a GPU round trip (wait_new_placement, 801-841). (3) ReservedKey::from_desc_clear (903-909) compares all 20 bytes of D3D12_CLEAR_VALUE; depth clear values leave 11 bytes uninitialized, so equal depth clears can make different keys (pool misses, spares that are never used, extra waits). (4) The wait spins with yield_now for up to 1000 ms (817-823) instead of waiting on an event. (5) Spares are registered in RESERVED by dev_create_reserved_resource and freed with the original Release when evicted (1073, 2504-2507), leaving stale RESERVED entries. (6) The new GPU test only checks promote_pending (already covered by an existing test); make_spares, wait_new_placement and the place_on_pages changes have no test. (7) Render target, depth and UAV textures are now recycled by default; not tested on any Windows driver. The amdgpu fault itself cannot be reproduced on Windows; no retail title was run here (no smoke run).
performance: can cost frame time by default: extra synchronous CreateReservedResource calls and a queue Signal for spares, plus a CPU spin wait of up to 1 s per new placement on the title's thread; not measured on Windows (no retail title on this machine); the PR's own numbers are from Linux/Wine/RADV only
verdict: not yet: PR description check fails (no Tested / Not tested / AI use, no xcl-smoke blocks for main and head 83ed4c7e); clear-value key compares uninitialized bytes for depth clears; default-on spares and CPU wait are unmeasured on Windows (cost per placement, spin wait)
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114 / 621.14), AMD Ryzen 7 7800X3D, Windows 11 Pro 10.0.26300, rustc 1.100.0 MSVC / Claude Code, Claude Opus 5.5

<!-- greyfinch-sync:ivall/xcl:comment:7296205554 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7296205554). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T00:19:42Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 83ed4c7e91c3c5c073d584281b3df2981c64777b merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2892 passed, 0 failed, 51 ignored (the lib binary aborted with STATUS_ACCESS_VIOLATION after 2752/2775 tests in the first run, no failures before it; the 23 unreported tests pass alone, and a full rerun of `cargo test -p xcl --lib -- --test-threads=4` gave 2744 passed / 0 failed / 31 ignored, counted here together with the other binaries' 148/0/20; matches the open intermittent issue #1487); SKIPPED: 28 (22 no wave64, 2 no heap windows (opt-in), 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 driver cache needs Developer Mode); failing: none review: (1) "PR description" check fails: the Tested / Not tested / AI use sections are missing (no model named), and there are no xcl-smoke blocks for main or for head 83ed4c7e; CI build was still pending. (2) On by default on every platform, but measured only on Linux/Wine/RADV: make_spares (vram.rs:845-879, called at 2597) creates up to 2 reserved textures with CreateReservedResource on the title's thread whenever a description has fewer than 2 pooled or pending ones, which brings back the per-placement cost the pool was added to remove (#1268: 0.6-1.7 ms AMD, ~0.1 ms NVIDIA), and each new placement waits for a GPU round trip (wait_new_placement, 801-841). (3) ReservedKey::from_desc_clear (903-909) compares all 20 bytes of D3D12_CLEAR_VALUE; depth clear values leave 11 bytes uninitialized, so equal depth clears can make different keys (pool misses, spares that are never used, extra waits). (4) The wait spins with yield_now for up to 1000 ms (817-823) instead of waiting on an event. (5) Spares are registered in RESERVED by dev_create_reserved_resource and freed with the original Release when evicted (1073, 2504-2507), leaving stale RESERVED entries. (6) The new GPU test only checks promote_pending (already covered by an existing test); make_spares, wait_new_placement and the place_on_pages changes have no test. (7) Render target, depth and UAV textures are now recycled by default; not tested on any Windows driver. The amdgpu fault itself cannot be reproduced on Windows; no retail title was run here (no smoke run). performance: can cost frame time by default: extra synchronous CreateReservedResource calls and a queue Signal for spares, plus a CPU spin wait of up to 1 s per new placement on the title's thread; not measured on Windows (no retail title on this machine); the PR's own numbers are from Linux/Wine/RADV only verdict: not yet: PR description check fails (no Tested / Not tested / AI use, no xcl-smoke blocks for main and head 83ed4c7e); clear-value key compares uninitialized bytes for depth clears; default-on spares and CPU wait are unmeasured on Windows (cost per placement, spin wait) hardware / tool and model: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114 / 621.14), AMD Ryzen 7 7800X3D, Windows 11 Pro 10.0.26300, rustc 1.100.0 MSVC / Claude Code, Claude Opus 5.5
lucsoft commented 2026-12-01 00:48:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T00:48:55Z.


Thanks for the review. Addressed in 797541b7:

  1. Description rewritten to the template: Tested with counts (one thread, under Wine on RADV; the main baseline run the same way), and xcl-smoke blocks for main 86e86fcb and head 797541b7.
      1. The pool widening (render targets, depth, UAV), the spares and the new-placement wait are now on by default only under Wine with an AMD adapter, where amdgpu runs page-table updates behind in-flight work. On Windows and NVIDIA the previous behaviour is unchanged, so no extra CreateReservedResource calls or waits on the title's thread there. XCL_LIVE_RESERVED=1/0 forces it.
  2. The key now compares only the meaningful bytes of the clear value: format + four colour floats, or depth float + stencil byte for depth-stencil textures. Test with garbage in the union tail.
  3. The wait sleeps on an event (SetEventOnCompletion + WaitForSingleObject with the timeout) instead of spinning.
  4. Spares stay out of RESERVED until they are handed out, and every pool eviction goes through one helper that removes the entry before the release.
  5. New tests: the gate, the depth key, the fence wait, and a GPU test through place_on_pages (new texture waits and gets spares, the next comes from the pool without a wait; gate off: neither).
<!-- greyfinch-sync:ivall/xcl:comment:7296769415 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7296769415). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-12-01T00:48:55Z. --- Thanks for the review. Addressed in 797541b7: 1. Description rewritten to the template: Tested with counts (one thread, under Wine on RADV; the `main` baseline run the same way), and `xcl-smoke` blocks for `main` 86e86fcb and head 797541b7. 2. + 7. The pool widening (render targets, depth, UAV), the spares and the new-placement wait are now on by default only under Wine with an AMD adapter, where amdgpu runs page-table updates behind in-flight work. On Windows and NVIDIA the previous behaviour is unchanged, so no extra `CreateReservedResource` calls or waits on the title's thread there. `XCL_LIVE_RESERVED=1/0` forces it. 3. The key now compares only the meaningful bytes of the clear value: format + four colour floats, or depth float + stencil byte for depth-stencil textures. Test with garbage in the union tail. 4. The wait sleeps on an event (`SetEventOnCompletion` + `WaitForSingleObject` with the timeout) instead of spinning. 5. Spares stay out of `RESERVED` until they are handed out, and every pool eviction goes through one helper that removes the entry before the release. 6. New tests: the gate, the depth key, the fence wait, and a GPU test through `place_on_pages` (new texture waits and gets spares, the next comes from the pool without a wait; gate off: neither).
thehollowedone commented 2026-12-01 01:12:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T01:12:22Z.


Source review of current head 797541b7, following the earlier merge-check. The updated gate, clear-key comparison, and tests address several of its points. I still see these paths to resolve:

  1. wait_fence closes the event after a timeout even when the fence has not completed. vkd3d-proton registers the supplied handle for later signalling and wraps the caller's handle. If it completes after the timeout, a reused handle could signal an unrelated event. Keep a registered handle alive until completion, or use bounded polling without registration. A delayed-completion test should time out, create another event, then confirm that event is not signalled by the old fence.

  2. signal_now increments pages.value and ignores a failed native_queue_signal. make_spares can then publish pending spares against that value, while before_execute submits a GPU wait for it. If no later successful signal reaches the value, that wait cannot complete. Propagate the signal error, publish a mark only after success, and release the new spares or fail the placement path on error. The existing bind/unmap callers also discard signal errors; please account for those paths in the fix. An injected signal failure should not leave the next submission waiting on an unreachable value.

  3. from_desc_clear now compares only the meaningful depth/stencil bytes, but first read_unaligned reads the entire 20-byte clear-value union. A depth/stencil clear may leave its colour-sized tail uninitialised. Copy only the selected prefix into the already-zeroed key; the current test fills the unused tail with garbage, so it does not exercise this case.

Candidate clear-key correction
diff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs
@@
-            let raw = std::ptr::read_unaligned(clear as *const [u8; CLEAR_VALUE_BYTES]);
             let used = if desc.Flags.contains(D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) { 4 + 4 + 1 } else { CLEAR_VALUE_BYTES };
-            key.clear[..used].copy_from_slice(&raw[..used]);
+            std::ptr::copy_nonoverlapping(clear.cast::<u8>(), key.clear.as_mut_ptr(), used);
  1. Spare demand is counted under PAGES, but spares are created after releasing it. Concurrent same-key placements can each observe the same shortage and create excess reserved resources. Track in-flight spare reservations under the lock and return them on creation failure. A barrier-controlled concurrent placement test would bound the number created.

This is source review, not a new GPU or title test of this head. AI use: OpenAI Codex (GPT-6.2 Sol) traced the current source and vkd3d-proton path; OpenAI Codex (GPT-6.2 Astra) independently checked the lifecycle and concurrency paths.

<!-- greyfinch-sync:ivall/xcl:comment:7297217761 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7297217761). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T01:12:22Z. --- Source review of current head [`797541b7`](https://github.com/xcl-dev/xcl/commit/797541b71c2323b03386935994f9e0a975fe21da), following [the earlier merge-check](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7296205554). The updated gate, clear-key comparison, and tests address several of its points. I still see these paths to resolve: 1. [`wait_fence`](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L833-L853) closes the event after a timeout even when the fence has not completed. [vkd3d-proton registers the supplied handle](https://github.com/HansKristian-Work/vkd3d-proton/blob/020fc9441762f67a4176b702f47bfbf7a1972bb4/libs/vkd3d/command.c#L1415-L1458) for later signalling and [wraps the caller's handle](https://github.com/HansKristian-Work/vkd3d-proton/blob/020fc9441762f67a4176b702f47bfbf7a1972bb4/libs/vkd3d/command.c#L1482-L1487). If it completes after the timeout, a reused handle could signal an unrelated event. Keep a registered handle alive until completion, or use bounded polling without registration. A delayed-completion test should time out, create another event, then confirm that event is not signalled by the old fence. 2. [`signal_now`](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L2166-L2173) increments `pages.value` and ignores a failed `native_queue_signal`. [`make_spares`](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L916-L929) can then publish pending spares against that value, while [`before_execute`](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L3035-L3063) submits a GPU wait for it. If no later successful signal reaches the value, that wait cannot complete. Propagate the signal error, publish a mark only after success, and release the new spares or fail the placement path on error. The existing `bind`/`unmap` callers also discard signal errors; please account for those paths in the fix. An injected signal failure should not leave the next submission waiting on an unreachable value. 3. [`from_desc_clear`](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L952-L963) now compares only the meaningful depth/stencil bytes, but first `read_unaligned` reads the *entire* 20-byte clear-value union. A depth/stencil clear may leave its colour-sized tail uninitialised. Copy only the selected prefix into the already-zeroed key; the current test fills the unused tail with garbage, so it does not exercise this case. <details> <summary>Candidate clear-key correction</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs @@ - let raw = std::ptr::read_unaligned(clear as *const [u8; CLEAR_VALUE_BYTES]); let used = if desc.Flags.contains(D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) { 4 + 4 + 1 } else { CLEAR_VALUE_BYTES }; - key.clear[..used].copy_from_slice(&raw[..used]); + std::ptr::copy_nonoverlapping(clear.cast::<u8>(), key.clear.as_mut_ptr(), used); ``` </details> 4. [Spare demand is counted](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L2553-L2567) under `PAGES`, but [spares are created](https://github.com/xcl-dev/xcl/blob/797541b71c2323b03386935994f9e0a975fe21da/crates/xcl/src/hle/d3d12x/vram.rs#L2659-L2662) after releasing it. Concurrent same-key placements can each observe the same shortage and create excess reserved resources. Track in-flight spare reservations under the lock and return them on creation failure. A barrier-controlled concurrent placement test would bound the number created. This is source review, not a new GPU or title test of this head. AI use: OpenAI Codex (GPT-6.2 Sol) traced the current source and vkd3d-proton path; OpenAI Codex (GPT-6.2 Astra) independently checked the lifecycle and concurrency paths.
lucsoft commented 2026-12-01 01:35:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T01:35:21Z.


Thanks, all four addressed in 85c1c599:

  1. wait_fence no longer registers an event: it polls the fence with sleeps of at most 0.5 ms up to the timeout, so nothing is left with vkd3d-proton after a timeout. Test: time out, create a new event, signal the old value; the new event stays unsignalled.
  2. signal_now advances the mapping queue's value only after the Signal was queued and returns the failure; bind/unmap go through it, so a failed Signal never leaves the value before_execute waits on unreachable. A new placement whose Signal fails does not wait, and spares made without their Signal are released and their reservation returned. Test with an injected Signal failure.
  3. from_desc_clear copies only the meaningful prefix with copy_nonoverlapping (9 bytes for depth-stencil, 20 for colour). Test: a depth clear value placed right before a PAGE_NOACCESS page.
  4. Missing spares are reserved under PAGES (counting pooled, pending and in-flight ones), created after the lock, and the reservation is returned on failure through a drop guard. Test: 4 barrier-synchronised placements of one description with the mapping queue held make at most 2 spares, and no reservation is left.

Description updated: suite and xcl-smoke block for head 85c1c599 (2499 frames, no device removal, no page fault in the kernel log).

<!-- greyfinch-sync:ivall/xcl:comment:7297672815 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7297672815). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-12-01T01:35:21Z. --- Thanks, all four addressed in 85c1c599: 1. `wait_fence` no longer registers an event: it polls the fence with sleeps of at most 0.5 ms up to the timeout, so nothing is left with vkd3d-proton after a timeout. Test: time out, create a new event, signal the old value; the new event stays unsignalled. 2. `signal_now` advances the mapping queue's value only after the Signal was queued and returns the failure; bind/unmap go through it, so a failed Signal never leaves the value `before_execute` waits on unreachable. A new placement whose Signal fails does not wait, and spares made without their Signal are released and their reservation returned. Test with an injected Signal failure. 3. `from_desc_clear` copies only the meaningful prefix with `copy_nonoverlapping` (9 bytes for depth-stencil, 20 for colour). Test: a depth clear value placed right before a `PAGE_NOACCESS` page. 4. Missing spares are reserved under `PAGES` (counting pooled, pending and in-flight ones), created after the lock, and the reservation is returned on failure through a drop guard. Test: 4 barrier-synchronised placements of one description with the mapping queue held make at most 2 spares, and no reservation is left. Description updated: suite and `xcl-smoke` block for head 85c1c599 (2499 frames, no device removal, no page fault in the kernel log).
thehollowedone commented 2026-12-01 01:51:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T01:51:13Z.


Follow-up on head 85c1c599 to my earlier review: the event lifetime, clear-value read, and concurrent spare reservation changes address those points. The failed-Signal path still needs to cover mapping and unmapping already queued.

Pages::map and unmap_range queue UpdateTileMappings, then discard signal_now() returning None. After a failed Signal, bind_range still returns success, while before_execute waits only on the previous successful value. A consuming queue can therefore proceed without a fence mark covering the new mapping. On retirement, recycle_ready publishes that old value for a NULL unmap; if it is already complete, drain_recycled can return the reserved texture to the pool before the unmap finishes. The new failure test invokes signal_now directly and checks spares; it does not exercise either caller.

Please track mapping work whose Signal failed and obtain a successful later mark before allowing dependent execution or recycling. If no mark can be queued, keep the mapping/resource unavailable rather than treating the previous completed value as its mark. A regression can complete mark N, inject a failed Signal after a bind or NULL unmap, hold the mapping queue behind a test fence, and verify that execution/recycling waits for a successfully queued N+1 and its completion.

This is a source trace; I did not inject a failure or run a GPU test on this revision. AI use: Codex (GPT-6.2 Sol) checked the revised call paths; Codex (GPT-6.2 Astra) independently reviewed the mapping and retirement sequence.

<!-- greyfinch-sync:ivall/xcl:comment:7297966755 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7297966755). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T01:51:13Z. --- Follow-up on [head `85c1c599`](https://github.com/xcl-dev/xcl/commit/85c1c599f2fb9782a33756b3cd4c6be4504875dd) to [my earlier review](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7297217761): the event lifetime, clear-value read, and concurrent spare reservation changes address those points. The failed-Signal path still needs to cover **mapping and unmapping already queued**. [`Pages::map`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L2155-L2199) and [`unmap_range`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L2245-L2267) queue `UpdateTileMappings`, then discard `signal_now()` returning `None`. After a failed Signal, `bind_range` still returns success, while [`before_execute`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L3099-L3127) waits only on the previous successful value. A consuming queue can therefore proceed without a fence mark covering the new mapping. On retirement, [`recycle_ready`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L1194-L1217) publishes that old value for a NULL unmap; if it is already complete, [`drain_recycled`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L1141-L1160) can return the reserved texture to the pool before the unmap finishes. The new failure test invokes `signal_now` directly and checks spares; it does not exercise either caller. Please track mapping work whose Signal failed and obtain a successful **later** mark before allowing dependent execution or recycling. If no mark can be queued, keep the mapping/resource unavailable rather than treating the previous completed value as its mark. A regression can complete mark N, inject a failed Signal after a bind or NULL unmap, hold the mapping queue behind a test fence, and verify that execution/recycling waits for a successfully queued N+1 and its completion. This is a source trace; I did not inject a failure or run a GPU test on this revision. AI use: Codex (GPT-6.2 Sol) checked the revised call paths; Codex (GPT-6.2 Astra) independently reviewed the mapping and retirement sequence.
lucsoft commented 2026-12-01 01:55:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T01:55:30Z.


Thanks, the follow-up is right: a failed Signal after Pages::map / unmap_range still leaves the mapping without a mark. I'm fixing that next: mapping work whose Signal failed will need a later successful mark before dependent execution or recycling, with a test through the real callers (complete N, fail the Signal after a bind and after a NULL unmap, hold the mapping queue, check that execution and recycling wait for N+1).

On the other points raised elsewhere:

  • The new-placement wait (up to 1000 ms). It only applies under Wine on AMD, and only to textures that have to be created new (3–4 % of placements; the rest come from the pool or the spares). Measured: longest single wait 186 ms in a 600 s run and 607 ms in a 180 s run, no timeouts. A shorter cap means more timeouts, and a timeout means the page fault and device removal this PR fixes, so I'm keeping 1000 ms as the cap.
  • The doc comment naming a title is changed to neutral wording; it goes out with the fix above.
  • make_spares is complete in the branch; a review tool that showed it cut off was limited by the diff size.
<!-- greyfinch-sync:ivall/xcl:comment:7298044573 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7298044573). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-12-01T01:55:30Z. --- Thanks, the follow-up is right: a failed Signal after `Pages::map` / `unmap_range` still leaves the mapping without a mark. I'm fixing that next: mapping work whose Signal failed will need a later successful mark before dependent execution or recycling, with a test through the real callers (complete N, fail the Signal after a bind and after a NULL unmap, hold the mapping queue, check that execution and recycling wait for N+1). On the other points raised elsewhere: - **The new-placement wait (up to 1000 ms).** It only applies under Wine on AMD, and only to textures that have to be created new (3–4 % of placements; the rest come from the pool or the spares). Measured: longest single wait 186 ms in a 600 s run and 607 ms in a 180 s run, no timeouts. A shorter cap means more timeouts, and a timeout means the page fault and device removal this PR fixes, so I'm keeping 1000 ms as the cap. - **The doc comment naming a title** is changed to neutral wording; it goes out with the fix above. - **`make_spares`** is complete in the branch; a review tool that showed it cut off was limited by the diff size.
Foniass commented 2026-12-01 02:03:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T02:03:38Z.


merge-check
base: d0832e614f
head: 85c1c599f2
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2899 passed, 0 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache); failing: none. The new vram tests (live_reserved_is_on_by_default_only_under_wine_on_amd, concurrent_placements_make_at_most_the_spares_of_one, a_failed_signal_publishes_no_value_and_no_spares, live_placements_wait_when_new_and_take_spares_without_waiting, wait_fence_returns_at_the_signal_or_times_out, the depth-clear key tests) ran and passed.
review: whole diff read. All points of the earlier merge-check and of the second review are addressed: on by default only under Wine with an AMD adapter (XCL_LIVE_RESERVED=1/0 forces it), the clear key compares only the meaningful bytes, the wait polls instead of spinning or registering an event, failed Signals publish no value, spares leave RESERVED when evicted, and the new paths have tests. On Windows + NVIDIA the default path adds no CreateReservedResource, Signal or wait. Remaining: (1) 797541b7 and 85c1c599 are review fixups that rewrite the first two commits (the wait went spin -> event -> polling); CONTRIBUTING wants them squashed. (2) about 821 changed lines (351 runtime, 462 test) with no reason in the description why it cannot be split. (3) not verified: DXVK's dxgi (Proton) can report an NVIDIA GPU as AMD, which would turn live mode on there (time, not a crash). (4) nits: signal_now's doc comment sits on reserve_spares; no linked issue.
performance: smoke 240 s on the merged tree 3fa20d5a vs main d0832e61 (same title, same input script): every run, main included, loses the device to a GPU page fault (DRED state 7) during the world load: main at 100.4 s / 100.4 s with 2195 / 2219 presents, this PR at 93.4 s with 1987 (90 %); peak commit 31916 MB vs 34766 / 32760 MB. Within run-to-run noise (an earlier run of 83ed4c7e had 2222); the live mode is off here, so the AMD/Wine path is not exercised on this machine.
verdict: not yet: squash the review fixups 797541b7 / 85c1c599 into the first commits (and say why ~820 lines cannot be split); the code has no blocking finding
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114 / 621.14), AMD Ryzen 7 7800X3D, Windows 11 Pro 10.0.26300, rustc 1.100.0 MSVC / Claude Code, Claude Opus 5.5

<!-- greyfinch-sync:ivall/xcl:comment:7298188445 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7298188445). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T02:03:38Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: 85c1c599f2fb9782a33756b3cd4c6be4504875dd merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2899 passed, 0 failed, 51 ignored; SKIPPED: 28 (22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 cannot disable the driver cache); failing: none. The new vram tests (live_reserved_is_on_by_default_only_under_wine_on_amd, concurrent_placements_make_at_most_the_spares_of_one, a_failed_signal_publishes_no_value_and_no_spares, live_placements_wait_when_new_and_take_spares_without_waiting, wait_fence_returns_at_the_signal_or_times_out, the depth-clear key tests) ran and passed. review: whole diff read. All points of the earlier merge-check and of the second review are addressed: on by default only under Wine with an AMD adapter (XCL_LIVE_RESERVED=1/0 forces it), the clear key compares only the meaningful bytes, the wait polls instead of spinning or registering an event, failed Signals publish no value, spares leave RESERVED when evicted, and the new paths have tests. On Windows + NVIDIA the default path adds no CreateReservedResource, Signal or wait. Remaining: (1) 797541b7 and 85c1c599 are review fixups that rewrite the first two commits (the wait went spin -> event -> polling); CONTRIBUTING wants them squashed. (2) about 821 changed lines (351 runtime, 462 test) with no reason in the description why it cannot be split. (3) not verified: DXVK's dxgi (Proton) can report an NVIDIA GPU as AMD, which would turn live mode on there (time, not a crash). (4) nits: signal_now's doc comment sits on reserve_spares; no linked issue. performance: smoke 240 s on the merged tree 3fa20d5a vs main d0832e61 (same title, same input script): every run, main included, loses the device to a GPU page fault (DRED state 7) during the world load: main at 100.4 s / 100.4 s with 2195 / 2219 presents, this PR at 93.4 s with 1987 (90 %); peak commit 31916 MB vs 34766 / 32760 MB. Within run-to-run noise (an earlier run of 83ed4c7e had 2222); the live mode is off here, so the AMD/Wine path is not exercised on this machine. verdict: not yet: squash the review fixups 797541b7 / 85c1c599 into the first commits (and say why ~820 lines cannot be split); the code has no blocking finding hardware / tool and model: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114 / 621.14), AMD Ryzen 7 7800X3D, Windows 11 Pro 10.0.26300, rustc 1.100.0 MSVC / Claude Code, Claude Opus 5.5
thehollowedone commented 2026-12-01 02:11:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T02:11:11Z.


One ordering detail for the failed-Signal fix you described on head 85c1c599: before_execute calls release_held_unmaps before it reads pages.value for the consumer wait. That helper can queue a new NULL unmap through self.unmap, whose Signal can fail. A recovery check only at before_execute entry would miss that unmarked work.

If recovery happens in before_execute, check again after release_held_unmaps and before using pages.value for the wait or reclaim decision. The real-caller regression should include a held unmap that becomes releasable during before_execute, with its NULL-mapping Signal forced to fail. This is a source-ordering check; I did not run the new revision. AI use: Codex (GPT-6.2 Sol) verified the call order; Codex (GPT-6.2 Astra) independently traced this path.

<!-- greyfinch-sync:ivall/xcl:comment:7298335865 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7298335865). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T02:11:11Z. --- One ordering detail for the failed-Signal fix you described on [head `85c1c599`](https://github.com/xcl-dev/xcl/commit/85c1c599f2fb9782a33756b3cd4c6be4504875dd): [`before_execute`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L3099-L3115) calls `release_held_unmaps` before it reads `pages.value` for the consumer wait. That helper can queue a **new** NULL unmap through [`self.unmap`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L2327-L2345), whose Signal can fail. A recovery check only at `before_execute` entry would miss that unmarked work. If recovery happens in `before_execute`, check again after `release_held_unmaps` and before using `pages.value` for the wait or reclaim decision. The real-caller regression should include a held unmap that becomes releasable during `before_execute`, with its NULL-mapping Signal forced to fail. This is a source-ordering check; I did not run the new revision. AI use: Codex (GPT-6.2 Sol) verified the call order; Codex (GPT-6.2 Astra) independently traced this path.
thehollowedone commented 2026-12-01 03:13:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T03:13:30Z.


One separate lifetime point on head 85c1c599, for XCL_DUMP_TARGETS:

make_spares creates each idle spare through the title-facing dev_create_reserved_resource wrapper. For a 3D texture, that wrapper calls lut3d::created, which stores its raw pointer in VOLS. forget_reserved removes only the separate reserved-resource record. If the spare is later evicted, the original COM Release bypasses the normal hook that calls lut3d::forget. to_dump can then call GetDesc through that freed pointer, even for a volume it would otherwise exclude from readback.

Create an internal spare through the existing PC creator and register diagnostics only when a resource is handed to the title. The GPU-owned and sampled placement paths already do the latter after successful placement. Clearing VOLS only at eviction would still leave idle spares in dumps and miss the original Release after a failed QueryInterface on checkout.

Candidate diff against this head
diff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs
@@
-        let hr = super::real::dev_create_reserved_resource(this, tiled as *const _ as usize, state as usize, clear as usize, riid, &mut p);
+        let hr = super::real::pc_create_reserved_resource(this, tiled as *const _ as usize, state as usize, clear as usize, riid, &mut p);
@@
-        // (idle in the pool, as a title's released one: `note_reserved` again when handed out)
-        super::real::forget_reserved(p as usize);

Please add a deterministic regression with dump tracking enabled: make a 3D spare, check that the idle spare is absent from diagnostic enumeration, force pool eviction, then check that enumeration cannot touch the released resource. A checked-out 3D texture should still be registered. I traced this in source; I did not run that regression or a GPU test on this head. AI use: Codex (GPT-6.2 Sol) checked the release and diagnostic paths; Codex (GPT-6.2 Astra) independently traced the spare lifecycle.

<!-- greyfinch-sync:ivall/xcl:comment:7299475980 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7299475980). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T03:13:30Z. --- One separate lifetime point on [head `85c1c599`](https://github.com/xcl-dev/xcl/commit/85c1c599f2fb9782a33756b3cd4c6be4504875dd), for `XCL_DUMP_TARGETS`: [`make_spares`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L918-L936) creates each idle spare through the title-facing `dev_create_reserved_resource` wrapper. For a 3D texture, that wrapper calls [`lut3d::created`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/real.rs#L4619-L4634), which stores its raw pointer in `VOLS`. `forget_reserved` removes only the separate reserved-resource record. If the spare is later [evicted](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L1163-L1170), the original COM `Release` bypasses the normal hook that calls `lut3d::forget`. [`to_dump`](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/lut3d.rs#L211-L220) can then call `GetDesc` through that freed pointer, even for a volume it would otherwise exclude from readback. Create an internal spare through the existing PC creator and register diagnostics only when a resource is handed to the title. The [GPU-owned and sampled placement paths](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/device_x.rs#L1291-L1317) already do the latter after successful placement. Clearing `VOLS` only at eviction would still leave idle spares in dumps and miss the original `Release` after a failed `QueryInterface` on checkout. <details> <summary>Candidate diff against this head</summary> ```diff diff --git a/crates/xcl/src/hle/d3d12x/vram.rs b/crates/xcl/src/hle/d3d12x/vram.rs @@ - let hr = super::real::dev_create_reserved_resource(this, tiled as *const _ as usize, state as usize, clear as usize, riid, &mut p); + let hr = super::real::pc_create_reserved_resource(this, tiled as *const _ as usize, state as usize, clear as usize, riid, &mut p); @@ - // (idle in the pool, as a title's released one: `note_reserved` again when handed out) - super::real::forget_reserved(p as usize); ``` </details> Please add a deterministic regression with dump tracking enabled: make a 3D spare, check that the idle spare is absent from diagnostic enumeration, force pool eviction, then check that enumeration cannot touch the released resource. A checked-out 3D texture should still be registered. I traced this in source; I did not run that regression or a GPU test on this head. AI use: Codex (GPT-6.2 Sol) checked the release and diagnostic paths; Codex (GPT-6.2 Astra) independently traced the spare lifecycle.
thehollowedone commented 2026-12-01 03:52:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-01T03:52:43Z.


One additional cold-placement case for the failed-Signal fix on head 85c1c599: with XCL_TEXTURE_LEVEL_PAGES=1 (off by default), a newly created, eligible sampled texture takes the lazy level path without queueing a tile map. Its initial page-table readiness then depends on wait_new_placement's Signal. If that Signal fails, the helper returns None, but the placement caller ignores it and returns success. A title could then use the descriptor before the newly created texture has live page-table entries. Repairing failed bind or unmap Signals in before_execute alone would miss this case: neither operation has queued a mapping, and previously submitted work cannot be made to wait there.

Please distinguish a disabled placement wait from a failed Signal. On failure, queue a successful readiness mark and wait for it before returning the resource, or roll back the placement and propagate failure. A focused regression can disable spares, hold the mapping queue behind a test fence, inject the first Signal failure during a cold lazy placement, and verify the caller does not receive a usable resource before a successful retry completes. This is a source trace; I did not run that failure injection or a GPU test on this head.

AI use: Codex (GPT-6.2 Sol) checked the call path; Codex (GPT-6.2 Astra) independently checked the page-table invariant.

<!-- greyfinch-sync:ivall/xcl:comment:7300154479 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7300154479). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-12-01T03:52:43Z. --- One additional cold-placement case for the failed-Signal fix on [head `85c1c599`](https://github.com/xcl-dev/xcl/commit/85c1c599f2fb9782a33756b3cd4c6be4504875dd): with `XCL_TEXTURE_LEVEL_PAGES=1` (off by default), a newly created, eligible sampled texture takes the [lazy level path](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L2689-L2695) without queueing a tile map. Its initial page-table readiness then depends on [`wait_new_placement`'s Signal](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L854-L868). If that Signal fails, the helper returns `None`, but [the placement caller ignores it and returns success](https://github.com/xcl-dev/xcl/blob/85c1c599f2fb9782a33756b3cd4c6be4504875dd/crates/xcl/src/hle/d3d12x/vram.rs#L2707-L2727). A title could then use the descriptor before the newly created texture has live page-table entries. Repairing failed bind or unmap Signals in `before_execute` alone would miss this case: neither operation has queued a mapping, and previously submitted work cannot be made to wait there. Please distinguish a disabled placement wait from a failed Signal. On failure, queue a successful readiness mark and wait for it before returning the resource, or roll back the placement and propagate failure. A focused regression can disable spares, hold the mapping queue behind a test fence, inject the first Signal failure during a cold lazy placement, and verify the caller does not receive a usable resource before a successful retry completes. This is a source trace; I did not run that failure injection or a GPU test on this head. AI use: Codex (GPT-6.2 Sol) checked the call path; Codex (GPT-6.2 Astra) independently checked the page-table invariant.
Aniseto commented 2026-12-01 07:54:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T07:54:07Z.


Ran the vram::tests module at 85c1c599 on an NVIDIA Blackwell desktop part with 16 GB of VRAM. The wider vram filter and a main control are also reported below.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1
78 passed; 0 failed; 1 ignored; 2702 filtered out      (exit 0)

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram -- --test-threads=1
73 passed; 8 failed; 1 ignored; 2699 filtered out      (exit 101)

three new tests, each alone at 85c1c599: a_failed_signal_publishes_no_value_and_no_spares,
concurrent_placements_make_at_most_the_spares_of_one, live_placements_wait_when_new_and_take_spares_without_waiting
1 passed; 0 failed; 0 ignored each      (exit 0)

same wider `vram` filter on main 493dbd3d (own CARGO_TARGET_DIR): the test binary
exited 0x80004005 after "sparse upload preparation still failed after bounded retries";
no final test result line was produced on that run.

The 78/0/1 of vram::tests matches the description's lib-suite count for that module. On this Windows NVIDIA host the new behaviour is gated off (it defaults on only under Wine with an AMD adapter), so this is a no-registration check of the module, not a test of the gate's active path. The wider vram filter also selects placed_title_textures_share_vram_and_preserve_pixels, which already fails here on main (row 5: stale shadowed texture corrupted B); the seven other failures in that run are PoisonError cascades, and the three new tests pass when run alone. The control on main did not finish cleanly, so no A/B verdict is drawn from it.

Not tested: Wine with AMD/RADV (where the change is on by default), the XCL_LIVE_RESERVED=1 forced path on NVIDIA, an injected Signal failure with the gate active, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data.

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

<!-- greyfinch-sync:ivall/xcl:comment:7304624546 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7304624546). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-12-01T07:54:07Z. --- Ran the `vram::tests` module at `85c1c599` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. The wider `vram` filter and a `main` control are also reported below. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, `XCL_ADAPTER=NVIDIA`, detached worktree at the exact PR head, no local patches. ``` XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1 78 passed; 0 failed; 1 ignored; 2702 filtered out (exit 0) XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram -- --test-threads=1 73 passed; 8 failed; 1 ignored; 2699 filtered out (exit 101) three new tests, each alone at 85c1c599: a_failed_signal_publishes_no_value_and_no_spares, concurrent_placements_make_at_most_the_spares_of_one, live_placements_wait_when_new_and_take_spares_without_waiting 1 passed; 0 failed; 0 ignored each (exit 0) same wider `vram` filter on main 493dbd3d (own CARGO_TARGET_DIR): the test binary exited 0x80004005 after "sparse upload preparation still failed after bounded retries"; no final test result line was produced on that run. ``` The 78/0/1 of `vram::tests` matches the description's lib-suite count for that module. On this Windows NVIDIA host the new behaviour is gated off (it defaults on only under Wine with an AMD adapter), so this is a no-registration check of the module, not a test of the gate's active path. The wider `vram` filter also selects `placed_title_textures_share_vram_and_preserve_pixels`, which already fails here on `main` (`row 5: stale shadowed texture corrupted B`); the seven other failures in that run are `PoisonError` cascades, and the three new tests pass when run alone. The control on `main` did not finish cleanly, so no A/B verdict is drawn from it. Not tested: Wine with AMD/RADV (where the change is on by default), the `XCL_LIVE_RESERVED=1` forced path on NVIDIA, an injected Signal failure with the gate active, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
lucsoft commented 2026-12-01 08:09:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T08:09:05Z.


Squashed into one commit, 5d7820cf, which also covers the open points:

@Foniass's merge-check:

  1. The review fixups are squashed: one commit on main 86e86fcb.
  2. Why one commit: the description now says it under Fix. Without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame; without the marks a failed Signal lets the wait and the pool count on a mapping nothing covers. The diff is about 455 runtime lines (with comments) and 840 test lines.
  3. DXVK's DXGI reporting an NVIDIA GPU as AMD: the gate now takes the vendor of the Vulkan physical device vkd3d-proton drives (through ID3D12DXVKInteropDevice) and falls back to the DXGI adapter only when that is not available. Test: Vulkan NVIDIA behind a DXGI AMD stays off, and the reverse is on.
  4. The signal_now doc comment now sits on signal_now. There is no linked issue.

@thehollowedone:

  • Queued mapping work whose Signal failed (7297966755) and the ordering in before_execute (7298335865): a mapping whose Signal fails is marked unmarked. before_execute first runs release_held_unmaps, then gets a later mark (Pages::mark) and has the title's queue wait for that. If no Signal can be queued, the work does not go. A retired texture whose NULL unmap has no mark stays out of the pool until a later one completes. Test mappings_whose_signal_failed_get_a_later_mark_before_use holds the mapping queue behind a test fence and covers a bind, a held unmap that becomes releasable inside before_execute with its NULL mapping's Signal failing, the case with no Signal at all, and recycling.
  • Spares and dump tracking (7299475980): spares are made through pc_create_reserved_resource, so they are not in VOLS or RESERVED while idle; they are registered when handed out. Test spares_stay_out_of_dump_tracking_until_handed_out (an idle 3D spare is neither a reserved resource nor a dumped 3D texture, one released from the pool leaves nothing the dump enumerates, and a handed-out one is tracked).
  • The cold lazy placement (7300154479): wait_new_placement now tells a disabled wait from a failed Signal. On failure a retry is queued and waited for; if that fails too, the placement fails the way a failed creation does: nothing is mapped or noted yet, the texture is released and the title gets no resource. Test a_lazy_placement_without_a_readiness_signal_is_not_handed_out.

Description updated: suite (one module per process, 2 threads, failing modules rerun with 1) and the xcl-smoke block for 5d7820cf (2358 frames, no device removal, no page fault in the kernel log).

<!-- greyfinch-sync:ivall/xcl:comment:7304940159 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7304940159). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-12-01T08:09:05Z. --- Squashed into one commit, 5d7820cf, which also covers the open points: @Foniass's merge-check: 1. The review fixups are squashed: one commit on `main` 86e86fcb. 2. Why one commit: the description now says it under **Fix**. Without the wait a burst of new textures outruns the spares and faults; without the spares every new placement waits a frame; without the marks a failed Signal lets the wait and the pool count on a mapping nothing covers. The diff is about 455 runtime lines (with comments) and 840 test lines. 3. DXVK's DXGI reporting an NVIDIA GPU as AMD: the gate now takes the vendor of the Vulkan physical device vkd3d-proton drives (through `ID3D12DXVKInteropDevice`) and falls back to the DXGI adapter only when that is not available. Test: Vulkan NVIDIA behind a DXGI AMD stays off, and the reverse is on. 4. The `signal_now` doc comment now sits on `signal_now`. There is no linked issue. @thehollowedone: - Queued mapping work whose Signal failed (7297966755) and the ordering in `before_execute` (7298335865): a mapping whose Signal fails is marked `unmarked`. `before_execute` first runs `release_held_unmaps`, then gets a later mark (`Pages::mark`) and has the title's queue wait for that. If no Signal can be queued, the work does not go. A retired texture whose NULL unmap has no mark stays out of the pool until a later one completes. Test `mappings_whose_signal_failed_get_a_later_mark_before_use` holds the mapping queue behind a test fence and covers a bind, a held unmap that becomes releasable inside `before_execute` with its NULL mapping's Signal failing, the case with no Signal at all, and recycling. - Spares and dump tracking (7299475980): spares are made through `pc_create_reserved_resource`, so they are not in `VOLS` or `RESERVED` while idle; they are registered when handed out. Test `spares_stay_out_of_dump_tracking_until_handed_out` (an idle 3D spare is neither a reserved resource nor a dumped 3D texture, one released from the pool leaves nothing the dump enumerates, and a handed-out one is tracked). - The cold lazy placement (7300154479): `wait_new_placement` now tells a disabled wait from a failed Signal. On failure a retry is queued and waited for; if that fails too, the placement fails the way a failed creation does: nothing is mapped or noted yet, the texture is released and the title gets no resource. Test `a_lazy_placement_without_a_readiness_signal_is_not_handed_out`. Description updated: suite (one module per process, 2 threads, failing modules rerun with 1) and the `xcl-smoke` block for 5d7820cf (2358 frames, no device removal, no page fault in the kernel log).
Aniseto commented 2026-12-01 08:12:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T08:12:31Z.


This is a new response on the same thread as my report at 85c1c599 (https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7304624546); the head moved to 5d7820cf (the four commits squashed into one), so I am not editing that comment.

Ran the vram::tests module at 5d7820cf on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1
82 passed; 0 failed; 1 ignored; 2702 filtered out      (exit 0)

All 82 tests pass at the squashed head, four more than the 78 of my earlier report at 85c1c599. On this Windows NVIDIA host the new behaviour is still gated off by default (it turns on under Wine with an AMD adapter), so this is a no-registration check of the module, not a test of the active path. I did not repeat the wider vram filter here; its earlier 8 failures came from the pre-existing placed_title_textures_share_vram_and_preserve_pixels failure and poisoned-lock cascades.

Not tested: Wine with AMD/RADV (where the change is on by default), the XCL_LIVE_RESERVED=1 forced path on NVIDIA, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data.

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

<!-- greyfinch-sync:ivall/xcl:comment:7305015149 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7305015149). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-12-01T08:12:31Z. --- This is a new response on the same thread as my report at `85c1c599` (https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7304624546); the head moved to `5d7820cf` (the four commits squashed into one), so I am not editing that comment. Ran the `vram::tests` module at `5d7820cf` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, `XCL_ADAPTER=NVIDIA`, detached worktree at the exact PR head, no local patches. ``` XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1 82 passed; 0 failed; 1 ignored; 2702 filtered out (exit 0) ``` All 82 tests pass at the squashed head, four more than the 78 of my earlier report at `85c1c599`. On this Windows NVIDIA host the new behaviour is still gated off by default (it turns on under Wine with an AMD adapter), so this is a no-registration check of the module, not a test of the active path. I did not repeat the wider `vram` filter here; its earlier 8 failures came from the pre-existing `placed_title_textures_share_vram_and_preserve_pixels` failure and poisoned-lock cascades. Not tested: Wine with AMD/RADV (where the change is on by default), the `XCL_LIVE_RESERVED=1` forced path on NVIDIA, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Foniass commented 2026-12-01 09:11:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:11:20Z.


merge-check
base: 7d86c5d2b7
head: 5d7820cf3e
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: re-review (my earlier merge-checks were on 83ed4c7e and 85c1c599); read the whole current diff (vram.rs +1298/-16, ~455 runtime lines and ~840 test lines, title_textures.rs, real.rs, lut3d.rs). The earlier points, mine and thehollowedone's, are addressed in the code. On Windows the live path is off (live_decide short-circuits before any vendor query); the only change there is how a failed Signal is handled. Under Wine on AMD it's on by default. Findings: (1) when vram::before_execute returns false (the mapping's Signal and a retry both failed, with no device removal), refresh_parts returns RetryRequired (title_textures.rs ~2066) and prepare_title_submission ends the title with "sparse upload preparation still failed after bounded retries" (real.rs ~12091-12098): the work is stopped, on every platform, with a message naming the wrong cause, where the description says it's held. Rare, but worth a clearer path. (2) In live mode the PR's own counters show 66,172 spares made for 65,536 placements, so about one CreateReservedResource per placement still runs synchronously on the title's thread (make_spares, ~2827), the cost the pool (#1268) existed to avoid; only frames were measured (92 % of main's). (3) 1,334 lines; the Signal-failure handling applies everywhere and could be its own preparation PR. (4) The PR's CI crash (0xc0000005 in eh::tests, before any vram test) looks like the intermittent #1487; see the run above. The PR's smoke blocks under Wine read 0 MB peak commit, so the 125 % check can't catch anything there. Still no linked issue. Fine: the gate takes the vendor from the Vulkan device behind ID3D12DXVKInteropDevice, the depth clear key reads only 9 bytes, the wait polls without registering an event, spares stay out of RESERVED / VOLS until handed out and are forgotten before Release, the spare reservation is returned through a drop guard on every early exit, and the GPU tests use skip_test.
performance: 60 s smoke of a retail title, main 7d86c5d2 vs this merge (bc3334cd): 1663 -> 1690 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 17153 -> 17335 MB, 0 device removals, 0 crashes. This Windows run takes the Signal-failure change only; the live path is Wine-only.
verdict: not yet: 1,334 changed lines (about 455 of them runtime), with no stated reason it can't be split; the Signal-failure handling, which applies on every platform, could be its own preparation PR. Also, a failed mapping Signal now ends the title with a message that names the wrong cause (finding 1). My earlier blocking points are fixed
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7306339703 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7306339703). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:11:20Z. --- merge-check base: 7d86c5d2b7845695031eeea1327aa81b6c439323 head: 5d7820cf3eae036ecdac57b507bbcd18e101c559 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2909 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: re-review (my earlier merge-checks were on 83ed4c7e and 85c1c599); read the whole current diff (vram.rs +1298/-16, ~455 runtime lines and ~840 test lines, title_textures.rs, real.rs, lut3d.rs). The earlier points, mine and thehollowedone's, are addressed in the code. On Windows the live path is off (`live_decide` short-circuits before any vendor query); the only change there is how a failed Signal is handled. Under Wine on AMD it's on by default. Findings: (1) when `vram::before_execute` returns false (the mapping's Signal and a retry both failed, with no device removal), `refresh_parts` returns RetryRequired (`title_textures.rs` ~2066) and `prepare_title_submission` ends the title with "sparse upload preparation still failed after bounded retries" (`real.rs` ~12091-12098): the work is stopped, on every platform, with a message naming the wrong cause, where the description says it's held. Rare, but worth a clearer path. (2) In live mode the PR's own counters show 66,172 spares made for 65,536 placements, so about one CreateReservedResource per placement still runs synchronously on the title's thread (`make_spares`, ~2827), the cost the pool (#1268) existed to avoid; only frames were measured (92 % of main's). (3) 1,334 lines; the Signal-failure handling applies everywhere and could be its own preparation PR. (4) The PR's CI crash (0xc0000005 in `eh::tests`, before any vram test) looks like the intermittent #1487; see the run above. The PR's smoke blocks under Wine read 0 MB peak commit, so the 125 % check can't catch anything there. Still no linked issue. Fine: the gate takes the vendor from the Vulkan device behind `ID3D12DXVKInteropDevice`, the depth clear key reads only 9 bytes, the wait polls without registering an event, spares stay out of `RESERVED` / `VOLS` until handed out and are forgotten before Release, the spare reservation is returned through a drop guard on every early exit, and the GPU tests use `skip_test`. performance: 60 s smoke of a retail title, main 7d86c5d2 vs this merge (bc3334cd): 1663 -> 1690 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 17153 -> 17335 MB, 0 device removals, 0 crashes. This Windows run takes the Signal-failure change only; the live path is Wine-only. verdict: not yet: 1,334 changed lines (about 455 of them runtime), with no stated reason it can't be split; the Signal-failure handling, which applies on every platform, could be its own preparation PR. Also, a failed mapping Signal now ends the title with a message that names the wrong cause (finding 1). My earlier blocking points are fixed hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
lucsoft commented 2026-12-01 09:49:00 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T09:49:00Z.


Thanks. All four points of 7306339703 are addressed; the new head is db57f30c:

  1. The wrong stop message. When the mapping's Signal and its retry both fail without a device removal, refresh_parts now returns a separate PreparationOutcome::MappingUnmarked. The title stops with "a texture page mapping has no Signal of the mapping queue (its own and a retry failed)", and the wait-inside-a-submit path names the same cause. The description now says the title stops instead of "held". It stays fail-closed, like the other preparation failures: the D3D12 submit is void, so there is nothing to retry later.
  2. The spares on the title's thread. The log line now measures it. In the retail run on this head, 66126 spares were made in 2071 ms over 130 s (31 µs each on average, longest call 10 ms), about 1.6 % of one thread. The waits of new placements are on top (5.3 s over 125 s, longest 102 ms). Numbers and frames (90 % of main's in that run) are in the description.
  3. The split. The Signal-failure handling, which applies on every platform, is its own PR now: #3566 (69700342, on main 86e86fcb, about 290 lines with its tests). This PR is stacked on it: the first commit is #3566, and its own commit db57f30c is the Wine-on-AMD part (about 1100 lines: about 380 runtime with comments in vram.rs, about 690 tests, the rest test hooks in real.rs and lut3d.rs).
  4. #1487. Agreed, the Windows crash is the intermittent one (the same 0xc0000005 hit an unrelated PR 15 minutes earlier). Still no linked issue.

Suite and xcl-smoke blocks are in both descriptions for their exact heads.

<!-- greyfinch-sync:ivall/xcl:comment:7307248268 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7307248268). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-12-01T09:49:00Z. --- Thanks. All four points of 7306339703 are addressed; the new head is db57f30c: 1. **The wrong stop message.** When the mapping's Signal and its retry both fail without a device removal, `refresh_parts` now returns a separate `PreparationOutcome::MappingUnmarked`. The title stops with "a texture page mapping has no Signal of the mapping queue (its own and a retry failed)", and the wait-inside-a-submit path names the same cause. The description now says the title stops instead of "held". It stays fail-closed, like the other preparation failures: the D3D12 submit is void, so there is nothing to retry later. 2. **The spares on the title's thread.** The log line now measures it. In the retail run on this head, 66126 spares were made in 2071 ms over 130 s (31 µs each on average, longest call 10 ms), about 1.6 % of one thread. The waits of new placements are on top (5.3 s over 125 s, longest 102 ms). Numbers and frames (90 % of `main`'s in that run) are in the description. 3. **The split.** The Signal-failure handling, which applies on every platform, is its own PR now: #3566 (69700342, on `main` 86e86fcb, about 290 lines with its tests). This PR is stacked on it: the first commit is #3566, and its own commit db57f30c is the Wine-on-AMD part (about 1100 lines: about 380 runtime with comments in `vram.rs`, about 690 tests, the rest test hooks in `real.rs` and `lut3d.rs`). 4. **#1487.** Agreed, the Windows crash is the intermittent one (the same 0xc0000005 hit an unrelated PR 15 minutes earlier). Still no linked issue. Suite and `xcl-smoke` blocks are in both descriptions for their exact heads.
Foniass commented 2026-12-01 09:55:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:55:27Z.


Re-review (head db57f30c; range-diff from 5d7820cf, which I merge-checked, read). Not a new merge-check: this head is stacked on #3566, which is still a draft.

  • Both blockers from my merge-check are answered. The Signal-failure handling, the part that applies on every platform, is now #3566, the first commit here, which I reviewed separately. With it, a failed mapping Signal no longer ends the title with the misleading "bounded retries" message. The commit message now says why the rest is one change: the wait, the spares and the marks only work together.

  • Size. This PR's own commit is still +1097 / -7, about 1,077 of it in vram.rs and mostly tests. With the reason now stated, that is for the maintainer to accept.

  • New since 5d7820cf:

    • a spare whose Signal fails is released, not pooled;
    • a new texture whose readiness Signal can't be queued fails as a failed creation does;
    • spares are kept out of dump tracking (lut3d.rs);
    • the log now reports the time spent making spares on the placing threads, which answers my finding about synchronous CreateReservedResource calls with a number per run.

    The new tests cover the failing-Signal spare and a cold lazy placement.

Once #3566 is out of draft and merged, a suite run and smoke pair of this commit on main would make it ready. On Windows the live path stays off, so the default path there is unchanged.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7307406099 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7307406099). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T09:55:27Z. --- Re-review (head db57f30c; range-diff from 5d7820cf, which I merge-checked, read). Not a new merge-check: this head is stacked on #3566, which is still a draft. - **Both blockers from my merge-check are answered.** The Signal-failure handling, the part that applies on every platform, is now #3566, the first commit here, which I reviewed separately. With it, a failed mapping Signal no longer ends the title with the misleading "bounded retries" message. The commit message now says why the rest is one change: the wait, the spares and the marks only work together. - **Size.** This PR's own commit is still +1097 / -7, about 1,077 of it in `vram.rs` and mostly tests. With the reason now stated, that is for the maintainer to accept. - **New since 5d7820cf:** - a spare whose Signal fails is released, not pooled; - a new texture whose readiness Signal can't be queued fails as a failed creation does; - spares are kept out of dump tracking (`lut3d.rs`); - the log now reports the time spent making spares on the placing threads, which answers my finding about synchronous `CreateReservedResource` calls with a number per run. The new tests cover the failing-Signal spare and a cold lazy placement. Once #3566 is out of draft and merged, a suite run and smoke pair of this commit on main would make it ready. On Windows the live path stays off, so the default path there is unchanged. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Aniseto commented 2026-12-01 10:01:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T10:01:10Z.


This is a new response on the same thread as my report at 5d7820cf (https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7305015149); the head moved to db57f30c (now stacked on #3566), so I am not editing that comment.

Ran the vram::tests module at db57f30c on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1
83 passed; 0 failed; 1 ignored; 2702 filtered out      (exit 0)

All 83 tests pass at the stacked head, one more than the 82 of my previous report. The new behaviour remains gated off by default on Windows NVIDIA, so this is a no-registration check of the module, not a test of the Wine/AMD path.

Not tested: Wine with AMD/RADV (where the change is on by default), the XCL_LIVE_RESERVED=1 forced path on NVIDIA, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data.

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

<!-- greyfinch-sync:ivall/xcl:comment:7307545847 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7307545847). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-12-01T10:01:10Z. --- This is a new response on the same thread as my report at `5d7820cf` (https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7305015149); the head moved to `db57f30c` (now stacked on #3566), so I am not editing that comment. Ran the `vram::tests` module at `db57f30c` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, `XCL_ADAPTER=NVIDIA`, detached worktree at the exact PR head, no local patches. ``` XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1 83 passed; 0 failed; 1 ignored; 2702 filtered out (exit 0) ``` All 83 tests pass at the stacked head, one more than the 82 of my previous report. The new behaviour remains gated off by default on Windows NVIDIA, so this is a no-registration check of the module, not a test of the Wine/AMD path. Not tested: Wine with AMD/RADV (where the change is on by default), the `XCL_LIVE_RESERVED=1` forced path on NVIDIA, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Foniass commented 2026-12-01 10:13:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T10:13:30Z.


Triage (#1607) – head db57f30

Stacked on #3566: its first commit (69700342) is #3566, and that is where the 153 shared added lines come from. Not a duplicate. This PR's own commit, db57f30c, adds the live reserved-texture pool, spares made ahead, and the wait for new placements in vram.rs. It is gated to Wine on AMD (live_decide) or XCL_LIVE_RESERVED.
#3124 touches the same spot in place_on_pages but solves a different problem (a NULL mapping for an NVIDIA removal).
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7307859968 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7307859968). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T10:13:30Z. --- **Triage (#1607)** – head db57f30 Stacked on #3566: its first commit (69700342) is #3566, and that is where the 153 shared added lines come from. Not a duplicate. This PR's own commit, db57f30c, adds the live reserved-texture pool, spares made ahead, and the wait for new placements in `vram.rs`. It is gated to Wine on AMD (`live_decide`) or `XCL_LIVE_RESERVED`. #3124 touches the same spot in `place_on_pages` but solves a different problem (a NULL mapping for an NVIDIA removal). No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
lucsoft commented 2026-12-01 10:49:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by lucsoft on 2026-12-01T10:49:55Z.


The Windows CI job on db57f30c ran into its 45-minute timeout: with 4 test threads, several vram::tests never finished. Cause: there is one D3D12 device per adapter, so every test shares its mapping queue, and this PR's tests hold that queue behind a test fence; a test placing textures meanwhile without VRAM_TEST_LOCK waited behind it (a deadlock on WARP; on RADV it showed as a wait counter off by one). ee13d5ad changes only tests: every fence that holds the mapping queue gets a watchdog that opens it after 10 s at the latest (so a race can fail a test but never hang the job), and reserved_resource_with_private_data_is_excluded_from_recycle takes the lock. vram:: with 4 threads: 5 of 5 clean here (0 of 3 before). #3566 is unchanged (69700342; its CI is green). New xcl-smoke block in the description (2700 frames, no page fault).

<!-- greyfinch-sync:ivall/xcl:comment:7308791444 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7308791444). Originally posted by [lucsoft](https://github.com/lucsoft) on 2026-12-01T10:49:55Z. --- The Windows CI job on db57f30c ran into its 45-minute timeout: with 4 test threads, several `vram::tests` never finished. Cause: there is one D3D12 device per adapter, so every test shares its mapping queue, and this PR's tests hold that queue behind a test fence; a test placing textures meanwhile without `VRAM_TEST_LOCK` waited behind it (a deadlock on WARP; on RADV it showed as a wait counter off by one). ee13d5ad changes only tests: every fence that holds the mapping queue gets a watchdog that opens it after 10 s at the latest (so a race can fail a test but never hang the job), and `reserved_resource_with_private_data_is_excluded_from_recycle` takes the lock. `vram::` with 4 threads: 5 of 5 clean here (0 of 3 before). #3566 is unchanged (69700342; its CI is green). New `xcl-smoke` block in the description (2700 frames, no page fault).
Aniseto commented 2026-12-01 10:59:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T10:59:42Z.


This is a new response on the same thread as my report at db57f30c (https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7307545847); the head moved to ee13d5ad, so I am not editing that comment.

Ran the vram::tests module at ee13d5ad on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1
83 passed; 0 failed; 1 ignored; 2702 filtered out      (exit 0)

All 83 tests pass at this head, the same count as at db57f30c. The new behaviour remains gated off by default on Windows NVIDIA, so this is a no-registration check of the module, not a test of the Wine/AMD path.

Not tested: Wine with AMD/RADV (where the change is on by default), the XCL_LIVE_RESERVED=1 forced path on NVIDIA, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data.

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

<!-- greyfinch-sync:ivall/xcl:comment:7309017667 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7309017667). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-12-01T10:59:42Z. --- This is a new response on the same thread as my report at `db57f30c` (https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7307545847); the head moved to `ee13d5ad`, so I am not editing that comment. Ran the `vram::tests` module at `ee13d5ad` on an NVIDIA Blackwell desktop part with 16 GB of VRAM. Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build, `XCL_ADAPTER=NVIDIA`, detached worktree at the exact PR head, no local patches. ``` XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib vram::tests -- --test-threads=1 83 passed; 0 failed; 1 ignored; 2702 filtered out (exit 0) ``` All 83 tests pass at this head, the same count as at `db57f30c`. The new behaviour remains gated off by default on Windows NVIDIA, so this is a no-registration check of the module, not a test of the Wine/AMD path. Not tested: Wine with AMD/RADV (where the change is on by default), the `XCL_LIVE_RESERVED=1` forced path on NVIDIA, the full workspace suite, a title run, native wave64 hosts, Intel GPUs, release profile, game data. AI-assisted (OpenCode), model: **MiMo-V2.6-Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Foniass commented 2026-12-01 14:23:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T14:23:16Z.


merge-check
base: b2b1f109d2
head: ee13d5ada0
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2916 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: re-check of this head (ee13d5ad, stacked on #3566); my earlier merge-check (5d7820cf) and re-reviews (db57f30c, then test-only hardening) have the details. The PR's own commit hands the title reserved textures with live page tables, on by default only under Wine with an AMD GPU (judged by the Vulkan device behind vkd3d-proton), so on Windows the default path is unchanged; XCL_LIVE_RESERVED=1/0 forces it. My earlier blockers are answered: the Signal-failure handling is now #3566 underneath, with a correct stop reason, and the commit message says why the rest is one change (the wait, the spares and the marks only work together). Since then: a spare whose Signal fails is released, not pooled; a new texture whose readiness Signal can't be queued fails as a failed creation does; spares are kept out of dump tracking; and the log reports the time spent making spares on the placing threads. Still large (+1,097 of its own, mostly vram.rs tests), with the reason stated. Fine: spares stay out of RESERVED / VOLS until handed out and are forgotten before Release, the spare reservation is returned through a drop guard on every early exit, and the GPU tests use skip_test. The smoke run below covers Windows' default path, where the live path is off.
performance: 60 s smoke of a retail title, main b2b1f109 vs this merge (c8d15eee): 1671 -> 1624 frames shown (97 %; last presents per 2 s: 61 60 60), peak commit 17394 -> 19144 MB, 0 device removals, 0 crashes. On Windows the live path is off, so this measures #3566's Signal-failure handling and the unchanged default path. Peak commit is 11.5 % above main in this one run, within the 125 % limit; my earlier smoke of this PR (5d7820cf) was 17335 MB and other runs today varied by 1-2 GB between runs of the same merge, so I read it as run-to-run variation.
verdict: safe to merge once #3566 below it carries the test watchdog (this head's copy of mappings_whose_signal_failed_get_a_later_mark_before_use has open_at_the_latest and passed here; #3566's own head hangs on it, see my comment there)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7314167708 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7314167708). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T14:23:16Z. --- merge-check base: b2b1f109d27e746a62ec95b04dd1f9924452e682 head: ee13d5ada0b55f7348f4da27cd514936c9839e2f merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2916 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: re-check of this head (ee13d5ad, stacked on #3566); my earlier merge-check (5d7820cf) and re-reviews (db57f30c, then test-only hardening) have the details. The PR's own commit hands the title reserved textures with live page tables, on by default only under Wine with an AMD GPU (judged by the Vulkan device behind vkd3d-proton), so on Windows the default path is unchanged; `XCL_LIVE_RESERVED=1/0` forces it. My earlier blockers are answered: the Signal-failure handling is now #3566 underneath, with a correct stop reason, and the commit message says why the rest is one change (the wait, the spares and the marks only work together). Since then: a spare whose Signal fails is released, not pooled; a new texture whose readiness Signal can't be queued fails as a failed creation does; spares are kept out of dump tracking; and the log reports the time spent making spares on the placing threads. Still large (+1,097 of its own, mostly `vram.rs` tests), with the reason stated. Fine: spares stay out of `RESERVED` / `VOLS` until handed out and are forgotten before Release, the spare reservation is returned through a drop guard on every early exit, and the GPU tests use `skip_test`. The smoke run below covers Windows' default path, where the live path is off. performance: 60 s smoke of a retail title, main b2b1f109 vs this merge (c8d15eee): 1671 -> 1624 frames shown (97 %; last presents per 2 s: 61 60 60), peak commit 17394 -> 19144 MB, 0 device removals, 0 crashes. On Windows the live path is off, so this measures #3566's Signal-failure handling and the unchanged default path. Peak commit is 11.5 % above main in this one run, within the 125 % limit; my earlier smoke of this PR (5d7820cf) was 17335 MB and other runs today varied by 1-2 GB between runs of the same merge, so I read it as run-to-run variation. verdict: safe to merge once #3566 below it carries the test watchdog (this head's copy of `mappings_whose_signal_failed_get_a_later_mark_before_use` has `open_at_the_latest` and passed here; #3566's own head hangs on it, see my comment there) hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
capy-ai[bot] commented 2026-12-01 15:07:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by capy-ai[bot] on 2026-12-01T15:07:25Z.


Review of head ee13d5ad (not a full merge-check: no test suite or title run on this machine)

  • Merged onto main b2b1f109: clean, git diff --check clean. Also clean together with #3536.
  • cargo check --workspace --all-targets --target x86_64-pc-windows-gnu: ok for this merge and for #3566 alone, with the same warning count as main.
  • I read both commits, and the runtime change looks right to me:
    • live is decided once per device and stays off on Windows (live_decide returns before any vendor query).
    • The spare reservation is given back on every early exit.
    • Spares get their mark from a Signal sent after they were created, and are released when that Signal fails.
    • wait_new_placement polls without registering an event and does not hold PAGES while it waits.

Blocking: the first commit, 69700342 (#3566 as it stands), lands with a test that can hang the suite. mappings_whose_signal_failed_get_a_later_mark_before_use installs its own Pages for the shared device and holds its mapping queue behind gate fences. reserved_resource_with_private_data_is_excluded_from_recycle places textures on that device without VRAM_TEST_LOCK. When the two overlap, or any assert fails between mq.Wait and the gate's Signal, the queue never reopens and the test process cannot exit. That is the mechanism described in https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7308791444, and the hang Foniass hit on #3566 in https://github.com/xcl-dev/xcl/pull/3566#issuecomment-7313134336. The fix (open_at_the_latest on the three gates, plus the lock) exists only in ee13d5ad. Merged as it is, the hanging version goes into history and #3566 closes along with it.

What would unblock it: move open_at_the_latest and the VRAM_TEST_LOCK line into #3566's commit, rebase this PR onto it, then merge #3566 and this PR in that order. With that change, this is ready from my side: Foniass's run of the merged tree passed the full Windows/NVIDIA suite with 0 failures.

Not blocking:

  • The size: about 1,100 lines of its own, mostly tests, and the reason is given.
  • The cost on Wine/AMD only: about 1.6 % of a thread making spares, plus waits of up to about 190 ms per new texture (both from the description).

Hardware: Linux x86_64 cloud machine, no GPU. The crate was type-checked only, not built for or run on Windows.
AI use: Capy (Claude Opus 5.5) did the merge, the type-check and the diff review, and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7315382267 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7315382267). Originally posted by [capy-ai[bot]](https://github.com/apps/capy-ai) on 2026-12-01T15:07:25Z. --- Review of head ee13d5ad (not a full merge-check: no test suite or title run on this machine) - Merged onto `main` b2b1f109: clean, `git diff --check` clean. Also clean together with #3536. - `cargo check --workspace --all-targets --target x86_64-pc-windows-gnu`: ok for this merge and for #3566 alone, with the same warning count as `main`. - I read both commits, and the runtime change looks right to me: - `live` is decided once per device and stays off on Windows (`live_decide` returns before any vendor query). - The spare reservation is given back on every early exit. - Spares get their mark from a Signal sent after they were created, and are released when that Signal fails. - `wait_new_placement` polls without registering an event and does not hold `PAGES` while it waits. **Blocking: the first commit, 69700342 (#3566 as it stands), lands with a test that can hang the suite.** `mappings_whose_signal_failed_get_a_later_mark_before_use` installs its own `Pages` for the shared device and holds its mapping queue behind gate fences. `reserved_resource_with_private_data_is_excluded_from_recycle` places textures on that device without `VRAM_TEST_LOCK`. When the two overlap, or any assert fails between `mq.Wait` and the gate's Signal, the queue never reopens and the test process cannot exit. That is the mechanism described in https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7308791444, and the hang Foniass hit on #3566 in https://github.com/xcl-dev/xcl/pull/3566#issuecomment-7313134336. The fix (`open_at_the_latest` on the three gates, plus the lock) exists only in ee13d5ad. Merged as it is, the hanging version goes into history and #3566 closes along with it. What would unblock it: move `open_at_the_latest` and the `VRAM_TEST_LOCK` line into #3566's commit, rebase this PR onto it, then merge #3566 and this PR in that order. With that change, this is ready from my side: Foniass's run of the merged tree passed the full Windows/NVIDIA suite with 0 failures. Not blocking: - The size: about 1,100 lines of its own, mostly tests, and the reason is given. - The cost on Wine/AMD only: about 1.6 % of a thread making spares, plus waits of up to about 190 ms per new texture (both from the description). Hardware: Linux x86_64 cloud machine, no GPU. The crate was type-checked only, not built for or run on Windows. AI use: Capy (Claude Opus 5.5) did the merge, the type-check and the diff review, and wrote this comment.
Foniass commented 2026-12-01 20:55:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:55:31Z.


Test report (not a merge-check: PR description red: its smoke block is for an older head)
base: 6bfb5c5153
head: 18547df7c5
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2918 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: follow-up on 18547df7 (rebased from ee13d5ad, the head of my merge-check above; stacked on #3566 at f5a57437). The PR's own commit was only rebased, apart from two hunks dropped because #3566 now carries them: the VRAM_TEST_LOCK guard in reserved_resource_with_private_data_is_excluded_from_recycle, and its three open_at_the_latest(&gate*) calls in #3566's failed-Signal test, which now uses #3566's Gate. The commit message is the same (1,117 insertions against 1,121 before). Nit: the PR's own tests still use open_at_the_latest (vram.rs ~6240, ~6312, ~6419), so the module now has two watchdogs for held mapping queues; its doc comment (~6805) still says it exists for "a shared device's mapping queue" though the remaining callers hold private Pages::new queues, and when it fires it doesn't fail the test, unlike #3566's Gate. It can't hang the process, so it doesn't block. Fine: the rebased commit sits on f5a57437 without duplicated code and merges cleanly into current main; the Gate / AtomicU8 / mpsc imports don't clash; the lock order is the same in both (VRAM_TEST_LOCK, then RECYCLE_DRAIN_TEST_LOCK, then PAGES), and the PR adds no drain_recycled call outside tests. The Windows default path is unchanged: live_decide is still on by default only when under_wine() is true and the Vulkan vendor is 0x1002, with XCL_LIVE_RESERVED forcing it either way.
performance: 60 s smoke of a retail title, main 6bfb5c51 vs this merge (8125b27e): 1646 -> 1663 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 18685 -> 18384 MB, 0 device removals, 0 crashes. The first run of this merge lost the lib test binary to the known uma_driver coherent-window abort; this is the rerun. On Windows the live path is off by default, so the smoke run covers the default path only.
assessment: merges, builds and passes the whole suite on current main at 18547df7 (with #3566's f5a57437 underneath, whose test no longer hangs), and the smoke run is clean; the PR's own commit was only rebased. What remains for a merge-check is the description's smoke block on this head, and #3566 below it landing first
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7325479415 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7325479415). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T20:55:31Z. --- Test report (not a merge-check: `PR description` red: its smoke block is for an older head) base: 6bfb5c5153ccc23517daf30aa1071ddb0fadb53c head: 18547df7c5f1fbc1baada66dd252d73799afc5a7 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2918 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: follow-up on 18547df7 (rebased from ee13d5ad, the head of my merge-check above; stacked on #3566 at f5a57437). The PR's own commit was only rebased, apart from two hunks dropped because #3566 now carries them: the `VRAM_TEST_LOCK` guard in `reserved_resource_with_private_data_is_excluded_from_recycle`, and its three `open_at_the_latest(&gate*)` calls in #3566's failed-Signal test, which now uses #3566's `Gate`. The commit message is the same (1,117 insertions against 1,121 before). Nit: the PR's own tests still use `open_at_the_latest` (`vram.rs` ~6240, ~6312, ~6419), so the module now has two watchdogs for held mapping queues; its doc comment (~6805) still says it exists for "a shared device's mapping queue" though the remaining callers hold private `Pages::new` queues, and when it fires it doesn't fail the test, unlike #3566's `Gate`. It can't hang the process, so it doesn't block. Fine: the rebased commit sits on f5a57437 without duplicated code and merges cleanly into current main; the `Gate` / `AtomicU8` / `mpsc` imports don't clash; the lock order is the same in both (`VRAM_TEST_LOCK`, then `RECYCLE_DRAIN_TEST_LOCK`, then `PAGES`), and the PR adds no `drain_recycled` call outside tests. The Windows default path is unchanged: `live_decide` is still on by default only when `under_wine()` is true and the Vulkan vendor is 0x1002, with `XCL_LIVE_RESERVED` forcing it either way. performance: 60 s smoke of a retail title, main 6bfb5c51 vs this merge (8125b27e): 1646 -> 1663 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 18685 -> 18384 MB, 0 device removals, 0 crashes. The first run of this merge lost the lib test binary to the known `uma_driver` coherent-window abort; this is the rerun. On Windows the live path is off by default, so the smoke run covers the default path only. assessment: merges, builds and passes the whole suite on current main at 18547df7 (with #3566's f5a57437 underneath, whose test no longer hangs), and the smoke run is clean; the PR's own commit was only rebased. What remains for a merge-check is the description's smoke block on this head, and #3566 below it landing first hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 22:34:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T22:34:36Z.


merge-check
base: f07e426dad
head: 5800b721b3
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2918 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: re-check of 5800b721, stacked on #3566 at 94b0d761. Since my test report on 18547df7 the PR's own commit is unchanged (git range-diff: =); only #3566's new commit 94b0d761 came in underneath (reviewed on #3566). Against ee13d5ad, the own commit was only rebased, apart from two hunks dropped because #3566 now carries them: the VRAM_TEST_LOCK guard in reserved_resource_with_private_data_is_excluded_from_recycle, and its three open_at_the_latest(&gate*) calls in #3566's failed-Signal test, which now uses #3566's Gate. The commit message is the same (1,117 insertions against 1,121 before). Nit: the PR's own tests still use open_at_the_latest (vram.rs ~6240, ~6312, ~6419), so the module now has two watchdogs for held mapping queues; its doc comment (~6805) still says it exists for "a shared device's mapping queue" though the remaining callers hold private Pages::new queues, and when it fires it doesn't fail the test, unlike #3566's Gate. It can't hang the process, so it doesn't block. Fine: the rebased commit sits on f5a57437 without duplicated code and merges cleanly into current main; the Gate / AtomicU8 / mpsc imports don't clash; the lock order is the same in both (VRAM_TEST_LOCK, then RECYCLE_DRAIN_TEST_LOCK, then PAGES), and the PR adds no drain_recycled call outside tests. The Windows default path is unchanged: live_decide is still on by default only when under_wine() is true and the Vulkan vendor is 0x1002, with XCL_LIVE_RESERVED forcing it either way.
performance: 60 s smoke of a retail title, main f07e426d vs this merge (5fd0b6ce): 1672 -> 1658 frames shown (99 %; last presents per 2 s: 60 60 60), peak commit 17352 -> 18865 MB, 0 device removals, 0 crashes. On Windows the live path is off by default, so the smoke run covers the default path only.
verdict: safe to merge once #3566 below it is merged: the PR's own commit is unchanged since my last review, the merge passes the whole suite and the smoke run is clean; on Windows the live path is off by default, so the run covers the default path, and the remaining nit (two test watchdogs) doesn't block
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7328046651 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#issuecomment-7328046651). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T22:34:36Z. --- merge-check base: f07e426dade72aa7112cf6bfe08ca6f6ff5a9d5c head: 5800b721b3c7ae0e1fe80afa5bb4b86777c8a959 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2918 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: re-check of 5800b721, stacked on #3566 at 94b0d761. Since my test report on 18547df7 the PR's own commit is unchanged (`git range-diff`: `=`); only #3566's new commit 94b0d761 came in underneath (reviewed on #3566). Against ee13d5ad, the own commit was only rebased, apart from two hunks dropped because #3566 now carries them: the `VRAM_TEST_LOCK` guard in `reserved_resource_with_private_data_is_excluded_from_recycle`, and its three `open_at_the_latest(&gate*)` calls in #3566's failed-Signal test, which now uses #3566's `Gate`. The commit message is the same (1,117 insertions against 1,121 before). Nit: the PR's own tests still use `open_at_the_latest` (`vram.rs` ~6240, ~6312, ~6419), so the module now has two watchdogs for held mapping queues; its doc comment (~6805) still says it exists for "a shared device's mapping queue" though the remaining callers hold private `Pages::new` queues, and when it fires it doesn't fail the test, unlike #3566's `Gate`. It can't hang the process, so it doesn't block. Fine: the rebased commit sits on f5a57437 without duplicated code and merges cleanly into current main; the `Gate` / `AtomicU8` / `mpsc` imports don't clash; the lock order is the same in both (`VRAM_TEST_LOCK`, then `RECYCLE_DRAIN_TEST_LOCK`, then `PAGES`), and the PR adds no `drain_recycled` call outside tests. The Windows default path is unchanged: `live_decide` is still on by default only when `under_wine()` is true and the Vulkan vendor is 0x1002, with `XCL_LIVE_RESERVED` forcing it either way. performance: 60 s smoke of a retail title, main f07e426d vs this merge (5fd0b6ce): 1672 -> 1658 frames shown (99 %; last presents per 2 s: 60 60 60), peak commit 17352 -> 18865 MB, 0 device removals, 0 crashes. On Windows the live path is off by default, so the smoke run covers the default path only. verdict: safe to merge once #3566 below it is merged: the PR's own commit is unchanged since my last review, the merge passes the whole suite and the smoke run is clean; on Windows the live path is off by default, so the run covers the default path, and the remaining nit (two test watchdogs) doesn't block hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
bmjask commented 2026-12-02 14:06:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:06:38Z.

Review: COMMENTED


Review of 5800b721: 2 finding(s) (1 high, 1 medium), most severe first.

  1. High crates/xcl/src/hle/d3d12x/vram.rs:2794: When wait_new_placement times out (FenceWait::TimedOut), the new texture is placed and returned anyway, so the fault this PR fixes can still happen, and each new placement can block the title thread for the full XCL_PLACE_MAP_WAIT_MS. (inline)
  2. Medium crates/xcl/src/hle/d3d12x/vram.rs:2188: Not certain about this one: live_reserved_for runs inside Pages::new, called from or_insert_with while the global PAGES mutex is held. (inline)

These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6152379056 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#pullrequestreview-6152379056). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:06:38Z. **Review:** COMMENTED --- Review of `5800b721`: 2 finding(s) (1 high, 1 medium), most severe first. 1. **High** `crates/xcl/src/hle/d3d12x/vram.rs:2794`: When `wait_new_placement` times out (FenceWait::TimedOut), the new texture is placed and returned anyway, so the fault this PR fixes can still happen, and each new placement can block the title thread for the full XCL_PLACE_MAP_WAIT_MS. (inline) 2. **Medium** `crates/xcl/src/hle/d3d12x/vram.rs:2188`: Not certain about this one: `live_reserved_for` runs inside `Pages::new`, called from `or_insert_with` while the global PAGES mutex is held. (inline) --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
bmjask commented 2026-12-02 14:06:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:06:39Z.

Code review location: crates/xcl/src/hle/d3d12x/vram.rs; line 2794

@@ -2367,6 +2787,16 @@ unsafe fn place_on_pages(
         None
     };
     let texels = (!require_aligned && super::memory_report::enabled()).then(|| TexelMeta::from_desc(desc, levels.is_none()));
+    // (no live one in the pool: wait until its VA has page-table entries, before the pages know
+    // it. A texture with lazy levels queues no mapping here, so that Signal is all that tells;
+    // when none can be queued the placement fails as a failed creation does: nothing is mapped
+    // or noted yet, and the spare reservation goes back with `reservation`.)
+    if cached_total.is_none() && live && wait_new_placement(dev_key) == NewWait::Failed {

High: When wait_new_placement times out (FenceWait::TimedOut), the new texture is placed and returned anyway, so the fault this PR fixes can still happen, and each new placement can block the title thread for the full XCL_PLACE_MAP_WAIT_MS. If a GPU frame (loading screen, heavy compute) runs past 1000 ms, every new reserved texture placed meanwhile waits 1 s on the placing thread and is then handed out with no PTEs. The title writes its descriptor into memory the in-flight work reads, which is the amdgpu page fault and DXGI_ERROR_DEVICE_REMOVED. N new textures in that window stall the title N seconds. On timeout, handing out a spare (or keeping the texture back until its page tables are live) would avoid both.

<!-- greyfinch-sync:ivall/xcl:review-comment:4770793235 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#discussion_r4770793235). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:06:39Z. **Code review location:** `crates/xcl/src/hle/d3d12x/vram.rs`; line 2794 ~~~~diff @@ -2367,6 +2787,16 @@ unsafe fn place_on_pages( None }; let texels = (!require_aligned && super::memory_report::enabled()).then(|| TexelMeta::from_desc(desc, levels.is_none())); + // (no live one in the pool: wait until its VA has page-table entries, before the pages know + // it. A texture with lazy levels queues no mapping here, so that Signal is all that tells; + // when none can be queued the placement fails as a failed creation does: nothing is mapped + // or noted yet, and the spare reservation goes back with `reservation`.) + if cached_total.is_none() && live && wait_new_placement(dev_key) == NewWait::Failed { ~~~~ --- **High**: When `wait_new_placement` times out (FenceWait::TimedOut), the new texture is placed and returned anyway, so the fault this PR fixes can still happen, and each new placement can block the title thread for the full XCL_PLACE_MAP_WAIT_MS. If a GPU frame (loading screen, heavy compute) runs past 1000 ms, every new reserved texture placed meanwhile waits 1 s on the placing thread and is then handed out with no PTEs. The title writes its descriptor into memory the in-flight work reads, which is the amdgpu page fault and DXGI_ERROR_DEVICE_REMOVED. N new textures in that window stall the title N seconds. On timeout, handing out a spare (or keeping the texture back until its page tables are live) would avoid both.
bmjask commented 2026-12-02 14:06:39 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:06:39Z.

Code review location: crates/xcl/src/hle/d3d12x/vram.rs; line 2188

@@ -1854,6 +2185,9 @@ impl Pages {
             unmap_fences: std::collections::HashMap::new(),
             held_unmaps: Vec::new(),
             reservable_cache: std::collections::HashMap::new(),
+            live: live_reserved_for(dev),

Medium: Not certain about this one: live_reserved_for runs inside Pages::new, called from or_insert_with while the global PAGES mutex is held. It does QueryInterface for the vkd3d interop, GetModuleHandle/LoadLibraryA of vulkan-1.dll, and possibly CreateDXGIFactory1 plus EnumAdapterByLuid. On the first placement under Wine, when the interop lookup fails, a DXGI factory is created (DXVK builds a VkInstance, tens of ms) or a DLL is loaded under PAGES.lock(). Every other streaming thread, before_execute and drain_recycled block meanwhile, and the loader lock is taken while holding an application mutex, a lock-order risk with any DllMain that calls back into XCL. Computing the decision once per device before taking the lock would avoid it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4770793250 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3553#discussion_r4770793250). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T14:06:39Z. **Code review location:** `crates/xcl/src/hle/d3d12x/vram.rs`; line 2188 ~~~~diff @@ -1854,6 +2185,9 @@ impl Pages { unmap_fences: std::collections::HashMap::new(), held_unmaps: Vec::new(), reservable_cache: std::collections::HashMap::new(), + live: live_reserved_for(dev), ~~~~ --- **Medium**: Not certain about this one: `live_reserved_for` runs inside `Pages::new`, called from `or_insert_with` while the global PAGES mutex is held. It does QueryInterface for the vkd3d interop, GetModuleHandle/LoadLibraryA of vulkan-1.dll, and possibly CreateDXGIFactory1 plus EnumAdapterByLuid. On the first placement under Wine, when the interop lookup fails, a DXGI factory is created (DXVK builds a VkInstance, tens of ms) or a DLL is loaded under PAGES.lock(). Every other streaming thread, before_execute and drain_recycled block meanwhile, and the loader lock is taken while holding an application mutex, a lock-order risk with any DllMain that calls back into XCL. Computing the decision once per device before taking the lock would avoid it.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3553
No description provided.