Skip to content
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

Enable loading of ORT format model graph runtime optimizations #9901

Merged
merged 39 commits into from
Jan 4, 2022

Conversation

edgchen1
Copy link
Contributor

@edgchen1 edgchen1 commented Dec 1, 2021

Description
Initial implementation of load/replay of runtime optimizations in an ORT format model.

Motivation and Context
Enable some graph optimization at runtime in ORT format models.

#if !defined(ORT_ENABLE_ORT_FORMAT_RUNTIME_GRAPH_OPTIMIZATION)
ORT_RETURN_IF(saving_runtime_optimizations, "Saving runtime optimizations is not supported in this build.");
#endif // !defined(ORT_ENABLE_ORT_FORMAT_RUNTIME_GRAPH_OPTIMIZATION)

Copy link
Contributor

Choose a reason for hiding this comment

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

I would have expected ORT_ENABLE_ORT_FORMAT_RUNTIME_GRAPH_OPTIMIZATION to only be applied to a minimal build to add the code for applying the saved optimizations.

In a full build you should always be able to save the optimizations, with that being turned on via config setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took the approach of having the general runtime optimization functionality be optional. We could have it always be enabled in a full build.

I guess we could also do something like this:
#if !defined(ORT_MINIMAL_BUILD) || (defined(ORT_EXTENDED_MINIMAL_BUILD) && defined(ORT_ENABLE_RUNTIME_OPTIMIZATION_IN_MINIMAL_BUILD))

Not sure that's better though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure of a scenario where you don't want it to be included in a full build. We'd certainly need it enabled in any pre-built package so that can be used to create the saved optimizations.

Does ORT_ENABLE_RUNTIME_OPTIMIZATION_IN_MINIMAL_BUILD imply ORT_EXTENDED_MINIMAL_BUILD so things can be simplified?

How many places would we need to use this check though? AddPredefinedTransformers is not enabled at all in a minimal build currently.

skottmckay
skottmckay previously approved these changes Jan 3, 2022
Copy link
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Contributor

@skottmckay skottmckay left a comment

Choose a reason for hiding this comment

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

:shipit:

@edgchen1 edgchen1 merged commit 792db33 into master Jan 4, 2022
@edgchen1 edgchen1 deleted the edgchen1/sat_runtime_optimization_load branch January 4, 2022 20:09
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