Skip to content

Commit 60535e9

Browse files
committed
[executorch][weight sharing] Introduce NamedData to PTE schema
See 'Schema Changes' in the [RFC]( Differential Revision: [D69430152](https://our.internmc.facebook.com/intern/diff/D69430152/) ghstack-source-id: 268329106 Pull Request resolved: #8695
1 parent c81ddb0 commit 60535e9

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,16 @@ table SubsegmentOffsets {
431431
offsets: [uint64];
432432
}
433433

434+
// Attributes a name to data referenced by Program.segments. Typically used
435+
// when data is referenced by multiple users.
436+
table NamedData {
437+
// The unique id of the data blob.
438+
key: string;
439+
440+
// Index of the segment in Program.segments
441+
segment_index: uint32;
442+
}
443+
434444
table Program {
435445
// Schema version.
436446
version: uint;
@@ -468,6 +478,10 @@ table Program {
468478
// constant memory, copying it over, and then being unable to release the
469479
// constant segment. No two elements should point to the same segment.
470480
mutable_data_segments: [SubsegmentOffsets];
481+
482+
// [Optional] List of blobs keyed by a name. Stored in segments attached to
483+
// the PTE file.
484+
named_data: [NamedData];
471485
}
472486

473487
root_type Program;

0 commit comments

Comments
 (0)