-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[wasm] Initial SIMD support #67848
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
[wasm] Initial SIMD support #67848
Conversation
The llvm code generator works nicely with them.
So that C#
WasmBase.Constant(0xff11ff22ff33ff44, 0xff55ff66ff77ff88)
is compiled into wasm code
v128.const 0xff11ff22ff33ff44ff55ff66ff77ff88 [SIMD]
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to 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. |
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
|
note for me, C#: compiles to wasm code: |
|
Shouldn't the APIs get approved first before opening a PR? |
This will need more work, as it crashes clang during 'WebAssembly
Instruction Selection' pass:
WasmApp.Native.targets(353,5): error : 3. Running pass 'WebAssembly Instruction Selection' on function '@corlib_System_Runtime_Intrinsics_Wasm_WasmBase_Shuffle_System_Runtime_Intrinsics_Vector128_1_byte_System_Runtime_Intrinsics_Vector128_1_byte_System_Runtime_Intrinsics_Vector128_1_byte'
|
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
Add initial SIMD support for wasm. This is subset of the original [draft PR](#67848) without the public API additions. Add `WasmSIMD` property to enable SIMD in AOT builds. With the property enabled, the apps built with AOT get SIMD intrinsics inlined for parts of `S.R.I.Vector128` and `S.R.I.Vector128<T>` API. Add test to build and run a simple app with SIMD enabled. * Initial wasm SIMD support * Enable Vector intrinsic on wasm The llvm code generator works nicely with them. * Add missing files * Make SIMD support conditional * Remove test code * Fix debug build * Update after merge * Add Splat and ExcractLane methods * Switch i64 values for Constant method So that C# WasmBase.Constant(0xff11ff22ff33ff44, 0xff55ff66ff77ff88) is compiled into wasm code v128.const 0xff11ff22ff33ff44ff55ff66ff77ff88 [SIMD] * Update PlatformNotSupported version of WasmBase * Fix CI build * Add ReplaceLane and Swizzle * Change WasmBase.Constant to get Vector128 as input * Add Shuffle methods This will need more work, as it crashes clang during 'WebAssembly Instruction Selection' pass: WasmApp.Native.targets(353,5): error : 3. Running pass 'WebAssembly Instruction Selection' on function '@corlib_System_Runtime_Intrinsics_Wasm_WasmBase_Shuffle_System_Runtime_Intrinsics_Vector128_1_byte_System_Runtime_Intrinsics_Vector128_1_byte_System_Runtime_Intrinsics_Vector128_1_byte' * Handle SN_Shuffle * Fix crash in OP_STOREX_MEMBASE * Add build test * Set WasmSIMD to false as default value Also add "experimental" to the property comment * Remove public API, it will be part of another PR * Add link to the llvm issue * Review feedback * Review feedback
System.Runtime.Intrinsics.Wasm WasmBase class for WebAssembly platform SIMD intrinsics
System.Runtime.Intrinsics Vector128_1 and Vector128 types support on WebAssembly