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.
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
feat: Prototype Module-Acceleration in Dynamo #1921
feat: Prototype Module-Acceleration in Dynamo #1921
Changes from 2 commits
ee05b59
60df50e
e4c6ba5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do you know if theres a better type than string for this registry? Like is there a op type?
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.
I will look into this more - there is the
torch._ops.OpOverload
type which could be a substitute here.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.
After looking more into this,
str
is likely the best choice for this registry for now. The issue is that node targets can be a mix of functions andtorch._ops.OpOverload
objects. For example,torch.ops.aten.add.Tensor
is an overload object representing a Tensor addition op, whereas the operator forget
is an actual Python function. The unifying framework which can connect all of these types is the_get_qualified_name
function, which can handle all of these types, and returns a string. I have updated the implementation here to use that function.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.
This is sick 😄
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.
It would be cool to have a sphinx tutorial on how to do this from an external user perspective. could be as easy as removing maxpool1d from the registry then walking through all the parts.
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.
Agreed. I will add this, in addition to documentation on how to ensure all the relevant code is registered (
__init__.py
imports)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.
To avoid clashing with or making dependencies on #1966 and #1967, I'll add more commenting to this file and then port it over to a formatted
.py
file once those PRs are merged.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.
For module substitution "in library" do we want to put the converter here? or do we want to put the converter in the registry with the rest?
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.
For external users they'd probably put it here.
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.
I thought it could be cleaner to have the converter implementation here, so all of the code relating to that module and its replacement is centralized.
The requirement, however, is that for every new module replacement file, the user will have to add
from .my_module_replacement import *
tomodule_substitutions/__init__.py
to ensure the registrations occur.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.
aten_ops
-->tensorrt
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.
Why is there a separate testing backend? Would we need to continue to make changes to this in step with the actual one?
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.
The main reason for the separate testing backend is the argument
store_intermediate_graphs
. This is needed to track intermediate partitioned modules at different points in the compilation, to ensure decompositions, fusions, etc. are being utilized.As changes are made to the main backend, yes, those changes would need to be reflected here, and in the
compile_module_testing
function below, however these are higher-level functions which do not change often.