Skip to content

Improve error message when EPContext node is not assigned to an EP#27474

Merged
adrianlizarraga merged 3 commits intomainfrom
adrianl/EpContext_MissingEP_ErrorMessage
Feb 27, 2026
Merged

Improve error message when EPContext node is not assigned to an EP#27474
adrianlizarraga merged 3 commits intomainfrom
adrianl/EpContext_MissingEP_ErrorMessage

Conversation

@adrianlizarraga
Copy link
Copy Markdown
Contributor

@adrianlizarraga adrianlizarraga commented Feb 27, 2026

Description

Improves the error message returned by ORT when loading a compiled model in a session that does not have the required execution provider(s).

For example, ORT now returns the following error when creating session with a model compiled explicitly for OpenVINO EP without adding OpenVINO EP to the session:

EPContext node generated by 'OpenVINOExecutionProvider' is not compatible with any execution provider added to the session. EPContext node name: 'EPContextNode0'. Available session execution providers: [CPUExecutionProvider].

Compare the above message with the more generic message that is currently returned:

Could not find an implementation for EPContext(1) node with name 'EPContextNode0'

Motivation and Context

Improves diagnosability when loading of pre-compiled models fails. Specifically, the ambiguity of the original message led to many hours spent debugging an error where a compiled model failed to run because the expected OrtEpDevice was inadvertently not added to a session.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves diagnosability when loading pre-compiled models containing EPContext nodes by emitting a targeted error if an EPContext node is not assigned to any execution provider, and adds a regression test to validate the new message.

Changes:

  • Add a specialized NOT_IMPLEMENTED error message for unassigned EPContext nodes that includes the node’s source attribute and the session’s registered EPs.
  • Add a new AutoEP test that compiles a model with the example plugin EP and verifies the explicit error when loading it without registering the required EP.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
onnxruntime/test/autoep/test_execution.cc Adds regression test covering the explicit error when loading an EPContext model without the required EP.
onnxruntime/core/framework/session_state.cc Enhances node-to-EP assignment verification to emit a descriptive error for unassigned EPContext nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread onnxruntime/test/autoep/test_execution.cc
Comment thread onnxruntime/test/autoep/test_execution.cc
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adrianlizarraga adrianlizarraga marked this pull request as ready for review February 27, 2026 04:58
@adrianlizarraga adrianlizarraga changed the title Explicit error message when EPContext node is not assigned to an EP Improve error message when EPContext node is not assigned to an EP Feb 27, 2026
@adrianlizarraga adrianlizarraga merged commit 5f94d6c into main Feb 27, 2026
98 of 103 checks passed
@adrianlizarraga adrianlizarraga deleted the adrianl/EpContext_MissingEP_ErrorMessage branch February 27, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants