Skip to content

[pytorch] fix ParallelNative.h/cpp build#26746

Closed
ljk53 wants to merge 8 commits intogh/ljk53/57/basefrom
gh/ljk53/57/head
Closed

[pytorch] fix ParallelNative.h/cpp build#26746
ljk53 wants to merge 8 commits intogh/ljk53/57/basefrom
gh/ljk53/57/head

Conversation

@ljk53
Copy link
Contributor

@ljk53 ljk53 commented Sep 24, 2019

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:

  • builds

Differential Revision: D17556002

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]
Copy link
Contributor

@smessmer smessmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want to be able to construct Futures without type information? Afaik, we want to have types everywhere. cc @zdevito

@ljk53 ljk53 added this to the 1.3 milestone 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]
@ljk53 ljk53 requested a review from ilia-cher September 25, 2019 00:56
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]
Copy link
Member

@suo suo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ljk53 changed the title [pytorch] add default constructor to ivalue::Future [pytorch] fix ParallelNative.h/cpp build 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());
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@ljk53 ljk53 requested review from smessmer and suo September 25, 2019 04:21
@zdevito
Copy link
Contributor

zdevito commented Sep 25, 2019

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]
@zdevito zdevito removed their request for review September 25, 2019 18:50
@ljk53 ljk53 closed this Sep 26, 2019
@facebook-github-bot facebook-github-bot deleted the gh/ljk53/57/head branch October 28, 2019 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: internals Related to internal abstractions in c10 and ATen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants