eklund.n

Quick question about vector types

Discussion created by eklund.n on Nov 2, 2010
Latest reply on Nov 3, 2010 by eklund.n
Structural relation between arrays and vectors

Hi.

In AESEncryptDecrypt sample, some memory buffers are created and filled with an array of uchar. The buffer is later read from kernel, but as array of uchar4.

Can we always expect the structural layout of an array of 'type' to map into an array of 'typeX' (where X is 2-16)?

'type' ptr[nbr]; cl_mem buffer_object = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeof('type')*nbr, ptr, NULL); clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *)&buffer_object); __kernel void kernel_name(__global 'typeX' *buffer_object) {}

Outcomes