Skip to content

Commit 9c3bcd8

Browse files
committed
Revert "Preserve in-place result aliases and lifetimes during memory planning…"
This reverts commit 5ef2767.
1 parent 20a9d8c commit 9c3bcd8

9 files changed

Lines changed: 160 additions & 298 deletions

File tree

‎exir/BUCK‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -168,19 +168,6 @@ fbcode_target(_kind = runtime.python_library,
168168
],
169169
)
170170

171-
fbcode_target(_kind = runtime.python_library,
172-
name = "inplace_aliasing",
173-
srcs = [
174-
"inplace_aliasing.py",
175-
],
176-
deps = [
177-
":error",
178-
":tensor",
179-
"//caffe2:torch",
180-
"//executorch/exir/operator:convert",
181-
],
182-
)
183-
184171
fbcode_target(_kind = runtime.python_library,
185172
name = "memory_planning",
186173
srcs = [
@@ -190,7 +177,6 @@ fbcode_target(_kind = runtime.python_library,
190177
":control_flow",
191178
":delegate",
192179
":error",
193-
":inplace_aliasing",
194180
":memory",
195181
":schema",
196182
":tensor",

‎exir/emit/_emitter.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ def _emit_spec(self, spec: ValueSpec) -> _EmitterValue:
638638
"""Given the provided spec constructs the corresponding EValue from it and then emits it.
639639
640640
If `spec` was already emitted earlier (e.g., because two FX
641-
nodes share the same TensorSpec object — typically because
642-
`alias_inplace_result_specs` aliased an in-place
641+
nodes share the same TensorSpec object — typically because the
642+
planner's `_alias_inplace_result_specs` aliased an in-place
643643
op's result onto its mutated input), reuse the existing
644644
value_id. This keeps the invariant "one TensorSpec ↔ one
645645
Value" so downstream emit doesn't create duplicate Values for
@@ -2093,8 +2093,9 @@ def _is_buffer(node: Node, graph_signature: ExportGraphSignature) -> bool:
20932093

20942094
# Populate spec2id_dict so downstream `_emit_spec` calls (e.g.,
20952095
# for in-place op result FX nodes whose spec was aliased onto
2096-
# this placeholder's spec by `alias_inplace_result_specs`) reuse
2097-
# this placeholder's value_id rather than creating a new Value.
2096+
# this placeholder's spec by the planner's
2097+
# `_alias_inplace_result_specs`) reuse this placeholder's
2098+
# value_id rather than creating a new Value.
20982099
if isinstance(spec, TensorSpec):
20992100
self.emitter_state.spec2id_dict[spec] = value.id
21002101

‎exir/inplace_aliasing.py‎

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)