vector type and one dimension array in OpenCl
I'd like to implement two versions of my kernel, a vector and a scalar versions. Now I'm wondering whether let's say double4 type is similar in term of memory access to a array of double of size 4. What I have in mind is to use the same data type for my two kernels where in the scalar one I will just work on each component individually (.s0 .. .s3) like with a regular array. In other world I'd like to use OpenCl vector types for storage only in the scalar kernel and take the advantage of the vector properties in the vector kernel. I honestly don't want to have different variable types for each kernel. Does that make sense to you guys? Any hints here? Thank you,
2, 4, 8 and 16 element vectors are laid out in memory just like 2/4/8/16 scalars. The exception is 3 element vectors, which use as much memory as 4 element vectors. The main benefit of using vectors in my experience has been that all devices support some form of instruction level parallelism, either through SIMD instructions like on CPUs or through executing independent instructions simultaneously, which happens on GPUs.