In the Visual Studio Developer Preview release of C++ AMP several core classes (e.g., extent, array, array_view) exposed members named x, y and z and get_x(), get_y() and get_z(). All such fields/properties/member functions have been removed in the Beta release, leaving as the only option to achieve the same results usage of the subscript operator.
In C++ AMP, when talking about an index space identified by an N dimensional extent (i.e., extent<N>), the dimensions are ordered from 0 to N-1, where dimension 0 is the most significant dimension and dimension N-1 is the least significant.
The question of significance arises in the context of locality. Referencing an array with two indices which differ only by one unit in the least significant dimension results in adjacent memory references. Similarly, two threads whose ID’s only differ by one unit in the least significant dimension will typically execute close-by to each other.
Any C++ AMP function which takes dimensional data as a list of arguments, accepts them to be specified from most significant to less significant. For example, consider this specialized constructor of extent<3>:
extent(int _I0, int _I1, int _I2) restrict(cpu,amp);
To access _I0, you would write myExtent. In the Developer Preview release, we provided the shortcuts z, y and x to mean: dimension 0, dimension 1 and dimension 2, respectively. In the case of 2 dimensions, y meant dimension 0 and x meant dimension 1. And finally for the case of a single dimension, x meant dimension 0. So for example, for an extent<3> instance, instead of writing myExtent, you could have also written myExtent.z.
We have received ample feedback that the x, y, z syntax is counter-productive, and therefore decided to drop it. There were three specific objections:
If you have been following our C++ AMP samples, and following our lead, you will have noticed that none of them used x, y, z so perhaps none of your code needs updating.
For the rest of the code out there, in the table below I’ve captured in detail how this change affects Developer Preview based code, vs. Beta code.
Developer Preview Syntax
index<N> for N >= 3
extent<N> for N >= 1
Same as class index
Class grid<N> has been removed. Use extent<N> instead
array_view<N> for N >= 1
Same as class array
We hope you’ll agree that this change is for the better and the modifications necessary to your code are straight forward.
In the Beta release we are adding short-vector-types which do have the x, y, z notation familiar to HLSL and OpenGL programmers. These classes are available in the concurrency::graphics namespace and therefore are targeted at graphics programmer and adhere to the conventions used in that domain.