XmainframeX

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

Discussion created by XmainframeX on Mar 1, 2011
Latest reply on Mar 1, 2011 by MicahVillmow

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?

Outcomes