cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

XmainframeX
Journeyman III

min(1.0f, NAN) evaluates different on CPU and GPU

Just tracked down a problem in a huge OpenCL kernel and found out, that min(1.0f, NAN) evaluates different on CPU and GPU.

My system:

  • Gentoo Linux
  • fglrx 11.2
  • app-sdk 2.3
  • RV730
  • Core2 Duo

The problem appears also with this test snipped of kernel code:

__kernel void test(__global float * out)
{
    out[0] = min(1.0f, NAN);
}

On GPU out[0] contains 1.0f after the call, on CPU its nan.

The OpenCL Spec only contains a definition for fmin (which works as it should).

Is the behaviour of min intentionally undefined by the OpenCL Spec and AMDs implementation or is this a bug?

0 Likes
2 Replies
nou
Exemplar

from spec:

If x and y are infinite or NaN, the return values are undefined.

 

0 Likes

Thanks for reporting this, it will be fixed in our next SDK.
0 Likes