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

Merged
merged 1 commit into from
Jun 19, 2025

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
@ashrit-ms ashrit-ms merged commit 6413908 into main Jun 19, 2025
89 checks passed
@ashrit-ms ashrit-ms deleted the ashritms/skip-hash-epcontext branch June 19, 2025 15:34
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