The Radeon™ Memory Visualizer (RMV) collects a wealth of memory usage information for graphics-based applications, but finding a specific resource of interest can be daunting.
Starting with version 1.3 of RMV, resource naming is supported for DirectX® 12 applications. Previously, this feature was only available for Vulkan®-based applications. Resource naming provides a convenient way to identify resources shown in the RMV GUI.
Note that the Radeon Developer Panel (RDP) version 2.5 or newer is required to dump memory traces with resource naming.
The latest versions of RMV and RDP are available for download as part of the Radeon Developer Tool Suite.
The workflow
The first step is to make use of the DirectX 12 ID3D12Object::SetName()
method to assign a custom name to the resource.
The sample source code below shows how to set the name of a texture resource (see line 25).
ComPtr CreateMyTexture(ComPtr device)
{
ComPtr texture = nullptr;
CD3DX12_RESOURCE_DESC texture_description(D3D12_RESOURCE_DIMENSION_TEXTURE2D,
0,
512,
512,
1,
1,
DXGI_FORMAT_BC1_UNORM,
1,
0,
D3D12_TEXTURE_LAYOUT_UNKNOWN,
D3D12_RESOURCE_FLAG_NONE);
device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
D3D12_HEAP_FLAG_NONE,
&texture_description,
D3D12_RESOURCE_STATE_COPY_DEST,
nullptr,
IID_PPV_ARGS(&texture));
// Set the resource name that will be displayed in RMV.
texture->SetName(L"My texture");
return texture;
}
Once the client application has been updated to use SetName()
, a memory dump can be taken with RDP as explained in the Radeon Developer Panel online documentation. The dump can then be loaded into RMV.
Displaying Named Resources
After loading the RMV trace into the RMV application, take a snapshot by right clicking anywhere on the timeline.
The snapshot is added to a list below the timeline.
Open the snapshot by double clicking it and select the Resource listing tab. Notice that the named resources are listed in the table. A resource hash ID is used for resources which haven’t been given a name. If there are many resources listed, type the resource name of interest into the Search edit field. Only resources matching the Search text will be shown in the list.
In addition to the Resource list, resource naming is supported in a number of other RMV UI panes:
Troubleshooting
Behind the scenes, the Resource naming solution for DirectX 12 relies on Microsoft’s® Event Tracing for Windows (ETW). Group permissions must be properly set in order for RDP to collect the Resource name events. The Radeon Developer Tool Suite contains a AddUserToGroup.bat script in the /scripts folder that may need to be run to enable permissions. RDP will display a warning message if there is a problem opening the ETW session.
The RDP log file contains DebugNameTokenEmitter::HandleDebugNameEvent
entries for each ETW resource name event processed and written to the RMV file. If these log entries are not seen, it may indicate an issue accessing ETW or the application isn’t enabled to set DirectX 12 object names. Some client applications may need to be run in debug mode or have a specific way to enable named resources. Consult with the developer or documentation of the application to determine the requirements.
The IDs included with the ETW resource name events need to be matched up with resource IDs. To do this, the video driver emits correlation data included in the RMV file. Be sure to use the latest driver when capturing memory traces with RDP.
Conclusion
Resource naming can make it easy to zero in on specific allocations shown in RMV. Of course the reverse is also possible. When a leak is found with RMV, the custom named resources can be quickly located back in the client application’s source code.
Find that needle in the haystack with a little help from resource naming.
More detailed information on RMV can be found in the online documentation.
For more information regarding DirectX 12 resource naming, please refer to Microsoft’s ID3D12Object::SetName method documentation.
Get the Radeon Developer Tool Suite today!
The latest version of the Radeon Memory Visualizer is available as part of the Radeon Developer Tool Suite.
Related content
Radeon™ Developer Panel
The RDP provides a communication channel with the Radeon™ Adrenalin driver. It generates event timing data used by the Radeon™ GPU Profiler (RGP), and the memory usage data used by the Radeon™ Memory Visualizer (RMV).
Unified Radeon™ GPU Profiler and Radeon™ Memory Visualizer usage with Radeon™ Developer Panel 2.1
This tutorial explains how to take advantage of the functionality in RDP v2.1 onwards, which unifies the RMV and RGP functionality from earlier versions to provide a unified workflow.
Getting Started with Radeon™ Memory Visualizer (RMV)
Radeon™ Memory Visualizer (RMV) is a tool provided by AMD for use by game engine developers. It allows engineers to examine, diagnose, and understand the GPU memory management within their projects.
Radeon™ Memory Visualizer
Radeon™ Memory Visualizer (RMV) is a tool to allow you to gain a deep understanding of how your application uses memory for graphics resources.
Glen Kwasny
Glen Kwasny is a Member of the Technical Staff at AMD in the Radeon Developer Tools Group. Glen's current focus is backend and UI development for the Radeon Memory Visualizer.
Anthony Hosier
Tony Hosier is a member of AMD's GPU Tools team and is currently the team lead for the Radeon™ Memory Visualizer. In his career, Tony has worked on a variety of PC, handheld, and online games.