Skip to content

Commit

Permalink
[executorch][weight sharing] Introduce NamedData to PTE schema
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lucylq committed Feb 25, 2025
1 parent c81ddb0 commit 60535e9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions exir/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ class SubsegmentOffsets:
offsets: List[int]


@dataclass
class NamedData:
key: str
segment_index: int


@dataclass
class Program:
version: int
Expand All @@ -299,3 +305,4 @@ class Program:
segments: List[DataSegment]
constant_segment: SubsegmentOffsets
mutable_data_segments: Optional[List[SubsegmentOffsets]] = None
named_data: Optional[List[NamedData]] = None
14 changes: 14 additions & 0 deletions schema/program.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,16 @@ table SubsegmentOffsets {
offsets: [uint64];
}

// Attributes a name to data referenced by Program.segments. Typically used
// when data is referenced by multiple users.
table NamedData {
// The unique id of the data blob.
key: string;

// Index of the segment in Program.segments
segment_index: uint32;
}

table Program {
// Schema version.
version: uint;
Expand Down Expand Up @@ -468,6 +478,10 @@ table Program {
// constant memory, copying it over, and then being unable to release the
// constant segment. No two elements should point to the same segment.
mutable_data_segments: [SubsegmentOffsets];

// [Optional] List of blobs keyed by a name. Stored in segments attached to
// the PTE file.
named_data: [NamedData];
}

root_type Program;

0 comments on commit 60535e9

Please sign in to comment.