-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Remove use_c10_dispatcher: unboxed_only #36838
Conversation
All ops now do unboxing after dispatch, i.e. c10 handles unboxing and c10 registers a wrapper for the op to JIT The last op that manually registered its own wrapper to JIT in register_aten_ops.cpp was migrated. Since there are no ops using use_c10_dispatcher: unboxed_only anymore, we can delete the feature. Also: - Rename some files to more accurately describe what they're doing now: - OpsAlreadyMovedToC10.h/cpp -> ATenOpList.h/cpp - register_aten_ops.cpp -> generated_unboxing_wrappers.cpp - gen_jit_dispatch.py -> gen_unboxing_wrappers.cpp Differential Revision: [D21100081](https://our.internmc.facebook.com/intern/diff/D21100081/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D21100081/)! [ghstack-poisoned]
All ops now do unboxing after dispatch, i.e. c10 handles unboxing and c10 registers a wrapper for the op to JIT The last op that manually registered its own wrapper to JIT in register_aten_ops.cpp was migrated. Since there are no ops using use_c10_dispatcher: unboxed_only anymore, we can delete the feature. Also: - Rename some files to more accurately describe what they're doing now: - OpsAlreadyMovedToC10.h/cpp -> ATenOpList.h/cpp - register_aten_ops.cpp -> generated_unboxing_wrappers.cpp - gen_jit_dispatch.py -> gen_unboxing_wrappers.cpp Differential Revision: [D21100081](https://our.internmc.facebook.com/intern/diff/D21100081/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D21100081/)! ghstack-source-id: 102407222 Pull Request resolved: #36838
💊 Build failures summary and remediationsAs of commit dd12431 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 10 times. |
Do we still need |
Yes, to get rid of that, we first need to fix all the gaps in #32366. The new default (after this PR but without fixing those gaps) is 'with_codegenerated_unboxing_wrappers', i.e. if an op doesn't explicitly specify 'use_c10_dispatcher: full', it will get a codegenerated unboxing wrapper. The registration then still needs to use |
aten/src/ATen/core/ATenOpList.h
Outdated
namespace at { | ||
|
||
// list of ATen ops that come from native_functions.yaml | ||
CAFFE2_API bool is_aten_op(const c10::OperatorName& opName); |
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 new name doesn't seem very descriptive. (A better question to ask, perhaps: why do I care if it is_aten_op
? Why isn't this the same thing as just checking the namespace?)
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, the implications of this name aren't that clear unless you're pretty deep into what's going on. Judging by its use here, I'd suggest maybe inverting the sense and making it is_custom_op
instead.
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.
checking the namespace is a good idea, we should move towards doing that instead. I added a TODO. It likely doesn't work just yet because we might have internal "custom" ops that use the aten namespace. For now, I renamed it to is_custom_op
.
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.
@smessmer when I get everything onto the new API, we will be able to guarantee that custom ops don't use the aten namespace.
But I am kind of curious what the downstream usage of this is, because the way I'm likely going to make the internal "Custom" ops (you're talking about the JIT ops right?) live in a centralized location is by hardcoding their registrations in TypeDefault.cpp ala #36925
See also #36926
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 seems like a strict improvement (so I will approve) but I don't see why you need the is_aten_op
predicate anymore.
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.
If @ezyang is right and is_aten_op
can be replaced by a simple namespace check at the remaining callsites, that definitely seems better. Otherwise I'd vote for renaming per inline comment.
Also, not for this PR but in general I'd mildly prefer having the unboxed_only
removal and the renaming be separate diffs, esp given that the file renaming ripples into the build scripts and so on.
aten/src/ATen/core/ATenOpList.h
Outdated
namespace at { | ||
|
||
// list of ATen ops that come from native_functions.yaml | ||
CAFFE2_API bool is_aten_op(const c10::OperatorName& opName); |
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, the implications of this name aren't that clear unless you're pretty deep into what's going on. Judging by its use here, I'd suggest maybe inverting the sense and making it is_custom_op
instead.
@@ -169,16 +169,11 @@ class RegistrationListener final : public c10::OpRegistrationListener { | |||
// TODO Find a better way to handle this. | |||
return; | |||
} | |||
if (at::is_aten_op_and_unboxing_is_already_handled_by_c10( | |||
op.schema().operator_name())) { | |||
if (at::is_aten_op(op.schema().operator_name())) { |
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.
Aside: in a world where the listener setup is no longer needed (because the JIT knows how to do c10 registry lookups directly), where will this conditional creation of a testing wrapper wind up?
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.
Excellent question. I guess it would have to be in the call path which sucks. Moving this to do a namespace check instead might solve the issue.
All ops now do unboxing after dispatch, i.e. c10 handles unboxing and c10 registers a wrapper for the op to JIT The last op that manually registered its own wrapper to JIT in register_aten_ops.cpp was migrated. Since there are no ops using use_c10_dispatcher: unboxed_only anymore, we can delete the feature. Also: - Rename some files to more accurately describe what they're doing now: - OpsAlreadyMovedToC10.h/cpp -> ATenOpList.h/cpp - register_aten_ops.cpp -> generated_unboxing_wrappers.cpp - gen_jit_dispatch.py -> gen_unboxing_wrappers.cpp Differential Revision: [D21100081](https://our.internmc.facebook.com/intern/diff/D21100081/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D21100081/)! [ghstack-poisoned]
All ops now do unboxing after dispatch, i.e. c10 handles unboxing and c10 registers a wrapper for the op to JIT The last op that manually registered its own wrapper to JIT in register_aten_ops.cpp was migrated. Since there are no ops using use_c10_dispatcher: unboxed_only anymore, we can delete the feature. Also: - Rename some files to more accurately describe what they're doing now: - OpsAlreadyMovedToC10.h/cpp -> ATenOpList.h/cpp - register_aten_ops.cpp -> generated_unboxing_wrappers.cpp - gen_jit_dispatch.py -> gen_unboxing_wrappers.cpp Differential Revision: [D21100081](https://our.internmc.facebook.com/intern/diff/D21100081/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D21100081/)! [ghstack-poisoned]
All ops now do unboxing after dispatch, i.e. c10 handles unboxing and c10 registers a wrapper for the op to JIT The last op that manually registered its own wrapper to JIT in register_aten_ops.cpp was migrated. Since there are no ops using use_c10_dispatcher: unboxed_only anymore, we can delete the feature. Also: - Rename some files to more accurately describe what they're doing now: - OpsAlreadyMovedToC10.h/cpp -> ATenOpList.h/cpp - register_aten_ops.cpp -> generated_unboxing_wrappers.cpp - gen_jit_dispatch.py -> gen_unboxing_wrappers.cpp Differential Revision: [D21100081](https://our.internmc.facebook.com/intern/diff/D21100081/) **NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D21100081/)! [ghstack-poisoned]
This pull request has been merged in 6d13a33. |
Stack from ghstack:
All ops now do unboxing after dispatch, i.e. c10 handles unboxing and c10 registers a wrapper for the op to JIT
The last op that manually registered its own wrapper to JIT in register_aten_ops.cpp was migrated.
Since there are no ops using use_c10_dispatcher: unboxed_only anymore, we can delete the feature.
Also:
Differential Revision: D21100081
NOTE FOR REVIEWERS: This PR has internal Facebook specific changes or comments, please review them on Phabricator!