From 3a74a1f06ce13a1953b530b9066ee1fc3e75b563 Mon Sep 17 00:00:00 2001 From: Varun Puri Date: Tue, 31 Oct 2023 22:17:57 -0700 Subject: [PATCH] Deprecate etrecord.program_buffer (#1042) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/1042 We will no longer serialize the program buffer in ETRecord. Formally deprecating this as well as the portion of the size tool that depends on it. Reviewed By: tarun292 Differential Revision: D50479948 fbshipit-source-id: 3c34ed5b7e7a8d490f543eb41eabb4368e079997 --- sdk/etrecord/_etrecord.py | 6 ------ sdk/size_analysis_tool/size_analysis_tool.py | 6 +----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/sdk/etrecord/_etrecord.py b/sdk/etrecord/_etrecord.py index e24be7ce05..8b9946ce33 100644 --- a/sdk/etrecord/_etrecord.py +++ b/sdk/etrecord/_etrecord.py @@ -26,7 +26,6 @@ class ETRecordReservedFileNames(str, Enum): ETRECORD_IDENTIFIER = "ETRECORD_V0" - PROGRAM_BUFFER = "program_buffer" EDGE_DIALECT_EXPORTED_PROGRAM = "edge_dialect_exported_program" ET_DIALECT_GRAPH_MODULE = "et_dialect_graph_module" DEBUG_HANDLE_MAP_NAME = "debug_handle_map" @@ -37,7 +36,6 @@ class ETRecordReservedFileNames(str, Enum): class ETRecord: edge_dialect_program: Optional[ExportedProgram] = None graph_map: Optional[Dict[str, ExportedProgram]] = None - program_buffer: Optional[bytes] = None _debug_handle_map: Optional[Dict[int, Union[int, List[int]]]] = None _delegate_map: Optional[ Dict[str, Dict[int, Dict[str, Union[str, _DelegateDebugIdentifierMap]]]] @@ -231,7 +229,6 @@ def parse_etrecord(etrecord_path: str) -> ETRecord: graph_map: Dict[str, ExportedProgram] = {} debug_handle_map = None delegate_map = None - program_buffer = None edge_dialect_program = None serialized_exported_program_files = set() @@ -245,8 +242,6 @@ def parse_etrecord(etrecord_path: str) -> ETRecord: delegate_map = json.loads( etrecord_zip.read(ETRecordReservedFileNames.DELEGATE_MAP_NAME) ) - elif entry == ETRecordReservedFileNames.PROGRAM_BUFFER: - program_buffer = etrecord_zip.read(ETRecordReservedFileNames.PROGRAM_BUFFER) elif entry == ETRecordReservedFileNames.ETRECORD_IDENTIFIER: continue elif entry == ETRecordReservedFileNames.EDGE_DIALECT_EXPORTED_PROGRAM: @@ -275,7 +270,6 @@ def parse_etrecord(etrecord_path: str) -> ETRecord: return ETRecord( edge_dialect_program=edge_dialect_program, graph_map=graph_map, - program_buffer=program_buffer, _debug_handle_map=debug_handle_map, _delegate_map=delegate_map, ) diff --git a/sdk/size_analysis_tool/size_analysis_tool.py b/sdk/size_analysis_tool/size_analysis_tool.py index 345a6899b1..228fb922d0 100644 --- a/sdk/size_analysis_tool/size_analysis_tool.py +++ b/sdk/size_analysis_tool/size_analysis_tool.py @@ -168,11 +168,7 @@ def main(): generate_model_size_information( model=exported_program, delegate_deserializers=None, - flatbuffer=( - etrecord.program_buffer - if name == ETRecordReservedFileNames.ET_DIALECT_GRAPH_MODULE - else None - ), + flatbuffer=None, ) for (name, exported_program) in etrecord.graph_map.items() ]