GPUView

If you find yourself working with GPU-intensive applications on Windows, you will quickly find that getting good visibility into what's happening on the GPU and on the integrated systems is a bit challenging.

One old tool you can use to get a sense of what's going on is GPUView.

This is different from tools such as RenderDoc or the PIX GPU Capture functionality, which are based on recording assets and commands and then replaying them to get step-by-step execution and insights.

One of the benefits of GPUView is that it works across DirectX versions, as opposed to PIX for Windows, which only works with DirectX 12 - although some amount of support was eventually added for DirectX 11, and there existed older versions as well available through the DirectX SDK back when it was a thing unto itself.

You can get GPUView from the Windows Performance Toolkit.

How GPUView Works

One of the nice things about the way GPUView works is that it's really based around providers emitting certain ETW events to collect all necessary information.

The tooling is really based around selecting what to collect, and then in helping shape the collected events into something that is human-understandable.

That's why, for example, you can replace the collection with any old script that will turn on the correct providers and events/flags, how you can collect additional information that might help understand what's going on, or how it can integrate with tools such as UIforETW.

Running GPUView

The use is pretty straightforward, and simply following the quick start instructions should yield a useful visualization. It boils down to starting a command prompt with Administrative privileges and running the log.cmd command, as-is in the regular flow or with some more advanced switches.

You can also muck around with the log.cmd file itself, which isn't too terribly complicated.

One gotcha from experience: if you interrupt the script or generally mess around with it, make sure that the environment variables it uses to control flags are properly restored. Often the simplest way is to start a new command prompt and start afresh.

NVidia has some instruction on how to generate merged files you can share here, which is really just a more detailed set of steps. Note that if you have custom symbols you care about, that's something you'll want to include in your .zip files.

Understanding Results

This is the fun part, and the one where you'll get better with experience. I usually start by looking at whether CPU or GPU are idle and could be put to work, and to get a sense of where work is generated and how much accumulates as it moves through queues.

However, here are some great links to get you started, which are worth going over to get a sense of what you might run into and what things to look out for.

Finally, there is a similar tool from AMD that is contrasted here and shows how to spot multiple frames being enqueued ahead of time.

Of course, GPUView only works on Windows. Apple has their own tools bundled with XCode and Android has AGI which combine this with some of the classic RenderDoc/PIX functionality, but those deserve their own posts in the future.

Happy graphics debugging!

Tags:  graphicsperf

Home