D3D12.X: tiny sampled textures take 4 KiB heap slots, not 64 KiB tiles #1248
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1248
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1248"
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?
@AmYisael on GitHub · 2026-11-24 13:43 UTC · original
AmYisael:small-textures-4k→main· +277 −2 · 1 files · 1 commits · openA sampled texture of at most 4 KiB that sits inside one 64 KiB page of the title's address (no page boundary within it) gets a whole 64 KiB "extra" tile on the title-texture pages (
vram::Pages, keyed by its address). While a retail game loads its world it makes ~12 000 views by address of 16x4 R16G16B16A16_FLOAT textures of 1–2.5 KB each: 768 MiB of tiles for 20 MiB of textures (counted with a local log line, not in this PR). Part of #320.What is in it
vram.rs:place_pagesfirst triesplace_small. A texture of ≤ 4 KiB on the console, single-sample, with no page boundary inside it, that the PC places in 4 KiB (GetResourceAllocationInfowithAlignment = 4096says so) becomes a placed resource in 4 MiB heaps (DENY_BUFFERS | DENY_RT_DS_TEXTURES), one 4 KiB slot per title address. Anything else takes the pages as before.PLACED_TEXTURES, sotitle_texturestreats them as before. A slot no texture uses any more is reused afterCOOL(2 s).XCL_ACTIVITY"target pages N MB (pools M MB)" figure includes the small slots and heaps.small_texture_slots_are_per_address_and_come_back_cooled(no GPU) andsmall_sampled_textures_take_slots_not_pages(GPU: 64 such textures take slots and no pages, a second one at an address shares its slot, two neighbours keep their own texels after a copy in and a read back, one over a page boundary still goes on the pages, released slots come back). It fails withplace_smalltaken out ("small textures took pages").Tested
x86_64-pc-windows-msvc(rustc 1.100.0) and run under GE-Proton11-12's Wine with a vkd3d-proton v3.1 build carrying #257's patch, DXVK's dxgi, DXC 1.9.2609. NVIDIA GeForce RTX 2060 SUPER 8 GB (driver 620.70; main's full-suite run below was on 615.71), Ryzen 5 3600, 16 GB RAM.cargo test -p xcl --lib vram:: title_textures::: 24 passed, 0 failed on 620.70 (includesplaced_title_textures_share_vram_and_preserve_pixels).cargo test --workspace -- --test-threads=4(debug), this branch (same tree as7877001, driver 620.70): lib 643 passed, 57 failed, 21 ignored; e2e 2/1 failed; pls_quota 0/1; predication_e2e 0/1; the rest passed.main(47efa2e), same setup on driver 615.71: lib 642 passed, 56 failed. Same failures apart from the new GPU test, which fails there only on a poisonedVRAM_TEST_LOCK, asd32s8_targets_take_their_own_size_of_video_memorydoes on main. Most failures followgpu_more_atomics_sub_dword_scratch_valu, which hangs the GPU on this stack and leaves the shared device removed.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),gpu_console_textures_upload_every_mip_and_slice,gpu_upload_batches_reuse_the_queues_upload_buffer(no GPU).XCL_PRESS_AT) into its world load,XCL_ACTIVITY=1. Title-texture pages / non-local video memory at the end: main 6963 / 7521 MB (300 s), this PR 4876 / 5381 MB (299 s). Local video memory is full (~7.6 GB) in both, so what the pages save is what spills into system memory. At ~240 s: main 4754 / 5204, PR 4055 / 4609 MB. The runs reach the world load at different times, so single runs vary: another run of the same tree ended at 5645 / 6211 MB. Earlier pairs on 615.71: 6025 → 4424 MB of pages (47efa2e), 5646 → 4500 MB (beaa245).Regression run
Made by a line-for-line bash port of
scripts/smoke.ps1(no PowerShell here), A pressed from 100 s in both runs.peak commitis 0 because Wine reports no private bytes. Not every run here gets to 300 s: on this commit 3 of 4 runs ended with status 0x3 from an abort inside winevulkan / d3d12core (no xcl.exe frame on the stack), the same abort as in earlier runs of main (cedf8ce); on main47efa2eone of three runs was killed at the 13 GB memory cap and one crashed in ucrtbase (read in a GPU view of CPU memory).main:
PR:
Not tested
AI use
@DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
@Chrysana on GitHub · 2026-11-24 15:10 UTC · original
First native Windows / AMD run of
7877001. The memory saving holds, but the stretch after the first A press runs at about two-thirds of main's frame rate on this card.Setup: AMD Radeon RX 9070 XT 16 GB (RDNA4), driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 26200.9974, rustc 1.100.0 MSVC, release. Retail title 1.0.2.1, the same saved state for every run.
main47efa2eagainst this PR's head7877001, which sits directly on47efa2e. Runs alternate main / PR. Every run:XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PRESS_A_AT=20,25,30.Memory (does what it says): 240 s runs into the world load, two each.
+0x23cf683mainThat's about 0.7 GB less in both columns. The world load stalls the same way in all four runs: presents fall to 0 at 110–120 s, memory goes flat, then the title's own stop (#534). So the saving doesn't change how far the load gets here.
Regression: fewer frames after the first A press.
scripts/smoke.ps1 -Seconds 60from each tree, two rounds:Second round:
main1139 frames, PR 832 frames.XCL_ACTIVITY, the 240 s runs). From the first A press (~28 s) to ~56 s, the PR shows 25–42 presents per 2 s in both runs;mainshows 60 in both. Draws per frame are the same (6), so it's the same content drawn more slowly. The stretch lasts ~28 s on the PR against ~19 s onmain, which fits the same frames played slower. In earlier runs with frame captures on this machine, this stretch is the title's intro video. From ~58 s on, both are back at 60.title textures: N uploads left out so farcounter grows more slowly in that stretch on the PR. It reaches 1024 at 41–46 s and 2048 at 57 s, againstmain's ~30 s and ~34 s, about 2.5× fewer skipped uploads per frame even allowing for the lower frame rate. It may be that the small textures in 4 KiB slots no longer get the unchanged-content skip and are uploaded again.Tests on this card: TESTS_PLACEHOLDER
Not tested
AI use
@crosettiremi on GitHub · 2026-11-24 15:21 UTC · original
RDNA3 data point on Windows, RX 7900 XT, driver 32.0.32029.2010. I applied
7877001to main930e8b4and ran the exact hardware test hle::d3d12x::vram::tests::small_sampled_textures_take_slots_not_pages. It passed in 0.26 s with no skip reported, including the 64 distinct addresses, reuse at the same address, and page-boundary fallback. This confirms 4 KiB placement support on this machine. I have no retail frame-time measurement for this PR on RDNA3 yet.@grahamster2 on GitHub · 2026-11-24 16:25 UTC · original
Test report on the retail title, on a 10 GB card. #1182 and #1248 were tested together, in one build. The savings below are for both combined, not split between them.
Builds
main037aecd+ #902 + #751, release.0cf6d08) and #1248 (7877001). Both merged without conflicts.Setup: RTX 3080 10 GB (driver 610.88), Ryzen 5 7600X, 32 GB RAM, Windows 11 26200. Settings:
XCL_NETWORK=0,XCL_PSO_PRELOAD=0,XCL_PSO_WAIT_MS=50. A pressed at 14, 17, 21, 25 and 31 s. Warm DXIL and driver blob caches. One run each. Both runs were stopped at about 100 s by my free-RAM guard (under 0.5 GB of RAM available).Tested
From the
XCL_ACTIVITYmemory line. RAM available isGlobalMemoryStatusExullAvailPhys.XCL_DXC_THREADS=3) and preload on, so this comparison is loose.Not tested
Test report written with Claude Code (Claude Opus 5.5) from my own runs; the extra logging is local only.
@Royalflamejlh on GitHub · 2026-11-24 18:00 UTC · original · edited 2026-11-24 18:06 UTC
Linux (Wine + vkd3d-proton) + NVIDIA test of
7877001onmainb7aa9f3+ #684, 5 alternated runs each way of a retail title on a 12 GB card: 38 s in, after the title has made its small textures, the title-texture pages were about 845 MB smaller and local video memory 836 MB lower with it, in 5 of 5 runs. The frame rate after the A press did not drop here.Setup: Fedora 44 (kernel 7.2.9), Wine 11.21 Staging (Wayland driver), vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch,
VKD3D_CONFIG=ignore_shared_fence. RTX 4070 12 GB (driver 615.71.09, 32-lane waves; the desktop is on it too), Ryzen 9 9950X3D, 64 GB RAM. Release, cross-compiled tox86_64-pc-windows-gnu(rustc 1.98.0), DXC 1.9.2609.5,XCL_NETWORK=0,XCL_PSO_PRELOAD=0,XCL_ACTIVITY=1. Retail title 1.0.2.1, the first-run screens completed once and no story progress, one A press on the account screen at 16 to 18 s.7877001merged ontomainb7aa9f3+ #684 (e56dbc3) without conflicts. The first two runs of each tree were asked for 125 s and ended at the title's watchdog; the other three were 100 s runs.mainis9e3831enow.Tested
cargo test --release -p xcl --libforsmall_texture_slotsandsmall_sampled_texturesunder Wine, on the merge: 2 passed, 0 failed, none skipped. So vkd3d-proton on this card places these textures at 4 KiB.b7aa9f3+ #6847877001game+0x23cf683(the runs that went that far)0x89240009)The readings are those of the
memory:line nearest each time. Between 30 and 38 s the pages grow by about 950 MB without the change and by about 110 MB with it. By 80 s this card is full with or without the change (9.5 GB local; my guess is that this is what the title gets on a card that also holds the desktop), so later the saving shows elsewhere: the pages were 400 to 800 MB smaller, and non-local video memory was 7958 to 8132 MB against 8191 to 8877 MB. The runs end at the stall of #662 either way; a few hundred MB do not move it here.The failed DirectStorage requests are the ones #549 is about. Their count swings between runs of one tree, on both sides, so I do not put the two high first runs with the change down to it.
Read
vram.rs:765(place_small) and:782: a texture only takes a slot when the driver itself answers 4 KiB alignment and at most 4 KiB for it, and otherwise goes to the pages as before (:683). The test's pass above is that path under vkd3d-proton.vram.rs:800: when a slot's new heap cannot be made, the slot is handed back bynext -= 1. That is right whileSMALLstays locked fromtaketo here, which it does. A comment there would save the next reader the check.vram.rs:831(small_bytes): thememory:line's "target pages" now includes the slots in use and "pools" their 4 MiB heaps, so the numbers in the table are like for like.Not tested: past the stall, where the description's 300 s numbers are; a card with free video memory at that point; the preload of #690 on; the rest of the test suite; AMD and Intel.
AI use: Claude Code (Claude Fable 5.2) read the diff, built the trees, ran the tests and the ten runs, compared the logs and wrote this report.
Edited 2026-11-24: removed a paragraph that said three runs without the change logged NVIDIA kernel messages and the runs with it did not. Every run logs the same 12 lines (
_threadNodeCheckTimeout) about 12 s after XCL's process has ended; our harness caught them in some runs only. Also: the third Read point named the wrong log line, and the 9.5 GB remark is now marked as a guess.@madaraXor on GitHub · 2026-11-24 19:40 UTC · original
Measured together with #1182 on a 12 GB RDNA2 card and the retail title (head
787700174of this PR): local video memory at 280 s 6.7 GB instead of 8.6 GB, and under the card from there on, see #1182. I did not run the two apart.AI use: Claude Code, Claude Opus 5.5 ran the runs and wrote this note.
@thiagocalile on GitHub · 2026-11-25 00:49 UTC · original
Tested commit
78770017450281836c811b760a07ffb0401d40d6on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native 64-lane waves) with targeted/workspace tests and a 60 sscripts/smoke.ps1regression run (comparing againstmain62265d3).Tested
32.0.21045.29003;XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test -p xcl --lib vram::tests -- --test-threads=4: 11 passed, 0 failed, 0 ignored (42.81s).XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 739 passed, 4 failed, 41 ignored (54.32s).mainfailures (placed_title_textures_share_vram_and_preserve_pixels+ 2 mutex-poison cascades; #1028), plussmall_sampled_textures_take_slots_not_pageshitting the sameVRAM_TEST_LOCKpoison cascade in the workspace run (it passed in targetedvram::tests: 11/0).Regression run (
scripts/smoke.ps1, 60 s, release build,XCL_ADAPTER=radeon)Base (
main62265d3):PR (
7877001):Not tested
AI use
scripts/smoke.ps1runs on my RX 6600 and drafted this report; I checked the output before posting.@DavidM1911 on GitHub · 2026-11-26 04:32 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.