[Mesa-dev] 3 element vectors in opencl 1.1+

Jan Vesely jan.vesely at rutgers.edu
Mon Apr 21 19:02:27 PDT 2014


Hi,

I ran into a problem caused by this part of the OCL specs (6.1.5
Alignment of Types):
"For 3-component vector data types, the size of the data type is 4 *
sizeof(component)."

and the corresponding part of Khronos cl_platform.h (with all types, not
just float):
/* cl_float3 is identical in size, alignment and behavior to cl_float4.
See section 6.1.5. */
typedef  cl_float4  cl_float3;

So when I try to run kernel that takes 3 element vectors as arguments I
get 'invalid arg size' error.

Not sure whether this is best solved in clang, libclc or clover. I tried
changing float3 to have 4 elements in libclc, it caused clang to
complain in thousand places. I don't think this can be handled cleanly
in clang, unless we add something like __attribute__((padding)).

I have attached a workaround that I use now.

any advice welcome,
Jan

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: workaround.diff
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140421/ba042451/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140421/ba042451/attachment.sig>


More information about the mesa-dev mailing list