Skip to content

D3D12.X: report retained texture upload staging capacity - #2862

Draft
jeroenhaentjens wants to merge 1 commit into
xcl-dev:mainfrom
jeroenhaentjens:diagnostics/texture-upload-staging-activity
Draft

jeroenhaentjens wants to merge 1 commit into
xcl-dev:mainfrom
jeroenhaentjens:diagnostics/texture-upload-staging-activity

Conversation

@jeroenhaentjens

@jeroenhaentjens jeroenhaentjens commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2639 and #1833. The queue's reusable texture upload buffer is retained between batches, but its capacity was absent from the world-load memory timeline. This adds a measurement; upload behavior and limits do not change.

What is in it

  • gpu/texture.rs counts backing upload-buffer capacity while batches use it, while queue uploaders keep it idle, and at the combined peak. Growth, drop, and intentional retention after a GPU wait failure are accounted for.
  • host.rs adds one XCL_ACTIVITY line with reserved (zero for this owner), active, idle, and peak-held MiB. The existing memory line is unchanged.

Tested

  • Windows 11 Pro build 26200, Intel i7-9750H, NVIDIA Quadro RTX 3000 (driver 32.0.15.9706), Rust 1.100.0 MSVC, debug.
  • Clean committed head 3f0ed9b: cargo build --workspace --locked succeeded.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 1,446 reported passes, 0 failures, 47 ignored across 38 suites. 29 explicit SKIPPED records: 21 no native wave64, 3 per-lane instruction refusals, 5 other unavailable capabilities or debug-layer checks. Reported passes include skips. Both GPU tests for upload-buffer reuse and large mixed uploads passed.
  • git diff --check passed.

Regression run
Standard setup

Both clean release builds timed out before guest entry while precompiling the title's 26,503 shader records. The 150-second smoke command with a 120-second startup allowance expired after about 270 seconds on each build. XCL did not print the log path needed to produce a smoke block. These attempts predate the controlled AC retest.

Separate runtime diagnostic on AC

Both runs used the same retail title, Quadro RTX 3000, 150-second script, XCL_NETWORK=0, input schedule (15:A,35:A,55:A,75:A), and separate initially empty XCL shader caches. In a separate game directory, the byte-identical shaders.rpf was supplied via XCL's runtime overlay. This gave the guest access to the archive while skipping the host's up-front shader preparation. Both builds were unmodified. Windows reported AC power before and after both runs.

Diagnostic run Frames shown Peak process commit Exit Crashes / device removals
Main 8b957bec6f82495aec940944c6bf47faa02db590 752 15,216 MiB 0x0 0 / 0
PR head 3f0ed9b8b35dba7732bd5b3ba8ab7997b9967079 693 15,216 MiB 0x0 0 / 0

The PR emitted 73 staging samples. The active and idle maxima were each 64 MiB at different samples, and the combined high-water mark was 64 MiB. The default setup still lacks a completed paired smoke test.

Not tested

  • No completed standard-setup smoke pair. The overlay run verifies the activity line during the observed part of the title. Reaching the playable world was not confirmed, and the measured staging peak does not establish a memory reduction.
  • No AMD or native-wave64 GPU was tested during the retail run.
  • Other staging owners, including detile scratch and DirectStorage, are outside this measurement.

AI use

  • OpenAI Codex (GPT-6) selected the scope, wrote the accounting and activity line, inspected lifetime paths, ran the build and tests, and prepared this description.
  • OpenAI Codex (gpt-6.2-sol) ran the retail comparisons and recorded the results above.

Track the upload buffer capacity held by active batches and idle queue uploaders, including the peak across both. This makes the staging owner's contribution to world-load memory pressure measurable without counting texture payload views twice.

The measurement is additive to XCL_ACTIVITY and does not change upload behavior. Full GPU-backed workspace tests passed on the Quadro RTX 3000; no retail smoke run is available yet.

Assisted-by: OpenAI Codex (GPT-6)
@jeroenhaentjens

Copy link
Copy Markdown
Contributor Author

Completed the GTA VI 1.0.2.1 startup run on 3f0ed9b8b35dba7732bd5b3ba8ab7997b9967079 (release build, NVIDIA Quadro RTX 3000). The earlier attempt timed out during shader preparation. This run let preparation finish before starting the 150-second title timer.

  • Texture upload staging peaked at 64 MB held. The final activity sample reported 0 MB reserved, 0 MB active, 64 MB idle.
  • Shader preparation processed 26,503 records in 50,945.7 seconds of elapsed time, including a laptop sleep interval. XCL reported 0 compilation errors and 390 skips (runtime pairing or unsupported translation). It created 2,689 GPU pipelines during preparation, with 0 refused.
  • The title ran for the full 150 seconds. XCL logged 477 frames shown and 477 PresentX calls. The timer ended the run as configured. The report recorded exit code 0 and no crash.

World visibility is unverified. We did not visually verify what those frames contained, so we do not know whether the game world was visible.

@jeroenhaentjens

Copy link
Copy Markdown
Contributor Author

Follow-up to the 477-frame startup run: we completed a standard base/head comparison with frame captures on GTA VI 1.0.2.1 and the Quadro RTX 3000. Both builds used the same game directory, an existing DXIL cache, a fresh title-data directory per run, networking off, a 150-second title timer, scripted A presses at 15/35/55/75 s, and a capture every 30 presents. There was also manual input. The earlier overlay runs and the earlier 477-frame head run are separate observations.

Build Frames shown / PresentX calls Peak sampled process commit Last stage confirmed in captures
Base 8b957bec 1,021 / 1,021 14,911 MiB Illustrated intro
PR 3f0ed9b8 785 / 786 15,342 MiB Illustrated intro followed by the Rockstar logo

Both timers ended as configured with exit code 0 and no recorded crash. We inspected 34 captures from base and 26 from head. The tester also observed responsive keyboard input at player selection. Neither set of captures confirms a playable world. The two runs spent different amounts of time at player selection and reached different points in the intro, so these frame counts and memory samples cannot establish a performance or memory regression.

@JJAutoCompare

Copy link
Copy Markdown

Tested

Clean detached 3f0ed9b8b35dba7732bd5b3ba8ab7997b9967079 on Windows 11 build 26200, Ryzen 7 3800X, Intel Arc A770 (8086:56a0, driver 32.0.101.9175), and Rust 1.100.1 MSVC in the unoptimized test profile. I reran the pinned executable with --exact gpu::texture::tests::gpu_staging_capacity_lifecycle_arc --nocapture --test-threads=1. Its private source extraction adds a #[cfg(test)] fixture to the exact-head production source. I verified the fixture insertion against the source and binary pins.

The fixture called production upload_batch on one D3D12 queue, held completion with a queue fence, and used the stock readback helper. The baseline was zero across all three counters.

Phase Payload (bytes) Gated active / idle / peak (MiB) Completed active / idle / peak (MiB)
Allocate 16,384 4 / 0 / 4 0 / 4 / 4
Grow 4,198,400 8 / 0 / 8 0 / 8 / 8
Reuse 16,384 8 / 0 / 8 0 / 8 / 8

All three uploads remained pending while gated and read back byte-exactly after completion. The smaller reuse batch kept the same 8 MiB backing as the growth batch. 1 passed, 0 failed, 0 ignored, 0 skips. The runtime identified the A770 with XCL_ADAPTER=A770. The native test and GPU lock wrapper exited 0, and the executable SHA-256 held before, under, and after the lock.

Not tested

Release of the last idle uploader, multiple queues, GPU failure paths, other adapters, retail smoke, and the full workspace suite.

AI use

T3 Code / Codex (gpt-6.2-sol) prepared the fixture, independently reran the pinned test, and wrote this report.

@andrewDoing

Copy link
Copy Markdown
Contributor

While reviewing the staging accounting on head 3f0ed9b8, I noticed a pre-existing post-submission ownership asymmetry in upload_batch. After ExecuteCommandLists, a queue.Signal error returns through ? and drops the uploader. If signaling succeeds but the subsequent fence wait fails, the code deliberately retains the uploader because completion is unknown.

I compiled the exact post-submission block with mock queue/fence responses and an observing uploader drop counter:

Simulated outcome after submission Wait called Uploader dropped Cached
Signal and wait succeed Yes No Yes
Signal succeeds, wait fails Yes No No
Signal fails No Yes No

All control assertions passed. On the signal-error path the new counter also decreases when the staging allocation drops, though the test does not show whether any native GPU work remains pending. This ownership behavior predates this PR; it may deserve a separate failure-path fix rather than being attributed to the telemetry change. No actual device removal or retail run was induced.

AI use: OpenAI Codex with GPT-6.2 Astra inspected the path and ran the mock; Codex reviewed and prepared this report.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 3f0ed9b

No open or merged PR adds the same staging-capacity metric (#3050 and #3194 change how many upload buffers are kept; they do not report them).
The accounting in gpu/texture.rs is consistent in the diff: growth, put_back, reuse, Drop on error paths, and the mem::forget path after a failed fence wait, which stays counted as active as the description says.
gpu/texture.rs has changed a lot on main since the base (upload_batch_with_zero_mips and more), so the PR conflicts and needs a rebase. It is still a draft.
Recommendation: keep open.

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

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.

4 participants