Question

I am reading a book on C++ AMP and don't really understand some of the terminology:

Always choose your tile size so that the number of threads in the least significant dimension is at least 16, and use 32 or even 64 if you can.

I had seen similar terminology used in the Eigen documentation, so I suspect this is quite common usage.

So let's suppose I have a 2D index, array, whatever:

// construct it:
ArrayType my2DArray(rows,columns);

// now index it:
float element = my2DArray[rowIdx,colIdx];

Forgetting for a moment the type of ArrayType, and thinking more about the terminology, which would be the most and least significant dimension of that array?

Was it helpful?

Solution

When allocating threads logically in multiple dimensions, there is generally a mapping from that N-dimensional space to a linear space. The dimension that varies the linear space least is the least significant dimension.

As an example, mapping a 2-dimensional (X,Y) coordinate to linear space might be determined using the expression (Y * width + X). Here, X is the least significant dimension and Y is the most significant dimension. Likewise, for a 3-dimensional (X,Y,Z) space, the expression might be (Z * width * height + Y * width + X). Here, X is still the least significant, but Z is the most significant. Your layout may not necessarily be the same, for example you may choose to map linear space to (Z * width * height + X * height + Y), in which case Y is the least significant dimension.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top