Skip to content

Conversation

@smessmer
Copy link
Contributor

@smessmer smessmer commented Sep 11, 2019

Stack from ghstack:

When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: D17301917

@pytorchbot pytorchbot added the module: internals Related to internal abstractions in c10 and ATen label Sep 11, 2019
@smessmer smessmer changed the title [wip] forward c10 registrations to aten forward c10 registrations to aten Sep 11, 2019
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
smessmer added a commit that referenced this pull request Sep 11, 2019
Pull Request resolved: #25969

When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().

This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.

Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

ghstack-source-id: 89860596

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
smessmer added a commit that referenced this pull request Sep 11, 2019
Pull Request resolved: #25969

When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().

This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.

Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

ghstack-source-id: 89873100

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
@pytorchbot pytorchbot added the module: cpp-extensions Related to torch.utils.cpp_extension label Sep 11, 2019
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
When an op is registered with the c10 dispatcher but the op is actually one of the ops that still lives on globalATenDispatch(), the c10 dispatcher will forward the registration call to globalATenDispatch().
This will allow backend extensions like XLA to immediately move to the new c10 registration API, while we are moving ops from globalATenDispatch to the c10 dispatcher behind the scenes without breaking their API.
Note that for consistency, this also changes all op registrations in TypeDefault/CPUType/... They now also directly go to the c10 dispatcher, and will be rerouted to globalATenDispatch from there.

Differential Revision: [D17301917](https://our.internmc.facebook.com/intern/diff/D17301917/)
@ailzhang ailzhang self-requested a review September 12, 2019 17:48
@smessmer
Copy link
Contributor Author

merged into #23667

@smessmer smessmer closed this Sep 12, 2019
.op("aten::empty.memory_format(int[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor", torch::RegisterOperators::options()
.impl_unboxedOnlyKernel<decltype(empty_override), &empty_override>(
"aten::empty.memory_format(int[] size, *, ScalarType? dtype=None, Layout? layout=None, Device? device=None, bool? pin_memory=None, MemoryFormat? memory_format=None) -> Tensor",
TensorTypeId::MSNPUTensorId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This registration looks WAY worse than the old one. A big problem is that the schema string shows up twice. Why does the schema string show up twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this API either but it's the only way to implement the forwarding to ATen without serious refactorings and probably bc breaking changes to the custom op API. This is only needed for the forwarding of registrations to ATen, it won't be needed anymore once everything is on c10. I'm planning to fix the API then and deprecate the one taking an additional string.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think the registration API is really bad and needs to be improved.

@facebook-github-bot facebook-github-bot deleted the gh/smessmer/32/head branch October 28, 2019 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: cpp-extensions Related to torch.utils.cpp_extension module: internals Related to internal abstractions in c10 and ATen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants