Skip to content

Commit 54feeef

Browse files
add uint16 to serialization
Differential Revision: D65915213 Pull Request resolved: #6942
1 parent 1de96f8 commit 54feeef

File tree

6 files changed

+31
-4
lines changed

6 files changed

+31
-4
lines changed

devtools/bundled_program/schema/scalar_type.fbs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ enum ScalarType : byte {
1818
FLOAT = 6,
1919
DOUBLE = 7,
2020
BOOL = 11,
21-
// TODO(jakeszwe): Verify these are unused and then remove support
2221
QINT8 = 12,
2322
QUINT8 = 13,
2423
QINT32 = 14,
2524
QUINT4X2 = 16,
2625
QUINT2X4 = 17,
2726
BITS16 = 22,
27+
FLOAT8E5M2 = 23,
28+
FLOAT8E4M3FN = 24,
29+
FLOAT8E5M2FNUZ = 25,
30+
FLOAT8E4M3FNUZ = 26,
31+
UINT16 = 27,
32+
UINT32 = 28,
33+
UINT64 = 29,
2834
// Types currently not implemented.
2935
// COMPLEXHALF = 8,
3036
// COMPLEXFLOAT = 9,

devtools/etdump/etdump_flatcc.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ executorch_flatbuffer_ScalarType_enum_t get_flatbuffer_scalar_type(
5757
return executorch_flatbuffer_ScalarType_BOOL;
5858
case exec_aten::ScalarType::Bits16:
5959
return executorch_flatbuffer_ScalarType_BITS16;
60+
case exec_aten::ScalarType::UInt16:
61+
return executorch_flatbuffer_ScalarType_UINT16;
6062
default:
6163
ET_CHECK_MSG(
6264
0,

devtools/etdump/scalar_type.fbs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ enum ScalarType : byte {
1818
FLOAT = 6,
1919
DOUBLE = 7,
2020
BOOL = 11,
21-
// TODO(jakeszwe): Verify these are unused and then remove support
2221
QINT8 = 12,
2322
QUINT8 = 13,
2423
QINT32 = 14,
2524
QUINT4X2 = 16,
2625
QUINT2X4 = 17,
2726
BITS16 = 22,
27+
FLOAT8E5M2 = 23,
28+
FLOAT8E4M3FN = 24,
29+
FLOAT8E5M2FNUZ = 25,
30+
FLOAT8E4M3FNUZ = 26,
31+
UINT16 = 27,
32+
UINT32 = 28,
33+
UINT64 = 29,
2834
// Types currently not implemented.
2935
// COMPLEXHALF = 8,
3036
// COMPLEXFLOAT = 9,

exir/scalar_type.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,10 @@ class ScalarType(IntEnum):
2929
QUINT4x2 = 16
3030
QUINT2x4 = 17
3131
BITS16 = 22
32+
FLOAT8E5M2 = 23
33+
FLOAT8E4M3FN = 24
34+
FLOAT8E5M2FNUZ = 25
35+
FLOAT8E4M3FNUZ = 26
36+
UINT16 = 27
37+
UINT32 = 28
38+
UINT64 = 29

exir/tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def memory_format_enum(memory_format: torch.memory_format) -> int:
262262
torch.qint32: ScalarType.QINT32,
263263
torch.bfloat16: ScalarType.BFLOAT16,
264264
torch.quint4x2: ScalarType.QUINT4x2,
265-
torch.uint16: ScalarType.BITS16,
265+
torch.uint16: ScalarType.UINT16,
266266
}
267267

268268

schema/scalar_type.fbs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ enum ScalarType : byte {
1818
FLOAT = 6,
1919
DOUBLE = 7,
2020
BOOL = 11,
21-
// TODO(jakeszwe): Verify these are unused and then remove support
2221
QINT8 = 12,
2322
QUINT8 = 13,
2423
QINT32 = 14,
2524
QUINT4X2 = 16,
2625
QUINT2X4 = 17,
2726
BITS16 = 22,
27+
FLOAT8E5M2 = 23,
28+
FLOAT8E4M3FN = 24,
29+
FLOAT8E5M2FNUZ = 25,
30+
FLOAT8E4M3FNUZ = 26,
31+
UINT16 = 27,
32+
UINT32 = 28,
33+
UINT64 = 29,
2834
// Types currently not implemented.
2935
// COMPLEXHALF = 8,
3036
// COMPLEXFLOAT = 9,

0 commit comments

Comments
 (0)