Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions thunder/core/update_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,6 @@ def _involves_viewed_args(bsym, viewed):
return any(isinstance(p, TensorProxy) and variableify(p) in viewed for p in bsym.flat_proxy_args)


def _add_output_to_setitem(trace: Trace) -> Trace:
def helper(bsym):
if bsym.sym is not setitem_:
return bsym
sym = bsym.sym
new_bsym = sym.bind(
*bsym.args,
**bsym.kwargs,
output=bsym.subsymbols[1].output,
subsymbols=bsym.subsymbols,
_call_ctx=bsym._call_ctx,
)
return new_bsym

new_symbols = [helper(bound_symbol) for bound_symbol in trace.bound_symbols]
trace.bound_symbols = new_symbols
return trace


def replace_args_with_alias_map(
computation_trace: Trace,
alias_tensor_indices: list[list[int]],
Expand Down Expand Up @@ -140,7 +121,6 @@ def insert_alias_updates(computation_trace: Trace, alias_tensor_indices: list[li
# First pass: identify inputs which are views of each other and swap them out with a default,
# reshaping if necessary.
computation_trace, _ = replace_args_with_alias_map(computation_trace, alias_tensor_indices)
computation_trace = _add_output_to_setitem(computation_trace)

# Second pass: identify views, their originals, and operands involved in inplace ops
view_groups = []
Expand Down
Loading