-
Notifications
You must be signed in to change notification settings - Fork 537
[executorch][flat_tensor] DataMap implementation #7900
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
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7900
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit e1c396f with merge base 821a2fe ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D67064580 |
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) ghstack-source-id: 262756077 Pull Request resolved: #7900
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) ghstack-source-id: 262759344
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. ghstack-source-id: 262759344 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. ghstack-source-id: 262941711 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Populates a map with {key: tensor} and {key: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. ghstack-source-id: 262957949 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
This pull request was exported from Phabricator. Differential Revision: D67064580 |
executorch::runtime::FreeableBuffer _flat_tensor_data; | ||
|
||
// Map of name to {segment index, offset, TensorLayout}. | ||
std::unordered_map< |
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.
Im not super opinionated on this, but one thing to consider by having this state as part of the class is you force it to keep dangling around after all the method inits are done which is wasteful. I'm not really super sold on this being a huge latency win either rather then just constructing these things as they are needed.
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.
Ok, this sounds good. Esp. for training case where there aren't many tensors and a linear search (or logn if tensors are sorted) isn't time consuming. If there are latency issues later down the track we can create an impl with a map.
int segment_size = s_data_segment->Get(0)->size(); | ||
assert(segment_size <= segment_data_size); | ||
|
||
Result<FreeableBuffer> _data_ro = loader->load( |
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.
Ok I was trying to figure out how I wanted to handle this for mutable state. Here is what Ive come up with.
Lazily load segments, but internally keep a list of all the loaded segments. If the first time you need to load a segment is through "get_data" then put it in the preserve lis. If the first time you need to load a segment is through load_into then instead you just call data_loader load into which doesnt keep it hanging around.
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Populates a map with {key: tensor} and {key: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. ghstack-source-id: 264110292 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. ghstack-source-id: 264501132 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. TODO: in a later diff, update the ET runtime to hold onto the FreeableBuffers returned by the NDM. Then, the NDM will not persist the segment. T214294528 ghstack-source-id: 264501132 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. TODO: in a later diff, update the ET runtime to hold onto the FreeableBuffers returned by the NDM. Then, the NDM will not persist the segment. T214294528 ghstack-source-id: 264850001 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. TODO: in a later diff, update the ET runtime to hold onto the FreeableBuffers returned by the NDM. Then, the NDM will not persist the segment. T214294528 ghstack-source-id: 264871691 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. TODO: in a later diff, update the ET runtime to hold onto the FreeableBuffers returned by the NDM. Then, the NDM will not persist the segment. T214294528 ghstack-source-id: 264905837 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
DataMap implementation that * Loads a flat_tensor file * Populates a map with {fqn: tensor} and {fqn: TensorLayout}. * Makes tensor information available via the named_data_map.h interface. For now, DataMap doesn't store the DataLoader. - If/when tensors are in their own segments, DataMap should also store a DataLoader. Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D67064580 |
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. TODO: in a later diff, update the ET runtime to hold onto the FreeableBuffers returned by the NDM. Then, the NDM will not persist the segment. T214294528 ghstack-source-id: 264916795 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/)
Pull Request resolved: #7900 DataMap implementation that * Loads a flat_tensor file * Makes tensor information available via the named_data_map.h interface. TODO: in a later diff, update the ET runtime to hold onto the FreeableBuffers returned by the NDM. Then, the NDM will not persist the segment. T214294528 ghstack-source-id: 264916795 Differential Revision: [D67064580](https://our.internmc.facebook.com/intern/diff/D67064580/) --------- Co-authored-by: lucylq <[email protected]>
Stack from ghstack (oldest at bottom):
DataMap implementation that
For now, DataMap doesn't store the DataLoader.
Differential Revision: D67064580