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: Use SIMD to copy nongc gaps in blocks with gc pointers #99140

Merged
merged 3 commits into from
Mar 1, 2024

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Mar 1, 2024

struct MyStruct
{
    long a;
    long b;
    long c;
    long d;
    string a1;
    long e;
    long f;
    long j;
    long k;
}

MyStruct Test(MyStruct ms) => ms;

Codegen diff for Test on arm64:

; Assembly listing for method Prog:Test(Prog+MyStruct):Prog+MyStruct:this
            stp     fp, lr, [sp, #-0x10]!
            mov     fp, sp
            mov     x14, x8
            mov     x13, x1
            bl      CORINFO_HELP_ASSIGN_BYREF
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
+           ldp     q16, q17, [x13], #0x20
+           stp     q16, q17, [x14], #0x20
+           ldp     q16, q17, [x13], #0x20
+           stp     q16, q17, [x14], #0x20
            ldp     fp, lr, [sp], #0x10
            ret     lr

x64 in the same code path uses rep movsq (it can't use SIMD due to atomicity guarantees)

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 1, 2024
@ghost ghost assigned EgorBo Mar 1, 2024
@ghost
Copy link

ghost commented Mar 1, 2024

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

Issue Details
struct MyStruct
{
    long a;
    long b;
    long c;
    long d;
    string a1;
    long e;
    long f;
    long j;
    long k;
}

MyStruct Test(MyStruct ms) => ms;

Codegen diff for Test on arm64:

; Assembly listing for method Prog:Test(Prog+MyStruct):Prog+MyStruct:this
            stp     fp, lr, [sp, #-0x10]!
            mov     fp, sp
            mov     x14, x8
            mov     x13, x1
            bl      CORINFO_HELP_ASSIGN_BYREF
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
-           ldp     x12, x15, [x13], #0x10
-           stp     x12, x15, [x14], #0x10
+           ldp     q16, q17, [x13], #0x20
+           stp     q16, q17, [x14], #0x20
+           ldp     q16, q17, [x13], #0x20
+           stp     q16, q17, [x14], #0x20
            ldp     fp, lr, [sp], #0x10
            ret     lr
; Total bytes of code 60
Author: EgorBo
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@EgorBo
Copy link
Member Author

EgorBo commented Mar 1, 2024

@dotnet/jit-contrib PTAL, simple change, diffs.

@EgorBo EgorBo marked this pull request as ready for review March 1, 2024 09:07
@EgorBo EgorBo requested a review from kunalspathak March 1, 2024 17:38
@EgorBo
Copy link
Member Author

EgorBo commented Mar 1, 2024

@kunalspathak @TIHan please take a look

@EgorBo EgorBo requested a review from TIHan March 1, 2024 17:39
Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

This seems to be always there on xarch and was just not present on arm64. LGTM. Thanks!

@EgorBo EgorBo merged commit a604763 into dotnet:main Mar 1, 2024
129 checks passed
@EgorBo EgorBo deleted the faster-nongc-copy branch March 4, 2024 17:13
EgorBo added a commit to EgorBo/runtime-1 that referenced this pull request Mar 22, 2024
github-actions bot pushed a commit that referenced this pull request Mar 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 4, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants