Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive warning when serving dedicated memory allocations to small images #2000

Closed
haasn opened this issue Jul 5, 2020 · 1 comment
Assignees
Milestone

Comments

@haasn
Copy link
Contributor

haasn commented Jul 5, 2020

The best practices layer spits out warnings like this:

Allocating 4096 memory of type 0x1 (id 0) in heap 0
vk Validation Performance Warning: [ UNASSIGNED-BestPractices-vkAllocateMemory-small-allocation ] Object 0: handle = 0x55e896a0f0b0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdc18ad6b | vkAllocateMemory(): Allocating a VkDeviceMemory of size 4096. This is a very small allocation (current threshold is 262144 bytes). You should make large allocations and sub-allocate from one large VkDeviceMemory.
    using VkDevice: anon (0x55e896a0f0b0)
vk Validation Performance Warning: [ UNASSIGNED-BestPractices-vkBindMemory-small-dedicated-allocation ] Object 0: handle = 0x55e896a0f0b0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xb3d4346b | vkBindImageMemory(): Trying to bind VkImage 0x157c000000157c[] to a memory block which is fully consumed by the image. The required size of the allocation is 4096, but smaller images like this should be sub-allocated from larger memory blocks. (Current threshold is 1048576 bytes.)
    using VkDevice: anon (0x55e896a0f0b0)
vk Validation Performance Warning: [ UNASSIGNED-BestPractices-vkAllocateMemory-small-allocation ] Object 0: handle = 0x55e896a0f0b0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xdc18ad6b | vkAllocateMemory(): Allocating a VkDeviceMemory of size 4096. This is a very small allocation (current threshold is 262144 bytes). You should make large allocations and sub-allocate from one large VkDeviceMemory.
    using VkDevice: anon (0x55e896a0f0b0)
Imported 4096 of memory from fd: 7 (dedicated)
vk Validation Performance Warning: [ UNASSIGNED-BestPractices-vkBindMemory-small-dedicated-allocation ] Object 0: handle = 0x55e896a0f0b0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xb3d4346b | vkBindImageMemory(): Trying to bind VkImage 0x157e000000157e[] to a memory block which is fully consumed by the image. The required size of the allocation is 4096, but smaller images like this should be sub-allocated from larger memory blocks. (Current threshold is 1048576 bytes.)
    using VkDevice: anon (0x55e896a0f0b0)

However, this is in spite of the fact that I am trying to serve memory to an image which has VkMemoryDedicatedRequirementsKHR.requiresDedicatedAllocation set to true, so there is no other way I could be allocating/binding memory here - no matter how wasteful it may seem to the layer. (Moreoever, one of the two allocations isn't even an allocation - it's a memory import from an FD, the size of which we have no control over)

I suggest adding a simple check to the best practices layer to disable those two VUIDs when serving images that require dedicated allocations.

@mark-lunarg
Copy link
Contributor

@haasn, added this to the BP tracking issue #24, hoping to get to it soon. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants