pocl/pocl — pull request #12 by eschnett (2013-09-18 02:08:00+00:00)
Title: Raspberry pi

I have re-written the TARGET/HOST handling to better support certain architectures. Also, 64-bit types (long and double) are now supported on 32-bit architectures.

While my original goal was to support pocl on a Raspberry Pi, this does not yet work. Several clang problems are in the way; these are independent of pocl. However, I believe that the current modifications are valuable on their own.

TARGET/HOST handling changes: Instead of passing various TARGET variables that choose the target, configure.ac now sets two variables HOST_CLANG_FLAGS and HOST_LLC_FLAGS that choose the target. This allows more freedom; in particular, it allows choosing the CPU type, which is sometimes necessary to fully specify the ABI that should be used. If this is not done, then different files may be built with different ABIs, and the resulting kernel will not function correctly. This is an issue on x86-64 (where AVX support changes the calling convention for 32-byte vectors), or ARMv6 (where hardware floating point support changes the calling conventions for floating point values).

The architecture-specific kernel library directories do not exist any more, since they were largely unused. Vecmathlib is now used on all architectures, if enabled, and other issues such as support for the half datatype is handled with #ifdefs.

Support for 64-bit datatypes: Current versions of clang (trunk) ensure that the type "long" in OpenCL is always a 64-bit type. This makes it possible to support long and double on 32-bit architectures as well. Some of the include files (e.g. types.h) were slightly rewritten, sometimes explicitly assuming that the kernel library is built with clang. I also renamed some of the include files (using a "pocl_" prefix) to avoid naming collisions.

I also corrected a few other errors along the way that were exposed on 32-bit systems.

NOTE: vload_half and vload_store are currently implemented efficiently only for ARM, since clang does not support this on other architectures. We should use an autoconf test for this instead. I hear that this is also supported for TCE -- the respective #ifdefs in vload_half.cl and vstore_half.cl need to be updated. (I can't do this since I don't know how to detect TCE from the compiler.)