Skip to content

Commit 7adffe6

Browse files
authored
Fix mutable buffer tagging in ExecuTorch (#11990)
This PR is intended to address #11542. A mutable buffer is tagged for consumption by the delegate, but the graph_signature.output_spec keeps the mutable buffer there because it is not in the state_dict (persistent=false), but instead inside of constants.
1 parent e9e5255 commit 7adffe6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

exir/lowered_backend_module.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,10 @@ def _get_new_signature( # noqa: C901
599599

600600
if any(
601601
orig_output_spec.kind == OutputKind.BUFFER_MUTATION
602-
and orig_output_spec.target in new_state_dict
602+
and (
603+
orig_output_spec.target in new_state_dict
604+
or orig_output_spec.target in new_constants
605+
)
603606
for orig_output_spec in orig_output_specs
604607
):
605608
# If the delegate wants to consume the buffer, then the
@@ -612,7 +615,10 @@ def _get_new_signature( # noqa: C901
612615
orig_output_spec
613616
for orig_output_spec in orig_output_specs
614617
if orig_output_spec.kind == OutputKind.BUFFER_MUTATION
615-
and orig_output_spec.target in new_state_dict
618+
and (
619+
orig_output_spec.target in new_state_dict
620+
or orig_output_spec.target in new_constants
621+
)
616622
][0]
617623

618624
assert len(orig_output_specs) == 1, (

0 commit comments

Comments
 (0)