Support for priority based residency
Uses ID3D12Device1::SetResidencyPriority to manage residency per resource/heap.
Implement and decide if/how this will work with ID3D12Device::[MakeResident|Evict] based residency via gpgmm::d3d12::ResidencySet.
@bjjones, this one would be a good follow-up work item.
This was something I experimented with at the time - but the Intel driver I used did not seem to have the functionality. The scheme was pretty simple - instead of MakeResident(), I set priority high. Instead of Evict(), I set priority low.
Something like this would be pretty simple to integrate:
- Locked heaps are priority MAX
- heaps scheduled for use are priority HIGH
- heaps in the LRU (i.e. fit in memory) would remain HIGH even if they aren't scheduled for use.
- heaps that don't fit into memory and are not scheduled for use are priority LOW
Part of me thinks that heaps that do fit into memory, but are not scheduled for use could be priority NORMAL, however this will require cycles on the CPU to iterate the LRU and I don't know that it would have a worthwhile effect.
That idea seems pretty reasonable to me.
I envision two modes: 1) to mimic MakeResident/Evict but using priorities and/or 2) means for the developer to override these priorities.
The first mode just sets these default priorities as you suggest (ex. heaps in ResidencySet are HIGH, locked heaps are MAX). The second mode skips that so the developer can provide them instead.