-
Notifications
You must be signed in to change notification settings - Fork 108
Remove unnecessary repetition of update_aliases
#2772
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
929ed00
86adceb
92663e5
c5d914d
ff06df3
3954b51
d765875
cc595a1
a0fbd45
2f6609c
3d46b2f
4cee1ad
61a125e
912adbd
ed75fe1
3627ee6
ff3bdb2
cf62b36
1f01b01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -817,10 +817,15 @@ def map_redundant(x: Any) -> Any: | |
| new_symbols = [new_bsyms.get(bsym, bsym) for bsym in trace.bound_symbols] | ||
| cse_trace.bound_symbols = list(filterfalse(lambda a: a is None, new_symbols)) | ||
|
|
||
| return_bsym = cse_trace.bound_symbols[-1] | ||
| assert return_bsym.sym.id == prims.PrimIDs.RETURN | ||
| return_bsym = None | ||
| for idx, bsym in enumerate(cse_trace.bound_symbols): | ||
| if bsym.sym.id == prims.PrimIDs.RETURN: | ||
| return_bsym = cse_trace.bound_symbols.pop(idx) | ||
| break | ||
| assert return_bsym is not None | ||
|
Comment on lines
821
to
828
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked at the code changes first before looking at the discussion and this was very alarming to me. Could you add a TODO comment about this being removed?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I appreciate that kind of feedback. Yes, it's a rough solution indeed... |
||
|
|
||
| trace_output = tree_map(map_redundant, return_bsym.args) | ||
| cse_trace.bound_symbols[-1] = prims.python_return.bind(*trace_output, output=None) | ||
| cse_trace.bound_symbols.append(prims.python_return.bind(*trace_output, output=None)) | ||
|
|
||
| end_time_ns = time.perf_counter_ns() | ||
| elapsed_time_ns = end_time_ns - start_time_ns | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qq: wouldn't this call g.intersect len(view_groups) times?