From ce911a2f1d9cd678fb9fe82a40c86ad0c6772f5a Mon Sep 17 00:00:00 2001 From: Tai Ly Date: Thu, 21 Mar 2024 17:01:14 +0000 Subject: Add conversions of U8 to/from BF16 and FP8 Adds type to PadAttribute and ClampAttribute so their pad_const and max_val/min_val can be deserialized according to type Adds conversion functions of U8 arrays to/from BF16/FP8 values Also, refactor and expose TosaSerializer.convertDataToUint8Vec for converting dtype/data to uint8 list for serialization And modify convertDataToUint8Vec to serialize bf16 values into 2 bytes each, and serialize fp8 values into single bytes each. Signed-off-by: Tai Ly Change-Id: I05659e8187c76d359f1cc9f71c8c23cafd0e877f --- include/attribute.def | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include/attribute.def') diff --git a/include/attribute.def b/include/attribute.def index 723543e..30b432d 100644 --- a/include/attribute.def +++ b/include/attribute.def @@ -52,8 +52,9 @@ DEF_ATTRIBUTE(TransposeConv, 7, bool, S, local_bound, DType, S, acc_type) -DEF_ATTRIBUTE(Pad, 1, - uint8_t, V, pad_const) +DEF_ATTRIBUTE(Pad, 2, + uint8_t, V, pad_const, + DType, S, type) DEF_ATTRIBUTE(Axis, 1, int32_t, S, axis) @@ -64,9 +65,10 @@ DEF_ATTRIBUTE(Resize, 4, int16_t, V, border, ResizeMode, S, mode) -DEF_ATTRIBUTE(Clamp, 2, +DEF_ATTRIBUTE(Clamp, 3, uint8_t, V, min_val, - uint8_t, V, max_val) + uint8_t, V, max_val, + DType, S, type) DEF_ATTRIBUTE(Rescale, 7, int32_t, S, input_zp, -- cgit v1.2.1