Skip to content

[API Proposal]: Add AVX10.2 MoveScalar APIs: VMOVD / VMOVW #113090

Closed

Description

@khushal1996

Background and motivation

This API proposal introduces remaining API surface for AVX10v2 in .NET.
Spec doc - link
Previous Discussion - comment1, comment2, comment3, comment4

AVX10.2 original proposal - link

Image

Image

Image

Image

We will be adding these APIs to existing Avx10v2 API surface

Note: We are not doing the StoreScalar API since it already exists. link

API Proposal

// VMOVD xmm1, xmm2/m32
public static Vector128<uint> MoveScalar(Vector128<uint>)

// VMOVD xmm1, xmm2/m32
public static Vector128<int> MoveScalar(Vector128<int>)

// VMOVW xmm1, xmm2/m16
public static Vector128<ushort> MoveScalar(Vector128<ushort>)

// VMOVW xmm1, xmm2/m16
public static Vector128<short> MoveScalar(Vector128<short>)

// VMOVW xmm1/m16, xmm2
public static unsafe void StoreScalar(Int16* address, Vector128<Int16>)

// VMOVW xmm1/m16, xmm2
public static unsafe void StoreScalar(UInt16* address, Vector128<UInt16>)

API Usage

Vector128<int> v1 = Vector128.Create((int)someParam1);
if (Avx10v2.IsSupported()) {
  Vector128<int> v2 = Avx10v2.MoveScalar(v1);
  // etc
}

Alternative Designs

No response

Risks

No response

Activity

  1. added
    api-suggestion
    on Mar 3, 2025
  2. added
    untriaged
    on Mar 3, 2025
  3. dotnet-policy-service commented on Mar 3, 2025

    @dotnet-policy-service
    Contributor

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

  4. khushal1996 commented on Mar 3, 2025

    @khushal1996
    MemberAuthor

    @tannergooding This proposal covers the remaining APIs for Avx10v2. Can you please review this based on our previous discussion?

    Previous discussion - #109083 (comment)

  5. tannergooding commented on Mar 3, 2025

    @tannergooding
    Member

    LGTM. Could you add the spaces in the proposal, that is change:

    - public static Vector128<uint>MoveScalar(Vector128<uint>)
    + public static Vector128<uint> MoveScalar(Vector128<uint>)

    and do we need to mark the previously approved ConvertToVector128UInt32 APIs as removed here, so that should be included as part of the proposal?

  6. khushal1996 commented on Mar 3, 2025

    @khushal1996
    MemberAuthor

    We have not added ConvertToVector128UInt32 to Avx10v2 API surface. So even though we approved it, because it was under discussion, I left it out of the API surface. So we do not need to include removal of ConvertToVetor128UInt32.

    I will wait for API review.

  7. added
    api-ready-for-review
    and removed
    api-suggestion
    untriaged
    on Mar 3, 2025
  8. khushal1996 commented on Mar 27, 2025

    @khushal1996
    MemberAuthor

    @tannergooding
    For the following instruction
    Image

    Shall we introduce

    StoreScalar(Int16** address, Vector128<Int16>);
    StoreScalar(UInt16* address, Vector128<UInt16>);
    

    ??

    I see we already have the following Stores

    public static unsafe void StoreScalar(int* address, Vector128<int> source)
    public static unsafe void StoreScalar(uint* address, Vector128<uint> source)
    public static unsafe void StoreScalar(long* address, Vector128<long> source)
    public static unsafe void StoreScalar(ulong* address, Vector128<ulong> source)
    public static unsafe void StoreScalar(float* address, Vector128<float> source)
    public static unsafe void StoreScalar(double* address, Vector128<double> source)
    

    But we do not have one for short/ushort. I am not sure why we did not discuss this before. Let me know if we should introduce the remaining 2 APIs as well here.

  9. tannergooding commented on Mar 27, 2025

    @tannergooding
    Member

    Yes, I'd go ahead and add them for consistency. They're not "required" since we can just pattern match the relevant local = MoveScalar(value), but since we already have the other overloads the consistency makes sense.

  10. khushal1996 commented on Mar 27, 2025

    @khushal1996
    MemberAuthor

    Yes, I'd go ahead and add them for consistency. They're not "required" since we can just pattern match the relevant local = MoveScalar(value), but since we already have the other overloads the consistency makes sense.

    Updated the API doc.

  11. bartonjs commented on Apr 1, 2025

    @bartonjs
    Member

    Video

    • Looks good as proposed
    // VMOVD xmm1, xmm2/m32
    public static Vector128<uint> MoveScalar(Vector128<uint> value);
    
    // VMOVD xmm1, xmm2/m32
    public static Vector128<int> MoveScalar(Vector128<int> value);
    
    // VMOVW xmm1, xmm2/m16
    public static Vector128<ushort> MoveScalar(Vector128<ushort> value);
    
    // VMOVW xmm1, xmm2/m16
    public static Vector128<short> MoveScalar(Vector128<short> value);
    
    // VMOVW xmm1/m16, xmm2
    public static unsafe void StoreScalar(Int16* address, Vector128<Int16> source);
    
    // VMOVW xmm1/m16, xmm2
    public static unsafe void StoreScalar(UInt16* address, Vector128<UInt16> source);
  12. added
    api-approved
    and removed
    api-ready-for-review
    on Apr 1, 2025
  13. khushal1996 commented on Apr 14, 2025

    @khushal1996
    MemberAuthor

    LGTM. Could you add the spaces in the proposal, that is change:

    • public static Vector128MoveScalar(Vector128)
    • public static Vector128 MoveScalar(Vector128)
      and do we need to mark the previously approved ConvertToVector128UInt32 APIs as removed here, so that should be included as part of the proposal?

    Hey. I think I made a mistake. I was under the impression that we skipped adding VMOV APIs. I just saw that we have added the following APIs --

    /// <summary>
    ///   <para>  VMOVD xmm1, xmm2/m32</para>
    /// </summary>
    public static Vector128<uint> ConvertToVector128UInt32(Vector128<uint> value)
    
    /// <summary>
    ///   <para>  VMOVW xmm1, xmm2/m16</para>
    /// </summary>
    public static Vector128<ushort> ConvertToVector128UInt16(Vector128<ushort> value)
    

    Can we rename them or we need to add them to their own proposal (for removing them)?

  14. tannergooding commented on Apr 14, 2025

    @tannergooding
    Member

    We'd just remove them, that was part of the discussion and only weren't included in the proposal removal as we thought they hadn't been added yet.

    -- They haven't shipped so removal is still fine at this point.

  15. khushal1996 commented on Apr 14, 2025

    @khushal1996
    MemberAuthor

    We'd just remove them, that was part of the discussion and only weren't included in the proposal removal as we thought they hadn't been added yet.

    -- They haven't shipped so removal is still fine at this point.

    Thank you.

  16. khushal1996 commented on May 7, 2025

    @khushal1996
    MemberAuthor

    Can we close this now? @tannergooding

  17. tannergooding commented on May 7, 2025

    @tannergooding
    Member

    Yep!

  18. locked and limited conversation to collaborators on Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedarea-System.Runtime.Intrinsics

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions