d3d12: pool unaligned not_aliased buffers into shared L1/L0 heaps #3776
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3776
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3774"
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?
@Holastor on GitHub · 2026-12-01 18:13 UTC · original
Holastor:fix/d3d12-shared-buffer-heap-pool→main· +84 −3 · 1 files · 1 commits · openSummary
Pool unaligned
not_aliasedbuffer allocations insrc/startup_stubs/d3d12_xs_device.cppinto shared L1/L0 D3D12 heaps instead of creating a dedicated heap per buffer.<= 16 MiB) from 64 MiBID3D12Heapchunks tied to the activeID3D12Device*.!ALLOW_UNORDERED_ACCESS) buffers intoD3D12_HEAP_TYPE_CUSTOM(D3D12_MEMORY_POOL_L0) on discrete GPUs with< 9 GiBlocal VRAM budget (controllable viaX2W_D3D12_L0_BUFFER_POOL=0|1), keepingPOOL_L1(DEFAULT) for12+ GiBGPUs and UAV buffers.check_device("before Device view", N)prior to view creation inDevice::slot18to distinguish asynchronous prior device removal from view creation failures.Scope
src/startup_stubs/d3d12_xs_device.cpp(+84/-3)Verification
cmake --build --preset release— passed (0 warnings)-Console x -Gpu amd, 8 GiB VRAM): reduces liveID3D12Heapcount from ~18,500 to ~16 and cuts peak local VRAM usage by ~600 MiB.@Leyukaka on GitHub · 2026-12-01 21:57 UTC · original · reviewed
Reviewed
88bf81273. Thanks for the change. A few points:src/startup_stubs/d3d12_xs_device.cpp:7103selects custom L0 before checking pool eligibility. A 32 MiB non-UAV fallback buffer bypasses pooling and still goes to L0. If an L0 heap allocation fails, the committed retry also uses L0, which places those buffers in system memory on a discrete adapter. Please preserve the committed DEFAULT fallback for ineligible buffers and pool failures. D3D12 heap property mappingsrc/startup_stubs/d3d12_xs_device.cpp:7092retains raw heap references until a different device enters the pool. Unloading the module drops the pointer vector without releasing those references. The 64 MiB backing allocation is also absent from the budget counters, while:6847charges each slice as committed. Please give the pool explicit teardown and account for each heap once.:6417to a separate change.@R0Y00 on GitHub · 2026-12-02 19:53 UTC · original · reviewed
On
88bf8127, withX2W_D3D12_L0_BUFFER_POOL=1, I ran MSVC Debugctest --preset dev --no-tests=error -j 1 -V -R '^startup_slot133_heap_cap_(hardware_debug1|capped_hardware)$'. The two existing slot 133 cases passed on Windows 11 build 26300 and RTX 4060 Laptop 32.0.16.1656, with the registered debug-layer settings. They check the existing alias/copy behavior. They do not distinguish a committed DEFAULT fallback from a committed L0 fallback or verify released ranges are reused, so the open review points still apply.@R0Y00 on GitHub · 2026-12-03 06:33 UTC · original · requested changes
Two issues in the slot 133 fallback on this head:
github-bot referenced this pull request2026-12-03 07:55:23 +00:00
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.