SwiftShader out of device memory error

50 views
Skip to first unread message

Dov Grobgeld

unread,
Sep 15, 2020, 2:21:53 PM9/15/20
to swiftshader
Hello,

I'm using SwiftShader for Vulkan rendering for a project where I can't rely on having a functioning hardware implementation. Today I encountered an ERROR_OUT_OF_DEVICE_MEMORY when trying to allocate a large chunk of device memory through vkCreateBuffer(). Since SwiftShader is a software implementation, I assumed that the device memory is configurable. Is it? If so, how is it configured?

Here is my call that fails:

size_t sz=1323371088; // > 1GB size_t usage_flags = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; VkBufferCreateInfo bufferCreateInfo = vks::initializers::bufferCreateInfo(usageFlags, size); bufferCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; int ret = vkCreateBuffer(device, &bufferCreateInfo, nullptr, buffer);

(This example is using the VulkanInitializers.hpp macros by Sasha Willems.)

Thanks in advance!

Alexis Hétu

unread,
Sep 15, 2020, 2:39:11 PM9/15/20
to Dov Grobgeld, swiftshader
Hi, "device memory" is just regular RAM for SwiftShader, but the issue here is that your allocation exceeds the limit advertised by VkPhysicalDeviceMaintenance3Properties::maxMemoryAllocationSize, which, for SwiftShader, is 1Gb.
This limit can be queried by using a VkPhysicalDeviceMaintenance3Properties structure as a pNext pointer to the VkPhysicalDeviceProperties2 structure and call vkGetPhysicalDeviceProperties2().

Alexis

--
You received this message because you are subscribed to the Google Groups "swiftshader" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftshader...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swiftshader/3f009629-dbf7-4af6-ab58-8b859e21addcn%40googlegroups.com.

Dov Grobgeld

unread,
Sep 15, 2020, 2:44:09 PM9/15/20
to swiftshader
Thanks for the explanation!

Is there any way of increasing maxMemoryAllocationSize without recompiling swiftShader?

Nicolas Capens

unread,
Sep 15, 2020, 2:46:21 PM9/15/20
to Dov Grobgeld, swiftshader
Hi Dov,

The maximum allocation size is currently hard-coded to be 1 GiB. This can be increased up to 2 GiB by adjusting the code and recompiling. It can currently be no more than 2 GiB due to signed 32-bit indices being used to address resources.

Increasing it to 4 GiB could be feasible by using unsigned indices, but it's not straightforward due to some of Vulkan's data offsets being signed.

Cheers,
Nicolas

Reply all
Reply to author
Forward
0 new messages