Skip to content

Commit 4eb0602

Browse files
Olivia-liufacebook-github-bot
authored andcommitted
Add ScalarType 22 BITS16 support in etdump gen and deserialization
Summary: Add support in etdump gen and etdump parsing for ScalarType 22 `BITS16`. Note: fbcode/executorch/schema/scalar_type.fbs and fbcode/executorch/devtools/etdump/scalar_type.fbs are copies of each other for historical reasons. Differential Revision: D64812253
1 parent 8f9fb7e commit 4eb0602

File tree

5 files changed

+6
-2
lines changed

5 files changed

+6
-2
lines changed

devtools/etdump/etdump_flatcc.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ executorch_flatbuffer_ScalarType_enum_t get_flatbuffer_scalar_type(
5555
return executorch_flatbuffer_ScalarType_DOUBLE;
5656
case exec_aten::ScalarType::Bool:
5757
return executorch_flatbuffer_ScalarType_BOOL;
58+
case exec_aten::ScalarType::Bits16:
59+
return executorch_flatbuffer_ScalarType_BITS16;
5860
default:
5961
ET_CHECK_MSG(
6062
0,

devtools/etdump/scalar_type.fbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ enum ScalarType : byte {
2929
// COMPLEXFLOAT = 9,
3030
// COMPLEXDOUBLE = 10,
3131
// BFLOAT16 = 15,
32+
BITS16 = 22,
3233
}

exir/scalar_type.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ class ScalarType(IntEnum):
2626
BFLOAT16 = 15
2727
QUINT4x2 = 16
2828
QUINT2x4 = 17
29-
Bits16 = 22
29+
BITS16 = 22

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.BITS16,
266266
}
267267

268268

schema/scalar_type.fbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ enum ScalarType : byte {
2929
// COMPLEXFLOAT = 9,
3030
// COMPLEXDOUBLE = 10,
3131
// BFLOAT16 = 15,
32+
BITS16 = 22,
3233
}

0 commit comments

Comments
 (0)