Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT REVIEW] refactor to remove use of TensorProxy.numel #1451

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 3 additions & 5 deletions thunder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,15 +576,13 @@ def get_computation_and_inputs(*args, **kwargs):
arg_to_idx[a] = i

tensor_indices: int = []
tensor_args_consumed_by_inplace_grouped_by_numel: dict[int, list[TensorProxy]] = defaultdict(list)
for bsym in filter(lambda b: b.sym.id == prims.PrimIDs.COPY_, computation_trc.bound_symbols):
t = bsym.flat_proxy_args[1]
index = arg_to_idx[t]
numel = t.numel
tensor_args_consumed_by_inplace_grouped_by_numel[numel].append(index)
tensor_indices.append(index)
if len(tensor_args_consumed_by_inplace_grouped_by_numel) > 1:
vanilla_tensor_args = set(tensor_indices)
tmp_vanilla_tensor_args = set(tensor_indices)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments please! This file is getting hard to read

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh sorry, this is just a smoke test. I should have added a do not review on the title first. 🙇

if len(tmp_vanilla_tensor_args) > 1:
vanilla_tensor_args = tmp_vanilla_tensor_args

if epilogue_trc is not None:
epilogue_traces = [epilogue_trc]
Expand Down
Loading