-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[MLIR] support dynamic indexing of vector.maskedload
in VectorEmulateNarrowTypes
#115070
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5eebcc0
Implement dynamic indexing for MaskedLoads
lialan f3c2d3a
Small update
lialan 94ab287
fix
lialan 21bd52c
Update
hasekawa-takumi 4532a04
Merge branch 'main' into lialan/dynamic_masked_load
lialan d6437e9
update comments
lialan 9e7aedf
fix according to comments
lialan f72ac5c
another update according to comments.
lialan 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
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
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 is not clear from the method name ...
What are
origElements
,scale
andintraDataOffset
?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.
origElements
is the number of elements of the subbyte vectorscale
isbyte-emulated element type size / original element type size
. For example, if the original elem type isi2
, then thescale
issizeof(i8)/sizeof(i2) = 4
.intraDataOffset
is the element offset into the emulated byte. For example, to extract the second slice ofvector<3xi2>
out from avector<3x3xi2>
(here we assume the subbyte type elements are stored in memory packed), we would need to load 2 bytes (the first and second byte), and extract bit[7, 14)
out from it. so the first 3 elements are irrelevant in this case, henceintraDataOffset == 3
in such case.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.
OK, this was not clear to me at all :)
I was trying to understand all of this a bit better and am just thinking that this logic needs TLC. The comment for this method needs updating to capture the info that you shared above. I think that it would also be good to provide more descriptive argument names.
Now, I appreciate that it wasn't you who wrote this to begin with and updating this shouldn't be a blocker for this PR. Some help would be appreciated. Also, I want to help:
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.
Here's my attempt to improve the comments and input variable names:
getCompressedMaskOp
#115663Please let me know whether that makes sense to you, and any feedback is welcome.
Note, I've also created these two:
populateVectorNarrowTypeEmulationPatterns
(1D vs 2D) #115653(again, your feedback would be appreciated). Last, but not least, this example seems off. In particular:
Shouldn't the padded mask be:
%mask = [0, 1, 1, 0, 0, 0, 0]
(7 elements)?Btw, thanks so much for working on this - your efforts are truly appreciated! Please don’t let my comments (and appetite to improve things overall) give you any other impression 😅.
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.
you are right! Here I just exposed some intermediate calculating details to the comment, as in this case
scale == 2
so making the padded mask a multiple ofscale
in the intermediary result is easier.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.
slightly updated the comment part. can you take a look at it again?