Content-Length: 341070 | pFad | https://github.com/dotnet/runtime/pull/87052

08 [wasm] Add PackedSimd load and load scalar methods by radekdoulik · Pull Request #87052 · dotnet/runtime · GitHub
Skip to content

[wasm] Add PackedSimd load and load scalar methods #87052

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

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

radekdoulik
Copy link
Member

No description provided.

@ghost
Copy link

ghost commented Jun 2, 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 ghost assigned radekdoulik Jun 2, 2023
@radekdoulik radekdoulik requested a review from lewing June 2, 2023 11:49
@ghost
Copy link

ghost commented Jun 2, 2023

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

Issue Details

null

Author: radekdoulik
Assignees: -
Labels:

area-System.Runtime.Intrinsics, new-api-needs-documentation

Milestone: -

@radekdoulik
Copy link
Member Author

Test methods:

    unsafe static void TestLoad()
    {
        var mem = GetByteArray(32);
        for (int i = 0; i < 16; i++) {
            fixed(byte* ptr = &mem[i]) {
                var v = PackedSimd.LoadVector128(ptr);
                System.Console.WriteLine($"load v: {v}");
            }
        }
    }

    unsafe static void TestLoadScalar()
    {
        var uintmem = GetUIntArray(32);
        for (int i = 1; i < 17; i++) {
            fixed(uint* ptr = &uintmem[i]) {
                var v = PackedSimd.LoadScalarVector128(ptr);
                System.Console.WriteLine($"load v: {v}");
            }
        }
        var int64mem = GetInt64Array(32);
        for (int i = 1; i < 17; i++) {
            fixed(Int64* ptr = &int64mem[i]) {
                var v = PackedSimd.LoadScalarVector128(ptr);
                System.Console.WriteLine($"load v: {v}");
            }
        }
        var floatmem = GetFloatArray(32);
        for (int i = 1; i < 17; i++) {
            fixed(float* ptr = &floatmem[i]) {
                var v = PackedSimd.LoadScalarVector128(ptr);
                System.Console.WriteLine($"load v: {v}");
            }
        }
        var doublemem = GetDoubleArray(32);
        for (int i = 1; i < 17; i++) {
            fixed(double* ptr = &doublemem[i]) {
                var v = PackedSimd.LoadScalarVector128(ptr);
                System.Console.WriteLine($"load v: {v}");
            }
        }
    }

output:

  load v: <0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15>
  load v: <1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16>
  load v: <2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17>
  load v: <3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18>
  load v: <4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19>
  load v: <5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20>
  load v: <6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21>
  load v: <7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22>
  load v: <8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23>
  load v: <9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24>
  load v: <10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25>
  load v: <11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26>
  load v: <12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27>
  load v: <13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28>
  load v: <14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29>
  load v: <15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30>
  load v: <1, 0, 0, 0>
  load v: <2, 0, 0, 0>
  load v: <3, 0, 0, 0>
  load v: <4, 0, 0, 0>
  load v: <5, 0, 0, 0>
  load v: <6, 0, 0, 0>
  load v: <7, 0, 0, 0>
  load v: <8, 0, 0, 0>
  load v: <9, 0, 0, 0>
  load v: <10, 0, 0, 0>
  load v: <11, 0, 0, 0>
  load v: <12, 0, 0, 0>
  load v: <13, 0, 0, 0>
  load v: <14, 0, 0, 0>
  load v: <15, 0, 0, 0>
  load v: <16, 0, 0, 0>
  load v: <1, 0>
  load v: <2, 0>
  load v: <3, 0>
  load v: <4, 0>
  load v: <5, 0>
  load v: <6, 0>
  load v: <7, 0>
  load v: <8, 0>
  load v: <9, 0>
  load v: <10, 0>
  load v: <11, 0>
  load v: <12, 0>
  load v: <13, 0>
  load v: <14, 0>
  load v: <15, 0>
  load v: <16, 0>
  load v: <1.4321, 0, 0, 0>
  load v: <2.4321, 0, 0, 0>
  load v: <3.4321, 0, 0, 0>
  load v: <4.4321, 0, 0, 0>
  load v: <5.4321, 0, 0, 0>
  load v: <6.4321, 0, 0, 0>
  load v: <7.4321, 0, 0, 0>
  load v: <8.4321, 0, 0, 0>
  load v: <9.4321, 0, 0, 0>
  load v: <10.4321, 0, 0, 0>
  load v: <11.4321, 0, 0, 0>
  load v: <12.4321, 0, 0, 0>
  load v: <13.4321, 0, 0, 0>
  load v: <14.4321, 0, 0, 0>
  load v: <15.4321, 0, 0, 0>
  load v: <16.4321, 0, 0, 0>
  load v: <1.4321098765, 0>
  load v: <2.4321098765, 0>
  load v: <3.4321098765, 0>
  load v: <4.4321098765, 0>
  load v: <5.4321098765, 0>
  load v: <6.4321098765, 0>
  load v: <7.4321098765, 0>
  load v: <8.4321098765, 0>
  load v: <9.4321098765, 0>
  load v: <10.4321098765, 0>
  load v: <11.4321098765, 0>
  load v: <12.4321098765, 0>
  load v: <13.4321098765, 0>
  load v: <14.4321098765, 0>
  load v: <15.4321098765, 0>
  load v: <16.4321098765, 0>

emitted code check:

> wa-info -d -f TestLoad src/mono/sample/wasm/console-node/bin/Release/AppBundle/dotnet.native.wasm|grep 'v128.load'
        v128.load    [SIMD]
  v128.load offset:16 align:4    [SIMD]
        v128.load32.zero    [SIMD]
   v128.load offset:64 align:4    [SIMD]
        v128.load64.zero    [SIMD]
        v128.load32.zero    [SIMD]
   v128.load offset:96 align:4    [SIMD]
        v128.load64.zero    [SIMD]

@radekdoulik
Copy link
Member Author

remaining failures are unrelated

@radekdoulik radekdoulik merged commit c41bb3f into dotnet:main Jun 13, 2023
@@ -4654,14 +4654,14 @@ emit_x86_intrinsics (
case MONO_TYPE_U:
#endif
case MONO_TYPE_I4:
case MONO_TYPE_U4: op = OP_SSE2_MOVD; break;
case MONO_TYPE_U4: op = OP_SIMD_LOAD_SCALAR_I4; break;
Copy link
Member

Choose a reason for hiding this comment

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

I know it was already this way but is there a reason this isn't handling MONO_TYPE_R4?

@ghost ghost locked as resolved and limited conversation to collaborators Jul 16, 2023
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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/dotnet/runtime/pull/87052

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy