Microsoft has published the specification for C++ AMP (Accelerated Massive Parallelism), its new system for heterogeneous parallel processing in C++. When Microsoft first announced C++ AMP in June last year, it said that it wanted to make the AMP specification open to all.
AMP has been developed by Microsoft with input from AMD and NVIDIA. Microsoft's implementation allows AMP programs to use both the main CPU and Direct3D video cards (via the company's DirectCompute API), though the specification should also permit OpenGL/OpenCL-based implementations.
Microsoft encourages other compiler developers to implement the technology. The published specification includes within it an irrevocable promise to not assert claims on any patents that Microsoft may hold that are relevant to AMP unless the implementing party sues Microsoft for patent infringement.
AMP is some pretty cool stuff. Programs are written in C++, and blocks that should be computed in parallel (whether on the CPU or the video card) are annotated (and restricted) in various ways but are kept inline with the rest of the C++ program, and so look just like C++.
The closest equivalent to AMP is OpenCL. OpenCL is also designed for heterogeneous parallel computing, and is also not tied to any specific video card manufacturer. OpenCL is based on C rather than C++, with the GPU functions written in a restricted form of C99 rather than a restricted C++.
But OpenCL is a lot more manual and low-level. In OpenCL, the GPU functions are typically (though not always) quite separate, either in special OpenCL source code files or embedded as blocks of text within the program. Instead of calling them just like regular functions, OpenCL functions must be manually compiled at runtime. Data buffers in OpenCL must be explicitly sent to the video card, and both buffer operations and function calls must be explicitly enqueued so that the GPU can run them.
The result is that in OpenCL there's a big divide between the CPU world and the GPU world, and bridging the two requires lots of manual management by the programmer. C++ AMP makes using the GPU a lot more streamlined; the management is performed automatically, allowing developers to write more natural, high-level programs.
For heterogeneous programming to become genuinely widespread and mainstream, the kind of easy-to-use, natural integration with existing programming languages seems like a necessary step. OpenCL was a step in the right direction, but C++ AMP goes far further towards bridging CPU programming and GPU programming. Microsoft's next version of Visual C++ will include support for C++ AMP. With the publishing of the specification, along with the patent promise, the door is open to other implementations.