D3D12.X: pre-reclaim completed upload jobs and keep one buffer per normal size class #3678

Open
iggyvilla wants to merge 1 commit from upstream-pr/3678 into amd-dev
iggyvilla commented 2026-12-02 08:52:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by iggyvilla on 2026-12-02T08:52:35Z.


Metric (retail world load, 128-batch windows) Before After
Startup upload buffer allocs (t ≈ 20 s) 85.9 ms (12 misses / 239 MB) 29.9 ms (7 misses / 95 MB)
Load phase take misses (t = 21..102 s, 9 windows = 1,152 batches) 158.0 ms (11 misses / 352 MB) 0.0 ms (0 misses)
Heavy in-world take misses (t = 106..119 s, 384 batches) 309.4 ms (31 misses / 554 MB, pre-reclaim only) 70.2 ms (15 misses / 107 MB, 4.4× faster)
Idle upload buffer cap (XCL_UPLOAD_KEEP_MB, default 64 MiB) 64 MiB 64 MiB (unchanged)

What is in it

  • crates/xcl/src/hle/d3d12x/title_textures.rs: in submit_on, non-blockingly reclaim already-completed upload jobs (reclaim(q, u64::MAX, 0)) into texture_upload::FREE via return_for_reuse before calling texture_upload::submit -> take(), instead of only reclaiming after submit (which previously forced take() to allocate a new 32 MiB staging buffer while a completed 32 MiB buffer sat in q.in_flight, then immediately dropped the old one). An RAII TrimGuard declared before the queue lock guarantees texture_upload::trim_free() always runs outside the queue lock even on early returns or errors.
  • crates/xcl/src/hle/d3d12x/texture_upload.rs: split give_back into return_for_reuse + trim_free and refine trim_free eviction (pick_eviction_victim): (1) drop oversized one-off bursts (> 32 MiB, above BATCH_BYTES) largest-first, (2) drop duplicate size classes on the same device largest-duplicate-first so one buffer per normal power-of-two size class (32 + 16 + 8 + 4 + 2 + 1 = 63 MiB <= 64 MiB) stays resident simultaneously without repeatedly evicting the sole 32 MiB batch buffer, and (3) fall back to largest remaining when XCL_UPLOAD_KEEP_MB < 64. Adds pure unit test free_eviction_drops_oversized_bursts_and_duplicates_before_unique_normal_sizes.

Tested

  • Hardware: AMD Radeon RX 6650 XT 8 GB (RDNA2, driver 32.0.21045.29003), AMD Ryzen 7 5700X, Windows 11 x64, rustc 1.100.0 (0ef1bc386 2026-11-09), debug tests + release smoke.
  • cargo test --lib -p xcl hle::d3d12x::texture_upload::tests:: -- --test-threads=4: 13 passed, 0 failed (including free_eviction_drops_oversized_bursts_and_duplicates_before_unique_normal_sizes).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 2,959 passed, 13 pre-existing failed, 49 ignored (identical pre-existing failures to clean origin/amd-dev 41aa60ce).
  • Matched 160 s retail world-load profiling (T6-PROF sub-timers): eliminated all 11 load-phase take misses across 1,152 consecutive batches (158.0 ms -> 0.0 ms) and cut heavy in-world take misses by 4.4× (309.4 ms -> 70.2 ms).

Regression run
Base (main, required by pr_check.py):

xcl-smoke v1
commit: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15479 MB

Base (origin/amd-dev merge base):

xcl-smoke v1
commit: 41aa60ce842060a597b7e8724896f7bf6a031af5
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 15902 MB

PR head (cfb59651):

xcl-smoke v1
commit: cfb596517c1e1b4ec182dadcce62bf3c3551fcdd
gpu: AMD Radeon RX 6650 XT
title: 1778c2d9
seconds: 60
exit: 0x0
frames shown: 1654 (PresentX 1654)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16146 MB

Not tested

  • NVIDIA and Intel GPUs, and Wine.

AI use

  • Antigravity (Gemini 4 Neon High) profiled texture_upload + submit_on on the retail workload, implemented pre-reclaim and duplicate-aware FREE trimming with unit tests, ran the workspace GPU suite and 60 s smoke, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5603056326 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3678). Originally posted by [iggyvilla](https://github.com/iggyvilla) on 2026-12-02T08:52:35Z. --- | Metric (retail world load, 128-batch windows) | Before | After | | --- | ---: | ---: | | Startup upload buffer allocs (`t ≈ 20 s`) | `85.9 ms` (`12` misses / `239 MB`) | **`29.9 ms` (`7` misses / `95 MB`)** | | Load phase `take` misses (`t = 21..102 s`, 9 windows = 1,152 batches) | `158.0 ms` (`11` misses / `352 MB`) | **`0.0 ms` (`0` misses)** | | Heavy in-world `take` misses (`t = 106..119 s`, 384 batches) | `309.4 ms` (`31` misses / `554 MB`, pre-reclaim only) | **`70.2 ms` (`15` misses / `107 MB`, 4.4× faster)** | | Idle upload buffer cap (`XCL_UPLOAD_KEEP_MB`, default `64 MiB`) | `64 MiB` | **`64 MiB` (unchanged)** | **What is in it** - `crates/xcl/src/hle/d3d12x/title_textures.rs`: in `submit_on`, non-blockingly reclaim already-completed upload jobs (`reclaim(q, u64::MAX, 0)`) into `texture_upload::FREE` via `return_for_reuse` *before* calling `texture_upload::submit` -> `take()`, instead of only reclaiming *after* `submit` (which previously forced `take()` to allocate a new 32 MiB staging buffer while a completed 32 MiB buffer sat in `q.in_flight`, then immediately dropped the old one). An RAII `TrimGuard` declared before the queue lock guarantees `texture_upload::trim_free()` always runs outside the queue lock even on early returns or errors. - `crates/xcl/src/hle/d3d12x/texture_upload.rs`: split `give_back` into `return_for_reuse` + `trim_free` and refine `trim_free` eviction (`pick_eviction_victim`): (1) drop oversized one-off bursts (`> 32 MiB`, above `BATCH_BYTES`) largest-first, (2) drop duplicate size classes on the same device largest-duplicate-first so one buffer per normal power-of-two size class (`32 + 16 + 8 + 4 + 2 + 1 = 63 MiB <= 64 MiB`) stays resident simultaneously without repeatedly evicting the sole `32 MiB` batch buffer, and (3) fall back to largest remaining when `XCL_UPLOAD_KEEP_MB < 64`. Adds pure unit test `free_eviction_drops_oversized_bursts_and_duplicates_before_unique_normal_sizes`. **Tested** - Hardware: AMD Radeon RX 6650 XT 8 GB (RDNA2, driver `32.0.21045.29003`), AMD Ryzen 7 5700X, Windows 11 x64, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, debug tests + release smoke. - `cargo test --lib -p xcl hle::d3d12x::texture_upload::tests:: -- --test-threads=4`: **13 passed, 0 failed** (including `free_eviction_drops_oversized_bursts_and_duplicates_before_unique_normal_sizes`). - `cargo test --workspace --no-fail-fast -- --test-threads=4`: **2,959 passed, 13 pre-existing failed, 49 ignored** (identical pre-existing failures to clean `origin/amd-dev` `41aa60ce`). - Matched 160 s retail world-load profiling (`T6-PROF` sub-timers): eliminated all `11` load-phase `take` misses across 1,152 consecutive batches (`158.0 ms -> 0.0 ms`) and cut heavy in-world `take` misses by 4.4× (`309.4 ms -> 70.2 ms`). **Regression run** Base (`main`, required by `pr_check.py`): ``` xcl-smoke v1 commit: d8bd9a38204667f3ca7dd9eeffcc2f1c937b07b0 gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 15479 MB ``` Base (`origin/amd-dev` merge base): ``` xcl-smoke v1 commit: 41aa60ce842060a597b7e8724896f7bf6a031af5 gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 15902 MB ``` PR head (`cfb59651`): ``` xcl-smoke v1 commit: cfb596517c1e1b4ec182dadcce62bf3c3551fcdd gpu: AMD Radeon RX 6650 XT title: 1778c2d9 seconds: 60 exit: 0x0 frames shown: 1654 (PresentX 1654) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16146 MB ``` **Not tested** - NVIDIA and Intel GPUs, and Wine. **AI use** - Antigravity (Gemini 4 Neon High) profiled `texture_upload` + `submit_on` on the retail workload, implemented pre-reclaim and duplicate-aware `FREE` trimming with unit tests, ran the workspace GPU suite and 60 s smoke, and drafted this PR description.
Foniass commented 2026-12-02 08:58:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T08:58:06Z.


Review (head cfb59651, diff read, not a merge-check):

  • The pre-reclaim in submit_on has no test. The only new test covers pick_eviction_victim (texture_upload.rs ~1572). Nothing tests the new reclaim(q, u64::MAX, 0) + return_for_reuse before texture_upload::submit (title_textures.rs ~3435): neither that a completed in-flight job's buffer is reused by the next submit_on, nor that a job whose fence has not completed stays in in_flight. The existing submit_on GPU tests (~5180, ~5395) have the setup to check that a second upload after a completed one gets the same buf.
  • Two separate default-path changes in one PR. Reclaiming completed jobs before take() (~3432) and the new trim_free eviction order (texture_upload.rs ~928-968) are independent and both always on; the description's own table measures them separately (its in-world "Before" is "pre-reclaim only", not amd-dev). The eviction order now drops many small duplicate buffers before a unique 32 MiB one, which changes what stays resident for every title; as its own PR each could be measured against amd-dev and reverted alone.

Fine: the pre-reclaim uses the same fence check as the existing post-submit reclaim: with cap = u64::MAX and wait_ms = 0, reclaim only pops jobs whose fence has completed, so it never hands back a buffer the GPU still reads; TrimGuard is declared before slot, so trimming runs after the queue lock is released on every exit path; the idle cap is unchanged and the new FREE locking under the queue state does not invert any lock order.

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

<!-- greyfinch-sync:ivall/xcl:comment:7340176210 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3678#issuecomment-7340176210). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T08:58:06Z. --- Review (head cfb59651, diff read, not a merge-check): - **The pre-reclaim in `submit_on` has no test.** The only new test covers `pick_eviction_victim` (`texture_upload.rs` ~1572). Nothing tests the new `reclaim(q, u64::MAX, 0)` + `return_for_reuse` before `texture_upload::submit` (`title_textures.rs` ~3435): neither that a completed in-flight job's buffer is reused by the next `submit_on`, nor that a job whose fence has not completed stays in `in_flight`. The existing `submit_on` GPU tests (~5180, ~5395) have the setup to check that a second upload after a completed one gets the same `buf`. - **Two separate default-path changes in one PR.** Reclaiming completed jobs before `take()` (~3432) and the new `trim_free` eviction order (`texture_upload.rs` ~928-968) are independent and both always on; the description's own table measures them separately (its in-world "Before" is "pre-reclaim only", not `amd-dev`). The eviction order now drops many small duplicate buffers before a unique 32 MiB one, which changes what stays resident for every title; as its own PR each could be measured against `amd-dev` and reverted alone. Fine: the pre-reclaim uses the same fence check as the existing post-submit reclaim: with `cap = u64::MAX` and `wait_ms = 0`, `reclaim` only pops jobs whose fence has completed, so it never hands back a buffer the GPU still reads; `TrimGuard` is declared before `slot`, so trimming runs after the queue lock is released on every exit path; the idle cap is unchanged and the new `FREE` locking under the queue state does not invert any lock order. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-02 12:31:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T12:31:57Z.


merge-check
base: 41aa60ce84
head: cfb596517c
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2962 passed, 9 failed, 49 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 amd-dev); failing: gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu, gpu::recomp::tests::gpu_fract_f32_edges, hle::d3d12x::sparse::tests::private_physical_pages_reach_the_gpu_on_mapping, hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, hle::d3d12x::title_textures::tests::remapped_pages_are_compared_with_what_they_held, hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones (the same tests fail on amd-dev 41aa60ce alone on this card, so none is from this PR)
review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3678#issuecomment-7340176210 and its findings stand. Most serious: nothing tests the new default-path pre-reclaim in submit_on (~3432), and two independent default-path changes share one PR.
performance: 60 s smoke of a retail title, amd-dev 41aa60ce vs this merge (cfb59651): 1671 -> 1635 frames shown (97 %; last presents per 2 s: 60 60 60), peak commit 16722 -> 16795 MB, 0 device removals, 0 crashes.
verdict: not yet: nothing tests the new default-path pre-reclaim in submit_on (~3432), and two independent default-path changes share one PR (see the review)
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:7345479080 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3678#issuecomment-7345479080). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T12:31:57Z. --- merge-check base: 41aa60ce842060a597b7e8724896f7bf6a031af5 head: cfb596517c1e1b4ec182dadcce62bf3c3551fcdd merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2962 passed, 9 failed, 49 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 amd-dev); failing: gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu, gpu::recomp::tests::gpu_fract_f32_edges, hle::d3d12x::sparse::tests::private_physical_pages_reach_the_gpu_on_mapping, hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, hle::d3d12x::title_textures::tests::remapped_pages_are_compared_with_what_they_held, hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones (the same tests fail on amd-dev 41aa60ce alone on this card, so none is from this PR) review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3678#issuecomment-7340176210 and its findings stand. Most serious: nothing tests the new default-path pre-reclaim in `submit_on` (~3432), and two independent default-path changes share one PR. performance: 60 s smoke of a retail title, amd-dev 41aa60ce vs this merge (cfb59651): 1671 -> 1635 frames shown (97 %; last presents per 2 s: 60 60 60), peak commit 16722 -> 16795 MB, 0 device removals, 0 crashes. verdict: not yet: nothing tests the new default-path pre-reclaim in `submit_on` (~3432), and two independent default-path changes share one PR (see the review) 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.
grathepic commented 2026-12-03 02:31:22 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grathepic on 2026-12-03T02:31:22Z.


merge-check claim
head: cfb596517c

<!-- greyfinch-sync:ivall/xcl:comment:7365555003 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3678#issuecomment-7365555003). Originally posted by [grathepic](https://github.com/grathepic) on 2026-12-03T02:31:22Z. --- merge-check claim head: cfb596517c1e1b4ec182dadcce62bf3c3551fcdd
grathepic commented 2026-12-03 03:08:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by grathepic on 2026-12-03T03:08:03Z.


merge-check
base: 41aa60ce84
head: cfb596517c
merge: clean
build: cargo build --workspace -> ok (cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace; 46 pre-existing lib warnings, 0 new)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2960 passed, 10 unique failed (12 including 2 nested child-process summaries), 49 ignored; SKIPPED: 27 (19 no wave64, 3 per-lane form refused (#1426 semantics), 2 no heap windows, 1 no dxil.dll, 1 no GPU_UPLOAD heaps, 1 cannot disable the driver cache (Windows Developer Mode required)); failing: gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, gpu::recomp::tests::gpu_fract_f32_edges, hle::d3d12x::sparse::tests::private_physical_pages_reach_the_gpu_on_mapping, hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, hle::d3d12x::title_textures::tests::remapped_pages_are_compared_with_what_they_held, hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads, hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload, hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (gpu_two_pass_cache_e2e) — all 10 ran and failed identically on clean origin/amd-dev (41aa60ce) alone (0 new failures). All 13 hle::d3d12x::texture_upload::tests:: passed in 3.42 s (0 skips), including free_eviction_drops_oversized_bursts_and_duplicates_before_unique_normal_sizes.
title run: none (no retail title folder on this machine; runtime change in crates/xcl/src outside tests still needs an in-world run)
review: Read full diff (crates/xcl/src/hle/d3d12x/texture_upload.rs +71/-2, title_textures.rs +25/-4) and surrounding code.

  1. Blocking — missing test coverage for new default-path logic: only pick_eviction_victim is tested. Nothing tests submit_on's pre-reclaim (reclaim(q, u64::MAX, 0) + return_for_reuse before texture_upload::submit), verifying that a completed in-flight job's buffer is reused before allocating a new one, that an incomplete job stays in in_flight, or that TrimGuard trims excess buffers on early return/error.
  2. Blocking — scope: bundles two independent always-on default-path changes in one PR (pre-reclaiming completed jobs before take(), and changing trim_free() from largest-first to duplicate-aware size-class eviction), which the PR's own measurement table evaluates separately.
  3. Correctness & lock safety (no bugs found): reclaim(q, u64::MAX, 0) breaks immediately on the first incomplete fence without sleeping and only pops completed jobs; TrimGuard is declared before slot, so slot is always dropped before trim_free() runs on every exit path, preserving lock order (slot -> FREE -> SPARE) and dropping D3D12 buffers outside locks; NORMAL_MAX (32 << 20) matches BATCH_BYTES in title_textures.rs. Minor non-blocking nit: in title_textures.rs:3459-3463, return_for_reuse(retired) still locks FREE even when retired is empty and only trim.0 is true.
  4. Duplicates: searched open/merged PRs and #1607 groups before and after testing; no duplicate found (#3050 adds XCL_UPLOAD_KEEP_MB, #2912 handles cross-queue reclaim and q_release cleanup).
    performance: idle upload cap (XCL_UPLOAD_KEEP_MB, default 64 MiB) is unchanged, so peak idle staging memory does not increase; pre-reclaim avoids an extra transient allocation when a completed buffer sits in in_flight; pick_eviction_victim is O(n^2) over FREE entries (tiny N under 64 MiB cap) and changes which size classes remain resident by default (unmeasured on a retail title here).
    verdict: not yet: missing test coverage for the new default-path pre-reclaim / TrimGuard in submit_on, bundles two independent default-path changes in one PR, and no retail title run on this machine
    hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), rustc 1.98.1 (48a229cea 2026-09-01, 1.98.1-x86_64-pc-windows-msvc), DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon
<!-- greyfinch-sync:ivall/xcl:comment:7366236575 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3678#issuecomment-7366236575). Originally posted by [grathepic](https://github.com/grathepic) on 2026-12-03T03:08:03Z. --- merge-check base: 41aa60ce842060a597b7e8724896f7bf6a031af5 head: cfb596517c1e1b4ec182dadcce62bf3c3551fcdd merge: clean build: cargo build --workspace -> ok (cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace; 46 pre-existing lib warnings, 0 new) tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2960 passed, 10 unique failed (12 including 2 nested child-process summaries), 49 ignored; SKIPPED: 27 (19 no wave64, 3 per-lane form refused (#1426 semantics), 2 no heap windows, 1 no dxil.dll, 1 no GPU_UPLOAD heaps, 1 cannot disable the driver cache (Windows Developer Mode required)); failing: `gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu`, `gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk`, `gpu::recomp::tests::gpu_fract_f32_edges`, `hle::d3d12x::sparse::tests::private_physical_pages_reach_the_gpu_on_mapping`, `hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels`, `hle::d3d12x::title_textures::tests::remapped_pages_are_compared_with_what_they_held`, `hle::d3d12x::title_textures::tests::stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads`, `hle::d3d12x::title_textures::tests::stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload`, `hle::d3d12x::title_textures::tests::stream_recheck_schedule_catches_late_writes_and_resets_milestones`, `two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs` (`gpu_two_pass_cache_e2e`) — all 10 ran and failed identically on clean `origin/amd-dev` (`41aa60ce`) alone (0 new failures). All 13 `hle::d3d12x::texture_upload::tests::` passed in 3.42 s (0 skips), including `free_eviction_drops_oversized_bursts_and_duplicates_before_unique_normal_sizes`. title run: none (no retail title folder on this machine; runtime change in `crates/xcl/src` outside tests still needs an in-world run) review: Read full diff (`crates/xcl/src/hle/d3d12x/texture_upload.rs` +71/-2, `title_textures.rs` +25/-4) and surrounding code. 1) Blocking — missing test coverage for new default-path logic: only `pick_eviction_victim` is tested. Nothing tests `submit_on`'s pre-reclaim (`reclaim(q, u64::MAX, 0)` + `return_for_reuse` before `texture_upload::submit`), verifying that a completed in-flight job's buffer is reused before allocating a new one, that an incomplete job stays in `in_flight`, or that `TrimGuard` trims excess buffers on early return/error. 2) Blocking — scope: bundles two independent always-on default-path changes in one PR (pre-reclaiming completed jobs before `take()`, and changing `trim_free()` from largest-first to duplicate-aware size-class eviction), which the PR's own measurement table evaluates separately. 3) Correctness & lock safety (no bugs found): `reclaim(q, u64::MAX, 0)` breaks immediately on the first incomplete fence without sleeping and only pops completed jobs; `TrimGuard` is declared before `slot`, so `slot` is always dropped before `trim_free()` runs on every exit path, preserving lock order (`slot` -> `FREE` -> `SPARE`) and dropping D3D12 buffers outside locks; `NORMAL_MAX` (`32 << 20`) matches `BATCH_BYTES` in `title_textures.rs`. Minor non-blocking nit: in `title_textures.rs:3459-3463`, `return_for_reuse(retired)` still locks `FREE` even when `retired` is empty and only `trim.0` is true. 4) Duplicates: searched open/merged PRs and `#1607` groups before and after testing; no duplicate found (`#3050` adds `XCL_UPLOAD_KEEP_MB`, `#2912` handles cross-queue reclaim and `q_release` cleanup). performance: idle upload cap (`XCL_UPLOAD_KEEP_MB`, default 64 MiB) is unchanged, so peak idle staging memory does not increase; pre-reclaim avoids an extra transient allocation when a completed buffer sits in `in_flight`; `pick_eviction_victim` is O(n^2) over `FREE` entries (tiny N under 64 MiB cap) and changes which size classes remain resident by default (unmeasured on a retail title here). verdict: not yet: missing test coverage for the new default-path pre-reclaim / `TrimGuard` in `submit_on`, bundles two independent default-path changes in one PR, and no retail title run on this machine hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), rustc 1.98.1 (48a229cea 2026-09-01, 1.98.1-x86_64-pc-windows-msvc), DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3678:upstream-pr/3678'
git switch 'upstream-pr/3678'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'amd-dev'
git merge --no-ff 'upstream-pr/3678'
git switch 'upstream-pr/3678'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --ff-only 'upstream-pr/3678'
git switch 'upstream-pr/3678'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --no-ff 'upstream-pr/3678'
git switch 'amd-dev'
git merge --squash 'upstream-pr/3678'
git switch 'amd-dev'
git merge --ff-only 'upstream-pr/3678'
git switch 'amd-dev'
git merge 'upstream-pr/3678'
git push origin 'amd-dev'
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!3678
No description provided.