Skip to content
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: Implement AbsoluteCompare* and Compare* APIs #104464

Merged
merged 10 commits into from
Jul 5, 2024

Conversation

kunalspathak
Copy link
Member

@kunalspathak kunalspathak commented Jul 5, 2024

  • AbsoluteCompareGreaterThan
  • AbsoluteCompareGreaterThanOrEqual
  • AbsoluteCompareLessThan
  • AbsoluteCompareLessThanOrEqual
  • CompareEqual
  • CompareGreaterThan
  • CompareGreaterThanOrEqual
  • CompareLessThan
  • CompareLessThanOrEqual
  • CompareNotEqualTo
  • CompareUnordered

Some changes are from @mikabl-arm contributions in #102611.

All stress tests are passing.

Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@kunalspathak
Copy link
Member Author

@dotnet/arm64-contrib

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
See info in area-owners.md if you want to be subscribed.

@@ -1981,30 +1981,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree, int* pDstCou
getLowVectorOperandAndCandidates(intrin, &lowVectorOperandNum, &lowVectorCandidates);
}

if ((intrin.id == NI_Sve_ConditionalSelect) && (intrin.op2->IsEmbMaskOp()) &&
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was dead code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks like we handle embedded masks just above this snippet, right here.

Copy link
Member

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

}

[method: MethodImpl(MethodImplOptions.AggressiveInlining)]
private void ConditionalSelectScenario_TrueValue({Op1VectorType}<{Op1BaseType}> mask, {Op1VectorType}<{Op1BaseType}> op1, {Op1VectorType}<{Op1BaseType}> op2, {Op1VectorType}<{Op1BaseType}> falseOp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of cases in this template where the second operand uses Op1BaseType instead of Op2BaseType. This shouldn't cause any problems for now, since the APIs you're adding use operands of the same type. Should we fix this before checking the new template in, or should we wait to fix this once we add new APIs with different operand types (like what we've been doing for the last few)? I'm fine with either approach.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, perhaps it needs a audit for similar templates, so will probably do this on need basis.

@kunalspathak kunalspathak marked this pull request as ready for review July 5, 2024 16:47
@amanasifkhalid
Copy link
Member

Test changes LGTM, too.

@kunalspathak kunalspathak merged commit 5505150 into dotnet:main Jul 5, 2024
163 of 167 checks passed
@kunalspathak kunalspathak deleted the AbsoluteCompare branch July 5, 2024 22:13
Comment on lines +1336 to +1339
if (HWIntrinsicInfo::ReturnsPerElementMask(node->GetHWIntrinsicId()))
{
nodeType = TYP_MASK;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be node->TypeGet() 100% of the time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, will change it in follow-up PRs.

@@ -2059,7 +2036,7 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree, int* pDstCou
{
SingleTypeRegSet candidates = lowVectorOperandNum == 2 ? lowVectorCandidates : RBM_NONE;

if (intrin.op2->gtType == TYP_MASK)
if (intrin.op2->OperIsHWIntrinsic(NI_Sve_ConvertVectorToMask))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this change the register set to MASK but regular TYP_MASK nodes do not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its the same reason I mentioned in #102611 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants