-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[rpc] remove default constructor in futureInfo #30197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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]
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() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FutureInfo() = delete;|
@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. |
|
Thanks, @rohan-varma. This makes it just a bit more robust for future changes. |
|
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]
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/)
pietern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
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
Stack from ghstack:
Addresses @pietern's comment on #29601. This default constructor was added because
std::map'soperator[]requires a default constructor. However, instead of usingoperator[], we canuse
emplaceand remove the constructor, to ensure that theFutureInfostructdoesn't get constructed with garbage values.
Differential Revision: D18627675