Author Topic: AMD Vulkan Memory Allocator  (Read 4396 times)

0 Members and 1 Guest are viewing this topic.

Stefan

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4428
    • View Profile
AMD Vulkan Memory Allocator
« on: June 21, 2017, 11:09:59 PM »
Vulkan Memory Allocator library and accompanying sample application.

Problem Statement

Memory allocation and resource (buffer and image) creation in Vulkan is difficult (comparing to older graphics API-s, like D3D11 or OpenGL) for several reasons:
 
  • It requires a lot of boilerplate code, just like everything else in Vulkan, because it is a low-level and high-performance API.
  • There is additional level of indirection: VkDeviceMemory is allocated separately from creating VkBuffer/VkImage and they must be bound together. The binding cannot be changed later - resource must be recreated.
  • Driver must be queried for supported memory heaps and memory types. Different IHV-s provide different types of it.
  • Resources that don't fit in VRAM are not automatically evicted to RAM. Developer must handle out-of-memory errors on his own.
  • It is recommended practice to allocate bigger chunks of memory and assign parts of them to particular resources.
  Features

This library is helps game developers to manage memory allocations and resource creation by offering some higher-level functions. Features of the library could be divided into several layers, low level to high level:
 
  • Functions that help to choose correct and optimal memory type based on intended usage of the memory.
    • Required or preferred traits of the memory are expressed using higher-level description comparing to Vulkan flags.
  • Functions that allocate memory blocks, reserve and return parts of them (VkDeviceMemory + offset + size) to the user.
    • Library keeps track of allocated memory blocks, used and unused ranges inside them, finds best matching unused ranges for new allocations, takes all the rules of alignment into consideration.
  • Functions that can create an image/buffer, allocate memory for it and bind them together - all in one call.


reg

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Adam Sawicki - Home Page
Re: AMD Vulkan Memory Allocator
« Reply #1 on: August 28, 2018, 10:37:38 AM »
Vulkan Memory Allocator version 2.1.0-beta.1 has been released yesterday after few months of development. It adds many new features, including:
  • Added linear allocation algorithm, accessible for custom pools, that can be used as free-at-once, stack, double stack, or ring buffer.
  • Added feature to record sequence of calls to the library to a file and replay it using dedicated application.
  • Improved support for non-coherent memory.
  • Improved debug features related to detecting incorrect mapped memory usage.
  • Changed format of JSON dump to include more information and allow better coloring in VmaDumpVis.
And of course many smaller bug fixes, improvements and additions.

You can find the library here: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator

It is a single C++ header file, released under MIT license.

JeGX

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2110
    • View Profile
    • Geeks3D.com
Vulkan Memory Allocator 2.1
« Reply #2 on: September 11, 2018, 01:30:55 PM »
Quote
We released Vulkan Memory Allocator 1.0 (VMA) back in July last year, but we’ve been remiss in posting about the progress of the library as it marched onwards, despite hitting a decent marker of maturity with the 2.0 release back in March this year. Let’s correct that with the release of 2.1 today.

Since extracting the library from a game he was working on to make it generally useful by any Vulkan® client application, Adam Sawicki, VMA’s chief engineer, has been mostly feedback-driven in the road to 2.0 and beyond. Real games and applications using the library have shaped the features and evolution of the code, and feedback from the community that’s using it leads us to believe it’s now integrated into a majority of in-development Vulkan-based games and apps on PC today.

For example, the EA SEED team’s Halcyon engine that they’ve developed for their future-looking research. Halcyon powers the Project PICA PICA demo that SEED released in March to show off their work with DirectX ray-tracing, but also supports Vulkan as a traditional rendering API, using VMA internally to manage memory. In fact, SEED were one of the earliest adopters of the library back when we released 1.0 and have used it ever since, giving us great feedback along the way. Thanks, Graham!

In a similar vein, Confetti Interactive use it in their Forge open source cross-platform rendering engine, and were possibly the first ever user of the library outside of AMD in a production Vulkan environment, integrating it even before we formally released 1.0!

Last but not least by any means, the Google team working on Filament, a modern engine primarily aimed at Android games but which is also cross-platform, also integrated VMA into their rendering system. Vulkan’s maturity on Android has helped it push into mobile-focused engines. Exposure to the underlying platform architecture of today’s mobile devices — where it’s quite different to common PC systems and especially where the memory subsystem is concerned — has helped make VMA more robust and helped it consider how more types of games and applications consume and manage their Vulkan memory.

There’s also been a natural evolution in the new features of the library as it has matured. More optimal allocation strategies, support for defragmentation, and more developer-focused profiling and debugging support is all there now. The future also looks bright: we internally sponsor VMA as an active research project for Adam and other engineers to work on it, dedicating time to experimentation inside the library to make sure it stays great.

We want to continue to make it useful in the future, as games and their use of Vulkan — and the Vulkan API itself! — matures.

Link: https://gpuopen.com/vulkan-memory-allocator-2-1/

VMA 2.1:
- https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/releases/tag/v2.1.0
- https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator

reg

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Adam Sawicki - Home Page
Re: AMD Vulkan Memory Allocator
« Reply #3 on: December 14, 2018, 10:08:46 PM »
New version of Vulkan Memory Allocator library has been released - v2.2.0:

https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/

Quote
Notable new features: defragmentation of GPU memory, buddy algorithm, convenience functions for sparse binding.

reg

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Adam Sawicki - Home Page
Re: AMD Vulkan Memory Allocator
« Reply #4 on: March 15, 2019, 10:39:07 PM »
Everyone who uses or considered using Vulkan Memory Allocator library is invited to fill in a survey, to help shape the future of the library:

https://t.co/Ivap5BH4jP - Vulkan Memory Allocator Survey March 2019