本文介绍了漏斗转移 - 是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当阅读CUDA 5.0编程指南时,我偶然发现了一个名为漏斗转移的功能,它存在于3.5计算能力的设备,但不是3.0。它包含一个注释参见参考手册,但是当我在手册中搜索漏斗移位术语时,我没有找到任何东西。

When reading through CUDA 5.0 Programming Guide I stumbled on a feature called "Funnel shift" which is present in 3.5 compute-capable device, but not 3.0. It contains an annotation "see reference manual", but when I search for the "funnel shift" term in the manual, I don't find anything.

因为它,但只有在的第8章: / p>

I tried googling for it, but only found a mention on http://www.cudahandbook.com, in the chapter 8:

GK110添加了64-可以使用以下内在函数访问的位漏斗转换指令:

GK110 added a 64-bit "funnel shift" instruction that may be accessed with the following intrinsics:

__ funnelshift_lc():返回左漏斗移位的最重要的32位。

__funnelshift_lc(): returns most significant 32 bits of a left funnel shift.

__ funnelshift_rc():返回最小有效32位右侧漏斗移位。

__funnelshift_rc(): returns least significant 32 bits of a right funnel shift.

这些内在函数实现为内联设备
函数(使用内联PTX汇编器)在sm_35_intrinsics.h中。

These intrinsics are implemented as inline device functions (using inline PTX assembler) in sm_35_intrinsics.h.

...但它仍然不解释左漏斗

...but it still does not explain what the "left funnel shift" or "right funnel shift" is.

那么,它是什么,什么地方需要它呢?

So, what is it and where does one need it?

推荐答案

在CUDA的情况下,两个32位寄存器连接在一起成为一个64位值;该值向左或向右移动;

In the case of CUDA, two 32-bit registers are concatenated together into a 64-bit value; that value is shifted left or right; and the most significant (for a left shift) or least significant (for right shift) 32 bits are returned.

sm_35_intrinsics.h的内在函数如下:

unsigned int __funnelshift_lc(unsigned int lo, unsigned int hi, unsigned int shift);
unsigned int __funnelshift_rc(unsigned int lo, unsigned int hi, unsigned int shift);

Andy Glew对渠道转移做了很好的描述:

Andy Glew has a good description of funnel shift here: http://semipublic.comp-arch.net/wiki/Funnel_shift

Glew列举了快速错位memcpy作为漏斗移位的一个应用程序;并且如上面注释中的njuffa所述,如果两个输入词相同,它可以用于实现旋转。

Glew cites fast misaligned memcpy as one application for funnel shift; and as njuffa mentions in the comments above, it can be used to implement rotate if the two input words are the same.

这篇关于漏斗转移 - 是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 19:03