GPUOpen-LibrariesAndSDKs / VulkanMemoryAllocator

Easy to integrate Vulkan memory allocation library
MIT License
2.63k stars 359 forks source link

Validation error in TestAllocationAliasing on AMD Ryzen™ 9 7950X #338

Open IAmNotHanni opened 1 year ago

IAmNotHanni commented 1 year ago

Hello

When running VulkanSample application's tests with my AMD 7950X (AMD Radeon(TM) Graphics), I get a validation error caused by TestAllocationAliasing(). Running the tests with my Intel Arc A770 works without any problems. (I use the --GPUIndex command line to enforce which physical device will be chosen)

When I continue the tests, there is another issue with ProcessDefragmentationPass, but I will create a separate issue for this.

Vulkan Memory Allocator Sample 3.0.1
Vulkan API version used: 1.3
physicalDeviceProperties:
    driverVersion: 0x8000FA
    vendorID: 0x1002 (AMD)
    deviceID: 0x164E
    deviceType: 1 (INTEGRATED_GPU)
    deviceName: AMD Radeon(TM) Graphics
    limits:
        maxMemoryAllocationCount: 4096
        bufferImageGranularity: 1 B
        nonCoherentAtomSize: 128 B
physicalDeviceVulkan11Properties:
    maxMemoryAllocationSize: 2147483648 B (2.00 GB)
physicalDeviceVulkan12Properties:
    driverID: 1 (AMD_PROPRIETARY)
    driverName: AMD proprietary driver
    driverInfo: 22.40.40 (AMD proprietary shader compiler)

MEMORY HEAPS:
heapCount=3, typeCount=8
Heap 0: 268435456 B (256.00 MB) DEVICE_LOCAL, MULTI_INSTANCE
    Type 0: DEVICE_LOCAL
    Type 4: DEVICE_LOCAL, DEVICE_COHERENT (AMD), DEVICE_UNCACHED (AMD)
Heap 1: 16437477376 B (15.31 GB)
    Type 1: HOST_VISIBLE, HOST_COHERENT
    Type 3: HOST_VISIBLE, HOST_COHERENT, HOST_CACHED
    Type 5: HOST_VISIBLE, HOST_COHERENT, DEVICE_COHERENT (AMD), DEVICE_UNCACHED (AMD)
    Type 7: HOST_VISIBLE, HOST_COHERENT, HOST_CACHED, DEVICE_COHERENT (AMD), DEVICE_UNCACHED (AMD)
Heap 2: 268435456 B (256.00 MB) DEVICE_LOCAL, MULTI_INSTANCE
    Type 2: DEVICE_LOCAL, HOST_VISIBLE, HOST_COHERENT
    Type 6: DEVICE_LOCAL, HOST_VISIBLE, HOST_COHERENT, DEVICE_COHERENT (AMD), DEVICE_UNCACHED (AMD)

Conclusions:
- 2 heaps are DEVICE_LOCAL, total 512.00 MB.
- 2 heaps are HOST_VISIBLE, total 15.56 GB.
- 1 heaps are DEVICE_LOCAL and HOST_VISIBLE, total 256.00 MB.
- No types are HOST_VISIBLE but not HOST_COHERENT.
- No types are not DEVICE_LOCAL and not HOST_VISIBLE.
- 4 types are AMD-specific DEVICE_COHERENT or DEVICE_UNCACHED.
- No types are LAZILY_ALLOCATED.
- A buffer with VERTEX_BUFFER usage can be created in some non-DEVICE_LOCAL type.
- An image with OPTIMAL tiling and SAMPLED usage can be created in some non-DEVICE_LOCAL type.

Enabled extensions and features:
Validation layer: 1
Sparse binding: 1
VK_EXT_memory_budget: 1
VK_AMD_device_coherent_memory: 1
bufferDeviceAddress: 1
VK_EXT_memory_priority: 1

TESTING:
Test JSON
Saving JSON dump to file "JSON_VULKAN.json"
Test basics
Test vnaGetAllocatorInfo
Test virtual blocks
Test virtual blocks algorithms
Benchmark virtual blocks algorithms
Alignment,Algorithm,Strategy,Alloc time ms,Random operation time ms,Free time ms
1,TLSF,Default,0.5684,1.802,0.6351
1,Linear,Default,0.6116,2.0894,1.0173
1,TLSF,MIN_MEMORY,0.4404,1.7821,0.6319
1,Linear,MIN_MEMORY,0.3802,1.8538,0.9999
1,TLSF,MIN_TIME,0.421,1.7144,0.6522
1,Linear,MIN_TIME,0.3785,1.9067,0.9979
16,TLSF,Default,1.4293,2.2369,0.6939
16,Linear,Default,0.3765,1.8518,1.0022
16,TLSF,MIN_MEMORY,1.8616,3.6379,0.7029
16,Linear,MIN_MEMORY,0.3808,1.8713,1.0271
16,TLSF,MIN_TIME,0.7092,2.1489,0.7045
16,Linear,MIN_TIME,0.3808,1.8795,1.0175
64,TLSF,Default,1.6448,4.1676,0.7037
64,Linear,Default,0.3809,1.8937,1.0152
64,TLSF,MIN_MEMORY,1.817,4.6938,0.6869
64,Linear,MIN_MEMORY,0.3966,2.0087,1.0144
64,TLSF,MIN_TIME,0.7245,2.0992,0.7062
64,Linear,MIN_TIME,0.3808,1.8716,1.0115
256,TLSF,Default,1.8157,4.7682,0.7052
256,Linear,Default,0.3891,1.8862,1.0088
256,TLSF,MIN_MEMORY,1.8568,4.765,0.6778
256,Linear,MIN_MEMORY,0.3837,1.8848,1.0349
256,TLSF,MIN_TIME,0.7472,2.0387,0.7257
256,Linear,MIN_TIME,0.382,1.8839,1.0164
Test allocation versus resource size
Test Pool MinBlockCount
Test Pool MinAllocationAlignment
Test pools and allocation parameters
Test heap size limit
Testing memory usage:
  VMA_MEMORY_USAGE_UNKNOWN:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=0
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, memoryTypeIndex=0
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=0
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, memoryTypeIndex=0
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, memoryTypeIndex=0
  VMA_MEMORY_USAGE_GPU_ONLY:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=0
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, memoryTypeIndex=0
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=0
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, memoryTypeIndex=0
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, memoryTypeIndex=0
  VMA_MEMORY_USAGE_CPU_ONLY:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=1
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, memoryTypeIndex=1
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=1
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, memoryTypeIndex=1
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, memoryTypeIndex=1
  VMA_MEMORY_USAGE_CPU_TO_GPU:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=2
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, memoryTypeIndex=2
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=2
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, memoryTypeIndex=2
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, memoryTypeIndex=2
  VMA_MEMORY_USAGE_GPU_TO_CPU:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=3
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, memoryTypeIndex=3
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=3
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, memoryTypeIndex=3
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, memoryTypeIndex=3
  VMA_MEMORY_USAGE_CPU_COPY:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=1
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, memoryTypeIndex=1
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, memoryTypeIndex=1
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, memoryTypeIndex=1
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, memoryTypeIndex=1
  VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED:
    Buffer TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, FAILED with res=-8
    Buffer TRANSFER_DST + VERTEX_BUFFER: memoryTypeBits=0xFF, FAILED with res=-8
    Image OPTIMAL TRANSFER_DST + TRANSFER_SRC: memoryTypeBits=0xFF, FAILED with res=-8
    Image OPTIMAL TRANSFER_DST + SAMPLED: memoryTypeBits=0xFF, FAILED with res=-8
    Image OPTIMAL SAMPLED + COLOR_ATTACHMENT: memoryTypeBits=0xFF, FAILED with res=-8
Testing device coherent memory...
Testing budget...
Testing aliasing...
  size: max(1441792, 8896880) = 8896880
  alignment: max(65536, 65536) = 65536
  memoryTypeBits: 255 & 255 = 255
Testing allocation aliasing...
VUID-vkAllocateMemory-pAllocateInfo-01713 ║ Validation Error: [ VUID-vkAllocateMemory-pAllocateInfo-01713 ] Object 0: handle = 
0x1cbd17a8e20, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xe9a2b96f | vkAllocateMemory: attempting to allocate 314572800 
bytes from heap 0,but size of that heap is only 268435456 bytes. The Vulkan spec states: pAllocateInfo->allocationSize must be less than 
or equal to VkPhysicalDeviceMemoryProperties::memoryHeaps[memindex].size where memindex = 
VkPhysicalDeviceMemoryProperties::memoryTypes[pAllocateInfo->memoryTypeIndex].heapIndex as returned by 
vkGetPhysicalDeviceMemoryProperties for the VkPhysicalDevice that device was created from (https://vulkan.lunarg.com/doc/view
/1.3.246.0/windows/1.3-extensions/vkspec.html#VUID-vkAllocateMemory-pAllocateInfo-01713)
IAmNotHanni commented 1 year ago

I will look into this and try to find a solution for the problem.