Skip to content

RFC: Java layer EValue serialization #6569

@kirklandsign

Description

@kirklandsign

🚀 The feature, motivation and pitch

Context: #6470 (comment)

We need to design a way to serialize an EValue (and its embedding tensor), for some IPC use case in AOSP.

This won’t be the official serialization across ET. ET uses fbs for serialization. This is only for the Java frameworks layer for AOSP.

Basic layout

Tag (1 byte)
Bytes_of_payload (8 bytes?)
<
<
<
<
<
<
<
Payload (var)

Where payload can be one of them

None (0 byte): No value or absence of a value.
Tensor (var): A multi-dimensional array used for numerical computations.
String/uint8_array (var): A sequence of characters, often used to represent text.
Double (8): A 64-bit floating-point number, used for decimal arithmetic.
Int (4 or 8?): A 32-bit integer, used for whole numbers.
Bool (1): A boolean value, either true or false.
ListBool (var): A list of boolean values.
ListDouble (var): A list of double-precision floating-point numbers.
ListInt (var): A list of integers.
ListTensor (var): A list of tensors.
ListScalar (var): A list of scalar values (e.g., numbers).
ListOptionalTensor (var): A list of optional tensors, where each element may be present or absent.

Per Jacob, we don’t care about List types (6-11). They are internal to ET runtime.

For those without variant length (0, 3, 4, 5), we just serialize the value directly.

For 2 String, let’s assume that it’s uint8_t[]. We just serialize the array directly.

So we will focus on the tensor type.

Tensor type

Scalar_type (1 byte)
Num_dim (1)
Sizes (var)

Dim_order (var)

Data (var)




Questions

Do we really need a field for Bytes_of_payload?
Do we need Dim order?
Do we need TensorShapeDynamism?

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions