Repository navigation
Remove mk_unique_var in untyped_passes.py
#8266
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
Merged
sklam
merged 6 commits into
numba:main
from
guilhermeleobas:guilhermeleobas/remove_mk_unique_var_untyped_passes
Aug 22, 2022
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
06b9ef0
Remove `mk_unique_var` in `untyped_passes.py`
guilhermeleobas 78f73df
Fix CI failure
guilhermeleobas 5c627af
Fix another bug
guilhermeleobas ad2879a
another attempt to fix ci issue
guilhermeleobas a11fe01
flake8
guilhermeleobas c6a2506
replace scope.redefine by scope.define
guilhermeleobas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This needs a careful look. Previously,
mk_unique_varwould return a unique identifier, whereasscope.redefinemight just return the original identifier if it is the first time defining it.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.
@guilhermeleobas which tests are failing due to this?
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.
Change this line to
And run the tests
python -m runtests numba.tests.test_mixed_tuple_unroller.TestMixedTupleUnroll.test_08There 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.
Thanks for the example, I think I understand what's happening. The
switch_iris some IR containing the switch table to jump to a type specific loop body version, it initially won't contain any of the variables present in the loop blocks scheduled for versioning. This part of the code is essentially wiring these versioned blocks into the switch table, which means the switch table need to "know" about the loops' variables as they are now in scope. Occasionally there are collisions, like in the case above, whereby the switch table happens to have the same name for a constant as a versioned loop body and the proposed change works around this.I think another way to "fix" it would be to version the inlined variable names with the branch version from which they were derived, e.g.
which might be a strategy worth employing as it makes it easier to track the origin of the variable.
Either way, I think the proposed code change is correct.