Repository navigation
D3D12.X: video-memory arenas never overlap - #122
Merged
Merged
Conversation
arena_for reused an arena only if it held the whole placement, and a new one took the 32 MiB blocks below the address up to 128 MiB with no regard for the arenas already there. A placement straddling an arena (or a new arena growing into one) gave two heaps over the same title addresses, so resources at one address could land in different heaps and stop aliasing. The layout is now a pure function (plan) over the arena ranges: - a placement inside an arena reuses it; - a new arena that overlaps none grows to 128 MiB but stops at the next arena; - a placement that overlaps arenas gets one arena over the union of its range and all of them (to closure), and those leave the list. Their resources keep their heaps; later placements at those addresses use the new arena. Tests (vram::tests): the straddling sequence from xcl-dev#104, a new arena stopping at the next one, a placement merging two arenas over a gap.
Collaborator
|
Merged. XDefiant hits it in practice: ~78 s in it logs one straddling placement merged into a new arena, and runs on. Checked on Windows 11 with an RX 9070 (RDNA4), merged together with the rest of #110–#129: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#104 item 1.
arena_forreused an arena only if it held the whole placement. A new arena took the 32 MiB blocks from below the address up to 128 MiB, with no check against the arenas already there. So a placement that straddled an arena, or a new arena that grew into one, gave two heaps over the same title addresses. Resources at one address could then land in different heaps and stop aliasing.The layout is now a pure function,
plan, over the arena ranges.arena_forapplies it:I picked merging over "allocate the remainder" because a D3D12 resource must sit in one heap. A straddling resource cannot be split between the old arena and a remainder heap.
Tests in
vram::tests, CPU only:Each step also checks that no two arenas overlap. With the old rule the first test's second step gives
[0x1_0200_0000, +128 MiB)over the first arena. The other lib tests pass on a GTX 1650 under Wine. Not run with a retail title.