PDA

View Full Version : Error:-42: Argument 1 of instuction 'selp':must be register



wrx
04-13-2011, 03:58 AM
Hi,

I have this error by changing static value in the kernel by arg value :



Log = ptxas application ptx input, line 57; error : Argument 1 of instuction 'selp': must be register
ptxas application ptx input, line 57; error : Argument 2 of instuction 'selp': must be register
ptxas fatal : Ptx assembly aborted due to errors
error : Ptx compilation failed: gpu='sm_13', device code='anonymous_jit_identity'
: Retrieving binary for 'anonymous_jit_identity', for gpu='sm_13', usage mode=''
: Considering profile 'compute_10' for gpu='sm_13' in 'anonymous_jit_identity'
: Control flags for 'anonymous_jit_identity' disable search path
: Ptx binary found for 'anonymous_jit_identity', architecture='compute_10'
: Ptx compilation for 'anonymous_jit_identity', for gpu='sm_13', ocg options=''



My kernel :



#define TYPE short

__kernel void threshold(__global const TYPE *inputBuffer, __global TYPE *outputBuffer, const TYPE insideValue, const TYPE outsideValue, const TYPE thresholdHighValue, const TYPE thresholdLowValue)
{
int location = get_global_id(0);
TYPE pixel ;
if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = insideValue; // works if pixel =1000
}
else
{
pixel = outsideValue;
}
outputBuffer[location] = pixel;
}


The following codes work if pixel value is static:


if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = 1000;
}
else
{
pixel = 0;
}



if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = insideValue;
}
else
{
pixel = 0;
}




if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = 1000;
}
else
{
pixel = outsideValue;
}


, but not with both, insideValue, outsideValue together.

Every part of code for "insideValue, outsideValue, thresholdHighValue, thresholdLowValue" are the same and all value are readed well before sending to GPU.

Did you have any idea on this issue.
Thanks.

david.garcia
04-13-2011, 04:46 AM
Good job finding out what works and what doesn't :) Have you tried contacting NVidia's technical support?

wrx
04-13-2011, 05:01 AM
No, I haven't. Should I contact them?
My first contact for OpenCL problem is always here . :)

The problem propably come from me, but where? Finding a serious fault on technical aspect shouldn't be easy.
Can it be a memory problem? (I don't thing so)

david.garcia
04-13-2011, 05:09 AM
I don't see any error on your code, and even if there was, the error message from the compiler is not acceptable. You should definitely bring this to the attention of NVidia's support.

wrx
04-13-2011, 05:20 AM
OK.

The only similar error finding is here :
http://forums.nvidia.com/index.php?showtopic=174885
posted July 22, 2010 without any reply.

I'll try to contact them, and post here if any concrete solution is suggest.

wrx
04-14-2011, 01:01 AM
So, technical support suggest to register as an NVIDIA developer by click to link, where I can't :

You must have your parent or guardian complete the COPPA form and submit it to the administrator before your member account can be created.
......
Should I register here too, don't know.

Another thread funding about similar problem is here, without solution for now:
http://forums.nvidia.com/index.php?showtopic=153344

I will search a alternative ...

wrx
04-15-2011, 02:11 AM
I feel little bit like I talk to myself . :)

I don't know how name this (trick, solution, ... not really) but I will develop my working code.

Part of kernel code was :


....
if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = insideValue;
}
else
{
pixel = outsideValue;
}
outputBuffer[location] = pixel;


strangely, if I only change

pixel = outsideValue;
by,

pixel = outsideValue+1; // or +2, +50, +1000
, it works involving an offset.

BUT, this code doesn't work too :


if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = insideValue+1;
}
else
{
pixel = outsideValue+1;
}
outputBuffer[location] = pixel-1;


So, a working alternative is:


if(inputBuffer[location] < thresholdHighValue && inputBuffer[location] > thresholdLowValue)
{
pixel = insideValue;
outputBuffer[location] = pixel;
}
else
{
pixel = outsideValue+1;
outputBuffer[location] = pixel-1;
}


I don't know if this problem will be fixed later or not, but hope it can be useful to someone.

david.garcia
04-15-2011, 04:20 PM
Thanks for posting this solution in case other users find the same problem :)