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-poisoned]
  • Loading branch information
lucylq committed Feb 27, 2025
1 parent d651dcd commit d295db1
Show file tree
Hide file tree
Showing 2 changed files with 23 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
16 changes: 16 additions & 0 deletions schema/program.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,17 @@ table SubsegmentOffsets {
offsets: [uint64];
}

// Attributes a name to data referenced by Program.segments. Used when data is
// referenced by multiple users, in cases where indices are not guaranteed to
// be consistent across the 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 +479,11 @@ 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 unique name. Note that multiple
// 'NamedData' entries could point to the same segment index. Stored in
// segments attached to the PTE file.
named_data: [NamedData];
}

root_type Program;

0 comments on commit d295db1

Please sign in to comment.