Single instruction, multiple data: Difference between revisions

Content deleted Content added
m History: Fixed typo
Tags: canned edit summary Mobile edit Mobile app edit Android app edit App select source
Line 125:
Instances of these types are immutable and in optimized code are mapped directly to SIMD registers. Operations expressed in Dart typically are compiled into a single instruction without any overhead. This is similar to C and C++ intrinsics. Benchmarks for [[4×4 matrix|4×4]] [[matrix multiplication]], [[3D vertex transformation]], and [[Mandelbrot set]] visualization show near 400% speedup compared to scalar code written in Dart.
 
McCutchan's work on Dart, now called SIMD.js, has been adopted by [[ECMAScript]] and Intel announced at IDF 2013 that they arewere implementing McCutchan's specification for both [[V8 (JavaScript engine)|V8]] and [[SpiderMonkey (JavaScript engine)|SpiderMonkey]].<ref>{{cite web |title=SIMD in JavaScript |url=https://01.org/node/1495 |website=01.org |date=8 May 2014}}</ref> However, by 2017, SIMD.js has beenwas taken out of the ECMAScript standard queue in favor of pursuing a similar interface in [[WebAssembly]].<ref>{{cite web |title=tc39/ecmascript_simd: SIMD numeric type for EcmaScript. |url=https://github.com/tc39/ecmascript_simd/ |website=GitHub |publisher=Ecma TC39 |access-date=8 September 2019 |date=22 August 2019}}</ref> AsSupport offor AugustSIMD 2020,was added to the WebAssembly interface2.0 remains unfinishedspecification, butwhich itswas portablefinished 128-biton SIMD2022 featureand hasbecame alreadyofficial seenon someDecember use in many engines2024.{{Citation needed|date=March <ref>https://webassembly.org/news/2025}}-03-20-wasm-2.0/</ref>
LLVM supports auto-vectorization of programs to automatically make use of SIMD, while SIMD intrinsic are also available.<ref>{{cite web |title=Porting SIMD code targeting WebAssembly |url=https://emscripten.org/docs/porting/simd.html |website=Emscripten 1.40.1 documentation}}</ref>
 
Emscripten, Mozilla's C/C++-to-JavaScript compiler, with extensions can enable compilation of C++ programs that make use of SIMD intrinsics or GCC-style vector code to the SIMD API of JavaScript, resulting in equivalent speedups compared to scalar code.<ref>{{cite web |title=SIMD in JavaScript via C++ and Emscripten |first1=Peter |last1=Jensen |first2=Ivan |last2=Jibaja |first3=Ningxin |last3=Hu |first4=Dan |last4=Gohman |first5=John |last5=McCutchan |year=2015 |format=PDF |url=https://docs.google.com/viewer?a=v&pid=sites&srcid=ZGVmYXVsdGRvbWFpbnx3cG12cDIwMTV8Z3g6NTkzYWE2OGNlNDAyMTRjOQ}}</ref> It also supports (and now prefers) the WebAssembly 128-bit SIMD proposal.<ref>{{cite web |title=Porting SIMD code targeting WebAssembly |url=https://emscripten.org/docs/porting/simd.html |website=Emscripten 1.40.1 documentation}}</ref>
 
==Commercial applications==