1

我正在读一本关于 C++ AMP 的书,但并不真正理解一些术语:

始终选择您的 tile 大小,以便最低有效维度中的线程数至少为 16,如果可以,请使用 32 甚至 64。

我在 Eigen 文档中看到过类似的术语,所以我怀疑这是很常见的用法。

所以让我们假设我有一个 2D 索引,数组,无论如何:

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

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

暂时忘记 的类型ArrayType并更多地考虑术语,哪个是该数组的重要和最不重要的维度?

4

1 回答 1

4

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.

于 2013-11-06T23:52:56.210 回答