Device-side vector types can be accessed like struct types. e.g. float2 T.x, T.y.
However, the spec is silent (or I don’t see where it is mentioned) on how this maps to the host-side types e.g. cl_float2 (is it a struct? array?). The nvidia implementation I have has defined this as an array type… but I don’t see in the spec how I should know which values have been stored where… does T.x correspond to host T? T?
If this is in the spec and I didn’t see it, please point out where.
The spec does not describe the host-side types. There are only described in the cl_platform.h header file.
Thank you for your response.
This is a rather dangerous omission on the part of the spec, and hopefully it can be corrected within the specification itself. The spec should say something about how the host-side types are accessed… I don’t care about how they are implemented, but I should know what the actual mapping is. For instance, the spec should say something like “the host accesses vector types with indexing…” with a nice table that shows “x is mapped to index 0, y is mapped to index 1”, etc.
It’s rather unfortunate that a cl_float2 for instance can’t be represented as a struct on the host side, I find it easier to work with .xy addressing than [0,1].