This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4] Offloading wiki page

On 07/21/2014 09:07 PM, Ilya Verbin wrote:
I've created a wiki page about offloading.  Any improvements are welcome.

It says "Immutable Page", so I can't seem to edit it. Anyway, here are my thoughts on the configure/make changes (should go into the TODO section):

The host and offload compilers need to be able to find each other. This is achieved by installing the offload compiler into special locations, and informing each about the presence of the other. All available offload compilers must first be configured with "--enable-as-accelerator-for=host-triplet", and installed into the same prefix as the host compiler. Then the host compiler is built with "--enable-offload-targets=target1,target2,..." which identifies the offload compilers that have already been built and installed.

The install locations for the offload compilers differ from those of a normal cross toolchain, by the following mapping:

bin/$target-gcc   -> bin/$host-accel-$target-gcc
lib/gcc/$target/$ver/ -> lib/gcc/$host/$ver/accel/$target

It may be necessary to compile offload compilers with a sysroot, since otherwise install locations for libgomp could clash (maybe that library needs to move into lib/gcc/..?)

A target needs to provide a mkoffload tool if it wishes to be usable as an accelerator. It is installed as one of EXTRA_PROGRAMS, and the host lto-wrapper knows how to find it from the paths described above. mkoffload will invoke the offload compiler in LTO mode to produce an offload binary from the host object files, then post-process this to produce a new object file that can be linked in with the host executable. It can find the host compiler by examining $COLLECT_GCC, and it must take care to clear this and certain other environment variables when executing the offload compiler so as to not confuse it.

The object file produced with mkoffload should contain a constructor that calls GOMP_offload_register to identify itself at run-time. Arguments to that function are a symbol called __OPENMP_TARGET__, provided by libgcc and unique per shared object, a table with information about mappings between host and offload functions and variables, and a target identifier.

[ Note: on gomp-4_0-branch, all the Makefile bits aren't entirely working at the moment since we were intending to use a slightly different scheme for nvptx. However, this is how it should work after I get some patches installed. ]

For reference, I'm attaching my current version of ptx mkoffload.


Attachment: mkoffload.c
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]