Microsoft has released a new DirectX 12 update that can allow both processors to simultaneously access GPU memory. The feature is called GPU Upload Heaps and is available in the Agility SDK 1.710.0. GPU Upload Heaps is another function that can be utilized as a part of Resizable BAR to improve performance by eliminating the need to copy data between the CPU and GPU. Microsoft explains that this new feature addresses an issue where apps could not fully access the frame buffer of a discreet video GPU.
From Microsoft:
It used to be typical for a discrete GPU to have only a small portion of its frame buffer exposed over the PCI bus. D3D chose not to expose this because the I/O region for a frame buffer is usually only 256MB, which is not that useful. A bigger problem was that it’s not a properly virtualizable resource. If app A comes in and allocates all 256MB, then app B wouldn’t be able to allocate any. So we can’t provide any guarantees around it, at which point it seemed like a bad idea to expose it to apps.
However, now there are a lot of GPUs that support a resizable base address register(also known as Resizable BAR). With a resizable bar, Windows will renegotiate the size of a GPU’s BAR in WDDM Version 2.0 and later. Another good reason for D3D12 to expose Resizable BAR is that some performance testing on some platforms has shown that games perform better with resizeable BAR enabled.”
GPU Upload Heaps does not require anything from the user other than having Resizable Bar enabled on compatible hardware along with up-to-date drivers. Resizable BAR has already shown impressive gains with AMD and NVIDIA graphics since its release and Intel recommends it for optimal performance of its Arc Alchemist graphics cards. As the feature has only just been released it will take time for developers to implement the DirectX 12 update following their own testing. Developers must follow steps in order to utilize GPU Upload Heaps as it is not automatically utilized by DirectX but they do not appear to be overly complicated.
Instructions
- Create a resource using D3D12_HEAP_TYPE_GPU_UPLOAD, with D3D12_CPU_PAGE_PROPERTY_UNKNOWN and D3D12_MEMORY_POOL_UNKNOWN. (Or D3D12_HEAP_TYPE_CUSTOM, then use GetCustomHeapProperties to get the page property and memory pool)
- Use Map to get a CPU pointer to the resource and upload CPU data to the resource.
- Optional (Pix): Use TrackWrite to notify Pix about modifications to the resource.
- Use the resource directly without copying the resource to a default heap.