nvptx offloading patches [1/n]

Bernd Schmidt bernds@codesourcery.com
Sat Nov 1 11:47:00 GMT 2014


This is one of the patches required to make offloading via the LTO path 
work when the machines involved differ.

x86 requires bigger alignments for some types than nvptx does, which 
becomes an issue when reading LTO produced by the host compiler. The 
problem with having a variable with DECL_ALIGN larger than the stack 
alignment is that gcc will try to align the variable dynamically with an 
alloca/rounding operation, and there isn't a working alloca on nvptx. 
Besides, the overhead would be pointless.

The patch below restricts the alignments to the maximum possible when 
reading in LTO data in an offload compiler. Unfortunately 
BIGGEST_ALIGNMENT isn't suitable for this, as it can vary at runtime 
with attribute((target)), and because vector modes can exceed it, so a 
limit based on BIGGEST_ALIGNMENT would be unsuitable for some ports. 
Instead I've added a hook called limit_offload_alignment which is called 
when reading LTO on an offload compiler. It does nothing anywhere except 
on ptx where it limits alignments to 64 bit.

Bootstrapped and tested on x86_64-linux. Ok?


Bernd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: align.diff
Type: text/x-patch
Size: 4545 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141101/d7f8c075/attachment.bin>


More information about the Gcc-patches mailing list