[cfe-dev] Implementing OpenMP function variants

Doerfert, Johannes via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 18 12:25:50 PST 2019


On 12/18, John McCall wrote:
> On 18 Dec 2019, at 15:02, Doerfert, Johannes wrote:
> > On 12/18, John McCall wrote:
> > > On 18 Dec 2019, at 14:25, Doerfert, Johannes wrote:
> > > > On 12/18, John McCall wrote:
> > > > > On 18 Dec 2019, at 11:16, Doerfert, Johannes wrote:
> > > > > > Is there a good reason to make 5.1-type variants different from
> > > > > > multi-versions (as we have them)? They do not depend on
> > > > > > the lexical call
> > > > > > context but only on the compilation parameters.
> > > > > 
> > > > > Are multi-versions yet another feature?  Do they interact
> > > > > with this one?
> > > > 
> > > > In 5.1, `begin/end declare variant` multi-version a function
> > > > basically
> > > > the same way as `__attribute__((target(...)))` does. The
> > > > condition can
> > > > be more than only a target though. (I mispoke earlier, it can
> > > > include
> > > > call site context information). So we have multiple versions of a
> > > > function, let's say "sin", and depending on the compilation target,
> > > > e.g., are we compiling for nvptx or not, ans call site context,
> > > > e.g.,
> > > > are we syntacitally inside a parallel region, we pick on of
> > > > them. The
> > > > prototype for this reuses almost all of the multi-version code that
> > > > enables the target attribute as it seemed to be the natural fit.
> > > 
> > > I see.  And that’s still totally statically selected at use time,
> > > right?
> > 
> > Yes, as of OpenMP TR8 (Nov this year). But (to me) it is fairly certain
> > we'll also get an dynamic dispatch version too, maybe even this year
> > (for
> > OpenMP 5.1).
> 
> A dynamic version of `__attribute__((target))`, or of variants, or both?

A dynamic version of variants, potentially both kinds:
 The 5.0 declare variant (=different names for base and variant
 function).
 The 5.1 begin/end declare variant (=same name for base and variant
 function).

I maybe was a bit confusing earlier:
 We don't actually have __attribute__((target)) but begin/end declare
 variant is very similar in the behavior right now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191218/13b26448/attachment-0001.sig>


More information about the cfe-dev mailing list