Repository navigation
D3D12.X: retire overwritten title textures, evict MADE, and clean up (#248) - #292
heretic1321 wants to merge 2 commits into
Conversation
…memory (ivall#248) A texture the CPU fills (kept in step with title memory) placed at a 64 KiB aligned address is now a reserved resource on 64 KiB pages of video memory, one per page of the title's address, shared by every such texture placed there - as on the console, where a texture placed over another overwrites its memory. A committed PC texture per placement, never let go, held the sum of every texture a streaming title ever placed (12.7 GB over 4.0 GB of its memory at 90 s, then 0x887a0007). - vram: page bookkeeping in a plain Book (unit-tested); textures and GPU-owned targets in separate spaces, so a texture's CPU-view upload never overwrites what the GPU rendered into a target at the same address. - title_textures: uploads oldest placement first (the newest texture's texels win on shared pages); the upload queue waits for tile mappings. - device_x: pages first, committed as before when a texture cannot be reserved (unaligned address, 3D on tier 2, driver refusal). XCL_TITLE_TEXTURE_PAGES=0 turns it off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vall#248) Stacked on ivall#269 (which moves 64 KiB-aligned kept-in-step title textures onto shared 64 KiB pages in vram::Book). What remains after ivall#269: - Overwritten placements stayed registered in title_textures forever, continuing to be scanned/uploaded and holding extra tiles / leftover pages in vram::Book even when a newer texture replaced their memory. - real::resource_at (device ivall#70/ivall#71 by-address SRV/UAV creation) stored every created ID3D12Resource in MADE forever and never released superseded entries (including unaligned committed textures). - Device / queue release did not clear MADE, title_textures state, upload queues, or vram::Pages::waited. - XCL_ACTIVITY memory lines lacked title-texture active/covered/retired/ released counters. This commit adds O(log N + k) overlap retirement in title_textures, detaches retired entries from vram::Book, cools and releases superseded entries in real::resource_at (2 s cooling + MADE_MAX cap), cleans up on device/queue release, and logs title-texture counters on XCL_ACTIVITY. Assisted-by: Antigravity CLI (Gemini 4 Neon)
86a9207 to
bf8e16c
Compare
|
Retail run of
The access violation at No device removal, and no new warning kinds compared with xcl-smoke, 60 sClaude Code (Claude Opus 5.5) ran the tests and wrote this report. No game files attached. |
|
A data point for the retirement part of this PR, on current RX 9060 XT 16 GB, 32 GB RAM, release,
Pages are shared per address on AI use: Claude Code with Claude Opus 5.5 read the run's log and wrote this comment from my run. |
|
From a static review (no builds or runs) of
Hold a COM reference through descriptor creation and defer GPU retirement until the relevant queue fences complete. xcl/crates/xcl/src/hle/d3d12x/real.rs Lines 2136 to 2149 in bf8e16c xcl/crates/xcl/src/hle/d3d12x/real.rs Lines 2077 to 2095 in bf8e16c Review by Claude Code (Claude Opus 5.5) with a gpt-6.2-sol audit subagent; I checked each point against the code. |
Stacked on #269 — review and merge #269 first (this branch is rebased onto #269 head
8111cf9). Part of #248.Overlaps
Dropped (taken from #269, which has RX 6800 GPU evidence):
vram::Book,Space::{Targets, Textures},vram::place_title_texture,device_x.rsplacement wiring,title_textures::layout,Entry::seq/in_placement_order, and all four of D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269's tests (textures_share_pages_with_textures_not_with_targets,streamed_textures_cost_the_memory_they_cover,released_pages_are_kept_then_cooled_before_reuse, and GPU testtitle_textures_at_one_address_share_video_memory).try_share(ShareKey/QueryInterfacehandle reuse), which overlapped D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269's page sharing for identical placements andMADE's deduplication for by-address views.Kept (unique on top of #269; 4 files, +274 / -33):
title_textures.rs,vram.rs):title_textures::Registrykeeps pairwise-disjoint active ranges per device (by_end) and retires overwritten overlapping placements in O(log N + k) onregister, avoiding redundant dirty-page scans/uploads and detaching superseded entries' page claims from D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269'svram::Book(vram::detach_title_texture) so leftover pages and extra tiles cool and recycle even when the title never callsRelease().real::resource_atentries (real.rs): replaces the unboundedstatic MADEmap (used by device recomp: run wave64 compute programs as two wave32 halves on 32-lane GPUs #70/GPU tests: run wave64 kernels as two wave32 halves on 32-lane GPUs #71 by-address SRV/UAV creation) withResourceAtCache, which removes retired entries, drops their COM references outside the lock after a 2 s cooling delay (MADE_COOL) so superseded unaligned/committed resources are actually freed, and caps non-title_texturesentries atMADE_MAX(65 536).real.rs,title_textures.rs,vram.rs): hooksID3D12Device::Release(dev_release) to drop device-scopedMADEresources,title_texturesentries, and uploadQUEUES; clears released queues fromvram::Pages::waited(vram::on_queue_release).XCL_ACTIVITYcounters (title_textures.rs,host.rs): addstitle textures <active> (<covered> MB covered, <retired> retired, <released> released)to theXCL_ACTIVITY=1memory:line.title_textures::tests::overlapping_placements_retire_old_release_and_teardownandreal::tests::resource_at_cache_retires_cools_caps_and_tears_down(no duplication of D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269'sBookor GPU tests).What the reporter should measure (on top of #269)
Run the streaming repro on Windows + RX 7800 XT (16 GB) for 5 minutes with
XCL_ACTIVITY=1,XCL_PRESS_A_AT=14,17,21,XCL_NETWORK=0, comparing #269 (8111cf9) vs this stacked commit (bf8e16c):title textures <active> (<covered> MB covered, <retired> retired, <released> released)andvideo memory ... MB localat 30 s, 60 s, 90 s, 120 s, 180 s, 240 s, 300 s — verify active count stays bounded near the covered memory (instead of growing to 15.0 GB vs 4.6 GB covered as measured on D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269) and confirm whetherMADEeviction frees superseded unaligned by-address views.cargo test --workspace -- --test-threads=4(including D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269's 4 tests plus our 2 new unit tests) andscripts/smoke.ps1onmain/ D3D12.X: title textures on shared 64 KiB pages of video memory – video memory stays at what the title covers (#248) #269 and onbf8e16c.Tested
AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace --target x86_64-pc-windows-msvc— exit 0AR_x86_64_pc_windows_msvc=llvm-ar cargo check --release --workspace --tests --target x86_64-pc-windows-msvc— exit 0Not tested
cargo test, GPU tests, orscripts/smoke.ps1regression runs executed (Linux host).AI use
8111cf9), keeping only the non-overlapping lifetime/eviction/teardown/counter changes and their unit tests, and ran the Linux-to-x86_64-pc-windows-msvccargo checkcommands above.