VSG failed to allocate dynamic data more than 4 GB #1160
-
When allocated memory of all buffers marked with DYNAMIC_DATA exceeeds 4 GB, vkAllocateMemory return error code VK_ERROR_OUT_OF_DEVICE_MEMORY. It happens then allocating memory for staging buffer with createBufferAndMemory() function: if (!staging || staging->size < totalSize)
{
VkMemoryPropertyFlags stagingMemoryPropertiesFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
staging = vsg::createBufferAndMemory(device, totalSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_SHARING_MODE_EXCLUSIVE, stagingMemoryPropertiesFlags);
auto stagingMemory = staging->getDeviceMemory(deviceID);
buffer_data = nullptr;
result = stagingMemory->map(staging->getMemoryOffset(deviceID), staging->size, 0, &buffer_data);
if (result != VK_SUCCESS) return result;
} I have seen in Vulkan documentation: Some platforms may have a limit on the maximum size of a single allocation. For example, certain systems may fail to create allocations with a size greater than or equal to 4GB. Such a limit is implementation-dependent, and if such a failure occurs then the error VK_ERROR_OUT_OF_DEVICE_MEMORY must be returned. This limit is advertised in [VkPhysicalDeviceMaintenance3Properties]. Is it a bug? If not, how it can be avoided? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This doesn't sound like a bug, but a limit of driver/hardware. Allocating over 4GB of dynamic data is the thing to address. Why are you requiring so much dynamic data? FYI, a couple of weeks back I extended vsg::TransferTask to support assignment of incidental static vsg::BufferInfo/ImageInfo: This should make it possible to leave more data left as STATIC_DATA and when the application needs to update that data it manually adds it the TransferTask which then transfers the data to the GPU and then removes the BufferInfo/ImageInfo entry from the TransferTask. This is ideal for data that rarely changes. DYNAMIC_DATA is best reserved for data that is regularly changed. |
Beta Was this translation helpful? Give feedback.
This doesn't sound like a bug, but a limit of driver/hardware.
Allocating over 4GB of dynamic data is the thing to address. Why are you requiring so much dynamic data?
FYI, a couple of weeks back I extended vsg::TransferTask to support assignment of incidental static vsg::BufferInfo/ImageInfo:
#1141
This should make it possible to leave more data left as STATIC_DATA and when the application needs to update that data it manually adds it the TransferTask which then transfers the data to the GPU and then removes the BufferInfo/ImageInfo entry from the TransferTask. This is ideal for data that rarely changes.
DYNAMIC_DATA is best reserved for data that is regularly changed.