-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Remove LazyStreamContext (2 out of 2) #59299
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
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit 8a1dfce (more details on the Dr. CI page):
1 failure not recognized by patterns:
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) ghstack-source-id: 130359961 Pull Request resolved: #59299
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
Pull Request resolved: #59299 After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. ghstack-source-id: 130473860 Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/)
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
Pull Request resolved: #59299 After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. ghstack-source-id: 130478940 Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/)
| const std::vector<torch::Tensor>& tensors) { | ||
| c10::optional<c10::impl::VirtualGuardImpl> impl; | ||
| size_t deviceCount = 0; | ||
| std::vector<bool> indexBitSet; |
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.
curious about this var name. It seems to be neither bit nor set? Or is it possible to use a real std::bitset here?
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.
This is probably not the best capitalization, but the name was meant to be "a bitset of indices". It is conceptually identical to std::bitset, but if you notice std::bitset requires a compile-time size. The doc for std::bitset says:
If the size of the bitset is not known at compile time,
std::vector<bool>may be used.
Hope this clarifies. I'll fix the capitalization.
| } | ||
| std::vector<c10::Device> devices; | ||
| devices.reserve(deviceCount); | ||
| for (c10::DeviceIndex idx = 0; idx < indexBitSet.size(); idx++) { |
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.
lint failures look real.
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.
The linter is correct "in principle" but here we know that the size of the vector will fit in a DeviceIndex because we used a DeviceIndex to resize the vector.
I'm starting to think that perhaps we should create a dedicated DeviceVector class, that can provide properly-typed accessors, can perhaps use small-vector optimizations, ...
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
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. Stamp to unblock.
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. Differential Revision: [D28789174](https://our.internmc.facebook.com/intern/diff/D28789174/) [ghstack-poisoned]
|
This pull request has been merged in c09beaa. |
Summary: Pull Request resolved: pytorch#59299 After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type. This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals. ghstack-source-id: 130583773 Test Plan: CI Reviewed By: mrshenli Differential Revision: D28789174 fbshipit-source-id: a27d2b1f40ab3cf2ac0dd946232fd0eecda6d450
Stack from ghstack:
After recent changes, LazyStreamContext had in fact always become eager, and was in fact equivalent to a vector of streams. So it makes more sense now to remove this abstraction and use a more self-descriptive type.
This PR migrates the TensorPipe agent. The previous PR migrated the RequestCallback internals.
Differential Revision: D28789174