You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[pytorch/executorch][diff_train] Serialize NamedData in PTE file (#8847)
1. Serialize NamedData in PTE file
2. Add NamedDataStore to EdgeProgramManager
---
Serializing NamedData is slightly different to constant/delegate data as each segment comes with its own alignment.
**An example:**
Given NamedData = {"key": data}. Data is 250 bytes.
- BackendA requires data with alignment=3
- BackendB requires data with alignment=4
Then, data0 should be serialized with alignment of lcm(3, 4) = 12
At serialization, ExecuTorch has a 'segment_alignment' that defaults to 128. Data is now serialized to lcm(12, 128) = 384.
Inside the DataSegment, we want to store the original size of the data (250). The offset of the subsequent DataSegment would be 384 bytes after the start of this one.
**Design**
Introduce a new dataclass 'AlignedData' that stores the buffer and any alignment that's required. This is used when assembling Program.segments to ensure we get lcm(buffer_alignment, segment_alignment).
Note: The default segment_alignment can be overridden inside 'ExecutorchBackendConfig'.
Pull Request resolved: pytorch/executorch#8835
Internal:
<< DO NOT EDIT BELOW THIS LINE >>
**GitHub Author**: pytorchbot <[email protected]>
**GitHub Repo**: [pytorch/executorch](https://github.com/pytorch/executorch)
**GitHub Pull Request**: [#8835](pytorch/executorch#8835)
Initially generated by: https://www.internalfb.com/intern/sandcastle/job/18014400207802303/
This was imported as part of a Diff Train.
Please review this as soon as possible. Since it is a direct copy of a commit on
GitHub, there shouldn't be much to do.
diff-train-source-id: 314ab18
Co-authored-by: lucylq <[email protected]>
Differential Revision: [D69764150](https://our.internmc.facebook.com/intern/diff/D69764150/)
ghstack-source-id: 269082799
0 commit comments