Dynamically Allocate Memory with Unified Memory Architecture (UMA) Graphics Processing Units (GPUs)
Many graphic-intensive applications, especially games, require a minimum amount of video memory to run correctly, or to run at all. Unified Memory Architecture (UMA) Graphics Processing Units (GPUs) dynamically allocate system memory for use as graphics memory. They balance 2D and 3D graphics and system performance. Graphics memory is allocated based on system requirements and application demands (up to the configured maximum amount). When an application no longer needs memory, the dynamically allocated portion returns to the operating system for other uses.
Intel recommends that developers use the following methods to detect the maximum possible video memory budget available to their application:
Microsoft DirectX* 12
For Microsoft DirectX* 12, use the QueryVideoMemoryInfo()
approach:
We recommend applications detect the video memory budget using a query to the QueryVideoMemoryInfo()
method. This is the most accurate method and also gives the operating system the chance to dynamically limit this to what you're actually budgeted for: 2 GB for all 4th generation and earlier Intel® Core™ processors, and total available memory divided by two for 5th generation and later Intel Core processors. These apps can also subscribe to a budget change notification via RegisterVideoMemoryBudgetChangeNotificationEvent()
.
Microsoft DirectX* 11
For Microsoft DirectX* 11, use the DXGI_ADAPTER_DESC
approach:
We recommend using the SharedSystemMemory
(50 percent of the available memory) within the DXGI_ADAPTER_DESC
structure. On discrete graphics cards, DedicatedVideoMemory
is the amount of onboard video RAM (VRAM). For Intel integrated graphics GPUs, everything uses shared resources with UMA so the DedicatedVideoMemory
value is instead populated by a 128 MB dummy value to prevent crashes in legacy code. Consult other vendors for how they handle this.
The QueryVideoMemoryInfo()
approach explicitly defines the "Budget" value as a UINT64
in the DXGI_QUERY_VIDEO_MEMORY_INFO
structure. With the DXGI_ADAPTER_DESC
approach, Microsoft* stores the system memory information as a SIZE_T
(defined as an unsigned long) in the DXGI_ADAPTER_DESC
structure and can be problematic. Depending on how the compiler treats UINT64
and SIZE_T
, and whether your app is 32 bit or 64 bit, the difference between what the video memory budget appears to be and what it actually is could be a margin upwards of 50 percent to 90 percent.
For applications other than DirectX, use the D3DKMT API:
This approach mirrors the suggested DX11 method. We recommend using the SharedSystemMemorySize
within the D3DKMT_SEGMENTSIZEINFO
structure. Populate this value through queries to D3DKMTQueryAdapterInfo()
of an adapter info type KMTQAITYPE_GETSEGMENTSIZE
.
Summary
Detect your video memory budget and then dynamically allocate system memory as graphics memory with UMA GPUs to improve the performance of your graphics-intensive applications
For more details, see this article from Microsoft on Calculating Graphics Memory.