1313
1414import logging
1515import os
16- from typing import final , List , Optional
16+ from typing import cast , final , List , Optional
1717
1818import serializer .tosa_serializer as ts
1919from executorch .backends .arm .arm_vela import vela_compile
3131from executorch .exir .backend .backend_details import BackendDetails , PreprocessResult
3232from executorch .exir .backend .compile_spec_schema import CompileSpec
3333from torch .export .exported_program import ExportedProgram
34+ from torch .fx import Node
3435
3536# TOSA backend debug functionality
3637logger = logging .getLogger (__name__ )
@@ -225,6 +226,7 @@ def preprocess( # noqa: C901
225226 node_visitors = get_node_visitors (edge_program )
226227
227228 for node in graph_module .graph .nodes :
229+ node = cast (Node , node )
228230 if node .op == "call_function" :
229231 process_call_function (node , tosa_graph , node_visitors )
230232 elif node .op == "placeholder" :
@@ -236,9 +238,6 @@ def preprocess( # noqa: C901
236238 # any checking of compatibility.
237239 dbg_fail (node , tosa_graph , artifact_path )
238240
239- # TODO: It would be awesome if this dump could somehow be done on top level and not here.
240- # Problem is that the desc.json has to be created on the tosa_graph object, which we can't
241- # access from top level.
242241 if artifact_path :
243242 tag = _get_first_delegation_tag (graph_module )
244243 dbg_tosa_dump (
@@ -259,6 +258,4 @@ def preprocess( # noqa: C901
259258 else :
260259 raise RuntimeError (f"Unknown format { output_format } " )
261260
262- # Continueing from above. Can I put tosa_graph into this function?
263- # debug_handle_map = ...
264261 return PreprocessResult (processed_bytes = binary )
0 commit comments