Fix EPContext node referencing MXR files that are never written - #69
Merged
Conversation
…tten When ep.context_enable was set without cache_dir (or with disable_caching), the generated EPContext node referenced/embedded a .mxr file that the EP never actually saved to disk, breaking the model on load. Default the cache directory to context_file_path's or the model's directory in that case, always persist the .mxr when context_enable is on, and fail fast instead of emitting a broken node when the graph has dynamic input shapes.
urpetkov-amd
previously approved these changes
Jul 29, 2026
Collaborator
|
LGTM |
TedThemistokleous
requested changes
Jul 30, 2026
TedThemistokleous
left a comment
Collaborator
There was a problem hiding this comment.
Overall looks good just need to update comment to represent new state regarding the added dynamic batch functionality using the ORT flags
ivarusic-amd
force-pushed
the
fix_epcontext_mxr_cache_dir
branch
from
July 30, 2026 12:56
712eb97 to
299aa4b
Compare
ivarusic-amd
marked this pull request as ready for review
July 31, 2026 09:22
TedThemistokleous
approved these changes
Aug 4, 2026
urpetkov-amd
approved these changes
Aug 4, 2026
tperry-amd
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When ep.context_enable was set without cache_dir (or with disable_caching), the generated EPContext node referenced/embedded a .mxr file that the EP never actually saved to disk, breaking the model on load. Default the cache directory to context_file_path's or the model's directory in that case, always persist the .mxr when context_enable is on, and fail fast instead of emitting a broken node when the graph has dynamic input shapes.
Is defaulting to the original model's directory (rather than erroring out) the right last resort, or should we require the user to set at least one of cache_dir/context_file_path explicitly when context_enable=1?
Should context_enable=1 on a dynamic-input-shape graph hard-fail?
NOTE : need to retest if everything else stays unchanged before merge