Skip to content

Commit c11ba1b

Browse files
Cortex-M backend: Ensure no get_attr nodes appear after lowering (#18538)
Adds an additional run of the lift_constant_tensor_pass after all passes in CortexMPassManager has been run, previously the serializer would complain in some cases with ETRecords enabled, see #18422 Signed-off-by: Adrian Lundell <adrian.lundell@arm.com>
1 parent c7f1d72 commit c11ba1b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backends/cortex_m/passes/cortex_m_pass_manager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818
from executorch.exir.pass_base import ExportPass
1919
from executorch.exir.pass_manager import PassManager
20-
from executorch.exir.program._program import _transform
20+
from executorch.exir.program._program import _transform, lift_constant_tensor_pass
2121
from torch.export import ExportedProgram
2222
from torch.fx.passes.infra.pass_base import PassResult
2323

@@ -81,4 +81,8 @@ def transform(self) -> ExportedProgram:
8181
transform_pass = pass_cls()
8282
pass_callable = cast(Callable[[Module], PassResult], transform_pass)
8383
ep = _transform(ep, pass_callable)
84+
85+
# All constant tensors should be lifted to buffers at this point, re-run
86+
# lift_constant_tensor_pass in case new ones have been introduced by the passes above.
87+
ep = lift_constant_tensor_pass(ep)
8488
return ep

0 commit comments

Comments
 (0)