Predicate variable must be in register state space

My call to clBuildProgram is failing and giving me the following error message in the build log:

Using Device (NVIDIA Corporation : GeForce GTX 260)
Failed to build program executable

BUILD LOG:
ptxas application ptx input, line 133; error : Predicate variable ‘sampleKernel_param_6’ must be in register state space
: Retrieving binary for ‘anonymous_jit_identity’, for gpu=‘sm_13’, usage mode=’’

My source file contains two kernels and two helper functions. I can provide some of the code if needed but I don’t really even know what this error relates to. I tried for a while to search for this error online but couldn’t find any information. The line number it is reporting the error at is a call to one of the helper functions but I’m not sure if it actually has anything to do with the error…


sample = complexAdd(sample, scattererContribution);


double2 complexAdd(double2 a, double2 b)
{
	double2 rv;
	rv.x = a.x + b.x;
	rv.y = a.y + b.y;
	return rv;
}

I can provide more of my code if necessary but since I didn’t know where to begin with this error I didn’t know how to narrow down the portion of the code that was incorrect.

It sounds like you are trying to pass in variables from different address spaces to a function that doesn’t support that, but from your code I’m not sure what’s going on. Take a look and see if any of the data is coming from constant or local memory, and if so, make sure the functions that use it support the right address spaces. Otherwise I’m not sure what’s up.

BUILD LOG:
ptxas application ptx input, line 133; error : Predicate variable ‘sampleKernel_param_6’ must be in register state space
: Retrieving binary for ‘anonymous_jit_identity’, for gpu=‘sm_13’, usage mode=‘’

ptxas sounds like a program which is an assembler for PTX code, which is nvidia’s low level representation code for their GPUs. On Mac OS there’s a compiler which compiles from OpenCL to PTX, and then something else which goes from PTX to GPU specific code. It wouldn’t surprise me if it was similar on other platforms too.

This means that that line number doesn’t refer to your code, but to a line in the PTX code which you don’t have access too. It’s basically useless information for you.

What might be useful is the name ‘sampleKernel_param_6’. I assume your kernel is called sampleKernel, and it looks like parameter number 6 is being used in a conditional statement, but it’s stored in global or local space. Try copying parameter 6 into a private variable before using it.

If that fails, I’m afraid you’re down to commenting parts of your shader out until you find what’s causing the problem.

This sounds like a compiler bug to me, as the system shouldn’t be generating PTX code that can’t be built.