Repository navigation
Conversation
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, ...). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/180852
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit b5760f4 with merge base b72c0ac ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, ...). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: e203d1e Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, ...). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, ...). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: 44bdf35 Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, ...). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy kadeng muchulee8 amjames chauhang aakhundov coconutruben jataylo [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: dc881ad Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: dc881ad Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: dc881ad Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: a5826f3 Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: 4c8fe1f Pull Request resolved: #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. ghstack-source-id: 095e2d2 Pull Request resolved: #180852
|
My local claude pr-review has acquiesced on this, but feel free to request it on the PR |
| unwrapped_mutable_out = ( | ||
| (unwrapped_outs,) if n_mutable == 1 else tuple(unwrapped_outs) | ||
| ) | ||
| unwrapped_actual_out = ( |
There was a problem hiding this comment.
isnt this the same as unwrapped_outs?
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. [ghstack-poisoned]
|
Starting merge as part of PR stack under #180987 |
Operators tagged with Tag.out have well-defined fake kernel semantics: return the out= arguments in declaration order. This extends the existing auto-fake-kernel mechanism (which handles mutable ops with no returns) to also cover Tag.out ops, removing the need for users to manually write trivial fake/meta kernels for these operators. Also warns when users manually register a Meta kernel for a non-builtin Tag.out operator, since the automatic registration is preferred and the manual version is easy to get wrong. Authored with Claude. Pull Request resolved: #180987 Approved by: https://github.com/angelayi ghstack dependencies: #180851, #180852
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. Pull Request resolved: pytorch#180852 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851
Operators tagged with Tag.out have well-defined fake kernel semantics: return the out= arguments in declaration order. This extends the existing auto-fake-kernel mechanism (which handles mutable ops with no returns) to also cover Tag.out ops, removing the need for users to manually write trivial fake/meta kernels for these operators. Also warns when users manually register a Meta kernel for a non-builtin Tag.out operator, since the automatic registration is preferred and the manual version is easy to get wrong. Authored with Claude. Pull Request resolved: pytorch#180987 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851, pytorch#180852
…torch#181098) test/custom_operator/** tests are not actually run in CI (except for one of them...) Pull Request resolved: pytorch#181098 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851, pytorch#180852, pytorch#180987
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. Pull Request resolved: pytorch#180852 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851
Operators tagged with Tag.out have well-defined fake kernel semantics: return the out= arguments in declaration order. This extends the existing auto-fake-kernel mechanism (which handles mutable ops with no returns) to also cover Tag.out ops, removing the need for users to manually write trivial fake/meta kernels for these operators. Also warns when users manually register a Meta kernel for a non-builtin Tag.out operator, since the automatic registration is preferred and the manual version is easy to get wrong. Authored with Claude. Pull Request resolved: pytorch#180987 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851, pytorch#180852
…torch#181098) test/custom_operator/** tests are not actually run in CI (except for one of them...) Pull Request resolved: pytorch#181098 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851, pytorch#180852, pytorch#180987
Allow custom operators tagged with torch.Tag.out to go through auto_functionalize during torch.compile. Previously these were rejected because their returns have alias annotations. - the functional form of e.g. `foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)` is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device). The semantics of this operator are `foo(Tensor x) -> Tensor`. This is because the out= args are write-only, and we need to store the metadata to know how to allocate the output. - Re-inplacing this operator is easy. We just use empty_like to allocate the output tensor and call foo_out. Authored with Claude. Pull Request resolved: pytorch#180852 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851
Operators tagged with Tag.out have well-defined fake kernel semantics: return the out= arguments in declaration order. This extends the existing auto-fake-kernel mechanism (which handles mutable ops with no returns) to also cover Tag.out ops, removing the need for users to manually write trivial fake/meta kernels for these operators. Also warns when users manually register a Meta kernel for a non-builtin Tag.out operator, since the automatic registration is preferred and the manual version is easy to get wrong. Authored with Claude. Pull Request resolved: pytorch#180987 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851, pytorch#180852
…torch#181098) test/custom_operator/** tests are not actually run in CI (except for one of them...) Pull Request resolved: pytorch#181098 Approved by: https://github.com/angelayi ghstack dependencies: pytorch#180851, pytorch#180852, pytorch#180987
Stack from ghstack (oldest at bottom):
Allow custom operators tagged with torch.Tag.out to go through
auto_functionalize during torch.compile. Previously these were
rejected because their returns have alias annotations.
foo_out(Tensor x, *, Tensor(a!) out) -> Tensor(a!)is auto_functionalized(foo, x, out_shape, out_stride, out_dtype, out_device).
The semantics of this operator are
foo(Tensor x) -> Tensor. This is because the out= args arewrite-only, and we need to store the metadata to know how to allocate
the output.
the output tensor and call foo_out.
Authored with Claude.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo