OpenCL vectors on the Epiphany
Posted:
Mon Sep 02, 2013 2:13 am
by nickoppen
Hi,
OpenCL supports vector operations but I have not seen any reference to the Epiphany having any hardware support for them.
Can I write my programs using vector operations and let the compiler "de-vectorize" it?
nick
Re: OpenCL vectors on the Epiphany
Posted:
Mon Sep 02, 2013 12:32 pm
by dar
Yes, you may use common vectors like float4, int2, etc. , and the operations will be serialized. Please note the restrictions on access/swizzle operations and the GCC syntax for initializing vectors. For example, for a float4, v.x, v.y, v.z, v.w, v.xy, and v.zw are supported, but other combinations are not. The OpenCL swizzle operator breaks C compliance (and is unnecessary) so there is only so much we can get mainline GCC to support right now. Also, initializing vectors must use the GCC notation {} vs the Apple notation (). For portability you should use an initializer anyway, and one is provided, e.g., __builtin_vector_float4(x,y,z,w) which will compile to GCC or Apple notation depending on what platform you are using, if you include stdcl.h in your kernels. These __builtin_vector_*() macros are trivial, you can write them yourself to create C compliant kernels.
Re: OpenCL vectors on the Epiphany
Posted:
Wed Sep 04, 2013 11:37 am
by nickoppen
Thanks.
I don't think that I'll ever want to use the fancy stuff. My requirements are pretty straight forward and I like to keep things simple.