[TENSOR MERGE] Delete type_ field from TensorImpl, replaced with backend_/scalar_typ…#9787
Closed
ezyang wants to merge 4 commits intopytorch:masterfrom
Closed
[TENSOR MERGE] Delete type_ field from TensorImpl, replaced with backend_/scalar_typ…#9787ezyang wants to merge 4 commits intopytorch:masterfrom
ezyang wants to merge 4 commits intopytorch:masterfrom
Conversation
…e_/is_variable_ The basic game plan is to stop accessing the type_ field directly, and instead using the stored backend_, scalar_type_ and is_variable_ to look up the appropriate Type from Context. Storage of backend_ and scalar_type_ are new. At some future point in time, I'd like to look at this code carefully to see if I can get everything in this codepath inlining. I didn't do it in this patch because there are circular include problems making things difficult. Some other details: - Added Device::backend() which does what it says on the tin - SparseTensorImpl is temporarily hard-coded to root in at::Context for the appropriate context. If/when we put this in shared code, we'll have to break this dep too, but for now it should be OK. - There's a stupid problem with globalContext() deadlocking if you didn't actually initialize it before loading libtorch.so (which is bringing along the variable hooks). I didn't fix it in this PR; it's tracked in pytorch#9784 Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Contributor
Author
|
@pytorchbot retest this please |
1 similar comment
Contributor
Author
|
@pytorchbot retest this please |
gchanan
requested changes
Jul 26, 2018
aten/src/ATen/Device.h
Outdated
| return type_ == Type::CPU; | ||
| } | ||
|
|
||
| Backend backend() const { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
aten/src/TH/THTensor.hpp
Outdated
| } | ||
|
|
||
| at::Backend backend() const { | ||
| return storage_->data_ptr.device().backend(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
gchanan
approved these changes
Jul 30, 2018
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
zdevito
pushed a commit
to zdevito/ATen
that referenced
this pull request
Aug 1, 2018
…… (#9787) Summary: …e_/is_variable_ The basic game plan is to stop accessing the type_ field directly, and instead using the stored backend_, scalar_type_ and is_variable_ to look up the appropriate Type from Context. Storage of backend_ and scalar_type_ are new. At some future point in time, I'd like to look at this code carefully to see if I can get everything in this codepath inlining. I didn't do it in this patch because there are circular include problems making things difficult. Some other details: - Added Device::backend() which does what it says on the tin - SparseTensorImpl is temporarily hard-coded to root in at::Context for the appropriate context. If/when we put this in shared code, we'll have to break this dep too, but for now it should be OK. - There's a stupid problem with globalContext() deadlocking if you didn't actually initialize it before loading libtorch.so (which is bringing along the variable hooks). I didn't fix it in this PR; it's tracked in #9784 Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: pytorch/pytorch#9787 Reviewed By: cpuhrsch Differential Revision: D8980971 Pulled By: ezyang fbshipit-source-id: 2b4d867abfdc3999a836a220c638c109053145a8
goodlux
pushed a commit
to goodlux/pytorch
that referenced
this pull request
Aug 15, 2018
pytorch#9787) Summary: …e_/is_variable_ The basic game plan is to stop accessing the type_ field directly, and instead using the stored backend_, scalar_type_ and is_variable_ to look up the appropriate Type from Context. Storage of backend_ and scalar_type_ are new. At some future point in time, I'd like to look at this code carefully to see if I can get everything in this codepath inlining. I didn't do it in this patch because there are circular include problems making things difficult. Some other details: - Added Device::backend() which does what it says on the tin - SparseTensorImpl is temporarily hard-coded to root in at::Context for the appropriate context. If/when we put this in shared code, we'll have to break this dep too, but for now it should be OK. - There's a stupid problem with globalContext() deadlocking if you didn't actually initialize it before loading libtorch.so (which is bringing along the variable hooks). I didn't fix it in this PR; it's tracked in pytorch#9784 Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: pytorch#9787 Reviewed By: cpuhrsch Differential Revision: D8980971 Pulled By: ezyang fbshipit-source-id: 2b4d867abfdc3999a836a220c638c109053145a8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…e_/is_variable_
The basic game plan is to stop accessing the type_ field directly,
and instead using the stored backend_, scalar_type_ and
is_variable_ to look up the appropriate Type from Context.
Storage of backend_ and scalar_type_ are new.
At some future point in time, I'd like to look at this code
carefully to see if I can get everything in this codepath inlining.
I didn't do it in this patch because there are circular include
problems making things difficult.
Some other details:
Added Device::backend() which does what it says on the tin
SparseTensorImpl is temporarily hard-coded to root in at::Context
for the appropriate context. If/when we put this in shared code,
we'll have to break this dep too, but for now it should be OK.
There's a stupid problem with globalContext() deadlocking if
you didn't actually initialize it before loading libtorch.so
(which is bringing along the variable hooks). I didn't fix
it in this PR; it's tracked in globalContext() deadlock if Context is not initialized before libtorch (variable hooks) is loaded #9784
Signed-off-by: Edward Z. Yang ezyang@fb.com