Repository navigation
D3D12.X: a view's padding does not make a second texture - #2762
joeypercia wants to merge 1 commit into
Conversation
resource_at makes a placed texture for each new (address, description) of a view the title writes without a resource object (device xcl-dev#70/xcl-dev#71) and keeps it. Its key cleared the padding after the flags but not the padding after Dimension (bytes 4..8). A retail title leaves that set, so the same view made another texture whenever it differed: 24,844 of 80,953 textures in a 200 s run were such twins (GreemSC, xcl-dev#2743). The key now leaves out both. The activity line counts the textures kept. Part of xcl-dev#2743, xcl-dev#2688. Assisted-by: Claude Code (Claude Opus 5.5)
luckyteagirl
left a comment
There was a problem hiding this comment.
On 496ef5780a4549fc3f15bc65340deb1db4794d6b, the new VIEW_TEXTURES activity count uses MADE.len(), but resource_at deliberately caches failed creations as a null pointer. A driver-refused descriptor therefore increases views without a resource: N textures kept even though no texture was created; repeated distinct failures can make this diagnostic grow during the OOM investigation that motivated the PR. Could the count include only non-null cached resources, or call it cache entries and report failures separately? A small map fixture with one successful pointer and one null entry could lock the meaning down. This is exact-head source review; I did not induce a D3D12 creation failure.
AI use: OpenAI Codex (GPT-6.2 Sol) found the count mismatch; OpenAI Codex (GPT-6.2 Astra) independently checked the source and wrote this review.
|
Independent Windows/NVIDIA test of PR #2762 head Tested: RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, DXC 1.8.2502.11. Not tested: a title run, matched smoke, or a measured reduction in texture count, memory, or frame time. The new unit test verifies key normalization; this suite does not by itself measure the retained-resource behavior in a retail workload. AI use: Codex (GPT-6.2 Sol) inspected the diff, ran the commands on the hardware above, and drafted this report. |
|
Linux / AMD test of Tested
Not tested: Windows, NVIDIA, more than one run with the PR, runs past 200 s, a smoke pair on this machine (plain AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the runs and wrote this report. |
|
On native D3D12 with an RTX 4080, changing only padding bytes
An exact repeat and the already-normalized trailing-padding control both reused the original on each revision. A second aligned title-memory address remained distinct. All resources were 64×64 RGBA8 shared-page textures. Tested on RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC, DXC 1.8.2502.11.
|
|
Independent RTX 3090 Ti validation of I replayed the same world transition with the same 11,721 starting native PSO blobs, translated cache seed, runtime settings, GPU timestamps, DRED, and 1 GiB application-specific shader heap profile. The change was the view key normalization and cache-size counter.
The #2762 run reported 41,329 retained view-at entries before removal. The control lacked that counter. The partially executed DRED list completed 56 of 921 operations, with a Dispatch next and no usable shader label for its bound PSO. The fault VA was zero. The last memory sample left about 13,230 MiB of system commit headroom. Neither replay produced a verified world frame. This independently validates coverage of the descriptor padding case. The two retail replays are single samples and do not establish a change in cache cardinality, memory use, or device-removal frequency from this fix. AI assistance was used to run the tests and prepare this report. |
|
Under Wine + vkd3d-proton on an RTX 4070, this pull request kept 31 % fewer textures for views without a resource (GreemSC's RADV run showed 29 to 30 %): 41,136 to 41,369 at 118 s in 3 runs, against 59,564 to 60,240 in 3 runs with the old key. In all 3 runs with it, the title reached the same stop sooner, a burst of about 7,000 dispatches after which nothing is presented: its last presents ended at 64.1 to 66.2 s against 72.0 to 76.2 s, and its first call to Setup:
Not tested: Windows; the title past the point where it stops here; the whole test suite. AI use: Claude Code (Claude Opus 5.5) ran the title and the tests and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
`prepare_placed_srv_desc` and `prepare_placed_uav_desc` key `placed_srvs` / `placed_uavs` by (address, 0x38-byte console resource description) and clear only 0x34.. of it. Bytes 0x04..0x08 are the padding between `Dimension` and `Alignment`; the retail title leaves stack bytes there, so the same view at the same address made a second PC texture (and its views) whenever that padding differed. Both now clear it too. Measured on the retail title (RX 7900 XT, RADV, Wine, amd-dev b5c0275 with the Wine stack), one 200 s run each: `placed_srvs` held 60,925 entries at 190 s without the change and 41,965 with it (-31 %); the same share as main's `resource_at` (#2743, fixed there by #2762). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent desktop NVIDIA verification of PR #2762 at head Environment
Targeted release tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib padding_does_not_make_another_texture -- --nocapture |
1 passed; 0 failed; 0 ignored; 1336 filtered out (0.00s) |
cargo test --release -p xcl --lib hle::d3d12x::real:: (3 consecutive runs) |
61 passed; 0 failed; 0 ignored; 1276 filtered out × 3 (0.35s, 0.36s, 0.37s) |
cargo build --release -p xcl --bin xcl |
Clean build (1m 16s, exit 0) |
Paired quiet 60 s retail smoke (title: 29640639)
Exact parent & merge-base (b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, cached baseline on the same machine):
xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1518 (PresentX 1518)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14018 MB
PR #2762 (496ef5780a4549fc3f15bc65340deb1db4794d6b):
xcl-smoke v1
commit: 496ef5780a4549fc3f15bc65340deb1db4794d6b
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1593 (PresentX 1593)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14005 MB
Runtime log observations (xcl.log)
9249log lines,0[ERROR]/ device-removal / panic lines.- New activity-line counter active throughout the smoke (
37samples): steady atviews without a resource: 540 textures keptby50.2 sthrough58.2 s. - Final draw/memory telemetry in log:
19540 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample14004 MB committed by the process; video memory 6115 MB local, 4684 MB non-local.
Limits of coverage
- View-key padding zeroing (bytes
4..8afterDimensionas well as trailing padding afterFlags) was verified directly viapadding_does_not_make_another_textureand 3×hle::d3d12x::real::, while the 60 s retail smoke exercisedresource_atlive (views without a resource: 540 textures kept) with zero errors or removals. - No multi-minute in-world soak measuring total duplicate-texture reduction vs. an instrumented pre-PR build was performed (the 60 s menu capture verifies clean runtime behavior and telemetry rather than the 200 s world-load count). Frame-count delta vs. the cached parent smoke (
1593vs.1518) reflects normal single-run startup variance and is not attributed to this PR.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
a view's padding no longer makes a second texture (xcl-dev#2743). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#1479 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@joeypercia a 3090 data point for the padding key, from a port, not a test of What differs from the PR (patch 0023): with the switch on, the texture already made for the key is served, which is what the PR's key does. With it off, our tree makes them again as before and counts them. The PR's own test was not run here. Measured (the retail title, one run each, 420 s in the world):
Not credited to the change: in that run the character heads were drawn again (still blue-lit). Later runs showed that on our setup whether characters are whole changes from run to run, from the Not tested
Setup: MacieGx's lab AI use: Claude Code, model Claude Opus 5.5. It wrote the patch, ran the runs, read the logs, and wrote this. The person running these tests asked for this post. |
main gained 345 commits since 753e8b1, most of them bmjask's stack (xcl-dev#2959), plus xcl-dev#2872, xcl-dev#3085 and xcl-dev#3086 from this branch. Conflicts, per PR: - xcl-dev#2404 + xcl-dev#2633 (split chained ExecuteIndirect): main's xcl-dev#2959 took both over (ed98461, a05fbc4, 8626d5b: IndirectBuild/IndirectChain on a CBV root, one-command slicer, separate cache namespace). Main's side kept in dispatch_chain.rs, pso.rs (slicer, command signature, chain root), bind.rs (ExecuteIndirect path), device_x.rs (signature traits), pso_async.rs (no background whole build, so no build_waited_on), real.rs (ComputeBuild, driver_cache names) and shaders.rs (blob names). Dropped with them: slab_count, record_slicer, abi_signature_id names, the direct root-CBV constant blocks, list_x::predicated, the split.rs/runner.rs ExecuteIndirect test and the list_x chain-scratch test. Not in main: xcl-dev#2404 ran the pieces before any whole form was built; main runs the whole form (built on the title's thread) until the indirect set is ready. - xcl-dev#2707 (allocator reclaim): main has it (31930d8, 057f463, 8e7b566). alloc_pool.rs is main's, with xcl-dev#867's changes on top; bind.rs takes main's native_backing; xcl-dev#2707's tests and bind::push_uma_for_test go. - xcl-dev#867 + xcl-dev#2477 (Wine vtables and fences), adapted to main's new code: real.rs keeps the in-place patching, UnadoptGuard and FenceProxy beside main's native_queue_* helpers; guards in cl_reset, bind_pipeline_exact, clear_pipeline_exact, reset_pc_allocator, the title ExecuteCommandLists closure and native_queue_execute; Signal/Wait unwrap the title's fence (also in native_queue_signal/wait); list_x guards in reset_reserved_segment and KickoffX's submit closures; create_raw_fence for main's new internal fences in alloc_pool.rs (SubmissionGate), title_textures.rs, present.rs, vram.rs, sparse.rs, cpu_writes.rs; tests as xcl-dev#2477 had them; runner.rs is main's plus submit_list. - xcl-dev#1803 (heap addresses): kept, carried into main's PreparedSplit and PreparedAbiState (prepared_abi_io takes the heaps). - xcl-dev#1368 (NodeMask 0): kept in compute_container, before main's per-node blob names, so names and pipeline use node 0. - xcl-dev#1860, xcl-dev#2082 (cfg.rs, module/opt.rs): cfg.rs is 1567f72's version (xcl-dev#1860 on main's Succs); opt.rs is that plus xcl-dev#2082's arm and test. - xcl-dev#2229 (rodata): kept through main's kernel.rs entry points; translate_entry_rodata loses wave32_only as main dropped per-GPU tables (3cde0cc); pso.rs and coverage.rs call it with main's options (no_remap, split for graphics); recomp Options keeps rodata and no_remap. - xcl-dev#1975: kept in emit.rs and lower_valu.rs; its mesh barrier guard and its test dropped, main's wider guard (2ca9127) covers it; the now-unused lower::has_non_uniform_barrier goes. - xcl-dev#2070 (64 MB stacks): pso_async::WORKER_STACK on main's worker, helper and preload threads; shaders.rs's piece threads on worker_thread. - xcl-dev#2551 (whole forms prebuilt): split_whole_roots(false) is DirectChain, so the precompile builds every split program's whole form; main built it only for programs an earlier run used through ExecuteIndirect. - xcl-dev#688 (dxc.rs imports), xcl-dev#2762 (host.rs log line), xcl-dev#3090 (list_x tests), arch/window-title-commit (present.rs with_commit on main's compiling_text), README.md: both sides. - list_x.rs: main dropped title_textures::list_reset; main's side. - sparse.rs, vram.rs: main's quarantine_tiles_for and per-device retire state, with create_raw_fence. - xcl-dev#3090, xcl-dev#3092 tests: runner::device and Uma::block_len added from nvidia-dev (5 and 12 lines) so the lib tests compile. - xcl-dev#751: its commit is already in main (b84e037, via xcl-dev#2844); it leaves the README table with xcl-dev#2404, xcl-dev#2633, xcl-dev#2707, xcl-dev#2872, xcl-dev#3085 and xcl-dev#3086. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
#3000 (@voiceovarian1-max) makes the same change (zeroing desc bytes 4..8 and 0x34.. before keying a view-by-address texture), and #1607 lists the two as one. I'm not going to rebase this after the |
|
@joeypercia this conflicts with AI use: Claude Code (Claude Fable 5.2) made the trial merge and wrote this. |
|
#3000 made the same change (zeroing the padding at 0x04..0x08 and 0x34..0x38 of the view-by-address desc before it keys a texture in AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
resource_atmakes a placed texture for each new (address, description) of a view the title writes without a resource object (device #70 / #71,CreateShaderResourceViewAtX/CreateUnorderedAccessViewAtX), and keeps it for later views. Its key cleared the padding after the flags (bytes 0x34..0x38) but not the padding afterDimension(bytes 0x04..0x08). The newer retail title leaves that padding set, so the same view made another texture whenever it differed. @GreemSC counted 24,844 such twins among 80,953 textures in a 200 s run (31 %, #2743). This clears both. Part of #2743 and #2688.There's no eviction here. A version that let earlier textures go when a view covered their memory bounded the count on an RTX 4070 Ti (about 24,000 instead of 62,822 and climbing), but it didn't lower video memory. More than half of what it let go was made again, and its one run ended in the title's own breakpoint. Details are on #2743.
What is in it (one commit,
crates/xcl/src/hle/d3d12x/real.rs,crates/xcl/src/host.rs)view_keyclears both padding ranges of the 0x38-byte description.resource_atkeys its map with it, and passes the cleared description on.views without a resource: N textures kept).padding_does_not_make_another_texture: two descriptions that differ only in their padding give one key, and a change of any other byte (dimension, width, format, flags) keeps them apart. It fails without the change (padding at 0x04).Tested
XCL_ADAPTER=Radeon. Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11. Debug builds for the tests, release for the runs.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on496ef578:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, which fails the same way onmainon this iGPU (DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115).nvidia-devaf2cecc4(1 GiB shader heap, through the world load), the count was 15,773 at 71 s, 42,457 at 121 s and 62,822 at 403 s. I have no count on this card without the change; the 31 % is GreemSC's (AMD / Linux, D3D12.X: resource_at keeps a PC texture for every view-at-address forever (~1 GB a minute on Linux/RADV) #2743).Regression run
RTX 4070 Ti (driver 621.40), release builds, 60 s each,
scripts/smoke.ps1 -Game <folder> -Title retail-titleon the newer retail title, with the same settings. Both ran with the NVIDIA shader-heap profile (#2590, 1 GiB) installed on this machine. The PR's run shared the GPU with a test suite of mine for part of it.mainb49be183(this PR's base) and this PR's head (no uncommitted changes):main:
PR:
Not tested
Dimensionis a 4-byte enum, followed by the 8-byteAlignmentat 0x08, so 0x04..0x08 is padding inD3D12_RESOURCE_DESC.AI use