3 Replies Latest reply on Sep 27, 2012 3:05 AM by binying

    problems of "do while" in kernel

    qishengkiss

      Hi,

       

      I have a do while in kernel.

      a)
      __kernel(...)

      {

            bool shutdown = false;

            do

            {

                  // do something

                  shutdown = true;

            } while ( !shutdown )

      }

      The kernel will not stop, instead of stopping loop.

       

      On the other hand,

      b)

      __kernel(...)

      {

           bool shutdown = false;

           do

           {

                 // do something

                 shutdown = true;

                  if( shutdown )

                 {

                        break;

                  }

           } while ( true )

      }

      The kernel work well.

       

      Why a) do not work? isn't it supported in OpenCL kernel?