order - Fast way to swap endianness using opencl -
i'm reading , writing lots of fits , dng images may contain data of endianness different platform and/or opencl device.
currently swap byte order in host's memory if necessary slow , requires step.
is there fast way pass buffer of int/float/short having wrong endianess opencl-kernel?
using kernel run fixing endianess ok; using overheadless auto-fixing-read/-write operation perfect.
i know variable attribute ((endian(host/device))) doesn't big endian fits file on little endian platform using little endian device.
i thought solution 1 (neither implemented nor tested, yet):
uint4 mask = (uint4) (3, 2, 1, 0); uchar4 swappedendianness = shuffle(originalendianness, mask); // applied on float/int-buffer somehow
hoping there's better solution out there.
thanks in advance, runtimeterror
sure. since have uchar4 - can swizzle components , write them back.
output[tid] = input[tid].wzyx;
swizzling performant on simd architectures little cost, should able combine other operations in kernel.
hope helps!
Comments
Post a Comment