Is there a way to guarantee that the CUDA compiler will use prediction rather than serialisation? i.e. would the following always be done with prediction;
if(condition) variableA = variableTemp;
I don’t know how to test this so I’m having to ask.
It says there is a threshold on the number of instructions allowed for prediction, but I don’t see how to test to make sure prediction is being used rather than serialisation.
I don’t think there is a way to force predication. Maybe you can do so in ptx. I believe there is some mention in the Programming Guide about predication, that seems to indicate predication is use when the code path is not too long. Otherwise it is serialized.
Well, decuda should be a quite sure way to find out, though I guess this is likely to depend on the architecture version (i.e. change with future graphic cards).
The decuda output uses the “@$pn.cond” prefix for this I think (where pn is the predicate register and cond is the condition on which the instruction behind this is executed).
I do not see any way to influence/see this in ptx, though that is no surprise since IMO the limit is likely to depend on the specific GPU (at least in the future),and the GPU-specific stuff is done in ptxas.
And please take care not to write “prediction” when you mean “predication”, while I am not sure if the later is really a valid word, the former already has a meaning, and a very different one.