Skip to content

Fix EPContext node referencing MXR files that are never written - #69

Merged
tperry-amd merged 4 commits into
mainfrom
fix_epcontext_mxr_cache_dir
Aug 5, 2026
Merged

Fix EPContext node referencing MXR files that are never written#69
tperry-amd merged 4 commits into
mainfrom
fix_epcontext_mxr_cache_dir

Conversation

@ivarusic-amd

@ivarusic-amd ivarusic-amd commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

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

…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
urpetkov-amd previously approved these changes Jul 29, 2026
@urpetkov-amd

Copy link
Copy Markdown
Collaborator

LGTM

@TedThemistokleous TedThemistokleous left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks good just need to update comment to represent new state regarding the added dynamic batch functionality using the ORT flags

Comment thread src/migraphx/mgx_ep.cc Outdated
@CLAassistant

CLAassistant commented Jul 30, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ivarusic-amd
ivarusic-amd force-pushed the fix_epcontext_mxr_cache_dir branch from 712eb97 to 299aa4b Compare July 30, 2026 12:56
@ivarusic-amd
ivarusic-amd marked this pull request as ready for review July 31, 2026 09:22
@tperry-amd
tperry-amd merged commit 3bb62d5 into main Aug 5, 2026
1 check passed
@tperry-amd
tperry-amd deleted the fix_epcontext_mxr_cache_dir branch August 5, 2026 01:27
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.

5 participants