-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[MLIR] Define memory effects for memref.prefetch
operation
#151261
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
Changes from 10 commits
7078f7d
3f91e0f
3a7212a
daaabfb
23b37c5
429910e
0c3cdcb
9c410c6
789c474
cc864c7
4b0a756
3af3996
8b8d76b
1fbc305
07c76bf
0f96d60
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 |
---|---|---|
|
@@ -1351,7 +1351,11 @@ def MemRef_PrefetchOp : MemRef_Op<"prefetch"> { | |
instruction cache. | ||
}]; | ||
|
||
let arguments = (ins AnyMemRef:$memref, Variadic<Index>:$indices, | ||
// The memref argument is labeled with a MemWrite side effect to enforce a | ||
// relative ordering of the prefetch and other memory operations targeting | ||
// that memory stream. | ||
let arguments = (ins Arg<AnyMemRef, "prefetch address", [MemWrite]> :$memref, | ||
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. Why do you need to "write to the buffer" semantically here? 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. Good suggestion, will add a comment. It's basically to ensure that dead-code analysis does not remove the operation. It is inline with making that operation a "volatile" so that it remains in place with respect to the other load/store of the prefetched data. 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. It shouldn't be removing the operation if it doesn't declare any side effects at all though, and conservatively assume it has all possible side effects. It feels like there's a bug somewhere 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. @ftynse I believe the source of the problem is that without side-effects defined, the buffer allocation will fail:
So we need to add side effects, and the part about
is only an answer to "why write and not just read". 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. An alternative design here, more SSA-friendly, would be for the op to be side-effect free and return a token to be consumed later by some load operation. |
||
Variadic<Index>:$indices, | ||
BoolAttr:$isWrite, | ||
ConfinedAttr<I32Attr, [IntMinValue<0>, | ||
IntMaxValue<3>]>:$localityHint, | ||
|
Uh oh!
There was an error while loading. Please reload this page.