Skip to content

Skip hash computation for EPContext models #25106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ashrit-ms
Copy link
Contributor

Description

Add early exit in ComputeModelGraphHash when EPContext nodes are present, returning "0" to indicate pre-compiled model state. Conditionally skip ComputeModelWeightHash when graph hash is "0" to avoid unnecessary computation for pre-compiled models.

This optimization reduces overhead for models containing EPContext nodes, which represent execution provider pre-compiled subgraphs.

Motivation and Context

Currently, the hash generated by ComputeModelGraphHash function when the graph contains EPContext nodes does not correctly represent the graph because we do not hash the contents of the context pointed to by the EPContext node. Thus, it makes more sense to skip hashing for cases involving EPContext nodes.

Add early exit in ComputeModelGraphHash when EPContext nodes are
present, returning "0" to indicate pre-compiled model state.
Conditionally skip ComputeModelWeightHash when graph hash is "0"
to avoid unnecessary computation for pre-compiled models.

This optimization reduces overhead for models containing EPContext
nodes, which represent execution provider pre-compiled subgraphs.
@ashrit-ms ashrit-ms self-assigned this Jun 18, 2025
@ashrit-ms ashrit-ms requested a review from snnn June 18, 2025 20:02
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.

2 participants