Hi,
Assume that such simple kernel is given:
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
__kernel void sum(__global const double2 *a,__global const float2 *b,__global float2 *c){
size_t id = get_global_id(0);
c[id]=a[id]+b[id];
}
Running it on CPU works fine [implicit double to float cast performs] whereas on GPU it behaves quite unexpected. I suppose that implicit cast cannot be done in this case so I tried an explicit cast like
#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
__kernel void sum(__global const double2 *a,__global const float2 *b,__global float2 *c){
size_t id = get_global_id(0);
c[id].x = (float)a[id].x+b[id].x;
c[id].y = (float)a[id].y+b[id].y;//or even:
float2 aa;
aa.x = a[id].x;
aa.x = a[id].x;
c[id].x = aa.x+b[id].x;
c[id].y = aa.y+b[id].y;}
Both solutions are wrong - cause CL complier error or an undefined data as a result of such sum. I've also tried to use the to_float2(double2) function, but compliler complains that source and destination have different size. Does anyone have an idea why or how to avoid such issue? Is this possible at all to cast double -> float?
Originally posted by: MicahVillmow The 2.01 release only supports double math operations and IO, not casts/conversions.
Ok, thanks for pointing that. May I expect support for such operation in a future release ? If so, then when?
new version of SDK is coming soon. maybe with double and image support.
New version of SDK [2.1] is available already, but I assume nothing has changed in this case? Actually that's not what I expected. Besides that I cannot find any information that it is a bug though. Perhaps I am missing something?
Originally posted by: MicahVillmow blelump, Our double support did not change much for the 2.1 release. Conversions between double and other types will be fully supported in our next release.
Ok, thank you.