In OpenCL, transfer from CPU client side to GPU server side is accomplished through clEnqueueReadBuffer(...)/clEnqueueWriteBuffer(...). However, the documentation does not specify whether any endian-related conversions take place in the underlying driver.

I'm developing on x86-64, and a NVIDIA card--both little endian, so the potential problem doesn't arise for me.

Does conversion happen, or do I need to do it myself?

有帮助吗?

解决方案

The transfer do not do any conversions. The runtime does not know the type of your data.

You can probably expect conversions only on kernel arguments.

其他提示

You can query the device endianness (using clGetDeviceInfo and check CL_DEVICE_ENDIAN_LITTLE ), but I am not aware of a way that allows transparent conversions.

This is the point, where INMHO the specification is not satisfactory. At first it is clear about pointers, that is, data that a pointer is referencing can be in host or device byte order, and one can declare this by a pointer attribute, and the default byte order is that of the device. So according to this, developers have to take care of the endianness that they feed as input to a kernel. But than in "Appendix B - Portability" it's said that implementations may or may not automatically convert endianness of kernel arguments and that developers should consult the documentation of the vendors in case host and device byte order is different. Sorry for me being that direct but what shit is that. I mean the intention of the OpenXX specifications is that they should make it possible to write cross platform code. But when there are that significant asspects that can vary from implementation to implementation, this is quite not possible. The next point is, what does this all mean for OpenCL/OpenGL interoperation. In OpenGL data for buffer objects like VBO's have to be in host byte order. So what in case such a buffer is shared between OpenCL and OpenGL. Must the data of it be transformed before and after they are processed by an OpenCL kernel or not?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top