Skip to content

D3D12.X: gate texture uploads on OOM back-off and commit headroom (XCL_UPLOAD_BACKOFF=1) - #3037

Open
Decodere wants to merge 2 commits into
xcl-dev:mainfrom
Decodere:feat/c5-upload-backoff
Open

Decodere wants to merge 2 commits into
xcl-dev:mainfrom
Decodere:feat/c5-upload-backoff

Conversation

@Decodere

@Decodere Decodere commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What is in it

Ports the C5 OOM back-off and commit-headroom upload admission gate from Vice-Tay commit 57deba5c4c752b97a8286bdbd80b96517f0988fc (crates/victory-gpu/src/residency.rs, GPL-3.0; credit to TaynanGT, codec_d (codec-d), avatarmanz/VIctory-7900XTX, and VIctory contributors) onto nvidia-dev behind an opt-in environment variable XCL_UPLOAD_BACKOFF=1 (default OFF).

  • New module crates/xcl/src/hle/d3d12x/residency.rs (with GPL-3.0 §5a modification notice and matching Vice-Tay provenance row in THIRD_PARTY.md):
    • Opt-in toggle XCL_UPLOAD_BACKOFF=1 (default OFF; disabled path is a complete no-op with zero extra syscalls or log output).
    • 500 ms E_OUTOFMEMORY upload cooldown (UPLOAD_RETRY_MS = 500), armed by residency::allocation_error(hr).
    • 32 ms cached GlobalMemoryStatusEx available-commit sampling (COMMIT_SAMPLE_MS = 32) serialized under a leaf Mutex<CommitSample>: fresh staging growth grants debit the cached available-commit headroom immediately and hold an in-flight GrowthReservation until allocation completes so concurrent calls or sample refreshes cannot double-spend headroom below the 1024 MiB growth floor.
    • Dual reserve floors: 512 MiB upload reserve (UPLOAD_RESERVE_BYTES) keeping pooled staging buffer reuse open under moderate pressure, and 1024 MiB staging growth reserve (GROWTH_RESERVE_BYTES) gating fresh CreateCommittedResource upload allocations.
    • Thread-local upload deferral flag (upload_deferred_during / note_upload_deferred) and aggregate-only exit counters (deferrals, oom_cooldowns, growth_denials, free_trims / MiB), logged once in report::write_final only when XCL_UPLOAD_BACKOFF=1.
  • Staging & heap pressure integration:
    • crates/xcl/src/hle/d3d12x/texture_upload.rs: preserves E_OUTOFMEMORY via SubmitError { Deferred, Oom, Failed } (from_win / from_win_in); reuses pooled FREE staging jobs down to the 512 MiB floor; reserves fresh upload heap growth with reserve_staging_growth_with against the 1024 MiB reserve; drops idle FREE staging buffers (trim_free) and declines re-pooling in give_back when pressure denies admission or E_OUTOFMEMORY occurs.
    • crates/xcl/src/hle/d3d12x/title_textures.rs:
      • Reaps completed in-flight upload jobs without waiting (reclaim_completed_uploads, preserving ON_QUEUE -> FREE lock order) before checking upload admission in upload_all and before checking admission for a non-empty RETRY queue in retry_failed, so completed staging buffers return to FREE (or drop under low commit) without waiting for a later successful submit.
      • Preserves windows::core::Error through upload_queue and maps queue-creation errors via SubmitError::from_win("upload queue", e) so E_OUTOFMEMORY on a compute/copy queue's first upload arms the 500 ms cooldown and stops after one batch while queueing all remaining batches for retry.
      • Checks residency::admit_upload() before batches when XCL_UPLOAD_BACKOFF=1; on Deferred/Oom, forgets known hashes for the failed batch and remaining queued items so nothing is lost, queues deduplicated retry entries keyed by (res, Entry::seq) with the backoff delay, trims idle FREE buffers, and stops spinning in the current submit pass.
      • retry_failed / retry_failed_at prunes retired or registration-mismatched RETRY entries even while upload admission is closed, preventing retry-queue growth under streaming churn and avoiding spurious rescheduling when a resource address is reused. Default-OFF behavior is unchanged.
    • crates/xcl/src/hle/d3d12x/sparse.rs and crates/xcl/src/hle/d3d12x/vram.rs: call residency::allocation_error(e.code().0) on 64 MiB sparse/texture-page pool and arena CreateHeap failures so GPU heap OOM immediately pauses staging growth.
    • crates/xcl/src/hle/d3d12x/mod.rs and crates/xcl/src/report.rs: expose pub mod residency; and emit the opt-in aggregate exit summary in write_final.
  • Scope note: This PR intentionally gates uploads only on OS commit headroom (ullAvailPageFile) and E_OUTOFMEMORY failures rather than DXGI local-VRAM budget. On Windows / WDDM hosts with ample RAM, titles can exceed local VRAM budget cleanly via non-local spill without hitting OOM (as also observed in @Anon64's 300 s RTX 3060 12 GB + 64 GB RAM run); deferring texture uploads on local VRAM budget without active eviction risks texture starvation and belongs in separate eviction/residency work.
  • Review follow-up (58ff61c2): Addresses all four pressure-path findings raised by @thehollowedone (non-blocking completed-upload reap, upload_queue HRESULT preservation, debited/reserved 32 ms growth-budget accounting, and (res, Entry::seq) retry identity with closed-admission pruning).
  • Tests added / updated:
    • 6 deterministic unit tests in hle::d3d12x::residency::tests (disabled no-op, 500 ms OOM cooldown + expiry, dual reserve floors, 32 ms commit-sample cache, debited growth budget + in-flight reservation across sample refresh, thread-local deferral propagation).
    • 3 deferral/retry unit tests in hle::d3d12x::title_textures::tests (upload_backoff_defers_without_dropping_dirty_or_pending_textures, upload_queue_oom_arms_cooldown_stops_after_one_batch_and_queues_all_retries, retry_prunes_retired_while_closed_and_ignores_same_address_replacement) plus live GPU fence reap verification in gpu_an_upload_still_running_is_kept_when_its_wait_times_out.
    • 1 live D3D12 GPU test in hle::d3d12x::texture_upload::tests (gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers) exercising warm pool creation, pooled reuse at 768 MiB commit headroom with bit-exact GPU readback, 2 MiB fresh-growth deferral + FREE trim + deferral observation, 500 ms E_OUTOFMEMORY cooldown, disabled-mode no-op, and post-expiry recovery with bit-exact GPU readback.

Part of #2688
Refs #3011

Tested

Tested locally on Windows 11 (26200), Intel Core i5-11400F, 32 GB RAM, NVIDIA GeForce RTX 4060 8 GB (Ada, Wave32, driver 32.0.16.2114), rustc 1.100.0, DXC 1.9.2609.5, PR head 58ff61c296bda172c636a007ff102324c5c5d6f3 (fast-forward onto ac52410957a909952e54647e719dcf954cce66bb) off nvidia-dev (d1be8103644791b7a65f068954324e93d4b1b565):

  • cargo clippy --tests -p xcl -- -A clippy::approx_constant -A clippy::while_immutable_condition: exit 0, 0 new warnings in any touched or new file (residency.rs: 0 warnings; the -A flags suppress only pre-existing nvidia-dev deny-by-default lints outside this diff).
  • cargo build --release -p xcl: exit 0, 0 new warnings in touched files.
  • Targeted tests on 58ff61c2 (3x Debug + 3x Release, --test-threads=1 --nocapture, 0 GPU test skips):
    • hle::d3d12x::residency::: 6 passed; 0 failed; 0 ignored (3x Debug, 3x Release).
    • hle::d3d12x::texture_upload::tests::gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers: 1 passed; 0 failed; 0 ignored (3x Debug, live RTX 4060 D3D12 upload + readback).
    • hle::d3d12x::texture_upload:: (full module, live RTX 4060 GPU tests): 9 passed; 0 failed; 0 ignored (3x Release, 0 skips).
    • hle::d3d12x::title_textures:: (including live GPU fence test gpu_an_upload_still_running_is_kept_when_its_wait_times_out and all 3 backoff/retry unit tests): 32 passed; 0 failed; 0 ignored (3x Debug, 3x Release, 0 skips).
  • Prior commit ac524109 (unchanged files sparse.rs, vram.rs, report.rs, mod.rs) also passed hle::d3d12x::sparse:: (66 passed; 0 failed; 1 ignored), hle::d3d12x::vram:: (22 passed; 0 failed; 1 ignored), and cargo test --release --lib -p xcl -- --test-threads=4 (1706 passed; 0 failed; 28 ignored).
  • Verified default-OFF log silence (0 upload backoff lines in xcl.log when unset) and opt-in aggregate exit summary (D3D12.X: upload backoff summary (XCL_UPLOAD_BACKOFF=1): deferrals=0, oom_cooldowns=0, growth_denials=0, free_trims=0 (0 MiB)) on the live 60 s RTX 4060 runs below.

Regression run

Quiet 60 s retail smoke runs (scripts/smoke.ps1 -Seconds 60, XCL_NETWORK=0, title: 29640639, NVIDIA GeForce RTX 4060). Includes a same-day main (81693f020768ec47dbfe9eefba5eec0ab9aeda6c, XCL_PREPARE=0) baseline for scripts/pr_check.py, the nvidia-dev target base (d1be8103644791b7a65f068954324e93d4b1b565), the updated PR head (58ff61c296bda172c636a007ff102324c5c5d6f3, XCL_PREPARE=0 set, no-op on nvidia-dev) with default settings (XCL_UPLOAD_BACKOFF unset), and the updated PR head with XCL_UPLOAD_BACKOFF=1:

main baseline (81693f02, XCL_PREPARE=0, for pr_check.py):

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

nvidia-dev target base (d1be8103):

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

PR head (58ff61c2, default XCL_UPLOAD_BACKOFF unset; 0 upload-backoff log lines):

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

PR head (58ff61c2, opt-in XCL_UPLOAD_BACKOFF=1; aggregate summary deferrals=0, oom_cooldowns=0, growth_denials=0, free_trims=0 (0 MiB)):

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

Not tested

  • Sustained live OS commit-exhaustion (<1024 MiB available commit) or real driver E_OUTOFMEMORY during a retail game session: on this 32 GB RAM / 8 GB VRAM host, available commit remained above the 1024 MiB reserve floor throughout the 60 s XCL_UPLOAD_BACKOFF=1 smoke (deferrals=0, oom_cooldowns=0, growth_denials=0, free_trims=0). The low-commit deferral, pooled-reuse-between-floors, non-blocking fence reap, debited/reserved growth budget, upload_queue OOM cooldown, (res, Entry::seq) retry pruning, FREE trimming, and recovery paths are verified deterministically by the unit tests and live RTX 4060 D3D12 GPU tests.
  • Hardware Wave64 GPUs (RDNA / GCN) and non-NVIDIA adapters (AMD / Intel).
  • XCL_SAMPLE_* game-data tests and test_title_runs_and_game_folder_is_untouched.
  • Pre-existing Debug-only arithmetic overflow in texture_upload::tests::some_ranges (tracked separately by Tests: some_ranges in texture_upload wraps its generator instead of overflowing #2771; passes in --release).
  • Additional C5 residency slices (active VRAM eviction / residency background worker) and DXGI local-VRAM budget deferral, which are intentionally out of scope for this commit-headroom / OOM back-off PR.

AI use

Google Antigravity (Gemini 4 Neon) was used to port, adapt, fix review findings, test, and document this change under human supervision; all edits, unit/GPU tests, clippy checks, and quiet 60 s RTX 4060 regression smokes were executed and verified locally on this machine.

…L_UPLOAD_BACKOFF=1)

Port the C5 OOM back-off and commit-headroom upload admission gate from
Vice-Tay (`57deba5c4c752b97a8286bdbd80b96517f0988fc`,
`crates/victory-gpu/src/residency.rs`, GPL-3.0) behind opt-in
`XCL_UPLOAD_BACKOFF=1` (default OFF).

- Add `hle::d3d12x::residency` with 500 ms E_OUTOFMEMORY upload cooldown,
  32 ms cached `GlobalMemoryStatusEx` commit-headroom sampling, 512 MiB
  upload reserve floor (keeps pooled staging reuse open), 1024 MiB staging
  growth reserve floor, thread-local deferral signaling, and an opt-in
  aggregate exit summary logged in `report::write_final`.
- Wire `residency::allocation_error` into `sparse.rs` and `vram.rs` heap
  creation OOM paths, `texture_upload.rs` staging pool reuse / growth /
  trim-on-pressure / `SubmitError`, and `title_textures.rs` deferred retry
  handling so deferred textures are forgotten cleanly and re-queued
  without dropping dirty or pending state.
- Add `Vice-Tay` provenance entry to `THIRD_PARTY.md`.
- Add 5 unit tests in `residency.rs`, a deferral/retry unit test in
  `title_textures.rs`, and a live D3D12 GPU test in `texture_upload.rs`.

Part of xcl-dev#2688
Refs xcl-dev#3011
@throny

throny commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Merge status (I have been asked to prepare merges of PRs with several independent tests; the bar is: no open critical finding or performance regression, a fresh check of the merge result against today's main, and green required checks. Each merge is still confirmed by a person.)

This is against nvidia-dev, where Build and test is red on every open PR because of the branch's own test run, so nothing there can go in until that is fixed. It is in my test queue for a world run on an RTX 4080 16 GB (with and without XCL_UPLOAD_BACKOFF=1); the machine has 64 GB, so it will show "no harm" rather than the low-memory benefit, which needs an 8 GB card or a small-RAM machine.

AI use: Claude Code (Claude Fable 5.2).

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent Windows/RTX 3080 Ti (621.35) check of head ac524109. The new gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers test passed on this card (cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::texture_upload::tests::gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers -- --exact --nocapture: 1 passed, 0 failed, 0 ignored/skipped). The five residency::tests passed. The Windows CI device removal occurs in the existing sparse test on the shared nvidia-dev base; #3039’s CI shows the same 256-byte Map failure. That does not clear #3037’s CI gate.

One pressure-path issue needs attention before the opt-in path is relied on: completed staging jobs remain in ON_QUEUE[*].in_flight until a successful later submit calls reclaim. At 768 MiB commit headroom, a matching completed job can therefore be unavailable in FREE; a fresh staging allocation is denied by the 1,024 MiB growth reserve, so subsequent retries cannot reach that reclaim call. The collapsed candidate below scans completed fences without waiting before upload admission and before a nonempty retry queue checks admission. It preserves the current ON_QUEUE → FREE lock order. The adapted GPU fence test passed 1/1 on the RTX 3080 Ti: it held an upload behind a fence, then confirmed the helper released it after completion. This verifies the reap helper; I did not simulate a low-commit retail run.

Three additional source-only cases need targeted regressions; I did not measure them on a live low-memory system:

  • upload_queue converts CreateCommandQueue errors to String, then the new call maps them to SubmitError::Failed. On a copy/compute queue's first upload, an E_OUTOFMEMORY here misses the 500 ms cooldown and the batch path uses the old 100 ms retry. Preserve the HRESULT through upload_queue and use SubmitError::from_win; inject queue-creation OOM with two batches and verify one attempt plus both retries queued.
  • allow_staging_growth_with reuses one 32 ms available-commit sample for successive fresh allocations. For example, two 32 MiB grants from 1,072 MiB can leave 1,008 MiB, below the stated 1,024 MiB floor. Serialize an uncached headroom query with fresh staging allocation, or reserve each grant against a shared budget that cannot be reset by a concurrent sample; test two grants within one sample window.
  • RETRY holds raw resource addresses. Retirement removes an entry from TEXTURES but leaves its retry entry, and denied admission returns before pruning it. Under streaming churn this grows retry scans; address reuse can schedule a replacement texture on recovery. Bind retries to registration identity and prune retired entries even while admission is closed; test retirement and same-address replacement.

cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 --quiet gave the same result and failing test names on untouched head and the local reap candidate: 1,827 passed, 12 failed, 48 ignored, 26 GPU skip notices. The candidate is uncommitted. Not tested: retail low-commit behavior, paired smoke, AMD or Intel. AI use: Codex (GPT-6.2 Sol) checked the paths, wrote and ran the local candidate and tests; Codex (GPT-6.2 Astra) independently reviewed the memory and retry invariants.

Nonblocking reap candidate and fence-test diff
diff --git a/crates/xcl/src/hle/d3d12x/title_textures.rs b/crates/xcl/src/hle/d3d12x/title_textures.rs
index b9141599..c54d92d5 100644
--- a/crates/xcl/src/hle/d3d12x/title_textures.rs
+++ b/crates/xcl/src/hle/d3d12x/title_textures.rs
@@ -2105,6 +2105,14 @@ unsafe fn reclaim(q: &mut QueueUploads, cap: u64, wait_ms: u64) {
     }
 }
 
+/// Return completed upload jobs before deciding that commit pressure requires another allocation.
+/// Never wait for a still-running title queue here.
+unsafe fn reclaim_completed_uploads() {
+    for q in ON_QUEUE.lock().unwrap().values_mut() {
+        reclaim(q, u64::MAX, 0);
+    }
+}
+
 /// The queue a submit's uploads go to, by device, and the one it waits for first.
 struct Target {
     /// the title's queue, when they go to it
@@ -2288,6 +2296,9 @@ unsafe fn upload_all(todo: Vec<Due>, dirty: &[usize], page: usize, title: Option
         Some((d, changed, bytes))
     }).peekable();
     let backoff_on = super::residency::enabled();
+    if backoff_on && todo.peek().is_some() {
+        reclaim_completed_uploads();
+    }
     while todo.peek().is_some() {
         if backoff_on && !super::residency::admit_upload() {
             super::residency::note_upload_deferred();
@@ -2420,6 +2431,12 @@ fn defer_remaining(
 
 /// Those whose time has come are to be uploaded as a whole, like new ones.
 fn retry_failed() {
+    if RETRY.lock().unwrap().is_empty() {
+        return;
+    }
+    if super::residency::enabled() {
+        unsafe { reclaim_completed_uploads(); }
+    }
     if super::residency::enabled() && !super::residency::admit_upload() {
         return;
     }
@@ -3074,10 +3091,16 @@ pub(super) mod tests {
                 assert!(q.bytes > 0);
             }
             gate.Signal(1).unwrap();
+            let (fence, value) = {
+                let g = ON_QUEUE.lock().unwrap();
+                let q = g.get(&key).unwrap();
+                (q.fence.clone(), q.value)
+            };
+            crate::gpu::fence::wait(&fence, value, dev, None, 5_000).unwrap();
+            reclaim_completed_uploads();
             {
-                let mut g = ON_QUEUE.lock().unwrap();
-                let q = g.get_mut(&key).unwrap();
-                reclaim(q, 0, 10_000);
+                let g = ON_QUEUE.lock().unwrap();
+                let q = g.get(&key).unwrap();
                 assert!(q.in_flight.is_empty() && q.bytes == 0);
             }
             assert_eq!(read_r8(dev, &queue, &texture), vec![0x77; 64 * 64]);

@Anon64

Anon64 commented Nov 27, 2026

Copy link
Copy Markdown

RTX 3060 12 GB (NVIDIA), ac524109 with XCL_UPLOAD_BACKOFF=1, a retail title for 300 s: the gate never acted. Its summary was deferrals=0, oom_cooldowns=0, growth_denials=0, free_trims=0 while local video memory reached 16 802 MB on a 12 GB card.

Release build, XCL_ACTIVITY=1, A pressed every 4 s from 20 s. The run exited 0x0 with 1 927 frames and no device removals or crashes. Presents stopped at ~205 s after the first frame. Peak commit was 41 210 MB, with 5 916 MB non-local.

On this card the title goes past the VRAM budget without ever getting an out-of-memory error. So, as far as this run shows, the OOM back-off has nothing to react to. The commit-headroom check never fired either, at 41 GB of process commit on a 64 GB machine. Whether the gate should also look at DXGI's local budget, not only at failures and commit, is for you to judge.

No base comparison: on base d1be8103 both runs ended before the title started. In the one I can account for, my RAM watchdog ended it: less than 4 GB of RAM was free during that build's shader preparation. So the run is mine to redo, not a finding about the PR.

RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200.

AI use: Claude Code (Claude Opus 5.5) built the PR, ran the title and wrote this report.

… on registration id

Fixes the four opt-in upload-backoff pressure-path review findings on xcl-dev#3037:
- Reap completed in-flight upload jobs without waiting before upload admission and before checking a non-empty retry queue (preserving ON_QUEUE -> FREE lock order), returning completed staging buffers to FREE (or dropping them under pressure) without requiring a later successful submit.
- Preserve windows::core::Error HRESULTs through title_textures::upload_queue and map them via SubmitError::from_win so E_OUTOFMEMORY on first copy/compute-queue upload arms the 500 ms cooldown and queues all remaining batches after a single attempt.
- Serialize and debit the 32 ms cached available-commit sample on staging growth grants under a leaf Mutex<CommitSample> and hold an in-flight GrowthReservation until allocation completes so concurrent refreshes cannot double-spend headroom below the 1024 MiB growth floor.
- Key RETRY entries on (res, Entry::seq) and prune retired or mismatched entries even while upload admission is closed, preventing retry-queue growth under churn and spurious rescheduling on address reuse.

Assisted-by: Google Antigravity (Gemini 4 Neon)
@Decodere

Copy link
Copy Markdown
Contributor Author

Thanks @thehollowedone for the thorough pressure-path review and RTX 3080 Ti verification, and thanks @Anon64 for the 300 s RTX 3060 12 GB + 64 GB RAM no-harm run (1927 frames, 0 removals/crashes, deferrals=0).

Pushed fast-forward commit 58ff61c2 onto ac524109 addressing all four findings from @thehollowedone:

  1. Non-blocking completed-upload reap (title_textures.rs): Added reclaim_completed_uploads() (reclaim(q, u64::MAX, 0), preserving ON_QUEUE -> FREE lock order) and called it before upload admission in upload_all and before checking admission for a non-empty RETRY queue in retry_failed (plus trimming newly reclaimed idle buffers when admission is closed). Updated the live GPU fence test gpu_an_upload_still_running_is_kept_when_its_wait_times_out to verify reclaim_completed_uploads() neither blocks on a gated queue nor leaves completed jobs stuck in ON_QUEUE.
  2. Preserve CreateCommandQueue HRESULT (title_textures.rs, texture_upload.rs): Changed upload_queue to return windows::core::Result<ID3D12CommandQueue> and mapped it in upload_all via SubmitError::from_win("upload queue", e) (with SubmitError::from_win_in + handle_batch_error shared with the test harness). Added upload_queue_oom_arms_cooldown_stops_after_one_batch_and_queues_all_retries verifying that injected E_OUTOFMEMORY on batch 1 of 2 arms the 500 ms cooldown, stops after 1 attempt, forgets both batches' known state, and queues both at t + 500 ms (while non-OOM E_INVALIDARG keeps the 100 ms per-batch retry without cooldown).
  3. Debit and reserve the 32 ms growth-headroom budget (residency.rs, texture_upload.rs): Replaced the split commit-sample atomics with a leaf Mutex<CommitSample> (next_sample, available, pending_growth) and RAII GrowthReservation. Each granted fresh staging allocation immediately debits available and holds pending_growth across take_in's allocation syscalls so neither a second allocation within the 32 ms window nor a concurrent sample refresh across the window boundary can double-spend headroom below the 1024 MiB growth floor. Added staging_growth_debits_cached_sample_and_holds_in_flight_reservation (testing two 32 MiB grants from 1,072 MiB within one window, concurrent refresh while in flight, and recovery on a subsequent window).
  4. Registration-identity retries and closed-admission pruning (title_textures.rs): Threaded Entry::seq onto Due and keyed RETRY entries on (at, res, seq) (push_retry also drops any older seq for res), and updated retry_failed / retry_failed_at to prune retired or seq-mismatched entries even while admitted == false. Added retry_prunes_retired_while_closed_and_ignores_same_address_replacement verifying both retirement pruning under denied admission and same-address replacement immunity when admission reopens.

On DXGI local-VRAM budget (@Anon64): Keeping DXGI local-VRAM budget deferral out of scope for #3037 intentionally — as your 300 s RTX 3060 12 GB + 64 GB RAM run showed, WDDM spills cleanly past local VRAM budget without hitting OOM when system commit is plentiful, so gating texture uploads on local VRAM budget without active VRAM eviction would risk texture starvation on healthy high-RAM hosts. Local-VRAM budget management belongs in dedicated residency/eviction PRs, while #3037 focuses strictly on OS commit headroom and E_OUTOFMEMORY recovery.

Verification on 58ff61c2 (RTX 4060 8 GB, driver 32.0.16.2114, Windows 11, rustc 1.100.0):

  • cargo clippy --tests -p xcl -- -A clippy::approx_constant -A clippy::while_immutable_condition: 0 new warnings in touched files (residency.rs: 0).
  • 3x Debug + 3x Release (--test-threads=1 --nocapture, 0 GPU test skips):
    • hle::d3d12x::residency::: 6 passed; 0 failed; 0 ignored
    • hle::d3d12x::texture_upload::: 1/0/0 Debug (gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers), 9/0/0 Release
    • hle::d3d12x::title_textures::: 32 passed; 0 failed; 0 ignored (including live GPU fence reap test)
  • Paired quiet 60 s smokes (title: 29640639, XCL_NETWORK=0, XCL_PREPARE=0):
    • Default OFF: exit 0x0, 1612 frames (60 60 60), 0 removals/crashes, peak commit: 14707 MB, 0 backoff log lines.
    • XCL_UPLOAD_BACKOFF=1: exit 0x0, 1572 frames (61 60 60), 0 removals/crashes, peak commit: 14627 MB, deferrals=0, oom_cooldowns=0, growth_denials=0, free_trims=0 (0 MiB).

@throny — branch is updated fast-forward to 58ff61c2 cleanly on nvidia-dev (d1be8103), ready whenever the shared nvidia-dev CI gate is unblocked.

AI use: Google Antigravity (Gemini 4 Neon) implemented the fixes, added the regressions, and ran all local tests and 60 s smokes on this RTX 4060.

@pickles976

Copy link
Copy Markdown

Verified current production head 58ff61c296bda172c636a007ff102324c5c5d6f3 on Linux/Wine11 + physical NVIDIA RTX4060 Laptop8GiB (590.48.1),16GiB host RAM. Local checkout xcl-pr3037-revised has test-only changes: mandatory real NVIDIA for the existing backoff GPU fixture, plus a completed-upload/no-new-submit readback fixture. No production changes.

10 passed /0 failed /0 ignored,1.46s tests after fresh33.30s intended-worktree compilation:

  • six residency::tests including cached-headroom debiting and an in-flight growth reservation across sample refresh;
  • OOM-vs-non-OOM queue-error/cooldown/retry helper coverage;
  • stale registration retry pruning while admission is closed and same-address/new-generation replacement;
  • real-GPU existing pooled reuse/growth deferral/trim/injected-OOM recovery fixture, preserving its exact texture readbacks;
  • added real-GPU fixture: submit one64×64 R8 upload, wait for its actual completion, confirm1MiB still accounted in ON_QUEUE, call production reclaim_completed_uploads() with no further upload, require empty in-flight deque/zero queue bytes, then read back all4096 texels correctly. No artificial queue stall, device removal or low-memory condition was induced.

Command: XCL_UPLOAD_BACKOFF=1 DXVK_CONFIG='dxgi.hideNvidiaGpu = False' XCL_SOURCE_DIR=$PWD/xcl-pr3037-revised /usr/bin/bash .compat-tools/cargo-xcl-wine.sh test --locked --target x86_64-pc-windows-msvc -p xcl --lib -- residency::tests:: upload_queue_oom_arms_cooldown_stops_after_one_batch_and_queues_all_retries retry_prunes_retired_while_closed_and_ignores_same_address_replacement gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers lab_completed_upload_is_reaped_without_another_submit --nocapture --test-threads=1, run through the lab's bounded scope/resource runner.

Evidence: .compat-runtime/logs/verify-xcl3037-revised-admission-20261127T183305Z/ (console, result, resource samples). Sampled GPUpeak166MiB/min availableRAM9139MiB/min availabledisk11.443GiB. Scope9GiB+512MiB swap and external6000MiB GPU/2048MiB availableRAM/10GiB disk limits unchanged.

Limits: diagnostic-relaxed-vtable vkd3d-proton3.2.0 2576c0b4adfae4a+, not stock-runtime certification. Synthetic commit/error injections are not Wine's real pressure behavior or a hard Linux/cgroup RAM budget. Reaping1MiB of completed staging does not prove it was returned to the OS: the free pool can retain it. The deliberately blocked-queue owner fixture was not run; no pending GPU work was freed. No matched-parent, aggregate-RAM, loading-stutter, title/Game-Init fence, or gameplay claim.

Useful next gate: matched measured loading on a separately runtime-cleared stack with real admitted/deferred/reclaimed bytes, preserving producer-fence completion and distinguishing idle-pool capacity from resident RAM. This passes the changed bookkeeping/data-recovery mechanisms, not that runtime gate.

@thehollowedone

thehollowedone commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: d1be810
head: 58ff61c
merge: clean (head fast-forwards from this base)
build: cargo build --offline --locked --workspace -> ok
tests: cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 -> 1,833 passed, 9 failed, 48 ignored, 26 explicit GPU skips on the clean head; the exact base produced 1,823 passed, 9 failed, 48 ignored, 26 skips. All nine failed instances have the same names on both revisions.
review: Not yet. At 768 MiB available commit, a 1 MiB pooled buffer can upload a small texture, while a larger request cannot grow staging under the 1,024 MiB floor. The growth denial in take_in then calls trim_free_in, discarding that reusable 1 MiB buffer. The next small upload is denied too and keeps retrying until headroom rises above the growth floor, although it needed no new commit. A test extension on the unmodified head failed 0/1 with Deferred("texture upload: staging growth deferred under low commit headroom"). Removing the trim on growth denial and retaining the buffer made the GPU test pass 1/1 with bit-exact small-texture readback; a low-commit control at 256 MiB still deferred and trimmed the buffer. This is a local, uncommitted candidate, not a full-suite or title result for the modified tree.
performance: default-off path adds no per-upload OS query. With the opt-in path, this correction avoids repeated deferral and reallocation of smaller staging buffers after a larger growth denial. Sustained frame-time and low-commit retail behavior were not measured.
verdict: not yet: retain reusable pooled buffers when only fresh growth is denied; rerun the GPU regression and required checks on the corrected head.
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GiB (621.35), DXC 1.8.2502.11; Codex (GPT-6.2 Sol) traced the paths, ran the exact-head/base suites and GPU regression, and drafted this check.

Local candidate and GPU regression diff
diff --git a/crates/xcl/src/hle/d3d12x/texture_upload.rs b/crates/xcl/src/hle/d3d12x/texture_upload.rs
index 49faf1a4..fd61e249 100644
--- a/crates/xcl/src/hle/d3d12x/texture_upload.rs
+++ b/crates/xcl/src/hle/d3d12x/texture_upload.rs
@@ -885,7 +885,6 @@ unsafe fn take_in(
         match res.reserve_staging_growth_with(cap, now, true, query_commit) {
             Some(guard) => Some(guard),
             None => {
-                trim_free_in(pool, res);
                 res.note_deferred();
                 return Err(SubmitError::Deferred("texture upload: staging growth deferred under low commit headroom"));
             }
@@ -1518,16 +1517,40 @@ mod tests {
             pool.lock().unwrap().push(reused);
 
             // Requesting the 2 MiB texture under mid_commit cannot reuse the 1 MiB buffer:
-            // must defer fresh CreateCommittedResource growth AND trim the idle 1 MiB pooled buffer.
+            // must defer fresh CreateCommittedResource growth while retaining the idle 1 MiB
+            // pooled buffer for smaller uploads that are still admitted at this headroom.
             let (deferred_res, observed) = residency::upload_deferred_during(|| {
                 submit_with(&pool, &dev, &queue, &[make_item(&big, &big_mem)], &res, true, 300, || Some(mid_commit))
             });
             assert!(matches!(deferred_res, Err(SubmitError::Deferred(_))), "expected growth deferral under mid_commit");
             assert!(observed, "upload_deferred_during must observe the deferral");
-            assert!(pool.lock().unwrap().is_empty(), "idle too-small pooled upload buffer must be trimmed on growth deferral");
+            assert_eq!(pool.lock().unwrap().len(), 1, "retain a reusable smaller staging buffer");
             assert_eq!(res.stats().growth_denials, 1);
+            assert_eq!(res.stats().free_trims, 0);
+
+            // A larger deferred upload must not strand later small uploads that could reuse
+            // an already committed staging buffer at the same available-commit level.
+            let (failed, continued, _) = submit_with(&pool, &dev, &queue, &[make_item(&small, &small_mem_a)], &res, true, 301, || Some(mid_commit))
+                .expect("a smaller upload should still reuse its pooled staging buffer");
+            assert!(failed.is_empty());
+            let continued = continued.expect("small upload job");
+            assert_eq!(continued.buf.as_raw() as usize, pooled_raw);
+            value += 1;
+            queue.Signal(&fence, value).unwrap();
+            crate::gpu::fence::wait(&fence, value, &dev, None, 20_000).unwrap();
+            let want_continued = super::super::title_textures::subresources(small_mem_a.as_ptr() as usize, &small.tex);
+            assert_eq!(read_back(&dev, &queue, &small.res, want_continued.len()), want_continued.iter().map(|w| w.data.clone()).collect::<Vec<_>>());
+            pool.lock().unwrap().push(continued);
+
+            // Below the upload reserve, even pooled reuse is closed, so returning idle
+            // commit to the OS still takes priority.
+            let low_commit = UPLOAD_RESERVE_BYTES / 2;
+            assert!(matches!(
+                submit_with(&pool, &dev, &queue, &[make_item(&small, &small_mem_b)], &res, true, 350, || Some(low_commit)),
+                Err(SubmitError::Deferred(_))
+            ));
+            assert!(pool.lock().unwrap().is_empty());
             assert_eq!(res.stats().free_trims, 1);
-            assert_eq!(res.stats().free_trim_bytes, BUFFER_MIN);
 
             // Arm a 500 ms E_OUTOFMEMORY cooldown at t=400: uploads defer until t=900.
             assert!(res.record_allocation_error(crate::util::E_OUTOFMEMORY, 400, true));

@razormontana

Copy link
Copy Markdown
Contributor

Independent native validation of 58ff61c296bda172c636a007ff102324c5c5d6f3 on d1be8103644791b7a65f068954324e93d4b1b565. Windows 11 Pro build 22631, Core i7-10700K, RTX 3070 8 GB with NVIDIA 617.42, Rust 1.100.0 x64 MSVC.

Tested

  • cargo +stable-x86_64-pc-windows-msvc test --offline --locked -j 1 -p xcl --lib --no-run passed. Each test was selected by its fully qualified name with -- --exact --test-threads=1 --nocapture.
  • Six residency tests and three title-texture retry and admission tests passed. The native gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers fixture also passed. It simulated available commit, the cooldown clock, and the allocation HRESULT. The actual D3D12 copies after reuse and recovery read back byte-for-byte. A separate native probe verified the default hardware adapter as the RTX 3070.
  • 10 passed, 0 failed, 0 ignored, 0 explicit skips.

Not tested

Sustained OS commit pressure, actual allocation failure, the full suite, or retail behavior.

AI use

Codex GPT-6.2 ran the focused validation, checked the results, and prepared this report.

@andrewDoing

Copy link
Copy Markdown
Contributor

I checked one Windows accounting boundary for the headroom predicate at head 58ff61c using a disposable child in a Job Object with a 204 MiB per-process commit limit.

GlobalMemoryStatusEx().ullAvailPageFile, the field used by the predicate, reported 41,575 MiB both before and after imposing the process limit. In that child, a 4 MiB VirtualAlloc succeeded, while a 256 MiB allocation failed with Win32 error 1455. The sampled system headroom would clear the PR's 1,024 MiB reserve and admit that growth.

This shows that system-wide available commit does not capture a tighter job/process commit limit. The probe did not allocate a D3D12 heap or test XCL's failure cooldown, so it does not establish a GPU failure or retail impact. A follow-up could check the relevant job limits if supporting constrained processes is in scope.

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

@upipibi

upipibi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Test report for #3037 on NVIDIA: the whole workspace suite on this PR merged onto today's nvidia-dev and on nvidia-dev alone, and the PR's own tests 3 times by name.

Tested

  • Base: nvidia-dev 54225f5884a94cd23b7aab3f703a7c975070aa77. Head: 58ff61c296bda172c636a007ff102324c5c5d6f3 (its merge-base with this base is d1be8103). git merge --no-ff of the head onto the base: clean, no conflicts (mod.rs, sparse.rs, texture_upload.rs and title_textures.rs auto-merged); the merge (3a6961a2, local) differs from the base by 8 files, +1069/-49.
  • RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11 Pro 10.0.26100, Rust 1.100.0 MSVC, debug. Each tree in its own worktree and target dir; XCL_UPLOAD_BACKOFF not set.
  • cargo build --workspace and cargo build --workspace --tests: both exit 0 on both trees, 9 and 10 warnings, the same count as the base.
  • cargo test --workspace --no-fail-fast -- --test-threads=4, once on each tree. On both trees the xcl library binary stopped partway through, before printing its result. It exited with code 130088963 (0x7C10003) after D3D12.X: coherent window could not be restored at ... (268435456 bytes, got 0x0, Windows error 487) after CreateCommandQueue: ... (0x8007000E); stopping before guest memory is used, which a uma_driver mixed-window test prints. The other 39 result lines:
    • merge: 132 passed, 0 failed, 20 ignored, 26 SKIPPED lines;
    • base: 132 passed, 0 failed, 20 ignored, 26 SKIPPED lines; the same per-binary results as the merge.
    • Before the stop, the library binary printed 5 FAILED lines on each tree. On the merge: the 4 title_textures tests below plus hle::d3d12x::title_textures::tests::gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released. On the base: the same 4 plus hle::d3d12x::list_x::tests::mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares, which passed in the base's 3 library re-runs and 3 of 3 times alone, and passed in the merge's run.
  • Because of that stop, the library binary was run again 3 times on each tree with the two mixed-window tests skipped: cargo test -p xcl --lib -- --test-threads=4 --skip hle::d3d12x::uma_driver::tests::a_refused_gpu_upload_segment_becomes_custom --skip hle::d3d12x::uma_driver::tests::mixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment:
    • merge: 1779 passed, 7 failed, 28 ignored (2 filtered out), 26 SKIPPED lines, the same in 3 runs;
    • base: 1770 passed, 6 failed, 28 ignored (2 filtered out), 26 SKIPPED lines, the same in 3 runs.
    • 6 of the failures have the same names on both trees: hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, …stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, …stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, …stream_recheck_schedule_catches_late_writes_and_resets_milestones, hle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memory and …gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark. Three panic on 0x8007000E (E_OUTOFMEMORY) from a D3D12 call, and the other three stream_recheck_* ones on a PoisonError after those panics.
    • The 7th fails on the merge only: hle::d3d12x::title_textures::tests::gpu_uploads_on_the_title_queue_run_before_its_later_work_and_are_released. It panics at title_textures.rs:3020:106, the test's CreateCommandQueue of a COMPUTE queue, with 0x8007000E (E_OUTOFMEMORY). It failed in 4 of 4 parallel runs on the merge (the workspace run and the 3 library re-runs) and passed in 4 of 4 on the base.
    • Alone, one at a time (--exact --test-threads=1), all 7, plus the base-only list_x one, pass 3 of 3 times on both the merge and the base: 8 passed, 0 failed each run.
    • The two skipped mixed-window tests pass alone on both trees: 2 passed, 0 failed, 3 of 3 times each.
    • Together with the other 39 result lines of the workspace run: merge 1911 passed, 7 failed, 48 ignored, base 1902 passed, 6 failed, 48 ignored. The merge lists 1816 library tests, the base 1806, so 10 are added.
  • The 26 SKIPPED lines are the same on both trees: 21 "no wave64", 3 f16/f32 per-lane forms refused after gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426, 1 "no heap windows", 1 "cannot disable the driver cache".
  • None of the 9 tests in main e429936 on NVIDIA: 3 e2e title tests and 6 split-wave64 GPU tests fail since #2959 #3093 fail here. The 5 split-wave64 tests present on nvidia-dev and the 3 e2e title tests pass on both trees; gpu_heap_flat_reads_match_guarded_and_root_output is not in nvidia-dev's test list.
  • The PR's own tests, by exact name, 3 runs: cargo test -p xcl --lib -- <the 11 names> --exact --test-threads=1 --nocapture. 11 passed, 0 failed, 0 ignored in each of the 3 runs, 0 SKIPPED lines. The log shows backend 'real' – NVIDIA GeForce RTX 3070 (8017 MiB VRAM), and with no XCL_ADAPTER set the upload GPU fixture uses the default adapter.
    • hle::d3d12x::residency::tests::commit_sample_is_cached_for_32ms_and_refreshes_after
    • hle::d3d12x::residency::tests::disabled_mode_is_a_complete_noop
    • hle::d3d12x::residency::tests::oom_arms_500ms_cooldown_and_expires_cleanly
    • hle::d3d12x::residency::tests::reserve_floors_keep_pooled_reuse_open_while_gating_fresh_growth
    • hle::d3d12x::residency::tests::staging_growth_debits_cached_sample_and_holds_in_flight_reservation
    • hle::d3d12x::residency::tests::upload_deferral_reaches_enclosing_observation
    • hle::d3d12x::texture_upload::tests::gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers
    • hle::d3d12x::title_textures::tests::retry_prunes_retired_while_closed_and_ignores_same_address_replacement
    • hle::d3d12x::title_textures::tests::upload_backoff_defers_without_dropping_dirty_or_pending_textures
    • hle::d3d12x::title_textures::tests::upload_queue_oom_arms_cooldown_stops_after_one_batch_and_queues_all_retries
    • hle::d3d12x::title_textures::tests::gpu_an_upload_still_running_is_kept_when_its_wait_times_out (changed by the PR)

Not tested

  • No xcl-smoke block: no title was run.
  • XCL_UPLOAD_BACKOFF=1 in the suite: every run here had the switch unset.
  • Real commit exhaustion or a driver E_OUTOFMEMORY outside the tests.
  • A release build, AMD or Intel GPUs, Linux / Wine.

AI use: Claude Code (Claude Opus 5.5) ran the tests above on the hardware named and wrote this report.

@Aniseto

Aniseto commented Nov 28, 2026

Copy link
Copy Markdown

Ran the upload-backoff tests at 58ff61c2 on an NVIDIA Blackwell desktop part:

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

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib -- hle::d3d12x::residency::tests:: hle::d3d12x::texture_upload:: --test-threads=1
13 passed; 2 failed; 0 ignored; 0 measured; 1722 filtered out      (exit 101)

The two failures are pieces_hold_the_texels_of_their_levels and gpu_parts_of_a_texture_go_up_and_the_rest_stays, both panicking with attempt to multiply with overflow at texture_upload.rs:1137. The PR description documents pre-existing debug-only overflows in that file, so I am not attributing them to this change. The new gpu_upload_backoff_reuses_pooled_buffer_defers_growth_and_recovers GPU test passes here, as do all six residency tests. The thread has runs on RTX 4060, RTX 3080 Ti, RTX 3060 and Wine, but no desktop 5070 Ti.

Not tested: sustained OS commit exhaustion, a paired smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, a retail title, game data.

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

@JJAutoCompare

Copy link
Copy Markdown

Tested

Exact 58ff61c296bda172c636a007ff102324c5c5d6f3 on the nvidia-dev PR, Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC. I verified 17 byte-exact ranges from residency.rs, then reran the pinned standalone CPU harness with injected samples.

residency-headroom.exe head::tests::staging_growth_debits_cached_sample_and_holds_in_flight_reservation --exact --nocapture --test-threads=1
residency-headroom.exe head::tests::mixed_growth_reservations_survive_failed_refresh_and_selective_release --exact --nocapture --test-threads=1

The failed refresh at tick 132 retained 1,040 MiB of cached availability and scheduled the next sample at tick 164. The 32 MiB request was denied. Releasing the 16 MiB reservation left 32 MiB pending without restoring its cached debit. A successful sample at tick 164 followed by a new 32 MiB grant reached the exact 1,024 MiB floor. One additional byte was denied. Later refreshes and releases restored the full sample and admitted 64 MiB again. The fixture recorded five queries and two denials.

2 passed, 0 failed, 0 ignored, 0 runtime skips. Both processes exited 0 with one test filtered out each.

Not tested

OS memory telemetry, real memory pressure, staging or D3D12 allocations, runtime scheduling, GPU or WARP, retail, CI, and the workspace suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified the source and executable, reran both tests, checked the trace, and wrote this report.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 58ff61c

No open or merged PR makes the same change (an opt-in commit-headroom and E_OUTOFMEMORY gate on texture upload staging). No correctness problem found in what I read (residency.rs, the texture_upload.rs and title_textures.rs changes); the off path keeps the old retry behaviour.
It conflicts with main: main's title_textures::Entry no longer has the seq field that the new (res, seq) retry identity and Due::seq rely on, so the rebase needs more than textual fixes. At 1069 lines it is also well over the size limit; the residency module and its wiring could be split.
Recommendation: keep open.

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

@Foniass

Foniass commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Review (head 58ff61c, diff read, not a merge-check; conflicts with main):

  • The conflict is a redesign, not a rebase. About 10 hunks in title_textures.rs conflict: main replaced Entry::seq with generation, and 3427358 (generation-keyed RETRY / requeue_generations) already covers part of this PR's retry-identity fix. The smoke and test results are from an nvidia-dev base, and CI hasn't run since it was retargeted to main.
  • A deferred upload leaves stale or uninitialised texels, with no bound. While available commit stays under 512 MiB, entries are retried forever (~2305, ~2513), and the title's lists run before the texture is uploaded. A cap on deferral, or a forced first upload, would bound it.
  • thehollowedone's blocker is still open. When fresh growth is denied, texture_upload.rs ~886-890 also throws away the reusable pooled buffer, so small uploads that could use it stay stuck, and the test asserts that (~1527).
  • GPU heap out-of-memory pauses the wrong thing (reasoned). OOM from GPU heaps (vram.rs ~161, ~532, sparse.rs ~1254) starts a cooldown on system-RAM staging uploads, so textures stop updating without freeing GPU memory.
  • The gate:
    • It reads the system-wide ullAvailPageFile (residency.rs ~42-45), which ignores a job's commit limit (andrewDoing's probe).
    • Its floors are far below main's gates (dxc::wait_for_memory 6 GB, big_compile_commit_free 3 GB) and share no accounting with them.
    • It's a fourth copy of the GlobalMemoryStatusEx helper.
    • It doesn't cover D3D12.X: reuse the command objects and readback buffers of texture downloads #3514's download pool.
  • The default path changes slightly, though the description says it doesn't: retry_failed_at drops pending or mismatched entries early, and push_retry deduplicates.
  • +1069 lines with no reason given. A split would be: the residency module, then the wiring, then the error hooks and summary log.

Fine: off is really off (every call checks enabled()), the lock order holds, and the counters and tests are deterministic. Every run so far showed deferrals=0, so the deferral path is untested in a title.

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.