-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][linalg] set inbounds on xfer_read/writes
for assumeDynamicDimsMatchVecSizes
#160839
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 all commits
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 | ||||
---|---|---|---|---|---|---|
|
@@ -524,6 +524,23 @@ VectorizationState::maskOperation(RewriterBase &rewriter, Operation *opToMask, | |||||
|
||||||
if (!mask) { | ||||||
LDBG() << "No mask required"; | ||||||
if (assumeDynamicDimsMatchVecSizes) { | ||||||
LDBG() << "Assuming dynamic dimensions match vector sizes!"; | ||||||
// Set inbounds to all-true. | ||||||
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. This comment tells me what is happening, but that's also what the code says :) Could you instead clarify why we need this extra step? I would also update the Basically,
Suggested change
|
||||||
llvm::TypeSwitch<Operation *>(opToMask) | ||||||
.Case<vector::TransferReadOp, vector::TransferWriteOp>( | ||||||
[&](auto xferOp) { | ||||||
SmallVector<bool> inBoundsMap(xferOp.getInBounds().size(), | ||||||
true); | ||||||
Comment on lines
+533
to
+534
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. Note, 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. Oh, completely missed that 🥲 Thanks! |
||||||
rewriter.modifyOpInPlace(xferOp, [&]() { | ||||||
xferOp.setInBoundsAttr( | ||||||
rewriter.getBoolArrayAttr(inBoundsMap)); | ||||||
}); | ||||||
}) | ||||||
.Default([](Operation *op) { | ||||||
// No-op if the operation is not an xfer read or write. | ||||||
}); | ||||||
} | ||||||
return opToMask; | ||||||
} | ||||||
|
||||||
|
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 would move this inside the lambda. Otherwise it will be printed for every Op, which could be noise, no?