fix _unsafe_view composite compliance#77127
fix _unsafe_view composite compliance#77127bdhirsh wants to merge 3 commits intogh/bdhirsh/225/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful links
❌ 5 New Failures, 5 Flaky FailuresAs of commit b4be12a (more details on the Dr. CI page): Expand to see more
🕵️ 5 new failures recognized by patternsThe following CI failures do not appear to be due to upstream breakages
|
| "not compatible with input tensor's size and stride (at least one dimension" | ||
| " spans across two contiguous subspaces). Use .reshape(...) instead."); | ||
| return alias_with_sizes_and_strides(self, inferred_size, *stride); | ||
| return self.as_strided(inferred_size, *stride); |
There was a problem hiding this comment.
The whole point of unsafe_view is to be faster than doing a proper view that goes through the dispatcher.
So if we do this, we might as well remove unsafe_view altogether.
There was a problem hiding this comment.
oh haha. Then maybe the CompositeExplicitAutograd label is just false advertising.
Ok, I'm actually going to just remove this PR. I guess we could replace CompositeExplicitAutograd with CPU, CUDA, QuantizedCPU, QuantizedCUDA, etc, but we risk breaking 3rd party backends that happened to be relying on it.
I have another PR later that will add a new alias key for basically "all backends except functional backends", which might be a good candidate for this kernel (since functional backends like XLA/LTC won't like the alias_with_sizes_and_strides call).
|
I'm wondering what the right thing to do here is. @albanD isn't the goal of |
|
Ho I forgot we added full autograd support for it. It is already going through the dispatcher once I gues (unless it is called via at::native). On a side note, isn't composite compliance only for the Implicit autograd keys? |
Yes? Wasn't this the whole point of inference mode |
I'm probably overloading the term, yeah 😛. "Ops advertising as |
`_unsafe_view` is listed as `CompositeExplicitAutograd`, but internally is calls `alias_with_sizes_and_strides` which isn't supported by non-eager backends. [ghstack-poisoned]
`_unsafe_view` is listed as `CompositeExplicitAutograd`, but internally is calls `alias_with_sizes_and_strides` which isn't supported by non-eager backends. [ghstack-poisoned]
|
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
_unsafe_viewis listed asCompositeExplicitAutograd, but internally is callsalias_with_sizes_and_strideswhich isn't supported by non-eager backends.Stack from ghstack: