d3d12: keep a large guest view heap in smaller CPU heaps #399
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/399"
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 brcly/TuxBox. Originally posted by KainanP on 2026-11-28T14:29:35Z.
lanes-selftest-descriptor-reclaimfails on an Intel UHD (8086:a78b) withcreate oversized view heap failed: 0x8007000e(it is the failing gate inevidence/windows11-uhd-a78b-native.json).Cause
A paged guest view heap keeps every slot's native view in a CPU-only heap, made as large as the guest heap in one piece. The scenario's heap has 2,097,152 descriptors. A small probe measured the limits. On this UHD driver,
CreateDescriptorHeapfor a non-shader-visible CBV/SRV/UAV heap returnsE_OUTOFMEMORYat 2,097,152 descriptors and succeeds at 1,048,576. The RTX 4060 Laptop takes up to 4,194,304. No feature query reports the limit.The guest heap really does need all 2,097,152 slots, so a smaller single heap would not be correct.
Change
descriptor_paging/staging.rs:Chunks::handle).Arena::copysplits a table copy where chunks end (Chunks::runs).E_OUTOFMEMORYshrinks the chunks.TUXBOX_HOST_PROFILE=cpu-view-heap=Nrefuses larger CPU view heaps withE_OUTOFMEMORY, the way such a driver does.verifyrunsdescriptor-reclaima second time, aslanes-selftest-descriptor-reclaim-split, withcpu-view-heap=1048576. That puts any card on the path the UHD takes.The path is chosen by what the host refuses, not by vendor.
Tests (Windows 11, native)
The
verifyruns used--only lanes-selftest --only d3d12-heaps --only d3d12-tables.lanes-selftest-descriptor-reclaimbefore0x8007000elanes-selftest-descriptor-reclaimafterlanes-selftest-descriptor-reclaim-split(new)d3d12-heaps,d3d12-tableslanes-selftestray-tracing-builder(no ray tracing on this card, fails on main too)Checking the override on the RTX:
TUXBOX_HOST_PROFILE=cpu-view-heap=1000is below the smallest chunk. It reproduces the UHD failure exactly:create oversized view heap failed: 0x8007000e.cpu-view-heap=100000splits the heap into 32 chunks of 65,536, and the gate passes.cargo test -p tuxbox-d3d12 --lib: 241 passed. The 4heap::backingtests that fail also fail on main on this machine.Still needed: a run on an AMD card. This changes
runtime/d3d12, and I have only tested Intel and NVIDIA.AI use: written with Claude Code (Claude Opus 5.5); the limits were measured and the tests run on the hardware above.
🤖 Generated with Claude Code
Imported from brcly/TuxBox. Originally posted by KainanP on 2026-11-28T15:12:00Z.
I rebased this onto main (
e380da1). The only conflict was inverify.py: main now picks the BVH builder for everyray-tracing-*scenario. I kept that and left the newdescriptor-reclaim-splitgate where it was.Rerun after the rebase on Windows 11, native backend. The build includes #400, because
build.py allstops at the xcrdapi warning otherwise:10de:28a0) and Intel UHD (8086:a78b):d3d12-heaps,d3d12-tables,lanes-selftest-descriptor-reclaimandlanes-selftest-descriptor-reclaim-splitall pass.cargo test -p tuxbox-d3d12 --lib -- --test-threads=1: 280 passed, 5 failed. The 5 failures are the same on main without this PR (275 passed, 5 failed): four indevice::heap::backingand one indevice::placement::residency(gpu_images_without_room_use_system_memory_and_keep_their_contents). The descriptor-paging and host-profile tests this PR adds all pass.AI use: Claude Code did the rebase and ran the checks.