perf(vk): give back retired pools' imports once the GPU is past them #446
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!446
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/vk-retired-imports"
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?
What this fixes
In Kokiri Forest on Linux with RADV, the frame rate falls to 3-5 fps while the GPU is mostly idle. The cost is in
vkQueueSubmit(#312, #413). One reason is that retired memory pools were never given back.When a pool is remade larger, the old one is retired, and its host-pointer import was kept forever. On amdgpu each import is a userptr buffer object. RADV lists every buffer object in every submission, because of buffer device addresses. So at every
DRM_IOCTL_AMDGPU_CSthe kernel re-checks every page of every userptr object, and the set it checks only grew with each pool merge. strace shows 15-45 ms per CS ioctl in Kokiri, with about 6 submits a frame.Change
gpu/vk/vk_memory.cpp:retired_valueandlast_value.dead_mirrorsalready is.retired_pools, since pointers to it are kept, andpools_genis bumped.memory_guest_importedskips freed retired pools.vk: imports: N live, N retired still imported, N retired given back.RX_VK_KEEP_RETIRED=1keeps them, as before.Tested
foliage-linux-updaterrelease with this patch.main: the patch is rebased onto currentmain, andhookshot_vkbuilds there. I have not run a fullmainbuild.This is the smaller half of the submit cost. #413's batching and the udmabuf PR (#448) address the rest.
Analysis and patch made with Claude (Anthropic); I ran every test on my machine.
🤖 Generated with Claude Code