-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Enabling L2+ Optimizations for EPs #23517
Merged
Merged
+874
−107
Conversation
This file contains 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
…Capability, selection function and ComputeCapability
…uteCapability, selection function and ComputeCapability
skottmckay
reviewed
Jan 28, 2025
onnxruntime/core/optimizer/qdq_transformer/constant_folding_dq_node.h
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/shared_library/provider_interfaces.h
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can commit the suggested changes from lintrunner.
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can commit the suggested changes from lintrunner.
onnxruntime/core/optimizer/qdq_transformer/constant_folding_dq_node.h
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.h
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc
Outdated
Show resolved
Hide resolved
onnxruntime/core/providers/tensorrt/tensorrt_execution_provider_helper.cc
Outdated
Show resolved
Hide resolved
skottmckay
previously approved these changes
Feb 28, 2025
skottmckay
reviewed
Mar 5, 2025
skottmckay
reviewed
Mar 6, 2025
skottmckay
previously approved these changes
Mar 7, 2025
skottmckay
approved these changes
Mar 7, 2025
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.
There are some requirements to modify the graph which are specific to the EP/hardware.
ORT has the hardcoded EP list for optimizations but that can't scale and it's hard be extended to enable EP custom optimizations.
This PR is to enable L2+ optimizations for EPs (The original prototype is provided by @skottmckay) as well as the TRT EP implementation for the ConstantFoldingDQ optimization.
The graph_optimizer_registry is designed for enabling L2+ graph optimizations tailored for EPs.
These optimizations are applied after the graph partitioner assigns ComputeCapability to the EP and before EP's "Compile" or fusion
Signatures for selection and optimization functions:
Optimizer's selection function:
Optimizer's optimization function:
GetCapability
call (new) provider bridge API to lookup pre-defined optimizer by name and get selection function
EP has to update the returning ComputeCapability to include the optimization ComputeCapability in nodes_to_optimize. So that later ORT can perform optimization/transformation accordingly.
GraphPartitioner