Bind arbitraty texture sizes

Hi all,

I’m trying to bind a arbitrary-sized memory buffer to a 2D texture, but this seems to fail for most texture sizes and I can’t understand why; as far as I see the docs don’t mention this at all. The bind seems to fail for most sizes (e.g. 183x183, 100x100 or 199x199) and succeeds for others (120x120, 160x160, 200x200). I’m using CUDA5 on Debian experimental (3.2.0 on a x86_64), with the 313.30 driver on a GFX Titan. In case of a failing bind I just get a vague status code indicating ‘invalid argument’.

const size_t W = 183, H = 183;
const size_t MEMSIZE = W * H * sizeof(float), PITCH = W * sizeof(float);

float* d_data;
CUDAHelper::checkError(cudaMalloc((void**) &d_data, MEMSIZE));

cudaChannelFormatDesc chD = cudaCreateChannelDesc<float>();
cudaError status =  cudaBindTexture2D(NULL, &tex, d_data, &chD, W, H,
                                PITCH);
if (status != cudaSuccess)
        std::cerr << "Error: " << cudaGetErrorString(status) << std::endl;
exit(0);

Thanks.