-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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: GetActiveElementCount #102813
ARM64-SVE: GetActiveElementCount #102813
Conversation
Note regarding the
|
Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics |
@dotnet/arm64-contrib @kunalspathak This is ready now |
src/coreclr/jit/hwintrinsicarm64.cpp
Outdated
argType = JITtype2varType(strip(info.compCompHnd->getArgType(sig, arg1, &argClass))); | ||
op1 = impPopStack().val; | ||
|
||
// Op1 and Op2 are masks. Op1 mask handling will be handled via IsExplicitMaskedOperation. |
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.
What cannot we handle op2
handling next to the place where we handle op1
?
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.
that would require an if (id ==NI_Sve_GetActiveElementCount)
in hwintrinsic.cpp. I'm trying to avoid adding any Arm specific code in that file.
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.
currently we have this:
if (HWIntrinsicInfo::IsExplicitMaskedOperation(intrinsic))
{
assert(numArgs > 0);
GenTree* op1 = retNode->AsHWIntrinsic()->Op(1);
if (intrinsic == NI_Sve_ConditionalSelect)
{
if (op1->IsVectorAllBitsSet() || op1->IsMaskAllBitsSet())
{
return retNode->AsHWIntrinsic()->Op(2);
}
else if (op1->IsVectorZero())
{
return retNode->AsHWIntrinsic()->Op(3);
}
}
if (!varTypeIsMask(op1))
{
// Op1 input is a vector. HWInstrinsic requires a mask.
retNode->AsHWIntrinsic()->Op(1) = gtNewSimdConvertVectorToMaskNode(retType, op1, simdBaseJitType, simdSize);
}
}
we can have varTypeIsMask(op2)
after the op1
, right?
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.
Yes, but would still require a NI_Sve_GetActiveElementCount
check, as we don't want to convert for other nodes.
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.
hhm, are there many intrinsic that will have op2
as mask? we can add assert or something to make sure that it is NI_Sve_GetActiveElementCount
.
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've simplified this handling. There's now just a small extra bit in IsExplicitMaskedOperation()
Change-Id: I58b8fadda15e096b0e63ffe0f88225057ff362d6
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
/ba-g build errors are timeout |
Also added some Helper functions to get random data for a mask element. These can eventually be used in existing templates.