Skip to content

Conversation

@rohan-varma
Copy link
Contributor

@rohan-varma rohan-varma commented Nov 20, 2019

Stack from ghstack:

Addresses @pietern's comment on #29601. This default constructor was added because std::map's operator[] requires a default constructor. However, instead of using operator[], we can
use emplace and remove the constructor, to ensure that the FutureInfo struct
doesn't get constructed with garbage values.

Differential Revision: D18627675

This default constructor was added because std::map's operator[]
requires a default constructor. However, instead of using operator[], we can
use emplace and remove the constructor, to ensure that the FutureInfo struct
doesnt get constructed with garbage values.

Differential Revision: [D18627675](https://our.internmc.facebook.com/intern/diff/D18627675/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Nov 20, 2019
This default constructor was added because std::map's operator[]
requires a default constructor. However, instead of using operator[], we can
use emplace and remove the constructor, to ensure that the FutureInfo struct
doesnt get constructed with garbage values.

Differential Revision: [D18627675](https://our.internmc.facebook.com/intern/diff/D18627675/)

ghstack-source-id: 94313674
Pull Request resolved: #30197
startTime_(startTime),
dstRank_(dstRank),
timeout_(timeout) {}
FutureInfo() {}
Copy link
Contributor

Choose a reason for hiding this comment

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

FutureInfo() = delete;

@zhaojuanmao
Copy link
Contributor

@rohan-varma I just caught up diff review about future time out PR in #29601, I think we do not need startTime_ and timeout_, endTime_ should be sufficient.

@pietern
Copy link
Contributor

pietern commented Nov 22, 2019

Thanks, @rohan-varma. This makes it just a bit more robust for future changes.

@xush6528
Copy link
Contributor

@zhaojuanmao

I am doing it in #30342.

Addresses @pietern's comment on #29601. This default constructor was added because `std::map`'s `operator[]` requires a default constructor. However, instead of using `operator[]`, we can
use `emplace` and remove the constructor, to ensure that the `FutureInfo` struct
doesn't get constructed with garbage values.

Differential Revision: [D18627675](https://our.internmc.facebook.com/intern/diff/D18627675/)

[ghstack-poisoned]
rohan-varma added a commit that referenced this pull request Dec 3, 2019
Pull Request resolved: #30197

This default constructor was added because std::map's operator[]
requires a default constructor. However, instead of using operator[], we can
use emplace and remove the constructor, to ensure that the FutureInfo struct
doesnt get constructed with garbage values.
ghstack-source-id: 94802453

Differential Revision: [D18627675](https://our.internmc.facebook.com/intern/diff/D18627675/)
Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@facebook-github-bot facebook-github-bot deleted the gh/rohan-varma/38/head branch December 10, 2019 15:20
wuhuikx pushed a commit to wuhuikx/pytorch that referenced this pull request Jan 30, 2020
Summary:
Pull Request resolved: pytorch#30197

This default constructor was added because std::map's operator[]
requires a default constructor. However, instead of using operator[], we can
use emplace and remove the constructor, to ensure that the FutureInfo struct
doesnt get constructed with garbage values.
ghstack-source-id: 94802453

Test Plan: Unit tests pass.

Differential Revision: D18627675

fbshipit-source-id: c4cb000e60081478c0fd7308e17103ebbc4dc554
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants