Skip to content

Conversation

@a74nh
Copy link
Contributor

@a74nh a74nh commented Nov 15, 2023

Many of the files touched here are autogenerated via InstructionSetDesc.txt.

@ghost ghost added community-contribution Indicates that the PR has been added by a community member area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI new-api-needs-documentation labels Nov 15, 2023
@ghost
Copy link

ghost commented Nov 15, 2023

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.

@ghost
Copy link

ghost commented Nov 15, 2023

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Many of the files touched here are autogenerated via InstructionSetDesc.txt.

Author: a74nh
Assignees: -
Labels:

area-CodeGen-coreclr, new-api-needs-documentation, community-contribution

Milestone: -

@a74nh
Copy link
Contributor Author

a74nh commented Nov 15, 2023

Currently includes all of @kunalspathak's #94529. I don't think it's possible to directly base a pull request on top of another pull request. All of my code starts from ceccafa

Not sure if the Arm64_Sve parts are required or if it should only be Sve. I think we want the readytorun/crossgen changes too (but it should be disabled for them?)

When running the included test, it fails with the following error:

Assert failure(PID 2048593 [0x001f4251], Thread: 2048593 [0x1f4251]): Assertion failed 'insOptsNone(id->idInsOpt())' in 'JIT.HardwareIntrinsics.Arm._AdvSimd.SveTest__SveTest:unzip(System.Numerics.Vector`1[int],System.Numerics.Vector`1[int]):System.Numerics.Vector`1[int]:this' during 'Generate code' (IL size 8; hash 0x0bc0f608; Tier0)

    File: /home/alahay01/dotnet/runtime_sve/src/coreclr/jit/emitarm64.cpp Line: 948
    Image: /home/alahay01/dotnet/runtime_sve/artifacts/tests/coreclr/linux.arm64.Checked/Tests/Core_Root/corerun

This is because id->idInsOpt() is set to INS_OPTS_4S. That is set in genHWIntrinsic(). I think we need to add a new flag HW_Category_SIMDVariable to do special handling.

This PR already touches quite a few files, so I was thinking any further codegen changes would go in a separate PR.

@tannergooding @BruceForstall @TamarChristinaArm

@a74nh
Copy link
Contributor Author

a74nh commented Nov 15, 2023

Count16BitElements() currently generates to MRS because we're missing all the codegen parts for the CNTH and MRS is a fairly safe instruction to use for now.

I had to do some changes to allow for API functions that don't use any vector registers. Happy to pull this part out of the PR into a new one.

@kunalspathak
Copy link
Contributor

Many of the files touched here are autogenerated via InstructionSetDesc.txt.

IMO, lets have a separate PR for these changes and that way, this PR will just be adding the UnzipEven() and Count16BitElements().

@a74nh
Copy link
Contributor Author

a74nh commented Nov 15, 2023

Many of the files touched here are autogenerated via InstructionSetDesc.txt.

IMO, lets have a separate PR for these changes and that way, this PR will just be adding the UnzipEven() and Count16BitElements().

Done - #94791

Copy link
Contributor

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

Hopefully we can start getting some of the "base" PRs merged soon so we'll only be looking at incremental diffs...

break;

case INS_sve_uzp1:
// TODO: This could also be SVE_BR_3B or SVE_CI_3A
Copy link
Contributor

Choose a reason for hiding this comment

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

We should standardize on TODO-SVE: for marking all SVE-related "to-do" work items.

@kunalspathak
Copy link
Contributor

Hopefully we can start getting some of the "base" PRs merged soon so we'll only be looking at incremental diffs...

I agree. I think we should definitely get in #94791 (for InstructionSet related changes). I am under the impression that in order to merge other example PRs like this one or #94529, we need to have register support, so we can validate the encoding. On the contrary, we could start merging the instructions in (probably commented code or some different way) and once register allocation changes are done and we have a tool to validate encoding, we can enable those instructions. Thoughts?

@a74nh
Copy link
Contributor Author

a74nh commented Nov 16, 2023

Empty API code is here: #94791
Count16BitElements() is here: #94845

I'll reduce this PR down to just UnzipEven()

@BruceForstall
Copy link
Contributor

Thoughts?

I wonder how many regalloc changes we really need to be able to make progress, assuming we don't need to generate predicate registers. Presumably we'd still use Vn registers, and they're encoded just like Zn registers. (Maybe the predicate register encoding could always assume predicate register zero, say, or use a Vn register temporarily instead of a new Pg register.)

@kunalspathak
Copy link
Contributor

I wonder how many regalloc changes we really need to be able to make progress, assuming we don't need to generate predicate registers. Presumably we'd still use Vn registers, and they're encoded just like Zn registers.

Yes, for now, the easier change to do is add Zn register so the code gets disassembled properly and then reuse one of the vector register for P0 predicate register.

return "VectorT128";
case InstructionSet_Rcpc2 :
return "Rcpc2";
case InstructionSet_Sve :
Copy link
Contributor

@TamarChristinaArm TamarChristinaArm Nov 17, 2023

Choose a reason for hiding this comment

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

Curious, why are there two instruction sets here? For the other ones it was because of AArch32, but there's no AArch32 SVE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AIUI, we need both to matching the existing structure. All the functions will be in Sve and Sve.Arm64 will be empty.


public sealed unsafe class SveTest__SveTest
{
public bool IsSupported => AdvSimd.IsSupported;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public bool IsSupported => AdvSimd.IsSupported;
public bool IsSupported => Sve.IsSupported;

?

@a74nh
Copy link
Contributor Author

a74nh commented Nov 24, 2023

This has been replaced by
#94845 and #95021

@a74nh a74nh closed this Nov 24, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants