我正在读一本关于C ++ AMP的书,并没有真正理解一些术语:
始终选择您的磁贴大小,以便最不重要维度中的线程数至少为16,如果可以,则使用32或甚至64。
我在Eigen文档中看到了类似的术语,所以我怀疑这是很常见的用法。
所以让我假设我有一个2D索引,数组,无论如何:
// construct it: ArrayType my2DArray(rows,columns); // now index it: float element = my2DArray[rowIdx,colIdx];忘记了ArrayType的类型 ,并更多地考虑术语,这将是该阵列最重要和最不重要的维度?
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?
最满意答案
当在多个维度上逻辑地分配线程时,通常存在从该N维空间到线性空间的映射。 使线性空间变化最小的维度是最不重要的维度。
作为示例,可以使用表达式(Y * width + X)来确定将2维(X,Y)坐标映射到线性空间。 这里,X是最不重要的维度,Y是最重要的维度。 同样,对于三维(X,Y,Z)空间,表达式可以是(Z *宽度*高度+ Y *宽度+ X)。 在这里,X仍然是最不重要的,但Z是最重要的。 您的布局可能不一定相同,例如您可以选择将线性空间映射到(Z *宽度*高度+ X *高度+ Y),在这种情况下,Y是最不重要的维度。
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.
更多推荐
发布评论