Microsoft chose to present a new version of C++ at AFDS. It is optimised for GPUs and, potentially, all types of accelerator. Called AMP (Accelerated Massive Parallelism), this extension supplements C++0x and Parallel Patterns Library (PPL) to facilitate the writing of code which will include functions designed to be accelerated by the GPU.
Herb Sutter, Software Architect at Microsoft and C++ guru, insisted on the importance of not making the language too complex and making do with additions that were as simple as possible by making the most of what is implicit in C++ and allowing the compiler to take care of the burden linked to the use of such accelerators.
Thus, only two innovations come in at language level. The first, array_view, enables the representation of a non-uniform, incoherent and/or disjoint memory without having to specify .copy()/.sync()s explicitly. This level of abstraction will simplify the code a good deal.
The second is called restrict(). As it’s name indicates, it allows to specify restrictions linked to a certain architecture for certain functions. These concern limitations inherent in current accelerators and indicate implicitly that a piece of code has significant parallelism and can be executed on a GPU for example. Microsoft’s first version of AMP C++ builds on the in-house DirectCompute 11 API using only restrict(direct3d), restrict(cpu) being the implicit default mode. Microsoft is thinking about a restrict(pure) in the future which would have no restrictions but would declare parallelism to the compiler.
Standard code on the left, AMP C++ on the right.
No other language component will be introduced, with all the rest being implicit. For example, attaching “const” will be interpreted as “read only”. Microsoft says here however that there is currently no similar way of specifying that elements are “write only”, which could be useful in the future.
A demonstration made by Microsoft highlighted the possibility, with a single executable, of putting any type of hardware to use: CPU, GPU, APU, APU + GPU, double GPU…
All this should come with the next version of Visual Studio. Microsoft moreover intends to make AMP C++ an open standard so that it can be exploited on different platforms, whether this be at the compute interface or operating system level. Herb Sutter announced that they were working directly with AMD so that AMD could offer an FSA
version. ARM also seems interested in this development. NVIDIA seems to have been surprised by this announcement and reacted on its blog by saying that it welcomed any development that facilitates the harnessing of GPU processing power, that the initial AMP version was for DirectCompute 11 and that its GPUs would also benefit. Nothing on a CUDA version of AMP however…