-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Arm64/Sve: Rewrite how ConditionalSelect wraps the embedded mask operations #104248
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
@dotnet/arm64-contrib |
@dotnet/arm64-contrib |
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.
Test template changes LGTM, assuming SVE tests still pass. Thanks!
src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs
Show resolved
Hide resolved
src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs
Show resolved
Hide resolved
src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs
Show resolved
Hide resolved
src/tests/Common/GenerateHWIntrinsicTests/GenerateHWIntrinsicTests_Arm.cs
Show resolved
Hide resolved
It does. Here are the results. |
For APIs does not take mask as 1st parameter, but generates only predicated instructions like Abs, we wrap it in
CndSel(AllTrue, Operation(), Zero)
. If user however, writes a code explicitly usingCndSel
operation, we would skip wrapping it, because we were already in that form. However, this caused issues when such embedded mask operation was used inmergeValue
operation, something likeCndSel(mask, trueValue, Operation())
.To solve this, now we will wrap the operation, regardless of if it is inside
CndSel
or not. For example,CndSel(mask, Operation(), mergeValue)
=>CndSel(mask, CndSel(AllTrue, Operation(), Zero) mergeValue)
CndSel(mask, trueValue, Operation())
=>CndSel(mask, trueValue, CndSel(AllTrue, Operation(), Zero))
One of these forms will then get handled in new lowering method to handle
CndSel
nodes in general to do the right operation.As part of this, I have updated all the test templates to pass
Operation()
formergeValue
.TODO:
Add validation forEdit: For now, will add this as a separate pass.CndSel(mask, Operation(), Operation())
All tests are passing. Results here.
Thanks to @tannergooding for spending time with me for coming up with the design.