Compute type_equal() without reference to backend()#53823
Compute type_equal() without reference to backend()#53823ezyang wants to merge 7 commits intogh/ezyang/943/basefrom
Conversation
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 2b53b5f (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 to the (internal) Dr. CI Users group. |
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> ghstack-source-id: e16f265 Pull Request resolved: #53823
bhosmer
left a comment
There was a problem hiding this comment.
This makes sense but it seems pretty fragile.
- any idea what it saves us, perf-wise?
- can we throw in a lightweight injectivity test somewhere?
My intention wasn't really perf; I just really didn't want to put Meta in the list of Backends XD
I... guess? But honestly I'd rather spend the time just getting rid of Backend (as we have kept saying we would do, and then haven't) |
Makes sense. So maybe just a comment on |
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> [ghstack-poisoned]
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: [D27036575](https://our.internmc.facebook.com/intern/diff/D27036575) [ghstack-poisoned]
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: [D27036575](https://our.internmc.facebook.com/intern/diff/D27036575) [ghstack-poisoned]
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: [D27036575](https://our.internmc.facebook.com/intern/diff/D27036575) [ghstack-poisoned]
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: [D27036575](https://our.internmc.facebook.com/intern/diff/D27036575) [ghstack-poisoned]
Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: [D27036575](https://our.internmc.facebook.com/intern/diff/D27036575) [ghstack-poisoned]
Summary: Pull Request resolved: pytorch#53823 Argument for correctness: type_equal previous compared if backends are equal. Backend is computed by translation from dispatch key. I verified that computeDispatchKey never computed a weird dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend was effectively injective. Then it is always valid to compare the arguments of an injective function for equality, rather than the output of the injective function. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Reviewed By: mruberry Differential Revision: D27036575 Pulled By: ezyang fbshipit-source-id: 6aeafc89f287da0bc0065bd21c1adb5e272dbb81
Stack from ghstack:
Argument for correctness: type_equal previous compared if backends
are equal. Backend is computed by translation from dispatch key.
I verified that computeDispatchKey never computed a weird
dispatch key (e.g., AutogradXLA), so that dispatchKeyToBackend
was effectively injective. Then it is always valid to compare
the arguments of an injective function for equality, rather than
the output of the injective function.
Signed-off-by: Edward Z. Yang ezyang@fb.com
Differential Revision: D27036575