Skip to content

D3D12.X: log what title texture uploads were for every 1024 submits - #3483

Open
Foniass wants to merge 3 commits into
xcl-dev:mainfrom
Foniass:d3d12x-upload-breakdown
Open

Foniass wants to merge 3 commits into
xcl-dev:mainfrom
Foniass:d3d12x-upload-breakdown

Conversation

@Foniass

@Foniass Foniass commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3482 (and #3477); only the top commit (efc10d43) belongs here.

The diagnostics part of raylitebull's amd-dev 02ceae64, split from #3482. Every 1024 submits that upload title textures, one log line says what went up and for what:

Each kind is given as a count and MB. amd-dev's counts of kept GPU writes are left out, because main has no XCL_GPU_WRITE_STAYS. Whether a texture had a CPU-written page is only worked out for textures already picked to go up, so picking textures costs no more.

What is in it

  • crates/xcl/src/hle/d3d12x/title_textures.rs: the counters and the line

Tested

  • NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.2114), AMD Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug tests, release smoke
  • cargo test -p xcl --lib -- title_textures texture_upload: 77 passed, 0 failed, 1 ignored
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on efc10d4, rebased on main 86e86fc (5070 Ti): 2892 passed, 0 failed, 51 ignored. SKIPPED: 28 notices, almost all no wave64 (the others: no D3D12 debug layer, heap windows off, driver cache needs Developer Mode). The narrower runs listed here are from before the rebase.
  • Retail title: 60 s smoke run below.

Regression run

main:

xcl-smoke v1
commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1608 (PresentX 1608)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15766 MB

this PR:

xcl-smoke v1
commit: efc10d4316ed25a92c755e2fa158e570cc467e20
gpu: NVIDIA GeForce RTX 5070 Ti
title: 3cb1d8e0
seconds: 60
exit: 0x0
frames shown: 1605 (PresentX 1605)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18080 MB

Not tested

  • The line in a long run (it comes every 1024 uploading submits)

AI use

  • Claude Code with Claude Opus 5.5: split the line out of the port and fitted it to main, ran the tests and the smoke runs, wrote this description.
  • Original code: raylitebull's amd-dev 02ceae64.

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) labels Nov 30, 2026
@Aniseto

Aniseto commented Nov 30, 2026

Copy link
Copy Markdown

Ran the upload-logging test groups at 4845a756 on an NVIDIA Blackwell desktop part, with a control run on main.

System

  • GPU: NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, mesh shaders), driver 32.0.16.2140 (621.40)
  • CPU: Intel Core i5-12400F, 64 GB RAM
  • OS: Windows 11 Pro build 26200 x64
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5
  • Build: debug

Results

  • PR head 4845a756, XCL_ADAPTER=NVIDIA cargo test -p xcl --lib texture_upload -- --test-threads=1: 11 passed, 0 failed, 0 ignored.
  • PR head, title_textures: 63 passed, 5 failed, 1 ignored (exit 101).
  • Control main 9dfbe3ea, same title_textures command: 63 passed, 5 failed, 1 ignored (exit 101), with the same five test names.

What this adds
The upload-logging group passes and the title_textures group matches main exactly, so this PR adds no new failure on this host. The author's run listed one failure, standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, which was not part of these focused groups and is not reproduced here. This is the first datapoint from a 5070 Ti on driver 32.0.16.2140 for these groups; no title run was made.

Not tested
A retail title, a paired smoke run, the full workspace suite here, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - ran the commands above on this machine and wrote this report; no game data was used.

@ClosetPie107

Copy link
Copy Markdown

Test report for #3483 at 4845a756db4dc4d96c539c4630667ec4d2b966f9, against its merge-base with main, 53e85fb1, under Wine on AMD.

Tested

Not tested

  • native Windows
  • NVIDIA
  • the gpu:: tests in the suite runs
  • the workspace's other crates and integration tests (only -p xcl --lib)
  • a game run (no regression block)

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

raylitebull and others added 3 commits November 30, 2026 22:43
…hange

`hot_runs` makes a block new to the watched ranges hot. To find those it
kept a set of all blocks (2 MiB) of the ranges of the last look and, each
time the ranges changed, made the set again over every block of every
range while holding `HOT` (the walk thread takes it too). The ranges are
made again whenever a tile is mapped, a texture is placed, a GPU-view page
is shown: in a retail title's world that is ~3.5 GB in 16 ranges, ~1,800
blocks, and the ranges change between many of the submits.

Now `new_blocks` compares the ranges with the last look's (both sorted and
apart, as `watch_ranges` makes them): a range found among the old ones as
it is has no new block, and a block of a changed range is new when no old
range meets it, which is what the set said. 16 ranges with one changed:
4 µs against 1.4 ms for a set of all their blocks (debug build, the test's
own timing; not measured in a release build or a game).

Test: new_blocks_are_those_no_old_range_meets (against a set of all the
old blocks: ranges grown, shifted, merged, new, gone, in part of a block).

Ported from amd-dev without its reasons for a hot block (`HOT_NEW`,
`look_stats::HOT_WHY`), which main does not have: a new block is put in
with its time only, as before.

(cherry picked from commit 5b660277a9460246eca668b144872fe4c66c1594)
(cherry picked from commit 5ff2b66)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pload

When CopyPageMappingsBatchX changed the pages under a texture read
through its pages, those 64 KiB pages went up again with no comparison:
no write watch fires for a clean pool page newly mapped. In a retail
title's open world (RX 9070 XT) about 4400 textures per
1024 submits were read again that way ("25294 read again for a mapping
changed under them" by 127 s), next to 7903 uploads of 2082 MB that took
1890 ms of the 1024 submits.

The changed parts are now compared, page by page, with the hashes of
what the PC texture got at its last upload (the same comparison CPU-
written pages get; a page whose hash is not known differs), and only
pages that differ go up. A page mapped again with the bytes the texture
has (the same page after an unmap, a page moved in its pool) costs a
hash instead of an upload. A render target or UAV texture, and one the
GPU wrote that gives way, still sends its pages with no comparison.
VIctory-Neo does the same: a remapped slot is digested again and only
uploaded when its bytes differ. XCL_TEXTURE_REMAP_COMPARE=0 restores the
old behaviour; on by default.

A line every 1024 submits that upload says what went up and for what:
whole textures, CPU-written pages, remapped pages, parts sent again
behind another queue (count and MB each), how many remapped textures
were compared and left out, and the GPU writes kept by
XCL_GPU_WRITE_STAYS. It gives the breakdown the 2 GB could only be
estimated from before.

Tests: new title_textures::tests::remapped_pages_are_compared_with_what_
they_held. cargo test -p xcl --lib -- title_textures texture_upload:
53 passed, 0 failed (RX 9070 XT). Not measured on the title.

Port onto main: amd-dev's XCL_GPU_WRITE_STAYS (c06cf41) is not on
main, so its early return in mapping_changed and its test are left
out; main's own GPU-write tracking decides instead: a texture whose
gpu_written mark gives way to the mapping still sends its pages with no
comparison. main clears gpu_written once the GPU's bytes are copied
back (publish_download) but kept the hashes of the upload before the
GPU's write, so a page mapped again with those old bytes would have
looked the same and the PC texture kept the GPU's texels: a published
GPU write now makes what the texture's pages held unknown
(texture_upload::unknown), and the next comparison sends all of it. As
a side effect a CPU write to such a texture after the copy-back sends
it whole instead of in parts. The selection follows main's
texture_needs_upload (pages to compare count like parts to send again)
and main's Due (no displaced textures). The upload breakdown line
described above is not in this commit: it is the next one, on its own.
New test title_textures::tests::a_remapped_page_of_a_texture_the_gpu_
wrote_is_not_taken_for_what_it_held (fails without the unknown() call;
remapped_pages_are_compared_with_what_they_held fails without the
comparison). cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib --
title_textures texture_upload: 77 passed, 0 failed, 1 ignored, no
SKIPPED (Windows 11, Ryzen 7 7800X3D with Radeon iGPU, RTX 5070 Ti).
Not measured on a title.

(cherry picked from commit 01ec624f32b33c2f4115f677781432b498471111)
(cherry picked from commit 02ceae6)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A line every 1024 submits that upload says what went up and for what:
whole textures, CPU-written pages, remapped pages, parts sent again
behind another queue (count and MB each), and how many remapped
textures were compared and left out. It gives the breakdown of the
upload volume that could only be estimated before (in a retail title's
open world, 7903 uploads of 2082 MB per 1024 submits on amd-dev), and
shows what the comparison of remapped pages (XCL_TEXTURE_REMAP_COMPARE)
saves.

Split out of amd-dev's 02ceae6 ("compare the pages a mapping changed
under a texture before upload"), which carried this line with the
behaviour change. Port onto main: the line leaves out amd-dev's count
of GPU writes kept by XCL_GPU_WRITE_STAYS (c06cf41), which main does
not have. Whether a texture had a CPU-written page is worked out only
for the textures that go up, after main's texture_needs_upload has
picked them, so the selection itself does no more work. Logging only;
no test. cargo +stable-x86_64-pc-windows-msvc test -p xcl --lib --
title_textures texture_upload: 77 passed, 0 failed, 1 ignored, no
SKIPPED (Windows 11, Ryzen 7 7800X3D with Radeon iGPU, RTX 5070 Ti).
The line was not seen in a title run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Foniass
Foniass force-pushed the d3d12x-upload-breakdown branch from 4845a75 to efc10d4 Compare November 30, 2026 23:07
@Aniseto

Aniseto commented Dec 1, 2026

Copy link
Copy Markdown

Ran the gpu_profile tests at 3ef4593d on an NVIDIA Blackwell desktop part with 16 GB of VRAM.

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

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

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

Both counts match the new test of the description and the three tests in that module at this exact head; the named test passes on this adapter.

Not tested: the full workspace suite, the standalone D3D12 reproduction of the driver bug, a title run with XCL_GPU_PROFILE=1 on a compute queue, an A/B against a build without the change, AMD and Intel GPUs, Wine, native wave64 hosts, release profile, game data.

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

@Aniseto

Aniseto commented Dec 1, 2026

Copy link
Copy Markdown

This supersedes my immediately preceding comment in this thread (#3483 (comment)). That body was the wrong local draft, posted because two publishes shared one temporary file; please disregard it. This is the measured report for efc10d43, a new response on the same thread as my report at 4845a756 (#3483 (comment)); the head moved, so I am not editing that comment.

Ran the title_textures texture_upload groups at the new head efc10d43 on an NVIDIA Blackwell desktop part with 16 GB of VRAM, with a control run on main 7d86c5d2 in a separate target directory.

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

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib -- title_textures texture_upload --test-threads=4   (efc10d43 on main 7d86c5d2)
70 passed; 4 failed; 1 ignored; 2695 filtered out      (exit 101)

same command on main 7d86c5d2 (own CARGO_TARGET_DIR)
70 passed; 4 failed; 1 ignored; 2704 filtered out      (exit 101)

The same four tests fail on both trees: placed_title_textures_share_vram_and_preserve_pixels (assertion left == right failed: row 5: stale shadowed texture corrupted B, at title_textures.rs:6321 here and :6297 on main), plus stream_recheck_keeps_the_whole_upload_baseline_over_partial_uploads (:6624), stream_recheck_partial_upload_without_an_entry_queues_a_whole_upload (:6737) and stream_recheck_schedule_catches_late_writes_and_resets_milestones (:6522), all with PoisonError on a lock after that first panic. The description's 77/0/1 at efc10d43 rebased on 86e86fcb used a different main; on the current main these four fail here too, so the head adds no new failure. The upload-logging tests were not isolated further here.

Not tested: the full workspace suite, the release smoke, a title run, Wine on AMD (where the fault this PR describes happens), the XCL_LIVE_RESERVED path, native wave64 hosts, AMD and Intel GPUs, game data.

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

@Foniass Foniass mentioned this pull request Dec 1, 2026
@fromthemoonx

fromthemoonx commented Dec 2, 2026 •

Copy link
Copy Markdown

merge-check
base: 1c8b551
head: efc10d4
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2912 passed, 0 failed, 51 ignored (base: 2909 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none
review: read this PR's commit efc10d43 on top of #3482 (2b0ef63e) and #3477, which my merge-checks on those PRs cover. No correctness problem found; diagnostics only.

  • The counters are bumped after texture_upload::join, so a texture with nothing to send returns early and is not counted. "Sent again" is only counted when another queue's parts really go up.
  • written is worked out only for textures already picked to go up.
  • Not this PR: hle::d3d12x::title_textures:: and hle::d3d12x::texture_upload:: run together at 4 threads fail texture_upload::tests::an_upload_reads_pages_kept_apart, 3 of 3 on this merge and also on main 1c8b551. It passes alone, and in its own module run. In the whole suite it passed.
  • No test reaches the 1024-submit log line. No retail title on this machine.
    performance: a few relaxed atomic adds per uploaded texture, and one log line per 1024 submits that upload.
    verdict: safe to merge
    hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)

@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) labels Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) needs:amd-test Needs a test report or merge-check on an AMD GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants