d3d12: do not wrap large allocations for unplaced memory SRVs #2603
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2611"
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 R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-25T23:18:48Z.
Change
Fixes #2610 (startup stall of ~120 s since #2395).
unplaced_memory_buffer(device slot 70, #2395) wraps the whole allocation holding a view withOpenExistingHeapFromAddress. Now it creates that wrap only when the allocation is at most 256 MiB, the limitunplaced_buffer_extentalready applies to the span. Larger allocations take the existing upload copy. A heap that is already wrapped for the same base is still reused.memory_srv_buffer.h:unplaced_max_spanandunplaced_existing_heap_allowed(allocation_bytes)(0 = unknown → no wrap).placed_buffer_range.h:allocation_bytes(address)gets the allocation size from one region-information call, without a page-table scan.standin_memory_bufferpath. This PR keeps the current design and only bounds it.Verification
Windows 10 22H2, RTX 3080 Ti (driver 32.0.16.1047), WARP; dev and release; commit
0a40a0fd(ona6967446).17/17 passed in each, with no capability skips (dev at
b45a19e4onf03cf16f; rerun at0a40a0fdafter the rebase: result to follow in a comment).startup_memory_srv_buffer: limit cases (64 KiB, 256 MiB, 256 MiB + 64 KiB, 2 GiB, unknown size). New negative controlstartup_memory_srv_buffer_unplaced-heap-limit_control(it accepts 2 GiB) fails as expected.startup_placed_buffer_rangecase 10:allocation_byteson 64 KiB and 256 MiB + 64 KiB reservations with only their first page committed, queried at the base and at the last byte.startup_address_buffer_srv_{warp,hardware}column 7: a view in a 256 MiB + 64 KiB allocation still publishes the right value, now through the upload copy.unplaced_memory_buffer(not in this PR). Without the limit, both the 64 KiB and the large allocation are wrapped (WARP and hardware). With it, 64 KiB is wrapped and the large one takes the upload copy.0a40a0fd, 3,254 DirectStorage requests completed at 10 s and first input poll at 5.8 s (with #2395 alone: 0 at 30 s, first poll ~122 s); no device removal in 180 s.Evidence and follow-up
VirtualAllocin the test); no title data.VirtualQuerycalls over that allocation is not proven (see the issue).Checklist
AI-assisted: the change, tests and this description were written with Claude; I ran the bisect and the startup runs.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:21:17Z.
Review: COMMENTED
Review of head
0a40a0fd(comment only, no approval).Code looks sound:
unplaced_existing_heap_allowed(memory_srv_buffer.h): 0 (unknown) and anything above 256 MiB fall back to the upload copy; an already wrapped heap is still reused (theexisting_heapslookup runs before the new check ind3d12_memory_srv.inl).allocation_bytes(placed_buffer_range.h): one region-information call, returns 0 on a missing or failed call, so it fails closed.unplaced_max_spanis now shared withunplaced_buffer_extent, so the two limits cannot drift apart.startup_memory_srv_buffercovers 64 KiB, 256 MiB, 256 MiB + 64 KiB, 2 GiB and unknown size. Theunplaced-heap-limitmutation flips only the 2 GiB case, so it is a real negative control. I read it; I did not build it (Windows-only tests).startup_address_buffer_srv_check.py,startup_address_srv.cpp,startup_placed_buffer_range_check.cpp) are extended consistently.Not verified by me, and why it is not merged by this review:
Linux commands run:
git diff --stat origin/main...HEAD,git diff --check origin/main...HEAD(clean),python3 tests/docs_links_check.py(19 files, 506 links ok),python3 tests/bidi_controls_check.py(ok).AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-25T23:19:32Z.
Rerun after the rebase, at
0a40a0fd(ona6967446), same selection (^startup_memory_srv_buffer|^startup_address_buffer_srv_|^startup_address_srv_|^startup_placed_buffer_range|^startup_memory_srv_diag): dev 17/17 passed, release 17/17 passed, no capability skips.