Additional diagnostics for DML failure path#28495
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds richer diagnostics in DmlGraphFusionHelper::ExecuteReusableCommandList when ExecuteCommandList fails with a device-lost/removal-class HRESULT, so that TDR-induced failures (DEVICE_HUNG, DEVICE_RESET, DRIVER_INTERNAL_ERROR) no longer surface only as the misleading "invalid command" FormatMessage text.
Changes:
- Broadens the failure branch from
DXGI_ERROR_DEVICE_REMOVEDonly to also includeDEVICE_HUNG,DEVICE_RESET, andDRIVER_INTERNAL_ERROR. - Queries
GetDeviceRemovedReasonon both the DML and D3D12 devices and selects the most specific HRESULT to throw with. - Uses
ORT_THROW_HR_MSGto emit a clear message naming TDR/device-removal as the likely cause and including the original HRESULT and both removed-reason HRESULTs.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/core/providers/dml/DmlExecutionProvider/src/DmlGraphFusionHelper.cpp | Expands the device-lost detection branch and emits a more diagnostic error message including DML/D3D12 GetDeviceRemovedReason values. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
Contributor
|
Note you might also get more info via the DML debug layer. It's probably already installed you have Visual Studio installed, but otherwise: https://learn.microsoft.com/en-us/windows/ai/directml/dml-debug-layer. Then:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
In DmlGraphFusionHelper::ExecuteReusableCommandList, after ExecuteCommandList fails:
DRIVER_INTERNAL_ERROR.
Motivation and Context
While investigating a WebNN sample failure on Chrome running Stable Diffusion 1.5 on an AMD Radeon 860M iGPU, ORT 1.23.4 surfaced this error:
DmlGraphFusionHelper.cpp(1078) ... 887A0006 The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application.0x887A0006 is DXGI_ERROR_DEVICE_HUNG. The text "...invalid command passed by the calling application" seems to be the FormatMessage string for that HRESULT.
The pre-existing code in DmlGraphFusionHelper::ExecuteReusableCommandList only special-cased DXGI_ERROR_DEVICE_REMOVED, so for DEVICE_HUNG / DEVICE_RESET / DRIVER_INTERNAL_ERROR HRESULTs the user just got the raw message. I wanted to add a little more diagnostic information to this.