vk: Filter out re-bar usage from memory pressure watchdog
Some checks failed
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.6, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.6, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, .ci/build-mac.sh, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, .ci/build-mac-arm64.sh, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang (win64, clang, clang64) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
Generate Translation Template / Generate Translation Template (push) Has been cancelled

This commit is contained in:
kd-11 2025-10-24 13:40:07 +03:00 committed by Ani
parent ae30cb5557
commit 73c984a637
4 changed files with 35 additions and 0 deletions

View file

@ -1010,6 +1010,8 @@ namespace vk
.heap = memory_properties.memoryHeaps[i],
.types = {}
});
result.heaps.push_back({ i, memory_properties.memoryHeaps[i].flags, memory_properties.memoryHeaps[i].size });
}
for (u32 i = 0; i < memory_properties.memoryTypeCount; i++)

View file

@ -30,6 +30,8 @@ namespace vk
struct memory_type_mapping
{
std::vector<memory_heap_info> heaps;
memory_type_info host_visible_coherent;
memory_type_info device_local;
memory_type_info device_bar;

View file

@ -200,6 +200,23 @@ namespace vk
// Allow fastest possible allocation on start
set_fastest_allocation_flags();
// Determine the rebar heap. We will exclude it from stats
const auto& memory_map = dev.get_memory_mapping();
if (memory_map.device_bar_total_bytes !=
memory_map.device_local_total_bytes)
{
for (u32 i = 0; i < ::size32(memory_map.heaps); ++i)
{
const auto& heap = memory_map.heaps[i];
if ((heap.flags & VK_MEMORY_HEAP_DEVICE_LOCAL_BIT) &&
heap.size == memory_map.device_bar_total_bytes)
{
m_rebar_heap_idx = i;
break;
}
}
}
}
void mem_allocator_vma::destroy()
@ -313,6 +330,12 @@ namespace vk
{
vmaGetHeapBudgets(m_allocator, stats.data());
// Filter out the Re-BAR heap
if (::size32(stats) > m_rebar_heap_idx)
{
stats[m_rebar_heap_idx].budget = 0;
}
float max_usage = 0.f;
for (const auto& info : stats)
{

View file

@ -59,6 +59,13 @@ namespace vk
void rebalance();
};
struct memory_heap_info
{
u32 index;
u32 flags;
u64 size;
};
class mem_allocator_base
{
public:
@ -113,6 +120,7 @@ namespace vk
private:
VmaAllocator m_allocator;
std::array<VmaBudget, VK_MAX_MEMORY_HEAPS> stats;
u32 m_rebar_heap_idx = UINT32_MAX;
};