@@ -16,8 +16,8 @@ file_extension "pte";
16
16
// Table that contains the metadata about how
17
17
// to unflatten the flattened input/output from compiler
18
18
table ContainerMetadata {
19
- encoded_inp_str:string;
20
- encoded_out_str:string;
19
+ encoded_inp_str: string;
20
+ encoded_out_str: string;
21
21
}
22
22
23
23
table Null {}
@@ -27,7 +27,7 @@ table Null {}
27
27
// This refers to where the buffer needs to be placed in an existing
28
28
// memory and at what offset from its base address.
29
29
table AllocationDetails {
30
- memory_id:uint; // ID of the memory where this data needs to be placed.
30
+ memory_id: uint; // ID of the memory where this data needs to be placed.
31
31
32
32
// Offset in bytes relative to the start of the memory area indicated by
33
33
// memory_id.
@@ -36,8 +36,8 @@ table AllocationDetails {
36
36
// larger models. To preserve backwards compatibility, the high bits are
37
37
// managed in a separate 32-bit field. Users should combine the two fields
38
38
// to get the full 64-bit offset.
39
- memory_offset_low:uint; // Least significant 32 bits
40
- memory_offset_high:uint; // Most significant 32 bits. Defaults to zero.
39
+ memory_offset_low: uint; // Least significant 32 bits
40
+ memory_offset_high: uint; // Most significant 32 bits. Defaults to zero.
41
41
}
42
42
43
43
// Indicates the types of shape a Tensor may have, from the point
@@ -61,21 +61,21 @@ table ExtraTensorInfo {
61
61
// program.mutable_data_segments that specifies where the data is located in.
62
62
// If not present and the data is located in a segment, then the data is in
63
63
// the first index.
64
- mutable_data_segments_idx:uint64;
64
+ mutable_data_segments_idx: uint64;
65
65
66
66
// [Optional] The unique name of the tensor. e.g. 'mod.linear.weight'
67
- fully_qualified_name:string;
67
+ fully_qualified_name: string;
68
68
}
69
69
70
70
table Tensor {
71
- scalar_type:ScalarType;
71
+ scalar_type: ScalarType;
72
72
73
73
// Offset in scalar_type elements (e.g., multiples of 4 bytes for an int
74
74
// scalar type) from the beginning of the tensor buffer to the beginning of
75
75
// the actual data. Currently, the runtime only supports a value of zero.
76
- storage_offset:int;
76
+ storage_offset: int;
77
77
78
- sizes:[int];
78
+ sizes: [int];
79
79
80
80
// Specifies in what order the dimensions are laid out in memory (from outer
81
81
// to inner).
@@ -88,10 +88,10 @@ table Tensor {
88
88
// - (0, 2, 1) represents a [row, batch, column] ordering where "column" is
89
89
// the innermost dimension, then comes "batch", and the outermost dimension
90
90
// is "row".
91
- dim_order:[ubyte];
91
+ dim_order: [ubyte];
92
92
93
93
// out of scope M1
94
- requires_grad:bool;
94
+ requires_grad: bool;
95
95
96
96
// Overall, a Tensor is either constant or mutable. At method load time
97
97
// constant tensors receive a dataptr into the serialized program. Mutable
@@ -117,13 +117,13 @@ table Tensor {
117
117
// in program.mutable_data_segments[0] otherwise if tensor_info is non-null
118
118
// then the mutable_data_segment index is specified by
119
119
// tensor_info.mutable_data_segments_index.
120
- data_buffer_idx:uint;
120
+ data_buffer_idx: uint;
121
121
122
122
// [Optional] preallocation details for non-constants (null otherwise).
123
- allocation_info:AllocationDetails;
123
+ allocation_info: AllocationDetails;
124
124
125
125
// May not be needed.
126
- layout:byte;
126
+ layout: byte;
127
127
128
128
// Determines the type of the tensor's shape, from the point of view of its
129
129
// dynamic or not behavior, and consequently how the allocation of the
@@ -137,52 +137,52 @@ table Tensor {
137
137
//
138
138
// 3. dynamism == DYNAMIC_UNBOUND: the stored sizes field can be ignored since
139
139
// shape is fully dynamic.
140
- shape_dynamism:TensorShapeDynamism;
140
+ shape_dynamism: TensorShapeDynamism;
141
141
142
142
// [Optional] Additional information about the Tensor that is not applicable
143
143
// to most tensors.
144
- extra_tensor_info:ExtraTensorInfo;
144
+ extra_tensor_info: ExtraTensorInfo;
145
145
}
146
146
147
147
table Int {
148
- int_val:long;
148
+ int_val: long;
149
149
}
150
150
151
151
table Bool {
152
- bool_val:bool;
152
+ bool_val: bool;
153
153
}
154
154
155
155
table Double {
156
- double_val:double;
156
+ double_val: double;
157
157
}
158
158
159
159
table String {
160
- string_val:string;
160
+ string_val: string;
161
161
}
162
162
163
163
table IntList {
164
- items:[long];
164
+ items: [long];
165
165
}
166
166
167
167
table DoubleList {
168
- items:[double];
168
+ items: [double];
169
169
}
170
170
171
171
table BoolList {
172
- items:[bool];
172
+ items: [bool];
173
173
}
174
174
175
175
// Unlike primitive lists, tensor lists have mutable members and aliasing behavior when
176
176
// elements are added to them. To match this aliasing behavior, the runtime tensor list is
177
177
// serialized by serializing its elements into the ExecutionPlan.values array, and then
178
178
// serializing their corresponding indices into TensorList.items.
179
179
table TensorList {
180
- items:[int]; // EValue indices.
180
+ items: [int]; // EValue indices.
181
181
}
182
182
183
183
// Similar to TensorList except the indices can also point to None.
184
184
table OptionalTensorList {
185
- items:[int];
185
+ items: [int];
186
186
}
187
187
188
188
// Supported values in Executorch kernels, Enums are serialized as ints.
@@ -202,30 +202,30 @@ union KernelTypes {
202
202
203
203
// Abstraction for program values. A subset of types supported in core pytorch kernels.
204
204
table EValue {
205
- val:KernelTypes;
205
+ val: KernelTypes;
206
206
}
207
207
208
208
table Operator {
209
209
// Operator registry and lookup is uniquely identified by its name, and overload name.
210
210
// TODO(larryliu): is there a more efficient way to represent this
211
- name:string;
212
- overload:string;
211
+ name: string;
212
+ overload: string;
213
213
}
214
214
215
215
table KernelCall {
216
216
// Index to the operators table in the program.
217
- op_index:int;
217
+ op_index: int;
218
218
219
219
// Indexes to the (values) required by the operation (in and out).
220
- args:[int];
220
+ args: [int];
221
221
}
222
222
223
223
table DelegateCall {
224
224
// Index to the delegates table in the program.
225
- delegate_index:int;
225
+ delegate_index: int;
226
226
227
227
// Indexes to the (values) required by the delegates (in and out).
228
- args:[int];
228
+ args: [int];
229
229
}
230
230
231
231
table MoveCall {
@@ -259,20 +259,20 @@ union InstructionArguments {
259
259
260
260
// Basic unit of execution
261
261
table Instruction {
262
- instr_args:InstructionArguments;
262
+ instr_args: InstructionArguments;
263
263
}
264
264
265
265
table Frame {
266
266
// For storing the frame to print stacktraces
267
- filename:string; // Name of the file in which the instruction exists
268
- lineno:int; // Line number at which the instruction was called
269
- name:string; // Name of the function the instruction was called from
270
- context:string; // Source code of the instruction
267
+ filename: string; // Name of the file in which the instruction exists
268
+ lineno: int; // Line number at which the instruction was called
269
+ name: string; // Name of the function the instruction was called from
270
+ context: string; // Source code of the instruction
271
271
}
272
272
273
273
table FrameList {
274
274
// For storing the frames to print stacktraces
275
- items:[Frame];
275
+ items: [Frame];
276
276
}
277
277
278
278
// Indicates where a piece of data is stored.
@@ -322,17 +322,17 @@ table BackendDelegate {
322
322
// seperate chains.
323
323
table Chain {
324
324
// Indices of the values that are (non-static) inputs into this Chain.
325
- inputs:[int];
325
+ inputs: [int];
326
326
327
327
// Indices of the values that are outputs out of this Chain.
328
- outputs:[int];
328
+ outputs: [int];
329
329
330
330
// List of instructions to be executed in order.
331
- instructions:[Instruction];
331
+ instructions: [Instruction];
332
332
333
333
// Optional list of frames for each instruction.
334
334
// The backend config must have 'emit_stacktrace' set to true to emit
335
- stacktrace:[FrameList];
335
+ stacktrace: [FrameList];
336
336
}
337
337
338
338
table ExecutionPlan {
@@ -344,22 +344,22 @@ table ExecutionPlan {
344
344
container_meta_type: ContainerMetadata;
345
345
346
346
// A list of all values used in this execution plan.
347
- values:[EValue];
347
+ values: [EValue];
348
348
349
349
// Indices to the 'Evalues' that are inputs to this execution plan.
350
350
// This list contains only the non-constant tensors (i.e. not part of
351
351
// the saved program).
352
- inputs:[int];
352
+ inputs: [int];
353
353
354
354
// Indices to the 'Evalues' that are outputs of this execution plan.
355
355
// This signals a lifespan that goes beyond the execution.
356
- outputs:[int];
356
+ outputs: [int];
357
357
358
358
// List of Chains of kernels.
359
- chains:[Chain];
359
+ chains: [Chain];
360
360
361
361
// Operators used in this execution plan
362
- operators:[Operator];
362
+ operators: [Operator];
363
363
364
364
// A list of delegates and each is a special instance of execution, the same level of chains.
365
365
delegates: [BackendDelegate];
@@ -379,7 +379,7 @@ table Buffer {
379
379
// During serialization, this alignment may be rewritten to a larger value.
380
380
// The magic "@executorch-tensor-alignment" comment tells EXIR which lines to
381
381
// patch.
382
- storage:[ubyte] (force_align: 16); // @executorch-tensor-alignment
382
+ storage: [ubyte] (force_align: 16); // @executorch-tensor-alignment
383
383
}
384
384
385
385
// Delegate data stored directly in the flatbuffer. This is a different type
@@ -419,31 +419,31 @@ table SubsegmentOffsets {
419
419
420
420
table Program {
421
421
// Schema version.
422
- version:uint;
422
+ version: uint;
423
423
424
424
// List of ExecutionPlans that make up the program. Each ExecutionPlan corresponds with a
425
425
// different entry point into the model.
426
- execution_plan:[ExecutionPlan];
426
+ execution_plan: [ExecutionPlan];
427
427
428
428
// Tables of constant data, used for constant Values (e.g.data field of weight tensors).
429
429
// Each constant is assigned an index into the table which are each individually aligned.
430
430
// 0 index is reserved to be pointed to by non-constant Tensors.
431
431
// If this field is non-empty, constant_segment.offsets must be empty.
432
432
// DEPRECATED: After D61996249 on 2024-09-05, no new PTE files will use this field.
433
- constant_buffer:[Buffer];
433
+ constant_buffer: [Buffer];
434
434
435
435
// List of delegate data. Pointed to by BackendDelegateDataReference.
436
- backend_delegate_data:[BackendDelegateInlineData];
436
+ backend_delegate_data: [BackendDelegateInlineData];
437
437
438
438
// List of data segments that follow the Program data in this file, sorted by
439
439
// offset. Elements in this schema can refer to these segments by index.
440
- segments:[DataSegment];
440
+ segments: [DataSegment];
441
441
442
442
// Describes the offsets of each constant tensor, relative to the segment
443
443
// offset. If constant_segment.offsets field is non-empty, constant_buffer
444
444
// must be empty. constant_segment.offsets[0] is reserved to be pointed to by
445
445
// non-constant Tensors.
446
- constant_segment:SubsegmentOffsets;
446
+ constant_segment: SubsegmentOffsets;
447
447
448
448
// [Optional] Describes the offsets into various segments for each mutable
449
449
// tensor. Only mutable tensors with a meaningful initial state are
@@ -453,7 +453,7 @@ table Program {
453
453
// into the mutable tensor, as opposed to loading the .pte data into
454
454
// constant memory, copying it over, and then being unable to release the
455
455
// constant segment. No two elements should point to the same segment.
456
- mutable_data_segments:[SubsegmentOffsets];
456
+ mutable_data_segments: [SubsegmentOffsets];
457
457
}
458
458
459
459
root_type Program;
0 commit comments