Repository navigation
[Framework] Report missing or unavailable execution backends - #33957
Sushanth Rajasankar (sushraja-msft) merged 3 commits into
Conversation
Reject unassigned nodes and unknown execution providers before inserting device copies, instead of reaching a fatal memcpy-transformer invariant. Cover invalid assignments and a valid CPU assignment without GPU hardware. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Return Status and a separate modification flag from the memcpy helper. Validate assignments in its existing scan before graph mutation, avoiding a second traversal. Cover late invalid assignments and successful host/device copy insertion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
433de07 to
e640bd3
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the execution-provider diagnostics change.
No open issues 🎉
What changed in this PR
Improves execution-provider diagnostics in the memcpy graph transformer so invalid node assignments return clear errors before copy nodes are inserted.
Changes:
- Returns node-specific
NOT_IMPLEMENTEDerrors for unassigned nodes andINVALID_ARGUMENTerrors for unregistered providers. - Refactors the internal
ModifyGraphhelper to returnStatusand report modifications through abool&. - Adds hardware-independent tests for invalid assignments, unchanged CPU nodes, and successful CPU–GPU copy insertion.
| File | Description |
|---|---|
onnxruntime/test/framework/memcpy_transformer_test.cc |
Adds a test provider and regression coverage for assignment validation and copy insertion. |
onnxruntime/core/optimizer/transformer_memcpy.cc |
Validates provider assignments during the initial scan and propagates errors through Status. |
Review effort: Balanced
Recognize the new missing-execution-provider status for unsupported Reshape and Unsqueeze types while preserving existing rejection checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Copilot update on behalf of Sushanth Rajasankar (@sushraja-msft) (human owner; @mention them for human follow-up): fixed the Web Debug/Release CI failures in 312bfcc. Unsupported Reshape/Unsqueeze sessions now return the new recoverable missing-provider diagnostic, which the negative-test allowlist did not recognize. The added check is operator-specific and does not accept arbitrary errors or successful session creation. It deliberately does not require the model opset number because the diagnostic reports the resolved operator schema version. Validation: using the failing-head Release WASM artifact, the focused browser suite changed from 110 passed / 16 failed / 16 skipped to 126 passed / 0 failed / 16 skipped. Skips are float16 cases unsupported by the local GPU. TypeScript, targeted ESLint/Prettier, lintrunner -a, and whitespace checks passed. Debug browser execution and the full Web suite were not rerun locally; new-head CI remains pending. |
27d11c0
into
main
What changes
Return a clear error when an operation has no assigned execution backend, or names a backend that is not registered, instead of failing while preparing data copies. This prevents cases where ops could not be assigned an ep from crashing the browser GPU process when ORT WebGPU is used as the backend for webnn.
The error identifies the affected node. Unsupported operations return
NOT_IMPLEMENTED; invalid backend names returnINVALID_ARGUMENT. Validation happens before copy nodes are inserted. Valid CPU-assigned nodes keep their existing behavior.ModifyGraphnow returnsStatusand reports graph modification through abool&output parameter. Assignment checks run in its existing initial node scan, before collecting each node's copy requirements; there is no separate validation traversal inApplyImpl.ApplyImplpropagates failures withORT_RETURN_IF_ERROR. These are internal helper changes, with no public API/ABI change. The existing non-CPU-provider guard and subgraph recursion remain unchanged.Native tests
3 tests passed, with no skips, after the refactor. They cover an unassigned node, an unavailable named backend, an unchanged valid CPU-assigned node, and successful CPU-to-GPU-to-CPU copy insertion with
modified == true. Invalid assignments are tested after an earlier valid GPU-assigned node has been processed; node assignments and connections remain unchanged on failure.Regression-sensitivity checks used disposable faulty source copies with the unchanged tests. Dropping the modification flag, omitting a GPU-to-CPU copy, and changing an earlier valid node's assignment each failed the intended assertion. The production source was then rebuilt and all three tests rerun successfully.
From an existing Release build configured with WebGPU:
The tests use a small test backend and do not depend on GPU hardware.