-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Arith] Merge surjective/non-surjective iter mapping detections #11287
Merged
vinx13
merged 6 commits into
apache:main
from
wrongtest-intellif:simplify_floormod_after_multiply
May 31, 2022
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4c36d01
simplify (x * 96) % 64 to (x * 32) % 64
wrongtest-intellif 8ce069d
adapt merge mulmod opt for OffsetOf computation
wrongtest-intellif e028443
merge DetectIterMap and DetectIterMapPadded
wrongtest-intellif 4344b68
adjust related interfaces for IterMapLevel
wrongtest-intellif 8d46bb5
- check incompatible left paddings
wrongtest-intellif 4d1239a
rebase upstream
wrongtest-intellif 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
- check incompatible left paddings
- determine case like x % 16, x in [0, 5) to be non-surjective, since usages may treat the region extent as 16 by mistake. - skip second round of rewrite when there is no padding - fix some typo in comments
- Loading branch information
commit 8d46bb5a23ded3baa91a6cd3f021247041c1a612
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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 would enable padding for
IterMapLevel::Surjective
, which I don't think is correct. Since padding is any output value for which no input value exists, any introduction of padding wouldn't be surjective.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.
That is the claim~ I try to change padding to iter mark itself.
For example,
(x + 7)
x
in [0, 8) =>IterMark(IterSplit(IterSum({x}, 7), lower_factor=1, extent=16, scale=1), extent=16
with left_pad=7, right_pad=1Then
(x + 7) // 8
is mapped to range [0, extent//2) == [0, 2), though we have padding into iter mark, the IterSplit's range can be achieved when we only iteratex
in it's original domain: (0 + 7) // 8 = 0, (7 + 7) // 8 = 1There 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.
Good point, and that does maintain surjectivity for a single index. I'm not entirely sure for the case of two indices, though. For the same
x ∈ [0,8)
, the indices[(x+7)//8, (x+7)%8]
would have the same paddingleft_pad=7
andright_pad=1
. Even though each individual index can take any value in the output ((x+7)//8 ∈[0,2)
and(x+7)%8 ∈ [0,8)
), there are some coordinate pairs that cannot be generated for any value ofx
(e.g.[0,0]
and[1,7]
).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.
I agree! This is where we should be careful. In
CheckMapping
with surjective mode when padding exists, we checkpadded // LCM
andpadded % LCM
(or it's sub-splits) must not both exists. The case below depict this check:Other kinds of negatives like
(80 + y) // 32, (80 + y) // 4
would be banned by existing checking rule.