[Openmp-dev] Mapping of non-trivial type support

Itaru Kitayama via Openmp-dev openmp-dev at lists.llvm.org
Thu Aug 8 17:31:14 PDT 2019


Ravi,
Do you have a simple C++ code that does show how it is done? As I am still
inserting a line

A a;

#pragma omp target data map(alloc: a)

?

On Fri, Aug 9, 2019 at 8:28 AM Narayanaswamy, Ravi <
ravi.narayanaswamy at intel.com> wrote:

> Correct.
> We are still working on supporting function pointers which should include
> support for virtual function.
>
> You can mark the class and object with declare target and use the object
> to invoke virtual function.
> Currently you cannot pass an object through the map clause and use virtual
> function with that object.
>
> -----Original Message-----
> From: Doerfert, Johannes [mailto:jdoerfert at anl.gov]
> Sent: Thursday, August 8, 2019 4:24 PM
> To: Itaru Kitayama <itaru.kitayama at gmail.com>
> Cc: Alexey Bataev <a.bataev at hotmail.com>; openmp-dev at lists.llvm.org;
> Narayanaswamy, Ravi <ravi.narayanaswamy at intel.com>
> Subject: Re: [Openmp-dev] Mapping of non-trivial type support
>
> You mean, calling a virtual function of a mapped object?
> That is, as far as I know, not OpenMP 5.0. It might make it in 5.1 though.
> (Allocating the object on the device and then calling a virtual function
> should be fine though.)
>
> @Ravi Is this correct?
>
> ________________________________________
> From: Itaru Kitayama <itaru.kitayama at gmail.com>
> Sent: Thursday, August 8, 2019 18:15
> To: Doerfert, Johannes
> Cc: Alexey Bataev; openmp-dev at lists.llvm.org
> Subject: Re: [Openmp-dev] Mapping of non-trivial type support
>
> In which issue the virtual function offloading feature support being
> worked on? I am not certain still after going over the OpenMP 5.0 features
> list.
>
>
> On Fri, Aug 9, 2019 at 2:32 AM Doerfert, Johannes <jdoerfert at anl.gov
> <mailto:jdoerfert at anl.gov>> wrote:
> Itaru, a webpage with implementation status details is in the works,
>   https://reviews.llvm.org/D64375
> but it seems hard to agree on an initial version.
>
> On 08/05, Itaru Kitayama via Openmp-dev wrote:
> > Alexey et al.,
> > What's the plan for OpenMP 5.0 API adoption in Clang? Would you point
> > me to a link to an appropriate web page?
> > Is there an OpenMP 5.0 API work-in-progress branch which I can give it
> > a try?
> >
> > On Sun, Aug 4, 2019 at 8:57 PM Alexey Bataev <a.bataev at hotmail.com
> <mailto:a.bataev at hotmail.com>> wrote:
> >
> > > clang works in accordance with the standard. Standard says that
> > > mapping is performed as bitwise copy of the objects. You can perform
> > > the bitwise copy safely only for the trivial types.
> > > You cannot simply map a vector. You need to convert it to C/C++
> > > array at first.
> > > OpenMP 5.0 introduced user-defined mappers to solve the problem of
> > > non-trivial types mapping, which are not supported by clang yet.
> > > We're working on this feature.
> > >
> > > Best regards,
> > > Alexey Bataev
> > >
> > > > 4 авг. 2019 г., в 1:16, Itaru Kitayama via Openmp-dev <
> > > openmp-dev at lists.llvm.org<mailto:openmp-dev at lists.llvm.org>>
> написал(а):
> > > >
> > > > Hi,
> > > > This simple code:
> > > >
> > > > int main() {
> > > >
> > > > std::vector<int> v(100, 0);
> > > > #pragma omp target teams distribute parallel for map(tofrom: v)
> > > >    for (int i=0;i<100;i++) {
> > > >         v[i] =i;
> > > >    }
> > > > };
> > > >
> > > > causes Clang to warn a message like:
> > > >
> > > > vectormap.cpp:31:62: warning: Non-trivial type 'std::vector<int>'
> > > > is
> > > mapped, only trivial types are guaranteed to be mapped correctly
> > > [-Wopenmp-target]
> > > > #pragma omp target teams distribute parallel for map(tofrom: v)
> > > >
> > > >                                    ^
> > > > 1 warning generated.
> > > >
> > > > ... and encounters an issue at run time. How much non-trivial
> > > > types are supported in trunk Clang?
> > > > _______________________________________________
> > > > Openmp-dev mailing list
> > > > Openmp-dev at lists.llvm.org<mailto:Openmp-dev at lists.llvm.org>
> > > > https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
> > >
>
> > _______________________________________________
> > Openmp-dev mailing list
> > Openmp-dev at lists.llvm.org<mailto:Openmp-dev at lists.llvm.org>
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>
>
> --
>
> Johannes Doerfert
> Researcher
>
> Argonne National Laboratory
> Lemont, IL 60439, USA
>
> jdoerfert at anl.gov<mailto:jdoerfert at anl.gov>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20190809/ca979981/attachment.html>


More information about the Openmp-dev mailing list