-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Add MemoryFormat to TensorOptions, but not codegen. #33704
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
Conversation
This diff adds MemoryFormat field to TensorOptions, and teaches all kernels that take TensorOptions to respect it, but doesn't teach the codegen about it. As such, it is now possible to specify memory_format using TensorOptions syntax, e.g., at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous)) in the C++ API, but there isn't any other user visible effect. The intended end state of this diff stack is to eliminate the explicit MemoryFormat? arguments from native functions, but as this change has BC implications I'd prefer to do it separately. So this starts things off with a non-BC breaking addition to the API. For all internal functions that are not bound by codegen, I switch them to exclusively using TensorOptions (eliminating MemoryFormat); there's only a few, mostly quantized and to(). To keep things screwed down in the short term, it is a HARD ERROR to specify both the explicit MemoryFormat argument as well as TensorOptions. This caught a few errors in my diff where I needed to modify memory format settings and then call code later, esp in empty_like. Signed-off-by: Edward Z. Yang <[email protected]> [ghstack-poisoned]
This diff adds MemoryFormat field to TensorOptions, and teaches all kernels that take TensorOptions to respect it, but doesn't teach the codegen about it. As such, it is now possible to specify memory_format using TensorOptions syntax, e.g., at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous)) in the C++ API, but there isn't any other user visible effect. The intended end state of this diff stack is to eliminate the explicit MemoryFormat? arguments from native functions, but as this change has BC implications I'd prefer to do it separately. So this starts things off with a non-BC breaking addition to the API. For all internal functions that are not bound by codegen, I switch them to exclusively using TensorOptions (eliminating MemoryFormat); there's only a few, mostly quantized and to(). To keep things screwed down in the short term, it is a HARD ERROR to specify both the explicit MemoryFormat argument as well as TensorOptions. This caught a few errors in my diff where I needed to modify memory format settings and then call code later, esp in empty_like. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D20073356](https://our.internmc.facebook.com/intern/diff/D20073356) [ghstack-poisoned]
💊 CircleCI build failures summary and remediationsAs of commit 7878001 (more details on the Dr. CI page): ✅ None of the build failures appear to be your fault 💚
🚧 1 upstream failure recognized by patterns:These were probably caused by upstream breakages:
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 7 times. |
This diff adds MemoryFormat field to TensorOptions, and teaches all kernels that take TensorOptions to respect it, but doesn't teach the codegen about it. As such, it is now possible to specify memory_format using TensorOptions syntax, e.g., at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous)) in the C++ API, but there isn't any other user visible effect. The intended end state of this diff stack is to eliminate the explicit MemoryFormat? arguments from native functions, but as this change has BC implications I'd prefer to do it separately. So this starts things off with a non-BC breaking addition to the API. For all internal functions that are not bound by codegen, I switch them to exclusively using TensorOptions (eliminating MemoryFormat); there's only a few, mostly quantized and to(). To keep things screwed down in the short term, it is a HARD ERROR to specify both the explicit MemoryFormat argument as well as TensorOptions. This caught a few errors in my diff where I needed to modify memory format settings and then call code later, esp in empty_like. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D20073356](https://our.internmc.facebook.com/intern/diff/D20073356) [ghstack-poisoned]
This diff adds MemoryFormat field to TensorOptions, and teaches all kernels that take TensorOptions to respect it, but doesn't teach the codegen about it. As such, it is now possible to specify memory_format using TensorOptions syntax, e.g., at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous)) in the C++ API, but there isn't any other user visible effect. The intended end state of this diff stack is to eliminate the explicit MemoryFormat? arguments from native functions, but as this change has BC implications I'd prefer to do it separately. So this starts things off with a non-BC breaking addition to the API. For all internal functions that are not bound by codegen, I switch them to exclusively using TensorOptions (eliminating MemoryFormat); there's only a few, mostly quantized and to(). To keep things screwed down in the short term, it is a HARD ERROR to specify both the explicit MemoryFormat argument as well as TensorOptions. This caught a few errors in my diff where I needed to modify memory format settings and then call code later, esp in empty_like. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D20073356](https://our.internmc.facebook.com/intern/diff/D20073356) [ghstack-poisoned]
This diff adds MemoryFormat field to TensorOptions, and teaches all kernels that take TensorOptions to respect it, but doesn't teach the codegen about it. As such, it is now possible to specify memory_format using TensorOptions syntax, e.g., at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous)) in the C++ API, but there isn't any other user visible effect. The intended end state of this diff stack is to eliminate the explicit MemoryFormat? arguments from native functions, but as this change has BC implications I'd prefer to do it separately. So this starts things off with a non-BC breaking addition to the API. For all internal functions that are not bound by codegen, I switch them to exclusively using TensorOptions (eliminating MemoryFormat); there's only a few, mostly quantized and to(). To keep things screwed down in the short term, it is a HARD ERROR to specify both the explicit MemoryFormat argument as well as TensorOptions. This caught a few errors in my diff where I needed to modify memory format settings and then call code later, esp in empty_like. Signed-off-by: Edward Z. Yang <[email protected]> Differential Revision: [D20073356](https://our.internmc.facebook.com/intern/diff/D20073356) [ghstack-poisoned]
Summary: Pull Request resolved: pytorch#33704 This diff adds MemoryFormat field to TensorOptions, and teaches all kernels that take TensorOptions to respect it, but doesn't teach the codegen about it. As such, it is now possible to specify memory_format using TensorOptions syntax, e.g., at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous)) in the C++ API, but there isn't any other user visible effect. The intended end state of this diff stack is to eliminate the explicit MemoryFormat? arguments from native functions, but as this change has BC implications I'd prefer to do it separately. So this starts things off with a non-BC breaking addition to the API. For all internal functions that are not bound by codegen, I switch them to exclusively using TensorOptions (eliminating MemoryFormat); there's only a few, mostly quantized and to(). To keep things screwed down in the short term, it is a HARD ERROR to specify both the explicit MemoryFormat argument as well as TensorOptions. This caught a few errors in my diff where I needed to modify memory format settings and then call code later, esp in empty_like. Signed-off-by: Edward Z. Yang <[email protected]> Test Plan: Imported from OSS Differential Revision: D20073356 Pulled By: bhosmer fbshipit-source-id: 18d310d7ee7cf2ee182994104652afcfc9d613e2
Stack from ghstack:
This diff adds MemoryFormat field to TensorOptions, and teaches
all kernels that take TensorOptions to respect it, but doesn't
teach the codegen about it. As such, it is now possible to specify
memory_format using TensorOptions syntax, e.g.,
at::empty_like(tensor, at::memory_format(MemoryFormat::Contiguous))
in the C++ API, but there isn't any other user visible effect.
The intended end state of this diff stack is to eliminate the
explicit MemoryFormat? arguments from native functions, but
as this change has BC implications I'd prefer to do it separately.
So this starts things off with a non-BC breaking addition to the
API. For all internal functions that are not bound by codegen,
I switch them to exclusively using TensorOptions (eliminating
MemoryFormat); there's only a few, mostly quantized and to().
To keep things screwed down in the short term, it is a HARD ERROR
to specify both the explicit MemoryFormat argument as well as
TensorOptions. This caught a few errors in my diff where I needed
to modify memory format settings and then call code later, esp
in empty_like.
Signed-off-by: Edward Z. Yang [email protected]
Differential Revision: D20073356