-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[AMD] re-enable canonicalize pointers pass #5329
base: main
Are you sure you want to change the base?
[AMD] re-enable canonicalize pointers pass #5329
Conversation
9390a46
to
bc6ba64
Compare
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.
It's looking nice! I left few comments in the code, and a general one is that I think we need to add few test cases.
Value tensorPtr = createTensorPointer(fatPtr, curLoc); | ||
auto newForOp = | ||
replaceForOpWithNewSignature(rewriter, forOp, {basePtr, offset}); | ||
size_t operandNum = curOperand->getOperandNumber(); |
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.
Could we have this into a function? Like rewriteForOpInPlace
?
operandNum + 1 - forOp.getNumControlOperands(); | ||
|
||
SmallVector<Value> newInitArgs( | ||
forOp.getInitArgs().take_front(numLeadingInitsIncludingCurOp)); |
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 remove the currentOp. It was there before exactly because we were pushing back the new operands. We can now get rid of it (and make the IR way simpler).
|
||
newForOp.getBody()->insertArgument(numLeadingInitsIncludingCurOp + 1, | ||
offset.getType(), offset.getLoc()); | ||
newForOp.getBody()->insertArgument(numLeadingInitsIncludingCurOp + 1, |
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.
Shouldn't be numLeadingInitsIncludingCurOp + 2
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.
No because you insert offset and then base behind it
rewriteOpMap[forOp] = newForOp; | ||
|
||
newForOp->setOperand(operandNum, tensorPtr); | ||
{ |
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.
Basically, if you remove the current operand from the the loop arguments, you won't need this anymore. This will be removed by canonicalization anyway, but it's here only because we have to pass "something" as the current operand.
Value tensorPtr = createTensorPointer(fatPtr, curLoc); | ||
newForOp->setOperand(operandNum, tensorPtr); | ||
} | ||
|
||
OpOperand *forOperand = &newForOp->getOpOperand(operandNum); | ||
// This is making sure we propagate the visit from the forOp result |
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.
Stale comment tbr
cca951b
to
2ca0a71
Compare
2ca0a71
to
ce211fd
Compare
d1f4d6a
to
e4b27bd
Compare
1773949
to
5091eef
Compare
32d4271
to
9ed96db
Compare
f308df9
to
1b44114
Compare
1b6bd72
to
05c6fc1
Compare
05c6fc1
to
55c3dd2
Compare
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.
As a warmup comment, could you add a test to check the issue we were having? Something on the line of:
for (%ptrA,%ptrB){
yield %ptrB, %ptrA
}
Disabled here #4966 (comment). Will explain soon.