Problem when compiling RT_CALLABLE_PROGRAM with reference parameters

Hi, I’m porting my project from Optix3.0.1+CUDA4.0 to Optix3.5.1+CUDA5.5, however my program cannot compile properly now.

I build the project using the Optix Wizard in VS2012. If my Callable Program has reference parameters, e.g.

RT_CALLABLE_PROGRAM float3 evalBSDF(const float3& woW,const float3& wiW,uint flags)
{
	return make_float3(0.f);
}

Then the compiler will issue a warning: Pointer parameters must be inlined, so overriding noinline attribute on evalBSDF.
When I run the program, Optix will complain that it cannot find that Callable Program(because it’s inlined).

I didn’t have this problem with Optix3.0.1+CUDA4.0, can somebody tell me how to solve this? Thanks!

So I will admit that I’m not 100% sure on how callable programs work because I don’t use them often. But, your error message gives some key information.

Passing by reference requires a function to be inlined.

Take a look at the include/optix_device.h file in the SDK. RT_CALLABLE_PROGRAM is defined as device noinline. This is why there is a problem.

You can fix this by passing by value instead (even though passing by const ref is typically a good idea in most applications). Or, you can change your function to be inlined (replace RT_CALLABLE_PROGRAM with device inline) and making sure it’s included in the kernel that calls it. Note that you shouldn’t “create program” with the context on the host when doing this.

What’s your OS, bitness, exact CUDA build version, driver version, and installed GPUs?
For which SM architecture are you building the PTX?
Or better, what’s the exact nvcc command line when that happens?