- Notifications
You must be signed in to change notification settings - Fork5.1k
[wasm] Initial SIMD support#70086
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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]
This will need more work, as it crashes clang during 'WebAssemblyInstruction 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'
Also add "experimental" to the property comment
What does |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Exception Handling |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ghost commentedJun 3, 2022
Tagging subscribers to 'arch-wasm':@lewing Issue DetailsAdd initial SIMD support for wasm. This is subset of the originaldraft PR without the public API additions. I left the underlying parts of new Add Add test to build and run a simple app with SIMD enabled. Example of the produced code:
The C# code:
And comparison to the non SIMD version:
Measurements of the bench-sample (aot and aot + SIMD are relevant here): browser-bench/Release configuration .NET7 May 19th *1 .NET7 May 13th + emscripten 3.1.9 + SIMD Chrome Version 101.0.4951.67 (Official Build) (64-bit)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The build, and test changes look good.
Are there benchmarks in |
These ones should see improvementshttps://github.com/dotnet/performance/blob/main/src/benchmarks/micro/libraries/System.Numerics.Vectors/Perf_VectorOfT.cs But they should be running already with bigger sets of instructions. |
Add initial SIMD support for wasm. This is subset of the originaldraft PR without the public API additions. I left the underlying parts of new
WasmBase
class implementation here as well to not loose it.Add
WasmSIMD
property to enable SIMD in AOT builds. With the property enabled, the apps built with AOT get SIMD intrinsics inlined for parts ofS.R.I.Vector128
andS.R.I.Vector128<T>
API.Add test to build and run a simple app with SIMD enabled.
Example of the produced code:
The C# code:
And comparison to the non SIMD version:
Measurements of the bench-sample (aot and aot + SIMD are relevant here):
browser-bench/Release configuration
.NET7 May 19th
*1 .NET7 May 13th + emscripten 3.1.9 + SIMD
Chrome Version 101.0.4951.67 (Official Build) (64-bit)