0

I am currently building a game engine in C++ which uses vulkan for rendering. While implementing a terrain renderer I reached a hardware limit, the maxMemoryAllocationCount which limits the amount of allocated memory blocks. I checked https://vulkan.gpuinfo.org/ to see how high that value on different GPUs is. When looking at the "GeForce GTX 1080 Ti", the value is 4096 for windows but 4294967296 for arch/manjaro. Why is there a difference between those OSes, when this really should be a hardware limitation?

Brotcrunsher
  • 1,964
  • 10
  • 32
  • `4294967296` is 2^32. `maxMemoryAllocationCount` is `uint32_t` which can hold values between `0` and `4294967295`/`2^32-1`. So the value is most likely just garbage. – Simon Kraemer Nov 15 '17 at 17:17
  • @SimonKraemer: It's not garbage. It means "as many as you want". – Nicol Bolas Nov 15 '17 at 17:32
  • 1
    4096 memory allocations is quite a big number. If You hit this limit, this means You should allocate smaller number of much larger memory objects. – Ekzuzy Nov 15 '17 at 17:54

1 Answers1

7

Why "should" it be a hardware limitation?

With 4 exceptions, every Windows implementation is limited to 4096 allocations. And those exceptions are either open-source RADV hacked to run on Windows or early drivers that returned bogus values.

So clearly, Windows as an OS is imposing this limitation. After all, the OS owns the GPU and must be involved in any memory allocations.

It is the right of the OS to prevent a process from engaging in pathological behavior. Windows seems to think that making lots of GPU allocations is pathological (and they're not wrong), so the WDDM model imposes a low-but-reasonable limit on GPU allocations.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • That "should" part is because maxMemoryAllocationCount is part of the physical device limits. "Physical Device Limit" seems to be not that strict here. – Brotcrunsher Nov 15 '17 at 18:30
  • @Brotcrunsher: It's `VkPhysicalDeviceLimits`. As in, the limits for `VkPhysicalDevice`s. The words "physical device" has a specific meaning in Vulkan, and it has nothing to do with a specific piece of silicon. – Nicol Bolas Nov 15 '17 at 18:32
  • 1
    @Brotcrunsher Graphics hardware (physical device) can only operate in an area defined by the operating system. So even if the silicon itself is capable of allocating much larger number of memory objects, it cannot do it if operating system doesn't allow for that. So in this case it doesn't even matter if it is a "real" hardware limitation or an OS constraint - this hardware/driver/OS combination forbids You to allocate more than 4096 memory objects. – Ekzuzy Nov 15 '17 at 21:44