Skip to content

Conversation

@CarolineConcatto
Copy link
Contributor

This patch adds new intrinsics and types for supporting SVE2.1. This patch depends on Pull-Request#217
(#217),
because some intrinsic in this specification are also in Pull-Request#217.

Depends on: #217


name: Pull request
about: Technical issues, document format problems, bugs in scripts or feature proposal.


Thank you for submitting a pull request!

If this PR is about a bugfix:

Please use the bugfix label and make sure to go through the checklist below.

If this PR is about a proposal:

We are looking forward to evaluate your proposal, and if possible to
make it part of the Arm C Language Extension (ACLE) specifications.

We would like to encourage you reading through the contribution
guidelines
, in particular the section on submitting
a proposal
.

Please use the proposal label.

As for any pull request, please make sure to go through the below
checklist.

Checklist: (mark with X those which apply)

  • If an issue reporting the bug exists, I have mentioned it in the
    PR (do not bother creating the issue if all you want to do is
    fixing the bug yourself).
  • I have added/updated the SPDX-FileCopyrightText lines on top
    of any file I have edited. Format is SPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}>
    (Please update existing copyright lines if applicable. You can
    specify year ranges with hyphen , as in 2017-2019, and use
    commas to separate gaps, as in 2018-2020, 2022).
  • I have updated the Copyright section of the sources of the
    specification I have edited (this will show up in the text
    rendered in the PDF and other output format supported). The
    format is the same described in the previous item.
  • I have run the CI scripts (if applicable, as they might be
    tricky to set up on non-*nix machines). The sequence can be
    found in the contribution
    guidelines
    . Don't
    worry if you cannot run these scripts on your machine, your
    patch will be automatically checked in the Actions of the pull
    request.
  • I have added an item that describes the changes I have
    introduced in this PR in the section Changes for next
    release
    of the section Change Control/Document history
    of the document. Create Changes for next release if it does
    not exist. Notice that changes that are not modifying the
    content and rendering of the specifications (both HTML and PDF)
    do not need to be listed.
  • [ X] When modifying content and/or its rendering, I have checked the
    correctness of the result in the PDF output (please refer to the
    instructions on how to build the PDFs
    locally
    ).
  • [ X] The variable draftversion is set to true in the YAML header
    of the sources of the specifications I have modified.
  • Please DO NOT add my GitHub profile to the list of contributors
    in the README page of the project.

Copy link
Contributor

@rsandifo-arm rsandifo-arm left a comment

Choose a reason for hiding this comment

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

Some comments below, but LGTM otherwise. Once the SME2 stuff is in, I think we should consolidate the intrinsics that are common between SME2 and SVE2p1, rather than duplicating them. I agree the current form makes sense until then though.

main/acle.md Outdated
// _u64base_u8, _u64base_u16, _u64base_s16, _u64base_u32, _u64base_s32,
// _u64base _u64, _u64base_s64
// _u64base_bf16, _u64base_f16, _u64base_f32, _u64base_f64
svint8_t svld1q_gather[_u64base_s8](svbool_t pg, svint64_t zn, const void *rm);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should provide the same addressing modes as for LDNT1 gather:

  • svld1q_gather[_u64base]_xx(svbool_t pg, svuint64_t zn) (note svuint64_t rather than svint64_t)
  • svld1q_gather[_u64base]_offset_xx(svbool_t pg, svuint64_t zn, int64_t offset)
  • svld1q_gather[_u64base]_index_xx(svbool_t pg, svuint64_t zn, int64_t index)
  • svld1q_gather_[u64]offset[_xx](svbool_t pg, const xx_t *base, svuint64_t offset)
  • svld1q_gather_[u64]index[_xx](svbool_t pg, const xx_t *base, svuint64_t index) for 16-bit, 32-bit and 64-bit xx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I imagine we should do the same for the ST1Q scatter quadrword, correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, same thing there.

main/acle.md Outdated
// Variants are also available for:
// _s8 _u16, _s16, _u32, _s32, _u64, _s64
// _bf16, _f16, _f32, _f64
void svst2q[_u8](svbool_t pg, uint8_t *rn, svuint8x2_t zt);

Choose a reason for hiding this comment

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

@CarolineConcatto Is there a reason why the pointers for the structured quad-word stores use uint8_t *, instead of the int8_t * for the svld2q, etc?

Copy link
Contributor

Choose a reason for hiding this comment

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

The type is meant to vary with the suffix, so it's uint8_t * for the [_u8] function shown, and would be int8_t * for the [_s8] version.

Choose a reason for hiding this comment

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

Doh! Of course, silly me. :)

main/acle.md Outdated

#### LD1Q

Gather Load Quadword.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is only an unscaled variant of this instruction, so maybe don't have both offset and index?

Copy link
Contributor

Choose a reason for hiding this comment

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

For the other SVE load and store intrinsics, we tried to provide a consistent interface and set of addressing modes. So the deciding factor wasn't so much whether the call mapped to a single instruction, but whether the underlying instruction could easily emulate the mode. “Single instruction” is a bit of nebulous concept anyway for loads and stores, since a single C address expression might need several operations to compute.

Since scaling is just a shift left, I think it's worth providing both index and offset variants.

main/acle.md Outdated

#### ST1Q

Scatter store quadwords.
Copy link
Contributor

Choose a reason for hiding this comment

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

There is only an unscaled version of this instruction? So maybe don't have both index and offset?

main/acle.md Outdated

// Variants are also available for:
// _s8, _u16, _s16, _u32, _s32, _u64, _s64
svuint8_t svpmov_lane_u8_z(svbool_t pn);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

s/ svuint8_t svpmov_lane_u8_z(svbool_t pn);/ svuint8_t svpmov_u8_z(svbool_t pn);/

Copy link

@ThomasBamelis ThomasBamelis left a comment

Choose a reason for hiding this comment

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

With the increased use of x4 vectors in 2.1, would it be the right time to introduce svreinterpret variants for x4 types as well?
With data rearranging, load/storing and element wise bit manipulation changing element size can come in quite handy.

main/acle.md Outdated
// _s8, _s16, _u16, _s32, _u32, _s64, _u64
// _bf16, _f16, _f32, _f64
svuint8_t svextq_lane[_u8](svuint8_t zdn, svuint8_t zm, uint64_t imm);
svuint8_t svextq[_u8](svuint8_t zdn, svuint8_t zm, uint64_t imm);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we dropping the _lane part here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Richard pointed out that the other ext do not have lane in it.

// Variants are also available for:
// _s8, _s16, _u16, _s32, _u32, _s64, _u64
// _bf16, _f16, _f32, _f64
svuint8_t svextq_lane[_u8](svuint8_t zdn, svuint8_t zm, uint64_t imm);
Member
@rsandifo-arm rsandifo-arm 3 weeks ago
I'm not sure these should be lane intrinsics. The instructions are really a form of permutation. (FWIW, the corresponding non-Q intrinsics don't have the _lane suffix.)

Copy link
Contributor

Choose a reason for hiding this comment

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

OK.

@Lukacma
Copy link
Contributor

Lukacma commented Feb 19, 2024

Hello @CarolineConcatto,

You have forgotten DUPQ instruction for sve2p1 . Prototype will look like this :

   // Variants are also available for:
   // _s8, _u16, _s16, _u32, _s32, _u64, _s64
   // _bf16, _f16, _f32, _f64
   svuint8_t svdup_laneq[_u8](svuint8_t zn, uint64_t imm_idx);

This is different to svdupq_lane intrinsic and they have different behaviour

@CarolineConcatto
Copy link
Contributor Author

I merged SVE2.1 and SME2 intrinsics to 1 section. But I am not sure that is the best.

This patch adds new intrinsics and types for supporting SVE2.1.
Copy link
Contributor

@rsandifo-arm rsandifo-arm left a comment

Choose a reason for hiding this comment

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

This version seems to add the shared SVE2.1/SME intrinsics back into the SME section (with __arm_streaming attributes). Is that deliberate?

I think we should only document each intrinsic once, as in the previous version. It's just that the relationship between streaming/non-streaming/streaming-compatible and SME/SME2/SVE2/SVE2.1 can't be expressed directly using attributes (and so needs to be specified in words instead).

@CarolineConcatto
Copy link
Contributor Author

_This version seems to add the shared SVE2.1/SME intrinsics back into the SME section (with _arm_streaming attributes). Is that deliberate?

No, they should not be in the SME section with streaming attribute.
I had to split the patch in two. All the tests in GitHub were failing.
So I created a patch to add all the SVE2.1 intrinsics an another to remove the ones that already exist in SME2.

  • ab72e2b (HEAD -> sve2.1) Address review comments
  • e9e3450 (origin/sve2.1) Remove from SME2 intriniscs that are common with SVE2.1
  • 16f9477 Add alpha support for SVE2.1

Copy link
Contributor

@rsandifo-arm rsandifo-arm left a comment

Choose a reason for hiding this comment

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

LGTM apart from the typo below.

main/acle.md Outdated
non-zero or __ARM_FEATURE_SME2 are non-zero.
For convenience, these the intrinsics for these instructions are listed in
the following section.
For convenience, the intrinsics fo these instructions are listed in the
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
For convenience, the intrinsics fo these instructions are listed in the
For convenience, the intrinsics for these instructions are listed in the

@rsandifo-arm rsandifo-arm merged commit f947de6 into ARM-software:main Apr 12, 2024
Copy link
Contributor

@sallyarmneale sallyarmneale left a comment

Choose a reason for hiding this comment

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

One very minor comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.