Download OpenCL™ Optimization Guide
Transcript
optimization_guide
}
Also consider similar optimization for other constants.
Finally, avoid or minimize use of branching in short computations with using min, max, clamp or
select built-ins instead of “if and else”.
Also, optimizing specifically for the OpenCL™ Intel Graphics device, ensure all conditionals are
evaluated outside of code branches (for the CPU device it does not make any difference).
For example, the following code demonstrates conditional evaluation in the conditional blocks:
if(x && y || (z && functionCall(x, y, z))
{
// do something
}
else
{
// do something else
}
The following code demonstrates the conditional evaluation moved outside of the conditional blocks:
//improves compilation time for Intel® Graphics device
bool comparison = x && y || (z && functionCall(x, y, z));
if(comparison)
{
// do something
}
else
{
// do something else
}
See Also
Using the Preprocessor for Constants
40