D3D12.X: XCL_SMALL_TEXTURES=1 puts small sampled textures on 4 KiB placements #3008
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3008"
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?
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-27T11:59:55Z.
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=4on24fdb7b9(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 #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 #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 #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. #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
Imported from ivall/xcl. Originally posted by UncommonDLL on 2026-11-27T15:37:34Z.
@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
16b040f016133c221d9284c188a19c67c1cb9377on #3008 head24fdb7b9297e47af1433a7c1069436becfe7a724. One run completed with zero skips.After GPU completion, XCL’s
late_releasepath retired texture A. Texture C then reused A’s exact 16 KiB range at offset 0 in the samesmall_texheap. All 16,384 bytes of C matched its new pattern. The neighboring texture B stayed live at offset 16,384, and every byte matched its original pattern before and after reuse. None of the three allocations fell back to a committed resource.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.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T16:29:44Z.
Independent desktop NVIDIA verification of PR #3008 at head
24fdb7b9297e47af1433a7c1069436becfe7a724(1commit; exact parent & merge-base:a5e2d851a503fc0e04609f773ea53f2d2c4e3269, ancestor ofnvidia-dev).Environment
7956 MiBreported by D3D12, Wave32-only Ada), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted tests & build (
24fdb7b9)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,0skipped; live RTX 4060 D3D12 device exercisedonly_textures_the_pc_places_on_4_kib_are_taken)cargo build --release -p xcl2m 04s, exit0,0new warnings insmall_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-devancestor):PR #3008 (
24fdb7b9297e47af1433a7c1069436becfe7a724, default —XCL_SMALL_TEXTURESunset):PR #3008 (
24fdb7b9297e47af1433a7c1069436becfe7a724, opt-in —XCL_SMALL_TEXTURES=1):A/B runtime telemetry observed in
xcl.logon RTX 4060 (621.14)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).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
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).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).
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-27T17:45:03Z.
Wine/NVIDIA offscreen verification at exact production head
24fdb7b9297e47af1433a7c1069436becfe7a724(immediate parenta5e2d851a503fc0e04609f773ea53f2d2c4e3269).xcl-pr3008differs only by a local GPU regression insmall_tex.rsand a required-device assertion in the existing admission fixture.With
XCL_SMALL_TEXTURES=1,XCL_LATE_RELEASE=1, andDXVK_CONFIG='dxgi.hideNvidiaGpu = False', Windows-MSVC Winecargo test --locked --target x86_64-pc-windows-msvc -p xcl --lib hle::d3d12x::small_tex::tests:: -- --nocapture --test-threads=1passed 3/3, 0 ignored, 0.69 s after fresh intended-worktree compilation (33.32 s).The new
nvidia_upload_readback_survives_serial_heap_offset_reuserequires vendor0x10deand real 4-KiB placement eligibility. Reproduction recipe:small_tex::placecreates two sampled RGBA8 1D textures, 256 texels each. On this RTX 4060 Laptop, allocation is 8192 bytes each, at offsets0 and8192 in the same4MiB heap.0x19to the first and0x5cto its live neighbour; GPU copy/readback checks every texel byte after an actual completion fence.small_tex::gone).0xa7; a second GPU submission verifies all replacement bytes and that every neighbour byte remains unchanged. Both resources subsequently retire through the same production path.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
2576c0b4adfae4a+, not stock certification. Unchanged9GiB/512MiB scope and external guards; sampled GPU158MiB, available RAM minimum9032.2MiB, disk minimum11.820GiB. Evidence.compat-runtime/logs/verify-xcl3008-small-texture-reuse-20261127T173952Z/. No matched parent or title run; this does not address our separate Game-Init incomplete producer fence. A useful remaining owner gate is retaining a placement across a pending consumer before reuse, with bounded teardown.AI-assisted local fixture/verification: OpenAI Codex GPT-6-Astra. No game assets, saves or imagery attached.
Imported from ivall/xcl. Originally posted by throny on 2026-11-28T00:06:21Z.
merge-check claim
head:
24fdb7b929Imported from ivall/xcl. Originally posted by throny on 2026-11-28T00:30:26Z.
merge-check
base:
d1be8103(nvidia-dev)head:
24fdb7b929merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1826 passed, 8 failed, 48 ignored (27 SKIPPED lines). The 8 failures are the base's own on this GPU, the same six names with and without the PR (#2771 and #2788 fix three of them). Base alone: 1824 passed, 8 failed, 48 ignored.
review: one finding that blocks the feature, read in the code and not reproduced at run time: units_for asks the device it is given for GetResourceAllocationInfo, and small_tex::place gives it the title's device, whose vtable is XCL's console one. Slot 25 there is get_resource_allocation_info_x (device_x.rs), which answers with the console's size and alignment for every texture its console model knows and with the PC driver's only otherwise. So the 4 KiB check and the unit count can be the console's, not this driver's; where the console size is smaller than the PC's (the PR itself notes 8 KiB on PC for one small 1D texture), the next texture would be placed over it, and CreatePlacedResource does not complain. The unit test uses a fresh, unhooked device, so it cannot see this. Fix: take the driver's function the way that hook does (real::orig_fn(this, 25)). Opt-in (XCL_SMALL_TEXTURES=1), so nothing changes by default.
performance: none by default (one OnceLock read).
verdict: not yet: size and alignment must come from the PC driver; then I will rerun, and I can add a world run with the switch on.
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite unless said).
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T01:28:05Z.
I checked the slot-25 sizing concern on exact head
24fdb7b9297e47af1433a7c1069436becfe7a724, RTX 5070 / NVIDIA 616.92, with a test-only native fixture. The device was adopted, and I verified that its slot 25 differed from the original driver function. The fixture called productionsmall_tex::units_forand compared its result with the original driver method on that same COM object.For the 256×1 RGBA8 sRGB example, both reported 8,192 bytes at 4,096-byte alignment;
units_forreturned two 4 KiB units. Across 738 tested descriptors, eligibility and unit counts agreed with the original driver.The likely reason is that adoption installs a split guard for slot 25: the call originating in XCL's
units_foris routed to the PC target, while a title-originated call is routed to the console target. This tests that particular caller and descriptor set; it does not prove correctness for every descriptor, neighboring texture contents, or GPU lifetime.AI use: OpenAI Codex with GPT-6.2 Astra built and ran the checks and traced the routing; Codex reviewed and prepared this report.
Imported from ivall/xcl. Originally posted by UncommonDLL on 2026-11-29T03:31:12Z.
Following up on the pending-consumer case left open by the earlier serial reuse tests: we now have a passing physical result on main
fa204595a488c60c6c5f905244f0172072c9c2a9with a local test-only fixture.Hardware: RTX 5070 Ti, NVIDIA driver 621.40 (32.0.16.2140), Windows, Rust 1.100.0 MSVC. Enabled
XCL_SMALL_TEXTURES=1,XCL_LATE_RELEASE=1andXCL_VRAM_ARENAS=1.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.