File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1717 ConstraintsGenPass ,
1818 get_aligned_offset ,
1919 MemoryPlanningAlgo ,
20+ MemoryPlanningAlgoFailure ,
2021 MemoryPlanningState ,
2122)
2223from executorch .backends .cadence .aot .utils import MemoryConfig
@@ -90,7 +91,7 @@ def plan(
9091 ):
9192 self .plan_spec (spec , state )
9293 if not state .is_placed (spec ):
93- raise MemoryError (f"Cannot fit { spec } in any memory hierarchy" )
94+ raise MemoryPlanningAlgoFailure (f"Cannot fit { spec } { spec . allocated_memory = } in any memory hierarchy for { self . memory_config } " )
9495
9596 return state
9697
@@ -162,7 +163,7 @@ def plan(
162163 ):
163164 self .plan_spec (spec , state )
164165 if not state .is_placed (spec ):
165- raise MemoryError (f"Cannot fit { spec } in any memory hierarchy" )
166+ raise MemoryPlanningAlgoFailure (f"Cannot fit { spec } in any memory hierarchy for { self . memory_config } " )
166167
167168 logging .debug (
168169 f"greedy by size for offset calculation with hierarchy returns bufsizes: { state .bufsizes } "
Original file line number Diff line number Diff line change 1818from executorch .exir .tensor import TensorSpec
1919from torch .export .exported_program import ExportGraphSignature
2020
21+ class MemoryPlanningAlgoFailure (Exception ):
22+ pass
23+
2124
2225def get_aligned_offset (pre_aligned_offset : int , alignment : int ) -> int :
2326 return int (math .ceil (pre_aligned_offset / alignment ) * alignment )
You can’t perform that action at this time.
0 commit comments