Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Mar 2, 2020

See Commits and Changes for more details.


Created by pull[bot]. Want to support this open source service? Please star it : )

Basil Hosmer added 2 commits March 1, 2020 18:22
Summary:
Pull Request resolved: #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
Summary:
Pull Request resolved: #33705

The fact that there were two overloads appears to be a historical
artifact that dates back to when goldsborough originally added these
bindings in the first place.  If TensorOptions is made optional,
then you only need one overload, not two, as they are exactly redundant
with each other.  When MemoryFormat was added, it was made a little
harder to do this, as the C++ syntax at::empty_like(t, memory_format) would
not work if you collapsed the overload; but now it works because TensorOptions
supports MemoryFormat.

The upshot is, I can get rid of all the overloads and just have one overload.
Amazingly, this change is backwards compatible, as the test attests.  While
I was at it, I also deleted the overload name from the functions entirely.

Signed-off-by: Edward Z. Yang <[email protected]>

Test Plan: Imported from OSS

Differential Revision: D20073355

Pulled By: bhosmer

fbshipit-source-id: c6a8908213b32ccf6737ea864d135e2cce34f56b
@pull pull bot added the ⤵️ pull label Mar 2, 2020
svcscm and others added 2 commits March 1, 2020 20:54
Summary:
GitHub commits:

pytorch/FBGEMM@af57f36

Test Plan: n/a

Reviewed By: wittgenst

fbshipit-source-id: 4bd71218aee5e2a20a3496f2a51d464a19c0f879
Summary:
Pull Request resolved: #33929

`Blob::~Blob()` calls `Blob::free_()`. `Blob::free_()` throws and destructors should not throw.

A few other minor tweaks include:
- Remove `static_cast<void*>()` in `ShareExternal`
- Remove default values of `pointer_` and `has_ownership_`

Test Plan:
```
buck test caffe2/caffe2:caffe2_test_cpu
```

https://our.intern.facebook.com/intern/ads/canary/424941782651397826
https://our.intern.facebook.com/intern/ads/canary/424941799628450155

Reviewed By: yinghai

Differential Revision: D19153199

fbshipit-source-id: f93983d5bf324b9a464ad2d1ed0dba13f807d2f6
@pull pull bot merged commit f857fe1 into peterjc123:master Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants