Openacc launch API

Nathan Sidwell nathan@acm.org
Tue Aug 25 13:40:00 GMT 2015


Jakub,

This patch changes the launch API for openacc parallels.  The current scheme 
passes the launch dimensions as 3 separate parameters to the GOACC_parallel 
function.  This is problematic for a couple of reasons:

1) these must be validated in the host compiler

2) they provide no extension to support a variety of different offload devices 
with different geometry requirements.

This patch changes things so that the function tables emitted by (ptx) 
mkoffloads includes the geometry triplet for each function.  This allows them to 
be validated and/or manipulated in the offload compiler.  However, this only 
works for compile-time known dimensions -- which is a common case.  To deal with 
runtime-computed dimensions we have to retain the host-side compiler's 
calculation and pass that into the GOACC_parallel function.  We change 
GOACC_parallel to take a variadic list of keyed operands ending with a sentinel 
marker.  These keyed operands have a slot for expansion to support multiple 
different offload devices.

We also extend the functionality of the 'oacc function' internal attribute. 
Rather than being a simple marker, it now has a value, which is a TREE_LIST of 
the geometry required.  The geometry is held as INTEGER_CSTs on the TREE_VALUE 
slots.  Runtime-calculated values are represented by an INTEGER_CST of zero. 
We'll also use this representation for  'routines', where the TREE_PURPOSE slot 
will be used to indicate the levels at which a routine might spawn a partitioned 
loop.  Again, to allow future expansion supporting a number of different offload 
devices, this can become a list-of-lists, keyed by and offload device 
identifier.  The offload  compiler can manipulate this data, and a later patch 
will do this within a new oacc-xform pass.

I  did rename the GOACC_parallel entry point to GOACC_parallel_keyed and provide 
a forwarding function. However, as the mkoffload data is incompatible, this is 
probably overkill.  I've had to increment the (just committed) version number to 
detect the change in data representation.  So any attempt to run an old binary 
with a new libgomp will fail at the loading point.  We could simply keep the 
same 'GOACC_parallel' name and not need any new symbols.  WDYT?

ok?

nathan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trunk-launch.patch
Type: text/x-patch
Size: 42511 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20150825/6ff47cd9/attachment.bin>


More information about the Gcc-patches mailing list