OpenCL v2.2 float--->double conversion

Discussion created by ibird on Nov 17, 2010
Latest reply on Nov 29, 2010 by nou



Are float ---> double and  double----> float conversion supported in V2.2?


I ask this becasue i has a lot of problems with double float conversion.


Modifing Template to feed float instead of unsigned int


 * Sample kernel which multiplies every element of the input array with
 * a constant and stores it at the corresponding output array

#pragma OPENCL EXTENSION cl_amd_fp64 : enable

__kernel void templateKernel(__global  float * output,
                             __global  float * input,
                             const     unsigned int multiplier)

  double shift = (double)input[7];
  double ztmp;

  ztmp  =  (shift * shift) + 1.0;

  output[0] = (float)ztmp;


on CPU i get 50  ( input[7] = 7 )             OK

on GPU i get    1                                        FAIL

( same result with convert_double()  convert_float()    )


where is a work around ?