Web applications such as image editors and advanced games could get a new performance boost from a graphics chip's processing power through a technology called WebCL.
Hardware acceleration is all the rage right now among browser makers: it can speed up everything from animating graphics to laying out all the elements of a Web page. Tapping directly into the hardware at a low level not only speeds things up, it saves precious battery power, too.
Now several companies are hard at work on a new interface called WebCL through the auspices of the Khronos Group standards body. WebCL is a browser-specific offshoot of a movement called GPGPU--general-purpose graphics processing unit.
Backers of WebCL aren't afraid to raise expectations.
"Providing millions of Web developers access to high-performance graphics and parallel computation will unleash a wave of creativity that will result in amazingly innovative Web applications that we haven't even imagined yet," said Neil Trevett, vice president of mobile content at graphics chipmaker Nvidia and the Khronos Group's president.
But WebCL advocates still have some persuading to do.
"We don't have plans to integrate WebCL at this point," said Mike Shaver, vice president of technical strategy at Mozilla, which has worked for years to make browsers a better foundation for more powerful Web applications. Its caution is notable given that one of its projects is WebGL, a close cousin of WebCL that's confined just to hardware-accelerated 3D graphics.
"WebGL reflects OpenGL, which is a well-understood and widely used graphics technology with a long history of interoperability," Shaver said. WebGL is based on a very mature Khronos graphics interface standard called OpenGL, but WebCL is based on the much younger OpenCL. "It's much, much earlier in OpenCL's life, and that makes it harder to say whether WebCL will let people write important new kinds of Web apps," Shaver said.
What it offers
The technology--if it comes to fruition, as appears likely for at least some browsers--won't accelerate everything under the sun. It's best suited to mathematical chores that can be broken down into independent pieces running in parallel.
Some examples of what it can offer: image processing algorithms, video game engines to simulate real-world physics, and even mining bitcoin virtual currency. Because such applications come from the Web, they arrive in a browser when you click a link--no downloading an installation file--and don't require programmers to worry about what operating system the browser is running on.
WebCL is part of a bigger trend, showing how the browser world is working hard to match what operating systems can do. That means, in short, that Web apps can be a more viable competitor to native apps. That's a particularly hot competition for developer attention when it comes to how to program apps for smartphones.
WebCL is not just an idea kicking around a standards group.
And earlier in July, Samsung contributed WebCL features to the open-source WebKit project that provides a foundation for many browsers, notably desktop and mobile browsers from Apple and Google. It's not clear yet which WebKit browsers if any will add WebCL support, but one possibility is the browser in Samsung's Bada operating system, which also is based on WebKit.
The work so far is still a long way from widespread availability--and the standardization process isn't done yet, either. And even when WebCL arrives in browsers, programmers will have to learn how to use it. So don't expect an immediate effect. When it does, though, it'll be useful, Trevett argues.
"Typical use cases would include accelerating a physics engine for a 3D game in a browser using WebGL for the graphics. Or accelerating editing HD photos or videos--smoothly and interactively, right in the browser," Trevett said.
In the cases where WebCL is useful, he predicts a significant help to battery life.
"Using a GPU instead of the CPU for image and computationally intensive tasks that can be highly parallelized can often deliver between 5 and 100 times performance increase," Trevett said. "A GPU is typically also far more efficient at highly parallel computation than general-purpose CPUs--and can deliver the same workload with a tenth of the battery consumption."
How much of that battery-life savings will actually be visible isn't yet clear--especially because game programmers have a tendency to write software that fully exploits the hardware rather than does what yesterday's games do with less power consumption.
How it works
GPUs are designed to accelerate visual tasks, for example by running programs called shaders involved in 3D graphics or converting videos into the color scheme used by a monitor. The work typically involves many similar operations proceeding in parallel.
As graphics chips grew more powerful, chipmakers such as Nvidia and AMD jumped on the idea of letting them perform more work than just graphics.
There are complications--for example, moving data into and out of the graphics chip's separate memory into the memory used by the main processor--but the idea has gained currency in programming circles.
Early attempts to use the technology were difficult, but it's become easier as higher-level interfaces arrived: Nvidia's CUDA (Compute Unified Device Architecture), Microsoft's DirectCompute, and the Khronos Group's OpenCL (Open Computing Language), an interface available in in Mac OS X.
WebCL dovetails with the WebGL project for the more limited job of 3D graphics in the browser.
Granting software downloaded from the Web access to low-level hardware adds new risks, though.
An illustration: security firm doing the same with Chrome 13. Meanwhile, ., and Khronos allies quickly updated the specification to disable the feature that led to the hole, requiring programmers who'd used it to rewrite their software. Mozilla backed out the WebGL feature with Firefox 5 to sidestep the problem, and Google, which prides itself on Chrome security, is
Security is "job one," Trevett said, and its backers are working with hardware companies to make sure their drivers--the software that enables operating systems to use their graphics hardware--are hardened against vulnerabilities. And the Web interfaces have limits not present in their native equivalents.
Don't expect Microsoft to jump aboard, though, given its expressed reservations--and its competing interfaces--DirectCompute and Direct3D for Windows and the new version of its Silverlight browser plug-in. And as Mozilla and 3D expert Gregg Tavares have observed, Silverlight and the Molehill 3D interface in the upcoming version of Flash Player .
Missing Microsoft support is a problem: when Web developers can't count on a feature being present in all browsers, they must either write different versions of their applications to adjust, or omit support for a particular browser in the first place. The first option is time-consuming, the second is limiting and potentially unpleasant for users.
Sure, it's a bit of a muddle. But given how many parties are collectively developing the future of the Web as a programming platform, a little chaos is to be expected.
"Even written directly to operating systems," Mozilla's Shaver said, "general-purpose GPU computing is still in its infancy."