Debugger Extension for DRED

Avatar

Bill

Microsoft recently announced the release of DRED (Device Removed Extended Data) for D3D12 in the Windows 10 May 2019 Update (previously referred to as the Windows 10 19H1 Preview).  Buried in that post is a mention that Microsoft is working on a debugger extension to help simplify post-mortem analysis of DRED.  Good news, that debugger extension is now available on GitHub.  D3DDred.js is a JavaScript debugger extension for WinDbg (available here). This extension makes it possible to examine the DRED output with clear context and a human-readable layout.

Why WinDbg? Besides being a powerful, lightweight debugger, WinDbg supports JavaScript extensions.  There is no need to configure build tools or run any installers to use D3DDred.js.  Simply load the script into WinDbg and you are ready to roll.  Using the WinDbg console, type:

When a TDR occurs in an app with DRED enabled, the runtime preserves the DRED output in the application memory heap.  Using WinDbg attached to a process or heap dump with D3DDred.js loaded, the DRED output can be trivially observed by running !d3ddred from the WinDbg console.

Example:

The following is an example using a busted version of Microsoft’s D3D12 ModelViewer sample.

In this example, there is only one AutoBreadcrumbNode object.  Clicking on AutoBreadcrumbNodes shows:

Click [0x0]:

This implies that queue “CommandListManager::m_CommandQueue” and command list “ClearBufferCL” contain the likely suspect operation.

The ReverseCompletedOps value is an array (in reverse order) of command list operations that completed without error:

This shows that only one operation completed before faulting.  In this case it was a ClearUnorderedAccessView command.

The OutstandingOps value is an array (in normal forward order) of command list operations that are not guaranteed to have completed without error.

In most cases, the first outstanding operation is the strongest suspect.  The outstanding CopyResource operation shown here is in fact the culprit.

Notice that PageFaultVA is not zero in the initial !d3ddred output.  This indicates that the GPU faulted due to a read or write error (and that the GPU supports reporting of page faults).  Beneath PageFaultVA is ExistingAllocations and RecentFreedAllocations.  These contain arrays of allocations that match the faulting virtual address.  Since ExistingAllocations is 0, it is not interesting in this case.  However, RecentFreedAllocations has two entries that match the faulting VA:

Allocation [0x0] is an internal heap object, and thus is not very interesting.  However, allocation [0x1] reveals:

So, a buffer named “UAVBuffer01” that mapped to the faulting VA was recently deleted.

The verdict in this case is that the CopyResource operation on CommandList “ClearBufferCL” tried to access buffer “UAVBuffer01” after it had been deleted.

Symbols:

Unfortunately, the public symbols for D3D12 do not include the type data needed for the D3DDred.js extension (type information is typically stripped from public OS symbols).  Fortunately, D3DDred.js can usually work around this by searching though other loaded modules for the DRED data types.  However, since older SDK’s will not have the DRED types this workaround requires building with the Windows 10 May 2019 SDK.  The good news is this has been addressed in the next OS release, and we are currently working to update the public symbols for May 2019 with the DRED data types.

Enabling DRED:

As of the May 2019 SDK, the most efficient way to enable DRED is by using the DRED API’s.  DRED must be enabled before creating the D3D12 Device.

Thanks for reading:

If TDR’s are keeping you up at night, you want to use DRED – and you should check out the D3DDred.js debugger extension.  As always, we look forward to your feedback and suggestions.

 

Avatar
Bill Kristiansen

Principal Developer, DirectX

Follow Bill   

0 comments

    Leave a comment