The Radeon™ Memory Visualizer (RMV)¶
The Radeon Memory Visualizer is a memory optimization tool that can be used by developers to optimize memory usage for DirectX® 12, Vulkan™ applications for AMD GCN and RDNA™ hardware.
This document describes how the Radeon Memory Visualizer can be used to examine a memory trace file.
Supported graphics APIs, RDNA and GCN hardware, and operating systems¶
- DirectX 12
Supported RDNA and GCN hardware
- AMD Radeon RX 6000 series
- AMD Radeon RX 5000 series
- AMD Radeon VII
- AMD RX Vega 64 and RX Vega 56
- AMD Ryzen™ Processors with Radeon Vega Graphics
- AMD Radeon R9 Fury and Nano series
- AMD Radeon RX 400 and RX 500 series
- AMD Tonga R9 285, R9 380
Supported Operating Systems
- Windows® 10/11
- Ubuntu® 20.04
Radeon Memory Visualizer - Quick Start¶
How to generate a memory trace¶
The first thing you will need to do is generate a memory trace. Currently, this is done via the Radeon Developer Panel. Read the documentation provided with this distribution for information on how to create a memory trace. This can be obtained from within the Radeon Developer Panel or from the link on the Radeon Memory Visualizer “Welcome” view. The documentation is also available online at: http://radeon-developer-panel.readthedocs.io/en/latest/
This documentation can also be found online at: http://radeon-memory-visualizer.readthedocs.io/en/latest/
Starting the Radeon Memory Visualizer¶
Start RadeonMemoryVisualizer.exe (this is the tool used to view memory trace data).
How to load a trace¶
There are a few ways to load a trace into RMV.
- Use the “File/Open trace” pull down menu, or the “File/Recent trace” pull down menu item.
- Go to the “Welcome” view and click on the “Open a Radeon Memory trace…”
- Go to the “Welcome” view and click on a trace that you have previously loaded in the Recent list.
- Go to the Recent traces view to see a full list of all your recent traces.
Notice that there is additional information provided for each trace when viewed in this pane, such as the date when the trace was last accessed. It is also possible to remove recent traces from the list using the “Remove from list” link button. Note that they will only be removed from the list; they won’t be deleted from the file system. There is also a link button, “Open file location” to open the folder where that trace file is on the disk.
- Drag and drop a memory trace file onto the Radeon Memory Visualizer executable, or onto an already open RMV instance.
The Radeon Memory Visualizer user interface¶
RMV uses the concepts of traces and snapshots. A trace is the file which has been loaded as described in the previous section. A memory trace file contains various memory-related events that happened on the GPU over time (memory allocations, deallocations, binding resources etc). A snapshot is the state of the GPU at a particular instance in time. Using snapshots, it is possible to examine which memory has been allocated and where resources can be found. It is also possible to compare snapshots to look for memory leaks. For example, a snapshot could be taken before starting a game level and another snapshot taken after completing the level. Ideally, the 2 snapshots should be the same.
There are four main menus in the Radeon Memory Visualizer and each may have a number of sub-windows..
- Welcome - Shows links to help documentation, and a list of recently opened traces, and a sample trace.
- Recent traces - Displays a list of the recently opened traces.
- About - Shows build information about RMV and useful links.
Gives an overview of memory consumption over time. Allows for the viewing and creation of snapshots
- Heap overview - Gives an overview of the heaps available and their associated properties
- Resource overview - Gives an overview of the total resources allocated and shows their relative sizes and types
- Allocation overview - Shows the resources within each allocation
- Resource list - Shows the properties for all the resource in all allocations
- Allocation explorer - Shows the resources within a chosen allocation
- Resource details - Display more information about a selected resource
- Snapshot delta - Shows an overview of the differences between one snapshot and another
- Memory leak finder - Shows allocations from each snapshot and how those allocations intersect to help locate memory leaks
Check for updates If checked, the Radeon Memory Visualizer will alert you that a new version is available for download.
Themes and colors¶
The visualizer makes heavy use of coloring to display its information. This pane allows users to thoroughly customize those colors.
Here users will find the Keyboard shortcuts pane:
The Global navigation section refers to keystrokes that aid user navigation, and are always detected regardless of which pane is visible.
The Timeline controls shortcuts are specific to zooming and panning operations that can be performed within the Timeline view (see below).
The Global hotkeys section refers to any hotkeys available anywhere in the product. Currently there are hotkeys to open and close a trace file and to cycle through the different time units from any pane, rather than having to go to the settings. This allows you to view a timeline in clock cycles, milliseconds, seconds or minutes very quickly.
All users are encouraged to adopt these keystrokes while using RMV.
The Timeline windows¶
The timeline tab shows the overview of the trace and the system.
The Snapshot generation view will be the first view shown when a memory trace file has loaded. It will show a graphical representation of the memory usage over time for a number of processes running on the system, including the application started by the user. Currently only the user’s process is available.
RMV uses the concept of snapshots. A snapshot is the memory state at a particular moment in time. Using multiple snapshots, it is possible to visualize how memory is being used by an application over time. It is also possible to compare snapshots to check to see if memory is being release or whether there are memory leaks.
Snapshots will be displayed in a table below the timeline graph. If there are no snapshots in the trace, the area under the timeline graph will indicate that there is nothing to show and offer some guidance of what may be required, as shown above. There are other instances in the tool showing similar displays, such as a resource table being empty if the selected allocation contains no resources, or if a resource type has no additional properties to show.
If snapshots were taken while recording, they will be shown as markers on the graph and in the table below the graph.
By default, the graph will be colored by resource type. A color legend below the timeline will indicate what resource these colors represent. The coloring mode can be changed by selecting from the combo box above the top-left of the timeline.
When the mouse is over the timeline, the tooltip help will show information about the memory allocated at the time corresponding to the mouse position. The time can be seen from the ruler above the graph. The most abundant resources are listed and the rest are combined in the last entry as “Other”.
Zoom controls are provided for adjusting the time scale that is viewable on screen and are displayed in the top right of the timeline pane. These are:
Zoom to selection
When Zoom to selection is clicked, the zoom level is increased to a selected region or selected event. A selection region is set by holding down the left mouse button while the mouse is on the graph and dragging the mouse either left or right. A colored overlay will highlight the selected region on the graph. For graphs that support it, an event may be selected by clicking on it with the mouse (either the left or right button). Zoom to selection can also be activated by right clicking on a selection on the graph and choosing the Zoom to selection context menu option. Zooming to a selected event can be accomplished by simply double clicking the event. Pressing the Z shortcut key while holding down the CTRL key activates Zoom to selection as well.
When Zoom reset is clicked, the zoom level is returned to the original level to reveal the entire time span on the graph. The zoom level can also be reset using the H shortcut key.
Increases the zoom level incrementally to display a shorter time span on the graph. The zoom level is increased each time this icon is clicked until the maximum zoom level is reached. Alternatively, holding down the CTRL key and scrolling the mouse wheel up while the mouse pointer is over the graph will also zoom in for a more detailed view. Zooming in can be activated with the A shortcut key. To zoom in quickly at a 10x rate, press the S shortcut key.
Decreases the zoom level incrementally to display a longer time span on the graph. The zoom level is decreased each time this icon is clicked until the minimum zoom level is reached (i.e. the full available time region). Alternatively, holding down the CTRL key and scrolling the mouse wheel down while the mouse pointer is over the graph will also zoom in for more detailed view. Zooming out can be activated with the Z shortcut key. To zoom out quickly at a 10x rate, press the X shortcut key.
When zoomed in on a graph region, the view can be shifted left or right by using the horizontal scroll bar. The view can also be scrolled by dragging the mouse left or right while holding down the spacebar and the left mouse button. Left and right arrow keys can be used to scroll as well.
Snapshots can be taken by right-clicking anywhere on the memory graph. This will bring up a context menu. Clicking on the context menu option “Add snapshot ..” will take a snapshot and add it to the graph and to the snapshot table below the graph. Notice that only the snapshot name is shown in the table; the other table entries will be created when the snapshot is viewed.
Clicking on the snapshot in the table or on the timeline will select that snapshot. Clicking on the SNAPSHOT tab with a snapshot selected, or double-clicking on a snapshot on the table or on the graph will jump to the Heap overview pane on the SNAPSHOT. This process will generate the snapshot data at the required time and returning back to the Snapshot generation will now show the table fully populated for the selected snapshot.
Right-clicking on a snapshot in the table will show a context menu allowing the snapshot to be renamed or deleted. Snapshots can be renamed using any printable ASCII character, including spaces. Snapshot names are limited to 32 characters. Snapshots are saved back to the trace file so they can be viewed at a later date.
Two or more snapshots can be selected in the table by holding down the shift key to select a range of snapshots or pressing Ctrl to select individual snapshots. If 2 snapshots are selected, right-clicking on the table while holding down the Ctrl key will display a context menu to allow them to be compared. Alternatively, the Compare snapshots button in the top right will become active. Clicking on either will jump to the Snapshot delta pane in the COMPARE tab. Alternatively, selecting 2 snapshots in the table and clicking on the COMPARE tab will do the same thing. The snapshots will be compared as base snapshot vs diff snapshot, where the base snapshot is the last (or highlighted) snapshot that was selected, and the diff snapshot is the first snapshot selected. If no snapshot is highlighted or the last snapshot was deselected (in the case where three snapshots are selected and one of those is deselected), the snapshots will be compared in the order they appear in the table.
It is possible to take RGP profiles at the same time as capturing an RMV trace. One thing to bear in mind is that at the point when an RGP profile is taken, the driver will allocate video memory for the RGP profile data. This can be seen in the RMV memory trace as spikes on the timeline corresponding to a resource type of ‘internal’, as seen below.
This pane will show some of the parameters of the video hardware on which the memory trace was taken, showing such things as the name of the video card and the memory bandwidth.
These panes allow the user to analyze single snapshots. The panes can be accessed from the list on the left hand side. Below the list is a combo box which allows quick switching between different snapshots.
This is the default snapshot pane that will be displayed after creating a snapshot. It gives an overview of the amount of memory the application is using and where that memory is allocated. It can be used to very quickly determine if the application is using too much memory of a certain type and if the correct memory type is being used where it should be.
RMV is able to detect if a memory trace was taken from a system with Smart Access Memory (SAM) enabled. SAM gives the CPU direct access to all available video memory. More information on SAM can be found in the GPUOpen article, “How to get the most out of Smart Access Memory” located at https://gpuopen.com/learn/get-the-most-out-of-smart-access-memory/
The top line of the Heap overview pane indicates if SAM is enabled or disabled.
When SAM is disabled, the display is split into 3 sections, one section per heap type. There is a brief description of the use for each heap.
When SAM is enabled, the section for the invisible heap is not shown since all memory is visible to the CPU.
On the left is the amount of memory used for each heap type as a series of bar graphs:
The requested bar graph shows how much of that heap was requested by the application. Just because an application requests memory doesn’t automatically mean the application gets it. If the application requests too much memory, a warning message is displayed. The bar is also color coded to show whether the memory type is oversubscibed or is close to being oversubscribed.
The ‘total size’ bar shows the total amount of physical memory in the heap.
The “Requested” bar shows how much memory the application has requested. This should give an indication of the memory footprint of the application. Memory requests typically request virtual memory under the hood and it is up to the driver to make sure that virtual memory is mapped to physical memory when and where appropriate.
The “Bound” bar shows how much memory has been bound to resources. If there is substantially more requested memory than bound memory, it may indicate that memory has been requested but is not actually being used by the application.
The “Committed” bar shows how much memory has been mapped to physical memory. If the amount of committed memory is substantially less than the amount of memory requested, it may indicate that there are other tasks running on the system that are consuming memory or the application itself is using more memory than is physically available.
The middle column shows a series of statistics for the heap memory type, such as where the memory resides (in system or video memory), whether it is mapped on the CPU and some statistics on the allocations.
The right column shows the makeup of the resource types in each of the heaps. From this, it can be determined if certain resource types are in the optimum memory type for the particular resource (maybe there’s a render target in system memory when ideally it should be in local memory).
This pane will show an overview of the resource used by the application. Most of the display is occupied by a resource view showing a graphical representation of the resources in memory. Resources can be filtered out to only show resources of a particular type or contained in a particular preferred heap. They can also be color-coded according to various attributes (by resource type or preferred heap for example).
Mousing over the resources will darken the resource under the mouse, and a tooltip will show pertinent information for the resource. If resources appear very small on the screen, the Filter by size slider bar can be used to filter out very large or very small resources.
Clicking on a resource will show details about it at the bottom of the pane, including various attributes and where the selected resource lies in its corresponding allocation. Most of this information is now available in the tooltip.
The preferred heap drop down list allows you to select resources you want to include in the resource view according to which heap was the preferred container for the resource at the time the resource was created. You can do this by checking one or more heaps you wish to include resources from.
The resource usage drop down allows selection of resources according to their usage type. Again, this is achieved by checking one or more resource types. For example, unbound resources are not shown by default but this can be changed.
These combo boxes appear on several of the UI’s and they are all independent ie changing heap types on one pane won’t affect the heap types on the other panes that use the heap combo box. Also, the heap selections don’t reset when switching snapshots so that comparisons can quickly be done with the same configuration. However, loading a new memory trace will reset the heap combo boxes to their default state. Currently, there are 3 heap types which are explained a little in the heap overview pane. A fourth heap type in the combo box, Unspecified is used to indicate that this resource does not have a preferred heap.
The color combo box allows you to color the display depending on various resource attributes. Examples include coloring by the resource type (the default) or coloring by resource bind or create times. Using the coloring modes allows you to instantly see the resources with the same parameters. Most of the coloring modes are self-explanatory but the ‘Commit type’ may need some explanation. There are currently 3 commit types:
- This means the resource was created with an implicit heap large enough to contain it. i.e.: The driver stack is being requested to create a full chain of memory mappings down to the physical page.
- The resource was requested to be a placed resource. This means the resource is bound to a previously allocated heap of memory.
- The resource was requested to be a virtual resource. This means that there is no physical memory backing the resource. The resource will have its own virtual address range allocated at the time the resource is created, but that virtual address space will not be mapped to an underlaying physical address range.
There are also 3 slicing combo boxes. These allow you to group resources by some attribute. The first slicing mode applies to all the resources. The other 2 slicing modes are applied to the groups set up by the previous slicing mode.
The screenshot below shows slicing and coloring resources depending whether they are in the preferred heap. You can tell instantly if resources are where you’d expect them to be and if not, investigate further by double-clicking on the resource which will jump to the Resource details pane.
If the resource is displayed with a ‘stippled’ effect, it means the resource is aliased indicating that 2 or more resources are sharing the same memory. In the screenshot below, the stippling effect can be seen on the command buffer.
This pane will show the allocations and all the resources in each allocation. Again, the resources will have a stippled effect if they are aliased.
Filtering by preferred heap is provided so that only resources in the specified preferred heaps are shown.
The coloring mode can be changed using the ‘color by .. ‘ combo box, which will color the resources and allocations by various parameters, for example, resource usage, and the preferred heap type.
The allocations can be sorted using the sort combo box at the top. Sorting is currently based on allocation size, allocation Id, allocation age or resource count (the number of resources in the allocation). Another combo box to the left allows the sort to be in ascending or decending order.
Normally, allocations are sized relative to the largest allocations. Sometimes this makes smaller allocations difficult to see. The ‘Normalize allocations’ check box will draw all allocations the same length, as seen below:
Also notice that the allocations are slightly taller than in the previous screenshot. The allocation height is controlled via the slider at the top, either allowing more allocations to be visible or showing more detail for a particular allocation. This is necessary in the case of aliased resources, where resources share the same underlying memory. The ‘Show aliasing’ check box will toggle between showing resources as a stacked display. If aliasing isn’t present, the allocation display will be unchanged. This is demonstrated below:
Here, there is aliasing on a depth-stencil buffer, and some of the render targets and textures. Normally these would be shown as single resources as seen in the previous image, but switching on the aliasing display, it can be seen that in the case of the depth-stencil buffer, the 3 resources share the same underlying memory. Also the height of the allocations has been increased to show the stacking more clearly.
The allocations can also be filtered using the search box. An allocation will only be shown if any part of its displayed text matches the text in the search box. This way, allocations can be filtered by size, heap type or number of resources.
Double-clicking on a resource will jump to the Allocation explorer.
The carousel is displayed on the Resource list panes and displays high level information about the resources in the current snapshot. It can be seen as an overview to answer high level questions such as ‘How much memory in each heap is my application using?’ or ‘How large are my allocations?’.
The Allocation sizes shows the sizes of allocations arranged in buckets. It is easy to see at a glance how many allocations are being used and their relative sizes.
The Committed memory shows the amount of memory that this application has committed to physical memory for each of the heap types. Ideally, all memory that the application has requested should be in physical memory.
The Requested virtual memory shows which memory was requested from which heap. The same coloring scheme is used as in the Heap overview pane so it is easy to see if certain heaps are over or undersubscribed.
The Resource types shows the makeup of the resources contained within the allocations. The most popular ones are displayed with everything else bucketed in the “Other” category.
The Virtual memory shows how much memory has resources bound to it. Unbound memory is effectively usused so should be minimized as much as possible. Sometimes due to alignment issues this is not possible but if there is a lot of unbound memory, this will be seen in the Allocation overview pane for each allocation.
The carousel is also shown in the Snapshot delta pane but here it shows the differences between the 2 selected snapshots.
This view will show a list of all the resources in table form for all allocations.
The top of the view shows the carousel, described earlier.
The preferred heap and resource usage filter combo box can be used to show or hide resources depending on their resource type or preferred heap type. By switching all preferred heaps off, some allocations will be left. Orphaned resources are ones where the parent allocation has been deallocated without freeing the resource first. Other resources with a ‘-’ don’t have a parent allocation.
The table items can be sorted by selecting one of the column headers. For example, if the Preferred heap column is selected, the whole table will be sorted by preferred heap.
The search box allows for resources to be filtered by any text which is present in the table. Any resources which do not match the text filter will not be displayed.
Searching any of the resource tables in RMV now adds a range-based search in addition to text searching. For example, if a virtual address is 0x1000 with a size of 256 bytes, entering the search text as 0x1001 will include this resource since it is in the address range. This is useful for seeing if memory locations are used by multiple resources. Range-based searching will work with either decimal or hexadecimal numbers.
Mousing over a memory size cell in the table will display a tooltip showing the exact number of bytes.
This will show the resources for each allocation. The pane consists of 2 tables. The top table lists all of the allocations. These allocations can be filtered using the search box text filter, located above the allocation table, and also by size using the “Filter by size” slider to the right of the search box.
Clicking on an allocation will show it in the graphic below, along with a representation of all of the resources in the selected allocation.
Mousing over a memory size cell in either table will display a tooltip showing the number of bytes.
The coloring can be changed using the “color by ..” combo box above the allocation graphic.
The “show aliasing” checkbox will display the resources in the allocation in a stacked view to help visualize aliasing. If no resources in the allocation are aliased, the checkbox will be grayed out. There are 2 splitters above and below the graphical allocation display and these can be moved to increase or decrease the height of the graphical allocation display. If there is a lot of aliasing, it may be useful to temporarily increase the height, as shown below:
The table under the allocation display shows a list of all the resources in the chosen allocation. These resources can be filtered using the search box text filter and also by size using the “Filter by size” slider on the right. Double-clicking on a resource will navigate to the Resource details pane.
This pane show the information for a selected resource. The pane is in 2 parts. The top section shows information about the selected resource and is split into a further 3 sections. To the left is a resource summary showing information about the resource (its size, which allocation it is in, when it was created etc).
The middle column shows the resource properties which will vary depending on the resource type. For example, texture resources will show their width, height and pixel format. Some resources will show create or usage flags. In the case where these flags are bitfields, the text equivalent of the bitfield will be shown, and where there are multiple flags, they will be separated with a ‘|’. The value in parentheses is the decimal value of the flags.
The right column shows where the texture is resident in physical memory. If it is not resident, it will be shown as unmapped. From here it can be determined if the resource is resident in the heap that was requested. If not, a warning message will appear stating what the problem is.
Underneath the resource info is a timeline showing how the resource changed over time. The same data is represented in the table below. A marker is also present showing when the current snapshot was taken. Any events that happened to the resource after the snapshot are grayed out in the table. This information can be used in conjunction with the physical residency donut to determine if and why the resource memory is in a different place than requested (maybe it was made resident at some point and then paged out).
These panes allow the user to compare snapshots to see how allocations and resources have changed over time.
The snapshot delta gives a high level overview of the differences between two snapshots. It shows the difference in the number of allocations and resources for each heap type.
The carousel works in a similar way to the carousel in the Resource list pane but now shows the differences between the 2 snapshots, indicating such things as whether memory consumption has gone up or down.
The “Switch snapshots” button in the top right corner under the settings tab can be used to switch the snapshots.
Memory leak finder¶
This pane shows the list of resources from both snapshots and allows them to be filtered depending on whether they are unique to one snapshot or present in both. This filtering can be achieved using the 3 checkboxes at the top. For example, just selecting the middle checkbox will show resources common to both snapshots. Underneath each checkbox is a summary of the number of resources that the checkbox represents and the total amount of memory used for that checkbox. For example, the left-most checkbox will show resources that are only present in the first snapshot.
As with the other panes, search strings and the “Filter by size” slider can be used to narrow down the list of resources.
Double-clicking on a resource will navigate to the Resource details pane and allow the snapshot to be viewed in the SNAPSHOT tab. If a resource is common to both snapshots, the base snapshot will be used.
Vulkan resource naming¶
Pipelines, images and buffers can be given unique names and these names will show up in the RMV UI. The Vulkan extension VK_EXT_debug_utils can be used for this.
For more information, see the document:
specifically the section “Naming Objects”
DirectX 12 resource naming¶
Memory traces for DirectX applications captured with the Radeon Developer Panel can include unique names for image-based resources. Names can be assigned to DirectX resources using the ID3D12Object::SetName() method. Calling the SetName() method results in ETW (Event Tracing for Windows) events being emitted and picked up by the Panel. This resource naming information is then included in the RMV trace file.
For more information, please review the Microsoft DirectX 12 documentation.
Viewing resource names¶
The resource names will show up in the RMV UI in the resource list pane, for example:
The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD’s products are as set forth in a signed agreement between the parties or in AMD’s Standard Terms and Conditions of Sale.
AMD, the AMD Arrow logo, Radeon, Ryzen, RDNA and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
DirectX is a registered trademark of Microsoft Corporation in the US and other jurisdictions.
Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.
OpenCL is a trademark of Apple Inc. used by permission by Khronos Group, Inc.
Microsoft is a registered trademark of Microsoft Corporation in the US and other jurisdictions.
Windows is a registered trademark of Microsoft Corporation in the US and other jurisdictions.
© 2018-2022 Advanced Micro Devices, Inc. All rights reserved.