[PATCH] D71241: [OpenMP][WIP] Use overload centric declare variants

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 11 01:57:47 PST 2019


ABataev added a comment.

In D71241#1778963 <https://reviews.llvm.org/D71241#1778963>, @jdoerfert wrote:

> In D71241#1778736 <https://reviews.llvm.org/D71241#1778736>, @ABataev wrote:
>
> > In D71241#1778717 <https://reviews.llvm.org/D71241#1778717>, @jdoerfert wrote:
> >
> > > >> There is no evidence that this is more complicated. By all measures, this is less complicated (see also below). It is also actually doing the right thing when it comes to code emission. Take https://godbolt.org/z/sJiP3B for example. The calls are wrong and the definition of base is missing.
> > > > 
> > > > How did you measure it? I have a completely different opinion. Also, tried to reproduce the problem locally, could not reproduce. It seems to me, the output of the test misses several important things. You can check it yourself. `tgt_target_teams()` call uses `@.offload_maptypes` global var but it is not defined.
> > >
> > > Here is the link with the globals not hidden: https://godbolt.org/z/5etB5S
> > >  The base function is called both times but should not be called at all. What is your local output and why does it differ?
> >
> >
> > On the host `base` is an alias for the `hst` function. On the device `base` has the body of `dev` function because NVPTX does nit support function aliases (10+ suppprts it, but LLVM does not support it yet). Try to change the bodies of dev and hst and you will see.
> >
> > I tried to keep original function names to improve debugging and make users less wonder why instead of `base` something else is called.
>
>
> How does that work with linking? Another translation unit can call both the base and hst/dev function, right? I mean they both need to be present.


If hst or dev are needed, they are emitted too, independently. On the host, the variamt function is emitted and base function is set to be an alias of the variant function. On the device we just inherit the body of the variant function, but this variant function also can be emitted, if used independently.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71241/new/

https://reviews.llvm.org/D71241





More information about the cfe-commits mailing list