Host de uso constante flutuante em um kernel em CUDA
Eu estou usando o CUDA 5.0. Notei que o compilador me permitirá usar o host declaradoint constantes dentro dos kernels. No entanto, ele se recusa a compilar quaisquer kernels que usem o host declaradoflutuador constantes. Alguém sabe o motivo dessa aparente discrepância?
Por exemplo, o código a seguir é executado corretamente, mas não será compilado se a linha final no kernel não estiver comentada.
#include <cstdio>
#include <cuda_runtime.h>
static int __constant__ DEV_INT_CONSTANT = 1;
static float __constant__ DEV_FLOAT_CONSTANT = 2.0f;
static int const HST_INT_CONSTANT = 3;
static float const HST_FLOAT_CONSTANT = 4.0f;
__global__ void uselessKernel(float * val)
{
*val = 0.0f;
// Use device int and float constants
*val += DEV_INT_CONSTANT;
*val += DEV_FLOAT_CONSTANT;
// Use host int and float constants
*val += HST_INT_CONSTANT;
//*val += HST_FLOAT_CONSTANT; // won't compile if uncommented
}
int main(void)
{
float * d_val;
cudaMalloc((void **)&d_val, sizeof(float));
uselessKernel<<<1, 1>>>(d_val);
cudaFree(d_val);
}