[pytorch] fix ParallelNative.h/cpp build#26746
Closed
ljk53 wants to merge 8 commits intogh/ljk53/57/basefrom
Closed
[pytorch] fix ParallelNative.h/cpp build#26746ljk53 wants to merge 8 commits intogh/ljk53/57/basefrom
ljk53 wants to merge 8 commits intogh/ljk53/57/basefrom
Conversation
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 We could set NoneType by default if we want to enforce non-null type everywhere, but looks like Tuple can take null TupleType so just follow it. Test Plan: - builds [ghstack-poisoned]
This was referenced Sep 24, 2019
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 We could set NoneType by default if we want to enforce non-null type everywhere, but looks like Tuple can take null TupleType so just follow it. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 We could set NoneType by default if we want to enforce non-null type everywhere, but looks like Tuple can take null TupleType so just follow it. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 We could set NoneType by default if we want to enforce non-null type everywhere, but looks like Tuple can take null TupleType so just follow it. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
suo
requested changes
Sep 25, 2019
Member
There was a problem hiding this comment.
I don't think this makes a ton of sense. TupleType takes a null type because the type can be lazily inferred by inspecting the types of the contained elements, not because it actually doesn't have a type.
I would prefer not to default construct Future as there is not an obvious default. Can we change ParallelNative and friends to use Future<None>?
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 Use NoneType::get() to initialize these Futures. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
ljk53
commented
Sep 25, 2019
| std::vector<std::shared_ptr<c10::ivalue::Future>> futures(num_tasks); | ||
| for (size_t i = 0; i < num_tasks; ++i) { | ||
| futures[i] = std::make_shared<c10::ivalue::Future>(NoneType::get()); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
@ilia-cher let me know if I should move this to a common util function, maybe in Parallel.h? I can reuse it in ParallelNativeMobile.h as well.
Contributor
|
This and #26739 are duplicates, fyi. |
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 Use NoneType::get() to initialize these Futures. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 Use NoneType::get() to initialize these Futures. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
Summary: PR #25439 introduced type() to IValue, which enforced ivalue::Future to be constructed with type. This broke ParallelNative.h and a few other places where Future was constructed without type and simply used as a barrier: https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63 Use NoneType::get() to initialize these Futures. Test Plan: - builds Differential Revision: [D17556002](https://our.internmc.facebook.com/intern/diff/D17556002) [ghstack-poisoned]
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.
Stack from ghstack:
Summary:
PR #25439 introduced type() to IValue, which enforced ivalue::Future to
be constructed with type. This broke ParallelNative.h and a few other
places where Future was constructed without type and simply used as a barrier:
https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/ParallelNative.h#L63
Use NoneType::get() to initialize these Futures.
Test Plan:
Differential Revision: D17556002