Call by reference with kernel function parameters (NVCC in CUDA 2.2)


yesterday I have upgraded my CUDA based framework from 2.1 to 2.2. Unfortunately I encounter some problems related to reference kernel parameters.

Think of this example:

__global__ void testKernel(int& i)

{ i = 5; }

The NVCC from 2.1 accepts this code and generates working code. The 2.2 version generates the following error message:

Error	1	error C2664: '__device_stub__Z10testKerneliRiRf' : cannot convert parameter 2 from 'int' to 'int *'	C:\Temp\tmpxft_0000014c_00000000-3_test1.cudafe1.stub.c	15

Maybe this behavior is related to recent changes like…

o The default compilation mode for host code is now C++. To restore the old behavior, use the option --host-compilation=c

…because with C compilation mode NVCC accepts the code.

Can someone confirm this behavior, and if so, confirm this is a bug?

Btw… I’m using the release version of 2.2 CUDA with Visual Studio 2005.



Are use passing a value by reference from host to device? How is that even possible?

This is possible via CuPP framework, since the copy operations are done by the underlying layer.
Unfortunately nvcc no longer seems to accepts passing things via reference.