GPU Memory Usage
Timing captures can track GPU memory usage, and PIX can show how heaps and resources are created and managed with respect to the underlying GPU memory. This can be used to understand and optimize heap residency and troubleshoot performance issues caused by paging between local and non-local GPU memory.
To capture GPU memory details, expand the Options pane for Timing Capture, make sure the Capture GPU memory usage option is enabled (it is on by default), and take a capture as described above. GPU memory information can be captured for both Immediate and Continuous timing captures.
When you open a timing capture with GPU memory usage, you’ll see an additional top-level tab called GPU Memory Usage with three views as shown below: Events, Resources & Heaps, and Timeline.
The Events view should already be familiar, but it includes a new drop-down called Event Category. If you select the new Memory option, PIX lists all the memory events. This shows when heaps are created, made resident and so forth.
The Resources & Heaps view lets you inspect all the tracked resources and heaps in the capture. Named heaps and resources can easily be located using the Filter option. The Residency column provides a quick overview of the residency status of each heap during the capture making it easy to spot heaps that changed residency or were never resident during the capture. Similarly, the Resources column shows the number of resources per heap making it easy to discover heaps with no resources in them. By default, PIX also shows the history for the selected heap or resource which is useful for understanding how the heap or resource is used through the duration of the capture.
Please note that in this release PIX only tracks D3D12 resource heaps. Additional tracking for data such as command allocators, pipeline state objects, and descriptor heaps will be added in future releases of PIX.
Finally, the Timeline shows a number of graphs and timelines for various GPU metrics and events from the set listed below.
- Local GPU Memory tracks amount of memory Budget, Commitment, and Usage the application asked to be placed in local memory segments.
- Non-Local GPU Memory tracks amount of memory Budget, Commitment, and Usage the application asked to be placed in non-local memory segments.
- Demoted GPU Memory shows demoted heaps and resources per priority category (Min, Low, Normal, High, and Max). For more information on residency priorities see the Residency section of Memory Management in Direct3D 12.
- Created shows when the heaps are created.
- Destroyed shows when the actual allocated heaps are destroyed.
- Evict shows the evict operation(s) corresponding to individual ID3D12Device::Evict calls.
- MakeResident shows the make resident operation(s) corresponding to individual ID3D12Device::MakeResident calls.
- Paging (Local to NonLocal) shows memory transferred from Local GPU memory to non-local GPU memory.
- Paging (NonLocal to Local) shows memory transferred from non-local GPU memory to local GPU memory.
Keep in mind, that the default behavior of PIX is to only show lanes that contain data, so for example if you don’t see the Destroyed lane that means that no heaps were destroyed during the capture. To show or hide additional lanes use the Settings option.
It is not uncommon to only see a limited number of heaps on the Created timeline. This just means that the other captured heaps were created prior to starting the capture. These heaps still show up in the Resources & Heaps view, and PIX can show their attributes and usage, but is not able to identify when they were created.