From c53436e4933c50c7465712590778ca283e8c07c5 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Tue, 19 Mar 2024 13:55:38 -0700 Subject: Revert "[serialization_lib] Add support for FP8E4M3 and FP8E5M2" This reverts commit a029f1f02707f40f6990df53fd4f56684490d58f. This commit was not meant to be included in the 0.90 branch. Change-Id: I5b252f2603a7554efab2b997faaf2b59d62ee3cd --- include/tosa_generated.h | 16 +++++----------- python/serializer/tosa_serializer.py | 18 +++--------------- python/tosa/DType.py | 2 -- schema/tosa.fbs | 2 -- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/include/tosa_generated.h b/include/tosa_generated.h index b5a8bd5..2ecd35a 100644 --- a/include/tosa_generated.h +++ b/include/tosa_generated.h @@ -116,13 +116,11 @@ enum DType : uint32_t { DType_FP16 = 10, DType_BF16 = 11, DType_SHAPE = 12, - DType_FP8E4M3 = 13, - DType_FP8E5M2 = 14, DType_MIN = DType_UNKNOWN, - DType_MAX = DType_FP8E5M2 + DType_MAX = DType_SHAPE }; -inline const DType (&EnumValuesDType())[15] { +inline const DType (&EnumValuesDType())[13] { static const DType values[] = { DType_UNKNOWN, DType_BOOL, @@ -136,15 +134,13 @@ inline const DType (&EnumValuesDType())[15] { DType_UINT16, DType_FP16, DType_BF16, - DType_SHAPE, - DType_FP8E4M3, - DType_FP8E5M2 + DType_SHAPE }; return values; } inline const char * const *EnumNamesDType() { - static const char * const names[16] = { + static const char * const names[14] = { "UNKNOWN", "BOOL", "UINT8", @@ -158,15 +154,13 @@ inline const char * const *EnumNamesDType() { "FP16", "BF16", "SHAPE", - "FP8E4M3", - "FP8E5M2", nullptr }; return names; } inline const char *EnumNameDType(DType e) { - if (::flatbuffers::IsOutRange(e, DType_UNKNOWN, DType_FP8E5M2)) return ""; + if (::flatbuffers::IsOutRange(e, DType_UNKNOWN, DType_SHAPE)) return ""; const size_t index = static_cast(e); return EnumNamesDType()[index]; } diff --git a/python/serializer/tosa_serializer.py b/python/serializer/tosa_serializer.py index 1aadbff..c44b225 100644 --- a/python/serializer/tosa_serializer.py +++ b/python/serializer/tosa_serializer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2024, ARM Limited. +# Copyright (c) 2020-2023, ARM Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -63,8 +63,6 @@ DTypeNames = [ "FP16", "BF16", "SHAPE", - "FP8E4M3", - "FP8E5M2", ] ByteMask = np.uint64(0xFF) @@ -427,12 +425,7 @@ class TosaSerializerTensor: self.shape = shape self.dtype = dtype - if ( - dtype == DType.FP32 - or dtype == DType.BF16 - or dtype == DType.FP8E4M3 - or dtype == DType.FP8E5M2 - ): + if dtype == DType.FP32 or dtype == DType.BF16: fntype = np.float32 elif dtype == DType.FP16: fntype = np.float16 @@ -532,12 +525,7 @@ class TosaSerializerTensor: elif self.dtype == DType.FP16: np_arr = np.array(self.data, dtype=np.float16) u8_data.extend(np_arr.view(np.uint8)) - elif ( - self.dtype == DType.FP32 - or self.dtype == DType.BF16 - or self.dtype == DType.FP8E4M3 - or self.dtype == DType.FP8E5M2 - ): + elif self.dtype == DType.FP32 or self.dtype == DType.BF16: # for val in self.data: # b = struct.pack("!f", val) # u8_data.extend([b[3], b[2], b[1], b[0]]) diff --git a/python/tosa/DType.py b/python/tosa/DType.py index e585cb9..6df2dcb 100644 --- a/python/tosa/DType.py +++ b/python/tosa/DType.py @@ -16,5 +16,3 @@ class DType(object): FP16 = 10 BF16 = 11 SHAPE = 12 - FP8E4M3 = 13 - FP8E5M2 = 14 diff --git a/schema/tosa.fbs b/schema/tosa.fbs index 1c2a85e..171818d 100644 --- a/schema/tosa.fbs +++ b/schema/tosa.fbs @@ -37,8 +37,6 @@ enum DType:uint32 { FP16, BF16, SHAPE, - FP8E4M3, - FP8E5M2, } enum ResizeMode:uint32 { -- cgit v1.2.1