-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Integrate function-inlining with version-conversion #5211
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
Merged
Merged
Conversation
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
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
xadupre
reviewed
May 9, 2023
xadupre
reviewed
May 9, 2023
xadupre
reviewed
May 9, 2023
xadupre
reviewed
May 9, 2023
xadupre
reviewed
May 9, 2023
xadupre
reviewed
May 9, 2023
Would it be possible to add a section in the python documentation as well about the inliner (https://github.com/onnx/onnx/tree/main/docs/docsgen/source/api)? |
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Done |
liqunfu
approved these changes
May 16, 2023
q-ycong-p
pushed a commit
to q-ycong-p/onnx
that referenced
this pull request
May 18, 2023
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com> Signed-off-by: Yu Cong <congyc@amazon.com>
adityagoel4512
pushed a commit
to adityagoel4512/onnx
that referenced
this pull request
Jul 28, 2023
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com> Signed-off-by: Aditya Goel <agoel4512@gmail.com>
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.
This extends the function-inliner to take advantage of the version-converter to inline functions targetting ONNX opset X into a model targetting ONNX opset Y (when conversion of the function from version X to version Y is successful).
The two are coupled because the existing version-converter does not support functions. It is not easy to extend the version-converter to handle functions because some of the version-conversion rules depend on context-information (such as the types of inputs or values of attributes) that may not be available in a function body. However, in the context of inlining a function into a callsite in a model, the necessary context information can be obtained, enabling the conversion to proceed.
The functionality is complete. But there are a couple of pending improvements, which can be delayed to a later PR
(i) It may be useful to expose an option to the caller to indicate if we should attempt version-conversion or not.
(ii) Version-conversion requires us to update type information for the model after one or more inlining steps, in order to apply version-conversion to nested function-calls. The current implementation uses a somewhat naive strategy to do this. We can improve this by using an incremental type-inference implementation.