【发布时间】:2016-03-06 21:36:06
【问题描述】:
我在不同的地方读到 __device__ 函数几乎总是被 CUDA 编译器内联。那么,当我将代码从内核移动到内核调用的__device__ 函数时,(通常)使用的寄存器数量没有增加是否正确?
举个例子,下面的sn-ps是否使用相同数量的寄存器?它们是否同样有效?
片段 1
__global__ void manuallyInlined(float *A,float *B,float *C,float *D,float *E) {
// code that manipulates A,B,C,D and E
}
片段 2
__device__ void fn(float *A,float *B,float *C,float *D,float *E) {
// code that manipulates A,B,C,D and E
}
__global__ void manuallyInlined(float *A,float *B,float *C,float *D,float *E) {
fn(A,B,C,D,E);
}
【问题讨论】:
标签: performance cuda inline