Google chairman Eric Schmidt once proclaimed almost all applications would be built using HTML5 - and now it seems the web browser is about to take a step closer to that ideal.
Historically, the browser has struggled to transcend its humble origins serving documents and make the move to handling the advanced graphics processing used in tasks such as games, photo-editing suites and computer vision.
SIMD operations allow the same instruction to be carried out on multiple data simultaneously, which is faster than applying the same instruction to each piece of data individually.
That sort of parallelism is particularly useful when manipulating images - for instance, when adjusting the contrast of a picture, multiple pixels in the image need the same operation applied to them.
A wide range of game engines, as well as image- and audio-processing and cryptographic software libraries capable of supporting sophisticated applications, could run acceptably in the browser once SIMD support becomes a reality, Intel senior principal engineer Moh Haghighat said.
"Our expectation is that it's going to have a huge impact on the web domain and bring all these classes of application into the web platform," he said.
"We look forward to libraries that are really useful in such domains as games, image processing, signal processing, video processing and what Intel calls perceptual computing, such as computer vision among others. They typically are compute-intensive. They are operating on large arrays of data, and SIMD capability is going to help those applications."
Emscripten already supports the SIMD API, generating SIMD.js code from C++ code that exploits the SIMD instruction set.
Haghighat said Emscripten had been used to port game engines with "one million lines of code" to the browser, with Unreal 3 already ported and Unreal 4 in the process of being converted.
"What we've found is that it's pretty easy to get that initial version with C++, to get the very first thing running but what developers typically want to do is to optimise the experience," he said.
One optimisation is disguising the large amounts of data that needs to be downloaded before some applications can run. Gohman gives the example of a browser game using the Unity engine loading in hundred of megabytes of textures. To address this issue, some developers opt to stream in assets on the fly, loading in only as much as is needed for someone to start playing.
The SIMD API
The proposed API introduces three new data types, each representing a vector holding multiple numbers. There is float32x4, which can store four 32-bit single-precision floating-point values, int32x4, which holds four 32-bit signed integer values, and float64x2, which holds two 64-bit floating-point values. It also creates new arrays for each of these new data types.
To create an instance of these data types, the developer calls the constructor, passing it the arguments to set each of the values.
var a = SIMD.float32x4(1.0, 2.0, 3.0, 4.0);
var b = SIMD.float32x4(5.0, 6.0, 7.0, 8.0);
The developer can then carry out a range of mathematical functions on these new data types by calling the desired method. Here the variables a and b, defined above as vectors each holding four floating-point values, are added together.
var c = SIMD.float32x4.add(a,b);
The range of functions that can be carried out on these vectors include: abs, neg, add, sub, mul, div, clamp, min, max, reciprocal, reciprocalSqrt, scale, sqrt, shuffle, lessThan, lessThanOrEqual, equal, notEqual, greaterThanOrEqual, greaterThan.
Work on the SIMD API spec is ongoing and not yet finalised.
Nick Heath is chief reporter for TechRepublic. He writes about the technology that IT decision makers need to know about, and the latest happenings in the European tech scene.