D3D12.X: XCL_UPLOAD_KEEP_MB sets the idle texture upload buffers kept #3050
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3050"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-27T17:54:36Z.
XCL_UPLOAD_KEEP_MBbounds completed texture-upload buffers retained for reuse (0–4096 MiB, default 512). Active buffers remain owned until completion. The activity log separates idle upload memory from submitted buffers awaiting reclaim. This addresses retained system-memory upload heaps; it does not cap live textures, VRAM or total process commit.Part of #2688; related to #2912's in-flight upload reclamation. This refreshes the existing proposal on
nvidia-dev54225f5884a94cd23b7aab3f703a7c975070aa77rather than opening another PR. Currentmaine429936c10a5b8aa09470ff99dfc8c8d3d8c56fduses a different uploader and does not contain this idle-pool switch.What is in it
Tested
cbb909c08ca786b4ddfeaf95b686aa105bec43e4; Windows x64, debug Rust tests, software WARP device. Commands below use the actual arguments with only the private build-cache path abbreviated as<target>.cargo test --locked -p xcl --lib --target-dir <target> hle::d3d12x::texture_upload::tests::the_idle_upload_buffers_kept_follow_the_switch -- --exact --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored, 0 explicit skips.cargo test --locked -p xcl --lib --target-dir <target> hle::d3d12x::texture_upload::tests::idle_upload_limit_releases_buffers_and_keeps_reusable_ones -- --exact --nocapture --test-threads=1: 1 top-level test passed, 0 failed, 0 ignored, 0 explicit skips; two child cases each passed separately. Nested summaries are not added to the top-level count.Regression run
Pending for this head. Previous-head smoke blocks and whole-suite results are historical and do not establish validation of this revision. Keep this PR a draft.
Not tested
AI use
Original implementation by Claude Code (Claude Opus 5.5), as recorded in the previous revision. Codex (GPT-6) rebased it, added the functional fixture/documentation, reviewed current-main overlap, and ran the focused checks above. Earlier contributors' results are not presented as new runs.
Optional temporary contributor/testing coordination: https://discord.gg/6B4TykyC4W
Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-27T18:39:14Z.
I tested the idle upload-buffer cap at
d6d529c2on Windows 11 with Microsoft WARP. I ran the same test binary in three fresh processes. Each run submitted two RGBA8 upload jobs, waited for their completion fences, then returned the 1 MiB buffer to the idle pool followed by the 2 MiB buffer.With the 1 MiB cap, the next small upload reused the same buffer. Idle capacity dropped to zero while it was checked out and returned to 1 MiB after its fence completed. All three runs passed byte-for-byte readback checks for both textures and the subsequent refresh, with zero skips. These measurements cover idle buffer capacity on WARP. I didn’t measure process memory, physical GPU performance, or loading in the retail game.
I used OpenAI Codex with GPT-6.2 Sol to write and run the test. A separate GPT-6.2 Sol agent verified the artifact and logs. GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-27T18:53:06Z.
Exact production
d6d529c2f7verified on RTX 4060 Laptop/Wine 11, with only a local test fixture added to texture_upload.rs.cargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib idle_upload -- --nocapture --test-threads=1: 2/2 pass, 0 ignored, 2.53 s after fresh intended-worktree compile32.86 s. Includes the owner's parser/policy test and a new three-child real-GPU consumer fixture. Each child independently initializes the once-read setting and requires NVIDIA vendor0x10de/non-software through the actual D3D12 device's adapter LUID.A 64x64 R8 upload plus 1024x1024 RGBA8 burst allocate 1 MiB and4 MiB staging jobs, neither counted idle while checked out. Both jobs are returned only after real queue-fence completion:
All GPU texels remain correct after trimming. A second differently patterned small upload reuses the original smallest-fitting buffer when retained; with zero retention it still returns every correct byte. The large texture remains intact after this subsequent upload. Device remains healthy in all three fresh processes. No fake fence completion or shader dispatch.
This verifies the actual allocated idle-pool cap and data correctness, not OS resident-RAM reduction, in-flight retirement under a stalled GPU, native Windows, title memory peaks, or improved frame times. Lowering the cap can increase allocation churn/stutter; no new default recommended without matched real loading measurements. The fixture's retained-capacity figures are not RSS.
Linux6.17/i7-13620H/16 GiB RAM/8 GiB VRAM, NVIDIA590.48.1, masking disabled; diagnostic-relaxed-vtable vkd3d2576c0b4adfae4a+, not stock certification. All guards unchanged. GPUpeak238 MiB, availableRAM minimum9120.3 MiB. Evidence
.compat-runtime/logs/verify-xcl3050-idle-pool-texels-20261127T184950Z/.Next useful owner measurement: matched burst/reuse workload or loading trace with allocation count and frame-time tails at a smaller retention cap, separating idle capacity from pending uploads and actual resident memory.
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-27T19:33:59Z.
I checked the activity-line wording on RTX 5070 / NVIDIA 616.92 at head
d6d529c2f7d725f12b157aeb25fe59513dc390f4with a test-only fixture using the production upload queue andupload_line.A queue fence held the upload until released. While its upload fence was incomplete, the line reported
0 MB idle / 1 MB the GPU has not read yet. After signaling the gate and waiting for the actual upload fence to complete, but before another upload or reclamation, the line was unchanged. The texture readback matched all 4,096 expected bytes. After invoking the production reclaim function, the line changed to1 MB idle / 0 MB the GPU has not read yet.The focused test passed with no skips. The queued count therefore includes completed staging buffers awaiting reclamation; it is not an exact measure of bytes the GPU still has to read. Wording such as “submitted upload buffers awaiting reclamation” would distinguish that accounting from fence progress. This is an activity-reporting observation, not an upload corruption or process-memory measurement.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the fixture; Codex reviewed and prepared this report.
Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-27T21:26:06Z.
Thanks to all three of you. @Gevroska and @pickles976: agreed, the default stays at 512 MiB until a loading run with a smaller cap measures allocation churn and frame-time tails. The run in the description only measured what's kept idle (378 MB at 277 s).
@andrewDoing: right, the second number includes finished uploads that are waiting for the next reclaim.
94b7a070now words it as "submitted and not taken back yet". The new head's suite and smoke are in the description.AI use: Claude Code (Claude Opus 5.5) wrote this reply; Prime posted it.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-28T08:54:25Z.
Tested
Exact
cbb909c08ca786b4ddfeaf95b686aa105bec43e4on native Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC debug. I reran the pinned libtest after verifying all 386 original Git blobs and reconstructing the private test insertion in memory.I ran
<libtest.exe> hle::d3d12x::title_textures::tests::warp_upload_accounting_until_reclaim --exact --nocapture --test-threads=1in two fresh processes withXCL_ADAPTER=warp,XCL_NETWORK=0, andXCL_UPLOAD_KEEP_MB=0then2. Both processes identified Microsoft Basic Render Driver (1414:008c) with the DXGI software flag and matching adapter and D3D12 device LUIDs.0 MB idle, 1 MB submitted and not taken back yet.0x77, and both device health checks returnedS_OK.2 passed, 0 failed, 0 ignored, 0 runtime skips. Both native processes exited 0, with 1,808 tests filtered out each.
Not tested
Physical GPUs, cross-queue or queue-release behavior, pool reuse, process memory, timing, retail smoke, or the full suite.
AI use
T3 Code through the Codex harness (
gpt-6.2-sol) verified the source and executable, reran the two tests, and wrote this report.Imported from ivall/xcl. Originally posted by Gevroska on 2026-11-28T12:14:27Z.
Thanks, Prime. On my RTX 3080, lowering the cap from 512 to 128 MiB reduced peak sampled idle upload capacity from 504 to 124 MiB and increased staging-buffer allocations from 15 to 64 during loading. I’d keep the 512 MiB default. The allocation trade-off showed up clearly, but the two runs didn’t isolate the cap’s effect on frame times.
I used the same instrumented build based on
94b7a070, identical starting DXIL caches, and a 20-minute window after Confirm in each run. The PR has since advanced tocbb909c0. The timing samples below are intervals between host presents during loading.All 59 evictions at 128 MiB occurred about 60–140 seconds after Confirm. Present intervals were already longer in that run during the first 45 seconds, before its first eviction. The p99 ordering also changed with the observation window: over the first 90 seconds, p99 was 657.1 ms at 128 MiB and 1,116.4 ms at 512 MiB. I wouldn’t attribute the higher full-window p99 to the smaller cap from this pair alone.
An initial 512 MiB attempt hit
DXGI_ERROR_DEVICE_HUNGabout 48 seconds after Confirm. The completed pair was the 128 MiB run followed by a fresh 512 MiB repeat. Both completed runs exited on schedule without a crash or device removal. Both stopped presenting during loading, and neither showed gameplay.I used OpenAI Codex with GPT-6.2 Sol to implement and calibrate the measurement and run the comparison. A separate GPT-6.2 Sol agent verified the saved evidence. GPT-6.2 Astra drafted this comment.
I reviewed and approved this comment before posting.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T04:00:09Z.
Current-main integration check for #3050 head
cbb909c0against mainfa204595: Git merged without a text conflict, butcargo check -p xcl --all-targetsfails withE0609atupload_line(). Main changedON_QUEUEvalues toArc<Mutex<Option<QueueUploads>>>; the PR still readsq.bytesdirectly.I revised my earlier suggested adaptation after checking its lock behavior. Cloning queue handles under the registry lock fixes compilation, but blocking on each queue state can pause the shared activity/PSO-pressure sampler while upload reclamation waits on the GPU, for up to 10 seconds in that path. The uncommitted candidate below uses
try_lock. If any queue is busy, it reports the submitted total as unavailable for that sample instead of silently undercounting it. The upload cap and PSO-pressure inputs are unchanged. This is a source-proven contention path, not a measured frame-rate claim. The sampled total is approximate across queues.The new
upload_line_does_not_wait_for_a_busy_queueregression failed with my earlier blocking-lock adaptation (0 passed, 1 failed, timeout), then passed with the candidate. On the combined, uncommitted tree,cargo check --offline --locked -j 4 -p xcl --all-targetspassed;cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::title_textures::tests:: -- --test-threads=4recorded 64 passed, 0 failed, 1 ignored;cargo test --offline --locked -j 4 -p xcl --lib idle_upload -- --test-threads=1recorded 2 passed, 0 failed, 0 ignored. Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D. The candidate also corrects the README wording: a submitted buffer may be GPU-complete yet still await reclamation.I have not run the full workspace suite or paired clean-commit title smoke for this uncommitted integration. The author should rebase, apply or adapt the diff, and run those gates on the clean new head.
Current-main integration and nonblocking diagnostic diff
AI use: Codex (GPT-6.2 Sol) reproduced the compile and lock-wait failures, wrote the candidate and regression, and ran the checks; Codex (GPT-6.2 Astra) reviewed the queue-state and sampling invariants.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T22:38:31Z.
merge-check
base:
beeb81be4b(merges cleanly as text, but fails to compile on main)head:
cbb909c08cmerge: clean as text, fails to build on main
build: fails as posted — title_textures.rs upload_line sums q.bytes over ON_QUEUE, whose values on main are per-queue Arc<Mutex<Option>> (QueueUploadState). Adapted locally to read each queue under its own lock after releasing ON_QUEUE; then builds ok.
tests: with local adaptation, non-GPU lib tests of touched modules (texture_upload 5 passed, title_textures 7 passed / 1 ignored). Full workspace suite and WARP child-process test not run.
review: needs rebase onto main for per-queue QueueUploadState. Otherwise diff looks clean: default keep limit unchanged (512 MiB), XCL_UPLOAD_KEEP_MB capped at 4096.
performance: default unchanged (512 MiB); one activity line every 20 s. Tested in a combined 600 s retail run on main
beeb81be+ 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR.verdict: not yet: does not compile on current main (needs rebase for QueueUploadState); full suite not run.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:45:55Z.
Review: COMMENTED
Critical review of current head
cbb909c0. Current-main build blocker despite a text-clean merge:upload_linesumsq.bytesoverON_QUEUE, but main changed its values to per-queueArc<Mutex<Option<QueueUploads>>>; the merged tree fails with E0609. See the current-main integration report. Please rebase and read queue upload state through its lock after releasing the outer map lock, then rerun all-targets check and the WARP upload test. The configurable idle limit is otherwise scoped correctly; it does not bound active allocations. No local Windows run.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:41:35Z.
Review (head
cbb909c0, diff read, not a merge-check; draft withPR descriptionred, so not built or run):upload_linereadsq.bytesfromON_QUEUE, which on main holdsArc<Mutex<Option<QueueUploads>>>(title_textures.rs~2551-2555). CI passed only against nvidia-dev54225f58, before the base changed to main. A fix that locks each queue's state would block the log thread whilesubmit_onholds it (up to 10 s inreclaim); a try-lock or a separate counter avoids that.XCL_UPLOAD_KEEP_MB(64MB,-1) silently falls back to 512; worth a log line.submit_on->give_backwith the fixedFREE_BYTES= 512 MiB (texture_upload.rs~795), exactly what this makes configurable (and the right place for the trimming #3194 attempted). No smoke blocks.Fine: only buffers whose fences completed reach the pool, so trimming is safe; the default stays 512 MiB; parsing and the 4096 cap are right; the tests run in separate WARP processes and fail without the switch.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T17:10:17Z.
Test report (not a merge-check: draft,
PR descriptionred)base:
b2b1f109d2head:
cbb909c08cmerge: clean (no textual conflict)
build: cargo build --workspace -> failed: error[E0609] at
crates/xcl/src/hle/d3d12x/title_textures.rs~2587,ON_QUEUE.lock().unwrap().values().map(|q| q.bytes): on main eachON_QUEUEvalue is now anArc<Mutex<Option<QueueUploads>>>(per-queue upload state), so there's nobytesfield to read without locking each queue's entry. The upload bookkeeping changed on main since this PR's base, so it needs a rebase onto the per-queue state.tests: not run (no build).
review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3050#issuecomment-7302036696, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: not measured.
assessment: needs a rebase onto current main's per-queue upload state; the findings in my review stand
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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.