Skip to content

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.

3 participants