SIMD/Overview: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Initial overview on SIMD)
 
(→‎JavaScript: link to Intel proposal)
Line 31: Line 31:


JavaScript currently has no support for SIMD operations. Thus developers cannot harness the awesome computational powers of SIMD-enabled CPUs.
JavaScript currently has no support for SIMD operations. Thus developers cannot harness the awesome computational powers of SIMD-enabled CPUs.
=== Proposals for SIMD support in Javascript ===
There is a proposal designed by folks at Intel (a company that happens to sell SIMD-enabled CPUs): [https://01.org/blogs/tlcounts/2014/bringing-simd-javascript https://01.org/blogs/tlcounts/2014/bringing-simd-javascript]

Revision as of 17:58, 9 April 2014

What is SIMD?

Wikipedia has a nice definition of SIMD for us:

Single instruction, multiple data (SIMD), is a class of parallel computers in Flynn's taxonomy. It describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously. Thus, such machines exploit data level parallelism, but not concurrency: there are simultaneous (parallel) computations, but only a single process (instruction) at a given moment. SIMD is particularly applicable to common tasks like adjusting the contrast in a digital image or adjusting the volume of digital audio. Most modern CPU designs include SIMD instructions in order to improve the performance of multimedia use.

In short, SIMD allows for processing several data values with one single instruction. It's a cheap way to increase the computational power of CPUs: What is mostly needed are wide ALUs (those are cheap) and comparatively little control logic.

To unlock the computation potential of modern CPUs it is essential to utilize SIMD instructions.

packed data

SIMD engines usually work with wide registers (a typical number is 128 bits) that can contain several independent values. A typical 128 bit SIMD register can contain...

  • sixteen 8 bit values (int8x16 and uint8x16)
  • eight 16 bit values (int16x8 and uint16x8)
  • four 32 bit values (int32x4 and uint32x4)
  • four single precision floating point values (float32x4)
  • two double precision floating point values (float64x2)

SIMD registers essentially contain vectors. SIMD instructions thus essentially are vector instructions. Awesome!

JavaScript

To be able to use SIMD operations one needs

  • SIMD data types
  • Operations that are defined on the SIMD data types

JavaScript currently has no support for SIMD operations. Thus developers cannot harness the awesome computational powers of SIMD-enabled CPUs.

Proposals for SIMD support in Javascript

There is a proposal designed by folks at Intel (a company that happens to sell SIMD-enabled CPUs): https://01.org/blogs/tlcounts/2014/bringing-simd-javascript