• Peter Jensen
  • Software Engineer Intel Corporation
  • Twitter
Worked on Intel's C/C++ optimizing compilers and low-level web-runtime technologies.

Session

  • SIMD Programming in JavaScript
  • Time: 2:30pm - 3:20pm | Room: Pacific LM

The leaps in JavaScript performance that has taken place over the past 5+ years has made JavaScript and HTML5 a viable platform for running many types of applications that previously required 'natively' compiled code in order to achieve acceptable performance. However, there are certain application domains that rely on clever use of SIMD (Single Instruction Multiple Data) programming for good performance. Examples of such domains are: 2D/3D graphics, physics engines, audio processing, fluid dynamics, and possibly others. These domains all require effective execution of vector/matrix operations and non-trivial vector math, such as trigonometric operations, which is why availability of SIMD operations is essential for good performance. Today, it is not possible to write JavaScript programs that utilize SIMD features in modern CPUs, without relying on various plugin solutions that interfaces to natively compiled code.

We have defined a set of low-level JavaScript SIMD APIs, which is only a slight abstraction of existing C/C++ intrinsics for doing SIMD programming directly in JavaScript. The main benefit of this API is a straightforward way for the JavaScript Virtual Machines (VMs) to map these operations to the powerful SIMD instructions in modern CPUs. A secondary benefit is reuse of existing algorithms. All the time and effort that has gone into implementing efficient algorithms utilizing SIMD via intrinsics can be reused with little effort; either through straightforward manual conversion of such algorithms or via automated translation using Emscripten. Also, the API is architecture neutral and will allow for efficient execution on different architectures that support a SIMD set of instruction; e.g. x86 and ARM.

In 2013, a joint Intel/Mozilla/Google effort successfully prototyped this SIMD JavaScript API in both Google’s V8 and Mozilla’s Spidermonkey JavaScript VMs, demonstrating impressive performance gains for kernels extracted from some of the application domains mentioned above.

It is the intent to include this JavaScript SIMD API in future versions (ES7?) of the EcmaScript standard (ECMA-262).

This talk will focus on the rationales behind the design of the API, show code examples, and present demos.

References:

EcmaScript strawman proposal
Recent blog post by Axel Rauschmayer
Bringing SIMD to JavaScript

Media

Video
Slides
Sponsors