Repository navigation
Conversation
5 tasks
…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>
Foniass
force-pushed
the
d3d12x-remap-compare
branch
from
November 30, 2026 23:07
041e39e to
2b0ef63
Compare
|
merge-check
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3477 (same file); only the top commit (
2b0ef63e) belongs here.Port of raylitebull's amd-dev commit
02ceae64. WhenCopyPageMappingsBatchXchanges the pages under a texture read through its pages, those 64 KiB pages went up again without comparison, because no write watch fires for a clean pool page newly mapped. In a retail title's open world on amd-dev (RX 9070 XT), about 4,400 textures per 1,024 submits went up again that way, next to 2 GB of uploads.The changed pages are now compared with the hashes of what the PC texture got at its last upload, the same comparison CPU-written pages get, and only those that differ go up. A page whose hash is unknown counts as different. Render targets, UAVs and textures whose GPU write gives way to the mapping still go up without comparison.
XCL_TEXTURE_REMAP_COMPARE=0restores the old behaviour.A main bug this fixes on the way. Main clears
gpu_writtenonce the GPU's bytes are copied back (publish_download), but it kept the page hashes from the upload before the GPU write. A page that later held those old bytes again would look "the same", and the PC texture would keep the GPU's texels. That applies to remapped pages, and already on main to CPU-written ones. A published GPU write now makes the texture's page hashes unknown (texture_upload::unknown). The cost: after a copy-back, the next CPU write to that texture sends it whole instead of only its changed pages. That cost is not measured.What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs: the comparison inmapping_changed/ the upload selection (texture_needs_upload),unknownon a published GPU write, testsremapped_pages_are_compared_with_what_they_heldanda_remapped_page_of_a_texture_the_gpu_wrote_is_not_taken_for_what_it_heldcrates/xcl/src/hle/d3d12x/texture_upload.rs: the hashes used by the comparisonXCL_GPU_WRITE_STAYS(c06cf419) is not ported (main has its own GPU-write copy-back), so its early return is left out; the upload breakdown line is the stacked follow-up.Tested
cargo test -p xcl --lib -- title_textures texture_upload: 77 passed, 0 failed, 1 ignored. Each new test fails without its change: without the comparison, and without theunknown()call.cargo test --workspace --no-fail-fast -- --test-threads=4on 2b0ef63, rebased on main 86e86fc (5070 Ti): 2892 passed, 0 failed, 51 ignored. SKIPPED: 28 notices, almost allno 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.CopyPageMappingsBatchXline says 0 textures read again for a changed mapping.Regression run
main:
this PR:
Not tested
changed(), not an upload on a deviceAI use
XCL_GPU_WRITE_STAYSdependency, found and fixed the stale hashes after a copy-back, wrote the extra test, ran the tests and the smoke runs, wrote this description.02ceae64.🤖 Generated with Claude Code