Delete TensorImpl::type_, replace with backend_/scalar_type_/is_variable_#10210
Closed
ezyang wants to merge 3 commits intopytorch:masterfrom
Closed
Delete TensorImpl::type_, replace with backend_/scalar_type_/is_variable_#10210ezyang wants to merge 3 commits intopytorch:masterfrom
ezyang wants to merge 3 commits intopytorch:masterfrom
Conversation
…ble_ 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 fixed this by reordering the static initializers. Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Contributor
Author
|
Static initializer changes, which are new, at https://github.com/pytorch/pytorch/pull/10210/files#diff-831a1f12d3eac16763a4f42c9d05a213 |
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.
gchanan
approved these changes
Aug 3, 2018
| using at::RegistererVariableHooksRegistry; | ||
| using at::VariableHooksRegistry; | ||
|
|
||
| // WARNING: YOU MUST DO THE NEXT TWO STATIC INITIALIZERS IN THIS ORDER. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
ezyang is landing 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 4, 2018
…ble_ (#10210) Summary: 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 fixed this by reordering the static initializers. Fixes #9784 Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: pytorch/pytorch#10210 Differential Revision: D9150697 Pulled By: ezyang fbshipit-source-id: 89e2006c88688bcfab0dcee82dc369127c198c35
goodlux
pushed a commit
to goodlux/pytorch
that referenced
this pull request
Aug 15, 2018
…ble_ (pytorch#10210) Summary: 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 fixed this by reordering the static initializers. Fixes pytorch#9784 Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: pytorch#10210 Differential Revision: D9150697 Pulled By: ezyang fbshipit-source-id: 89e2006c88688bcfab0dcee82dc369127c198c35
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.
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 fixed this by
reordering the static initializers. Fixes globalContext() deadlock if Context is not initialized before libtorch (variable hooks) is loaded #9784
Signed-off-by: Edward Z. Yang ezyang@fb.com