Repository navigation
D3D12.X: XCL_SMALL_TEXTURES=1 puts small sampled textures on 4 KiB placements - #3008
Conversation
…acements A sampled texture the shared 64 KiB pages do not take (vram::place_pages refuses it; a 1D texture cannot be a reserved resource) was a committed resource, which takes at least 64 KiB of video memory. On the title the committed fallback held 8,361 x 64 KiB = 523 MiB (XCL_COMMITTED_AUDIT), mostly ~5k Texture1D RGBA8_SRGB textures of 4 KiB or less. With the switch, such a texture goes on a 4 KiB placement in a 4 MiB DEFAULT heap of XCL's own (ALLOW_ONLY_NON_RT_DS_TEXTURES), made through the adopting CreatePlacedResource. Only when the PC allows it: no RT/DS/UAV flags, one sample, and GetResourceAllocationInfo returning 4 KiB alignment for the description asking for it (most detailed level within 64 KiB). Otherwise, and when no heap can take it, it is committed as before. Its units are free again where late_release lets its last reference go (the queues are past the work before it); with XCL_LATE_RELEASE=0 the switch does nothing (logged once), as uploads of XCL's into a texture could still be in flight at the title's release. XCL asks no residency priority for the heaps, as for a committed texture (logged per heap). Measured on the title (RTX 5070 Ti, one 480 s run per arm, same base and env, with and without the switch): 8,192 small textures live in 58 MiB of 15 heaps, against at least 512 MiB as committed resources; local video memory over 250-310 s 18,332 vs 18,793 MB (-461 MB) with equal sparse pools and target pages. Still 3.1 GB over the budget there, and the frame rate did not move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Kalmarv We can test the freed-slot case you flagged using small 2D textures on an RTX 5070 Ti. We’ll check whether a replacement actually reuses the retired texture’s heap offset, then read back both the replacement and a neighboring texture that stayed alive. We’ll reuse the #1835 fixture if it reaches this path. Update: The freed-slot test passed on a physical RTX 5070 Ti with driver 621.40. We tested local commit After GPU completion, XCL’s This covers serial reuse after GPU completion. Release with GPU work still in flight remains open. We can share the test-only patch. OpenAI Codex ran the Windows test, and Claude Sonnet 5.5 Extra reviewed the fixture design. |
|
Independent desktop NVIDIA verification of PR #3008 at head Environment
Targeted tests & build (
|
| Command | Result |
|---|---|
cargo test --release -p xcl --lib -- --nocapture hle::d3d12x::small_tex:: (3 consecutive runs) |
2 passed; 0 failed; 0 ignored; 1727 filtered out × 3 (0.19s, 0.20s, 0.18s, 0 skipped; live RTX 4060 D3D12 device exercised only_textures_the_pc_places_on_4_kib_are_taken) |
cargo build --release -p xcl |
Clean build (2m 04s, exit 0, 0 new warnings in small_tex.rs, device_x.rs, late_release.rs, or PR-touched lines) |
Paired quiet 60 s retail smoke (title: 29640639, XCL_PREPARE=0, XCL_NETWORK=0, A/B default vs. XCL_SMALL_TEXTURES=1)
Exact parent & merge-base (a5e2d851a503fc0e04609f773ea53f2d2c4e3269, nvidia-dev ancestor):
xcl-smoke v1
commit: a5e2d851a503fc0e04609f773ea53f2d2c4e3269
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1513 (PresentX 1513)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14868 MB
PR #3008 (24fdb7b9297e47af1433a7c1069436becfe7a724, default — XCL_SMALL_TEXTURES unset):
xcl-smoke v1
commit: 24fdb7b9297e47af1433a7c1069436becfe7a724
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1559 (PresentX 1559)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14587 MB
PR #3008 (24fdb7b9297e47af1433a7c1069436becfe7a724, opt-in — XCL_SMALL_TEXTURES=1):
xcl-smoke v1
commit: 24fdb7b9297e47af1433a7c1069436becfe7a724
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1551 (PresentX 1551)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14576 MB
A/B runtime telemetry observed in xcl.log on RTX 4060 (621.14)
- Default (
XCL_SMALL_TEXTURESunset):0small textureslog lines; steady-state memory at ~58.6 s:14500 MBcommitted (peak commit: 14587 MB),6115 MB local,4702 MB non-local(budget6860 MB). - Enabled (
XCL_SMALL_TEXTURES=1): loggedD3D12.X: small textures: heap 1 of 4 MiB made, residency priority: default, no override (as for a committed texture)at3.457 swith04 KiB placement failedwarnings; steady-state memory at ~58.4 s:14576 MBcommitted (peak commit: 14576 MB,-11 MBvs. default),6116 MB local(+1 MB),4737 MB non-local(budget6863 MB). Becausesmall_tex::placelogs its placement summary at powers of two starting atk >= 64, fewer than 64 eligible small textures were placed during this 60 s startup window.
Limits of coverage
- Both
hle::d3d12x::small_tex::tests (units_are_taken_first_fit_and_given_backand live-RTX 4060only_textures_the_pc_places_on_4_kib_are_taken) passed3/3with0skips, and the A/B 60 s smokes (XCL_PREPARE=0,XCL_NETWORK=0) verified default-off behavior and clean 4 MiB small-texture heap creation + 4 KiBCreatePlacedResourceplacement (0placement failures,0device removals,0crashes, steady 60 Hz). - The 60 s startup window created fewer than 64 small textures (
14 MiB heap allocated), so multi-heap VRAM savings under heavy in-world streaming (hundreds/thousands of small lookup textures) and theXCL_LATE_RELEASE=0interaction were not exercised in this short smoke.
AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
|
Wine/NVIDIA offscreen verification at exact production head With The new
This is serial reuse after completed GPU work, not pending-use safety across queues. No deliberately blocked GPU queue; fence/retirement waits bounded to10s. The two original admission/first-fit unit fixtures also pass. Heap pooling/reuse is proven; physical memory saving, heap reclamation, title peak RAM/VRAM and frame time are not measured. Linux6.17/i7-13620H/16GiB/Wine11/NVIDIA590.48.1, physical RTX4060Laptop8GiB. Diagnostic relaxed-vtable vkd3d AI-assisted local fixture/verification: OpenAI Codex GPT-6-Astra. No game assets, saves or imagery attached. |
|
merge-check claim |
|
merge-check |
|
I checked the slot-25 sizing concern on exact head For the 256×1 RGBA8 sRGB example, both reported 8,192 bytes at 4,096-byte alignment; The likely reason is that adoption installs a split guard for slot 25: the call originating in XCL's AI use: OpenAI Codex with GPT-6.2 Astra built and ran the checks and traced the routing; Codex reviewed and prepared this report. |
|
Following up on the pending-consumer case left open by the earlier serial reuse tests: we now have a passing physical result on main Hardware: RTX 5070 Ti, NVIDIA driver 621.40 (32.0.16.2140), Windows, Rust 1.100.0 MSVC. Enabled
The isolated test reported 1 passed, 0 failed, 0 skipped. The D3D12 debug layer was enabled, with zero stored InfoQueue messages. The fixture retained its native command allocator and list until fence completion. This covers one synthetic DIRECT-queue consumer on one adapter and driver. Placement offsets come from allocator bookkeeping. GPU-based validation was not requested, and discarded InfoQueue messages were not counted. Cross-queue consumers, retail workloads, stress behavior and memory savings remain untested. We can share the test-only regression fixture if useful. AI assistance: OpenAI Codex prepared and executed the fixture, Claude Opus reviewed source readiness, and a separate Codex reviewer checked the measured evidence. Exact Codex model variants were not recorded. |
A sampled texture of the title that the shared 64 KiB pages do not take (
vram::place_pagesrefuses it; a 1D texture cannot be a reserved resource) is made a committed resource, and a committed resource takes at least 64 KiB of video memory. On the title we run, that fallback held thousands of tiny textures (mostlyTexture1DRGBA8 lookup tables of a few hundred bytes), at 64 KiB each. WithXCL_SMALL_TEXTURES=1such a texture goes on a 4 KiB placement in a heap of XCL's own instead. Off by default. Part of #2688.What is in it
hle/d3d12x/small_tex.rs(new): the PC's rules decide. No render target, depth or UAV flag, one sample, andGetResourceAllocationInforeturning 4 KiB alignment for the description withAlignment = D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT(its most detailed level fits in 64 KiB). Such a texture is placed first-fit in 4 KiB units of 4 MiBDEFAULTheaps (ALLOW_ONLY_NON_RT_DS_TEXTURES), made through the adoptingCreatePlacedResource. Anything else, and a texture no heap can take, is committed as before. Its units are free again wherelate_releaselets the texture go (the queues are past the work before it). WithXCL_LATE_RELEASE=0the switch does nothing (logged once): XCL's uploads into a texture could still be in flight at the title's release. XCL asks no residency priority for the heaps, as for a committed texture. Heaps are kept once made.device_x.rs: the committed fallback ofCreatePlacedResourceXtries it first.real.rs,late_release.rs:small_tex::gonenext toplacements::gone.units_are_taken_first_fit_and_given_back(the allocator),only_textures_the_pc_places_on_4_kib_are_taken(the rules, against the PC'sGetResourceAllocationInfo).Tested
XCL_DXC_DIR.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4on 24fdb7b (withCARGO_PROFILE_DEV_DEBUG=0: no debug info, for disk space): 1826 passed, 8 failed, 48 ignored. The same command onnvidia-deva5e2d851: 1822 passed, 10 failed, 48 ignored.a5e2d851as well:async_compute_pso_registers_real_pso_and_not_standin,console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays,hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels,split_compute_prefers_the_offline_whole_pipeline,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.SKIPPED: 8 no wave64; 1 const_mask, wave64: no wave64; 1 f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f16 arithmetic, wave64: no wave64; 1 f32 arithmetic, wave64: no wave64; 1 f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f16 packed, wave64: no wave64; 1 f32 compares, wave64: no wave64; 1 f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f32 conversions, wave64: no wave64; 1 f64, wave64: no wave64; 1 integer arithmetic, wave64: no wave64; 1 f32 rounding, wave64: no wave64; 1 mask_ff0_flbit, wave64: no wave64; 1 integer carries, wave64: no wave64; 1 f32 transcendentals, wave64: no wave64; 1 f32 three-source, wave64: no wave64; 1 no heap windows (opt-in: XCL_HEAP_WINDOWS=1); 1 no heap windows.Build and test (Windows, no GPU)is red onnvidia-devitself and on every PR into it, this one included: the lib test process ends with0x887a0020in a sparse test on the runner's software adapter, with no test reported failed. Tests: sparse tests take CI's Basic Render Driver for a software device #2837 fixes that test; nothing here touches it.Regression run
150 s runs, same title, same env (
XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=all XCL_DIRECT_SPLIT_INSTRUCTIONS=0 XCL_PSO_JOURNAL=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=120000, DXC 1.9); the head withXCL_SMALL_TEXTURES=1as well. Themainrun from a hard-link copy of our team branch's DXIL cache; the base and head runs from hard-link copies of one cache warmed onnvidia-deva5e2d851(on this branch the title starts after about 75-90 s of startup shader preparation, so 60 s would end inside it).A commit of
main(b49be183, the last one before the shader preparation screen of #2555):The base,
nvidia-deva5e2d851:This PR's head:
The head run reached the switch: by 171 s its log counted 4,096 small textures on 4 KiB placements, 4,096 live in 28,108 KiB of 7 heaps (at least 262,144 KiB as committed resources); 8 heaps were made by the end of the run.
Not tested
XCL_LATE_RELEASE=0(the switch is off then, by design).AI use
🤖 Generated with Claude Code