-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Introduce LegacyTHDispatcher for dispatching to TH functions. #14708
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
Conversation
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.
@gchanan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
|
||
| namespace at { | ||
|
|
||
| // TODO: This could be bad juju if someone calls globalContext() in the |
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.
Comment out of date
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.
is it? This is the same comment as in globalLegacyTypeDispatch -- is it out of date there? I'll admit I don't know what the comment is referring to.
|
|
||
| // LegacyTHDispatcher is the legacy mechanism for dispatching directly | ||
| // to TH/THNN/THC/THCUNN functions in ATen, which is essentially a giant virtual | ||
| // dispatch table for every TH function we support dynamically dispatching over. |
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 think what you want to add to the comment here is:
- Why you need another dispatcher, as opposed to using the existing LegacyTypeDispatch (you say that it's similar to the LegacyTypeDispatch with some simplifications, but that doesn't explain the "why")
- Under what situation we can delete this (when all the TH functions go away right)
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'm OK with this because we've discussed it in person, but I think you need to make sure @dzhulgakov and @smessmer understand what's going on 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.
@gchanan has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
58be3c0 to
f0dcc50
Compare
f0dcc50 to
a7e6f4d
Compare
…h#14708) Summary: This isn't hooked up to anything yet, this is just putting the skeleton in place. The idea here is that the functions generated via Declarations.cwrap and nn.yaml are not actually operators, they are implementation details of operators, and thus don't need to participate in VariableType, JIT dispatch generation. So, we will split these functions out from the usual Type/operator hierarchy; for now the dispatch will be done by a Type-like class called LegacyTHDispatcher. Once this is done this probably means we can collapse Type to be backend-specific, not Type/ScalarType specific, because all the ScalarType specific code will live in the LegacyTHDispatcher. Pull Request resolved: pytorch#14708 Reviewed By: ezyang Differential Revision: D13304654 Pulled By: ezyang fbshipit-source-id: dac7c7fba8b58d52836f48466e986487c58e78b0
a7e6f4d to
65defe1
Compare
Summary: This isn't hooked up to anything yet, this is just putting the skeleton in place. The idea here is that the functions generated via Declarations.cwrap and nn.yaml are not actually operators, they are implementation details of operators, and thus don't need to participate in VariableType, JIT dispatch generation. So, we will split these functions out from the usual Type/operator hierarchy; for now the dispatch will be done by a Type-like class called LegacyTHDispatcher. Once this is done this probably means we can collapse Type to be backend-specific, not Type/ScalarType specific, because all the ScalarType specific code will live in the LegacyTHDispatcher. Pull Request resolved: pytorch/pytorch#14708 Reviewed By: ezyang Differential Revision: D13304654 Pulled By: gchanan fbshipit-source-id: cfe3e1a28adcc355f67fe143495ee7e5c5118606
This isn't hooked up to anything yet, this is just putting the skeleton in place.
The idea here is that the functions generated via Declarations.cwrap and nn.yaml are not actually operators, they are implementation details of operators, and thus don't need to participate in VariableType, JIT dispatch generation.
So, we will split these functions out from the usual Type/operator hierarchy; for now the dispatch will be done by a Type-like class called LegacyTHDispatcher. Once this is done this probably means we can collapse Type to be backend-specific, not Type/ScalarType specific, because all the ScalarType specific code will live in the LegacyTHDispatcher.