-
Notifications
You must be signed in to change notification settings - Fork 12.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
[Sched] Skip MemOp with unknown size when clustering #118443
Conversation
In llvm#83875, we changed the type of `Width` to `LocationSize`. To get the clsuter bytes, we use `LocationSize::getValue()` to calculate the value. But when `Width` is an unknown size `LocationSize`, an assertion "Getting value from an unknown LocationSize!" will be triggered. This patch simply skips MemOp with unknown size to fix this issue and keep the logic the same as before. This issue was found when implementing software pipieliner for RISC-V in llvm#117546. The pipeliner may clone some memory operations with `BeforeOrAfterPointer` size.
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.
LGTM. I assume that this is going to be tested by the following RISCV PR.
Code that will generate unknown size llvm-project/llvm/lib/CodeGen/ModuloSchedule.cpp Lines 962 to 994 in c1ad064
|
@@ -1947,6 +1947,9 @@ void BaseMemOpClusterMutation::collectMemOpRecords( | |||
LocationSize Width = 0; | |||
if (TII->getMemOperandsWithOffsetWidth(MI, BaseOps, Offset, | |||
OffsetIsScalable, Width, TRI)) { | |||
if (!Width.hasValue()) |
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'd somewhat expect this to just collect the unknown width and let the users figure out what to do with it? Would that require widespread changes?
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.
Yeah, I think we need to modify clusterNeighboringMemOps
and other places as well. That can be a future work if you agree.
In llvm#83875, we changed the type of `Width` to `LocationSize`. To get the clsuter bytes, we use `LocationSize::getValue()` to calculate the value. But when `Width` is an unknown size `LocationSize`, an assertion "Getting value from an unknown LocationSize!" will be triggered. This patch simply skips MemOp with unknown size to fix this issue and keep the logic the same as before. This issue was found when implementing software pipeliner for RISC-V in llvm#117546. The pipeliner may clone some memory operations with `BeforeOrAfterPointer` size.
In #83875, we changed the type of
Width
toLocationSize
. To getthe clsuter bytes, we use
LocationSize::getValue()
to calculatethe value.
But when
Width
is an unknown sizeLocationSize
, an assertion"Getting value from an unknown LocationSize!" will be triggered.
This patch simply skips MemOp with unknown size to fix this issue
and keep the logic the same as before.
This issue was found when implementing software pipeliner for
RISC-V in #117546. The pipeliner may clone some memory operations
with
BeforeOrAfterPointer
size.