It's not correct to say that - as a general case - GPUs have a fixed limit on the number of allocations that may be made.
What the Vulkan documentation for
VkPhysicalDeviceLimits specifies is that:
maxMemoryAllocationCount is the maximum number of device memory allocations, as created by vkAllocateMemory, which can simultaneously exist.
The key destinction here is that the limit only applies to allocations that can simultaneously exist. For example, if the maximum is 256, and if you have 256 simultaneous allocations, then you've obviously hit that maximum. However, if you subsequently free 128 of those, then you can obviously make a further 128 new allocations.
If we drill down further into the documentation for
vkAllocateMemory, we find the following statement:
The maximum number of valid memory allocations that can exist simultaneously within a
VkDevice may be restricted by implementation- or platform-dependent limits.
This therefore tells us that the limit may be imposed by the hardware, by the driver or by the underlying OS, but also that in some cases there may not be such a limit.
Looking further at https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html in "Table 48. Required Limits" we find the entry for
maxMemoryAllocationCount and we see that it specifies a required minimum value of 4096, with no specified maximum.
From this we can say that a Vulkan device is required to support at least 4096, but (once more) may also have no limit on the count of, simultaneous allocations.
This is obviously to enable Vulkan to be implemented on the widest possible range of hardware; hardware where such limits might exist and hardware where they might not.
To wrap it all up.
- Vulkan allows for the capability of drivers to restrict the number of simultaneous allocations that may exist.
- This restriction is just on the number of simultaneous allocations, not the absolute number of total allocations.
- Vulkan also allows for this number to be unrestricted.
- Whether the number is restricted or not depends on the individual implementation.
- This is a Vulkan-specific feature which may not exist in other APIs.