cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

ibird
Adept I

OpenCL v2.2 float--->double conversion

 

 

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 ?

 

 

 

0 Likes
5 Replies

0 Likes

 

Done

 

/*!
 * 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 = convert_double(input[7]);
  double ztmp;

  ztmp  =  (shift * shift) + 1.0;

  output[0] = convert_float(ztmp);
}

 

same result

 

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

on GPU i get    1                                        FAIL

0 Likes

This is fixed in our upcoming SDK release.
0 Likes

Can we expect the next SDK release this year?

0 Likes

IMHO yes. but it is just speculation from me.

0 Likes