-
Notifications
You must be signed in to change notification settings - Fork 745
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
[SYCL][Matrix] Extend W/A for more corner cases of AccessChain usage #16370
base: sycl
Are you sure you want to change the base?
Conversation
068c6f3
to
63eb10c
Compare
63eb10c
to
44db814
Compare
The new corner case is: AccessChain is used on arrays of Joint Matrices and in loops
44db814
to
57dbccd
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.
lgtm given this is high priority with the condition someone more familiar with the pass will review it before it gets into the oneAPI release, just some nits
if (StopOnGEP && isa<GetElementPtrInst>(GEP)) | ||
return V; | ||
V = GEP->getPointerOperand(); | ||
} else if (Operator::getOpcode(V) == Instruction::BitCast) { |
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.
can we not use dyn_cast
here?
if (Value *RV = Call->getReturnedArgOperand()) { | ||
V = RV; |
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 for sret
right? should we assert it's a pointer?
if (auto *Call = dyn_cast<CallBase>(V)) { | ||
if (Value *RV = Call->getReturnedArgOperand()) { | ||
V = RV; | ||
continue; |
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.
can you add a comment explaining this continue
?
if (!WrapperMatrixTy) | ||
return nullptr; | ||
TargetExtType *MatrixTy = | ||
dyn_cast<TargetExtType>(WrapperMatrixTy->getElementType(0)); |
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.
nit: we could use dyn_cast_or_null
to get rid of the if
right above
if (!MatrixTy) | ||
return nullptr; | ||
StringRef Name = MatrixTy->getName(); | ||
if (Name != MATRIX_TYPE) |
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.
nit: can we move the getName()
call into the if
since we never use the Name
variable again and IMO its clear whats going on?
// __spirv_AccessChain | ||
// First we check if the argument came from a GEP instruction | ||
GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>( | ||
stripPointerCastsAndOffsets(CI->getArgOperand(0), true)); |
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.
nit: can we add an inline comment explaining what the true
is, like /*StopOnGEPs=*/true
} | ||
|
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.
nit: remove newline
The new corner case is: AccessChain is used on arrays of Joint Matrices
Fix for CMPLRLLVM-64465