On Fri, Sep 18, 2015 at 11:13:03AM +0200, Bernd Schmidt wrote: > On 09/17/2015 04:40 PM, Nathan Sidwell wrote: > > >Added call to gomp_fatal, indicating libgomp is out of date. Also added > >a default to the switch following with the same effect. The trouble > >with implementing handling of device_type here now, is difficulty in > >testing its correctness. If it were buggy we'd be in a worse position > >than not having it. > > Is that so difficult though? See if nvptx ignores (let's say) intelmic > arguments in favour of the default and accepts nvptx ones. > > >+ if (num_waits > 8) > >+ gomp_fatal ("too many waits for legacy interface"); > >+ > >+ va_start (ap, num_waits); > >+ for (ix = 0; ix != num_waits; ix++) > >+ waits[ix] = va_arg (ap, int); > >+ waits[ix] = 0; > >+ va_end (ap); > > I still don't like this. I think there are at least two better alternatives: > add a new GOMP_LAUNCH_key which makes GOACC_parallel read a number of waits > from a va_list * pointer passed after it, or just admit that the legacy > function always does host fallback and just truncate the current version > after > > if (host_fallback) > { > goacc_save_and_set_bind (acc_device_host); > fn (hostaddrs); > goacc_restore_bind (); > return; > } > > (which incidentally ignores all the wait arguments).
Iff GCC 5 compiled offloaded OpenACC/PTX code will always do host fallback anyway because of the incompatible PTX version, then why don't you just do goacc_save_and_set_bind (acc_device_host); fn (hostaddrs); goacc_restore_bind (); and nothing else in GOACC_parallel? If it doesn't always do host fallback, then I wonder if e.g. the waits wouldn't be better represented as an array of ints, GOMP_LAUNCH_WAIT op would then encode num_waits and be followed by a va_arg (ap, int *) with num_waits entries in it. No need to pass va_list around, instead just the pointer, and the compatibility entry point would alloca an array, stuff the waits in it and pass GOMP_LAUNCH_WAIT with the allocated array. Other than that, I think Bernd has covered all the issues I had. Jakub