Skip to content

Commit 952fd92

Browse files
committed
[executorch][weight sharing] Introduce NamedData to PTE schema
Pull Request resolved: #8695 See 'Schema Changes' in the [RFC]( ghstack-source-id: 268535712 @exported-using-ghexport Differential Revision: [D69430152](https://our.internmc.facebook.com/intern/diff/D69430152/)
1 parent bc55c01 commit 952fd92

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

exir/schema.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ class SubsegmentOffsets:
290290
offsets: List[int]
291291

292292

293+
@dataclass
294+
class NamedData:
295+
key: str
296+
segment_index: int
297+
298+
293299
@dataclass
294300
class Program:
295301
version: int
@@ -299,3 +305,4 @@ class Program:
299305
segments: List[DataSegment]
300306
constant_segment: SubsegmentOffsets
301307
mutable_data_segments: Optional[List[SubsegmentOffsets]] = None
308+
named_data: Optional[List[NamedData]] = None

schema/program.fbs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,17 @@ table SubsegmentOffsets {
431431
offsets: [uint64];
432432
}
433433

434+
// Attributes a name to data referenced by Program.segments. Used when data is
435+
// referenced by multiple users, in cases where indices are not guaranteed to
436+
// be consistent across the users.
437+
table NamedData {
438+
// The unique id of the data blob.
439+
key: string;
440+
441+
// Index of the segment in Program.segments.
442+
segment_index: uint32;
443+
}
444+
434445
table Program {
435446
// Schema version.
436447
version: uint;
@@ -468,6 +479,11 @@ table Program {
468479
// constant memory, copying it over, and then being unable to release the
469480
// constant segment. No two elements should point to the same segment.
470481
mutable_data_segments: [SubsegmentOffsets];
482+
483+
// [Optional] List of blobs keyed by a unique name. Note that multiple
484+
// 'NamedData' entries could point to the same segment index. Stored in
485+
// segments attached to the PTE file.
486+
named_data: [NamedData];
471487
}
472488

473489
root_type Program;

0 commit comments

Comments
 (0)